s3-param: Rename loadparm_s3_context -> loadparm_s3_helpers
[kai/samba.git] / source3 / configure.in
index 2794990b9959ba427568c2883fe660a7b6421bb2..6e324a16a0278c9ee8fdf5e22d6d94285d33ffaa 100644 (file)
@@ -35,7 +35,8 @@ done
 AC_SUBST(LIBTEVENT_OBJ0)
 LIBS="${LIBS} ${TEVENT_LIBS}"
 
-SAMBA_CPPFLAGS="-Iinclude/autoconf -Iinclude -I${srcdir-.}/include  -I. -I${srcdir-.}"
+SAMBA_CPPFLAGS="-Iinclude/autoconf -Iautoconf -Iautoconf/source3"
+SAMBA_CPPFLAGS="${SAMBA_CPPFLAGS} -Iinclude -I${srcdir-.}/include  -I. -I${srcdir-.}"
 SAMBA_CPPFLAGS="${SAMBA_CPPFLAGS} -I${srcdir-.}/../lib/replace"
 SAMBA_CPPFLAGS="${SAMBA_CPPFLAGS} ${TEVENT_CFLAGS}"
 SAMBA_CPPFLAGS="${SAMBA_CPPFLAGS} ${CCAN_CFLAGS}"
@@ -90,7 +91,6 @@ AC_SUBST(ACL_LIBS)
 AC_SUBST(PASSDB_LIBS)
 AC_SUBST(IDMAP_LIBS)
 AC_SUBST(KRB5_LIBS)
-AC_SUBST(UUID_LIBS)
 AC_SUBST(LDAP_LIBS)
 AC_SUBST(GPEXT_LIBS)
 AC_SUBST(PAM_MODULES)
@@ -467,10 +467,11 @@ default_shared_modules="$default_shared_modules vfs_crossrename"
 default_shared_modules="$default_shared_modules vfs_linux_xfs_sgid"
 default_shared_modules="$default_shared_modules vfs_time_audit"
 default_shared_modules="$default_shared_modules idmap_autorid"
+default_shared_modules="$default_shared_modules idmap_tdb2"
+default_shared_modules="$default_shared_modules idmap_rid"
+default_shared_modules="$default_shared_modules idmap_hash"
 
 if test "x$developer" = xyes; then
-   default_static_modules="$default_static_modules rpc_rpcecho pdb_ads"
-   default_static_modules="$default_static_modules auth_netlogond"
    default_shared_modules="$default_shared_modules perfcount_test"
 fi
 
@@ -587,7 +588,7 @@ LIBREPLACE_DIR=`echo ${libreplacedir} | sed -e "s;${srcdir};;" -e "s;^/;;"`
 LIBREPLACE_OBJS="${LIBREPLACEOBJ}"
 AC_SUBST(LIBREPLACE_OBJS)
 
-LIBREPLACE_LIBS="${LIBREPLACE_NETWORK_LIBS}"
+LIBREPLACE_LIBS="${LIBREPLACE_NETWORK_LIBS} ${LIBREPLACE_FILESYS_LIBS}"
 AC_SUBST(LIBREPLACE_LIBS)
 
 
@@ -610,7 +611,6 @@ AC_CHECK_HEADERS(langinfo.h locale.h)
 AC_CHECK_HEADERS(xfs/libxfs.h)
 AC_CHECK_HEADERS(netgroup.h)
 AC_CHECK_HEADERS(linux/falloc.h)
