Fix --without-icons
[dhcpcd-ui] / configure
index 7279906913bbac98476a4cff5fcec7999579518c..bcc9dd92487070d2da0ded687e285261324c6417 100755 (executable)
--- a/configure
+++ b/configure
@@ -4,9 +4,13 @@
 # Ensure that we do not inherit these from env
 DEBUG=
 LIBDHCPCD=no
+WITH_DHCPCD_ONLINE=yes
 WITH_GTK=
+WITH_QT=
+WITH_ICONS=
 NOTIFY=yes
 INCLUDEDIR=
+UI=
 
 for x; do
        opt=${x%%=*}
@@ -34,9 +38,14 @@ for x; do
        --includedir) eval INCLUDEDIR="$INCLUDEDIR${INCLUDEDIR:+ }$var";;
        --datadir|--infodir) ;; # ignore autotools
        --disable-maintainer-mode|--disable-dependency-tracking) ;;
-       --icondir) ICONDIR=$var;;
+       --with-dhcpcd-online) WITH_DHCPCD_ONLINE=${var:-yes};;
+       --without-dhcpcd-online) WITH_DHCPCD_ONLINE=no;;
        --with-gtk|--with-gtk+) WITH_GTK=${var:-yes};;
        --without-gtk|--without-gtk+) WITH_GTK=no;;
+       --with-qt) WITH_QT=${var:-yes};;
+       --without-qt) WITH_QT=no;;
+       --with-icons) WITH_ICONS=${var:-yes};;
+       --without-icons) WITH_ICONS=no;;
        --enable-notification) NOTIFY=yes;;
        --disable-notification) NOTIFY=no;;
        --help) echo "See the README file for available options"; exit 0;;
@@ -125,9 +134,9 @@ echo "# $OS" >$CONFIG_MK
 echo "/* $OS */" >$CONFIG_H
 
 VERSION=$($SED -ne 's/VERSION= //p' Makefile)
-echo "#define VERSION \"$VERSION\"" >>$CONFIG_H
+echo "#define VERSION          \"$VERSION\"" >>$CONFIG_H
 
-for x in PREFIX SYSCONFDIR BINDIR ICONDIR; do
+for x in PREFIX SYSCONFDIR BINDIR; do
        eval v=\$$x
        # Make files look nice for import
        l=$((10 - ${#x}))
@@ -138,7 +147,8 @@ 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
+echo "#define ICONDIR          \"$ICONDIR\"" >>$CONFIG_H
+echo "MANDIR=          $MANDIR" >>$CONFIG_MK
 
 # Always obey CC.
 # However, if CC is not specified and we are given GNU style
@@ -252,6 +262,7 @@ EOF
        elif $XCC _gettext.c -o _gettext -lintl 2>/dev/null; then
                GETTEXT="yes (-lintl)"
                LIB_INTL=-lintl
+               QMAKE_CONFIG="CONFIG+=has_libintl"
        else
                GETTEXT=no
        fi
@@ -315,7 +326,6 @@ echo "LIB_DHCPCD=   $x" >>$CONFIG_MK
 # what we actually need.
 echo "LDADD+=          -Wl,--as-needed" >>$CONFIG_MK
 
-UI=
 if [ "$WITH_GTK" = yes -o -z "$WITH_GTK" ]; then
        if pkg-config --cflags gtk+-2.0 >/dev/null 2>&1; then
                WITH_GTK="gtk+-2.0"
@@ -329,7 +339,7 @@ elif [ -n "$WITH_GTK" -a "$WITH_GTK" != no ]; then
        fi
 fi
        
-if [ -n "$WITH_GTK" ]; then
+if [ -n "$WITH_GTK" -a "$WITH_GTK" != no ]; then
        PKG="$WITH_GTK"
        if [ "$NOTIFY" = yes ]; then
                PKG="$PKG${PKG:+ }libnotify"
@@ -362,11 +372,17 @@ elif [ -n "$WITH_QT" -a "$WITH_QT" != no ]; then
        fi
 fi
 
-if [ -z "$UI" ]; then
-       echo "$0: no UI is available, not building." >&2
-       exit 1
+if [ -n "$UI" -a -z "$WITH_ICONS" ]; then
+       WITH_ICONS=yes
+fi
+if [ "$WITH_ICONS" = yes ]; then
+       echo "MKICONS=  icons" >>$CONFIG_MK
+fi
+
+if [ -n "$WITH_DHCPCD_ONLINE" -a "$WITH_DHCPCD_ONLINE" != no ]; then
+       UI="dhcpcd-online${UI:+ }$UI"
 fi
-echo "UI=              $UI" >>config.mk
+echo "UI=              ${UI:+libdhcpcd }$UI" >>$CONFIG_MK
 
 echo
 echo "   SYSCONFDIR =          $SYSCONFDIR"
@@ -380,7 +396,8 @@ echo
 echo "MKDIR=           \${TOPDIR}/mk" >>$CONFIG_MK
 
 if $DHCPCD_QT; then
-       if ! (cd src/dhcpcd-qt; qmake dhcpcd-qt.pro); then
+       QMAKE_CONFIG="$QMAKE_CONFIG PREFIX=$PREFIX MANDIR=$MANDIR"
+       if ! (cd src/dhcpcd-qt; qmake $QMAKE_CONFIG dhcpcd-qt.pro); then
                echo "$0: failed to configure dhcpcd-qt" >&2
                exit 1
        fi