(merge from 3.0)
[samba.git] / source / configure.in
index dd8f650a5749c5f38824330a8ec5a924a916fec8..746fb9eb8916c6a60f618c0fa267631232bb4e00 100644 (file)
@@ -81,22 +81,6 @@ AC_ARG_WITH(piddir,
     ;;
   esac])
 
-#################################################
-# set SWAT directory location
-AC_ARG_WITH(swatdir,
-[  --with-swatdir=DIR      Where to put SWAT files ($ac_default_prefix/swat)],
-[ case "$withval" in
-  yes|no)
-  #
-  # Just in case anybody does it
-  #
-    AC_MSG_WARN([--with-swatdir called without argument - will use default])
-  ;;
-  * )
-    swatdir="$withval"
-    ;;
-  esac])
-
 #################################################
 # set configuration directory location
 AC_ARG_WITH(configdir,
@@ -134,7 +118,6 @@ AC_SUBST(lockdir)
 AC_SUBST(piddir)
 AC_SUBST(logfilebase)
 AC_SUBST(privatedir)
-AC_SUBST(swatdir)
 AC_SUBST(bindir)
 AC_SUBST(sbindir)
 
@@ -160,41 +143,6 @@ AC_SUBST(SMBWRAPPER)
 AC_SUBST(EXTRA_BIN_PROGS)
 AC_SUBST(EXTRA_SBIN_PROGS)
 AC_SUBST(EXTRA_ALL_TARGETS)
-dnl For the DYNAMIC RPC stuff
-dnl The complicated _YES and _NO stuff allows us to avoid a dependency
-dnl on GNU Make.
-AC_SUBST(LSA_DYNAMIC_YES)
-AC_SUBST(LSA_DYNAMIC_NO)
-LSA_DYNAMIC_YES="#"
-LSA_DYNAMIC_NO=
-AC_SUBST(NETLOG_DYNAMIC_YES)
-AC_SUBST(NETLOG_DYNAMIC_NO)
-NETLOG_DYNAMIC_YES="#"
-NETLOG_DYNAMIC_NO=
-AC_SUBST(SAMR_DYNAMIC_YES)
-AC_SUBST(SAMR_DYNAMIC_NO)
-SAMR_DYNAMIC_YES="#"
-SAMR_DYNAMIC_NO=
-AC_SUBST(SVC_DYNAMIC_YES)
-AC_SUBST(SVC_DYNAMIC_NO)
-SVC_DYNAMIC_YES="#"
-SVC_DYNAMIC_NO=
-AC_SUBST(WKS_DYNAMIC_YES)
-AC_SUBST(WKS_DYNAMIC_NO)
-WKS_DYNAMIC_YES="#"
-WKS_DYNAMIC_NO=
-AC_SUBST(REG_DYNAMIC_YES)
-AC_SUBST(REG_DYNAMIC_NO)
-REG_DYNAMIC_YES="#"
-REG_DYNAMIC_NO=
-AC_SUBST(SPOOLSS_DYNAMIC_YES)
-AC_SUBST(SPOOLSS_DYNAMIC_NO)
-SPOOLSS_DYNAMIC_YES="#"
-SPOOLSS_DYNAMIC_NO=
-AC_SUBST(DFS_DYNAMIC_YES)
-AC_SUBST(DFS_DYNAMIC_NO)
-DFS_DYNAMIC_YES="#"
-DFS_DYNAMIC_NO=
 
 AC_ARG_ENABLE(debug, 
 [  --enable-debug          Turn on compiler debugging information (default=no)],
@@ -204,89 +152,28 @@ AC_ARG_ENABLE(debug,
 
 AC_ARG_ENABLE(developer, [  --enable-developer      Turn on developer warnings and debugging (default=no)],
     [if eval "test x$enable_developer = xyes"; then
-       CFLAGS="${CFLAGS} -gstabs -Wall -Wshadow -Wstrict-prototypes -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -DDEBUG_PASSWORD -DDEVELOPER"
+        developer=yes
+       CFLAGS="${CFLAGS} -gstabs -Wall -Wshadow -Wstrict-prototypes -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -DDEBUG_PASSWORD -DDEVELOPER"
     fi])
 
 AC_ARG_ENABLE(krb5developer, [  --enable-krb5developer  Turn on developer warnings and debugging, except -Wstrict-prototypes (default=no)],
     [if eval "test x$enable_krb5developer = xyes"; then
+        developer=yes
        CFLAGS="${CFLAGS} -gstabs -Wall -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -DDEBUG_PASSWORD -DDEVELOPER"
     fi])
 
-# compile with optimization and without debugging by default
-if test "x$CFLAGS" = x; then
-   CFLAGS = "-O";
-fi
-
-AC_ARG_ENABLE(dmalloc, [  --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
-
-AC_ARG_ENABLE(dynrpc,  [  --enable-dynrpc         Enable dynamic RPC modules [default=no]])
-
-if test x$enable_dynrpc = xyes
-then
-       enable_dynrpc=lsa,samr,reg,wks,netlog,dfs
-fi
-
-if test x$enable_dynrpc != xno
-then
-       for i in `echo $enable_dynrpc | sed -e's/,/ /g'` 
-         do case $i in lsa)
-         LSA_DYNAMIC_YES=
-         LSA_DYNAMIC_NO="#"
-          AC_DEFINE(RPC_LSA_DYNAMIC, 1,
-                    [Define to make the LSA pipe dynamic])
-        ;; samr)
-          SAMR_DYNAMIC_YES=
-          SAMR_DYNAMIC_NO="#"
-         AC_DEFINE(RPC_SAMR_DYNAMIC, 1, 
-                   [Define to make the SAMR pipe dynamic])
-        ;; svc)
-          SVC_DYNAMIC_YES=
-          SVC_DYNAMIC_NO="#"
-         AC_DEFINE(RPC_SVC_DYNAMIC, 1, 
-                   [Define to make the SRVSVC pipe dynamic])
-        ;; wks)
-          WKS_DYNAMIC_YES=
-          WKS_DYNAMIC_NO="#"
-         AC_DEFINE(RPC_WKS_DYNAMIC, 1, 
-                   [Define to make the WKSSVC pipe dynamic])
-        ;; netlog)
-          NETLOG_DYNAMIC_YES=
-          NETLOG_DYNAMIC_NO="#"
-         AC_DEFINE(RPC_NETLOG_DYNAMIC, 1, 
-                   [Define to make the NETLOGON pipe dynamic])
-        ;; reg)
-          REG_DYNAMIC_YES=
-          REG_DYNAMIC_NO="#"
-         AC_DEFINE(RPC_REG_DYNAMIC, 1, 
-                   [Define to make the WINREG pipe dynamic])
-        ;; spoolss)
-          SPOOLSS_DYNAMIC_YES=
-          SPOOLSS_DYNAMIC_NO="#"
-         AC_DEFINE(RPC_SPOOLSS_DYNAMIC, 1, 
-                   [Define to make the SPOOLSS pipe dynamic])
-        ;; dfs)
-          DFS_DYNAMIC_YES=
-          DFS_DYNAMIC_NO="#"
-         AC_DEFINE(RPC_DFS_DYNAMIC, 1, 
-                   [Define to make the NETDFS pipe dynamic])
-        ;; esac
-         done
-fi
-
 dnl Checks for programs.
 AC_PROG_CC
 AC_PROG_INSTALL