-AC_CHECK_HEADERS(sys/uuid.h)
 AC_CHECK_HEADERS(CommonCrypto/CommonDigest.h)
 
 AC_CHECK_HEADERS(rpcsvc/yp_prot.h,,,[[
@@ -670,9 +670,6 @@ AC_CHECK_HEADERS(shadow.h)
 AC_CHECK_HEADERS(nss.h nss_common.h nsswitch.h ns_api.h sys/security.h)
 AC_CHECK_HEADERS(syscall.h sys/syscall.h)
 
-AC_CHECK_HEADERS(sys/attributes.h attr/xattr.h sys/xattr.h sys/extattr.h sys/uio.h)
-AC_CHECK_HEADERS(sys/ea.h sys/proplist.h)
-
 AC_CHECK_HEADERS(sys/cdefs.h glob.h)
 
 # For experimental utmp support (lastlog on some BSD-like systems)
@@ -1005,27 +1002,6 @@ if test x"$ac_cv_header_gpfs_gpl_h" = x"yes"; then
     default_shared_modules="$default_shared_modules vfs_gpfs_hsm_notify"
 fi
 
-#############################################
-# check if building on Isilon OneFS
-printf "%s" "checking for Isilon OneFS... "
-save_LIBS="$LIBS"
-LIBS="$LIBS -lisi_version"
-AC_TRY_LINK([#include <isi_version/isi_version.h>],
-          [get_isilon_copyright()],
-          samba_cv_HAVE_ONEFS=yes,
-          samba_cv_HAVE_ONEFS=no)
-echo $samba_cv_HAVE_ONEFS
-if test x"$samba_cv_HAVE_ONEFS" = x"yes"; then
-    AC_DEFINE(HAVE_ONEFS,1,[Whether building on Isilon OneFS])
-    default_shared_modules="$default_shared_modules vfs_onefs vfs_onefs_shadow_copy perfcount_onefs"
-    default_static_modules="$default_static_modules"
-    ONEFS_LIBS="-lisi_acl -lisi_ecs -lisi_event -lisi_util"
-    # Need to also add general libs for oplocks support
-    save_LIBS="$save_LIBS -lisi_ecs -lisi_event -lisi_util -ldevstat"
-fi
-AC_SUBST(ONEFS_LIBS)
-LIBS="$save_LIBS"
-
 # Note that all the libunwind symbols in the API are defined to internal
 # platform-specific version, so we must include libunwind.h before checking
 # any of them.
@@ -1229,11 +1205,11 @@ fi
 AC_CACHE_CHECK([whether we can compile with __attribute__((destructor))],
               samba_cv_function_attribute_destructor,
               [
-                AC_COMPILE_IFELSE(
+                AC_COMPILE_IFELSE([AC_LANG_SOURCE(
                        [
                                __attribute__((destructor))
                                static void cleanup(void) { }
-                       ],
+                       ])],
                        samba_cv_function_attribute_destructor=yes)
                ])
 
@@ -1248,14 +1224,6 @@ AC_CHECK_LIB(resolv, dn_expand)
 AC_CHECK_LIB(resolv, _dn_expand)
 AC_CHECK_LIB(resolv, __dn_expand)
 
-AC_TRY_COMPILE([#include <resolv.h>],
-              [struct __res_state s; res_ninit(&s);],
-              ac_cv_have_res_ninit=yes,ac_cv_have_res_ninit=no)
-
-if test x"$ac_cv_have_res_ninit" = x"yes"; then
-       AC_DEFINE(HAVE_RES_NINIT, 1, [Whether we have res_ninit])
-fi
-
 #
 # Check for the functions putprpwnam, set_auth_parameters,
 # getspnam, bigcrypt and getprpwnam in -lsec and -lsecurity
@@ -1282,62 +1250,6 @@ AC_LIBTESTFUNC(sec, getprpwnam)
 
 AC_CHECK_FUNCS(strsignal)
 
-############################################
-# Check for EA implementations
-case "$host_os" in
-  *osf*)
-       AC_SEARCH_LIBS(getproplist, [proplist])
-       AC_CHECK_FUNCS(getproplist fgetproplist setproplist fsetproplist)
-       AC_CHECK_FUNCS(delproplist fdelproplist add_proplist_entry get_proplist_entry)
-       AC_CHECK_FUNCS(sizeof_proplist_entry)
-  ;;
-  *freebsd4* | *dragonfly* )
-       AC_DEFINE(BROKEN_EXTATTR, 1, [Does extattr API work])
-  ;;
-  *solaris*)
-       AC_CHECK_FUNCS(attropen)
-  ;;
-  *)
-       AC_SEARCH_LIBS(getxattr, [attr])
-       AC_CHECK_FUNCS(getxattr,[
-               AC_CHECK_FUNCS(fgetxattr listxattr flistxattr removexattr fremovexattr setxattr fsetxattr)
-               ])
-       AC_CHECK_FUNCS(getea,[
-               AC_CHECK_FUNCS(fgetea listea flistea removeea fremoveea setea fsetea)
-               ])
-       AC_CHECK_FUNCS(attr_get,[
-               AC_CHECK_FUNCS(attr_list attr_set attr_remove attr_getf attr_listf attr_setf attr_removef)
-               ])
-       AC_CHECK_FUNCS(extattr_delete_file,[
-               AC_CHECK_FUNCS(extattr_delete_fd extattr_get_fd extattr_get_file extattr_list_fd extattr_list_file extattr_set_fd extattr_set_file)
-               ])
-  ;;
-esac
-
-########################################################
-# Do xattr functions take additional options like on Darwin?
-if test x"$ac_cv_func_getxattr" = x"yes" ; then
-       AC_CACHE_CHECK([whether xattr interface takes additional options], smb_attr_cv_xattr_add_opt, [
-               old_LIBS=$LIBS
-               LIBS="$LIBS $ACL_LIBS"
-               AC_TRY_COMPILE([
-                       #include <sys/types.h>
-                       #if HAVE_ATTR_XATTR_H
-                       #include <attr/xattr.h>
-                       #elif HAVE_SYS_XATTR_H
-                       #include <sys/xattr.h>
-                       #endif
-               ],[
-                       getxattr(0, 0, 0, 0, 0, 0);
-               ],
-               [smb_attr_cv_xattr_add_opt=yes],
-               [smb_attr_cv_xattr_add_opt=no;LIBS=$old_LIBS])
-       ])
-       if test x"$smb_attr_cv_xattr_add_opt" = x"yes"; then
-               AC_DEFINE(XATTR_ADD_OPT, 1, [xattr functions have additional options])
-       fi
-fi
-
 AC_DISABLE_STATIC
 AC_ENABLE_SHARED
 
@@ -1938,9 +1850,7 @@ fi
 if test "x$enable_external_libtalloc" = xno
 then
        m4_include(../lib/talloc/libtalloc.m4)
-       if test x"$USESHARED" == x"no" ; then
-               LINK_LIBTALLOC=STATIC
-       fi
+       LINK_LIBTALLOC=STATIC
        LIBTALLOCVERSION=`grep ^VERSION ${tallocdir}/wscript | sed -e "s/'//g" -e 's/.* //'`
        SMB_LIBRARY(talloc, 2, ${LIBTALLOCVERSION})
        LIBTALLOC_OBJ0=""
@@ -1979,9 +1889,7 @@ AC_SUBST(LIBTDB_OBJ0)
 if test "x$enable_external_libtdb" = xno
 then
        m4_include(../lib/tdb/libtdb.m4)
-       if test x"$USESHARED" == x"no" ; then
-               LINK_LIBTDB=STATIC
-       fi
+       LINK_LIBTDB=STATIC
        LIBTDBVERSION=`grep ^VERSION ${tdbdir}/wscript | sed -e "s/'//g" -e 's/.* //'`
        SMB_LIBRARY(tdb, 1, ${LIBTDBVERSION})
        LIBTDB_OBJ0=""
@@ -2005,11 +1913,56 @@ then
        AC_SUBST(TDBTORTURE)
 fi
 
+AC_ARG_ENABLE(external_libntdb,
+       [AS_HELP_STRING([--enable-external-libntdb],
+               [Enable external ntdb [default=auto]])],
+               [ enable_external_libntdb=$enableval ],
+               [ enable_external_libntdb=auto ])
+
+if test "x$enable_external_libntdb" != xno
+then
+       PKG_CHECK_MODULES(LIBNTDB, ntdb >= 1.0,
+               [ enable_external_libntdb=yes ],
+               [
+               if test x$enable_external_libntdb = xyes; then
+                       AC_MSG_ERROR([Unable to find libntdb])
+               else
+                       enable_external_libntdb=no
+               fi
+               ])
+fi
+
+AC_SUBST(LIBNTDB_OBJ0)
+if test "x$enable_external_libntdb" = xno
+then
+       m4_include(../lib/ntdb/libntdb.m4)
+       LINK_LIBNTDB=STATIC
+       LIBNTDBVERSION=`grep ^VERSION ${ntdbdir}/wscript | sed -e "s/'//g" -e 's/.* //'`
+       SMB_LIBRARY(ntdb, 1, ${LIBNTDBVERSION})
+       LIBNTDB_OBJ0=""
+       LIBNTDB_LIBS="$LIBNTDB_LIBS $NTDB_DEPS"
+       for obj in ${NTDB_OBJ}; do
+               LIBNTDB_OBJ0="${LIBNTDB_OBJ0} ${ntdbdir}/${obj}"
+       done
+       AC_SUBST(LIBNTDB_OBJ0)
+       SAMBA_CPPFLAGS="${SAMBA_CPPFLAGS} ${NTDB_CFLAGS}"
+       SAMBA_CONFIGURE_CPPFLAGS="${SAMBA_CONFIGURE_CPPFLAGS} ${NTDB_CFLAGS}"
+
+       NTDBBACKUP="bin/ntdbbackup"
+       AC_SUBST(NTDBBACKUP)
+       NTDBDUMP="bin/ntdbdump"
+       AC_SUBST(NTDBDUMP)
+       NTDBRESTORE="bin/ntdbrestore"
+       AC_SUBST(NTDBRESTORE)
+       NTDBTOOL="bin/ntdbtool"
+       AC_SUBST(NTDBTOOL)
+       NTDBTORTURE="bin/ntdbtorture"
+       AC_SUBST(NTDBTORTURE)
+fi
+
 SMB_LIBRARY(netapi, 0)
 SMB_LIBRARY(smbclient, 0)
 SMB_LIBRARY(smbsharemodes, 0)
-SMB_LIBRARY(addns, 0, [], no, [undefined API])
-
 
 
 ################
@@ -2149,14 +2102,6 @@ if test x"$samba_cv_HAVE_MAKEDEV" = x"yes"; then
     AC_DEFINE(HAVE_MAKEDEV,1,[Whether the macro for makedev is available])
 fi
 
-AC_CACHE_CHECK([for unsigned char],samba_cv_HAVE_UNSIGNED_CHAR,[
-AC_TRY_RUN([#include <stdio.h>
-main() { char c; c=250; exit((c > 0)?0:1); }],
-samba_cv_HAVE_UNSIGNED_CHAR=yes,samba_cv_HAVE_UNSIGNED_CHAR=no,samba_cv_HAVE_UNSIGNED_CHAR=cross)])
-if test x"$samba_cv_HAVE_UNSIGNED_CHAR" = x"yes"; then
-    AC_DEFINE(HAVE_UNSIGNED_CHAR,1,[Whether the 'unsigned char' type is available])
-fi
-
 AC_CACHE_CHECK([whether seekdir returns void],samba_cv_SEEKDIR_RETURNS_VOID,[
 AC_TRY_COMPILE([#include <sys/types.h>
 #include <dirent.h>
@@ -2904,13 +2849,13 @@ AC_TRY_COMPILE([
   #define _XOPEN_SOURCE 600
   #include <stdlib.h>
   #if defined(__GLIBC__) && ((__GLIBC__ < 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 4))
-    probably broken posix_fallocate
+  #error 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)
+       AC_DEFINE(HAVE_BROKEN_POSIX_FALLOCATE, 1, Whether we have a broken posix_fallocate)
 fi
 
 
@@ -3568,9 +3513,15 @@ if test x"$with_ads_support" != x"no"; then
        AC_MSG_WARN([Samba cannot be supported without GSSAPI])
        use_ads=no
   else
-       AC_DEFINE(HAVE_LIBGSSAPI, , [Whether the platform has GSSAPI support])
+       AC_DEFINE(HAVE_GSSAPI, , [Whether the platform has GSSAPI support])
   fi
 
+  # This is for FreeBSD (and possibly others). gss_mech_krb5 is a
+  # #define to GSS_KRB5_MECHANISM, which is defined in -lgssapi_krb5
+  # Also, gsskrb5_extract_authz_data_from_sec_context is in -lgssapi_krb5
+  AC_CHECK_LIB_EXT(gssapi_krb5, KRB5_LIBS, GSS_KRB5_MECHANISM,
+                  [KRB5_LIBS="$KRB5_LIBS -lgssapi_krb5"])
+
   AC_CHECK_FUNC_EXT(krb5_set_real_time, $KRB5_LIBS)
   AC_CHECK_FUNC_EXT(krb5_set_default_in_tkt_etypes, $KRB5_LIBS)
   AC_CHECK_FUNC_EXT(krb5_set_default_tgs_enctypes, $KRB5_LIBS)
@@ -3596,6 +3547,7 @@ if test x"$with_ads_support" != x"no"; then
   AC_CHECK_FUNC_EXT(krb5_principal_compare_any_realm, $KRB5_LIBS)
   AC_CHECK_FUNC_EXT(krb5_parse_name_norealm, $KRB5_LIBS)
   AC_CHECK_FUNC_EXT(krb5_princ_size, $KRB5_LIBS)
+  AC_CHECK_FUNC_EXT(krb5_make_principal, $KRB5_LIBS)
   AC_CHECK_FUNC_EXT(krb5_principal_get_num_comp, $KRB5_LIBS)
   AC_CHECK_FUNC_EXT(krb5_get_init_creds_opt_set_pac_request, $KRB5_LIBS)
   AC_CHECK_FUNC_EXT(krb5_get_renewed_creds, $KRB5_LIBS)
@@ -3618,6 +3570,7 @@ if test x"$with_ads_support" != x"no"; then
   AC_CHECK_FUNC_EXT(krb5_cc_get_lifetime, $KRB5_LIBS)
   AC_CHECK_FUNC_EXT(krb5_cc_retrieve_cred, $KRB5_LIBS)
   AC_CHECK_FUNC_EXT(krb5_free_checksum_contents, $KRB5_LIBS)
+  AC_CHECK_FUNC_EXT(krb5_create_checksum, $KRB5_LIBS)
   AC_CHECK_FUNC_EXT(krb5_c_make_checksum, $KRB5_LIBS)
   AC_CHECK_FUNC_EXT(gss_krb5_import_cred, $KRB5_LIBS)
   AC_CHECK_FUNC_EXT(gss_get_name_attribute, $KRB5_LIBS)
@@ -3627,11 +3580,6 @@ if test x"$with_ads_support" != x"no"; then
   AC_CHECK_FUNC_EXT(gss_inquire_sec_context_by_oid, $KRB5_LIBS)
   AC_CHECK_FUNC_EXT(gss_wrap_iov, $KRB5_LIBS)
 
-  # This is for FreeBSD (and possibly others). gss_mech_krb5 is a
-  # #define to GSS_KRB5_MECHANISM, which is defined in -lgssapi_krb5
-  AC_CHECK_LIB_EXT(gssapi_krb5, KRB5_LIBS, GSS_KRB5_MECHANISM,
-                  [KRB5_LIBS="$KRB5_LIBS -lgssapi_krb5"])
-
   # MIT krb5 1.8 does not expose this call (yet)
   AC_CHECK_DECLS(krb5_get_credentials_for_user, [], [], [#include <krb5.h>])
 
@@ -4033,6 +3981,17 @@ if test x"$with_ads_support" != x"no"; then
 
   AC_HAVE_DECL(KRB5_PDU_NONE,[#include <krb5.h>])
 
+  AC_CACHE_CHECK([for flags in krb5_creds],
+                samba_cv_HAVE_FLAGS_IN_KRB5_CREDS,[
+    AC_TRY_COMPILE([#include <krb5.h>],
+      [krb5_creds creds; creds.flags.b.initial = 0;],
+      samba_cv_HAVE_FLAGS_IN_KRB5_CREDS=yes,
+      samba_cv_HAVE_FLAGS_IN_KRB5_CREDS=no)])
+
+  if test x"$samba_cv_HAVE_FLAGS_IN_KRB5_CREDS" = x"yes"; then
+    AC_DEFINE(HAVE_FLAGS_IN_KRB5_CREDS,1,
+               [Whether the krb5_creds struct has a flags property])
+  fi
   #
   #
   # Now the decisions whether we can support krb5
@@ -4097,17 +4056,15 @@ if test x"$with_ads_support" != x"no"; then
     use_ads=no
   fi
 
-  if test x"$ac_cv_func_ext_krb5_c_string_to_key" != x"yes"
-  then
-    AC_MSG_WARN(krb5_c_string_to_key not found in -lkrb5)
-    use_ads=no
-  fi
-
-  if test x"$ac_cv_func_ext_krb5_principal2salt" != x"yes" -a \
-          x"$ac_cv_func_ext_krb5_get_pw_salt" != x"yes"
+  if test x"$ac_cv_func_ext_krb5_principal2salt" != x"yes" -o \
+         x"$ac_cv_func_ext_krb5_c_string_to_key" != x"yes"
   then
-    AC_MSG_WARN(no CREATE_KEY_FUNCTIONS detected)
-    use_ads=no
+       if test x"$ac_cv_func_ext_krb5_get_pw_salt" != x"yes" -o \
+            x"$ac_cv_func_ext_krb5_string_to_key_salt" != x"yes"
+       then
+             AC_MSG_WARN(no CREATE_KEY_FUNCTIONS detected)
+             use_ads=no
+       fi
   fi
 
   if test x"$ac_cv_func_ext_krb5_get_permitted_enctypes" != x"yes" -a \
@@ -4130,6 +4087,11 @@ if test x"$with_ads_support" != x"no"; then
     use_ads=no
   fi
 
+  if test x"$ac_cv_func_ext_gss_wrap_iov" != x"yes" ; then
+    AC_MSG_WARN(gss_wrap_iov not found in -lgssapi)
+    use_ads=no
+  fi
+
   if test x"$ac_cv_func_ext_gss_get_name_attribute" != x"yes" ; then
     if test x"$ac_cv_func_ext_gsskrb5_extract_authz_data_from_sec_context" != x"yes" -o \
             x"$ac_cv_func_ext_gss_inquire_sec_context_by_oid" != x"yes"
@@ -4152,6 +4114,7 @@ if test x"$with_ads_support" != x"no"; then
     AC_REMOVE_DEFINE(HAVE_GSSAPI_H)
     AC_REMOVE_DEFINE(HAVE_GSSAPI_GSSAPI_GENERIC_H)
     AC_REMOVE_DEFINE(HAVE_GSSAPI_GSSAPI_H)
+    AC_REMOVE_DEFINE(HAVE_GSSAPI)
     KRB5_LIBS=""
     with_ads_support=no
   fi
@@ -4193,51 +4156,12 @@ if test x"$with_dnsupdate_support" != x"no"; then
                        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)
-
-       
-       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
 fi
 
 if test x"$with_dnsupdate_support" != x"no"; then
-
-  ########################################################
-  # Now see if we can find the uuid libs in standard paths
-  # On some systems, the uuid API is in libc, so we have to
-  # be careful not to insert a spurious -luuid.
-
-  UUID_LIBS=""
-  AC_LIBTESTFUNC(uuid, uuid_generate,
-         [
-           case " $LIBS " in
-               *\ -luuid\ *)
-               UUID_LIBS="-luuid"
-               SMB_REMOVE_LIB(uuid)
-               ;;
-           esac
-
-           with_dnsupdate_support=yes
-           AC_DEFINE(WITH_DNS_UPDATES,1,[Whether to enable DNS Update support])
-       ],
-       [
-           if test x"$with_dnsupdate_support" = x"yes"; then
-               AC_MSG_ERROR(libuuid is needed to enable DNS Updates support)
-           else
-               AC_MSG_WARN(libuuid is needed to enable DNS Updates support)
-           fi
-           with_dnsupdate_support=no
-       ])
+      AC_DEFINE(WITH_DNS_UPDATES,1,[Whether to enable DNS Update support])
 fi
+
   # finally print out the result:
 AC_MSG_CHECKING(whether DNS Updates support is used)
 AC_MSG_RESULT([$with_dnsupdate_support])
@@ -5464,15 +5388,21 @@ esac
 #################################################
 # check for AIO support
 
+with_aio=auto
 AC_MSG_CHECKING(whether to support asynchronous io)
 AC_ARG_WITH(aio-support,
-[AS_HELP_STRING([--with-aio-support], [Include asynchronous io support (default=no)])],
-[ case "$withval" in
-  yes)
+[AS_HELP_STRING([--with-aio-support], [Include asynchronous io support (default=auto)])],
+[  case "$withval" in
+    yes|no)
+       with_aio=$withval
+       ;;
+   esac ])
 
-       AC_MSG_RESULT(yes)
-       case "$host_os" in
-       *)
+AC_MSG_RESULT($with_aio)
+
+if test x"$with_aio" = x"no"; then
+    AC_DEFINE(HAVE_NO_AIO,1,[Whether no asynchronous io support should be built in])
+else
                AIO_LIBS=$LIBS
                no_rt_LIBS=$LIBS
                AC_CHECK_LIB(rt,aio_read,[AIO_LIBS="$LIBS -lrt"])
@@ -5487,62 +5417,54 @@ AC_ARG_WITH(aio-support,
 samba_cv_HAVE_AIO=yes,samba_cv_HAVE_AIO=no)
                LIBS=$aio_LIBS])
                if test x"$samba_cv_HAVE_AIO" = x"yes"; then
-                       AC_DEFINE(WITH_AIO, 1, [Using asynchronous io])
+                       AC_DEFINE(HAVE_AIO, 1, [Using asynchronous io])
                        LIBS=$AIO_LIBS
                        AC_MSG_CHECKING(for aio_read)
-                       AC_LINK_IFELSE([#include <aio.h>
-int main() { struct aiocb a; return aio_read(&a); }],
+                       AC_LINK_IFELSE([AC_LANG_SOURCE([#include <aio.h>
+int main() { struct aiocb a; return aio_read(&a); }])],
 [AC_DEFINE(HAVE_AIO_READ, 1, [Have aio_read]) AC_MSG_RESULT(yes)],
 [AC_MSG_RESULT(no)])
 
                        AC_MSG_CHECKING(for aio_write)
-                       AC_LINK_IFELSE([#include <aio.h>
-int main() { struct aiocb a; return aio_write(&a); }],
+                       AC_LINK_IFELSE([AC_LANG_SOURCE([#include <aio.h>
+int main() { struct aiocb a; return aio_write(&a); }])],
 [AC_DEFINE(HAVE_AIO_WRITE, 1, [Have aio_write]) AC_MSG_RESULT(yes)],
 [AC_MSG_RESULT(no)])
 
                        AC_MSG_CHECKING(for aio_fsync)
-                       AC_LINK_IFELSE([#include <aio.h>
-int main() { struct aiocb a; return aio_fsync(1, &a); }],
+                       AC_LINK_IFELSE([AC_LANG_SOURCE([#include <aio.h>
+int main() { struct aiocb a; return aio_fsync(1, &a); }])],
 [AC_DEFINE(HAVE_AIO_FSYNC, 1, [Have aio_fsync]) AC_MSG_RESULT(yes)],
 [AC_MSG_RESULT(no)])
 
                        AC_MSG_CHECKING(for aio_return)
-                       AC_LINK_IFELSE([#include <aio.h>
-int main() { struct aiocb a; return aio_return(&a); }],
+                       AC_LINK_IFELSE([AC_LANG_SOURCE([#include <aio.h>
+int main() { struct aiocb a; return aio_return(&a); }])],
 [AC_DEFINE(HAVE_AIO_RETURN, 1, [Have aio_return]) AC_MSG_RESULT(yes)],
 [AC_MSG_RESULT(no)])
 
                        AC_MSG_CHECKING(for aio_error)
-                       AC_LINK_IFELSE([#include <aio.h>
-int main() { struct aiocb a; return aio_error(&a); }],
+                       AC_LINK_IFELSE([AC_LANG_SOURCE([#include <aio.h>
+int main() { struct aiocb a; return aio_error(&a); }])],
 [AC_DEFINE(HAVE_AIO_ERROR, 1, [Have aio_error]) AC_MSG_RESULT(yes)],
 [AC_MSG_RESULT(no)])
 
                        AC_MSG_CHECKING(for aio_cancel)
-                       AC_LINK_IFELSE([#include <aio.h>
-int main() { struct aiocb a; return aio_cancel(1, &a); }],
+                       AC_LINK_IFELSE([AC_LANG_SOURCE([#include <aio.h>
+int main() { struct aiocb a; return aio_cancel(1, &a); }])],
 [AC_DEFINE(HAVE_AIO_CANCEL, 1, [Have aio_cancel]) AC_MSG_RESULT(yes)],
 [AC_MSG_RESULT(no)])
 
                        AC_MSG_CHECKING(for aio_suspend)
-                       AC_LINK_IFELSE([#include <aio.h>
-int main() { struct aiocb a; return aio_suspend(&a, 1, NULL); }],
+                       AC_LINK_IFELSE([AC_LANG_SOURCE([#include <aio.h>
+int main() { struct aiocb a; return aio_suspend(&a, 1, NULL); }])],
 [AC_DEFINE(HAVE_AIO_SUSPEND, 1, [Have aio_suspend]) AC_MSG_RESULT(yes)],
 [AC_MSG_RESULT(no)])
+               else
+                       AC_DEFINE(HAVE_NO_AIO,1,[Whether no asynchronous io support is available])
+                       AC_MSG_RESULT(no)
                fi
-
-            ;;
-        esac
-        ;;
-  *)
-    AC_MSG_RESULT(no)
-    AC_DEFINE(HAVE_NO_AIO,1,[Whether no asynchronous io support is available])
-    ;;
-  esac ],
-  AC_DEFINE(HAVE_NO_AIO,1,[Whether no asynchronous io support should be built in])
-  AC_MSG_RESULT(no)
-)
+fi
 
 if test x"$samba_cv_HAVE_AIO" = x"yes"; then
        if test x"$samba_cv_msghdr_msg_control" = x"yes" -o \
@@ -5580,7 +5502,7 @@ io_getevents(ctx, 1, 1, &ioev, &ts);],
 samba_cv_HAVE_LINUX_KERNEL_AIO=yes,samba_cv_HAVE_LINUX_KERNEL_AIO=no)
                LIBS=$aio_LIBS])
            if test x"$samba_cv_HAVE_LINUX_KERNEL_AIO" = x"yes"; then
-               AC_DEFINE(WITH_AIO, 1, [Using asynchronous io])
+               AC_DEFINE(HAVE_AIO, 1, [Using asynchronous io])
                default_shared_modules="$default_shared_modules vfs_aio_linux"
            fi
             ;;
@@ -5611,28 +5533,10 @@ ssize_t nwritten = sendfile(tofd, fromfd, &offset, total);
 ],
 samba_cv_HAVE_SENDFILE=yes,samba_cv_HAVE_SENDFILE=no)])
 
-# Try and cope with broken Linux sendfile....
-               AC_CACHE_CHECK([for broken linux sendfile support],samba_cv_HAVE_BROKEN_LINUX_SENDFILE,[
-               AC_TRY_LINK([\
-#if defined(_FILE_OFFSET_BITS) && (_FILE_OFFSET_BITS == 64)
-#undef _FILE_OFFSET_BITS
-#endif
-#include <sys/sendfile.h>],
-[\
-int tofd, fromfd;
-off_t offset;
-size_t total;
-ssize_t nwritten = sendfile(tofd, fromfd, &offset, total);
-],
-samba_cv_HAVE_BROKEN_LINUX_SENDFILE=yes,samba_cv_HAVE_BROKEN_LINUX_SENDFILE=no)])
-
         if test x"$samba_cv_HAVE_SENDFILE" = x"yes"; then
                AC_DEFINE(HAVE_SENDFILE,1,[Whether sendfile() is available])
                AC_DEFINE(LINUX_SENDFILE_API,1,[Whether linux sendfile() API is available])
                AC_DEFINE(WITH_SENDFILE,1,[Whether sendfile() should be used])
-       elif test x"$samba_cv_HAVE_BROKEN_LINUX_SENDFILE" = x"yes"; then
-               AC_DEFINE(LINUX_BROKEN_SENDFILE_API,1,[Whether (linux) sendfile() is broken])
-               AC_DEFINE(WITH_SENDFILE,1,[Whether sendfile should be used])
        else
                AC_MSG_RESULT(no);
        fi
@@ -5823,7 +5727,7 @@ AC_CACHE_CHECK([for Linux splice],
 #include <unistd.h>
 #endif
 #include <fcntl.h>],
-    [long ret = splice(0,0,1,0,400,0);],
+    [long ret = splice(0,0,1,0,400,SPLICE_F_MOVE);],
     samba_cv_HAVE_LINUX_SPLICE=yes,
     samba_cv_HAVE_LINUX_SPLICE=no)])
 ;;
@@ -5901,7 +5805,7 @@ case "$host_os" in
                NSSSONAMEVERSIONSUFFIX=".2"
                WINBIND_NSS_EXTRA_OBJS="../nsswitch/winbind_nss_linux.o"
                ;;
-       *freebsd[[5-9]]*)
+       *freebsd[[5-9]]* | *freebsd1[[0-9]]*)
                # FreeBSD winbind client is implemented as a wrapper around
                # the Linux version.
                NSSSONAMEVERSIONSUFFIX=".1"
