ѕ3:configure: use gettimeofday check from lib/util/
[ira/wip.git] / source3 / configure.in
index f624e0ef5d6831a712c98222bc5586b96b87500d..e3f53b45c2b8b711d4554bff47024c81c5f648ae 100644 (file)
@@ -120,6 +120,7 @@ fi
 
 m4_include(../lib/socket_wrapper/config.m4)
 m4_include(../lib/nss_wrapper/config.m4)
+m4_include(../lib/util/time.m4)
 
 m4_include(m4/swat.m4)
 
@@ -1057,7 +1058,7 @@ AC_CHECK_FUNCS(setsid glob strpbrk crypt16 getauthuid)
 AC_CHECK_FUNCS(sigprocmask sigblock sigaction sigset innetgr setnetgrent getnetgrent endnetgrent)
 AC_CHECK_FUNCS(initgroups select poll rdchk getgrnam getgrent pathconf)
 AC_CHECK_FUNCS(setpriv setgidx setuidx setgroups sysconf stat64 fstat64)
-AC_CHECK_FUNCS(lstat64 fopen64 atexit grantpt lseek64 ftruncate64)
+AC_CHECK_FUNCS(lstat64 fopen64 atexit grantpt lseek64 ftruncate64 posix_fallocate posix_fallocate64)
 AC_CHECK_FUNCS(fseek64 fseeko64 ftell64 ftello64 setluid getpwanam)
 AC_CHECK_FUNCS(opendir64 readdir64 seekdir64 telldir64 rewinddir64 closedir64)
 AC_CHECK_FUNCS(getpwent_r)
@@ -1066,7 +1067,7 @@ AC_CHECK_FUNCS(setenv strcasecmp fcvt fcvtl)
 AC_CHECK_FUNCS(syslog vsyslog timegm)
 AC_CHECK_FUNCS(setlocale nl_langinfo)
 AC_CHECK_FUNCS(nanosleep,,[AC_CHECK_LIB_EXT(rt, LIBS, nanosleep)])
-AC_CHECK_FUNCS(utimensat)
+AC_CHECK_FUNCS(lutimes futimes utimensat futimens)
 AC_CHECK_FUNCS(mlock munlock mlockall munlockall)
 AC_CHECK_FUNCS(memalign posix_memalign hstrerror)
 AC_CHECK_HEADERS(sys/mman.h)
@@ -1244,7 +1245,7 @@ AC_DEFINE(HAVE_PRCTL, 1, [Whether prctl is available]),[])
 case "$host_os" in
     *linux* | gnu* | k*bsd*-gnu | kopensolaris*-gnu)
        # glibc <= 2.3.2 has a broken getgrouplist
-       AC_TRY_RUN([
+       AC_CACHE_CHECK([for good getgrouplist],samba_cv_linux_getgrouplist_ok,[AC_TRY_RUN([
 #include <unistd.h>
 #include <sys/utsname.h>
 main() {
@@ -1260,8 +1261,8 @@ main() {
 #endif
        exit(0);
 }
-], [linux_getgrouplist_ok=yes], [linux_getgrouplist_ok=no])
-       if test x"$linux_getgrouplist_ok" = x"yes"; then
+], [samba_cv_linux_getgrouplist_ok=yes], [samba_cv_linux_getgrouplist_ok=no])])
+       if test x"$samba_cv_linux_getgrouplist_ok" = x"yes"; then
           AC_DEFINE(HAVE_GETGROUPLIST, 1, [Have good getgrouplist])
        fi
        ;;
@@ -1541,9 +1542,10 @@ DSO_EXPORTS=""
 
   # and these are for particular systems
   case "$host_os" in
-               *linux* | gnu* | k*bsd*-gnu | kopensolaris*-gnu)
-                       case "$host_os" in *linux*)
-                               AC_DEFINE(LINUX,1,[Whether the host os is linux]) ;;
+               *linux* | gnu* | k*bsd*-gnu | kopensolaris*-gnu | *qnx*)
+                       case "$host_os" in
+                               *linux*) AC_DEFINE(LINUX,1,[Whether the host os is linux]) ;;
+                               *qnx*) AC_DEFINE(QNX,1,[Whether the host os is qnx]) ;;
                        esac
                        BLDSHARED="true"
                        LDSHFLAGS="-shared -Wl,-Bsymbolic"