-AC_PROG_AWK
 AC_PATH_PROG(PERL, perl)
 
+# compile with optimization and without debugging by default, but
+# allow people to set their own preference.
+if test "x$CFLAGS" = x
+then
+  CFLAGS="-O ${CFLAGS}"
+fi
+
 dnl Check if we use GNU ld
 LD=ld
 AC_PROG_LD_GNU
@@ -309,7 +196,7 @@ AC_SUBST(BROKEN_CC)
 AC_CACHE_CHECK([that the C compiler can precompile header files],samba_cv_precompiled_headers, [
        dnl Check whether the compiler can generate precompiled headers
        touch conftest.h
-       if ${CC-cc} conftest.h && test -f conftest.h.gch; then
+       if ${CC-cc} conftest.h 2> /dev/null && test -f conftest.h.gch; then
                samba_cv_precompiled_headers=yes
        else
                samba_cv_precompiled_headers=no
@@ -342,6 +229,18 @@ AC_VALIDATE_CACHE_SYSTEM_TYPE
 
 DYNEXP=
 
+dnl Add modules that have to be built by default here
+dnl These have to be built static:
+default_static_modules="ntvfs_ipc ntvfs_simple ntvfs_print ntvfs_cifs dcerpc_rpcecho dcerpc_epmapper dcerpc_remote"
+
+dnl These are preferably build shared, and static if dlopen() is not available
+default_shared_modules=""
+
+if test "x$developer" = xyes; then
+   default_static_modules="$default_static_modules"
+   default_shared_modules="$default_shared_modules"
+fi
+
 #
 # Config CPPFLAG settings for strange OS's that must be set
 # before other tests.
@@ -495,6 +394,8 @@ exit(1);
        AC_TRY_RUN([
 #include <unistd.h>
 #include <sys/utsname.h>
+#include <string.h>
+#include <stdlib.h>
 main() {
 #if _LFS64_LARGEFILE == 1
        struct utsname uts;
@@ -566,7 +467,7 @@ AC_HEADER_STDC
 AC_HEADER_DIRENT
 AC_HEADER_TIME
 AC_HEADER_SYS_WAIT
-AC_CHECK_HEADERS(arpa/inet.h sys/fcntl.h sys/select.h fcntl.h sys/time.h sys/unistd.h)
+AC_CHECK_HEADERS(arpa/inet.h sys/select.h fcntl.h sys/time.h)
 AC_CHECK_HEADERS(unistd.h utime.h grp.h sys/id.h limits.h memory.h net/if.h)
 AC_CHECK_HEADERS(compat.h rpc/rpc.h rpcsvc/nis.h rpcsvc/yp_prot.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/mode.h)
@@ -593,17 +494,7 @@ AC_CHECK_HEADERS(shadow.h netinet/ip.h netinet/tcp.h netinet/in_systm.h netinet/
 AC_CHECK_HEADERS(nss.h nss_common.h ns_api.h sys/security.h security/pam_appl.h security/pam_modules.h)
 AC_CHECK_HEADERS(stropts.h poll.h)
 AC_CHECK_HEADERS(sys/capability.h syscall.h sys/syscall.h)
-AC_CHECK_HEADERS(sys/acl.h sys/cdefs.h glob.h)
-
-# For experimental utmp support (lastlog on some BSD-like systems)
-AC_CHECK_HEADERS(utmp.h utmpx.h lastlog.h)
-# For quotas on Veritas VxFS filesystems
-AC_CHECK_HEADERS(sys/fs/vx_quota.h)
-
-# For quotas on Linux XFS filesystems
-AC_CHECK_HEADERS(linux/xqm.h)
-AC_CHECK_HEADERS(xfs/xqm.h)
+AC_CHECK_HEADERS(sys/acl.h)
 
 AC_CHECK_SIZEOF(int,cross)
 AC_CHECK_SIZEOF(long,cross)
@@ -627,23 +518,7 @@ AC_CHECK_TYPE(loff_t,off_t)
 AC_CHECK_TYPE(offset_t,loff_t)
 AC_CHECK_TYPE(ssize_t, int)
 AC_CHECK_TYPE(wchar_t, unsigned short)
-
-############################################
-# for cups support we need libcups, and a handful of header files
-
-AC_ARG_ENABLE(cups,
-[  --enable-cups           Turn on CUPS support (default=auto)])
-
-if test x$enable_cups != xno; then
-       AC_PATH_PROG(CUPS_CONFIG, cups-config)
-
-        if test "x$CUPS_CONFIG" != x; then
-                        AC_DEFINE(HAVE_CUPS,1,[Whether we have CUPS])
-               CFLAGS="$CFLAGS `$CUPS_CONFIG --cflags`"
-               LDFLAGS="$LDFLAGS `$CUPS_CONFIG --ldflags`"
-               PRINTLIBS="$PRINTLIBS `$CUPS_CONFIG --libs`"
-        fi
-fi
+AC_CHECK_TYPE(uint_t, unsigned int)
 
 ############################################
 # we need dlopen/dlclose/dlsym/dlerror for PAM, the password database plugins and the plugin loading code
@@ -1956,6 +1831,7 @@ dnl glibc2.1 broken check has succeeded.
 dnl 
 
   AC_CACHE_CHECK([for 64 bit fcntl locking],samba_cv_HAVE_STRUCT_FLOCK64,[
+  AC_CHECK_HEADERS(sys/fcntl.h)
   AC_TRY_RUN([
 #if defined(HAVE_UNISTD_H)
 #include <unistd.h>
@@ -2115,28 +1991,6 @@ AC_SUBST(SMBD_EXTRA_OBJS)
 AC_SUBST(SMBD_EXTRA_LIBS)
 
 
-#################################################
-# check for STFS NTVFS backend
-STFS_ENABLED=#
-AC_MSG_CHECKING(whether to use STFS NTVFS backend)
-AC_ARG_WITH(stfs,
-[  --with-stfs              Include STFS NTVFS backend (default=no) ],
-[ case "$withval" in
-  yes)
-    AC_MSG_RESULT(yes)
-    AC_DEFINE(WITH_NTVFS_STFS,1,[Whether to include STFS NTVFS backend])
-    STFS_ENABLED=
-    ;;
-  *)
-    AC_MSG_RESULT(no)
-    ;;
-  esac ],
-  AC_MSG_RESULT(no)
-)
-
-AC_SUBST(STFS_ENABLED)
-
-
 #################################################
 # check for the DFS clear-text auth system
 AC_MSG_CHECKING(whether to use DFS clear-text auth)
@@ -2154,246 +2008,8 @@ AC_ARG_WITH(dfs,
   AC_MSG_RESULT(no)
 )
 
-#################################################
-# active directory support
-
-with_ads_support=yes
-AC_MSG_CHECKING([whether to use Active Directory])
-
-AC_ARG_WITH(ads,
-[   --with-ads  Active Directory support (default yes)],
-[ case "$withval" in
-    no)
-       with_ads_support=no
-       ;;
-  esac ])
-
-if test x"$with_ads_support" = x"yes"; then
-   AC_DEFINE(WITH_ADS,1,[Whether to include Active Directory support])
-fi
-
-AC_MSG_RESULT($with_ads_support)
-
-FOUND_KRB5=no
-if test x"$with_ads_support" = x"yes"; then
-
-  #################################################
-  # check for krb5-config from recent MIT and Heimdal kerberos 5
-  AC_PATH_PROG(KRB5_CONFIG, krb5-config)
-  AC_MSG_CHECKING(for working krb5-config)
-  if test -x "$KRB5_CONFIG"; then
-    LIBS="$LIBS `$KRB5_CONFIG --libs`"
-    CFLAGS="$CFLAGS `$KRB5_CONFIG --cflags`" 
-    CPPFLAGS="$CPPFLAGS `$KRB5_CONFIG --cflags`"
-    FOUND_KRB5=yes
-    AC_MSG_RESULT(yes)
-  else
-    AC_MSG_RESULT(no. Fallback to previous krb5 detection strategy)
-  fi
-  
-  if test x$FOUND_KRB5 = x"no"; then
-  #################################################
-  # check for location of Kerberos 5 install
-  AC_MSG_CHECKING(for kerberos 5 install path)
-  AC_ARG_WITH(krb5,
-  [  --with-krb5=base-dir    Locate Kerberos 5 support (default=/usr)],
-  [ case "$withval" in
-    no)
-      AC_MSG_RESULT(no)
-      ;;
-    *)
-      AC_MSG_RESULT(yes)
-      LIBS="$LIBS -lkrb5"
-      CFLAGS="$CFLAGS -I$withval/include"
-      CPPFLAGS="$CPPFLAGS -I$withval/include"
-      LDFLAGS="$LDFLAGS -L$withval/lib"
-      FOUND_KRB5=yes
-      ;;
-    esac ],
-    AC_MSG_RESULT(no)
-  )
-  fi
-
-if test x$FOUND_KRB5 = x"no"; then
-#################################################
-# see if this box has the SuSE location for the heimdal kerberos implementation
-AC_MSG_CHECKING(for /usr/include/heimdal)
-if test -d /usr/include/heimdal; then
-    if test -f /usr/lib/heimdal/lib/libkrb5.a; then
-        LIBS="$LIBS -lkrb5"
-        CFLAGS="$CFLAGS -I/usr/include/heimdal"
-        CPPFLAGS="$CPPFLAGS -I/usr/include/heimdal"
-        LDFLAGS="$LDFLAGS -L/usr/lib/heimdal/lib"
-        AC_MSG_RESULT(yes)
-    else
-        LIBS="$LIBS -lkrb5"
-        CFLAGS="$CFLAGS -I/usr/include/heimdal"
-        CPPFLAGS="$CPPFLAGS -I/usr/include/heimdal"
-        AC_MSG_RESULT(yes)
-    fi
-else
-    AC_MSG_RESULT(no)
-fi
-fi
-
-
-if test x$FOUND_KRB5 = x"no"; then
-#################################################
-# see if this box has the RedHat location for kerberos
-AC_MSG_CHECKING(for /usr/kerberos)
-if test -d /usr/kerberos -a -f /usr/kerberos/lib/libkrb5.a; then
-    LIBS="$LIBS -lkrb5"
-    LDFLAGS="$LDFLAGS -L/usr/kerberos/lib"
-    CFLAGS="$CFLAGS -I/usr/kerberos/include"
-    CPPFLAGS="$CPPFLAGS -I/usr/kerberos/include"
-    AC_MSG_RESULT(yes)
-else
-    AC_MSG_RESULT(no)
-fi
-fi
-
-  # 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)
-
-  # now check for gssapi headers.  This is also done here to allow for
-  # different kerberos include paths
-  AC_CHECK_HEADERS(gssapi.h gssapi/gssapi_generic.h gssapi/gssapi.h com_err.h)
-
-  ##################################################################
-  # we might need the k5crypto and com_err libraries on some systems
-  AC_CHECK_LIB(com_err, _et_list, [LIBS="$LIBS -lcom_err"])
-  AC_CHECK_LIB(k5crypto, krb5_encrypt_data, [LIBS="$LIBS -lk5crypto"])
-  # Heimdal checks.
-  AC_CHECK_LIB(crypto, des_set_key, [LIBS="$LIBS -lcrypto"])
-  AC_CHECK_LIB(asn1, copy_Authenticator, [LIBS="$LIBS -lasn1 -lroken"])
-  # Heimdal checks. On static Heimdal gssapi must be linked before krb5.
-  AC_CHECK_LIB(gssapi, gss_display_status, [LIBS="$LIBS -lgssapi -lkrb5 -lasn1";
-        AC_DEFINE(HAVE_GSSAPI,1,[Whether GSSAPI is available])])
-
-  AC_CHECK_LIB(krb5, krb5_set_real_time, [AC_DEFINE(HAVE_KRB5_SET_REAL_TIME,1,[Whether krb5_set_real_time is available])])
-  AC_CHECK_LIB(krb5, krb5_set_default_in_tkt_etypes, [AC_DEFINE(HAVE_KRB5_SET_DEFAULT_IN_TKT_ETYPES,1,[Whether krb5_set_default_in_tkt_etypes, is available])])
-  AC_CHECK_LIB(krb5, krb5_set_default_tgs_ktypes, [AC_DEFINE(HAVE_KRB5_SET_DEFAULT_TGS_KTYPES,1,[Whether krb5_set_default_tgs_ktypes is available])])
-
-  AC_CHECK_LIB(krb5, krb5_principal2salt, [AC_DEFINE(HAVE_KRB5_PRINCIPAL2SALT,1,[Whether krb5_principal2salt is available])])
-  AC_CHECK_LIB(krb5, krb5_use_enctype, [AC_DEFINE(HAVE_KRB5_USE_ENCTYPE,1,[Whether krb5_use_enctype is available])])
-  AC_CHECK_LIB(krb5, krb5_string_to_key, [AC_DEFINE(HAVE_KRB5_STRING_TO_KEY,1,[Whether krb5_string_to_key is available])])
-  AC_CHECK_LIB(krb5, krb5_get_pw_salt, [AC_DEFINE(HAVE_KRB5_GET_PW_SALT,1,[Whether krb5_get_pw_salt is available])])
-  AC_CHECK_LIB(krb5, krb5_string_to_key_salt, [AC_DEFINE(HAVE_KRB5_STRING_TO_KEY_SALT,1,[Whether krb5_string_to_key_salt is available])])
-  AC_CHECK_LIB(krb5, krb5_auth_con_setkey, [AC_DEFINE(HAVE_KRB5_AUTH_CON_SETKEY,1,[Whether krb5_auth_con_setkey is available])])
-  AC_CHECK_LIB(krb5, krb5_auth_con_setuseruserkey, [AC_DEFINE(HAVE_KRB5_AUTH_CON_SETUSERUSERKEY,1,[Whether krb5_auth_con_setuseruserkey is available])])
-  AC_CHECK_LIB(krb5, krb5_locate_kdc, [AC_DEFINE(HAVE_KRB5_LOCATE_KDC,1,[Whether krb5_locate_kdc is available])])
-  AC_CHECK_LIB(krb5, krb5_get_permitted_enctypes, [AC_DEFINE(HAVE_KRB5_GET_PERMITTED_ENCTYPES,1,[Whether krb5_get_permitted_enctypes is available])])
-  AC_CHECK_LIB(krb5, krb5_get_default_in_tkt_etypes, [AC_DEFINE(HAVE_KRB5_GET_DEFAULT_IN_TKT_ETYPES,1,[Whether krb5_get_default_in_tkt_etypes is available])])
-  AC_CHECK_LIB(krb5, krb5_free_ktypes, [AC_DEFINE(HAVE_KRB5_FREE_KTYPES,1,[Whether krb5_free_ktypes is available])])
-
-AC_CACHE_CHECK([for addrtype in krb5_address],samba_cv_HAVE_ADDRTYPE_IN_KRB5_ADDRESS,[
-AC_TRY_COMPILE([#include <krb5.h>],
-[krb5_address kaddr; kaddr.addrtype = ADDRTYPE_INET;],
-samba_cv_HAVE_ADDRTYPE_IN_KRB5_ADDRESS=yes,samba_cv_HAVE_ADDRTYPE_IN_KRB5_ADDRESS=no)])
-if test x"$samba_cv_HAVE_ADDRTYPE_IN_KRB5_ADDRESS" = x"yes"; then
-    AC_DEFINE(HAVE_ADDRTYPE_IN_KRB5_ADDRESS,1,[Whether the krb5_address struct has a addrtype property])
-fi
-
-AC_CACHE_CHECK([for addr_type in krb5_address],samba_cv_HAVE_ADDR_TYPE_IN_KRB5_ADDRESS,[
-AC_TRY_COMPILE([#include <krb5.h>],
-[krb5_address kaddr; kaddr.addr_type = KRB5_ADDRESS_INET;],
-samba_cv_HAVE_ADDR_TYPE_IN_KRB5_ADDRESS=yes,samba_cv_HAVE_ADDR_TYPE_IN_KRB5_ADDRESS=no)])
-if test x"$samba_cv_HAVE_ADDR_TYPE_IN_KRB5_ADDRESS" = x"yes"; then
-    AC_DEFINE(HAVE_ADDR_TYPE_IN_KRB5_ADDRESS,1,[Whether the krb5_address struct has a addr_type property])
-fi
-
-AC_CACHE_CHECK([for enc_part2 in krb5_ticket],samba_cv_HAVE_KRB5_TKT_ENC_PART2,[
-AC_TRY_COMPILE([#include <krb5.h>],
-[krb5_ticket tkt; tkt.enc_part2->authorization_data[0]->contents = NULL;],
-samba_cv_HAVE_KRB5_TKT_ENC_PART2=yes,samba_cv_HAVE_KRB5_TKT_ENC_PART2=no)])
-if test x"$samba_cv_HAVE_KRB5_TKT_ENC_PART2" = x"yes"; then
-    AC_DEFINE(HAVE_KRB5_TKT_ENC_PART2,1,[Whether the krb5_ticket struct has a enc_part2 property])
-fi
-
-AC_CACHE_CHECK([for keyvalue in krb5_keyblock],samba_cv_HAVE_KRB5_KEYBLOCK_KEYVALUE,[
-AC_TRY_COMPILE([#include <krb5.h>],
-[krb5_keyblock key; key.keyvalue.data = NULL;],
-samba_cv_HAVE_KRB5_KEYBLOCK_KEYVALUE=yes,samba_cv_HAVE_KRB5_KEYBLOCK_KEYVALUE=no)])
-if test x"$samba_cv_HAVE_KRB5_KEYBLOCK_KEYVALUE" = x"yes"; then
-    AC_DEFINE(HAVE_KRB5_KEYBLOCK_KEYVALUE,1,[Whether the krb5_keyblock struct has a keyvalue property])
-fi
-
-AC_CACHE_CHECK([for ENCTYPE_ARCFOUR_HMAC_MD5],samba_cv_HAVE_ENCTYPE_ARCFOUR_HMAC_MD5,[
-AC_TRY_COMPILE([#include <krb5.h>],
-[krb5_enctype enctype; enctype = ENCTYPE_ARCFOUR_HMAC_MD5;],
-samba_cv_HAVE_ENCTYPE_ARCFOUR_HMAC_MD5=yes,samba_cv_HAVE_ENCTYPE_ARCFOUR_HMAC_MD5=no)])
-if test x"$samba_cv_HAVE_ENCTYPE_ARCFOUR_HMAC_MD5" = x"yes"; then
-    AC_DEFINE(HAVE_ENCTYPE_ARCFOUR_HMAC_MD5,1,[Whether the ENCTYPE_ARCFOUR_HMAC_MD5 key type is available])
-fi
-
-  ########################################################
-  # now see if we can find the krb5 libs in standard paths
-  # or as specified above
-  AC_CHECK_LIB(krb5, krb5_mk_req_extended, [LIBS="$LIBS -lkrb5";
-        AC_DEFINE(HAVE_KRB5,1,[Whether KRB5 is available])])
-
-  ########################################################
-  # now see if we can find the gssapi libs in standard paths
-  AC_CHECK_LIB(gssapi_krb5, gss_display_status, [LIBS="$LIBS -lgssapi_krb5";
-        AC_DEFINE(HAVE_GSSAPI,1,[Whether GSSAPI is available])])
-
-fi
-
-########################################################
-# Compile with LDAP support?
-
-with_ldap_support=yes
-AC_MSG_CHECKING([whether to use LDAP])
-
-AC_ARG_WITH(ldap,
-[   --with-ldap  LDAP support (default yes)],
-[ case "$withval" in
-    no)
-       with_ldap_support=no
-       ;;
-  esac ])
-
-AC_MSG_RESULT($with_ldap_support)
-
-if test x"$with_ldap_support" = x"yes"; then
-
-  ##################################################################
-  # we might need the lber lib on some systems. To avoid link errors
-  # this test must be before the libldap test
-  AC_CHECK_LIB(lber, ber_scanf, [LIBS="$LIBS -llber"])
-
-  ########################################################
-  # now see if we can find the ldap libs in standard paths
-  if test x$have_ldap != xyes; then
-  AC_CHECK_LIB(ldap, ldap_domain2hostlist, [LIBS="$LIBS -lldap";
-       AC_DEFINE(HAVE_LDAP,1,[Whether ldap is available])])
-
-       ########################################################
-       # If we have LDAP, does it's rebind procedure take 2 or 3 arguments?
-       # Check found in pam_ldap 145.
-       AC_CHECK_FUNCS(ldap_set_rebind_proc)
-       AC_CACHE_CHECK(whether ldap_set_rebind_proc takes 3 arguments, pam_ldap_cv_ldap_set_rebind_proc, [
-       AC_TRY_COMPILE([
-       #include <lber.h>
-       #include <ldap.h>], [ldap_set_rebind_proc(0, 0, 0);], [pam_ldap_cv_ldap_set_rebind_proc=3], [pam_ldap_cv_ldap_set_rebind_proc=2]) ])
-       AC_DEFINE_UNQUOTED(LDAP_SET_REBIND_PROC_ARGS, $pam_ldap_cv_ldap_set_rebind_proc, [Number of arguments to ldap_set_rebind_proc])
-  fi
-fi
-
-########################################################
-# Compile with MySQL support?
-AM_PATH_MYSQL([0.11.0],[MODULE_MYSQL=bin/mysql.so],[MODULE_MYSQL=])
-CFLAGS="$CFLAGS $MYSQL_CFLAGS"
-AC_SUBST(MODULE_MYSQL)
-
-########################################################
-# Compile with XML support?
-AM_PATH_XML2([2.0.0],[MODULE_XML=bin/xml.so],[MODULE_XML=])
-CFLAGS="$CFLAGS $XML_CFLAGS"
-AC_SUBST(MODULE_XML)
+sinclude(libads/config.m4)
+sinclude(passdb/config.m4)
 
 #################################################
 # check for automount support
@@ -2446,10 +2062,12 @@ AC_ARG_WITH(pam,
 [  --with-pam              Include PAM support (default=no)],
 [ case "$withval" in
   yes)
-    AC_MSG_RESULT(yes)
-    AC_DEFINE(WITH_PAM,1,[Whether to include PAM support])
-    AUTHLIBS="$AUTHLIBS -lpam"
-    with_pam_for_crypt=yes
+    AC_MSG_RESULT(no)
+       AC_MSG_WARN(pam is disabled in samba4 until someone fixes it)
+#    AC_MSG_RESULT(yes)
+#    AC_DEFINE(WITH_PAM,1,[Whether to include PAM support])
+#    AUTHLIBS="$AUTHLIBS -lpam"
+#    with_pam_for_crypt=yes
     ;;
   *)
     AC_MSG_RESULT(no)
@@ -2512,39 +2130,15 @@ if test x"$samba_cv_HAVE_TRUNCATED_SALT" = x"yes"; then
 fi
 fi
 
-# New experimental SAM system
-
-AC_MSG_CHECKING([whether to build the new (experimental) SAM database])
-AC_ARG_WITH(sam,
-[  --with-sam              Build new (experimental) SAM database (default=no)],
-[ case "$withval" in
-  yes)
-    AC_MSG_RESULT(yes)
-    AC_DEFINE(WITH_SAM,1,[Whether to build the new (experimental) SAM database])
-    ;;
-  *)
-    AC_MSG_RESULT(no)
-    ;;
-  esac ],
-  AC_MSG_RESULT(no)
-)
-
-
-########################################################################################
-##
-## TESTS FOR SAM BACKENDS.  KEEP THESE GROUPED TOGETHER
-##
-########################################################################################
-
 #################################################
-# check for a LDAP password database configuration backwards compatibility
-AC_MSG_CHECKING(whether to use LDAP SAM 2.2 compatible configuration)
-AC_ARG_WITH(ldapsam,
-[  --with-ldapsam           Include LDAP SAM 2.2 compatible configuration (default=no)],
+# check for a NISPLUS_HOME support 
+AC_MSG_CHECKING(whether to use NISPLUS_HOME)
+AC_ARG_WITH(nisplus-home,
+[  --with-nisplus-home     Include NISPLUS_HOME support (default=no)],
 [ case "$withval" in
   yes)
     AC_MSG_RESULT(yes)
-    AC_DEFINE(WITH_LDAP_SAMCONFIG,1,[Whether to include 2.2 compatibel LDAP SAM configuration])
+    AC_DEFINE(WITH_NISPLUS_HOME,1,[Whether to include nisplus_home support])
     ;;
   *)
     AC_MSG_RESULT(no)
@@ -2554,14 +2148,14 @@ AC_ARG_WITH(ldapsam,
 )
 
 #################################################
-# check for a TDB password database
-AC_MSG_CHECKING(whether to use TDB SAM database)
-AC_ARG_WITH(tdbsam,
-[  --with-tdbsam           Include experimental TDB SAM support (default=no)],
+# check for syslog logging
+AC_MSG_CHECKING(whether to use syslog logging)
+AC_ARG_WITH(syslog,
+[  --with-syslog           Include experimental SYSLOG support (default=no)],
 [ case "$withval" in
   yes)
     AC_MSG_RESULT(yes)
-    AC_DEFINE(WITH_TDB_SAM,1,[Whether to include experimental TDB SAM support])
+    AC_DEFINE(WITH_SYSLOG,1,[Whether to include experimental syslog support])
     ;;
   *)
     AC_MSG_RESULT(no)
@@ -2571,14 +2165,14 @@ AC_ARG_WITH(tdbsam,
 )
 
 #################################################
-# check for a NISPLUS password database
-AC_MSG_CHECKING(whether to use NISPLUS SAM database)
-AC_ARG_WITH(nisplussam,
-[  --with-nisplussam       Include NISPLUS SAM support (default=no)],
+# check for a shared memory profiling support
+AC_MSG_CHECKING(whether to use profiling)
+AC_ARG_WITH(profiling-data,
+[  --with-profiling-data   Include gathering source code profile information (default=no)],
 [ case "$withval" in
   yes)
     AC_MSG_RESULT(yes)
-    AC_DEFINE(WITH_NISPLUS_SAM,1,[Whether to include nisplus SAM support])
+    AC_DEFINE(WITH_PROFILE,1,[Whether to use profiling])
     ;;
   *)
     AC_MSG_RESULT(no)
@@ -2587,12 +2181,6 @@ AC_ARG_WITH(nisplussam,
   AC_MSG_RESULT(no)
 )
 
-########################################################################################
-##
-## END OF TESTS FOR SAM BACKENDS.  
-##
-########################################################################################
-
 #################################################
 # check for a NISPLUS_HOME support 
 AC_MSG_CHECKING(whether to use NISPLUS_HOME)
@@ -2610,24 +2198,6 @@ AC_ARG_WITH(nisplus-home,
   AC_MSG_RESULT(no)
 )
 
-#################################################
-# check for syslog logging
-AC_MSG_CHECKING(whether to use syslog logging)
-AC_ARG_WITH(syslog,
-[  --with-syslog           Include experimental SYSLOG support (default=no)],
-[ case "$withval" in
-  yes)
-    AC_MSG_RESULT(yes)
-    AC_DEFINE(WITH_SYSLOG,1,[Whether to include experimental syslog support])
-    ;;
-  *)
-    AC_MSG_RESULT(no)
-    ;;
-  esac ],
-  AC_MSG_RESULT(no)
-)
-
-
 #################################################
 # check for experimental disk-quotas support
 QUOTAOBJS=smbd/noquotas.o
@@ -2711,54 +2281,6 @@ AC_ARG_WITH(manpages-langs,
   AC_SUBST(manlangs)]
 )
 
-#################################################
-# should we build libsmbclient?
-
-INSTALLCLIENTCMD_SH=:
-INSTALLCLIENTCMD_A=:
-LIBSMBCLIENT_SHARED=
-LIBSMBCLIENT=
-AC_MSG_CHECKING(whether to build the libsmbclient shared library)
-AC_ARG_WITH(libsmbclient,
-[  --with-libsmbclient     Build the libsmbclient shared library (default=yes if shared libs supported)],
-[ case "$withval" in
-  no) 
-     AC_MSG_RESULT(no)
-     ;;
-  *)
-     if test $BLDSHARED = true; then
-        INSTALLCLIENTCMD_SH="\$(INSTALLCMD)"
-        LIBSMBCLIENT_SHARED=bin/libsmbclient.$SHLIBEXT
-        LIBSMBCLIENT=libsmbclient
-        AC_MSG_RESULT(yes)
-     else
-       enable_static=yes
-        AC_MSG_RESULT(no shared library support -- will supply static library)
-     fi
-     if test $enable_static = yes; then
-        INSTALLCLIENTCMD_A="\$(INSTALLCMD)"
-        LIBSMBCLIENT=libsmbclient
-     fi
-     ;;
-  esac ],
-[
-# if unspecified, default is to built it iff possible.
-  if test $BLDSHARED = true; then
-     INSTALLCLIENTCMD_SH="\$(INSTALLCMD)"
-     LIBSMBCLIENT_SHARED=bin/libsmbclient.$SHLIBEXT
-     LIBSMBCLIENT=libsmbclient
-     AC_MSG_RESULT(yes)
-   else
-     enable_static=yes
-     AC_MSG_RESULT(no shared library support -- will supply static library)
-   fi
-   if test $enable_static = yes; then
-     INSTALLCLIENTCMD_A="\$(INSTALLCMD)"
-     LIBSMBCLIENT=libsmbclient
-  fi]
-)
-
-
 #################################################
 # these tests are taken from the GNU fileutils package
 AC_CHECKING(how to get filesystem space usage)
@@ -3266,173 +2788,49 @@ samba_cv_HAVE_SENDFILEV=yes,samba_cv_HAVE_SENDFILEV=no)])
   AC_MSG_RESULT(yes)
 )
 
+sinclude(nsswitch/config.m4)
+sinclude(popt/config.m4)
 
-#################################################
-# Check whether winbind is supported on this platform.  If so we need to
-# build and install client programs, sbin programs and shared libraries
-
-AC_MSG_CHECKING(whether to build winbind)
-
-# Initially, the value of $host_os decides whether winbind is supported
-
-case "$host_os" in
-       *linux*|*irix*)
-               HAVE_WINBIND=yes
-               ;;
-       *solaris*)
-               HAVE_WINBIND=yes
-               WINBIND_NSS_EXTRA_OBJS="nsswitch/winbind_nss_solaris.o"
-               WINBIND_NSS_EXTRA_LIBS="-lsocket"
-               ;;
-       *hpux11*)
-               HAVE_WINBIND=yes
-               WINBIND_NSS_EXTRA_OBJS="nsswitch/winbind_nss_solaris.o"
-               ;;
-       *)
-               HAVE_WINBIND=no
-               winbind_no_reason=", unsupported on $host_os"
-               ;;
-esac
-
-AC_SUBST(WINBIND_NSS_EXTRA_OBJS)
-AC_SUBST(WINBIND_NSS_EXTRA_LIBS)
-
-# Check the setting of --with-winbindd
-
-AC_ARG_WITH(winbind,
-[  --with-winbind          Build winbind (default, if supported by OS)],
-[ 
-  case "$withval" in
-       yes)
-               HAVE_WINBIND=yes
-               ;;
-        no)
-               HAVE_WINBIND=no
-                winbind_reason=""
-                ;;
-  esac ],
-)
-
-# We need unix domain sockets for winbind
-
-if test x"$HAVE_WINBIND" = x"yes"; then
-       if test x"$samba_cv_unixsocket" = x"no"; then
-               winbind_no_reason=", no unix domain socket support on $host_os"
-               HAVE_WINBIND=no
-       fi
-fi
-
-# Display test results
+for i in `echo $default_static_modules | sed -e's/,/ /g'`
+do
+       eval MODULE_DEFAULT_$i=STATIC
+done
 