@@ -5911,7 +5815,7 @@ case "$host_os" in
                WINBIND_WINS_NSS="../nsswitch/nss_wins.$SHLIBEXT"
                ;;
 
-       *netbsd*[[3-9]]*)
+       *netbsd*[[3-9]]* | *netbsd1[[0-9]]*)
                # NetBSD winbind client is implemented as a wrapper
                # around the Linux version. It needs getpwent_r() to
                # indicate libc's use of the correct nsdispatch API.
@@ -6268,15 +6172,17 @@ fi
 if test x"$enable_pthreadpool" = x"yes" -a x"$samba_cv_HAVE_PTHREAD" = x"yes"; then
     LIBS="$LIBS $PTHREAD_LDFLAGS"
     CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
-    AC_DEFINE(WITH_PTHREADPOOL, 1, [Whether to include pthreadpool helpers])
     AC_SUBST(PTHREADPOOL_OBJ, "lib/pthreadpool/pthreadpool.o")
-    PTHREADPOOLTEST="bin/pthreadpooltest"
-    AC_SUBST(PTHREADPOOLTEST)
     if test x"$samba_cv_HAVE_AIO" = x"yes"; then
         default_shared_modules="$default_shared_modules vfs_aio_pthread"
     fi
+else
+    AC_SUBST(PTHREADPOOL_OBJ, "lib/pthreadpool/pthreadpool_sync.o")
 fi
 
