Do not do a merged build without shared libs
[ira/wip.git] / source3 / configure.in
index 12808eb6f56802220020fc1418e9f74894a7cc5f..44374b989cb4091efb129cf8fb0635e054cb73a4 100644 (file)
@@ -116,9 +116,10 @@ AC_SUBST(LIBWBCLIENT_SHARED_TARGET)
 AC_SUBST(LIBWBCLIENT_SHARED)
 AC_SUBST(LIBWBCLIENT_STATIC_TARGET)
 AC_SUBST(LIBWBCLIENT_STATIC)
+AC_SUBST(LIBWBCLIENT_TARGET)
 AC_SUBST(LIBWBCLIENT_SOVER)
 AC_SUBST(LIBWBCLIENT)
-AC_SUBST(WINBIND_LIBS)
+AC_SUBST(LIBWBCLIENT_LIBS)
 
 AC_SUBST(LIBSAMBAUTIL_SHARED)
 
@@ -152,12 +153,12 @@ AC_SUBST(NSCD_LIBS)
 # do this here since AC_CACHE_CHECK apparently sets the CFLAGS to "-g -O2"
 # if it has no value.  This prevent *very* large debug binaries from occurring
 # by default.
-if test "x$CFLAGS" = x; then
-  CFLAGS="-O"
-fi
 if test "x$debug" = "xyes" ; then
        CFLAGS="${CFLAGS} -g"
 fi
+if test "x$CFLAGS" = x; then
+  CFLAGS="-O"
+fi
 
 m4_include(../lib/socket_wrapper/config.m4)
 m4_include(../lib/nss_wrapper/config.m4)
@@ -283,7 +284,7 @@ if test "$ac_cv_prog_gnu_ld" = "yes"; then
         else
            AC_MSG_CHECKING(GNU ld release version)
            changequote(,)dnl
-           ac_cv_gnu_ld_vernr=`echo $ac_cv_gnu_ld_version | sed -n 's,^.*[^0-9\.]\+\([1-9][0-9]*\.[0-9][0-9]*\).*$,\1,p'`
+           ac_cv_gnu_ld_vernr=`echo $ac_cv_gnu_ld_version | sed -n 's,^[^0-9]*\([1-9][0-9]*\.[0-9][0-9]*\).*$,\1,p'`
            ac_cv_gnu_ld_vernr_major=`echo $ac_cv_gnu_ld_vernr | cut -d '.' -f 1`
            ac_cv_gnu_ld_vernr_minor=`echo $ac_cv_gnu_ld_vernr | cut -d '.' -f 2`
            changequote([,])dnl
@@ -578,6 +579,15 @@ exit(1);
       fi
     ;;
 
+# Systems with LFS support.
+#
+    gnu* | k*bsd*-gnu | kopensolaris*-gnu)
+       CPPFLAGS="-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE $CPPFLAGS"
+       AC_DEFINE(_LARGEFILE64_SOURCE, 1, [Whether to enable large file support])
+       AC_DEFINE(_FILE_OFFSET_BITS, 64, [File offset bits])
+       AC_DEFINE(_GNU_SOURCE, 1, [Whether to use GNU libc extensions])
+       ;;
+
 # Tests for linux LFS support. Need kernel 2.4 and glibc2.2 or greater support.
 #
     *linux*)
@@ -670,6 +680,7 @@ SAVE_CPPFLAGS="${CPPFLAGS}"
 CPPFLAGS="${CPPFLAGS} ${SAMBA_CONFIGURE_CPPFLAGS}"
 
 AC_LIBREPLACE_BROKEN_CHECKS
+AC_CHECK_FUNCS([syslog],[],[AC_MSG_ERROR([Required function not found])])
 AC_LIBREPLACE_NETWORK_CHECKS
 
 CPPFLAGS="${SAVE_CPPFLAGS}"
@@ -788,6 +799,7 @@ if test x$enable_cups != xno; then
                        x"$ac_cv_header_cups_language_h" = xyes; then
                        AC_DEFINE(HAVE_CUPS,1,[Whether we have CUPS])
                        samba_cv_HAVE_CUPS=yes
+                       AC_CHECK_LIB_EXT(cups, PRINT_LIBS, httpConnectEncrypt)
                else
                        AC_MSG_WARN([cups-config around but cups-devel not installed])
                        CFLAGS=$ac_save_CFLAGS
