s3: fix dnsupdate configure check
[ira/wip.git] / source3 / configure.in
index d0ff14fa2fe785c84f1c07bedfeaa717b8578cd1..82664d6c4a6757ad6ba85592a352599d1499f83a 100644 (file)
@@ -24,32 +24,6 @@ m4_include(pkg.m4)
 
 AC_LIBREPLACE_CC_CHECKS
 
-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(TALLOC, talloc >= 1.3.0, 
-               [ 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)
-fi
-
-LIBTALLOC_OBJ0=""
-for obj in ${TALLOC_OBJ}; do
-       LIBTALLOC_OBJ0="${LIBTALLOC_OBJ0} ${tallocdir}/${obj}"
-done
-AC_SUBST(LIBTALLOC_OBJ0)
-
 m4_include(../lib/tevent/libtevent.m4)
 
 LIBTEVENT_OBJ0=""
@@ -59,27 +33,9 @@ done
 AC_SUBST(LIBTEVENT_OBJ0)
 LIBS="${LIBS} ${TEVENT_LIBS}"
 
-# TODO: These should come from m4_include(lib/tdb/libtdb.m4)
-# but currently this fails: things have to get merged from s4.
-tdbdir="../lib/tdb"
-AC_SUBST(tdbdir)
-TDB_CFLAGS="-I${srcdir-.}/$tdbdir/include"
-AC_SUBST(TDB_CFLAGS)
-
-LIBTDB_OBJ0=""
-for o in common/tdb.o common/dump.o common/transaction.o common/error.o \
-            common/traverse.o common/freelist.o common/freelistcheck.o \
-                common/io.o common/lock.o common/open.o; 
-do 
-       LIBTDB_OBJ0="$LIBTDB_OBJ0 $tdbdir/$o"
-done
-
-AC_SUBST(LIBTDB_OBJ0)
 SAMBA_CPPFLAGS="-Iinclude -I${srcdir-.}/include  -I. -I${srcdir-.}"
 SAMBA_CPPFLAGS="${SAMBA_CPPFLAGS} -I${srcdir-.}/../lib/replace"
-SAMBA_CPPFLAGS="${SAMBA_CPPFLAGS} ${TALLOC_CFLAGS}"
 SAMBA_CPPFLAGS="${SAMBA_CPPFLAGS} ${TEVENT_CFLAGS}"
-SAMBA_CPPFLAGS="${SAMBA_CPPFLAGS} ${TDB_CFLAGS}"
 SAMBA_CPPFLAGS="${SAMBA_CPPFLAGS} -I${srcdir-.}/libaddns"
 SAMBA_CPPFLAGS="${SAMBA_CPPFLAGS} -I${srcdir-.}/librpc"
 SAMBA_CPPFLAGS="${SAMBA_CPPFLAGS} -I${srcdir-.}/.."
@@ -116,7 +72,6 @@ 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(LIBWBCLIENT_LIBS)
@@ -140,6 +95,9 @@ AC_SUBST(EXTRA_BIN_PROGS)
 AC_SUBST(CIFSMOUNT_PROGS)
 AC_SUBST(INSTALL_CIFSMOUNT)
 AC_SUBST(UNINSTALL_CIFSMOUNT)
+AC_SUBST(CIFSUMOUNT_PROGS)
+AC_SUBST(INSTALL_CIFSUMOUNT)
+AC_SUBST(UNINSTALL_CIFSUMOUNT)
 AC_SUBST(CIFSUPCALL_PROGS)
 AC_SUBST(INSTALL_CIFSUPCALL)
 AC_SUBST(UNINSTALL_CIFSUPCALL)
@@ -162,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)
 
@@ -178,7 +137,7 @@ if test x"$ac_cv_prog_gcc" = x"yes" ; then
            int main(void)
            {
                return 0;
-           }],[-Wdeclaration-after-statement],[$CPPFLAGS],[$LDFLAGS],
+           }],[$CFLAGS -Wdeclaration-after-statement],[$CPPFLAGS],[$LDFLAGS],
            samba_cv_HAVE_Wdeclaration_after_statement=yes,
            samba_cv_HAVE_Wdeclaration_after_statement=no,
            samba_cv_HAVE_Wdeclaration_after_statement=cross)
@@ -196,7 +155,7 @@ if test x"$ac_cv_prog_gcc" = x"yes" ; then
            int main(void)
            {
                return 0;
-           }],[-Werror-implicit-function-declaration],[$CPPFLAGS],[$LDFLAGS],
+           }],[$CFLAGS -Werror-implicit-function-declaration],[$CPPFLAGS],[$LDFLAGS],
            samba_cv_HAVE_Werror_implicit_function_declaration=yes,
            samba_cv_HAVE_Werror_implicit_function_declaration=no,
            samba_cv_HAVE_Werror_implicit_function_declaration=cross)
@@ -216,16 +175,6 @@ if test x"$ac_cv_prog_gcc" = x"yes" ; then
        fi
 fi
 
-AC_ARG_ENABLE(dmalloc, [AS_HELP_STRING([--enable-dmalloc], [Enable heap debugging [default=no]])])
-
-if test "x$enable_dmalloc" = xyes
-then
-       AC_DEFINE(ENABLE_DMALLOC, 1, [Define to turn on dmalloc debugging])
-       AC_DEFINE(DMALLOC_FUNC_CHECK, 1,
-                  [Define to check invariants around some common functions])
-       LIBS="$LIBS -ldmalloc"  
-fi
-
 #################################################
 # check for a shared memory profiling support
 AC_MSG_CHECKING(whether to use profiling)
@@ -284,7 +233,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
@@ -320,7 +269,7 @@ AC_CACHE_CHECK([that the C compiler understands -Werror],samba_cv_HAVE_Werror, [
   int main(void)
   {
        return 0;
-  }],[-Werror],[$CPPFLAGS],[$LDFLAGS],
+  }],[$CFLAGS -Werror],[$CPPFLAGS],[$LDFLAGS],
   samba_cv_HAVE_Werror=yes,samba_cv_HAVE_Werror=no,samba_cv_HAVE_Werror=cross)])
 if test x"$samba_cv_HAVE_Werror" = x"yes"; then
    Werror_FLAGS="-Werror"
