Merge branch 'v3-2-test' of ssh://jra@git.samba.org/data/git/samba into v3-2-test
[ira/wip.git] / source / configure.in
index 227ab4033db0ff169abdfa473aa61d181d878e6b..1906d7450547b16222ce7e6ccfee6c46ab21243f 100644 (file)
@@ -52,6 +52,9 @@ test "${libdir}" || libdir="\${prefix}/lib"
 pammodulesdir="\${LIBDIR}/security"
 configdir="\${LIBDIR}"
 swatdir="\${prefix}/swat"
+codepagedir="\${LIBDIR}"
+statedir="\${LOCKDIR}"
+cachedir="\${LOCKDIR}"
 
 AC_ARG_WITH(fhs,
 [  --with-fhs              Use FHS-compliant paths (default=no)],
@@ -62,10 +65,10 @@ AC_ARG_WITH(fhs,
     mandir="\${prefix}/share/man"
     logfilebase="\${VARDIR}/log/samba"
     privatedir="\${CONFIGDIR}/private"
-    libdir="\${prefix}/lib/samba"
+    test "${libdir}" || libdir="\${prefix}/lib/samba"
     configdir="\${sysconfdir}/samba"
     swatdir="\${DATADIR}/samba/swat"
-    codepagedir="\${prefix}/lib/samba"
+    codepagedir="\${LIBDIR}"
     statedir="\${VARDIR}/lib/samba"
     cachedir="\${VARDIR}/lib/samba"
     AC_DEFINE(FHS_COMPATIBLE, 1, [Whether to use fully FHS-compatible paths])
@@ -315,6 +318,15 @@ AC_SUBST(INSTALL_LIBADDNS)
 AC_SUBST(UNINSTALL_LIBADDNS)
 AC_SUBST(LIBADDNS_SHARED)
 AC_SUBST(LIBADDNS)
+
+AC_SUBST(INSTALL_LIBWBCLIENT)
+AC_SUBST(UNINSTALL_LIBWBCLIENT)
+AC_SUBST(LIBWBCLIENT_SHARED)
+AC_SUBST(LIBWBCLIENT)
+AC_SUBST(WINBIND_LIBS)
+
+AC_SUBST(LIBSAMBAUTIL_SHARED)
+
 AC_SUBST(INSTALL_LIBSMBCLIENT)
 AC_SUBST(UNINSTALL_LIBSMBCLIENT)
 AC_SUBST(LIBSMBCLIENT_SHARED)
@@ -323,6 +335,10 @@ AC_SUBST(INSTALL_LIBSMBSHAREMODES)
 AC_SUBST(UNINSTALL_LIBSMBSHAREMODES)
 AC_SUBST(LIBSMBSHAREMODES_SHARED)
 AC_SUBST(LIBSMBSHAREMODES)
+AC_SUBST(INSTALL_LIBNETAPI)
+AC_SUBST(UNINSTALL_LIBNETAPI)
+AC_SUBST(LIBNETAPI_SHARED)
+AC_SUBST(LIBNETAPI)
 AC_SUBST(PRINT_LIBS)
 AC_SUBST(AUTH_LIBS)
 AC_SUBST(ACL_LIBS)
@@ -340,6 +356,9 @@ AC_SUBST(SMBMOUNT_PROGS)
 AC_SUBST(CIFSMOUNT_PROGS)
 AC_SUBST(INSTALL_CIFSMOUNT)
 AC_SUBST(UNINSTALL_CIFSMOUNT)
+AC_SUBST(CIFSSPNEGO_PROGS)
+AC_SUBST(INSTALL_CIFSSPNEGO)
+AC_SUBST(UNINSTALL_CIFSSPNEGO)
 AC_SUBST(EXTRA_SBIN_PROGS)
 AC_SUBST(EXTRA_ALL_TARGETS)
 AC_SUBST(CONFIG_LIBS)
@@ -367,6 +386,7 @@ CFLAGS="${CFLAGS} -D_SAMBA_BUILD_=3"
 AC_LIBREPLACE_CC_CHECKS
 
 m4_include(lib/socket_wrapper/config.m4)
+m4_include(lib/nss_wrapper/config.m4)
 
 SWAT_SBIN_TARGETS='bin/swat$(EXEEXT)'
 SWAT_INSTALL_TARGETS=installswat
@@ -390,7 +410,7 @@ AC_SUBST(SWAT_INSTALL_TARGETS)
 selftest_prefix="./"
 AC_SUBST(selftest_prefix)
 AC_ARG_WITH(selftest-prefix,
-[  --with-selftest-prefix=DIR    The prefix where make test will be runned ($selftest_prefix)],
+[  --with-selftest-prefix=DIR    The prefix where make test will be run ($selftest_prefix)],
 [ case "$withval" in
   yes|no)
     AC_MSG_WARN([--with-selftest-prefix called without argument - will use default])
@@ -1288,7 +1308,7 @@ fi
 AC_CHECK_FUNCS(waitpid getcwd strdup strndup strnlen strerror chown fchown lchown chmod fchmod chroot link mknod mknod64)
 AC_CHECK_FUNCS(strtol strtoll strtoul strtoull strtouq __strtoull)
 AC_CHECK_FUNCS(fstat strchr utime utimes chflags)
-AC_CHECK_FUNCS(getrlimit fsync memset strlcpy strlcat setpgid)
+AC_CHECK_FUNCS(getrlimit fsync fdatasync memset strlcpy strlcat setpgid)
 AC_CHECK_FUNCS(memmove vsnprintf snprintf asprintf vasprintf setsid glob strpbrk pipe crypt16 getauthuid)
 AC_CHECK_FUNCS(strftime sigprocmask sigblock sigaction sigset innetgr setnetgrent getnetgrent endnetgrent)
 AC_CHECK_FUNCS(initgroups select poll rdchk getgrnam getgrent pathconf realpath)
@@ -3039,6 +3059,7 @@ fi
 dnl test for ipv6
 AC_CACHE_CHECK([for ipv6 support],samba_cv_HAVE_IPV6,[
 AC_TRY_COMPILE([
+#include <stdlib.h> /* for NULL */
 #include <sys/socket.h>
 #include <sys/types.h>
 #include <netdb.h>],
@@ -3223,24 +3244,6 @@ if test x"$samba_cv_HAVE_STAT_ST_FLAGS" = x"yes"; then
                [Whether the stat struct has a st_flags member])
 fi
 
-case "$host_os" in
-*linux*)
-AC_CACHE_CHECK([for broken RedHat 7.2 system header files],samba_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS,[
-AC_TRY_COMPILE([
-#ifdef HAVE_SYS_VFS_H
-#include <sys/vfs.h>
-#endif
-#ifdef HAVE_SYS_CAPABILITY_H
-#include <sys/capability.h>
-#endif
-],[int i;],
-   samba_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS=no,samba_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS=yes)])
-if test x"$samba_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS" = x"yes"; then
-   AC_DEFINE(BROKEN_REDHAT_7_SYSTEM_HEADERS,1,[Broken RedHat 7.2 system header files])
-fi
-;;
-esac
-
 AC_CACHE_CHECK([for broken nisplus include files],samba_cv_BROKEN_NISPLUS_INCLUDE_FILES,[
 AC_TRY_COMPILE([
 #include <sys/types.h>
@@ -3655,10 +3658,12 @@ if test x"$with_ads_support" != x"no"; then
           KRB5_CFLAGS="-I/usr/include/heimdal"
           KRB5_CPPFLAGS="-I/usr/include/heimdal"
           KRB5_LDFLAGS="-L/usr/lib/heimdal/lib"
+         FOUND_KRB5=yes
           AC_MSG_RESULT(yes)
       else
           KRB5_CFLAGS="-I/usr/include/heimdal"
           KRB5_CPPFLAGS="-I/usr/include/heimdal"
+         FOUND_KRB5=yes
           AC_MSG_RESULT(yes)
       fi
     else
@@ -3674,6 +3679,21 @@ if test x"$with_ads_support" != x"no"; then
       KRB5_LDFLAGS="-L/usr/kerberos/lib"
       KRB5_CFLAGS="-I/usr/kerberos/include"
       KRB5_CPPFLAGS="-I/usr/kerberos/include"
+      FOUND_KRB5=yes
+      AC_MSG_RESULT(yes)
+    else
+      AC_MSG_RESULT(no)
+    fi
+  fi
+
+  if test x$FOUND_KRB5 = x"no"; then
+    #################################################
+    # see if this box has the OpenBSD location for heimdal krb5
+    AC_MSG_CHECKING(for /usr/include/kerberosV)
+    if test -d /usr/include/kerberosV; then
+      KRB5_CPPFLAGS="-I/usr/include/kerberosV"
+      KRB5_LIBS="-lcrypto"
+      FOUND_KRB5=yes
       AC_MSG_RESULT(yes)
     else
       AC_MSG_RESULT(no)
@@ -4214,6 +4234,30 @@ if test x"$with_ads_support" != x"no"; then
     fi
   fi
 
+  AC_CACHE_CHECK([for krb5_principal_get_realm],
+                samba_cv_HAVE_KRB5_PRINCIPAL_GET_REALM,[
+    AC_TRY_LINK([#include <krb5.h>],
+      [krb5_context ctx = NULL; krb5_principal princ = NULL; const char *str = krb5_principal_get_realm(ctx, princ);],
+      samba_cv_HAVE_KRB5_PRINCIPAL_GET_REALM=yes,
+      samba_cv_HAVE_KRB5_PRINCIPAL_GET_REALM=no)])
+
+  if test x"$samba_cv_HAVE_KRB5_PRINCIPAL_GET_REALM" = x"yes"; then
+    AC_DEFINE(HAVE_KRB5_PRINCIPAL_GET_REALM,1,
+               [Whether the function krb5_principal_get_realm is defined])
+  fi
+
+  AC_CACHE_CHECK([for krb5_princ_realm],
+                samba_cv_HAVE_KRB5_PRINC_REALM,[
+    AC_TRY_LINK([#include <krb5.h>],
+      [krb5_context ctx = NULL; krb5_principal princ = NULL; const char *str = krb5_princ_realm(ctx, princ)->data;],
+      samba_cv_HAVE_KRB5_PRINC_REALM=yes,
+      samba_cv_HAVE_KRB5_PRINC_REALM=no)])
+
+  if test x"$samba_cv_HAVE_KRB5_PRINC_REALM" = x"yes"; then
+    AC_DEFINE(HAVE_KRB5_PRINC_REALM,1,
+               [Whether the macro krb5_princ_realm is defined])
+  fi
+
   #
   #
   # Now the decisions whether we can support krb5
@@ -4454,6 +4498,45 @@ AC_ARG_WITH(cifsmount,
   esac ]
 )
 
+#################################################
+# check for cifs.spnego support
+AC_CHECK_HEADERS([keyutils.h], [HAVE_KEYUTILS_H=1], [HAVE_KEYUTILS_H=0])
+CIFSSPNEGO_PROGS=""
+INSTALL_CIFSSPNEGO=""
+UNINSTALL_CIFSSPNEGO=""
+AC_MSG_CHECKING(whether to build cifs.spnego)
+AC_ARG_WITH(cifsspnego,
+[  --with-cifsspnego       Include cifs.spnego (Linux only) support (default=no)],
+[ case "$withval" in
+  no)
+       AC_MSG_RESULT(no)
+       ;;
+  *)
+       case "$host_os" in
+       *linux*)
+               if test x"$use_ads" != x"yes"; then
+                       AC_MSG_ERROR(ADS support should be enabled for building cifs.spnego)
+               elif test x"$HAVE_KEYUTILS_H" != "x1"; then
+                       AC_MSG_ERROR(keyutils package is required for cifs.spnego)
+               else
+                       AC_MSG_RESULT(yes)
+                       AC_DEFINE(WITH_CIFSSPNEGO,1,[whether to build cifs.spnego])
+                       CIFSSPNEGO_PROGS="bin/cifs.spnego"
+                       INSTALL_CIFSSPNEGO="installcifsspnego"
+                       UNINSTALL_CIFSSPNEGO="uninstallcifsspnego"
+               fi
+               ;;
+       *)
+               AC_MSG_ERROR(not on a linux system!)
+               ;;
+       esac
+    ;;
+  esac ],
+[
+  AC_MSG_RESULT(no)
+  ]
+)
+
 
 #################################################
 # Check for a PAM clear-text auth, accounts, password
@@ -4996,6 +5079,51 @@ if test $enable_static = yes; then
        UNINSTALLLIBCMD_A="rm -f"
 fi
 
+#################################################
+# should we build libnetapi?
+INSTALL_LIBNETAPI=
+UNINSTALL_LIBNETAPI=
+LIBNETAPI_SHARED=
+LIBNETAPI=
+AC_MSG_CHECKING(whether to build the libnetapi shared library)
+AC_ARG_WITH(libnetapi,
+[  --with-libnetapi         Build the libnetapi shared library (default=no undefined API)],
+[ case "$withval" in
+  *)
+     AC_MSG_RESULT(no)
+     ;;
+  yes)
+     if test $BLDSHARED = true; then
+        LIBNETAPI_SHARED=bin/libnetapi.$SHLIBEXT
+        LIBNETAPI=libnetapi
+        AC_MSG_RESULT(yes)
+     else
+       enable_static=yes
+        AC_MSG_RESULT(no shared library support -- will supply static library)
+     fi
+     if test $enable_static = yes; then
+        LIBNETAPI=libnetapi
+     fi
+     INSTALL_LIBNETAPI=installlibnetapi
+     UNINSTALL_LIBNETAPI=uninstalllibnetapi
+     ;;
+  esac ],
+[
+# if unspecified, default is to built it if possible.
+  if test $BLDSHARED = true; then
+     LIBNETAPI_SHARED=bin/libnetapi.$SHLIBEXT
+     LIBNETAPI=libnetapi
+     AC_MSG_RESULT(yes)
+   else
+     enable_static=yes
+     AC_MSG_RESULT(no shared library support -- will supply static library)
+   fi
+   if test $enable_static = yes; then
+     LIBNETAPI=libnetapi
+  fi]
+  INSTALL_LIBNETAPI=installlibnetapi
+)
+
 #################################################
 # should we build libaddns?
 INSTALL_LIBADDNS=
@@ -5024,11 +5152,13 @@ AC_ARG_WITH(libaddns,
      INSTALL_LIBADDNS=installlibaddns
      UNINSTALL_LIBADDNS=uninstalllibaddns
      ;;
-  esac ]
+  esac ],
+[AC_MSG_RESULT(no)]
 )
 
 #################################################
 # should we build libsmbclient?
+
 INSTALL_LIBSMBCLIENT=
 UNINSTALL_LIBSMBCLIENT=
 LIBSMBCLIENT_SHARED=
@@ -5115,6 +5245,7 @@ AC_ARG_WITH(libsmbsharemodes,
   INSTALL_LIBSMBSHAREMODES=installlibsmbsharemodes
 )
 
+
 #################################################
 # these tests are taken from the GNU fileutils package
 AC_CHECKING(how to get filesystem space usage)
@@ -6014,6 +6145,14 @@ fi
 
 if test $BLDSHARED = true -a x"$HAVE_WINBIND" = x"yes"; then
        NSS_MODULES="${WINBIND_NSS} ${WINBIND_WINS_NSS}"
+       ## Only worry about libwbclient if we have shared library support
+       ## and winbindd
+        LIBWBCLIENT_SHARED=bin/libwbclient.$SHLIBEXT
+        LIBWBCLIENT=libwbclient
+       INSTALL_LIBWBCLIENT=installlibwbclient
+       UNINSTALL_LIBWBCLIENT=uninstalllibwbclient
+       WINBIND_LIBS="-lwbclient"
+       LDFLAGS="$LDFLAGS -L./bin"
 fi
 
 if test x"$HAVE_WINBIND" = x"yes"; then
@@ -6115,6 +6254,41 @@ AC_SUBST(BUILD_POPT)
 AC_SUBST(POPTLIBS)
 AC_SUBST(FLAGS1)
 
+#################################################
+# Check if user wants DNS service discovery support
+
+AC_ARG_ENABLE(dnssd,
+[  --enable-dnssd          Enable DNS service discovery support (default=auto)])
+
+AC_SUBST(DNSSD_LIBS)
+if test x"$enable_dnssd" != x"no"; then
+    have_dnssd_support=yes
+
+    AC_CHECK_HEADERS(dns_sd.h)
+    if test x"$ac_cv_header_dns_sd_h" != x"yes"; then
+       have_dnssd_support=no
+    fi
+
+    # On Darwin the DNSSD API is in libc, but on other platforms it's
+    # probably in -ldns_sd
+    AC_CHECK_FUNCS(DNSServiceRegister)
+    AC_CHECK_LIB_EXT(dns_sd, DNSSD_LIBS, DNSServiceRegister)
+    if test x"$ac_cv_func_DNSServiceRegister" != x"yes" -a \
+            x"$ac_cv_lib_ext_DNSServiceRegister" != x"yes"; then
+       have_dnssd_support=no
+    fi
+
+    if test x"$have_dnssd_support" = x"yes"; then
+       AC_DEFINE(WITH_DNSSD_SUPPORT, 1,
+               [Whether to enable DNS service discovery support])
+    else
+       if test x"$enable_dnssd" = x"yes"; then
+           AC_MSG_ERROR(DNS service discovery support not available)
+       fi
+    fi
+
+fi
+
 #################################################
 # Check to see if we should use the included iniparser
 
@@ -6421,6 +6595,9 @@ fi
 if test x"$with_dnsupdate_support" != x"no"; then
     AC_MSG_RESULT([    UUID_LIBS = $UUID_LIBS])
 fi
+if test x"$have_dnssd_support" != x"no"; then
+    AC_MSG_RESULT([    DNSSD_LIBS = $DNSSD_LIBS])
+fi
 AC_MSG_RESULT([    AUTH_LIBS = $AUTH_LIBS])
 
 #################################################
@@ -6446,7 +6623,11 @@ AC_SUBST(builddir)
 SMBD_LIBS="$samba_dmapi_libs"
 AC_SUBST(SMBD_LIBS)
 
-AC_OUTPUT(Makefile library-versions script/findsmb smbadduser script/gen-8bit-gap.sh script/installbin.sh script/uninstallbin.sh)
+AC_OUTPUT(Makefile library-versions
+         script/findsmb smbadduser script/gen-8bit-gap.sh script/installbin.sh script/uninstallbin.sh
+         lib/netapi/examples/Makefile
+         pkgconfig/smbclient.pc pkgconfig/netapi.pc pkgconfig/smbsharemodes.pc
+         )
 
 #################################################
 # Print very concise instructions on building/use