Always include all clients in SUBDIRS and use conditionals instead.
[doldaconnect.git] / configure.in
index 67dafb5..2d2017f 100644 (file)
@@ -3,6 +3,8 @@ AM_INIT_AUTOMAKE([doldaconnect], [0.4])
 AM_CONFIG_HEADER(config.h)
 
 AC_PROG_CC
+AC_PROG_CC_C_O
+AM_PROG_CC_C_O
 AC_PROG_INSTALL
 
 AM_GNU_GETTEXT_VERSION(0.12.1)
@@ -11,14 +13,13 @@ AM_GNU_GETTEXT([external])
 # Temporary hack to make libtool not check for g++ or g77
 m4_defun([_LT_AC_LANG_CXX_CONFIG], true)
 m4_defun([_LT_AC_LANG_F77_CONFIG], true)
-AM_PROG_LIBTOOL
+AC_PROG_LIBTOOL
 
 AC_CHECK_LIB(pam, pam_start, , AC_MSG_ERROR([*** must have PAM]))
 AC_CHECK_LIB(z, deflate, , AC_MSG_ERROR([*** must have zlib]))
 AC_CHECK_LIB(bz2, BZ2_bzWriteOpen, , AC_MSG_ERROR([*** must have bzlib]))
 AC_CHECK_LIB(gdbm, gdbm_open, , AC_MSG_ERROR([*** must have gdbm]))
 
-clients=
 extlibs=
 experimental=no
 
@@ -38,12 +39,14 @@ if test "$HAS_GTK2" != no; then
                        AC_MSG_RESULT(no)
                        HAS_GTK2=no
                fi
+               GTK2_LDADD="`pkg-config --libs gtk+-2.0`"
+               GTK2_CFLAGS="`pkg-config --cflags gtk+-2.0`"
                if test "$HAS_GTK2" != no; then
-                       AC_CHECK_LIB(gtk-x11-2.0, gtk_init, [HAS_GTK2=yes], [HAS_GTK2=no], `pkg-config --libs gtk+-2.0`)
+                       AC_CHECK_LIB(gtk-x11-2.0, gtk_init, [HAS_GTK2=yes], [HAS_GTK2=no], "$GTK2_LDADD")
                fi
                if test "$HAS_GTK2" = yes; then
                        cpp_bak="$CPPFLAGS"
-                       CPPFLAGS="$CPPFLAGS `pkg-config --cflags gtk+-2.0`"
+                       CPPFLAGS="$CPPFLAGS $GTK2_CFLAGS"
                        AC_CHECK_HEADER(gtk/gtk.h, [], [HAS_GTK2=no])
                        CPPFLAGS="$cpp_bak"
                fi
@@ -54,6 +57,7 @@ fi
 if test "$with_gtk2" = yes -a "$HAS_GTK2" = no; then
        AC_MSG_ERROR([*** cannot find GTK2 on this system])
 fi
+AC_SUBST([GTK2_LDADD GTK2_CFLAGS])
 
 # libxml2 check
 AC_MSG_CHECKING([for libxml2 package information])
@@ -64,13 +68,16 @@ if test "$PKG_CONFIG" = yes; then
                AC_MSG_RESULT(no)
                HAS_LIBXML=no
        fi
+       LIBXML_LDADD="`pkg-config --libs libxml-2.0`"
+       LIBXML_CFLAGS="`pkg-config --cflags libxml-2.0`"
        if test "$HAS_LIBXML" != no; then
-               AC_CHECK_LIB(xml2, xmlReadFile, [HAS_LIBXML=yes], [HAS_LIBXML=no], `pkg-config --libs libxml-2.0`)
+               AC_CHECK_LIB(xml2, xmlReadFile, [HAS_LIBXML=yes], [HAS_LIBXML=no], "$LIBXML_LDADD")
        fi
 else
        AC_MSG_RESULT(no)
        HAS_LIBXML=no
 fi
+AC_SUBST([LIBXML_LDADD LIBXML_CFLAGS])
 
 # libnotify check
 AC_MSG_CHECKING([for libnotify package information])
@@ -100,10 +107,10 @@ if test "$enable_gtk2ui" = yes; then
                AC_MSG_ERROR([*** the GTK2 UI needs libxml2])
        fi
 fi