@@ -331,7 +280,7 @@ AC_CACHE_CHECK([that the C compiler understands -w2],samba_cv_HAVE_w2, [
   int main(void)
   {
        return 0;
-  }],[-w2],[$CPPFLAGS],[$LDFLAGS],
+  }],[$CFLAGS -w2],[$CPPFLAGS],[$LDFLAGS],
   samba_cv_HAVE_w2=yes,samba_cv_HAVE_w2=no,samba_cv_HAVE_w2=cross)])
 if test x"$samba_cv_HAVE_w2" = x"yes"; then
    Werror_FLAGS="-w2"
@@ -342,7 +291,7 @@ AC_CACHE_CHECK([that the C compiler understands -errwarn],samba_cv_HAVE_errwarn,
    int main(void)
    {
        return 0;
-   }],[-errwarn=%all],[$CPPFLAGS],[$LDFLAGS],
+   }],[$CFLAGS -errwarn=%all],[$CPPFLAGS],[$LDFLAGS],
    samba_cv_HAVE_errwarn=yes,samba_cv_HAVE_errwarn=no,samba_cv_HAVE_errwarn=cross)])
 if test x"$samba_cv_HAVE_errwarn" = x"yes"; then
    Werror_FLAGS="-errwarn=%all"
@@ -429,16 +378,71 @@ esac
 
 DYNEXP=
 AC_SUBST(DYNEXP)
+LDSHFLAGS_Z_DEFS=
+AC_SUBST(LDSHFLAGS_Z_DEFS)
+LDSHFLAGS_Z_NODEFS=
+AC_SUBST(LDSHFLAGS_Z_NODEFS)
 
 dnl Add modules that have to be built by default here
 dnl These have to be built static:
-default_static_modules="pdb_smbpasswd pdb_tdbsam pdb_wbc_sam rpc_lsarpc rpc_samr rpc_winreg rpc_initshutdown rpc_dssetup rpc_wkssvc rpc_svcctl rpc_ntsvcs rpc_netlogon rpc_netdfs rpc_srvsvc rpc_spoolss rpc_eventlog auth_sam auth_unix auth_winbind auth_wbc auth_server auth_domain auth_builtin auth_netlogond vfs_default nss_info_template"
+default_static_modules=""
+default_static_modules="$default_static_modules pdb_smbpasswd"
+default_static_modules="$default_static_modules pdb_tdbsam"
+default_static_modules="$default_static_modules pdb_wbc_sam"
+default_static_modules="$default_static_modules rpc_lsarpc"
+default_static_modules="$default_static_modules rpc_samr"
+default_static_modules="$default_static_modules rpc_winreg"
+default_static_modules="$default_static_modules rpc_initshutdown"
+default_static_modules="$default_static_modules rpc_dssetup"
+default_static_modules="$default_static_modules rpc_wkssvc"
+default_static_modules="$default_static_modules rpc_svcctl"
+default_static_modules="$default_static_modules rpc_ntsvcs"
+default_static_modules="$default_static_modules rpc_netlogon"
+default_static_modules="$default_static_modules rpc_netdfs"
+default_static_modules="$default_static_modules rpc_srvsvc"
+default_static_modules="$default_static_modules rpc_spoolss"
+default_static_modules="$default_static_modules rpc_eventlog"
+default_static_modules="$default_static_modules auth_sam"
+default_static_modules="$default_static_modules auth_unix"
+default_static_modules="$default_static_modules auth_winbind"
+default_static_modules="$default_static_modules auth_wbc"
+default_static_modules="$default_static_modules auth_server"
+default_static_modules="$default_static_modules auth_domain"
+default_static_modules="$default_static_modules auth_builtin"
+default_static_modules="$default_static_modules auth_netlogond"
+default_static_modules="$default_static_modules vfs_default"
+default_static_modules="$default_static_modules nss_info_template"
 
 dnl These are preferably build shared, and static if dlopen() is not available
-default_shared_modules="vfs_recycle vfs_audit vfs_extd_audit vfs_full_audit vfs_netatalk vfs_fake_perms vfs_default_quota vfs_readonly vfs_cap vfs_expand_msdfs vfs_shadow_copy vfs_shadow_copy2 charset_CP850 charset_CP437 auth_script vfs_readahead vfs_xattr_tdb vfs_streams_xattr vfs_streams_depot vfs_acl_xattr vfs_acl_tdb vfs_smb_traffic_analyzer vfs_preopen"
+default_shared_modules=""
+default_shared_modules="$default_shared_modules vfs_recycle"
+default_shared_modules="$default_shared_modules vfs_audit"
+default_shared_modules="$default_shared_modules vfs_extd_audit"
+default_shared_modules="$default_shared_modules vfs_full_audit"
+default_shared_modules="$default_shared_modules vfs_netatalk"
+default_shared_modules="$default_shared_modules vfs_fake_perms"
+default_shared_modules="$default_shared_modules vfs_default_quota"
+default_shared_modules="$default_shared_modules vfs_readonly"
+default_shared_modules="$default_shared_modules vfs_cap"
+default_shared_modules="$default_shared_modules vfs_expand_msdfs"
+default_shared_modules="$default_shared_modules vfs_shadow_copy"
+default_shared_modules="$default_shared_modules vfs_shadow_copy2"
+default_shared_modules="$default_shared_modules charset_CP850"
+default_shared_modules="$default_shared_modules charset_CP437"
+default_shared_modules="$default_shared_modules auth_script"
+default_shared_modules="$default_shared_modules vfs_readahead"
+default_shared_modules="$default_shared_modules vfs_xattr_tdb"
+default_shared_modules="$default_shared_modules vfs_streams_xattr"
+default_shared_modules="$default_shared_modules vfs_streams_depot"
+default_shared_modules="$default_shared_modules vfs_acl_xattr"
+default_shared_modules="$default_shared_modules vfs_acl_tdb"
+default_shared_modules="$default_shared_modules vfs_smb_traffic_analyzer"
+default_shared_modules="$default_shared_modules vfs_preopen"
+default_shared_modules="$default_shared_modules vfs_catia"
+default_shared_modules="$default_shared_modules vfs_scannedonly"
 
 if test "x$developer" = xyes; then
