r23480: Fix DEVELOPER_CFLAGS quoting.
[sfrench/samba-autobuild/.git] / source / configure.in
index 0c69dde7d6635992b4aba5d10a3a1d6113eaca50..21f81ea1c6256bacf2fe0b62bcba8e5fb657bed3 100644 (file)
@@ -169,6 +169,20 @@ AC_ARG_WITH(logfilebase,
     ;;
   esac])
 
+
+#################################################
+# set ctdb source directory location
+AC_ARG_WITH(ctdb,
+[  --with-ctdb=DIR  Where to find ctdb sources],
+[ case "$withval" in
+  yes|no)
+    AC_MSG_WARN([--with-ctdb called without argument])
+  ;;
+  * )
+    ctdbdir="$withval"
+    ;;
+  esac])
+
 #################################################
 # set lib directory location
 AC_ARG_WITH(libdir,
@@ -254,6 +268,7 @@ AC_SUBST(configdir)
 AC_SUBST(lockdir)
 AC_SUBST(piddir)
 AC_SUBST(logfilebase)
+AC_SUBST(ctdbdir)
 AC_SUBST(privatedir)
 AC_SUBST(swatdir)
 AC_SUBST(bindir)
@@ -338,6 +353,21 @@ AC_LIBREPLACE_CC_CHECKS
 
 m4_include(lib/socket_wrapper/config.m4)
 
+
+AC_ARG_ENABLE(swat,
+[  --enable-swat           Build the SWAT tool (default=yes)],
+[
+    case "$enable_swat" in
+       no) ;;
+       *)
+           SWAT_SBIN_TARGETS='bin/swat$(EXEEXT)'
+           SWAT_INSTALL_TARGETS=installswat
+           ;;
+    esac
+    AC_SUBST(SWAT_SBIN_TARGETS)
+    AC_SUBST(SWAT_INSTALL_TARGETS)
+])
+
 #################################################
 # set prefix for 'make test'
 selftest_prefix="./"