-if test x"$HAVE_WINBIND" = x"yes"; then
-        AC_MSG_RESULT(yes)
-       AC_DEFINE(WITH_WINBIND,1,[Whether to build winbind])
+for i in `echo $default_shared_modules | sed -e's/,/ /g'`
+do
+       dnl Fall back to static if dlopen() is not available
+       eval MODULE_DEFAULT_$i=STATIC
 
-       EXTRA_BIN_PROGS="$EXTRA_BIN_PROGS bin/wbinfo\$(EXEEXT)"
-       EXTRA_SBIN_PROGS="$EXTRA_SBIN_PROGS bin/winbindd\$(EXEEXT)"
-        if test x"$BLDSHARED" = x"true"; then
-               case "$host_os" in
-               *irix*)
-                       SHLIB_PROGS="$SHLIB_PROGS nsswitch/libns_winbind.so"
-                       ;;
-               *)
-                       SHLIB_PROGS="$SHLIB_PROGS nsswitch/libnss_winbind.so"
-                       ;;
-               esac
-               if test x"$with_pam" = x"yes"; then
-                       SHLIB_PROGS="$SHLIB_PROGS nsswitch/pam_winbind.so"
-               fi
+       if test x"$ac_cv_func_dlopen" = xyes; then
+               eval MODULE_DEFAULT_$i=SHARED
        fi