-   default_static_modules="$default_static_modules rpc_rpcecho"
+   default_static_modules="$default_static_modules rpc_rpcecho pdb_ads"
    default_shared_modules="$default_shared_modules charset_weird perfcount_test"
 fi
 
@@ -579,6 +583,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*)
@@ -664,6 +677,10 @@ exit(1);
         fi
       AC_MSG_RESULT([$GLIBC_LFS_SUPPORT])
     ;;
+    *qnx*)
+        CPPFLAGS="-D_LARGEFILE64_SOURCE $CPPFLAGS"
+        AC_DEFINE(_LARGEFILE64_SOURCE, 1, [Whether to enable large file support])
+        ;;
 
 esac
 
@@ -671,18 +688,20 @@ 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}"
 
 LIBREPLACE_DIR=`echo ${libreplacedir} | sed -e "s;${srcdir};;" -e "s;^/;;"`
 
-LIBREPLACE_OBJS=""
-for obj in ${LIBREPLACEOBJ}; do
-       LIBREPLACE_OBJS="${LIBREPLACE_OBJS} ${LIBREPLACE_DIR}/${obj}"
-done
+LIBREPLACE_OBJS="${LIBREPLACEOBJ}"
 AC_SUBST(LIBREPLACE_OBJS)
 
+LIBREPLACE_LIBS="${LIBREPLACE_NETWORK_LIBS}"
+AC_SUBST(LIBREPLACE_LIBS)
+
+
 # add -ldl to the global LIBS
 LIBS="${LIBS} ${LIBDL} ${LIBREPLACE_NETWORK_LIBS}"
 AUTH_LIBS="${AUTH_LIBS} ${CRYPT_LIBS}"
@@ -692,7 +711,7 @@ AC_CHECK_HEADERS(aio.h sys/fcntl.h sys/select.h fcntl.h sys/time.h sys/unistd.h
 AC_CHECK_HEADERS(unistd.h grp.h sys/id.h memory.h alloca.h)
 AC_CHECK_HEADERS(limits.h float.h pthread.h libintl.h)
 AC_CHECK_HEADERS(rpc/rpc.h rpcsvc/nis.h rpcsvc/ypclnt.h)
-AC_CHECK_HEADERS(sys/param.h ctype.h sys/wait.h sys/resource.h sys/ioctl.h sys/ipc.h sys/prctl.h)
+AC_CHECK_HEADERS(sys/param.h ctype.h sys/wait.h sys/resource.h sys/ioctl.h sys/ipc.h sys/prctl.h sys/sysctl.h)
 AC_CHECK_HEADERS(sys/mman.h sys/filio.h sys/priv.h sys/shm.h string.h strings.h stdlib.h)
 AC_CHECK_HEADERS(sys/mount.h sys/vfs.h sys/fs/s5param.h sys/filsys.h termios.h termio.h)
 AC_CHECK_HEADERS(sys/termio.h sys/statfs.h sys/dustat.h sys/statvfs.h stdarg.h)
@@ -783,7 +802,7 @@ if test x$enable_cups != xno; then
                ac_save_PRINT_LIBS=$PRINT_LIBS
                CFLAGS="$CFLAGS `$CUPS_CONFIG --cflags`"
                LDFLAGS="$LDFLAGS `$CUPS_CONFIG --ldflags`"
-               PRINT_LIBS="$PRINT_LIBS `$CUPS_CONFIG --libs`"
+               PRINT_LIBS="$PRINT_LIBS -lcups"
                AC_CHECK_HEADERS(cups/cups.h cups/language.h)
                if test x"$ac_cv_header_cups_cups_h" = xyes -a \
                        x"$ac_cv_header_cups_language_h" = xyes; then
@@ -1040,7 +1059,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)
@@ -1049,12 +1068,15 @@ 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(lutimes futimes utimensat futimens)
 AC_CHECK_FUNCS(mlock munlock mlockall munlockall)
 AC_CHECK_FUNCS(memalign posix_memalign hstrerror)
 AC_CHECK_HEADERS(sys/mman.h)
 # setbuffer, shmget, shm_open are needed for smbtorture
 AC_CHECK_FUNCS(shmget shm_open)
 AC_CHECK_FUNCS(gettext dgettext)
+AC_CHECK_FUNCS(bindtextdomain textdomain)
+AC_CHECK_FUNCS(strupr)
 
 # Find a method of generating a stack trace
 AC_CHECK_HEADERS(execinfo.h libexc.h libunwind.h)
@@ -1066,33 +1088,13 @@ AC_CHECK_LIB(exc, trace_back_stack)
 # check for sysctlbyname for BSD systems
 AC_CHECK_FUNCS(sysctlbyname)
 