@@ -405,7 +435,19 @@ AC_ARG_WITH(smbtorture4_path,
 AC_ARG_ENABLE(developer, [  --enable-developer      Turn on developer warnings and debugging (default=no)],
     [if eval "test x$enable_developer = xyes"; then
         developer=yes
-       DEVELOPER_CFLAGS="-gstabs -Wall -Wshadow -Wstrict-prototypes -Wpointer-arith -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
+       krb5_developer=yes
+    fi])
+
+# Probe the gcc version for extra CFLAGS. We always stash these in
+# DEVELOPER_CFLAGS, so that you can turn them on and off with a simple
+# Makefile edit, avoiding the need to re-run configure.
+if test x"$ac_cv_prog_gcc" = x"yes" ; then
+       DEVELOPER_CFLAGS="-gstabs -Wall -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -DDEBUG_PASSWORD -DDEVELOPER"
        # Add -Wdeclaration-after-statement if compiler supports it
        AC_CACHE_CHECK(
           [that the C compiler understands -Wdeclaration-after-statement],
@@ -418,12 +460,12 @@ AC_ARG_ENABLE(developer, [  --enable-developer      Turn on developer warnings a
            samba_cv_HAVE_Wdeclaration_after_statement=yes,
            samba_cv_HAVE_Wdeclaration_after_statement=no,
            samba_cv_HAVE_Wdeclaration_after_statement=cross)
-
        ])
-       if test x"$samba_cv_HAVE_Wdeclaration_after_statement" = x"yes"; then
+
+       if test x"$samba_cv_HAVE_Wdeclaration_after_statement" = x"yes"; then
            DEVELOPER_CFLAGS="${DEVELOPER_CFLAGS} -Wdeclaration-after-statement"
-       fi
-       # here
+       fi
+
        #-Werror-implicit-function-declaration
        AC_CACHE_CHECK(
           [that the C compiler understands -Werror-implicit-function-declaration],
@@ -440,13 +482,13 @@ AC_ARG_ENABLE(developer, [  --enable-developer      Turn on developer warnings a
        if test x"$samba_cv_HAVE_Werror_implicit_function_declaration" = x"yes"; then
            DEVELOPER_CFLAGS="${DEVELOPER_CFLAGS} -Werror-implicit-function-declaration"
        fi
-    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])
+       # krb5developer is like developer, except we don't get
+       # -Wstrict-prototypes.
+       if test x"$krb5_developer" ~= x"$yes" ; then
+           DEVELOPER_CFLAGS="$DEVELOPER_CFLAGS -Wstrict-prototypes"
+       fi
+fi
 
 AC_ARG_ENABLE(dmalloc, [  --enable-dmalloc        Enable heap debugging [default=no]])
 
@@ -624,6 +666,12 @@ fi
 AM_DEP_TRACK()
 _AM_DEPENDENCIES(CC)
 
+# As per vl, disable dependency tracking by default until we don't need
+# to use "make proto' -- jpeach
+if test "x$enable_dependency_tracking" != xyes; then
+    ifGNUmake='#'
+fi
+
 ############################################
 # Figure out the flags to support named structure initializers
 
@@ -671,7 +719,7 @@ AC_SUBST(DYNEXP)
 
 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 rpc_lsa rpc_samr rpc_winreg rpc_initshutdown rpc_lsa_ds rpc_wkssvc rpc_svcctl rpc_ntsvcs rpc_net rpc_netdfs rpc_srvsvc rpc_spoolss rpc_eventlog rpc_unixinfo rpc_epmapper auth_sam auth_unix auth_winbind auth_server auth_domain auth_builtin vfs_default nss_info_template"
+default_static_modules="pdb_smbpasswd pdb_tdbsam rpc_lsa rpc_samr rpc_winreg rpc_initshutdown rpc_lsa_ds rpc_wkssvc rpc_svcctl2 rpc_ntsvcs rpc_net rpc_netdfs rpc_srvsvc rpc_spoolss rpc_eventlog2 rpc_unixinfo rpc_epmapper auth_sam auth_unix auth_winbind auth_server auth_domain auth_builtin vfs_default 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 charset_CP850 charset_CP437 auth_script vfs_readahead"
@@ -1310,7 +1358,7 @@ if test x"$ac_cv_func_execl" = x"no"; then
     EXTRA_BIN_PROGS="$EXTRA_BIN_PROGS bin/smbrun\$(EXEEXT)"
 fi
 
-AC_CHECK_FUNCS(waitpid getcwd strdup strndup strnlen strerror chown fchown chmod fchmod chroot link mknod mknod64)
+AC_CHECK_FUNCS(waitpid getcwd strdup strndup strnlen strerror chown fchown lchown chmod fchmod chroot link mknod mknod64)
 AC_CHECK_FUNCS(strtol strtoll strtoul strtoull strtouq __strtoull)
 AC_CHECK_FUNCS(fstat strchr utime utimes chflags)
 AC_CHECK_FUNCS(getrlimit fsync memset strlcpy strlcat setpgid)
@@ -1757,6 +1805,29 @@ EOF
        fi
 fi
 
+#Check if we can enable relro as well
+if test x"${samba_cv_fpie}" = x"yes"
+then
+       AC_CACHE_CHECK(for relro, samba_cv_fpie_relro,
+       [
+               cat > conftest.c <<EOF
+int foo;
+main () { return 0;}
+EOF
+                if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -pie -fPIE -Wl,-z,relro -o conftest conftest.c 1>&AS_MESSAGE_LOG_FD])
+               then
+                       samba_cv_fpie_relro=yes
+               else
+                       samba_cv_fpie_relro=no
+               fi
+               rm -f conftest*
+       ])
+       if test x"${samba_cv_fpie_relro}" = x"yes"
+       then
+               PIE_LDFLAGS="-pie -Wl,-z,relro"
+       fi
+fi
+
 # Assume non-shared by default and override below
 BLDSHARED="false"
 
@@ -1879,10 +1950,11 @@ case "$host_os" in
                        if test "${GCC}" = "yes"; then
                                PICFLAG="-fPIC"
                        else
-                               PICFLAG="+z"
+                               PICFLAG="+z +ESnolit"
                        fi
                        if test "$host_cpu" = "ia64"; then
                                SHLIBEXT="so"
+                             PICFLAG="+z"
                                DYNEXP="-Wl,-E,+b/usr/local/lib/hpux32:/usr/lib/hpux32"
                        else
                                SHLIBEXT="sl"
@@ -2049,6 +2121,14 @@ if test x"$samba_cv_compiler_supports_ll" = x"yes"; then
 fi
 
 