+PTHREADPOOLTEST="bin/pthreadpooltest"
+AC_SUBST(PTHREADPOOLTEST)
+
 
 #################################################
 # Check to see if we should use the included iniparser
@@ -6468,7 +6374,6 @@ fi
 SMB_MODULE(pdb_ldap, passdb/pdb_ldap.o passdb/pdb_nds.o passdb/pdb_ipa.o passdb/pdb_ldap_util.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)
@@ -6489,8 +6394,6 @@ SMB_SUBSYSTEM(IDMAP, winbindd/idmap.o)
 SMB_MODULE(nss_info_template, winbindd/nss_info_template.o, "bin/template.$SHLIBEXT", NSS_INFO)
 SMB_SUBSYSTEM(NSS_INFO, winbindd/nss_info.o)
 
-SMB_SUBSYSTEM(CHARSET,lib/iconv.o)
-
 SMB_MODULE(auth_sam, \$(AUTH_SAM_OBJ), "bin/sam.$SHLIBEXT", AUTH)
 SMB_MODULE(auth_unix, \$(AUTH_UNIX_OBJ), "bin/unix.$SHLIBEXT", AUTH)
 SMB_MODULE(auth_winbind, \$(AUTH_WINBIND_OBJ), "bin/winbind.$SHLIBEXT", AUTH)