-printf "%s" "checking for GPFS GPL libs... "
-save_LIBS="$LIBS"
-LIBS="$LIBS -lgpfs_gpl"
-AC_TRY_LINK([#include <gpfs_gpl.h>],
-          [gpfs_set_share(0,GPFS_SHARE_READ,GPFS_DENY_NONE)],
-          samba_cv_HAVE_GPFS=yes,
-          samba_cv_HAVE_GPFS=no)
-echo $samba_cv_HAVE_GPFS
-if test x"$samba_cv_HAVE_GPFS" = x"yes"; then
-    AC_DEFINE(HAVE_GPFS,1,[Whether GPFS GPL libs are available])
+#############################
+# check if building with gpfs
+AC_CHECK_HEADERS(gpfs_gpl.h)
+if test x"$ac_cv_header_gpfs_gpl_h" = x"yes"; then
+    AC_DEFINE(HAVE_GPFS,1,[Whether GPFS GPL headers are available])
     default_shared_modules="$default_shared_modules vfs_gpfs"
 fi
-LIBS="$save_LIBS"
-
-printf "%s" "checking for GPFS libs (with 3.2.1 PTF8 available as GPL)... "
-save_LIBS="$LIBS"
-LIBS="$LIBS -lgpfs"
-AC_TRY_LINK([#include <gpfs.h>],
-          [gpfs_set_share(0,GPFS_SHARE_READ,GPFS_DENY_NONE)],
-          samba_cv_HAVE_GPFS=yes,
-          samba_cv_HAVE_GPFS=no)
-echo $samba_cv_HAVE_GPFS
-if test x"$samba_cv_HAVE_GPFS" = x"yes"; then
-    AC_DEFINE(HAVE_GPFS,1,[Whether GPFS GPL libs are available])
-    default_shared_modules="$default_shared_modules vfs_gpfs"
-fi
-LIBS="$save_LIBS"
 
 #############################################
 # check if building on Isilon OneFS
@@ -1242,9 +1244,9 @@ 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([
+       AC_CACHE_CHECK([for good getgrouplist],samba_cv_linux_getgrouplist_ok,[AC_TRY_RUN([
 #include <unistd.h>
 #include <sys/utsname.h>
 main() {
@@ -1260,8 +1262,10 @@ 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],
+   [samba_cv_linux_getgrouplist_ok=cross])])
+       if test x"$samba_cv_linux_getgrouplist_ok" = x"yes"; then
           AC_DEFINE(HAVE_GETGROUPLIST, 1, [Have good getgrouplist])
        fi
        ;;
@@ -1541,12 +1545,15 @@ 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 | *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"
                        if test "${ac_cv_gnu_ld_no_default_allow_shlib_undefined}" = "yes"; then
-                               LDSHFLAGS="-shared -Wl,-Bsymbolic -Wl,--allow-shlib-undefined"
-                       else
-                               LDSHFLAGS="-shared -Wl,-Bsymbolic"
+                               LDSHFLAGS_Z_NODEFS="-Wl,--allow-shlib-undefined"
                        fi
                        DYNEXP="-Wl,--export-dynamic"
                        PICFLAG="-fPIC"
@@ -1654,9 +1661,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"
@@ -1741,6 +1745,40 @@ fi
 
 AC_MSG_RESULT($BLDSHARED)
 
+for flags in "-Wl,--as-needed" "-Wl,-z,ignore" "-z ignore" ; do
+       saved_ldflags="$LDFLAGS"
+       AC_MSG_CHECKING([if $flags works])
+       LDFLAGS="$flags $saved_ldflags"
+       AC_TRY_LINK([],[],
+               [AC_MSG_RESULT([yes])
+               LD_AS_NEEDED_FLAG=$flags
+               ld_as_needed_flag_found=yes],
+               AC_MSG_RESULT([no]))
+       LDFLAGS="$LD_AS_NEEDED_FLAG $saved_ldflags"
+       test x"$ld_as_needed_flag_found" = xyes && break
+done
+
+# for historical reasons almost all linkers don't complain about unresolved
+# symbols in shared libs. Except for the internal samba modules we want to get
+# errors when we produce a shared lib with unresolved symbols. On some
+# platforms unresolved symbols might be intended, so we might have to add
+# platform specific exceptions here.
+
+for flags in "-Wl,-z,defs" "-error_unresolved" "-Wl,-error_unresolved" ; do
+       saved_ldflags="$LDFLAGS"
+       AC_MSG_CHECKING([if $flags works])
+       LDFLAGS="$flags $saved_ldflags"
+       AC_TRY_LINK([],[],
+       [AC_MSG_RESULT([yes])
+       LDSHFLAGS_Z_DEFS=$flags
+       ldshflags_z_defs_found=yes],
+       AC_MSG_RESULT([no]))
+       LDFLAGS=$saved_ldflags
+       test x"$ldshflags_z_defs_found" = xyes && break
+done
+
+AC_MSG_CHECKING([LDSHFLAGS_Z_DEFS])
+AC_MSG_RESULT([$LDSHFLAGS_Z_DEFS])
 AC_MSG_CHECKING([LDFLAGS])
 AC_MSG_RESULT([$LDFLAGS])
 AC_MSG_CHECKING([DYNEXP])
@@ -1791,6 +1829,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])
@@ -1800,6 +1839,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,[
@@ -1993,15 +2220,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
 
@@ -2049,7 +2267,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>
@@ -2439,7 +2657,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]),
                     [])
@@ -2754,6 +2972,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>
@@ -2764,6 +2998,8 @@ if test x"$samba_cv_HAVE_STAT_ST_BLOCKS" = x"yes"; then
     AC_DEFINE(HAVE_STAT_ST_BLOCKS,1,[Whether the stat struct has a st_block property])
 fi
 
+AC_CHECK_TYPES([blksize_t, blkcnt_t], [], [], [[#include <sys/stat.h>]])
+
 AC_CACHE_CHECK([for st_blksize in struct stat],samba_cv_HAVE_STAT_ST_BLKSIZE,[
 AC_TRY_COMPILE([#include <sys/types.h>
 #include <sys/stat.h>
@@ -2867,11 +3103,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)
@@ -2949,7 +3186,7 @@ with_ldap_support=auto
 AC_MSG_CHECKING([for LDAP support])
 
 AC_ARG_WITH(ldap,
-[AS_HELP_STRING([--with-ldap], [LDAP support (default yes)])],
+[AS_HELP_STRING([--with-ldap], [LDAP support (default=yes)])],
 [ case "$withval" in
     yes|no)
        with_ldap_support=$withval
@@ -3099,7 +3336,7 @@ with_ads_support=auto
 AC_MSG_CHECKING([for Active Directory and krb5 support])
 
 AC_ARG_WITH(ads,
-[AS_HELP_STRING([--with-ads], [Active Directory support (default auto)])],
+[AS_HELP_STRING([--with-ads], [Active Directory support (default=auto)])],
 [ case "$withval" in
     yes|no)
        with_ads_support="$withval"
@@ -3310,10 +3547,33 @@ if test x"$with_ads_support" != x"no"; then
     CPPFLAGS=$ac_save_CPPFLAGS
     LDFLAGS=$ac_save_LDFLAGS
   fi
-  AC_CHECK_HEADERS(krb5/locate_plugin.h)
+  AC_CHECK_HEADERS([krb5/locate_plugin.h], [], [],
+[[#ifdef HAVE_KRB5_H
+ #include <krb5.h>
+ #endif
+]])
+
   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
+
+  # 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
 
@@ -3396,6 +3656,16 @@ if test x"$with_ads_support" != x"no"; then
   AC_CHECK_FUNC_EXT(krb5_enctype_to_string, $KRB5_LIBS)
   AC_CHECK_FUNC_EXT(krb5_fwd_tgt_creds, $KRB5_LIBS)
   AC_CHECK_FUNC_EXT(krb5_auth_con_set_req_cksumtype, $KRB5_LIBS)
+  AC_CHECK_FUNC_EXT(krb5_get_creds_opt_alloc, $KRB5_LIBS)
+  AC_CHECK_FUNC_EXT(krb5_get_creds_opt_set_impersonate, $KRB5_LIBS)
+  AC_CHECK_FUNC_EXT(krb5_get_creds, $KRB5_LIBS)
+  AC_CHECK_FUNC_EXT(krb5_get_credentials_for_user, $KRB5_LIBS)
+  # MIT krb5 1.8 does not expose this call (yet)
+  AC_CHECK_DECLS(krb5_get_credentials_for_user, [], [], [#include <krb5.h>])
+
+  # MIT krb5 1.7beta3 (in Ubuntu Karmic) does not have this declaration
+  # but does have the symbol
+  AC_CHECK_DECLS(krb5_auth_con_set_req_cksumtype, [], [], [#include <krb5.h>])
 
   LIBS="$KRB5_LIBS $LIBS"
 
@@ -3785,7 +4055,7 @@ if test x"$with_ads_support" != x"no"; then
                        if (str) free (str); 
                        return 0;
                }
-               ],[$Werror_FLAGS],[$CPPFLAGS],[$LDFLAGS],
+               ],[$CFLAGS $Werror_FLAGS],[$CPPFLAGS],[$LDFLAGS],
                smb_krb5_cv_enctype_to_string_takes_krb5_context_arg=yes,
                smb_krb5_cv_enctype_to_string_takes_krb5_context_arg=no)])
 
@@ -3803,7 +4073,7 @@ if test x"$with_ads_support" != x"no"; then
                        krb5_enctype_to_string(1, buf, 256);
                        return 0;
                }
-               ],[$Werror_FLAGS],[$CPPFLAGS],[$LDFLAGS],
+               ],[$CFLAGS $Werror_FLAGS],[$CPPFLAGS],[$LDFLAGS],
                smb_krb5_cv_enctype_to_string_takes_size_t_arg=yes,
                smb_krb5_cv_enctype_to_string_takes_size_t_arg=no)])
 
@@ -3932,11 +4202,11 @@ PASSDB_LIBS="$PASSDB_LIBS $NSCD_LIBS"
 ########################################################
 # Compile with DNS Updates support?
 
-with_dnsupdate_support=no
+with_dnsupdate_support=auto
 AC_MSG_CHECKING([whether to enable DNS Updates support])
 
 AC_ARG_WITH(dnsupdate,
-[AS_HELP_STRING([--with-dnsupdate], [Enable DNS Updates support (default no)])],
+[AS_HELP_STRING([--with-dnsupdate], [Enable DNS Updates support (default=auto)])],
 [ case "$withval" in
     yes|no)
        with_dnsupdate_support=$withval
@@ -3948,24 +4218,29 @@ AC_MSG_RESULT($with_dnsupdate_support)
 if test x"$with_dnsupdate_support" != x"no"; then
 
   ################################################################
-  # first test for Active Directory support being enabled
-  #if test x"$with_ads_support" = x"no"; then
-  #            AC_MSG_ERROR(Active Directory support is required to enable DNS Update support)
-  #            with_dnsupdate_support=no
-  #fi          
+  # first test for AD / GSSAPI support being enabled
+       if test x"$have_gssapi" != xyes ; then
+               if test x"$with_dnsupdate_support" = x"yes" ; then
+                       AC_MSG_ERROR(DNS Updates support only possible with AD and GSSAPI support)
+               else
+                       AC_MSG_NOTICE(DNS Updates support only possible with AD and GSSAPI support)
+                       with_dnsupdate_support=no
+               fi
+       fi
   ##################################################################
   # then test for uuid.h (necessary to generate unique DNS keynames
   # (uuid.h is required for this test)
-  AC_CHECK_HEADERS(uuid/uuid.h)
+       AC_CHECK_HEADERS(uuid/uuid.h)
 
-  if test x"$ac_cv_header_uuid_uuid_h" != x"yes"; then
-       if test x"$with_dnsupdate_support" = x"yes"; then
-        AC_MSG_ERROR(uuid.h is needed to enable DNS Updates support)
-       else
-        AC_MSG_WARN(uuid.h is needed to enable DNS Updates support)
+       
+       if test x"$ac_cv_header_uuid_uuid_h" != x"yes"; then
+               if test x"$with_dnsupdate_support" = x"yes"; then
+                       AC_MSG_ERROR(uuid.h is needed to enable DNS Updates support)
+               else
+                       AC_MSG_NOTICE(uuid.h is needed to enable DNS Updates support)
+               fi
+               with_dnsupdate_support=no
        fi
-       with_dnsupdate_support=no
-  fi
 fi
 
 if test x"$with_dnsupdate_support" != x"no"; then
@@ -3997,6 +4272,10 @@ if test x"$with_dnsupdate_support" != x"no"; then
            with_dnsupdate_support=no
        ])
 fi