+AC_CACHE_CHECK([for 64 bit time_t],samba_cv_SIZEOF_TIME_T,[
+AC_TRY_RUN([#include <time.h>
+main() { exit((sizeof(time_t) == 8) ? 0 : 1); }],
+samba_cv_SIZEOF_TIME_T=yes,samba_cv_SIZEOF_TIME_T=no,samba_cv_SIZEOF_TIME_T=cross)])
+if test x"$samba_cv_SIZEOF_TIME_T" = x"yes"; then
+    AC_DEFINE(SIZEOF_TIME_T,8,[The size of the 'time_t' type])
+fi
+
 AC_CACHE_CHECK([for 64 bit off_t],samba_cv_SIZEOF_OFF_T,[
 AC_TRY_RUN([#include <stdio.h>
 #include <sys/stat.h>
@@ -2439,8 +2519,7 @@ fi
 # end utmp details
 
 
-ICONV_LOCATION=standard
-LOOK_DIRS="/usr /usr/local /sw /opt"
+ICONV_LOOK_DIRS="/usr /usr/local /sw /opt"
 AC_ARG_WITH(libiconv,
 [  --with-libiconv=BASEDIR Use libiconv in BASEDIR/lib and BASEDIR/include (default=auto) ],
 [
@@ -2449,62 +2528,69 @@ AC_ARG_WITH(libiconv,
   else
      if test "$withval" != "yes" ; then
        ICONV_PATH_SPEC=yes
-        LOOK_DIRS="$withval"
+        ICONV_LOOK_DIRS="$withval"
      fi
   fi
 ])
 
-for i in $LOOK_DIRS ; do
-    save_LIBS=$LIBS
-    save_LDFLAGS=$LDFLAGS
-    save_CPPFLAGS=$CPPFLAGS
+for i in $ICONV_LOOK_DIRS ; do
+
+    save_LIBS="$LIBS"
+    save_LDFLAGS="$LDFLAGS"
+    save_CPPFLAGS="$CPPFLAGS"
+
+    iconv_current_LIBS=""
+    iconv_current_LDFLAGS=""
+    iconv_current_CPPFLAGS=""
+
     ICONV_FOUND="no"
     unset libext
-    CPPFLAGS="$CPPFLAGS -I$i/include"
-dnl This is here to handle -withval stuff for --with-libiconv
-dnl Perhaps we should always add a -L
-
-dnl Check lib and lib32 library variants to cater for IRIX ABI-specific
-dnl installation paths. This gets a little tricky since we might have iconv
-dnl in both libiconv and in libc. In this case the jm_ICONV test will always
-dnl succeed when the header is found. To counter this, make sure the
-dnl library directory is there and check the ABI directory first (which
-dnl should be harmless on other systems.
-dnl For IA64 HPUX systems, the libs are located in lib/hpux32 instead of lib.
+
+    #  This is here to handle -withval stuff for --with-libiconv
+    #  Perhaps we should always add a -L
+    CPPFLAGS="$save_CPPFLAGS -I$i/include"
+
+    # Check lib and lib32 library variants to cater for IRIX ABI-specific
+    # installation paths. This gets a little tricky since we might have iconv
+    # in both libiconv and in libc. In this case the jm_ICONV test will always
+    # succeed when the header is found. To counter this, make sure the
+    # library directory is there and check the ABI directory first (which
+    # should be harmless on other systems.
+    # For IA64 HPUX systems, the libs are located in lib/hpux32 instead of lib.
     for l in "lib32" "lib" "lib/hpux32"; do
         if test -d "$i/$l" ; then
                 LDFLAGS="$save_LDFLAGS -L$i/$l"
-        LIBS=
-        export LDFLAGS LIBS CPPFLAGS
-dnl Try to find iconv(3)
+               LIBS=
+               export LDFLAGS LIBS CPPFLAGS
+               # Try to find iconv(3)
                 jm_ICONV($i/$l)
                 if test x"$ICONV_FOUND" = "xyes" ; then
-            libext="$l"
-            break;
-        fi
+                   libext="$l"
+                   break
+               fi
         fi
     done
 
     if test x"$ICONV_FOUND" = "xyes" ; then
-       LDFLAGS=$save_LDFLAGS
-        LIB_ADD_DIR(LDFLAGS, "$i/$libext")
-        CFLAGS_ADD_DIR(CPPFLAGS, "$i/include")
-       LIBS="$save_LIBS"
-        ICONV_LOCATION=$i
-        export LDFLAGS LIBS CPPFLAGS
-dnl Now, check for a working iconv ... we want to do it here because
-dnl there might be a working iconv further down the list of LOOK_DIRS
-
-        ############
-        # check for iconv in libc
-        ic_save_LIBS="$LIBS"
-        if test x"$ICONV_PATH_SPEC" = "xyes" ; then
-           LIBS="$LIBS -L$ICONV_LOCATION/$libext"
-        fi
+       iconv_current_LDFLAGS="-L$i/$libext"
+       iconv_current_CPPFLAGS="-I$i/include"
+
         if test x"$jm_cv_lib_iconv" != x; then
-           LIBS="$LIBS -l$jm_cv_lib_iconv"
+           iconv_current_LIBS="$LIBS -l$jm_cv_lib_iconv"
+       else
+           # We found iconv in libc.
+           iconv_current_LIBS=""
         fi
-dnl        AC_CACHE_CHECK([for working iconv],samba_cv_HAVE_NATIVE_ICONV,[
+
+    fi
+
+    if test x"$ICONV_FOUND" = "xyes" ; then
+
+        LDFLAGS="$save_LDFLAGS $iconv_current_LDFLAGS"
+        CPPFLAGS="$save_CPPFLAGS $iconv_current_CPPFLAGS"
+       LIBS="$save_LIBS $iconv_current_LIBS"
+        export LDFLAGS LIBS CPPFLAGS
+
        default_dos_charset=no
        default_display_charset=no
        default_unix_charset=no
@@ -2512,28 +2598,30 @@ dnl        AC_CACHE_CHECK([for working iconv],samba_cv_HAVE_NATIVE_ICONV,[
        # check for default dos charset name
        for j in CP850 IBM850 ; do
            rjs_CHARSET($j)
-           if test x"$ICONV_CHARSET" = x"$j"; then
-               default_dos_charset="\"$j\""
+           default_dos_charset="$ICONV_CHARSET"
+           if test x"$default_dos_charset" = x"$j"; then
                break
            fi
        done
+
        # check for default display charset name
        for j in ASCII 646 ; do
            rjs_CHARSET($j)
-           if test x"$ICONV_CHARSET" = x"$j"; then
-               default_display_charset="\"$j\""
+           default_display_charset="$ICONV_CHARSET"
+           if test x"$default_display_charset" = x"$j"; then
                break
            fi
        done
+
        # check for default unix charset name
        for j in UTF-8 UTF8 ; do
            rjs_CHARSET($j)
-           if test x"$ICONV_CHARSET" = x"$j"; then
-               default_unix_charset="\"$j\""
+           default_unix_charset="$ICONV_CHARSET"
+           if test x"$default_unix_charset" = x"$j"; then
                break
            fi
        done
-       
+
        if test "$default_dos_charset" != "no" -a \
                "$default_dos_charset" != "cross" -a \
                "$default_display_charset" != "no" -a \
@@ -2542,38 +2630,63 @@ dnl        AC_CACHE_CHECK([for working iconv],samba_cv_HAVE_NATIVE_ICONV,[
                "$default_unix_charset" != "cross"
        then
                samba_cv_HAVE_NATIVE_ICONV=yes
-       else if test "$default_dos_charset" = "cross" -o \
+       else
+           if test "$default_dos_charset" = "cross" -o \
                     "$default_display_charset" = "cross" -o \
                     "$default_unix_charset" = "cross"
-       then
-               samba_cv_HAVE_NATIVE_ICONV=cross
-       else
-               samba_cv_HAVE_NATIVE_ICONV=no
+           then
+                   samba_cv_HAVE_NATIVE_ICONV=cross
+           else
+                   samba_cv_HAVE_NATIVE_ICONV=no
+           fi
        fi
+
+       # At this point, we have a libiconv candidate. We know that
+       # we have the right headers and libraries, but we don't know
+       # whether it does the conversions we want. We can't test this
+       # because we are cross-compiling. This is not necessarily a big
+       # deal, since we can't guarantee that the results we get now will
+       # match the results we get at runtime anyway.
+       if test x"$samba_cv_HAVE_NATIVE_ICONV" = x"cross" ; then
+           default_dos_charset="CP850"
+           default_display_charset="ASCII"
+           default_unix_charset="UTF-8"
+           samba_cv_HAVE_NATIVE_ICONV=yes
+           AC_MSG_WARN(assuming the libiconv in $iconv_current_LDFLAGS can convert)
+           AC_MSG_WARN([$default_dos_charset, $default_display_charset and $default_unix_charset to UCS-16LE])
        fi
-dnl ])
-
-        LIBS="$ic_save_LIBS"
-        if test x"$samba_cv_HAVE_NATIVE_ICONV" = x"yes"; then
-          CPPFLAGS=$save_CPPFLAGS
-          LDFLAGS=$save_LDFLAGS
-          LIBS=$save_LIBS
-           if test x"$jm_cv_lib_iconv" != x; then
-              LIBS="$LIBS -l$jm_cv_lib_iconv"
-           fi
-          dnl Add the flags we need to CPPFLAGS and LDFLAGS
-          CFLAGS_ADD_DIR(CPPFLAGS, "$i/include")
-          LIB_ADD_DIR(LDFLAGS, "$i/$libext")
-          export CPPFLAGS
-           AC_DEFINE(HAVE_NATIVE_ICONV,1,[Whether to use native iconv])
-          AC_DEFINE_UNQUOTED(DEFAULT_DOS_CHARSET,$default_dos_charset,[Default dos charset name])
-          AC_DEFINE_UNQUOTED(DEFAULT_DISPLAY_CHARSET,$default_display_charset,[Default display charset name])
-          AC_DEFINE_UNQUOTED(DEFAULT_UNIX_CHARSET,$default_unix_charset,[Default unix charset name])
+
+        if test x"$samba_cv_HAVE_NATIVE_ICONV" = x"yes" ; then
+
+           CPPFLAGS=$save_CPPFLAGS
+           LDFLAGS=$save_LDFLAGS
+           LIBS=$save_LIBS
+
+           if test x"$iconv_current_LIBS" != x; then
+               LIBS="$LIBS $iconv_current_LIBS"
+           fi
+
+           # Add the flags we need to CPPFLAGS and LDFLAGS
+           CPPFLAGS="$CPPFLAGS $iconv_current_CPPFLAGS"
+           LDFLAGS="$LDFLAGS $iconv_current_LDFLAGS"
+
+           # Turn the #defines into string literals
+           default_dos_charset="\"$default_dos_charset\""
+           default_display_charset="\"$default_display_charset\""
+           default_unix_charset="\"$default_unix_charset\""
+
+           AC_DEFINE(HAVE_NATIVE_ICONV,1,[Whether to use native iconv])
+           AC_DEFINE_UNQUOTED(DEFAULT_DOS_CHARSET,$default_dos_charset,[Default dos charset name])
+           AC_DEFINE_UNQUOTED(DEFAULT_DISPLAY_CHARSET,$default_display_charset,[Default display charset name])
+           AC_DEFINE_UNQUOTED(DEFAULT_UNIX_CHARSET,$default_unix_charset,[Default unix charset name])
+
            break
         fi
-dnl We didn't find a working iconv, so keep going
+
+    # We didn't find a working iconv, so keep going
     fi
-dnl We only need to clean these up here for the next pass through the loop
+
+    #  We only need to clean these up here for the next pass through the loop
     CPPFLAGS=$save_CPPFLAGS
     LDFLAGS=$save_LDFLAGS
     LIBS=$save_LIBS
@@ -3014,6 +3127,21 @@ if test x"$samba_cv_USE_SETUIDX" = x"yes"; then
 fi
 fi
 
+AC_CACHE_CHECK([for the Darwin initgroups system call],
+       samba_cv_DARWIN_INITGROUPS,
+       AC_TRY_LINK([
+#include <sys/syscall.h>
+#include <unistd.h>
+       ],
+       [ syscall(SYS_initgroups, 16, NULL, NULL, 0); ],
+       samba_cv_DARWIN_INITGROUPS=yes,
+       samba_cv_DARWIN_INITGROUPS=no)
+)
+
+if test x"$samba_cv_DARWIN_INITGROUPS" = x"yes" ; then
+    AC_DEFINE(HAVE_DARWIN_INITGROUPS, 1,
+       [Whether to use the Darwin-specific initgroups system call])
+fi
 
 AC_CACHE_CHECK([for working mmap],samba_cv_HAVE_MMAP,[
 AC_TRY_RUN([#include "${srcdir-.}/tests/shared_mmap.c"],
@@ -4052,7 +4180,7 @@ if test x"$with_ads_support" != x"no"; then
        AC_TRY_RUN_STRICT([
                #include <krb5.h>
                int main(void) {
-                       krb5_context context;
+                       krb5_context context = NULL;
                        char *str = NULL;
                        krb5_enctype_to_string(context, 1, &str);
                        if (str) free (str); 
@@ -4328,7 +4456,11 @@ AC_ARG_WITH(cifsmount,
 
 
 #################################################
-# check for a PAM clear-text auth, accounts, password and session support
+# Check for a PAM clear-text auth, accounts, password
+# and session support. Most PAM implementations keep their
+# headers in /usr/include/security. Darwin keeps its in
+# /usr/include/pam.
+
 with_pam_for_crypt=no
 try_pam=no
 AC_MSG_CHECKING(whether to try PAM support)
@@ -4348,10 +4480,13 @@ if test x"${try_pam}" != x"no";then
        use_pam=yes
        create_pam_modules=yes
 
-       AC_CHECK_HEADERS(security/pam_appl.h)
-       if test x"$ac_cv_header_security_pam_appl_h" != x"yes"; then
+       # Most systems have PAM headers in /usr/include/security, but Darwin
+       # has them in /usr/include/pam.
+       AC_CHECK_HEADERS(security/pam_appl.h pam/pam_appl.h)
+       if test x"$ac_cv_header_security_pam_appl_h" != x"yes" -a \
+               x"$ac_cv_header_pam_pam_appl_h" != x"yes"; then
                if test x"${try_pam}" = x"yes";then
-                       AC_MSG_ERROR([--with-pam=yes but security/pam_appl.h not found])
+                       AC_MSG_ERROR([--with-pam=yes but pam_appl.h not found])
                fi
                use_pam=no
                create_pam_modules=no
@@ -4366,14 +4501,18 @@ if test x"${try_pam}" != x"no";then
                create_pam_modules=no
        fi
 
-       AC_CHECK_HEADERS(security/pam_modules.h,,,[[
+       AC_CHECK_HEADERS(security/pam_modules.h pam/pam_modules.h,,,[[
                #if HAVE_SECURITY_PAM_APPL_H
                #include <security/pam_appl.h>
                #endif
+               #if HAVE_PAM_PAM_APPL_H
+               #include <pam/pam_appl.h>
+               #endif
        ]])
-       if test x"$ac_cv_header_security_pam_modules_h" = x"no"; then
+       if test x"$ac_cv_header_security_pam_modules_h" = x"no" -a \
+               x"$ac_cv_header_pam_pam_modules_h" = x"no" ; then
                if test x"${try_pam}" = x"yes";then
-                       AC_MSG_ERROR([--with-pam=yes but security/pam_modules.h not found])
+                       AC_MSG_ERROR([--with-pam=yes but pam_modules.h not found])
                fi
                create_pam_modules=no
        fi
@@ -4389,6 +4528,7 @@ if test x"${try_pam}" != x"no";then
                        # this checks are optional,
                        # we don't care about the results here
                        AC_CHECK_HEADERS(security/pam_ext.h security/_pam_macros.h)
+                       AC_CHECK_HEADERS(pam/pam_ext.h pam/_pam_macros.h)
                        AC_CHECK_FUNC_EXT(pam_vsyslog,$PAM_LIBS)
                else
                        AC_MSG_WARN([PAM support detected but PAM MODULES support is missing])          
@@ -5270,55 +5410,71 @@ fi
 
 AC_MSG_CHECKING(whether to support ACLs)
 AC_ARG_WITH(acl-support,
-[  --with-acl-support      Include ACL support (default=no)],
+[  --with-acl-support      Include ACL support (default=auto)],
 [ case "$withval" in
-  yes)
+       yes|no)
+               with_acl_support="$withval"
+               ;;
+  esac ])
+
+if test x"$with_acl_support" = x ; then
+       with_acl_support="auto"
+fi
+
+AC_MSG_RESULT($with_acl_support)
 
+if test x"$with_acl_support" = x"no"; then
+       AC_MSG_RESULT(Disabling ACL support)
+       AC_DEFINE(HAVE_NO_ACLS,1,[Whether no ACLs support should be built in])
+else
+       AC_MSG_NOTICE(checking whether ACL support is available:)
        case "$host_os" in
        *sysv5*)
-               AC_MSG_RESULT(Using UnixWare ACLs)
+               AC_MSG_NOTICE(Using UnixWare ACLs)
                AC_DEFINE(HAVE_UNIXWARE_ACLS,1,[Whether UnixWare ACLs are available])
                default_static_modules="$default_static_modules vfs_solarisacl"
                ;;
        *solaris*)
-               AC_MSG_RESULT(Using solaris ACLs)
+               AC_MSG_NOTICE(Using solaris ACLs)
                AC_DEFINE(HAVE_SOLARIS_ACLS,1,[Whether solaris ACLs are available])
                ACL_LIBS="$ACL_LIBS -lsec"
                default_static_modules="$default_static_modules vfs_solarisacl"
                ;;
        *hpux*)
-               AC_MSG_RESULT(Using HPUX ACLs)
+               AC_MSG_NOTICE(Using HPUX ACLs)
                AC_DEFINE(HAVE_HPUX_ACLS,1,[Whether HPUX ACLs are available])
                default_static_modules="$default_static_modules vfs_hpuxacl"
                ;;
        *irix*)
-               AC_MSG_RESULT(Using IRIX ACLs)
+               AC_MSG_NOTICE(Using IRIX ACLs)
                AC_DEFINE(HAVE_IRIX_ACLS,1,[Whether IRIX ACLs are available])
                default_static_modules="$default_static_modules vfs_irixacl"
                ;;
        *aix*)
-               AC_MSG_RESULT(Using AIX ACLs)
+               AC_MSG_NOTICE(Using AIX ACLs)
                AC_DEFINE(HAVE_AIX_ACLS,1,[Whether AIX ACLs are available])
                default_static_modules="$default_static_modules vfs_aixacl"
                ;;
        *osf*)
-               AC_MSG_RESULT(Using Tru64 ACLs)
+               AC_MSG_NOTICE(Using Tru64 ACLs)
                AC_DEFINE(HAVE_TRU64_ACLS,1,[Whether Tru64 ACLs are available])
                ACL_LIBS="$ACL_LIBS -lpacl"
                default_static_modules="$default_static_modules vfs_tru64acl"
                ;;
-       *freebsd[[5-9]]*)
-               AC_MSG_RESULT(Using FreeBSD posix ACLs)
-               AC_DEFINE(HAVE_POSIX_ACLS,1,[Whether FreeBSD POSIX ACLs are available])
-               AC_DEFINE(HAVE_ACL_GET_PERM_NP,1,[Whether acl_get_perm_np() is available])
-               default_static_modules="$default_static_modules vfs_posixacl"
+       *darwin*)
+               AC_MSG_NOTICE(ACLs on Darwin currently not supported)
+               AC_DEFINE(HAVE_NO_ACLS,1,[Whether no ACLs support is available])
                ;;
-       *linux*)
-               AC_CHECK_LIB(attr,getxattr,[ACL_LIBS="$ACL_LIBS -lattr"])
-                       AC_CHECK_LIB(acl,acl_get_file,[ACL_LIBS="$ACL_LIBS -lacl"])
-               AC_CACHE_CHECK([for ACL support],samba_cv_HAVE_POSIX_ACLS,[
+       *)
+               AC_CHECK_LIB(acl,acl_get_file,[ACL_LIBS="$ACL_LIBS -lacl"])
+               case "$host_os" in
+               *linux*)
+                       AC_CHECK_LIB(attr,getxattr,[ACL_LIBS="$ACL_LIBS -lattr"])
+                       ;;
+               esac
+               AC_CACHE_CHECK([for POSIX ACL support],samba_cv_HAVE_POSIX_ACLS,[
                        acl_LIBS=$LIBS
-                       LIBS="$LIBS -lacl"
+                       LIBS="$LIBS $ACL_LIBS"
                        AC_TRY_LINK([
                                #include <sys/types.h>
                                #include <sys/acl.h>
@@ -5333,11 +5489,11 @@ AC_ARG_WITH(acl-support,
                        LIBS=$acl_LIBS
                ])
                if test x"$samba_cv_HAVE_POSIX_ACLS" = x"yes"; then
-                       AC_MSG_RESULT(Using posix ACLs)
+                       AC_MSG_NOTICE(Using posix ACLs)
                        AC_DEFINE(HAVE_POSIX_ACLS,1,[Whether POSIX ACLs are available])
                        AC_CACHE_CHECK([for acl_get_perm_np],samba_cv_HAVE_ACL_GET_PERM_NP,[
                                acl_LIBS=$LIBS
-                               LIBS="$LIBS -lacl"
+                               LIBS="$LIBS $ACL_LIBS"
                                AC_TRY_LINK([
                                        #include <sys/types.h>
                                        #include <sys/acl.h>
@@ -5353,63 +5509,16 @@ AC_ARG_WITH(acl-support,
                        if test x"$samba_cv_HAVE_ACL_GET_PERM_NP" = x"yes"; then
                                AC_DEFINE(HAVE_ACL_GET_PERM_NP,1,[Whether acl_get_perm_np() is available])
                        fi
+                       default_static_modules="$default_static_modules vfs_posixacl"
+               else
+                       AC_MSG_NOTICE(ACL support is not avaliable)
+                       AC_DEFINE(HAVE_NO_ACLS,1,[Whether no ACLs support is available])
                fi
-            ;;
-         *)
-               AC_CHECK_LIB(acl,acl_get_file,[ACL_LIBS="$ACL_LIBS -lacl"])
-               AC_CACHE_CHECK([for ACL support],samba_cv_HAVE_POSIX_ACLS,[
-                       acl_LIBS=$LIBS
-                       LIBS="$LIBS -lacl"
-                       AC_TRY_LINK([
-                               #include <sys/types.h>
-                               #include <sys/acl.h>
-                       ],[
-                               acl_t acl;
-                               int entry_id;
-                               acl_entry_t *entry_p;
-                               return acl_get_entry( acl, entry_id, entry_p);
-                       ],
-                       [samba_cv_HAVE_POSIX_ACLS=yes],
-                       [samba_cv_HAVE_POSIX_ACLS=no])
-                       LIBS=$acl_LIBS
-               ])
-               if test x"$samba_cv_HAVE_POSIX_ACLS" = x"yes"; then
-                       AC_MSG_RESULT(Using posix ACLs)
-                       AC_DEFINE(HAVE_POSIX_ACLS,1,[Whether POSIX ACLs are available])
-                       AC_CACHE_CHECK([for acl_get_perm_np],samba_cv_HAVE_ACL_GET_PERM_NP,[
-                               acl_LIBS=$LIBS
-                               LIBS="$LIBS -lacl"
-                               AC_TRY_LINK([
-                                       #include <sys/types.h>
-                                       #include <sys/acl.h>
-                               ],[
-                                       acl_permset_t permset_d;
-                                       acl_perm_t perm;
-                                       return acl_get_perm_np( permset_d, perm);
-                               ],
-                               [samba_cv_HAVE_ACL_GET_PERM_NP=yes],
-                               [samba_cv_HAVE_ACL_GET_PERM_NP=no])
-                               LIBS=$acl_LIBS
-                       ])
-                       if test x"$samba_cv_HAVE_ACL_GET_PERM_NP" = x"yes"; then
-                               AC_DEFINE(HAVE_ACL_GET_PERM_NP,1,[Whether acl_get_perm_np() is available])
-                       fi
-               fi
-            ;;
+               ;;
         esac
-        ;;
-  *)
-    AC_MSG_RESULT(no)
-    AC_DEFINE(HAVE_NO_ACLS,1,[Whether no ACLs support is available])
-    ;;
-  esac ],
-  AC_DEFINE(HAVE_NO_ACLS,1,[Whether no ACLs support should be built in])
-  AC_MSG_RESULT(no)
-)
+fi # with_acl_support
+
 
-if test x"$samba_cv_HAVE_POSIX_ACLS" = x"yes"; then
-   default_static_modules="$default_static_modules vfs_posixacl"
-fi
 
 #################################################
 # check for AIO support
@@ -5827,6 +5936,8 @@ if test x"$samba_cv_HAVE_LINUX_READAHEAD" = x"yes"; then
              [Whether Linux readahead is available])
 fi
 
+AC_HAVE_DECL(readahead, [#include <fcntl.h>])
+
 ############################################
 # See if we have the posix_fadvise syscall.
 
@@ -6179,13 +6290,13 @@ SMB_MODULE(rpc_winreg, \$(RPC_REG_OBJ), "bin/librpc_winreg.$SHLIBEXT", RPC)
 SMB_MODULE(rpc_initshutdown, \$(RPC_INITSHUTDOWN_OBJ), "bin/librpc_initshutdown.$SHLIBEXT", RPC)
 SMB_MODULE(rpc_lsa_ds, \$(RPC_LSA_DS_OBJ), "bin/librpc_lsa_ds.$SHLIBEXT", RPC)
 SMB_MODULE(rpc_wkssvc, \$(RPC_WKS_OBJ), "bin/librpc_wkssvc.$SHLIBEXT", RPC)
-SMB_MODULE(rpc_svcctl, \$(RPC_SVCCTL_OBJ), "bin/librpc_svcctl.$SHLIBEXT", RPC)
+SMB_MODULE(rpc_svcctl2, \$(RPC_SVCCTL_OBJ), "bin/librpc_svcctl2.$SHLIBEXT", RPC)
 SMB_MODULE(rpc_ntsvcs, \$(RPC_NTSVCS_OBJ), "bin/librpc_ntsvcs.$SHLIBEXT", RPC)
 SMB_MODULE(rpc_net, \$(RPC_NETLOG_OBJ), "bin/librpc_NETLOGON.$SHLIBEXT", RPC)
 SMB_MODULE(rpc_netdfs, \$(RPC_DFS_OBJ), "bin/librpc_netdfs.$SHLIBEXT", RPC)
 SMB_MODULE(rpc_srvsvc, \$(RPC_SVC_OBJ), "bin/librpc_srvsvc.$SHLIBEXT", RPC)
 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_eventlog2, \$(RPC_EVENTLOG_OBJ), "bin/librpc_eventlog2.$SHLIBEXT", RPC)
 SMB_MODULE(rpc_samr, \$(RPC_SAMR_OBJ), "bin/librpc_samr.$SHLIBEXT", RPC)
 SMB_MODULE(rpc_rpcecho, \$(RPC_ECHO_OBJ), "bin/librpc_echo.$SHLIBEXT", RPC)
 SMB_MODULE(rpc_unixinfo, \$(RPC_UNIXINFO_OBJ), "bin/librpc_unixinfo.$SHLIBEXT", RPC)
@@ -6375,8 +6486,9 @@ AC_TRY_RUN([#include "${srcdir-.}/tests/summary.c"],
           AC_MSG_WARN([cannot run when cross-compiling]))
 
 dnl Merge in developer cflags from now on
-if test x"$developer" = x"yes"; then
-    CFLAGS="${CFLAGS} ${DEVELOPER_CFLAGS}"
+AC_SUBST(DEVELOPER_CFLAGS)
+if test x"$krb5_developer" = x"yes" -o x"$developer" = x"yes"; then
+    CFLAGS="${CFLAGS} \$(DEVELOPER_CFLAGS)"
 fi
 
 builddir=`pwd`
@@ -6387,7 +6499,7 @@ AC_SUBST(builddir)
 SMBD_LIBS="$samba_dmapi_libs"
 AC_SUBST(SMBD_LIBS)
 
-AC_OUTPUT(include/stamp-h Makefile script/findsmb smbadduser script/gen-8bit-gap.sh script/installbin.sh script/uninstallbin.sh)
+AC_OUTPUT(Makefile script/findsmb smbadduser script/gen-8bit-gap.sh script/installbin.sh script/uninstallbin.sh)
 
 #################################################
 # Print very concise instructions on building/use