-if test "$enable_gtk2ui" != no -a "$HAS_GTK2" = yes; then
-       clients="$clients gtk2"
+if test "$enable_gtk2ui" != no -a "$HAS_GTK2" = yes -a "$HAS_LIBXML" = yes; then
        gtk2ui_msg=Yes
 fi
+AM_CONDITIONAL(CLI_GTK2, test "$gtk2ui_msg" = Yes)
 
 # Dolconf check
 dolconf_msg=No
@@ -112,11 +119,9 @@ if test "$enable_dolconf" = yes -a "$HAS_GTK2" = no; then
        AC_MSG_ERROR([*** cannot build dolconf without GTK2])
 fi
 if test "$enable_dolconf" != no -a "$HAS_GTK2" = yes; then
-       AM_CONDITIONAL(DOLCONF, true)
        dolconf_msg=Yes
-else
-       AM_CONDITIONAL(DOLCONF, false)
 fi
+AM_CONDITIONAL(DOLCONF, test "$dolconf_msg" = Yes)
 
 # Gtk progress bar check
 gtk2pbar_msg=No
@@ -137,8 +142,8 @@ AC_ARG_ENABLE(gnomeapplet, [  --enable-gnomeapplet    Enable GNOME transfer appl
 if test "$enable_gnomeapplet" = yes; then
        experimental=yes
        gnometrapplet_msg=Yes
-       clients="$clients gnome-trans-applet"
 fi
+AM_CONDITIONAL(CLI_GNOMEAPPLET, test "$gnometrapplet_msg" = Yes)
 
 # Gaim plugin check
 gaimplugin_msg=No
@@ -146,8 +151,8 @@ AC_ARG_ENABLE(gaimplugin, [  --enable-gaimplugin     Enable GNOME transfer apple
 if test "$enable_gaimplugin" = yes; then
        experimental=yes
        gaimplugin_msg=Yes
-       clients="$clients gaim"
 fi
+AM_CONDITIONAL(CLI_GAIM, test "$gaimplugin_msg" = Yes)
 
 # Guile check (XXX: Shouldn't have to be enabled manually)
 guile_msg=No
@@ -216,6 +221,21 @@ AH_TEMPLATE(HAVE_KEYUTILS, [define if your system supports the Linux keyring fun
 AC_CHECK_LIB(keyutils, keyctl_search, [ AC_DEFINE(HAVE_KEYUTILS)
                                        LDFLAGS="$LDFLAGS -lkeyutils" ])
 
+# Unix credentials selector
+AH_TEMPLATE(UNIX_AUTH_STYLE, [undefine for no Unix auth, 1 for Linux style, 2 for BSD style])
+AC_CHECK_MEMBER(struct ucred.pid, [ linuxcreds=y ], [ linuxcreds=n ], [#include <sys/socket.h>])
+AC_CHECK_FUNC(getpeereid, [ bsdcreds=y ], [ bsdcreds=n ])
+AC_MSG_CHECKING([for Unix auth style])
+if test $linuxcreds = y; then
+       AC_DEFINE(UNIX_AUTH_STYLE, 1)
+       AC_MSG_RESULT(linux)
+elif test $bsdcreds = y; then
+       AC_DEFINE(UNIX_AUTH_STYLE, 2)
+       AC_MSG_RESULT(bsd)
+else
+       AC_MSG_RESULT(none)
+fi
+
 AC_HEADER_STDC
 AC_HEADER_DIRENT
 AC_HEADER_SYS_WAIT
@@ -227,7 +247,7 @@ AC_TYPE_SIGNAL
 
 CPPFLAGS="-I\$(top_srcdir)/include $CPPFLAGS"
 
-AC_SUBST([clients extlibs])
+AC_SUBST([extlibs])
 AC_OUTPUT([
 Makefile
 autopackage/Makefile
@@ -238,6 +258,7 @@ lib/guile/Makefile
 lib/guile/dolcon/Makefile
 clients/Makefile
 clients/gtk2/Makefile
+clients/tty/Makefile
 clients/gnome-trans-applet/Makefile
 clients/gaim/Makefile
 include/Makefile