@@ -6498,7 +6401,6 @@ SMB_MODULE(auth_wbc, \$(AUTH_WBC_OBJ), "bin/wbc.$SHLIBEXT", AUTH)
 SMB_MODULE(auth_domain, \$(AUTH_DOMAIN_OBJ), "bin/domain.$SHLIBEXT", AUTH)
 SMB_MODULE(auth_builtin, \$(AUTH_BUILTIN_OBJ), "bin/builtin.$SHLIBEXT", AUTH)
 SMB_MODULE(auth_script, \$(AUTH_SCRIPT_OBJ), "bin/script.$SHLIBEXT", AUTH)
-SMB_MODULE(auth_netlogond, \$(AUTH_NETLOGOND_OBJ), "bin/netlogond.$SHLIBEXT", AUTH)
 SMB_SUBSYSTEM(AUTH,auth/auth.o)
 
 SMB_MODULE(vfs_default, \$(VFS_DEFAULT_OBJ), "bin/default.$SHLIBEXT", VFS)
@@ -6544,8 +6446,6 @@ SMB_MODULE(vfs_notify_fam, \$(VFS_NOTIFY_FAM_OBJ), "bin/notify_fam.$SHLIBEXT", V
 SMB_MODULE(vfs_acl_xattr, \$(VFS_ACL_XATTR_OBJ), "bin/acl_xattr.$SHLIBEXT", VFS)
 SMB_MODULE(vfs_acl_tdb, \$(VFS_ACL_TDB_OBJ), "bin/acl_tdb.$SHLIBEXT", VFS)
 SMB_MODULE(vfs_smb_traffic_analyzer, \$(VFS_SMB_TRAFFIC_ANALYZER_OBJ), "bin/smb_traffic_analyzer.$SHLIBEXT", VFS)
-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_MODULE(vfs_crossrename, \$(VFS_CROSSRENAME_OBJ), "bin/crossrename.$SHLIBEXT", VFS)
@@ -6554,7 +6454,6 @@ SMB_MODULE(vfs_time_audit, \$(VFS_TIME_AUDIT_OBJ), "bin/time_audit.$SHLIBEXT", V
 
 SMB_SUBSYSTEM(VFS,smbd/vfs.o)
 
-SMB_MODULE(perfcount_onefs, \$(PERFCOUNT_ONEFS), "bin/pc_onefs.$SHLIBEXT", PERFCOUNT)
 SMB_MODULE(perfcount_test, \$(PERFCOUNT_TEST), "bin/pc_test.$SHLIBEXT", PERFCOUNT)
 SMB_SUBSYSTEM(PERFCOUNT,smbd/perfcount.o)
 
@@ -6707,9 +6606,6 @@ fi
 if test x"$with_ldap_support" != x"no"; then
     AC_MSG_RESULT([    LDAP_LIBS = $LDAP_LIBS])
 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
@@ -6746,7 +6642,7 @@ fi
 ])
 
 AC_OUTPUT(Makefile
-         script/findsmb smbadduser script/gen-8bit-gap.sh script/installbin.sh script/uninstallbin.sh
+         script/findsmb smbadduser script/installbin.sh script/uninstallbin.sh
          lib/netapi/examples/Makefile
          lib/netapi/tests/Makefile
          pkgconfig/smbclient.pc