@@ -1240,7 +1252,7 @@ AC_DEFINE(HAVE_PRCTL, 1, [Whether prctl is available]),[])
 #
 #
 case "$host_os" in
-    *linux*)
+    *linux* | gnu* | k*bsd*-gnu | kopensolaris*-gnu)
        # glibc <= 2.3.2 has a broken getgrouplist
        AC_TRY_RUN([
 #include <unistd.h>
@@ -1539,7 +1551,10 @@ DSO_EXPORTS=""
 
   # and these are for particular systems
   case "$host_os" in
-               *linux*)   AC_DEFINE(LINUX,1,[Whether the host os is linux])
+               *linux* | gnu* | k*bsd*-gnu | kopensolaris*-gnu)
+                       case "$host_os" in *linux*)
+                               AC_DEFINE(LINUX,1,[Whether the host os is linux]) ;;
+                       esac
                        BLDSHARED="true"
                        if test "${ac_cv_gnu_ld_no_default_allow_shlib_undefined}" = "yes"; then
                                LDSHFLAGS="-shared -Wl,-Bsymbolic -Wl,--allow-shlib-undefined"
@@ -1789,6 +1804,7 @@ if test x"$BLDSHARED" != x"true"; then
        SHLD="shared-libraries-disabled"
        PICFLAG="${PIE_CFLAGS}"
        SHLIBEXT="shared_libraries_disabled"
+       merged_build_possible=no
 fi
 
 AC_MSG_CHECKING([used PICFLAG])
