Add a man page for dhcpcd-gtk.
[dhcpcd-ui] / configure
index e1c35412c3d4363fd8fd331e923ec58b0431dc9b..0e85ec729a6c8e6537ae0e685c135ab91aafbc46 100755 (executable)
--- a/configure
+++ b/configure
@@ -6,6 +6,7 @@ DEBUG=
 LIBDHCPCD=no
 WITH_GTK=
 NOTIFY=yes
+INCLUDEDIR=
 
 for x; do
        opt=${x%%=*}
@@ -17,7 +18,7 @@ for x; do
        --debug) DEBUG=$var;;
        --disable-debug) DEBUG=no;;
        --enable-debug) DEBUG=yes;;
-       --prefix) PREFIX=$var;;
+       --prefix) prefix=$var;;
        --sysconfdir) SYSCONFDIR=$var;;
        --bindir) BINDIR=$var;;
        --libexecdir) LIBEXECDIR=$var;;
@@ -30,7 +31,9 @@ for x; do
        --host) HOST=$var;;
        --target) TARGET=$var;;
        --libdir) LIBDIR=$var;;
+       --includedir) eval INCLUDEDIR="$INCLUDEDIR${INCLUDEDIR:+ }$var";;
        --datadir|--infodir) ;; # ignore autotools
+       --disable-maintainer-mode|--disable-dependency-tracking) ;;
        --icondir) ICONDIR=$var;;
        --with-gtk|--with-gtk+) WITH_GTK=${var:-yes};;
        --without-gtk|--without-gtk+) WITH_GTK=no;;
@@ -44,7 +47,7 @@ done
 : ${INSTALL:=install}
 : ${SED:=sed}
 
-: ${PREFIX:=/usr/local}
+: ${PREFIX:=${prefix:=/usr/local}}
 : ${SYSCONFDIR:=$PREFIX/etc}
 : ${BINDIR:=$PREFIX/bin}
 : ${LIBEXECDIR:=$PREFIX/libexec}
@@ -53,6 +56,14 @@ done
 
 : ${ICONDIR:=$PREFIX/share/dhcpcd/icons}
 
+eval SYSCONFDIR="$SYSCONFDIR"
+eval LIBDIR="$LIBDIR"
+eval LIBEXECDIR="$LIBEXECDIR"
+eval STATEDIR="$STATEDIR"
+eval DBDIR="$DBDIR"
+eval RUNDIR="$RUNDIR"
+eval MANDIR="$MANDIR"
+
 _which()
 {
        x="$(which "$1" 2>/dev/null)"
@@ -90,11 +101,26 @@ if [ -z "$OS" ]; then
        # Derive OS from cpu-manufacturer-os-kernel
        CPU=${TARGET%%-*}
        REST=${TARGET#*-}
-       MANU=${REST%%-*}
-       REST=${REST#*-}
-       OS=${REST%%-*}
-       REST=${REST#*-}
-       KERNEL=${REST%%-*}
+       if [ "$CPU" != "$REST" ]; then
+               MANU=${REST%%-*}
+               REST=${REST#*-}
+               if [ "$MANU" != "$REST" ]; then
+                       OS=${REST%%-*}
+                       REST=${REST#*-}
+                       if [ "$OS" != "$REST" ]; then
+                               KERNEL=${REST%%-*}
+                       else
+                               # 3 tupple
+                               KERNEL=$OS
+                               OS=$MANU
+                               MANU=
+                       fi
+               else
+                       # 2 tupple
+                       OS=$MANU
+                       MANU=
+               fi
+       fi
 fi
 
 echo "Configuring dhcpcd-ui for ... $OS"
@@ -102,6 +128,9 @@ rm -f $CONFIG_H $CONFIG_MK
 echo "# $OS" >$CONFIG_MK
 echo "/* $OS */" >$CONFIG_H
 
+VERSION=$($SED -ne 's/VERSION= //p' Makefile)
+echo "#define VERSION \"$VERSION\"" >>$CONFIG_H
+
 for x in PREFIX SYSCONFDIR BINDIR ICONDIR; do
        eval v=\$$x
        # Make files look nice for import
@@ -113,6 +142,7 @@ for x in PREFIX SYSCONFDIR BINDIR ICONDIR; do
        [ $l -gt 2 ] && t="     "
        echo "#define $x$t      \"$v\"" >>$CONFIG_H
 done
+echo "MANDIR=          ${MANDIR}" >>$CONFIG_MK
 
 if [ -z "$CC" ]; then
        printf "Looking for compiler ... "
@@ -143,6 +173,9 @@ echo "CFLAGS=               $CFLAGS" >>$CONFIG_MK
 if [ -n "$CPPLAGS" ]; then
        echo "CPPLAGS=          $CPPLAGS" >>$CONFIG_MK
 fi
+for x in $INCLUDEDIR; do
+       echo "CPPFLAGS+=        -I$x" >>$CONFIG_MK
+done
 
 if [ -n "$DEBUG" -a "$DEBUG" != no -a "$DEBUG" != false ]; then
        echo "Enabling memory debugging"
@@ -219,6 +252,10 @@ else
 fi
 echo "LIB_DHCPCD=      $x" >>$CONFIG_MK
 
+# Due to our use of pkg-config, pass --as-needed to ld so we only link
+# what we actually need.
+echo "LDADD+=  -Wl,--as-needed" >>$CONFIG_MK
+
 # Get DBus CFLAGS
 DBUS_CFLAGS=$(pkg-config --cflags dbus-1) || exit 1
 DBUS_LIBS=$(pkg-config --libs dbus-1) || exit 1
@@ -256,6 +293,7 @@ echo "   SYSCONFDIR =               $SYSCONFDIR"
 echo "   BINDIR =              $BINDIR"
 echo "   LIBDIR =              $LIBDIR"
 echo "   ICONDIR =             $ICONDIR"
+echo "   MANDIR =              $MANDIR"
 echo "   UI =                  $UI"
 echo