+  # finally print out the result:
+AC_MSG_CHECKING(whether DNS Updates support is used)
+AC_MSG_RESULT([$with_dnsupdate_support])
+
 
 #################################################
 # check for automount support
@@ -4020,9 +4299,9 @@ AC_ARG_WITH(automount,
 CIFSMOUNT_PROGS=""
 INSTALL_CIFSMOUNT=""
 UNINSTALL_CIFSMOUNT=""
-AC_MSG_CHECKING(whether to build mount.cifs and umount.cifs)
+AC_MSG_CHECKING(whether to build mount.cifs)
 AC_ARG_WITH(cifsmount,
-[AS_HELP_STRING([--with-cifsmount], [Include mount.cifs and umount.cifs (Linux only) support (default=yes)])],
+[AS_HELP_STRING([--with-cifsmount], [Include mount.cifs (Linux only) support (default=yes)])],
 [ case "$withval" in
   no)
        AC_MSG_RESULT(no)
@@ -4031,8 +4310,8 @@ AC_ARG_WITH(cifsmount,
        case "$host_os" in
        *linux*)
                AC_MSG_RESULT(yes)
-               AC_DEFINE(WITH_CIFSMOUNT,1,[Whether to build mount.cifs and umount.cifs])
-               CIFSMOUNT_PROGS="bin/mount.cifs bin/umount.cifs"
+               AC_DEFINE(WITH_CIFSMOUNT,1,[Whether to build mount.cifs])
+               CIFSMOUNT_PROGS="bin/mount.cifs"
                INSTALL_CIFSMOUNT="installcifsmount"
                UNINSTALL_CIFSMOUNT="uninstallcifsmount"
                ;;
@@ -4045,8 +4324,8 @@ AC_ARG_WITH(cifsmount,
 [ case "$host_os" in
   *linux*)
        AC_MSG_RESULT(yes)
-       AC_DEFINE(WITH_CIFSMOUNT,1,[Whether to build mount.cifs and umount.cifs])
-       CIFSMOUNT_PROGS="bin/mount.cifs bin/umount.cifs"
+       AC_DEFINE(WITH_CIFSMOUNT,1,[Whether to build mount.cifs])
+       CIFSMOUNT_PROGS="bin/mount.cifs"
        INSTALL_CIFSMOUNT="installcifsmount"
        UNINSTALL_CIFSMOUNT="uninstallcifsmount"
        ;;
@@ -4056,6 +4335,34 @@ AC_ARG_WITH(cifsmount,
   esac ]
 )
 
+CIFSUMOUNT_PROGS=""
+INSTALL_CIFSUMOUNT=""
+UNINSTALL_CIFSUMOUNT=""
+AC_MSG_CHECKING(whether to build umount.cifs)
+AC_ARG_WITH(cifsumount,
+[AS_HELP_STRING([--with-cifsumount], [Include umount.cifs (Linux only) support (default=no)])],
+[ case "$withval" in
+  yes)
+       case "$host_os" in
+       *linux*)
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(WITH_CIFSUMOUNT,1,[Whether to build umount.cifs])
+               CIFSUMOUNT_PROGS="bin/umount.cifs"
+               INSTALL_CIFSUMOUNT="installcifsumount"
+               UNINSTALL_CIFSUMOUNT="uninstallcifsumount"
+               ;;
+       *)
+               AC_MSG_ERROR(not on a linux system!)
+               ;;
+       esac
+       ;;
+  *)
+       AC_MSG_RESULT(no)
+       ;;
+  esac ],
+  AC_MSG_RESULT(no)
+)
+
 #################################################
 # check for cifs.upcall support
 AC_CHECK_HEADERS([keyutils.h], [HAVE_KEYUTILS_H=1], [HAVE_KEYUTILS_H=0])