-else
-        AC_MSG_RESULT(no$winbind_no_reason)
-fi
-
-# Solaris has some extra fields in struct passwd that need to be
-# initialised otherwise nscd crashes.  Unfortunately autoconf < 2.50
-# doesn't have the AC_CHECK_MEMBER macro which would be handy for checking
-# this. 
-
-#AC_CHECK_MEMBER(struct passwd.pw_comment,
-#              AC_DEFINE(HAVE_PASSWD_PW_COMMENT, 1, [Defined if struct passwd has pw_comment field]),
-#              [#include <pwd.h>])
-
-AC_CACHE_CHECK([whether struct passwd has pw_comment],samba_cv_passwd_pw_comment, [
-    AC_TRY_COMPILE([#include <pwd.h>],[struct passwd p; p.pw_comment;],
-       samba_cv_passwd_pw_comment=yes,samba_cv_passwd_pw_comment=no)])
-if test x"$samba_cv_passwd_pw_comment" = x"yes"; then
-   AC_DEFINE(HAVE_PASSWD_PW_COMMENT,1,[Whether struct passwd has pw_comment])
-fi
-
-#AC_CHECK_MEMBER(struct passwd.pw_age,
-#              AC_DEFINE(HAVE_PASSWD_PW_AGE, 1, [Defined if struct passwd has pw_age field]),
-#              [#include <pwd.h>])
-
-AC_CACHE_CHECK([whether struct passwd has pw_age],samba_cv_passwd_pw_age, [
-    AC_TRY_COMPILE([#include <pwd.h>],[struct passwd p; p.pw_age;],
-       samba_cv_passwd_pw_age=yes,samba_cv_passwd_pw_age=no)])
-if test x"$samba_cv_passwd_pw_age" = x"yes"; then
-   AC_DEFINE(HAVE_PASSWD_PW_AGE,1,[Whether struct passwd has pw_age])
-fi
-
-#################################################
-# Check to see if we should use the included popt 
-
-AC_ARG_WITH(included-popt,
-[  --with-included-popt    use bundled popt library, not from system],
-[ 
-  case "$withval" in
-       yes)
-               INCLUDED_POPT=yes
-               ;;
-        no)
-               INCLUDED_POPT=no
-                ;;
-  esac ],
-)
-if test x"$INCLUDED_POPT" != x"yes"; then
-    AC_CHECK_LIB(popt, poptGetContext,
-                INCLUDED_POPT=no, INCLUDED_POPT=yes)
-fi
-
-AC_MSG_CHECKING(whether to use included popt)
-if test x"$INCLUDED_POPT" = x"yes"; then
-    AC_MSG_RESULT(yes)
-    BUILD_POPT='$(POPT_OBJS)'
-    FLAGS1="-I$srcdir/popt"
-else
-    AC_MSG_RESULT(no)
-    LIBS="$LIBS -lpopt"
-fi
-AC_SUBST(BUILD_POPT)
-AC_SUBST(FLAGS1)
+done
 