@@ -1656,9 +1658,6 @@ DSO_EXPORTS=""
                        AC_DEFINE(STAT_ST_BLOCKSIZE,8192,[The size of a block])
                        AC_DEFINE(POSIX_ACL_NEEDS_MASK,1,[Does a POSIX ACL need a mask element])
                        ;;
-               *qnx*) AC_DEFINE(QNX,1,[Whether the host os is qnx])
-                       AC_DEFINE(STAT_ST_BLOCKSIZE,512)
-                       ;;
                *osf*) AC_DEFINE(OSF1,1,[Whether the host os is osf1])
                        BLDSHARED="true"
                        LDSHFLAGS="-shared"
@@ -1837,6 +1836,194 @@ AC_DEFINE_UNQUOTED(SHLIBEXT, "$SHLIBEXT", [Shared library extension])
 
 AC_LIBREPLACE_RUNTIME_LIB_PATH_VAR
 
+
+###########################################################
+#
+# Configuration of subsystems / libraries
+#
+###########################################################
+
+INSTALLLIBCMD_SH=:
+INSTALLLIBCMD_A=:
+UNINSTALLLIBCMD_SH=:
+UNINSTALLLIBCMD_A=:
+
+if test $BLDSHARED = true; then
+       INSTALLLIBCMD_SH="\$(INSTALLCMD)"
+       UNINSTALLLIBCMD_SH="rm -f"
+fi
+if test $enable_static = yes; then
+       INSTALLLIBCMD_A="\$(INSTALLCMD)"
+       UNINSTALLLIBCMD_A="rm -f"
+fi
+
+#################################################
+# --disable-shared-libs
+# can be used to disable the internal use of shared libs altogether
+# (this only has an effect when building shared libs is enabled)
+#
+USESHARED=false
+AC_SUBST(USESHARED)
+
+AC_MSG_CHECKING(whether to use shared libraries internally)
+AC_ARG_ENABLE([shared-libs],
+       AS_HELP_STRING([--enable-shared-libs],
+               [Use shared libraries internally (default=yes)]),
+       [enable_shared_libs=$enableval],
+       [enable_shared_libs=yes])
+
+if test x"$enable_shared_libs" != x"no" ; then
+       USESHARED=$BLDSHARED
+fi
+
+AC_MSG_RESULT([$USESHARED])
+
+if test x"$enable_shared_libs" = x"yes" -a x"$BLDSHARED" != x"true" ; then
+       AC_MSG_WARN([--enable-shared-libs: no support for shared libraries])
+fi
+
+#################################################
+# --with-static-libs=LIBS:
+#   link (internal) libs dynamically or statically?
+#
+# If a subsystem is built as a library then this controls whether they are
+# linked into Samba targets statically or dynamically:
+#
+# * If we build the shared library at all, we link dynamically by default.
+#
+# * We only link statically if we don't build shared or if the library
+#   appears in the --with-static-libs configure option.
+#
+# Example:
+#   --with-static-libs=libtalloc makes use of libtalloc.a instead
+#   of linking the dynamic variant with -ltalloc.
+#
+# NOTE: This option only affects libraries that we do not only build
+# but that samba also links against as libraries (as opposed to linking
+# the plain object files. - This has to be configured in Makefile.in.
+# So in particular it does not harm to give invalid or unknown names here.
+#
+
+AC_ARG_WITH([static-libs],
+       [AS_HELP_STRING([--with-static-libs=LIBS],
+               [Comma-separated list of names of (internal) libraries to link statically (instead of dynamically)])],
+       [AS_IF([test $withval],
+               [for lib in `echo $withval | sed -e 's/,/ /g'` ; do
+                       [lib=`echo $lib | tr '[a-z]' '[A-Z]'`]
+                       eval LINK_$lib=STATIC
+               done], [])],
+       [])
+
+#
+# WORKAROUND:
+#   until we have organized other internal subsystems (as util, registry
+#   and smbconf) into shared libraries, we CAN NOT link libnetapi
+#   dynamically to samba programs.
+#
+LINK_LIBNETAPI=STATIC
+
+LINK_LIBSMBCLIENT=STATIC
+
+#
+#  The library versions are hardcoded here
+#  and filled into the LIBFOO_SOVER variable.
+#
+#  TODO: for talloc and tdb (at least), these should
+#  be extracted from their respective source directories
+#
+AC_ARG_ENABLE(external_libtalloc, [AS_HELP_STRING([--enable-external-libtalloc], [Enable external talloc [default=auto]])],
+[ enable_external_libtalloc=$enableval ], [ enable_external_libtalloc=auto ])
+
+if test "x$enable_external_libtalloc" != xno
+then
+       PKG_CHECK_MODULES(LIBTALLOC, talloc >= 2.0.1,
+               [ enable_external_libtalloc=yes ],
+               [ if test x$enable_external_libtalloc = xyes; then
+                       AC_MSG_ERROR([Unable to find libtalloc])
+                 else
+                       enable_external_libtalloc=no
+                 fi
+               ])
+fi
+
+if test "x$enable_external_libtalloc" = xno
+then
+       m4_include(../lib/talloc/libtalloc.m4)
+       LINK_LIBTALLOC=STATIC
+       SMB_LIBRARY(talloc, 2)
+       LIBTALLOC_OBJ0=""
+       for obj in ${TALLOC_OBJ}; do
+               LIBTALLOC_OBJ0="${LIBTALLOC_OBJ0} ${tallocdir}/${obj}"
+       done
+       SAMBA_CPPFLAGS="${SAMBA_CPPFLAGS} ${TALLOC_CFLAGS}"
+       SAMBA_CONFIGURE_CPPFLAGS="${SAMBA_CONFIGURE_CPPFLAGS} ${TALLOC_CFLAGS}"
+       AC_SUBST(LIBTALLOC_OBJ0)
+
+       TALLOCTORT="bin/talloctort\$(EXEEXT)"
+       AC_SUBST(TALLOCTORT)
+fi
+
+
+AC_ARG_ENABLE(external_libtdb,
+       [AS_HELP_STRING([--enable-external-libtdb],
+               [Enable external tdb [default=auto]])],
+               [ enable_external_libtalloc=$enableval ],
+               [ enable_external_libtalloc=auto ])
+
+if test "x$enable_external_libtdb" != xno
+then
+       PKG_CHECK_MODULES(LIBTDB, tdb >= 1.1.7,
+               [ enable_external_libtdb=yes ],
+               [
+               if test x$enable_external_libtdb = xyes; then
+                       AC_MSG_ERROR([Unable to find libtdb])
+               else
+                       enable_external_libtdb=no
+               fi
+               ])
+fi
+
+AC_SUBST(LIBTDB_OBJ0)
+if test "x$enable_external_libtdb" = xno
+then
+       m4_include(../lib/tdb/libtdb.m4)
+       LINK_LIBTDB=STATIC
+       SMB_LIBRARY(tdb, 1)
+       LIBTDB_OBJ0=""
+       for obj in ${TDB_OBJ}; do
+               LIBTDB_OBJ0="${LIBTDB_OBJ0} ${tdbdir}/${obj}"
+       done
+       AC_SUBST(LIBTDB_OBJ0)
+       SAMBA_CPPFLAGS="${SAMBA_CPPFLAGS} ${TDB_CFLAGS}"
+       SAMBA_CONFIGURE_CPPFLAGS="${SAMBA_CONFIGURE_CPPFLAGS} ${TDB_CFLAGS}"
+
+       TDBBACKUP="bin/tdbbackup\$(EXEEXT)"
+       AC_SUBST(TDBBACKUP)
+       TDBDUMP="bin/tdbdump\$(EXEEXT)"
+       AC_SUBST(TDBDUMP)
+       TDBTOOL="bin/tdbtool\$(EXEEXT)"
+       AC_SUBST(TDBTOOL)
+       TDBTORTURE="bin/tdbtorture\$(EXEEXT)"
+       AC_SUBST(TDBTORTURE)
+       ac_cv_have_tdb_err_nesting=yes
+else
+       AC_TRY_COMPILE([#include "tdb.h"],
+                      [enum TDB_ERROR err = TDB_ERR_NESTING],
+                      ac_cv_have_tdb_err_nesting=yes,
+                      ac_cv_have_tdb_err_nesting=no)
+fi
+
+if test x"$ac_cv_have_tdb_err_nesting" = xyes; then
+   AC_DEFINE(HAVE_TDB_ERR_NESTING, 1, [Whether we have TDB_ERR_NESTING])
+fi
+
+SMB_LIBRARY(netapi, 0)
+SMB_LIBRARY(smbclient, 0)
+SMB_LIBRARY(smbsharemodes, 0)
+SMB_LIBRARY(addns, 0, no, [undefined API])
+
+
+
 ################
 
 AC_CACHE_CHECK([for long long],samba_cv_have_longlong,[
@@ -2030,15 +2217,6 @@ if test x"$samba_cv_HAVE_FUNCTION_MACRO" = x"yes"; then
     AC_DEFINE(HAVE_FUNCTION_MACRO,1,[Whether there is a __FUNCTION__ macro])
 fi
 
-AC_CACHE_CHECK([if gettimeofday takes tz argument],samba_cv_HAVE_GETTIMEOFDAY_TZ,[
-AC_TRY_LINK([
-#include <sys/time.h>
-#include <unistd.h>], [struct timeval tv; return gettimeofday(&tv, NULL);],
-           samba_cv_HAVE_GETTIMEOFDAY_TZ=yes,
-          samba_cv_HAVE_GETTIMEOFDAY_TZ=no)])
-if test x"$samba_cv_HAVE_GETTIMEOFDAY_TZ" = x"yes"; then
-    AC_DEFINE(HAVE_GETTIMEOFDAY_TZ,1,[Whether gettimeofday takes a tz argument])
-fi
 
 if test x"$samba_cv_WITH_PROFILE" = x"yes"; then
 
@@ -2086,7 +2264,7 @@ dnl  We need to check for many of them
 dnl  But we don't need to do each and every one, because our code uses
 dnl  mostly just the utmp (not utmpx) fields.
 
-AC_CHECK_FUNCS(pututline pututxline updwtmp updwtmpx getutmpx)
+AC_CHECK_FUNCS(pututline pututxline updwtmp updwtmpx getutmpx getutxent)
 
 AC_CACHE_CHECK([for ut_name in utmp],samba_cv_HAVE_UT_UT_NAME,[
 AC_TRY_COMPILE([#include <sys/types.h>
@@ -2791,6 +2969,22 @@ exit(1);
   fi
 fi
 
+# glibc up to 2.3.6 had dangerously broken posix_fallocate(). DON'T USE IT.
+AC_CACHE_CHECK([for broken posix_fallocate],samba_cv_HAVE_BROKEN_POSIX_FALLOCATE,[
+AC_TRY_COMPILE([
+  #define _XOPEN_SOURCE 600
+  #include <stdlib.h>
+  #if defined(__GLIBC__) && ((__GLIBC__ < 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 4))
+    probably broken posix_fallocate
+  #endif
+], [
+], 
+samba_cv_HAVE_BROKEN_POSIX_FALLOCATE=no,samba_cv_HAVE_BROKEN_POSIX_FALLOCATE=yes)])
+if test x"$samba_cv_HAVE_BROKEN_POSIX_FALLOCATE" = xyes; then
+       AC_DEFINE(HAVE_BROKEN_POSIX_FALLOCATE,, Whether we have a broken posix_fallocate)
+fi
+
+
 AC_CACHE_CHECK([for st_blocks in struct stat],samba_cv_HAVE_STAT_ST_BLOCKS,[
 AC_TRY_COMPILE([#include <sys/types.h>
 #include <sys/stat.h>
@@ -3329,7 +3523,7 @@ if test x"$with_ads_support" != x"no"; then
   # now check for krb5.h. Some systems have the libraries without the headers!
   # note that this check is done here to allow for different kerberos
   # include paths
-  AC_CHECK_HEADERS(krb5.h krb5/krb5.h)
+  AC_CHECK_HEADERS(krb5.h)
 
   if test x"$ac_cv_header_krb5_h" = x"no"; then
 
@@ -3351,8 +3545,8 @@ if test x"$with_ads_support" != x"no"; then
     LDFLAGS=$ac_save_LDFLAGS
   fi
   AC_CHECK_HEADERS([krb5/locate_plugin.h], [], [],
-[[#ifdef HAVE_KRB5_KRB5_H
- #include <krb5/krb5.h>
+[[#ifdef HAVE_KRB5_H
+ #include <krb5.h>
  #endif
 ]])
 
@@ -3362,6 +3556,22 @@ if test x"$with_ads_support" != x"no"; then
                EXTRA_ALL_TARGETS="$EXTRA_ALL_TARGETS $WINBIND_KRB5_LOCATOR"
        fi
   fi
+
+  # check for new heimdal KRB5_DEPRECATED handling
+
+  AC_CACHE_CHECK([for KRB5_DEPRECATED define taking an identifier],
+                samba_cv_HAVE_KRB5_DEPRECATED_WITH_IDENTIFIER,[
+    AC_TRY_COMPILE(
+      [#define KRB5_DEPRECATED 1
+      #include <krb5.h>],
+      [],
+      samba_cv_HAVE_KRB5_DEPRECATED_WITH_IDENTIFIER=yes,
+      samba_cv_HAVE_KRB5_DEPRECATED_WITH_IDENTIFIER=no)])
+
+  if test x"$samba_cv_HAVE_KRB5_DEPRECATED_WITH_IDENTIFIER" = x"yes"; then
+    AC_DEFINE(HAVE_KRB5_DEPRECATED_WITH_IDENTIFIER, 1,
+              [Whether to use deprecated krb5 interfaces])
+  fi
 fi
 
 # Now we have determined whether we really want ADS support
@@ -4282,6 +4492,39 @@ if test x"${try_pam}" != x"no";then
        AC_MSG_RESULT([$create_pam_modules])
 fi # try_pam != no
 
+#################################################
+# check for PAM_RADIO_TYPE
+AC_TRY_COMPILE([
+#if (!defined(LINUX))
+
+#define PAM_EXTERN extern
+#if defined(HAVE_SECURITY_PAM_APPL_H)
+#include <security/pam_appl.h>
+#elif defined(HAVE_PAM_PAM_APPL_H)
+#include <pam/pam_appl.h>
+#endif
+
+#endif
+
+#if defined(HAVE_SECURITY_PAM_MODULES_H)
+#include <security/pam_modules.h>
+#elif defined(HAVE_PAM_PAM_MODULES_H)
+#include <pam/pam_modules.h>
+#endif
+
+#if defined(HAVE_SECURITY__PAM_MACROS_H)
+#include <security/_pam_macros.h>
+#elif defined(HAVE_PAM__PAM_MACROS_H)
+#include <pam/_pam_macros.h>
+#endif
+
+#ifdef HAVE_SECURITY_PAM_EXT_H
+#include <security/pam_ext.h>
+#endif
+],
+[int i; i = PAM_RADIO_TYPE; ],
+AC_DEFINE(HAVE_PAM_RADIO_TYPE, 1, [Define to 1 if PAM_RADIO_TYPE is available]),[])
+
 #################################################
 # check for pam_smbpass support
 PAM_MODULES=""
@@ -4747,173 +4990,6 @@ else
         AC_MSG_RESULT(no$utmp_no_reason)
 fi
 
-INSTALLLIBCMD_SH=:
-INSTALLLIBCMD_A=:
-UNINSTALLLIBCMD_SH=:
-UNINSTALLLIBCMD_A=:
-
-if test $BLDSHARED = true; then
-       INSTALLLIBCMD_SH="\$(INSTALLCMD)"
-       UNINSTALLLIBCMD_SH="rm -f"
-fi
-if test $enable_static = yes; then
-       INSTALLLIBCMD_A="\$(INSTALLCMD)"
-       UNINSTALLLIBCMD_A="rm -f"
-fi
-
-#################################################
-# --disable-shared-libs
-# can be used to disable the internal use of shared libs altogether
-# (this only has an effect when building shared libs is enabled)
-#
-USESHARED=false
-AC_SUBST(USESHARED)
-
-AC_MSG_CHECKING(whether to use shared libraries internally)
-AC_ARG_ENABLE([shared-libs],
-       AS_HELP_STRING([--enable-shared-libs],
-               [Use shared libraries internally (default=yes)]),
-       [enable_shared_libs=$enableval],
-       [enable_shared_libs=yes])
-
-if test x"$enable_shared_libs" != x"no" ; then
-       USESHARED=$BLDSHARED
-fi
-
-AC_MSG_RESULT([$USESHARED])
-
-if test x"$enable_shared_libs" = x"yes" -a x"$BLDSHARED" != x"true" ; then
-       AC_MSG_WARN([--enable-shared-libs: no support for shared libraries])
-fi
-
-#################################################
-# --with-static-libs=LIBS:
-#   link (internal) libs dynamically or statically?
-#
-# If a subsystem is built as a library then this controls whether they are
-# linked into Samba targets statically or dynamically:
-#
-# * If we build the shared library at all, we link dynamically by default.
-#
-# * We only link statically if we don't build shared or if the library
-#   appears in the --with-static-libs configure option.
-#
-# Example:
-#   --with-static-libs=libtalloc makes use of libtalloc.a instead
-#   of linking the dynamic variant with -ltalloc.
-#
-# NOTE: This option only affects libraries that we do not only build
-# but that samba also links against as libraries (as opposed to linking
-# the plain object files. - This has to be configured in Makefile.in.
-# So in particular it does not harm to give invalid or unknown names here.
-#
-
-AC_ARG_WITH([static-libs],
-       [AS_HELP_STRING([--with-static-libs=LIBS],
-               [Comma-separated list of names of (internal) libraries to link statically (instead of dynamically)])],
-       [AS_IF([test $withval],
-               [for lib in `echo $withval | sed -e 's/,/ /g'` ; do
-                       [lib=`echo $lib | tr '[a-z]' '[A-Z]'`]
-                       eval LINK_$lib=STATIC
-               done], [])],
-       [])
-
-#
-# WORKAROUND:
-#   until we have organized other internal subsystems (as util, registry
-#   and smbconf) into shared libraries, we CAN NOT link libnetapi
-#   dynamically to samba programs.
-#
-LINK_LIBNETAPI=STATIC
-
-LINK_LIBSMBCLIENT=STATIC
-
-#
-#  The library versions are hardcoded here
-#  and filled into the LIBFOO_SOVER variable.
-#
-#  TODO: for talloc and tdb (at least), these should
-#  be extracted from their respective source directories
-#
-AC_ARG_ENABLE(external_libtalloc, [AS_HELP_STRING([--enable-external-libtalloc], [Enable external talloc [default=auto]])], 
-[ enable_external_libtalloc=$enableval ], [ enable_external_libtalloc=auto ])
-
-if test "x$enable_external_libtalloc" != xno
-then
-       PKG_CHECK_MODULES(LIBTALLOC, talloc >= 2.0.1,
-               [ enable_external_libtalloc=yes ],
-               [ if test x$enable_external_libtalloc = xyes; then
-                       AC_MSG_ERROR([Unable to find libtalloc])
-             else 
-                       enable_external_libtalloc=no
-                 fi
-               ])
-fi
-
-if test "x$enable_external_libtalloc" = xno
-then
-       m4_include(../lib/talloc/libtalloc.m4)
-       LINK_LIBTALLOC=STATIC
-       SMB_LIBRARY(talloc, 2)
-       LIBTALLOC_OBJ0=""
-       for obj in ${TALLOC_OBJ}; do
-               LIBTALLOC_OBJ0="${LIBTALLOC_OBJ0} ${tallocdir}/${obj}"
-       done
-       SAMBA_CPPFLAGS="${SAMBA_CPPFLAGS} ${TALLOC_CFLAGS}"
-       AC_SUBST(LIBTALLOC_OBJ0)
-
-       TALLOCTORT="bin/talloctort\$(EXEEXT)"
-       AC_SUBST(TALLOCTORT)
-fi
-
-
-AC_ARG_ENABLE(external_libtdb,
-       [AS_HELP_STRING([--enable-external-libtdb],
-               [Enable external tdb [default=auto]])],
-               [ enable_external_libtalloc=$enableval ],
-               [ enable_external_libtalloc=auto ])
-
-if test "x$enable_external_libtdb" != xno
-then
-       PKG_CHECK_MODULES(LIBTDB, tdb >= 1.1.4,
-               [ enable_external_libtdb=yes ],
-               [
-               if test x$enable_external_libtdb = xyes; then
-                       AC_MSG_ERROR([Unable to find libtdb])
-               else
-                       enable_external_libtdb=no
-               fi
-               ])
-fi
-
-AC_SUBST(LIBTDB_OBJ0)
-if test "x$enable_external_libtdb" = xno
-then
-       m4_include(../lib/tdb/libtdb.m4)
-       LINK_LIBTDB=STATIC
-       SMB_LIBRARY(tdb, 1)
-       LIBTDB_OBJ0=""
-       for obj in ${TDB_OBJ}; do
-               LIBTDB_OBJ0="${LIBTDB_OBJ0} ${tdbdir}/${obj}"
-       done
-       AC_SUBST(LIBTDB_OBJ0)
-       SAMBA_CPPFLAGS="${SAMBA_CPPFLAGS} ${TDB_CFLAGS}"
-
-       TDBBACKUP="bin/tdbbackup\$(EXEEXT)"
-       AC_SUBST(TDBBACKUP)
-       TDBDUMP="bin/tdbdump\$(EXEEXT)"
-       AC_SUBST(TDBDUMP)
-       TDBTOOL="bin/tdbtool\$(EXEEXT)"
-       AC_SUBST(TDBTOOL)
-       TDBTORTURE="bin/tdbtorture\$(EXEEXT)"
-       AC_SUBST(TDBTORTURE)
-fi
-
-SMB_LIBRARY(netapi, 0)
-SMB_LIBRARY(smbclient, 0)
-SMB_LIBRARY(smbsharemodes, 0)
-SMB_LIBRARY(addns, 0, no, [undefined API])
-
 
 #################################################
 # these tests are taken from the GNU fileutils package
@@ -5177,7 +5253,7 @@ AC_ARG_WITH(ctdb,
   esac])
 
 SAVED_CPPFLAGS="$CPPFLAGS"
-CPPFLAGS="$CPPFLAGS $CTDB_CPPFLAGS"
+CPPFLAGS="$CPPFLAGS ${SAMBA_CONFIGURE_CPPFLAGS} $CTDB_CPPFLAGS"
 ctdb_broken="missing or broken headers"
 
 AC_CHECK_HEADERS(ctdb.h ctdb_private.h,,,[