@@ -2437,7 +2453,7 @@ if test x$enable_fam != xno; then
     if test x"$samba_cv_HAVE_LIBFAM" = x"yes" ; then
         default_shared_modules="$default_shared_modules vfs_notify_fam"
         AC_TRY_COMPILE([#include <fam.h>],
-                    [FAMCodes code = FAMChanged;],
+                    [enum FAMCodes code = FAMChanged;],
                     AC_DEFINE(HAVE_FAM_H_FAMCODES_TYPEDEF, 1,
                         [Whether fam.h contains a typedef for enum FAMCodes]),
                     [])
@@ -2865,11 +2881,12 @@ AC_ARG_WITH(fake-kaserver,
 if test x"$samba_cv_WITH_AFS" != x"no" ||
    test x"$samba_cv_WITH_FAKE_KASERVER" != x"no"; then
 
+    # see if this box has the OpenSSL DES libraries
+    AC_CHECK_LIB( crypto, DES_pcbc_encrypt, LIBS="$LIBS -lcrypto" , [AC_ERROR(OpenSSL library: libcrypto ot found!)] )
+
     # see if this box has the afs-headers in /usr/include/afs
     AC_MSG_CHECKING(for /usr/include/afs)
     if test -d /usr/include/afs; then
-          CFLAGS="$CFLAGS -I/usr/include/afs"
-          CPPFLAGS="$CPPFLAGS -I/usr/include/afs"
           AC_MSG_RESULT(yes)
     else
       AC_MSG_RESULT(no)
@@ -3311,7 +3328,9 @@ if test x"$with_ads_support" != x"no"; then
   AC_CHECK_HEADERS(krb5/locate_plugin.h)
   if test x"$ac_cv_header_krb5_locate_plugin_h" = x"yes"; then
        WINBIND_KRB5_LOCATOR="bin/winbind_krb5_locator.$SHLIBEXT"
-       EXTRA_ALL_TARGETS="$EXTRA_ALL_TARGETS $WINBIND_KRB5_LOCATOR"
+       if test x"$BLDSHARED" = x"true" ; then
+               EXTRA_ALL_TARGETS="$EXTRA_ALL_TARGETS $WINBIND_KRB5_LOCATOR"
+       fi
   fi
 fi
 
@@ -3919,6 +3938,10 @@ if test x"$with_ads_support" != x"no"; then
 LIBS="$ac_save_LIBS"
 fi
 
+if test x"$use_ads" != xyes; then
+       merged_build_possible=no
+fi
+
 AC_CHECK_LIB_EXT(nscd, NSCD_LIBS, nscd_flush_cache)
 PASSDB_LIBS="$PASSDB_LIBS $NSCD_LIBS"
 
@@ -5383,7 +5406,7 @@ AC_ARG_WITH(sendfile-support,
        AC_MSG_RESULT(yes);
 
        case "$host_os" in
-       *linux*)
+       *linux* | gnu* | k*bsd*-gnu | kopensolaris*-gnu)
                AC_CACHE_CHECK([for linux sendfile64 support],samba_cv_HAVE_SENDFILE64,[
                AC_TRY_LINK([#include <sys/sendfile.h>],
 [\
@@ -5695,6 +5718,16 @@ fi
 
 AC_HAVE_DECL(splice, [#include <fcntl.h>])
 
+############################################
+# See if we have the a broken readlink syscall.
+
+AC_CACHE_CHECK([for a broken readlink syscall],samba_cv_HAVE_BROKEN_READLINK,[
+AC_TRY_RUN([#include "${srcdir-.}/../tests/readlink.c"],
+       samba_cv_HAVE_BROKEN_READLINK=no,samba_cv_HAVE_BROKEN_READLINK=yes,samba_cv_HAVE_BROKEN_READLINK=cross)
+])
+if test x"$samba_cv_HAVE_BROKEN_READLINK" = x"yes"; then
+       AC_DEFINE(HAVE_BROKEN_READLINK,1,[Whether the readlink syscall is broken])
+fi
 
 #################################################
 # Check whether winbind is supported on this platform.  If so we need to
@@ -5744,7 +5777,7 @@ NSSSONAMEVERSIONSUFFIX=""
 WINBIND_NSS_PTHREAD=""
 
 case "$host_os" in
-       *linux*)
+       *linux* | gnu* | k*bsd*-gnu | kopensolaris*-gnu)
                NSSSONAMEVERSIONSUFFIX=".2"
                WINBIND_NSS_EXTRA_OBJS="../nsswitch/winbind_nss_linux.o"
                ;;
@@ -5840,8 +5873,8 @@ if test x"$HAVE_WINBIND" = x"no"; then
 fi
 if test x"$HAVE_WBCLIENT" = x"yes"; then
         AC_CHECK_LIB(wbclient, wbcInterfaceDetails,
-                    [WINBIND_LIBS="-lwbclient"], AC_MSG_ERROR([Could not find wbclient]), [$WBCLIENT_LDFLAGS])
-       WINBIND_LIBS="$WINBIND_LIBS $WBCLIENT_LDFLAGS"
+                    [LIBWBCLIENT_LIBS="-lwbclient"], AC_MSG_ERROR([Could not find wbclient]), [$WBCLIENT_LDFLAGS])
+       LIBWBCLIENT_LIBS="$LIBWBCLIENT_LIBS $WBCLIENT_LDFLAGS"
        AC_MSG_RESULT(yes)
        AC_DEFINE(WITH_WINBIND,1,[Whether to link to wbclient])
        EXTRA_BIN_PROGS="$EXTRA_BIN_PROGS bin/wbinfo\$(EXEEXT)"
@@ -5860,12 +5893,15 @@ else
                ## Only worry about libwbclient if we have shared
                # library support
                LIBWBCLIENT_SHARED=$LIBWBCLIENT_SHARED_TARGET
+               LIBWBCLIENT_TARGET=$LIBWBCLIENT_SHARED_TARGET
                LIBWBCLIENT=libwbclient
                INSTALL_LIBWBCLIENT=installlibwbclient
                UNINSTALL_LIBWBCLIENT=uninstalllibwbclient
-               WINBIND_LIBS="-lwbclient"
+               LIBWBCLIENT_LIBS="-lwbclient"
        else
                LIBWBCLIENT_STATIC=$LIBWBCLIENT_STATIC_TARGET
+               LIBWBCLIENT_TARGET=$LIBWBCLIENT_STATIC_TARGET
+               LIBWBCLIENT_LIBS=$LIBWBCLIENT_STATIC_TARGET
        fi
 fi
 
@@ -5885,7 +5921,9 @@ else
 fi
 
 AC_CHECK_LIB(pthread, pthread_mutex_lock, [WINBIND_NSS_PTHREAD="-lpthread"
-                       AC_DEFINE(HAVE_PTHREAD, 1, [whether pthread exists])])
+                       AC_DEFINE(HAVE_PTHREAD, 1, [whether pthread exists])
+                       samba_cv_HAVE_PTHREAD=yes],
+                       samba_cv_HAVE_PTHREAD=no)
 
 AC_SUBST(WINBIND_NSS_PTHREAD)
 AC_SUBST(WINBIND_NSS)
@@ -5973,10 +6011,10 @@ AC_SUBST(FLAGS1)
 # Check if user wants DNS service discovery support
 
 AC_ARG_ENABLE(dnssd,
-[AS_HELP_STRING([--enable-dnssd], [Enable DNS service discovery support (default=auto)])])
+[AS_HELP_STRING([--enable-dnssd], [Enable DNS service discovery support (default=no)])])
 
 AC_SUBST(DNSSD_LIBS)
-if test x"$enable_dnssd" != x"no"; then
+if test x"$enable_dnssd" = x"yes"; then
     have_dnssd_support=yes
 
     AC_CHECK_HEADERS(dns_sd.h)
@@ -6004,6 +6042,56 @@ if test x"$enable_dnssd" != x"no"; then
 
 fi
 
+#################################################
+# Check if user wants avahi support
+
+AC_ARG_ENABLE(avahi,
+[AS_HELP_STRING([--enable-avahi], [Enable Avahi support (default=auto)])])
+
+AC_SUBST(AVAHI_LIBS)
+if test x"$enable_avahi" != x"no"; then
+    have_avahi_support=yes
+
+    AC_CHECK_HEADERS(avahi-common/watch.h)
+    if test x"$ac_cv_header_avahi_common_watch_h" != x"yes"; then
+       have_avahi_support=no
+    fi
+
+    AC_CHECK_HEADERS(avahi-client/client.h)
+    if test x"$ac_cv_header_avahi_common_watch_h" != x"yes"; then
+       have_avahi_support=no
+    fi
+
+    AC_CHECK_LIB_EXT(avahi-client, AVAHI_LIBS, avahi_client_new)
+    if test x"$ac_cv_lib_ext_avahi_client_avahi_client_new" != x"yes"; then
+       have_avahi_support=no
+    fi
+
+    if test x"$have_avahi_support" = x"yes"; then
+       AC_DEFINE(WITH_AVAHI_SUPPORT, 1,
+               [Whether to enable avahi support])
+       AC_SUBST(AVAHI_OBJ, "lib/avahi.o smbd/avahi_register.o")
+    else
+       if test x"$enable_avahi" = x"yes"; then
+           AC_MSG_ERROR(avahi support not available)
+       fi
+    fi
+fi
+
+#################################################
+# Check if user wants pthreadpool support
+
+AC_ARG_ENABLE(pthreadpool,
+[AS_HELP_STRING([--enable-pthreadpool], [Enable pthreads pool helper support (default=auto)])])
+
+if test x"$enable_pthreadpool" != x"no" -a x"$samba_cv_HAVE_PTHREAD" = x"yes"; then
+    AC_TRY_LINK([#include "pthread.h"],
+    [pthread_create(NULL, NULL, NULL, NULL)],
+                   ,LIBS="$LIBS -lpthread")
+    AC_DEFINE(WITH_PTHREADPOOL, 1, [Whether to include pthreadpool helpers])
+    AC_SUBST(PTHREADPOOL_OBJ, "lib/pthreadpool.o")
+fi
+
 #################################################
 # Check to see if we should use the included iniparser
 
@@ -6114,6 +6202,12 @@ AC_ARG_WITH(shared-modules,
        done
 fi ])
 
+if test x"$MODULE_DEFAULT_vfs_notify_fam" = xSTATIC -o \
+               x"$MODULE_vfs_notify_fam" = xSTATIC ; then
+       SMBD_FAM_LIBS="$SMB_FAM_LIBS"
+       AC_SUBST(SMBD_FAM_LIBS)
+fi
+
 SMB_MODULE(pdb_ldap, passdb/pdb_ldap.o passdb/pdb_nds.o, "bin/ldapsam.$SHLIBEXT", PDB,
                   [ PASSDB_LIBS="$PASSDB_LIBS $LDAP_LIBS" ] )
 SMB_MODULE(pdb_smbpasswd, passdb/pdb_smbpasswd.o, "bin/smbpasswd.$SHLIBEXT", PDB)
@@ -6320,6 +6414,11 @@ AC_ARG_ENABLE(merged-build,
 [AS_HELP_STRING([--enable-merged-build], [Build Samba 4 as well])], 
 [ enable_merged_build=$enableval ], [ enable_merged_build=auto ])
 
+if test x"$enable_merged_build" = x"yes" -a \
+       x"$merged_build_possible" = x"no" ; then
+       AC_MSG_ERROR(Merged build required but not possible)
+fi
+
 m4_include(../lib/zlib/zlib.m4)
 
 if test x$enable_merged_build = xauto; then