-#################################################
-# Check if the user wants Python
+dnl Always built these modules static
+AC_ARG_WITH(static-modules,
+[  --with-static-modules=MODULES  Comma-seperated list of names of modules to statically link in],
+[ if test $withval; then
+       for i in `echo $withval | sed -e's/,/ /g'`
+       do
+               eval MODULE_$i=STATIC
+       done
+fi ])
 
-# At the moment, you can use this to set which Python binary to link
-# against.  (Libraries built for Python2.2 can't be used by 2.1,
-# though they can coexist in different directories.)  In the future
-# this might make the Python stuff be built by default.
+AC_ARG_WITH(shared-modules,
+[  --with-shared-modules=MODULES  Comma-seperated list of names of modules to build shared],
+[ if test $withval; then
+       for i in `echo $withval | sed -e's/,/ /g'`
+       do
+                       eval MODULE_$i=SHARED
+       done
+fi ])
 
-# Defaulting python breaks the clean target if python isn't installed
+SMB_SUBSYSTEM(CHARSET,lib/iconv.o)
 
-PYTHON=
+sinclude(ntvfs/config.m4)
+sinclude(rpc_server/config.m4)
 
-AC_ARG_WITH(python,
-[  --with-python=PYTHONNAME  build Python libraries],
-[ case "${withval-python}" in
-  yes)
-       PYTHON=python
-       EXTRA_ALL_TARGETS="$EXTRA_ALL_TARGETS python_ext"
-       ;;
-  no)
-       PYTHON=
-       ;;
-  *)
-       PYTHON=${withval-python}
-       ;;
-  esac ])
-AC_SUBST(PYTHON)
+AC_DEFINE_UNQUOTED(STRING_STATIC_MODULES, "$string_static_modules", [String list of builtin modules])
 
 #################################################
 # do extra things if we are running insure
@@ -3462,11 +2860,3 @@ CFLAGS_REMOVE_USR_INCLUDE(CFLAGS)
 CFLAGS_REMOVE_USR_INCLUDE(CPPFLAGS)
 
 AC_OUTPUT(include/stamp-h Makefile script/findsmb)
-
-#################################################
-# Print very concise instructions on building/use
-if test "x$enable_dmalloc" = xyes
-then
-       AC_MSG_RESULT([Note: The dmalloc debug library will be included.  To turn it on use])
-       AC_MSG_RESULT([      \$ eval \`dmalloc samba\`.])
-fi