@@ -4118,12 +4425,12 @@ AC_ARG_WITH(cifsupcall,
 # /usr/include/pam.
 
 with_pam_for_crypt=no
-try_pam=no
+try_pam=auto
 AC_MSG_CHECKING(whether to try PAM support)
 AC_ARG_WITH(pam,
-[AS_HELP_STRING([--with-pam], [Include PAM support (default=no)])],
+[AS_HELP_STRING([--with-pam], [Include PAM support (default=auto)])],
 [ case "$withval" in
-  yes|no)
+  yes|no|auto)
     try_pam=$withval
     ;;
   esac
@@ -4197,36 +4504,83 @@ 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=""
 INSTALL_PAM_MODULES=""
 UNINSTALL_PAM_MODULES=""
+
+try_pam_smbpass=auto
 AC_MSG_CHECKING(whether to use pam_smbpass)
 AC_ARG_WITH(pam_smbpass,
-[AS_HELP_STRING([--with-pam_smbpass], [Build PAM module for authenticating against passdb backends (default=no)])],
+[AS_HELP_STRING([--with-pam_smbpass], [Build PAM module for authenticating against passdb backends (default=auto)])],
 [ case "$withval" in
-  yes)
-    AC_MSG_RESULT(yes)
+  yes|no|auto)
+    try_pam_smbpass=$withval
+  ;;
+  *)
+    AC_MSG_ERROR([valid options are yes,no,auto])
+  ;;
+  esac
+])
 
-       # Conditions under which pam_smbpass should not be built.
+if test x"${try_pam_smbpass}" = xno ; then
+       use_pam_smbpass=no
+else
+       use_pam_smbpass=yes
+       # Conditions under which pam_smbpass can't be built.
+       if test x"$BLDSHARED" != xtrue ; then
+               if test x"${try_pam_smbpass}" = xyes ; then
+                       AC_MSG_ERROR([No support for shared modules])
+               fi
+               use_pam_smbpass=no
+       elif test x"$create_pam_modules" != xyes ; then
+               if test x"${try_pam_smbpass}" = xyes ; then
+                       AC_MSG_ERROR([No support for PAM MODULES])
+               fi
+               use_pam_smbpass=no
+       fi
 
