--icondir) ICONDIR=$var;;
--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;;
--enable-notification) NOTIFY=yes;;
--disable-notification) NOTIFY=no;;
--help) echo "See the README file for available options"; exit 0;;
fi
echo "Using compiler .. $CC"
-if ! type "$CC" >/dev/null 2>&1; then
- echo "$CC is not an executable"
+cat <<EOF >_test.c
+int main(void) {
+ return 0;
+}
+EOF
+_CC=false
+if $CC _test.c -o _test >/dev/null 2>&1; then
+ [ -x _test ] && _CC=true
+fi
+rm -f _test.c _test
+if ! $_CC; then
+ echo "$CC does not create executables"
exit 1
fi
[ "$CC" != cc ] && echo "CC= $CC" >>$CONFIG_MK
mirbsd*|openbsd*);; # OpenBSD has many redundant decs in system headers
*) echo "CFLAGS+= -Wredundant-decls" >>$CONFIG_MK;;
esac
+else
+ # Disable assertations
+ echo "CFLAGS+= -DNDEBUG" >>$CONFIG_MK
fi
# Add CPPFLAGS and CFLAGS to CC for testing features
XCC="$CC `$SED -n -e 's/CPPLAGS+=*\(.*\)/\1/p' $CONFIG_MK`"
XCC="$XCC `$SED -n -e 's/CFLAGS+=*\(.*\)/\1/p' $CONFIG_MK`"
+if [ -z "$GETTEXT" ]; then
+ printf "Testing for gettext ... "
+ cat <<EOF >_gettext.c
+#include <libintl.h>
+int main(void) {
+ gettext("foo");
+ return 0;
+}
+EOF
+ LIB_INTL=
+ if $XCC _gettext.c -o _gettext 2>/dev/null; then
+ GETTEXT=yes
+ 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
+ echo "$GETTEXT"
+ rm -f _gettext.c _gettext
+fi
+if [ "$GETTEXT" != no ]; then
+ echo "#define HAS_GETTEXT" >>$CONFIG_H
+ echo "LIB_INTL= $LIB_INTL" >>$CONFIG_MK
+fi
+
if [ -z "$STRLCPY" ]; then
printf "Testing for strlcpy ... "
cat <<EOF >_strlcpy.c
rm -f _strlcpy.c _strlcpy
fi
if [ "$STRLCPY" = no ]; then
- echo "#define strlcpy(dst, src, n) snprintf(dst, n, \"%s\", src)" \
- >>$CONFIG_H
+ echo "#define strlcpy(dst, src, n) " \
+ "((size_t)snprintf(dst, n, \"%s\", src))" \
+ >>$CONFIG_H
fi
if [ -z "$LIBDIR" ]; then
# 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
-echo "DBus CFLAGS=$DBUS_CFLAGS"
-echo "DBus LIBS=$DBUS_LIBS"
-echo "DBUS_CFLAGS= $DBUS_CFLAGS" >>$CONFIG_MK
-echo "DBUS_LIBS= $DBUS_LIBS" >>$CONFIG_MK
+echo "LDADD+= -Wl,--as-needed" >>$CONFIG_MK
UI=
if [ "$WITH_GTK" = yes -o -z "$WITH_GTK" ]; then
exit 1
fi
fi
-
-if [ -n "$WITH_GTK" ]; then
- PKG="dbus-1 $WITH_GTK"
+
+if [ -n "$WITH_GTK" -a "$WITH_GTK" != no ]; then
+ PKG="$WITH_GTK"
if [ "$NOTIFY" = yes ]; then
PKG="$PKG${PKG:+ }libnotify"
echo "NOTIFY= -DNOTIFY" >>$CONFIG_MK
UI="$UI${UI:+ }dhcpcd-gtk"
fi
-if [ -z "$UI" ]; then
- echo "$0: no UI is available, not building." >&2
- exit 1
+DHCPCD_QT=false
+if [ "WITH_QT" = yes -o -z "$WITH_QT" ]; then
+ if type qmake >/dev/null 2>&1; then
+ UI="$UI${UI+ }dhcpcd-qt"
+ DHCPCD_QT=true
+ fi
+elif [ -n "$WITH_QT" -a "$WITH_QT" != no ]; then
+ if type qmake >/dev/null 2>&1; then
+ UI="$UI${UI+ }dhcpcd-qt"
+ DHCPCD_QT=true
+ else
+ echo "$0: no suitable QT library has been found" >&2
+ exit 1
+ fi
+fi
+
+if [ -n "$UI" ]; then
+ echo "ICONS= icons" >>$CONFIG_MK
fi
-echo "UI= $UI" >>config.mk
+echo "UI= $UI" >>$CONFIG_MK
echo
echo " SYSCONFDIR = $SYSCONFDIR"
echo
echo "MKDIR= \${TOPDIR}/mk" >>$CONFIG_MK
+
+if $DHCPCD_QT; 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
+fi