-       if test x"$BLDSHARED" != x"true"; then
-          AC_MSG_ERROR([No support for shared modules])
-       elif test x"$create_pam_modules" != x"yes"; then
-         AC_MSG_ERROR([No support for PAM MODULES])
-       else
-          PAM_MODULES="pam_smbpass"
-          INSTALL_PAM_MODULES="installpammodules"
-          UNINSTALL_PAM_MODULES="uninstallpammodules"
-       fi
-    ;;
-  *)
-    AC_MSG_RESULT(no)
-    ;;
-  esac ],
-  AC_MSG_RESULT(no)
-)
+       if test x"${use_pam_smbpass}" = xyes ; then 
+               PAM_MODULES="pam_smbpass"
+               INSTALL_PAM_MODULES="installpammodules"
+               UNINSTALL_PAM_MODULES="uninstallpammodules"
+       fi
+fi
+AC_MSG_RESULT([$use_pam_smbpass])
 
 
 ##
@@ -4467,7 +4821,7 @@ AC_TRY_RUN_STRICT([
 #define HAVE_QUOTACTL_4A 1
 #define AUTOCONF_TEST 1
 #include "confdefs.h"
-#include "${srcdir-.}/../tests/sysquotas.c"],[$Werror_FLAGS],[$CPPFLAGS],[$LDFLAGS],
+#include "${srcdir-.}/../tests/sysquotas.c"],[$CFLAGS $Werror_FLAGS],[$CPPFLAGS],[$LDFLAGS],
            samba_cv_HAVE_QUOTACTL_4A=yes,samba_cv_HAVE_QUOTACTL_4A=no,samba_cv_HAVE_QUOTACTL_4A=cross)])
 if test x"$samba_cv_HAVE_QUOTACTL_4A" = x"yes"; then
     samba_cv_SYSQUOTA_FOUND=yes;
@@ -4482,7 +4836,7 @@ AC_TRY_RUN_STRICT([
 #define HAVE_QUOTACTL_4B 1
 #define AUTOCONF_TEST 1
 #include "confdefs.h"
-#include "${srcdir-.}/../tests/sysquotas.c"],[$Werror_FLAGS],[$CPPFLAGS],[$LDFLAGS],
+#include "${srcdir-.}/../tests/sysquotas.c"],[$CFLAGS $Werror_FLAGS],[$CPPFLAGS],[$LDFLAGS],
            samba_cv_HAVE_QUOTACTL_4B=yes,samba_cv_HAVE_QUOTACTL_4B=no,samba_cv_HAVE_QUOTACTL_4B=cross)])
 if test x"$samba_cv_HAVE_QUOTACTL_4B" = x"yes"; then
     echo "int quotactl(const char *path, int cmd, int id, char *addr) is not reworked for the new sys_quota api"
@@ -4498,7 +4852,7 @@ AC_TRY_RUN_STRICT([
 #define HAVE_QUOTACTL_3 1
 #define AUTOCONF_TEST 1
 #include "confdefs.h"
-#include "${srcdir-.}/../tests/sysquotas.c"],[$Werror_FLAGS],[$CPPFLAGS],[$LDFLAGS],
+#include "${srcdir-.}/../tests/sysquotas.c"],[$CFLAGS $Werror_FLAGS],[$CPPFLAGS],[$LDFLAGS],
            samba_cv_HAVE_QUOTACTL_3=yes,samba_cv_HAVE_QUOTACTL_3=no,samba_cv_HAVE_QUOTACTL_3=cross)])
 if test x"$samba_cv_HAVE_QUOTACTL_3" = x"yes"; then
     echo "CRAY int quotactl (char *spec, int request, char *arg) is NOT reworked for the sys_quota api"
@@ -4648,102 +5002,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
-#
-SMB_LIBRARY(talloc, 1)
-SMB_LIBRARY(tdb, 1)
-SMB_LIBRARY(netapi, 0)
-SMB_LIBRARY(smbclient, 0)
-SMB_LIBRARY(smbsharemodes, 0)
-SMB_LIBRARY(lua, 0)
-SMB_LIBRARY(addns, 0, no, [undefined API])
-
 
 #################################################
 # these tests are taken from the GNU fileutils package
@@ -5007,7 +5265,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,,,[
@@ -5039,6 +5297,23 @@ else
        ctdb_broken="missing transaction support"
 fi
 
+AC_HAVE_DECL(CTDB_CONTROL_TRANS2_ACTIVE,[
+#include "confdefs.h"
+#define NO_CONFIG_H
+#include "replace.h"
+#include "system/wait.h"
+#include "system/network.h"
+#include <talloc.h>
+#include <tdb.h>
+#include <ctdb.h>
+#include <ctdb_private.h>
+])
+if test x"$ac_cv_have_CTDB_CONTROL_TRANS2_ACTIVE_decl" = x"yes"; then
+       ctdb_broken=no
+else
+       ctdb_broken="transaction support too old"
+fi
+
 # in ctdb 1.0.57 ctdb_control_tcp was temparary renamed to ctdb_tcp_client
 AC_CHECK_TYPE(struct ctdb_tcp_client,[
        AC_DEFINE([ctdb_control_tcp],[ctdb_tcp_client],[ctdb ipv4 support])
@@ -5389,7 +5664,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>],
 [\
@@ -5701,6 +5976,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
@@ -5750,7 +6035,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"
                ;;
@@ -5792,8 +6077,6 @@ case "$host_os" in
                NSSSONAMEVERSIONSUFFIX=".1"
                WINBIND_NSS_EXTRA_OBJS="../nsswitch/winbind_nss_solaris.o \
                    ../nsswitch/winbind_nss_linux.o"
-               WINBIND_NSS_EXTRA_LIBS="${LIBREPLACE_NETWORK_LIBS}"
-               PAM_WINBIND_EXTRA_LIBS="${LIBREPLACE_NETWORK_LIBS}"
                ;;
        *hpux11*)
                WINBIND_NSS_EXTRA_OBJS="../nsswitch/winbind_nss_solaris.o"
@@ -5866,14 +6149,12 @@ 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
                LIBWBCLIENT_LIBS="-lwbclient"
        else
                LIBWBCLIENT_STATIC=$LIBWBCLIENT_STATIC_TARGET
-               LIBWBCLIENT_TARGET=$LIBWBCLIENT_STATIC_TARGET
                LIBWBCLIENT_LIBS=$LIBWBCLIENT_STATIC_TARGET
        fi
 fi
@@ -5894,16 +6175,16 @@ 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)
 AC_SUBST(WINBIND_WINS_NSS)
 AC_SUBST(WINBIND_NSS_LDSHFLAGS)
 AC_SUBST(WINBIND_NSS_EXTRA_OBJS)
-AC_SUBST(WINBIND_NSS_EXTRA_LIBS)
 AC_SUBST(NSSSONAMEVERSIONSUFFIX)
-AC_SUBST(PAM_WINBIND_EXTRA_LIBS)
 
 AC_SUBST(WINBIND_KRB5_LOCATOR)
 
@@ -5985,7 +6266,7 @@ AC_ARG_ENABLE(dnssd,
 [AS_HELP_STRING([--enable-dnssd], [Enable DNS service discovery support (default=no)])])
 
 AC_SUBST(DNSSD_LIBS)
-if test x"$enable_dnssd" == x"yes"; then
+if test x"$enable_dnssd" = x"yes"; then
     have_dnssd_support=yes
 
     AC_CHECK_HEADERS(dns_sd.h)
@@ -6019,7 +6300,6 @@ fi
 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
 
@@ -6033,12 +6313,18 @@ if test x"$enable_avahi" != x"no"; 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
+    save_LIBS="$LIBS"
+    AC_CHECK_LIB(avahi-client, avahi_client_new,[have_avahi_client_new=yes])
+    AC_CHECK_LIB(avahi-common, avahi_strerror,[have_avahi_strerror=yes])
+    LIBS="$save_LIBS"
+
+    if test x"$have_avahi_client_new" != x"yes" -o \
+       x"$have_avahi_strerror" != x"yes" ; then
        have_avahi_support=no
     fi
 
     if test x"$have_avahi_support" = x"yes"; then
+        AC_SUBST(AVAHI_LIBS, "-lavahi-client -lavahi-common")
        AC_DEFINE(WITH_AVAHI_SUPPORT, 1,
                [Whether to enable avahi support])
        AC_SUBST(AVAHI_OBJ, "lib/avahi.o smbd/avahi_register.o")
@@ -6049,6 +6335,20 @@ if test x"$enable_avahi" != x"no"; then
     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
 
@@ -6159,8 +6459,15 @@ 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_ads, passdb/pdb_ads.o \$(TLDAP_OBJ), "bin/ads.$SHLIBEXT", PDB)
 SMB_MODULE(pdb_smbpasswd, passdb/pdb_smbpasswd.o, "bin/smbpasswd.$SHLIBEXT", PDB)
 SMB_MODULE(pdb_tdbsam, passdb/pdb_tdb.o, "bin/tdbsam.$SHLIBEXT", PDB)
 SMB_MODULE(pdb_wbc_sam, passdb/pdb_wbc_sam.o, "bin/wbc_sam.$SHLIBEXT", PDB)
@@ -6181,7 +6488,7 @@ SMB_MODULE(rpc_spoolss, \$(RPC_SPOOLSS_OBJ), "bin/librpc_spoolss.$SHLIBEXT", RPC
 SMB_MODULE(rpc_eventlog, \$(RPC_EVENTLOG_OBJ), "bin/librpc_eventlog.$SHLIBEXT", RPC)
 SMB_MODULE(rpc_samr, \$(RPC_SAMR_OBJ), "bin/librpc_samr.$SHLIBEXT", RPC)
 SMB_MODULE(rpc_rpcecho, \$(RPC_ECHO_OBJ), "bin/librpc_rpcecho.$SHLIBEXT", RPC)
-SMB_SUBSYSTEM(RPC,smbd/server.o)
+SMB_SUBSYSTEM(RPC,smbd/process.o)
 
 SMB_MODULE(idmap_ldap, winbindd/idmap_ldap.o, "bin/ldap.$SHLIBEXT", IDMAP)
 SMB_MODULE(idmap_tdb, winbindd/idmap_tdb.o, "bin/tdb.$SHLIBEXT", IDMAP)
@@ -6257,6 +6564,7 @@ SMB_MODULE(vfs_smb_traffic_analyzer, \$(VFS_SMB_TRAFFIC_ANALYZER_OBJ), "bin/smb_
 SMB_MODULE(vfs_onefs, \$(VFS_ONEFS), "bin/onefs.$SHLIBEXT", VFS)
 SMB_MODULE(vfs_onefs_shadow_copy, \$(VFS_ONEFS_SHADOW_COPY), "bin/onefs_shadow_copy.$SHLIBEXT", VFS)
 SMB_MODULE(vfs_dirsort, \$(VFS_DIRSORT_OBJ), "bin/dirsort.$SHLIBEXT", VFS)
+SMB_MODULE(vfs_scannedonly, \$(VFS_SCANNEDONLY_OBJ), "bin/scannedonly.$SHLIBEXT", VFS)
 
 SMB_SUBSYSTEM(VFS,smbd/vfs.o)
 
@@ -6407,6 +6715,16 @@ AC_ZLIB([ZLIB_OBJS=""], [
        CFLAGS="-I../lib/zlib $CFLAGS"
 ])
 
+AC_ARG_ENABLE(dmalloc, [AS_HELP_STRING([--enable-dmalloc], [Enable heap debugging [default=no]])])
+
+if test "x$enable_dmalloc" = xyes
+then
+       AC_DEFINE(ENABLE_DMALLOC, 1, [Define to turn on dmalloc debugging])
+       AC_DEFINE(DMALLOC_FUNC_CHECK, 1,
+                  [Define to check invariants around some common functions])
+       LIBS="$LIBS -ldmalloc"
+fi
+
 dnl Remove -L/usr/lib/? from LDFLAGS and LIBS
 LIB_REMOVE_USR_LIB(LDFLAGS)
 LIB_REMOVE_USR_LIB(LIBS)