When testing for /usr/include/heimdal, don't include /usr/heimdal/include
[ira/wip.git] / source3 / configure.in
index 51722d6eb19e56b7a992d1e285161e3e4cf8b90c..fdc83769c7385f659660bd872f02d43af3c85b62 100644 (file)
@@ -11,14 +11,12 @@ AC_PREFIX_DEFAULT(/usr/local/samba)
 
 AC_ARG_WITH(fhs, 
 [  --with-fhs              Use FHS-compliant paths (default=no)],
-    codepagedir="\$(DATADIR)/samba/codepages"
     configdir="${sysconfdir}/samba"
     lockdir="\${VARDIR}/cache/samba"
     piddir="\$(VARDIR)/run/samba"
     logfilebase="\${VARDIR}/log/samba"
     privatedir="\${CONFIGDIR}/private"
     swatdir="\${DATADIR}/samba/swat",
-    codepagedir="\$(LIBDIR)/codepages"
     configdir="\$(LIBDIR)"
     logfilebase="\$(VARDIR)"
     lockdir="\${VARDIR}/locks"
@@ -106,22 +104,6 @@ AC_ARG_WITH(configdir,
     ;;
   esac])
 
-#################################################
-# set codepage directory location
-AC_ARG_WITH(codepagedir,
-[  --with-codepagedir=DIR  Where to put codepage files (\$libdir/codepages)],
-[ case "$withval" in
-  yes|no)
-  #
-  # Just in case anybody does it
-  #
-    AC_MSG_WARN([--with-codepagedir called without argument - will use default])
-  ;;
-  * )
-    codepagedir="$withval"
-    ;;
-  esac])
-
 #################################################
 # set log directory location
 AC_ARG_WITH(logfilebase,
@@ -138,7 +120,6 @@ AC_ARG_WITH(logfilebase,
     ;;
   esac])
 
-AC_SUBST(codepagedir)
 AC_SUBST(configdir)
 AC_SUBST(lockdir)
 AC_SUBST(piddir)
@@ -153,18 +134,23 @@ AC_SUBST(SHELL)
 AC_SUBST(RUNPROG)
 AC_SUBST(MPROGS)
 AC_SUBST(LDSHFLAGS)
+AC_SUBST(SONAMEFLAG)
 AC_SUBST(SHLD)
 AC_SUBST(HOST_OS)
 AC_SUBST(PAM_MOD)
 AC_SUBST(WRAP)
 AC_SUBST(WRAP32)
+AC_SUBST(WRAPPROG)
 AC_SUBST(PICFLAG)
 AC_SUBST(PICSUFFIX)
 AC_SUBST(POBAD_CC)
 AC_SUBST(SHLIBEXT)
 AC_SUBST(LIBSMBCLIENT_SHARED)
+AC_SUBST(LIBSMBCLIENT)
+AC_SUBST(PRINTLIBS)
+AC_SUBST(AUTHLIBS)
 
-# compile with optimisation and without debugging by default
+# compile with optimization and without debugging by default
 CFLAGS="-O ${CFLAGS}"
 
 AC_ARG_ENABLE(debug, 
@@ -173,17 +159,17 @@ AC_ARG_ENABLE(debug,
        CFLAGS="${CFLAGS} -g"
     fi])
 
-AC_ARG_ENABLE(developer, [  --enable-developer      turn on developer warnings and debugging [default=no]],
+AC_ARG_ENABLE(developer, [  --enable-developer      Turn on developer warnings and debugging (default=no)],
     [if eval "test x$enable_developer = xyes"; then
        CFLAGS="${CFLAGS} -g -Wall -Wshadow -Wstrict-prototypes -Wpointer-arith -Wcast-qual -Wcast-align -DDEBUG_PASSWORD -DDEVELOPER"
     fi])
 
-AC_ARG_ENABLE(krb5developer, [  --enable-krb5developer      turn on developer warnings and debugging, except -Wstrict-prototypes [default=no]],
+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
        CFLAGS="${CFLAGS} -g -Wall -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -DDEBUG_PASSWORD -DDEVELOPER"
     fi])
 
-AC_ARG_ENABLE(dmalloc, [  --enable-dmalloc          enable heap debugging [default=no]])
+AC_ARG_ENABLE(dmalloc, [  --enable-dmalloc        Enable heap debugging [default=no]])
 
 if test "x$enable_dmalloc" = xyes
 then
@@ -198,6 +184,10 @@ AC_PROG_CC
 AC_PROG_INSTALL
 AC_PROG_AWK
 
+dnl Check if we use GNU ld
+LD=ld
+AC_PROG_LD_GNU
+
 dnl needed before AC_TRY_COMPILE
 AC_ISC_POSIX
 
@@ -215,7 +205,7 @@ AC_CACHE_CHECK([that the C compiler understands volatile],samba_cv_volatile, [
     AC_TRY_COMPILE([#include <sys/types.h>],[volatile int i = 0],
        samba_cv_volatile=yes,samba_cv_volatile=no)])
 if test x"$samba_cv_volatile" = x"yes"; then
-   AC_DEFINE(HAVE_VOLATILE)
+   AC_DEFINE(HAVE_VOLATILE, 1, [Whether the C compiler understands volatile])
 fi
 
 
@@ -241,7 +231,7 @@ case "$host_os" in
     
       AC_PROG_CC_FLAG(Ae)
       # mmap on HPUX is completely broken...
-      AC_DEFINE(MMAP_BLACKLIST)
+      AC_DEFINE(MMAP_BLACKLIST, 1, [Whether MMAP is broken])
       if test $ac_cv_prog_cc_Ae = yes; then
         CPPFLAGS="$CPPFLAGS -Ae"
       fi
@@ -253,20 +243,20 @@ case "$host_os" in
       case `uname -r` in
                        *9*|*10*)
                                CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_POSIX_SOURCE -D_ALIGNMENT_REQUIRED=1 -D_MAX_ALIGNMENT=4"
-                               AC_DEFINE(USE_BOTH_CRYPT_CALLS)
-                               AC_DEFINE(_HPUX_SOURCE)
-                               AC_DEFINE(_POSIX_SOURCE)
-                               AC_DEFINE(_ALIGNMENT_REQUIRED,1)
-                               AC_DEFINE(_MAX_ALIGNMENT,4)
+                               AC_DEFINE(USE_BOTH_CRYPT_CALLS, 1, [Whether to use both of HPUX' crypt calls])
+                               AC_DEFINE(_HPUX_SOURCE, 1, [Whether to use HPUX extensions])
+                               AC_DEFINE(_POSIX_SOURCE, 1, [Whether to use POSIX compatible functions])
+                               AC_DEFINE(_ALIGNMENT_REQUIRED,1,[Required alignment])
+                               AC_DEFINE(_MAX_ALIGNMENT,4,[Maximum alignment])
                                ;;
                        *11*)
                                CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_POSIX_SOURCE -D_LARGEFILE64_SOURCE -D_ALIGNMENT_REQUIRED=1 -D_MAX_ALIGNMENT=4"
-                               AC_DEFINE(USE_BOTH_CRYPT_CALLS)
-                               AC_DEFINE(_HPUX_SOURCE)
-                               AC_DEFINE(_POSIX_SOURCE)
-                               AC_DEFINE(_LARGEFILE64_SOURCE)
-                               AC_DEFINE(_ALIGNMENT_REQUIRED,1)
-                               AC_DEFINE(_MAX_ALIGNMENT,4)
+                               AC_DEFINE(USE_BOTH_CRYPT_CALLS, 1, [Whether to use both of HPUX' crypt calls])
+                               AC_DEFINE(_HPUX_SOURCE, 1, [Whether to use HPUX extensions])
+                               AC_DEFINE(_POSIX_SOURCE, 1, [Whether to use POSIX compatible functions])
+                               AC_DEFINE(_LARGEFILE64_SOURCE, 1, [Whether to use large file support])
+                               AC_DEFINE(_ALIGNMENT_REQUIRED, 1, [Required alignment])
+                               AC_DEFINE(_MAX_ALIGNMENT, 4, [Maximum alignment])
                                ;;
       esac
       DYNEXP="-Wl,-E"
@@ -286,7 +276,7 @@ case "$host_os" in
     *aix4*)
          AC_MSG_RESULT([enabling large file support])
       CPPFLAGS="$CPPFLAGS -D_LARGE_FILES"
-      AC_DEFINE(_LARGE_FILES)
+         AC_DEFINE(_LARGE_FILES, 1, [Whether to enable large file support])
       ;;    
 #
 # Defines needed for Solaris 2.6/2.7 aka 7.0 to make it admit
@@ -310,18 +300,18 @@ case "$host_os" in
                                case "$ac_cv_gcc_compiler_version_number" in
                                        *"gcc version 2.6"*|*"gcc version 2.7"*)
                                                CPPFLAGS="$CPPFLAGS -D_LARGEFILE64_SOURCE"
-                                               AC_DEFINE(_LARGEFILE64_SOURCE)
+                                               AC_DEFINE(_LARGEFILE64_SOURCE, 1, [Whether to enable large file support])
                                                ;;
                                        *)
                                                CPPFLAGS="$CPPFLAGS -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
-                                               AC_DEFINE(_LARGEFILE64_SOURCE)
-                                               AC_DEFINE(_FILE_OFFSET_BITS,64)
+                                               AC_DEFINE(_LARGEFILE64_SOURCE, 1, [Whether to enable large file support])
+                                               AC_DEFINE(_FILE_OFFSET_BITS, 64, [File offset bits])
                                                ;;
                                esac
                        else
                                CPPFLAGS="$CPPFLAGS -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
-                               AC_DEFINE(_LARGEFILE64_SOURCE)
-                               AC_DEFINE(_FILE_OFFSET_BITS,64)
+                               AC_DEFINE(_LARGEFILE64_SOURCE, 1, [Whether to enable large file support])
+                               AC_DEFINE(_FILE_OFFSET_BITS, 64, [File offset bits])
                        fi
                        ;;
                esac
@@ -346,7 +336,7 @@ exit(1);
         CPPFLAGS="$old_CPPFLAGS"
         if test x$SINIX_LFS_SUPPORT = xyes ; then
           CPPFLAGS="-D_LARGEFILE64_SOURCE $CPPFLAGS"
-          AC_DEFINE(_LARGEFILE64_SOURCE)
+                 AC_DEFINE(_LARGEFILE64_SOURCE, 1, [Whether to enable large file support])
           CFLAGS="`getconf LFS64_CFLAGS` $CFLAGS"
           LDFLAGS="`getconf LFS64_LDFLAGS` $LDFLAGS"
           LIBS="`getconf LFS64_LIBS` $LIBS"
@@ -399,9 +389,9 @@ main() {
         CPPFLAGS="$old_CPPFLAGS"
         if test x$LINUX_LFS_SUPPORT = xyes ; then
           CPPFLAGS="-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE $CPPFLAGS"
-          AC_DEFINE(_LARGEFILE64_SOURCE)
-          AC_DEFINE(_FILE_OFFSET_BITS,64)
-          AC_DEFINE(_GNU_SOURCE)
+                 AC_DEFINE(_LARGEFILE64_SOURCE, 1, [Whether to enable large file support])
+          AC_DEFINE(_FILE_OFFSET_BITS, 64, [File offset bits])
+          AC_DEFINE(_GNU_SOURCE, 1, [Whether to use GNU libc extensions])
         fi
        AC_MSG_RESULT([$LINUX_LFS_SUPPORT])
                ;;
@@ -422,8 +412,8 @@ exit(1);
         CPPFLAGS="$old_CPPFLAGS"
         if test x$GLIBC_LFS_SUPPORT = xyes ; then
           CPPFLAGS="-D_LARGEFILE64_SOURCE -D_GNU_SOURCE $CPPFLAGS"
-          AC_DEFINE(_LARGEFILE64_SOURCE)
-          AC_DEFINE(_GNU_SOURCE)
+                 AC_DEFINE(_LARGEFILE64_SOURCE, 1, [Whether to enable large file support])
+          AC_DEFINE(_GNU_SOURCE, 1, [Whether to use GNU libc extensions])
         fi
       AC_MSG_RESULT([$GLIBC_LFS_SUPPORT])
     ;;
@@ -443,6 +433,7 @@ AC_CHECK_HEADERS(sys/mman.h sys/filio.h sys/priv.h sys/shm.h string.h strings.h
 AC_CHECK_HEADERS(sys/mount.h sys/vfs.h sys/fs/s5param.h sys/filsys.h termios.h termio.h)
 AC_CHECK_HEADERS(sys/termio.h sys/statfs.h sys/dustat.h sys/statvfs.h stdarg.h sys/sockio.h)
 AC_CHECK_HEADERS(security/pam_modules.h security/_pam_macros.h ldap.h lber.h dlfcn.h)
+AC_CHECK_HEADERS(sys/syslog.h syslog.h)
 
 #
 # HPUX has a bug in that including shadow.h causes a re-definition of MAXINT.
@@ -453,7 +444,7 @@ case "$host_os" in
                AC_TRY_COMPILE([#include <shadow.h>],[struct spwd testme],
                        ac_cv_header_shadow_h=yes,ac_cv_header_shadow_h=no)
                if test x"$ac_cv_header_shadow_h" = x"yes"; then
-                  AC_DEFINE(HAVE_SHADOW_H)
+                  AC_DEFINE(HAVE_SHADOW_H,1,[Whether we have shadow.h])
                fi
        ;;
 esac
@@ -471,6 +462,7 @@ 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_SIZEOF(int,cross)
 AC_CHECK_SIZEOF(long,cross)
@@ -498,25 +490,26 @@ AC_CHECK_TYPE(wchar_t, unsigned short)
 ############################################
 # for cups support we need libcups, and a handful of header files
 
-AC_CHECK_LIB(cups,httpConnect)
+AC_ARG_ENABLE(cups,
+[  --enable-cups           Turn on CUPS support (default=auto)])
 
-# I wonder if there is a nicer way of doing this?
+if test x$enable_cups != xno; then
+       AC_PATH_PROG(CUPS_CONFIG, cups-config)
 
-if test x"$ac_cv_lib_cups_httpConnect" = x"yes"; then
-        AC_CHECK_HEADERS(cups/cups.h cups/language.h)
-        if test x"$ac_cv_header_cups_cups_h" = x"yes"; then
-                if test x"$ac_cv_header_cups_language_h" = x"yes"; then
-                        AC_DEFINE(HAVE_CUPS)
-                fi
+        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
 
 ############################################
-# we need dlopen/dlclose/dlsym/dlerror for PAM, the password database plugins and the new VFS code
+# we need dlopen/dlclose/dlsym/dlerror for PAM, the password database plugins and the plugin loading code
 AC_CHECK_FUNCS(dlopen)
 if test x"$ac_cv_func_dlopen" = x"no"; then
     AC_CHECK_LIB(dl, dlopen, [LIBS="$LIBS -ldl";
-       AC_DEFINE(HAVE_DLOPEN)])
+       AC_DEFINE(HAVE_DLOPEN,1,[Whether we have dlopen()])])
 fi
 # dlopen/dlclose/dlsym/dlerror will be checked again later and defines will be set then
 
@@ -538,7 +531,7 @@ AC_CACHE_CHECK([for immediate structures],samba_cv_immediate_structures, [
 ],
        samba_cv_immediate_structures=yes,samba_cv_immediate_structures=no)])
 if test x"$samba_cv_immediate_structures" = x"yes"; then
-   AC_DEFINE(HAVE_IMMEDIATE_STRUCTURES)
+   AC_DEFINE(HAVE_IMMEDIATE_STRUCTURES,1,[Whether the compiler supports immediate structures])
 fi
 
 ############################################
@@ -556,7 +549,7 @@ AC_CACHE_CHECK([for unix domain sockets],samba_cv_unixsocket, [
 ],
        samba_cv_unixsocket=yes,samba_cv_unixsocket=no)])
 if test x"$samba_cv_unixsocket" = x"yes"; then
-   AC_DEFINE(HAVE_UNIXSOCKET)
+   AC_DEFINE(HAVE_UNIXSOCKET,1,[If we need to build with unixscoket support])
 fi
 
 
@@ -570,7 +563,7 @@ AC_CACHE_CHECK([for socklen_t type],samba_cv_socklen_t, [
 #include <sys/socket.h>],[socklen_t i = 0],
        samba_cv_socklen_t=yes,samba_cv_socklen_t=no)])
 if test x"$samba_cv_socklen_t" = x"yes"; then
-   AC_DEFINE(HAVE_SOCKLEN_T_TYPE)
+   AC_DEFINE(HAVE_SOCKLEN_T_TYPE,1,[Whether we have the variable type socklen_t])
 fi
 
 AC_CACHE_CHECK([for sig_atomic_t type],samba_cv_sig_atomic_t, [
@@ -583,7 +576,7 @@ AC_CACHE_CHECK([for sig_atomic_t type],samba_cv_sig_atomic_t, [
 #include <signal.h>],[sig_atomic_t i = 0],
        samba_cv_sig_atomic_t=yes,samba_cv_sig_atomic_t=no)])
 if test x"$samba_cv_sig_atomic_t" = x"yes"; then
-   AC_DEFINE(HAVE_SIG_ATOMIC_T_TYPE)
+   AC_DEFINE(HAVE_SIG_ATOMIC_T_TYPE,1,[Whether we have the atomic_t variable type])
 fi
 
 # stupid headers have the functions but no declaration. grrrr.
@@ -602,7 +595,7 @@ AC_CACHE_CHECK([for real setresuid],samba_cv_have_setresuid,[
 main() { setresuid(1,1,1); setresuid(2,2,2); exit(errno==EPERM?0:1);}],
        samba_cv_have_setresuid=yes,samba_cv_have_setresuid=no,samba_cv_have_setresuid=cross)])
 if test x"$samba_cv_have_setresuid" = x"yes"; then
-    AC_DEFINE(HAVE_SETRESUID)
+    AC_DEFINE(HAVE_SETRESUID,1,[Whether the system has setresuid])
 fi
 
 # Do the same check for setresguid...
@@ -613,7 +606,7 @@ AC_CACHE_CHECK([for real setresgid],samba_cv_have_setresgid,[
 main() { errno = 0; setresgid(1,1,1); exit(errno != 0 ? (errno==EPERM ? 0 : 1) : 0);}],
        samba_cv_have_setresgid=yes,samba_cv_have_setresgid=no,samba_cv_have_setresgid=cross)])
 if test x"$samba_cv_have_setresgid" = x"yes"; then
-    AC_DEFINE(HAVE_SETRESGID)
+    AC_DEFINE(HAVE_SETRESGID,1,[Whether the system has setresgid])
 fi
 
 AC_FUNC_MEMCMP
@@ -622,8 +615,8 @@ AC_FUNC_MEMCMP
 # test for where we get crypt() from
 AC_CHECK_FUNCS(crypt)
 if test x"$ac_cv_func_crypt" = x"no"; then
-    AC_CHECK_LIB(crypt, crypt, [LIBS="$LIBS -lcrypt";
-       AC_DEFINE(HAVE_CRYPT)])
+    AC_CHECK_LIB(crypt, crypt, [AUTHLIBS="$AUTHLIBS -lcrypt";
+       AC_DEFINE(HAVE_CRYPT,1,[Whether the system has the crypt() function])])
 fi
 
 
@@ -648,7 +641,7 @@ AC_ARG_WITH(readline,
       done
       AC_CHECK_LIB(readline, rl_callback_handler_install,
        [TERMLIBS="-lreadline $TERMLIBS"
-       AC_DEFINE(HAVE_LIBREADLINE)
+       AC_DEFINE(HAVE_LIBREADLINE,1,[Whether the system has readline])
        break], [TERMLIBS=], $TERMLIBS)])
     ;;
   no)
@@ -678,7 +671,7 @@ AC_ARG_WITH(readline,
        TERMCPPFLAGS="-I$with_readline/include"
        CPPFLAGS="-I$with_readline/include $CPPFLAGS"
        TERMLIBS="-lreadline $TERMLIBS"
-       AC_DEFINE(HAVE_LIBREADLINE)
+       AC_DEFINE(HAVE_LIBREADLINE,1,[Whether the system has readline])
        break], [TERMLIBS= CPPFLAGS=$_cppflags], $TERMLIBS)])
 
     LDFLAGS=$_ldflags
@@ -728,7 +721,7 @@ if test x"$ac_cv_func_connect" = x"no"; then
        test x"$ac_cv_lib_inet_connect" = x"yes"; then
         # ac_cv_func_connect=yes
         # don't!  it would cause AC_CHECK_FUNC to succeed next time configure is run
-        AC_DEFINE(HAVE_CONNECT)
+        AC_DEFINE(HAVE_CONNECT,1,[Whether the system has connect()])
     fi
 fi
 
@@ -737,7 +730,7 @@ fi
 AC_CHECK_FUNCS(yp_get_default_domain)
 if test x"$ac_cv_func_yp_get_default_domain" = x"no"; then
        AC_CHECK_LIB(nsl, yp_get_default_domain, [LIBS="$LIBS -lnsl";
-       AC_DEFINE(HAVE_YP_GET_DEFAULT_DOMAIN)]) 
+       AC_DEFINE(HAVE_YP_GET_DEFAULT_DOMAIN,1,[Whether the system has yp_get_default_domain()])]) 
 fi
 
 # Check if we have execl, if not we need to compile smbrun.
@@ -757,7 +750,7 @@ AC_CHECK_FUNCS(setpriv setgidx setuidx setgroups sysconf mktime rename ftruncate
 AC_CHECK_FUNCS(lstat64 fopen64 atexit grantpt dup2 lseek64 ftruncate64 readdir64)
 AC_CHECK_FUNCS(fseek64 fseeko64 ftell64 ftello64 setluid getpwanam setlinebuf)
 AC_CHECK_FUNCS(srandom random srand rand setenv usleep strcasecmp fcvt fcvtl symlink readlink)
-AC_CHECK_FUNCS(syslog vsyslog)
+AC_CHECK_FUNCS(syslog vsyslog getgrouplist timegm)
 # setbuffer is needed for smbtorture
 AC_CHECK_FUNCS(setbuffer)
 
@@ -793,7 +786,7 @@ if test x$ac_cv_func_stat64 = xno ; then
 ], [struct stat64 st64; exit(stat64(".",&st64));], [ac_cv_func_stat64=yes])
   AC_MSG_RESULT([$ac_cv_func_stat64])
   if test x$ac_cv_func_stat64 = xyes ; then
-    AC_DEFINE(HAVE_STAT64)
+    AC_DEFINE(HAVE_STAT64,1,[Whether stat64() is available])
   fi
 fi
 
@@ -807,7 +800,7 @@ if test x$ac_cv_func_lstat64 = xno ; then
 ], [struct stat64 st64; exit(lstat64(".",&st64));], [ac_cv_func_lstat64=yes])
   AC_MSG_RESULT([$ac_cv_func_lstat64])
   if test x$ac_cv_func_lstat64 = xyes ; then
-    AC_DEFINE(HAVE_LSTAT64)
+    AC_DEFINE(HAVE_LSTAT64,[Whether lstat64() is available])
   fi
 fi
 
@@ -821,7 +814,7 @@ if test x$ac_cv_func_fstat64 = xno ; then
 ], [struct stat64 st64; exit(fstat64(0,&st64));], [ac_cv_func_fstat64=yes])
   AC_MSG_RESULT([$ac_cv_func_fstat64])
   if test x$ac_cv_func_fstat64 = xyes ; then
-    AC_DEFINE(HAVE_FSTAT64)
+    AC_DEFINE(HAVE_FSTAT64,1,[Whether fstat64() is available])
   fi
 fi
 
@@ -860,6 +853,7 @@ AC_LIBTESTFUNC(sec, getprpwnam)
 # these are the defaults, good for lots of systems
 HOST_OS="$host_os"
 LDSHFLAGS="-shared"
+SONAMEFLAG="#"
 SHLD="\${CC}"
 PICFLAG=""
 PICSUFFIX="po"
@@ -871,105 +865,126 @@ AC_MSG_CHECKING([ability to build shared libraries])
 
 # and these are for particular systems
 case "$host_os" in
-               *linux*)   AC_DEFINE(LINUX)
+               *linux*)   AC_DEFINE(LINUX,1,[Whether the host os is linux])
                        BLDSHARED="true"
                        LDSHFLAGS="-shared" 
                        DYNEXP="-Wl,--export-dynamic"
                        PICFLAG="-fPIC"
+                       SONAMEFLAG="-Wl,-soname="
                        AC_DEFINE(STAT_ST_BLOCKSIZE,512)
                ;;
-               *solaris*) 
-                       AC_DEFINE(SUNOS5)
+               *solaris*) AC_DEFINE(SUNOS5,1,[Whether the host os is solaris])
                        BLDSHARED="true"
-                       LDSHFLAGS="-h \$@ -G"
+                       LDSHFLAGS="-G"
+                       SONAMEFLAG="-h "
                        if test "${GCC}" = "yes"; then
                                PICFLAG="-fPIC"
+                               if test "${ac_cv_prog_gnu_ld}" = "yes"; then
+                                       DYNEXP="-Wl,-E"
+                               fi
                        else
                                PICFLAG="-KPIC"
+                               ## ${CFLAGS} added for building 64-bit shared 
+                               ## libs using Sun's Compiler
+                               LDSHFLAGS="-G \${CFLAGS}"
                                POBAD_CC=""
                                PICSUFFIX="po.o"
                        fi
-                       AC_DEFINE(STAT_ST_BLOCKSIZE,512)
+                       AC_DEFINE(STAT_ST_BLOCKSIZE,512,[The size of a block])
                ;;
-               *sunos*) AC_DEFINE(SUNOS4)
+               *sunos*) AC_DEFINE(SUNOS4,1,[Whether the host os is sunos4])
                        BLDSHARED="true"
-                       LDSHFLAGS="-Wl,-h,\$@ -G"
+                       LDSHFLAGS="-G"
+                       SONAMEFLAG="-Wl,-h,"
                        PICFLAG="-KPIC"   # Is this correct for SunOS
                ;;
-               *bsd*)  BLDSHARED="true"
-                       LDSHFLAGS="-Wl,-soname,\$@ -shared"
+               *freebsd*)  BLDSHARED="true"
+                       LDSHFLAGS="-shared"
+                       DYNEXP="-Wl,--export-dynamic"
+                       SONAMEFLAG="-Wl,-soname,"
+                       PICFLAG="-fPIC -DPIC"
+                       AC_DEFINE(STAT_ST_BLOCKSIZE,512,[The size of a block])
+               ;;
+               *openbsd*)  BLDSHARED="true"
+                       LDSHFLAGS="-shared"
                        DYNEXP="-Wl,-Bdynamic"
+                       SONAMEFLAG="-Wl,-soname,"
                        PICFLAG="-fPIC"
-                       AC_DEFINE(STAT_ST_BLOCKSIZE,512)
+                       AC_DEFINE(STAT_ST_BLOCKSIZE,512,[The size of a block])
                ;;
-               *irix*) AC_DEFINE(IRIX)
+               *irix*) AC_DEFINE(IRIX,1,[Whether the host os is irix])
                        case "$host_os" in
-                       *irix6*) AC_DEFINE(IRIX6)
+                       *irix6*) AC_DEFINE(IRIX6,1,[Whether the host os is irix6])
                        ;;
                        esac
                        ATTEMPT_WRAP32_BUILD=yes
                        BLDSHARED="true"
-                       LDSHFLAGS="-soname \$@ -shared"
+                       LDSHFLAGS="-set_version sgi1.0 -shared"
+                       SONAMEFLAG="-soname "
                        SHLD="\${LD}"
                        if test "${GCC}" = "yes"; then
                                PICFLAG="-fPIC"
                        else 
                                PICFLAG="-KPIC"
                        fi
-                       AC_DEFINE(STAT_ST_BLOCKSIZE,512)
+                       AC_DEFINE(STAT_ST_BLOCKSIZE,512,[The size of a block])
                ;;
-               *aix*) AC_DEFINE(AIX)
+               *aix*) AC_DEFINE(AIX,1,[Whether the host os is aix])
                        BLDSHARED="true"
                        LDSHFLAGS="-Wl,-bexpall,-bM:SRE,-bnoentry"
-                       PICFLAG="-O2 -qmaxmem=6000"
-                       AC_DEFINE(STAT_ST_BLOCKSIZE,DEV_BSIZE)
+                       DYNEXP="-Wl,-brtl,-bexpall"
+                       PICFLAG="-O2"
+                       if test "${GCC}" != "yes"; then
+                               ## for funky AIX compiler using strncpy()
+                               CFLAGS="$CFLAGS -D_LINUX_SOURCE_COMPAT -qmaxmem=32000"
+                       fi
+
+                       AC_DEFINE(STAT_ST_BLOCKSIZE,DEV_BSIZE,[The size of a block])
                ;;
-               *hpux*) AC_DEFINE(HPUX)
+               *hpux*) AC_DEFINE(HPUX,1,[Whether the host os is HPUX])
                        SHLIBEXT="sl"
                        # Use special PIC flags for the native HP-UX compiler.
                        if test $ac_cv_prog_cc_Ae = yes; then
-                               SHLD="/usr/bin/ld"
                                BLDSHARED="true"
-                               LDSHFLAGS="-B symbolic -b -z +h \$@"
+                               SHLD="/usr/bin/ld"
+                               LDSHFLAGS="-B symbolic -b -z"
+                               SONAMEFLAG="+h "
                                PICFLAG="+z"
                        fi
                        DYNEXP="-Wl,-E"
-                       AC_DEFINE(STAT_ST_BLOCKSIZE,8192)
+                       AC_DEFINE(STAT_ST_BLOCKSIZE,8192,[The size of a block])
                ;;
-               *qnx*) AC_DEFINE(QNX);;
-               *osf*) AC_DEFINE(OSF1)
+               *qnx*) AC_DEFINE(QNX,1,[Whether the host os is qnx]);;
+               *osf*) AC_DEFINE(OSF1,1,[Whether the host os is osf1])
                        BLDSHARED="true"
-                       LDSHFLAGS="-Wl,-soname,\$@ -shared"
+                       LDSHFLAGS="-shared"
+                       SONAMEFLAG="-Wl,-soname,"
                        PICFLAG="-fPIC"
                ;;
-               *sco*) 
-                       AC_DEFINE(SCO)
-               ;;
-               *unixware*) AC_DEFINE(UNIXWARE)
+               *sco*) AC_DEFINE(SCO,1,[Whether the host os is sco unix]);;
+               *unixware*) AC_DEFINE(UNIXWARE,1,[Whether the host os is unixware])
                        BLDSHARED="true"
-                       LDSHFLAGS="-Wl,-soname,\$@ -shared"
+                       LDSHFLAGS="-shared"
+                       SONAMEFLAG="-Wl,-soname,"
                        PICFLAG="-KPIC"
                ;;
-               *next2*) AC_DEFINE(NEXT2);;
+               *next2*) AC_DEFINE(NEXT2,1,[Whether the host os is NeXT v2]);;
                *dgux*) AC_CHECK_PROG( ROFF, groff, [groff -etpsR -Tascii -man]);;
-               *sysv4*)
+               *sysv4*) AC_DEFINE(SYSV,1,[Whether this is a system V system])
                        case "$host" in
-                               *-univel-*)
-                                       if [ test "$GCC" != yes ]; then
-                                               AC_DEFINE(HAVE_MEMSET)
+                               *-univel-*)     if [ test "$GCC" != yes ]; then
+                                               AC_DEFINE(HAVE_MEMSET,1,[Whether memset() is available])
                                        fi
                                        LDSHFLAGS="-G"
                                        DYNEXP="-Bexport"
                                ;;
-                               *mips-sni-sysv4*)
-                                       AC_DEFINE(RELIANTUNIX)
-                               ;;
+                               *mips-sni-sysv4*) AC_DEFINE(RELIANTUNIX,1,[Whether the host os is reliantunix]);;
                        esac
                ;;
 
-               *sysv5*)
+               *sysv5*) AC_DEFINE(SYSV,1,[Whether this is a system V system])
                        if [ test "$GCC" != yes ]; then
-                               AC_DEFINE(HAVE_MEMSET)
+                               AC_DEFINE(HAVE_MEMSET,1,[Whether memset() is available])
                        fi
                        LDSHFLAGS="-G"
                ;;
@@ -1013,7 +1028,7 @@ AC_TRY_RUN([#include <stdio.h>
 main() { long long x = 1000000; x *= x; exit(((x/1000000) == 1000000)? 0: 1); }],
 samba_cv_have_longlong=yes,samba_cv_have_longlong=no,samba_cv_have_longlong=cross)])
 if test x"$samba_cv_have_longlong" = x"yes"; then
-    AC_DEFINE(HAVE_LONGLONG)
+    AC_DEFINE(HAVE_LONGLONG,1,[Whether the host supports long long's])
 fi
 
 #
@@ -1024,7 +1039,7 @@ AC_CACHE_CHECK([for LL suffix on long long integers],samba_cv_compiler_supports_
     AC_TRY_COMPILE([#include <stdio.h>],[long long i = 0x8000000000LL],
        samba_cv_compiler_supports_ll=yes,samba_cv_compiler_supports_ll=no)])
 if test x"$samba_cv_compiler_supports_ll" = x"yes"; then
-   AC_DEFINE(COMPILER_SUPPORTS_LL)
+   AC_DEFINE(COMPILER_SUPPORTS_LL,1,[Whether the compiler supports the LL prefix on long long integers])
 fi
 
   
@@ -1034,7 +1049,7 @@ AC_TRY_RUN([#include <stdio.h>
 main() { exit((sizeof(off_t) == 8) ? 0 : 1); }],
 samba_cv_SIZEOF_OFF_T=yes,samba_cv_SIZEOF_OFF_T=no,samba_cv_SIZEOF_OFF_T=cross)])
 if test x"$samba_cv_SIZEOF_OFF_T" = x"yes"; then
-    AC_DEFINE(SIZEOF_OFF_T,8)
+    AC_DEFINE(SIZEOF_OFF_T,8,[The size of the 'off_t' type])
 fi
 
 AC_CACHE_CHECK([for off64_t],samba_cv_HAVE_OFF64_T,[
@@ -1047,7 +1062,7 @@ AC_TRY_RUN([
 main() { struct stat64 st; off64_t s; if (sizeof(off_t) == sizeof(off64_t)) exit(1); exit((lstat64("/dev/null", &st)==0)?0:1); }],
 samba_cv_HAVE_OFF64_T=yes,samba_cv_HAVE_OFF64_T=no,samba_cv_HAVE_OFF64_T=cross)])
 if test x"$samba_cv_HAVE_OFF64_T" = x"yes"; then
-    AC_DEFINE(HAVE_OFF64_T)
+    AC_DEFINE(HAVE_OFF64_T,1,[Whether off64_t is available])
 fi
 
 AC_CACHE_CHECK([for 64 bit ino_t],samba_cv_SIZEOF_INO_T,[
@@ -1056,7 +1071,7 @@ AC_TRY_RUN([#include <stdio.h>
 main() { exit((sizeof(ino_t) == 8) ? 0 : 1); }],
 samba_cv_SIZEOF_INO_T=yes,samba_cv_SIZEOF_INO_T=no,samba_cv_SIZEOF_INO_T=cross)])
 if test x"$samba_cv_SIZEOF_INO_T" = x"yes"; then
-    AC_DEFINE(SIZEOF_INO_T,8)
+    AC_DEFINE(SIZEOF_INO_T,8,[The size of the 'ino_t' type])
 fi
 
 AC_CACHE_CHECK([for ino64_t],samba_cv_HAVE_INO64_T,[
@@ -1069,7 +1084,7 @@ AC_TRY_RUN([
 main() { struct stat64 st; ino64_t s; if (sizeof(ino_t) == sizeof(ino64_t)) exit(1); exit((lstat64("/dev/null", &st)==0)?0:1); }],
 samba_cv_HAVE_INO64_T=yes,samba_cv_HAVE_INO64_T=no,samba_cv_HAVE_INO64_T=cross)])
 if test x"$samba_cv_HAVE_INO64_T" = x"yes"; then
-    AC_DEFINE(HAVE_INO64_T)
+    AC_DEFINE(HAVE_INO64_T,1,[Whether the 'ino64_t' type is available])
 fi
 
 AC_CACHE_CHECK([for dev64_t],samba_cv_HAVE_DEV64_T,[
@@ -1082,7 +1097,7 @@ AC_TRY_RUN([
 main() { struct stat64 st; dev64_t s; if (sizeof(dev_t) == sizeof(dev64_t)) exit(1); exit((lstat64("/dev/null", &st)==0)?0:1); }],
 samba_cv_HAVE_DEV64_T=yes,samba_cv_HAVE_DEV64_T=no,samba_cv_HAVE_DEV64_T=cross)])
 if test x"$samba_cv_HAVE_DEV64_T" = x"yes"; then
-    AC_DEFINE(HAVE_DEV64_T)
+    AC_DEFINE(HAVE_DEV64_T,1,[Whether the 'dev64_t' type is available])
 fi
 
 AC_CACHE_CHECK([for struct dirent64],samba_cv_HAVE_STRUCT_DIRENT64,[
@@ -1094,8 +1109,8 @@ AC_TRY_COMPILE([
 #include <dirent.h>],
 [struct dirent64 de;],
 samba_cv_HAVE_STRUCT_DIRENT64=yes,samba_cv_HAVE_STRUCT_DIRENT64=no)])
-if test x"$samba_cv_HAVE_STRUCT_DIRENT64" = x"yes"; then
-    AC_DEFINE(HAVE_STRUCT_DIRENT64)
+if test x"$samba_cv_HAVE_STRUCT_DIRENT64" = x"yes" && test x"$ac_cv_func_readdir64" = x"yes"; then
+    AC_DEFINE(HAVE_STRUCT_DIRENT64,1,[Whether the 'dirent64' struct is available])
 fi
 
 AC_CACHE_CHECK([for major macro],samba_cv_HAVE_DEVICE_MAJOR_FN,[
@@ -1107,7 +1122,7 @@ AC_TRY_RUN([
 main() { dev_t dev; int i = major(dev); return 0; }],
 samba_cv_HAVE_DEVICE_MAJOR_FN=yes,samba_cv_HAVE_DEVICE_MAJOR_FN=no,samba_cv_HAVE_DEVICE_MAJOR_FN=cross)])
 if test x"$samba_cv_HAVE_DEVICE_MAJOR_FN" = x"yes"; then
-    AC_DEFINE(HAVE_DEVICE_MAJOR_FN)
+    AC_DEFINE(HAVE_DEVICE_MAJOR_FN,1,[Whether the major macro for dev_t is available])
 fi
 
 AC_CACHE_CHECK([for minor macro],samba_cv_HAVE_DEVICE_MINOR_FN,[
@@ -1119,7 +1134,7 @@ AC_TRY_RUN([
 main() { dev_t dev; int i = minor(dev); return 0; }],
 samba_cv_HAVE_DEVICE_MINOR_FN=yes,samba_cv_HAVE_DEVICE_MINOR_FN=no,samba_cv_HAVE_DEVICE_MINOR_FN=cross)])
 if test x"$samba_cv_HAVE_DEVICE_MINOR_FN" = x"yes"; then
-    AC_DEFINE(HAVE_DEVICE_MINOR_FN)
+    AC_DEFINE(HAVE_DEVICE_MINOR_FN,1,[Whether the minor macro for dev_t is available])
 fi
 
 AC_CACHE_CHECK([for unsigned char],samba_cv_HAVE_UNSIGNED_CHAR,[
@@ -1127,7 +1142,7 @@ 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)
+    AC_DEFINE(HAVE_UNSIGNED_CHAR,1,[Whether the 'unsigned char' type is available])
 fi
 
 AC_CACHE_CHECK([for sin_len in sock],samba_cv_HAVE_SOCK_SIN_LEN,[
@@ -1137,7 +1152,7 @@ AC_TRY_COMPILE([#include <sys/types.h>
 [struct sockaddr_in sock; sock.sin_len = sizeof(sock);],
 samba_cv_HAVE_SOCK_SIN_LEN=yes,samba_cv_HAVE_SOCK_SIN_LEN=no)])
 if test x"$samba_cv_HAVE_SOCK_SIN_LEN" = x"yes"; then
-    AC_DEFINE(HAVE_SOCK_SIN_LEN)
+    AC_DEFINE(HAVE_SOCK_SIN_LEN,1,[Whether the sockaddr_in struct has a sin_len property])
 fi
 
 AC_CACHE_CHECK([whether seekdir returns void],samba_cv_SEEKDIR_RETURNS_VOID,[
@@ -1146,21 +1161,21 @@ AC_TRY_COMPILE([#include <sys/types.h>
 void seekdir(DIR *d, long loc) { return; }],[return 0;],
 samba_cv_SEEKDIR_RETURNS_VOID=yes,samba_cv_SEEKDIR_RETURNS_VOID=no)])
 if test x"$samba_cv_SEEKDIR_RETURNS_VOID" = x"yes"; then
-    AC_DEFINE(SEEKDIR_RETURNS_VOID)
+    AC_DEFINE(SEEKDIR_RETURNS_VOID,1,[Whether seekdir returns void])
 fi
 
 AC_CACHE_CHECK([for __FILE__ macro],samba_cv_HAVE_FILE_MACRO,[
 AC_TRY_COMPILE([#include <stdio.h>], [printf("%s\n", __FILE__);],
 samba_cv_HAVE_FILE_MACRO=yes,samba_cv_HAVE_FILE_MACRO=no)])
 if test x"$samba_cv_HAVE_FILE_MACRO" = x"yes"; then
-    AC_DEFINE(HAVE_FILE_MACRO)
+    AC_DEFINE(HAVE_FILE_MACRO,1,[Whether there is a __FILE__ macro])
 fi
 
 AC_CACHE_CHECK([for __FUNCTION__ macro],samba_cv_HAVE_FUNCTION_MACRO,[
 AC_TRY_COMPILE([#include <stdio.h>], [printf("%s\n", __FUNCTION__);],
 samba_cv_HAVE_FUNCTION_MACRO=yes,samba_cv_HAVE_FUNCTION_MACRO=no)])
 if test x"$samba_cv_HAVE_FUNCTION_MACRO" = x"yes"; then
-    AC_DEFINE(HAVE_FUNCTION_MACRO)
+    AC_DEFINE(HAVE_FUNCTION_MACRO,1,[Whether there is a __FUNCTION__ macro])
 fi
 
 AC_CACHE_CHECK([if gettimeofday takes tz argument],samba_cv_HAVE_GETTIMEOFDAY_TZ,[
@@ -1170,7 +1185,7 @@ AC_TRY_RUN([
 main() { struct timeval tv; exit(gettimeofday(&tv, NULL));}],
            samba_cv_HAVE_GETTIMEOFDAY_TZ=yes,samba_cv_HAVE_GETTIMEOFDAY_TZ=no,samba_cv_HAVE_GETTIMEOFDAY_TZ=cross)])
 if test x"$samba_cv_HAVE_GETTIMEOFDAY_TZ" = x"yes"; then
-    AC_DEFINE(HAVE_GETTIMEOFDAY_TZ)
+    AC_DEFINE(HAVE_GETTIMEOFDAY_TZ,1,[Whether gettimeofday() is available])
 fi
 
 AC_CACHE_CHECK([for __va_copy],samba_cv_HAVE_VA_COPY,[
@@ -1178,7 +1193,7 @@ AC_TRY_LINK([#include <stdarg.h>
 va_list ap1,ap2;], [__va_copy(ap1,ap2);],
 samba_cv_HAVE_VA_COPY=yes,samba_cv_HAVE_VA_COPY=no)])
 if test x"$samba_cv_HAVE_VA_COPY" = x"yes"; then
-    AC_DEFINE(HAVE_VA_COPY)
+    AC_DEFINE(HAVE_VA_COPY,1,[Whether __va_copy() is available])
 fi
 
 AC_CACHE_CHECK([for C99 vsnprintf],samba_cv_HAVE_C99_VSNPRINTF,[
@@ -1208,7 +1223,7 @@ main() { foo("hello"); }
 ],
 samba_cv_HAVE_C99_VSNPRINTF=yes,samba_cv_HAVE_C99_VSNPRINTF=no,samba_cv_HAVE_C99_VSNPRINTF=cross)])
 if test x"$samba_cv_HAVE_C99_VSNPRINTF" = x"yes"; then
-    AC_DEFINE(HAVE_C99_VSNPRINTF)
+    AC_DEFINE(HAVE_C99_VSNPRINTF,1,[Whether there is a C99 compliant vsnprintf])
 fi
 
 AC_CACHE_CHECK([for broken readdir],samba_cv_HAVE_BROKEN_READDIR,[
@@ -1219,7 +1234,7 @@ if (di && di->d_name[-2] == '.' && di->d_name[-1] == 0 &&
 di->d_name[0] == 0) exit(0); exit(1);} ],
 samba_cv_HAVE_BROKEN_READDIR=yes,samba_cv_HAVE_BROKEN_READDIR=no,samba_cv_HAVE_BROKEN_READDIR=cross)])
 if test x"$samba_cv_HAVE_BROKEN_READDIR" = x"yes"; then
-    AC_DEFINE(HAVE_BROKEN_READDIR)
+    AC_DEFINE(HAVE_BROKEN_READDIR,1,[Whether readdir() is broken])
 fi
 
 AC_CACHE_CHECK([for utimbuf],samba_cv_HAVE_UTIMBUF,[
@@ -1228,7 +1243,7 @@ AC_TRY_COMPILE([#include <sys/types.h>
 [struct utimbuf tbuf;  tbuf.actime = 0; tbuf.modtime = 1; exit(utime("foo.c",&tbuf));],
 samba_cv_HAVE_UTIMBUF=yes,samba_cv_HAVE_UTIMBUF=no,samba_cv_HAVE_UTIMBUF=cross)])
 if test x"$samba_cv_HAVE_UTIMBUF" = x"yes"; then
-    AC_DEFINE(HAVE_UTIMBUF)
+    AC_DEFINE(HAVE_UTIMBUF,1,[Whether struct utimbuf is available])
 fi
 
 dnl  utmp and utmpx come in many flavours
@@ -1244,7 +1259,7 @@ AC_TRY_COMPILE([#include <sys/types.h>
 [struct utmp ut;  ut.ut_name[0] = 'a';],
 samba_cv_HAVE_UT_UT_NAME=yes,samba_cv_HAVE_UT_UT_NAME=no,samba_cv_HAVE_UT_UT_NAME=cross)])
 if test x"$samba_cv_HAVE_UT_UT_NAME" = x"yes"; then
-    AC_DEFINE(HAVE_UT_UT_NAME)
+    AC_DEFINE(HAVE_UT_UT_NAME,1,[Whether the utmp struct has a property ut_name])
 fi 
 
 AC_CACHE_CHECK([for ut_user in utmp],samba_cv_HAVE_UT_UT_USER,[
@@ -1253,7 +1268,7 @@ AC_TRY_COMPILE([#include <sys/types.h>
 [struct utmp ut;  ut.ut_user[0] = 'a';],
 samba_cv_HAVE_UT_UT_USER=yes,samba_cv_HAVE_UT_UT_USER=no,samba_cv_HAVE_UT_UT_USER=cross)])
 if test x"$samba_cv_HAVE_UT_UT_USER" = x"yes"; then
-    AC_DEFINE(HAVE_UT_UT_USER)
+    AC_DEFINE(HAVE_UT_UT_USER,1,[Whether the utmp struct has a property ut_user])
 fi 
 
 AC_CACHE_CHECK([for ut_id in utmp],samba_cv_HAVE_UT_UT_ID,[
@@ -1262,7 +1277,7 @@ AC_TRY_COMPILE([#include <sys/types.h>
 [struct utmp ut;  ut.ut_id[0] = 'a';],
 samba_cv_HAVE_UT_UT_ID=yes,samba_cv_HAVE_UT_UT_ID=no,samba_cv_HAVE_UT_UT_ID=cross)])
 if test x"$samba_cv_HAVE_UT_UT_ID" = x"yes"; then
-    AC_DEFINE(HAVE_UT_UT_ID)
+    AC_DEFINE(HAVE_UT_UT_ID,1,[Whether the utmp struct has a property ut_id])
 fi 
 
 AC_CACHE_CHECK([for ut_host in utmp],samba_cv_HAVE_UT_UT_HOST,[
@@ -1271,7 +1286,7 @@ AC_TRY_COMPILE([#include <sys/types.h>
 [struct utmp ut;  ut.ut_host[0] = 'a';],
 samba_cv_HAVE_UT_UT_HOST=yes,samba_cv_HAVE_UT_UT_HOST=no,samba_cv_HAVE_UT_UT_HOST=cross)])
 if test x"$samba_cv_HAVE_UT_UT_HOST" = x"yes"; then
-    AC_DEFINE(HAVE_UT_UT_HOST)
+    AC_DEFINE(HAVE_UT_UT_HOST,1,[Whether the utmp struct has a property ut_host])
 fi 
 
 AC_CACHE_CHECK([for ut_time in utmp],samba_cv_HAVE_UT_UT_TIME,[
@@ -1280,7 +1295,7 @@ AC_TRY_COMPILE([#include <sys/types.h>
 [struct utmp ut;  time_t t; ut.ut_time = t;],
 samba_cv_HAVE_UT_UT_TIME=yes,samba_cv_HAVE_UT_UT_TIME=no,samba_cv_HAVE_UT_UT_TIME=cross)])
 if test x"$samba_cv_HAVE_UT_UT_TIME" = x"yes"; then
-    AC_DEFINE(HAVE_UT_UT_TIME)
+    AC_DEFINE(HAVE_UT_UT_TIME,1,[Whether the utmp struct has a property ut_time])
 fi 
 
 AC_CACHE_CHECK([for ut_tv in utmp],samba_cv_HAVE_UT_UT_TV,[
@@ -1289,7 +1304,7 @@ AC_TRY_COMPILE([#include <sys/types.h>
 [struct utmp ut;  struct timeval tv; ut.ut_tv = tv;],
 samba_cv_HAVE_UT_UT_TV=yes,samba_cv_HAVE_UT_UT_TV=no,samba_cv_HAVE_UT_UT_TV=cross)])
 if test x"$samba_cv_HAVE_UT_UT_TV" = x"yes"; then
-    AC_DEFINE(HAVE_UT_UT_TV)
+    AC_DEFINE(HAVE_UT_UT_TV,1,[Whether the utmp struct has a property ut_tv])
 fi 
 
 AC_CACHE_CHECK([for ut_type in utmp],samba_cv_HAVE_UT_UT_TYPE,[
@@ -1298,7 +1313,7 @@ AC_TRY_COMPILE([#include <sys/types.h>
 [struct utmp ut;  ut.ut_type = 0;],
 samba_cv_HAVE_UT_UT_TYPE=yes,samba_cv_HAVE_UT_UT_TYPE=no,samba_cv_HAVE_UT_UT_TYPE=cross)])
 if test x"$samba_cv_HAVE_UT_UT_TYPE" = x"yes"; then
-    AC_DEFINE(HAVE_UT_UT_TYPE)
+    AC_DEFINE(HAVE_UT_UT_TYPE,1,[Whether the utmp struct has a property ut_type])
 fi 
 
 AC_CACHE_CHECK([for ut_pid in utmp],samba_cv_HAVE_UT_UT_PID,[
@@ -1307,7 +1322,7 @@ AC_TRY_COMPILE([#include <sys/types.h>
 [struct utmp ut;  ut.ut_pid = 0;],
 samba_cv_HAVE_UT_UT_PID=yes,samba_cv_HAVE_UT_UT_PID=no,samba_cv_HAVE_UT_UT_PID=cross)])
 if test x"$samba_cv_HAVE_UT_UT_PID" = x"yes"; then
-    AC_DEFINE(HAVE_UT_UT_PID)
+    AC_DEFINE(HAVE_UT_UT_PID,1,[Whether the utmp struct has a property ut_pid])
 fi 
 
 AC_CACHE_CHECK([for ut_exit in utmp],samba_cv_HAVE_UT_UT_EXIT,[
@@ -1316,7 +1331,7 @@ AC_TRY_COMPILE([#include <sys/types.h>
 [struct utmp ut;  ut.ut_exit.e_exit = 0;],
 samba_cv_HAVE_UT_UT_EXIT=yes,samba_cv_HAVE_UT_UT_EXIT=no,samba_cv_HAVE_UT_UT_EXIT=cross)])
 if test x"$samba_cv_HAVE_UT_UT_EXIT" = x"yes"; then
-    AC_DEFINE(HAVE_UT_UT_EXIT)
+    AC_DEFINE(HAVE_UT_UT_EXIT,1,[Whether the utmp struct has a property ut_exit])
 fi 
 
 AC_CACHE_CHECK([for ut_addr in utmp],samba_cv_HAVE_UT_UT_ADDR,[
@@ -1325,7 +1340,7 @@ AC_TRY_COMPILE([#include <sys/types.h>
 [struct utmp ut;  ut.ut_addr = 0;],
 samba_cv_HAVE_UT_UT_ADDR=yes,samba_cv_HAVE_UT_UT_ADDR=no,samba_cv_HAVE_UT_UT_ADDR=cross)])
 if test x"$samba_cv_HAVE_UT_UT_ADDR" = x"yes"; then
-    AC_DEFINE(HAVE_UT_UT_ADDR)
+    AC_DEFINE(HAVE_UT_UT_ADDR,1,[Whether the utmp struct has a property ut_addr])
 fi 
 
 if test x$ac_cv_func_pututline = xyes ; then
@@ -1335,7 +1350,7 @@ if test x$ac_cv_func_pututline = xyes ; then
   [struct utmp utarg; struct utmp *utreturn; utreturn = pututline(&utarg);],
   samba_cv_PUTUTLINE_RETURNS_UTMP=yes,samba_cv_PUTUTLINE_RETURNS_UTMP=no)])
   if test x"$samba_cv_PUTUTLINE_RETURNS_UTMP" = x"yes"; then
-      AC_DEFINE(PUTUTLINE_RETURNS_UTMP)
+      AC_DEFINE(PUTUTLINE_RETURNS_UTMP,1,[Whether pututline returns pointer])
   fi
 fi
 
@@ -1345,7 +1360,7 @@ AC_TRY_COMPILE([#include <sys/types.h>
 [struct utmpx ux;  ux.ut_syslen = 0;],
 samba_cv_HAVE_UX_UT_SYSLEN=yes,samba_cv_HAVE_UX_UT_SYSLEN=no,samba_cv_HAVE_UX_UT_SYSLEN=cross)])
 if test x"$samba_cv_HAVE_UX_UT_SYSLEN" = x"yes"; then
-    AC_DEFINE(HAVE_UX_UT_SYSLEN)
+    AC_DEFINE(HAVE_UX_UT_SYSLEN,1,[Whether the utmpx struct has a property ut_syslen])
 fi 
 
 
@@ -1363,7 +1378,7 @@ AC_ARG_WITH(libiconv,
     CFLAGS="$CFLAGS -I$withval/include"
     LDFLAGS="$LDFLAGS -L$withval/lib"
     AC_CHECK_LIB(iconv, iconv_open)
-    AC_DEFINE_UNQUOTED(WITH_LIBICONV, "${withval}")
+    AC_DEFINE_UNQUOTED(WITH_LIBICONV, "${withval}",[Path to iconv])
     ;;
   esac ],
   AC_MSG_RESULT(no)
@@ -1383,7 +1398,7 @@ main() {
 ],
 samba_cv_HAVE_NATIVE_ICONV=yes,samba_cv_HAVE_NATIVE_ICONV=no,samba_cv_HAVE_NATIVE_ICONV=cross)])
 if test x"$samba_cv_HAVE_NATIVE_ICONV" = x"yes"; then
-    AC_DEFINE(HAVE_NATIVE_ICONV)
+    AC_DEFINE(HAVE_NATIVE_ICONV,1,[Whether to use native iconv])
 fi
 
 
@@ -1401,7 +1416,7 @@ main() {
 ],
 samba_cv_HAVE_KERNEL_OPLOCKS_LINUX=yes,samba_cv_HAVE_KERNEL_OPLOCKS_LINUX=no,samba_cv_HAVE_KERNEL_OPLOCKS_LINUX=cross)])
 if test x"$samba_cv_HAVE_KERNEL_OPLOCKS_LINUX" = x"yes"; then
-    AC_DEFINE(HAVE_KERNEL_OPLOCKS_LINUX)
+    AC_DEFINE(HAVE_KERNEL_OPLOCKS_LINUX,1,[Whether to use linux kernel oplocks])
 fi
 
 AC_CACHE_CHECK([for kernel change notify support],samba_cv_HAVE_KERNEL_CHANGE_NOTIFY,[
@@ -1418,7 +1433,7 @@ main() {
 ],
 samba_cv_HAVE_KERNEL_CHANGE_NOTIFY=yes,samba_cv_HAVE_KERNEL_CHANGE_NOTIFY=no,samba_cv_HAVE_KERNEL_CHANGE_NOTIFY=cross)])
 if test x"$samba_cv_HAVE_KERNEL_CHANGE_NOTIFY" = x"yes"; then
-    AC_DEFINE(HAVE_KERNEL_CHANGE_NOTIFY)
+    AC_DEFINE(HAVE_KERNEL_CHANGE_NOTIFY,1,[Whether kernel notifies changes])
 fi
 
 AC_CACHE_CHECK([for kernel share modes],samba_cv_HAVE_KERNEL_SHARE_MODES,[
@@ -1437,7 +1452,7 @@ main() {
 ],
 samba_cv_HAVE_KERNEL_SHARE_MODES=yes,samba_cv_HAVE_KERNEL_SHARE_MODES=no,samba_cv_HAVE_KERNEL_SHARE_MODES=cross)])
 if test x"$samba_cv_HAVE_KERNEL_SHARE_MODES" = x"yes"; then
-    AC_DEFINE(HAVE_KERNEL_SHARE_MODES)
+    AC_DEFINE(HAVE_KERNEL_SHARE_MODES,1,[Whether the kernel supports share modes])
 fi
 
 
@@ -1449,7 +1464,7 @@ AC_TRY_COMPILE([#include <sys/types.h>
 [oplock_stat_t t; t.os_state = OP_REVOKE; t.os_dev = 1; t.os_ino = 1;],
 samba_cv_HAVE_KERNEL_OPLOCKS_IRIX=yes,samba_cv_HAVE_KERNEL_OPLOCKS_IRIX=no)])
 if test x"$samba_cv_HAVE_KERNEL_OPLOCKS_IRIX" = x"yes"; then
-    AC_DEFINE(HAVE_KERNEL_OPLOCKS_IRIX)
+    AC_DEFINE(HAVE_KERNEL_OPLOCKS_IRIX,1,[Whether IRIX kernel oplock type definitions are available])
 fi
 
 AC_CACHE_CHECK([for irix specific capabilities],samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES,[
@@ -1467,7 +1482,7 @@ main() {
 ],
 samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES=yes,samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES=no,samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES=cross)])
 if test x"$samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES" = x"yes"; then
-    AC_DEFINE(HAVE_IRIX_SPECIFIC_CAPABILITIES)
+    AC_DEFINE(HAVE_IRIX_SPECIFIC_CAPABILITIES,1,[Whether IRIX specific capabilities are available])
 fi
 
 #
@@ -1483,7 +1498,7 @@ AC_TRY_COMPILE([#include <sys/types.h>
 [int16 testvar;],
 samba_cv_HAVE_INT16_FROM_RPC_RPC_H=yes,samba_cv_HAVE_INT16_FROM_RPC_RPC_H=no)])
 if test x"$samba_cv_HAVE_INT16_FROM_RPC_RPC_H" = x"yes"; then
-    AC_DEFINE(HAVE_INT16_FROM_RPC_RPC_H)
+    AC_DEFINE(HAVE_INT16_FROM_RPC_RPC_H,1,[Whether int16 typedef is included by rpc/rpc.h])
 fi
 
 AC_CACHE_CHECK([for uint16 typedef included by rpc/rpc.h],samba_cv_HAVE_UINT16_FROM_RPC_RPC_H,[
@@ -1494,7 +1509,7 @@ AC_TRY_COMPILE([#include <sys/types.h>
 [uint16 testvar;],
 samba_cv_HAVE_UINT16_FROM_RPC_RPC_H=yes,samba_cv_HAVE_UINT16_FROM_RPC_RPC_H=no)])
 if test x"$samba_cv_HAVE_UINT16_FROM_RPC_RPC_H" = x"yes"; then
-    AC_DEFINE(HAVE_UINT16_FROM_RPC_RPC_H)
+    AC_DEFINE(HAVE_UINT16_FROM_RPC_RPC_H,1,[Whether uint16 typedef is included by rpc/rpc.h])
 fi
 
 AC_CACHE_CHECK([for int32 typedef included by rpc/rpc.h],samba_cv_HAVE_INT32_FROM_RPC_RPC_H,[
@@ -1505,7 +1520,7 @@ AC_TRY_COMPILE([#include <sys/types.h>
 [int32 testvar;],
 samba_cv_HAVE_INT32_FROM_RPC_RPC_H=yes,samba_cv_HAVE_INT32_FROM_RPC_RPC_H=no)])
 if test x"$samba_cv_HAVE_INT32_FROM_RPC_RPC_H" = x"yes"; then
-    AC_DEFINE(HAVE_INT32_FROM_RPC_RPC_H)
+    AC_DEFINE(HAVE_INT32_FROM_RPC_RPC_H,1,[Whether int32 typedef is included by rpc/rpc.h])
 fi
 
 AC_CACHE_CHECK([for uint32 typedef included by rpc/rpc.h],samba_cv_HAVE_UINT32_FROM_RPC_RPC_H,[
@@ -1516,7 +1531,7 @@ AC_TRY_COMPILE([#include <sys/types.h>
 [uint32 testvar;],
 samba_cv_HAVE_UINT32_FROM_RPC_RPC_H=yes,samba_cv_HAVE_UINT32_FROM_RPC_RPC_H=no)])
 if test x"$samba_cv_HAVE_UINT32_FROM_RPC_RPC_H" = x"yes"; then
-    AC_DEFINE(HAVE_UINT32_FROM_RPC_RPC_H)
+    AC_DEFINE(HAVE_UINT32_FROM_RPC_RPC_H,1,[Whether uint32 typedef is included by rpc/rpc.h])
 fi
 
 dnl
@@ -1538,7 +1553,7 @@ AC_TRY_COMPILE([#include <sys/types.h>
 [int testvar;],
 samba_cv_HAVE_RPC_AUTH_ERROR_CONFLICT=no,samba_cv_HAVE_RPC_AUTH_ERROR_CONFLICT=yes)])
 if test x"$samba_cv_HAVE_RPC_AUTH_ERROR_CONFLICT" = x"yes"; then
-    AC_DEFINE(HAVE_RPC_AUTH_ERROR_CONFLICT)
+    AC_DEFINE(HAVE_RPC_AUTH_ERROR_CONFLICT,1,[Whether there is a conflicting AUTH_ERROR define in rpc/rpc.h])
 fi
 
 AC_MSG_CHECKING([for test routines])
@@ -1551,7 +1566,7 @@ AC_CACHE_CHECK([for ftruncate extend],samba_cv_HAVE_FTRUNCATE_EXTEND,[
 AC_TRY_RUN([#include "${srcdir-.}/tests/ftruncate.c"],
            samba_cv_HAVE_FTRUNCATE_EXTEND=yes,samba_cv_HAVE_FTRUNCATE_EXTEND=no,samba_cv_HAVE_FTRUNCATE_EXTEND=cross)])
 if test x"$samba_cv_HAVE_FTRUNCATE_EXTEND" = x"yes"; then
-    AC_DEFINE(HAVE_FTRUNCATE_EXTEND)
+    AC_DEFINE(HAVE_FTRUNCATE_EXTEND,1,[Truncate extend])
 fi
 
 AC_CACHE_CHECK([for AF_LOCAL socket support], samba_cv_HAVE_WORKING_AF_LOCAL, [
@@ -1568,12 +1583,12 @@ AC_CACHE_CHECK([for broken getgroups],samba_cv_HAVE_BROKEN_GETGROUPS,[
 AC_TRY_RUN([#include "${srcdir-.}/tests/getgroups.c"],
            samba_cv_HAVE_BROKEN_GETGROUPS=yes,samba_cv_HAVE_BROKEN_GETGROUPS=no,samba_cv_HAVE_BROKEN_GETGROUPS=cross)])
 if test x"$samba_cv_HAVE_BROKEN_GETGROUPS" = x"yes"; then
-    AC_DEFINE(HAVE_BROKEN_GETGROUPS)
+    AC_DEFINE(HAVE_BROKEN_GETGROUPS,1,[Whether getgroups is broken])
 fi
 
 AC_CACHE_CHECK([whether getpass should be replaced],samba_cv_REPLACE_GETPASS,[
 SAVE_CPPFLAGS="$CPPFLAGS"
-CPPFLAGS="$CPPFLAGS -I${srcdir-.}/ -I${srcdir-.}/include -I${srcdir-.}/popt -I${srcdir-.}/ubiqx -I${srcdir-.}/smbwrapper"
+CPPFLAGS="$CPPFLAGS -I${srcdir-.}/ -I${srcdir-.}/include -I${srcdir-.}/ubiqx -I${srcdir-.}/popt  -I${srcdir-.}/smbwrapper"
 AC_TRY_COMPILE([
 #define REPLACE_GETPASS 1
 #define NO_CONFIG_H 1
@@ -1584,7 +1599,7 @@ AC_TRY_COMPILE([
 CPPFLAGS="$SAVE_CPPFLAGS"
 ])
 if test x"$samba_cv_REPLACE_GETPASS" = x"yes"; then
-       AC_DEFINE(REPLACE_GETPASS)
+       AC_DEFINE(REPLACE_GETPASS,1,[Whether getpass should be replaced])
 fi
 
 AC_CACHE_CHECK([for broken inet_ntoa],samba_cv_REPLACE_INET_NTOA,[
@@ -1601,7 +1616,7 @@ if (strcmp(inet_ntoa(ip),"18.52.86.120") &&
 exit(1);}],
            samba_cv_REPLACE_INET_NTOA=yes,samba_cv_REPLACE_INET_NTOA=no,samba_cv_REPLACE_INET_NTOA=cross)])
 if test x"$samba_cv_REPLACE_INET_NTOA" = x"yes"; then
-    AC_DEFINE(REPLACE_INET_NTOA)
+    AC_DEFINE(REPLACE_INET_NTOA,1,[Whether inet_ntoa should be replaced])
 fi
 
 AC_CACHE_CHECK([for secure mkstemp],samba_cv_HAVE_SECURE_MKSTEMP,[
@@ -1623,7 +1638,7 @@ samba_cv_HAVE_SECURE_MKSTEMP=yes,
 samba_cv_HAVE_SECURE_MKSTEMP=no,
 samba_cv_HAVE_SECURE_MKSTEMP=cross)])
 if test x"$samba_cv_HAVE_SECURE_MKSTEMP" = x"yes"; then
-    AC_DEFINE(HAVE_SECURE_MKSTEMP)
+    AC_DEFINE(HAVE_SECURE_MKSTEMP,1,[Whether mkstemp is secure])
 fi
 
 AC_CACHE_CHECK([for sysconf(_SC_NGROUPS_MAX)],samba_cv_SYSCONF_SC_NGROUPS_MAX,[
@@ -1631,14 +1646,14 @@ AC_TRY_RUN([#include <unistd.h>
 main() { exit(sysconf(_SC_NGROUPS_MAX) == -1 ? 1 : 0); }],
 samba_cv_SYSCONF_SC_NGROUPS_MAX=yes,samba_cv_SYSCONF_SC_NGROUPS_MAX=no,samba_cv_SYSCONF_SC_NGROUPS_MAX=cross)])
 if test x"$samba_cv_SYSCONF_SC_NGROUPS_MAX" = x"yes"; then
-    AC_DEFINE(SYSCONF_SC_NGROUPS_MAX)
+    AC_DEFINE(SYSCONF_SC_NGROUPS_MAX,1,[Whether sysconf(_SC_NGROUPS_MAX) is available])
 fi
 
 AC_CACHE_CHECK([for root],samba_cv_HAVE_ROOT,[
 AC_TRY_RUN([main() { exit(getuid() != 0); }],
            samba_cv_HAVE_ROOT=yes,samba_cv_HAVE_ROOT=no,samba_cv_HAVE_ROOT=cross)])
 if test x"$samba_cv_HAVE_ROOT" = x"yes"; then
-    AC_DEFINE(HAVE_ROOT)
+    AC_DEFINE(HAVE_ROOT,1,[Whether current user is root])
 else
     AC_MSG_WARN(running as non-root will disable some tests)
 fi
@@ -1654,7 +1669,7 @@ AC_TRY_RUN([
 #include "${srcdir-.}/lib/interfaces.c"],
            samba_cv_HAVE_IFACE_AIX=yes,samba_cv_HAVE_IFACE_AIX=no,samba_cv_HAVE_IFACE_AIX=cross)])
 if test x"$samba_cv_HAVE_IFACE_AIX" = x"yes"; then
-    iface=yes;AC_DEFINE(HAVE_IFACE_AIX)
+    iface=yes;AC_DEFINE(HAVE_IFACE_AIX,1,[Whether iface AIX is available])
 fi
 
 if test $iface = no; then
@@ -1666,7 +1681,7 @@ AC_TRY_RUN([
 #include "${srcdir-.}/lib/interfaces.c"],
            samba_cv_HAVE_IFACE_IFCONF=yes,samba_cv_HAVE_IFACE_IFCONF=no,samba_cv_HAVE_IFACE_IFCONF=cross)])
 if test x"$samba_cv_HAVE_IFACE_IFCONF" = x"yes"; then
-    iface=yes;AC_DEFINE(HAVE_IFACE_IFCONF)
+    iface=yes;AC_DEFINE(HAVE_IFACE_IFCONF,1,[Whether iface ifconf is available])
 fi
 fi
 
@@ -1679,7 +1694,7 @@ AC_TRY_RUN([
 #include "${srcdir-.}/lib/interfaces.c"],
            samba_cv_HAVE_IFACE_IFREQ=yes,samba_cv_HAVE_IFACE_IFREQ=no,samba_cv_HAVE_IFACE_IFREQ=cross)])
 if test x"$samba_cv_HAVE_IFACE_IFREQ" = x"yes"; then
-    iface=yes;AC_DEFINE(HAVE_IFACE_IFREQ)
+    iface=yes;AC_DEFINE(HAVE_IFACE_IFREQ,1,[Whether iface ifreq is available])
 fi
 fi
 
@@ -1696,7 +1711,7 @@ AC_TRY_RUN([
 #include "${srcdir-.}/lib/util_sec.c"],
            samba_cv_USE_SETRESUID=yes,samba_cv_USE_SETRESUID=no,samba_cv_USE_SETRESUID=cross)])
 if test x"$samba_cv_USE_SETRESUID" = x"yes"; then
-    seteuid=yes;AC_DEFINE(USE_SETRESUID)
+    seteuid=yes;AC_DEFINE(USE_SETRESUID,1,[Whether setresuid() is available])
 fi
 fi
 
@@ -1710,7 +1725,7 @@ AC_TRY_RUN([
 #include "${srcdir-.}/lib/util_sec.c"],
            samba_cv_USE_SETREUID=yes,samba_cv_USE_SETREUID=no,samba_cv_USE_SETREUID=cross)])
 if test x"$samba_cv_USE_SETREUID" = x"yes"; then
-    seteuid=yes;AC_DEFINE(USE_SETREUID)
+    seteuid=yes;AC_DEFINE(USE_SETREUID,1,[Whether setreuid() is available])
 fi
 fi
 
@@ -1723,7 +1738,7 @@ AC_TRY_RUN([
 #include "${srcdir-.}/lib/util_sec.c"],
            samba_cv_USE_SETEUID=yes,samba_cv_USE_SETEUID=no,samba_cv_USE_SETEUID=cross)])
 if test x"$samba_cv_USE_SETEUID" = x"yes"; then
-    seteuid=yes;AC_DEFINE(USE_SETEUID)
+    seteuid=yes;AC_DEFINE(USE_SETEUID,1,[Whether seteuid() is available])
 fi
 fi
 
@@ -1736,7 +1751,7 @@ AC_TRY_RUN([
 #include "${srcdir-.}/lib/util_sec.c"],
            samba_cv_USE_SETUIDX=yes,samba_cv_USE_SETUIDX=no,samba_cv_USE_SETUIDX=cross)])
 if test x"$samba_cv_USE_SETUIDX" = x"yes"; then
-    seteuid=yes;AC_DEFINE(USE_SETUIDX)
+    seteuid=yes;AC_DEFINE(USE_SETUIDX,1,[Whether setuidx() is available])
 fi
 fi
 
@@ -1745,28 +1760,28 @@ AC_CACHE_CHECK([for working mmap],samba_cv_HAVE_MMAP,[
 AC_TRY_RUN([#include "${srcdir-.}/tests/shared_mmap.c"],
            samba_cv_HAVE_MMAP=yes,samba_cv_HAVE_MMAP=no,samba_cv_HAVE_MMAP=cross)])
 if test x"$samba_cv_HAVE_MMAP" = x"yes"; then
-    AC_DEFINE(HAVE_MMAP)
+    AC_DEFINE(HAVE_MMAP,1,[Whether mmap works])
 fi
 
 AC_CACHE_CHECK([for ftruncate needs root],samba_cv_FTRUNCATE_NEEDS_ROOT,[
 AC_TRY_RUN([#include "${srcdir-.}/tests/ftruncroot.c"],
            samba_cv_FTRUNCATE_NEEDS_ROOT=yes,samba_cv_FTRUNCATE_NEEDS_ROOT=no,samba_cv_FTRUNCATE_NEEDS_ROOT=cross)])
 if test x"$samba_cv_FTRUNCATE_NEEDS_ROOT" = x"yes"; then
-    AC_DEFINE(FTRUNCATE_NEEDS_ROOT)
+    AC_DEFINE(FTRUNCATE_NEEDS_ROOT,1,[Whether ftruncate() needs root])
 fi
 
 AC_CACHE_CHECK([for fcntl locking],samba_cv_HAVE_FCNTL_LOCK,[
 AC_TRY_RUN([#include "${srcdir-.}/tests/fcntl_lock.c"],
            samba_cv_HAVE_FCNTL_LOCK=yes,samba_cv_HAVE_FCNTL_LOCK=no,samba_cv_HAVE_FCNTL_LOCK=cross)])
 if test x"$samba_cv_HAVE_FCNTL_LOCK" = x"yes"; then
-    AC_DEFINE(HAVE_FCNTL_LOCK)
+    AC_DEFINE(HAVE_FCNTL_LOCK,1,[Whether fcntl locking is available])
 fi
 
 AC_CACHE_CHECK([for broken (glibc2.1/x86) 64 bit fcntl locking],samba_cv_HAVE_BROKEN_FCNTL64_LOCKS,[
 AC_TRY_RUN([#include "${srcdir-.}/tests/fcntl_lock64.c"],
            samba_cv_HAVE_BROKEN_FCNTL64_LOCKS=yes,samba_cv_HAVE_BROKEN_FCNTL64_LOCKS=no,samba_cv_HAVE_BROKEN_FCNTL64_LOCKS=cross)])
 if test x"$samba_cv_HAVE_BROKEN_FCNTL64_LOCKS" = x"yes"; then
-    AC_DEFINE(HAVE_BROKEN_FCNTL64_LOCKS)
+    AC_DEFINE(HAVE_BROKEN_FCNTL64_LOCKS,1,[Whether fcntl64 locks are broken])
 
 else
 
@@ -1800,7 +1815,7 @@ exit(1);
        samba_cv_HAVE_STRUCT_FLOCK64=yes,samba_cv_HAVE_STRUCT_FLOCK64=no,samba_cv_HAVE_STRUCT_FLOCK64=cross)])
 
   if test x"$samba_cv_HAVE_STRUCT_FLOCK64" = x"yes"; then
-      AC_DEFINE(HAVE_STRUCT_FLOCK64)
+      AC_DEFINE(HAVE_STRUCT_FLOCK64,1,[Whether the flock64 struct is available])
   fi
 fi
 
@@ -1811,9 +1826,19 @@ AC_TRY_COMPILE([#include <sys/types.h>
 [struct stat st;  st.st_blocks = 0;],
 samba_cv_HAVE_STAT_ST_BLOCKS=yes,samba_cv_HAVE_STAT_ST_BLOCKS=no,samba_cv_HAVE_STAT_ST_BLOCKS=cross)])
 if test x"$samba_cv_HAVE_STAT_ST_BLOCKS" = x"yes"; then
-    AC_DEFINE(HAVE_STAT_ST_BLOCKS)
+    AC_DEFINE(HAVE_STAT_ST_BLOCKS,1,[Whether the stat struct has a st_block property])
 fi 
 
+AC_CACHE_CHECK([for st_blksize in struct stat],samba_cv_HAVE_STAT_ST_BLKSIZE,[
+AC_TRY_COMPILE([#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>],
+[struct stat st;  st.st_blksize = 0;],
+samba_cv_HAVE_STAT_ST_BLKSIZE=yes,samba_cv_HAVE_STAT_ST_BLKSIZE=no,samba_cv_HAVE_STAT_ST_BLKSIZE=cross)])
+if test x"$samba_cv_HAVE_STAT_ST_BLKSIZE" = x"yes"; then
+    AC_DEFINE(HAVE_STAT_ST_BLKSIZE,1,[Whether the stat struct has a st_blksize property])
+fi
+
 case "$host_os" in
 *linux*)
 AC_CACHE_CHECK([for broken RedHat 7.2 system header files],samba_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS,[
@@ -1827,7 +1852,7 @@ AC_TRY_COMPILE([
 ],[int i;],
    samba_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS=no,samba_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS=yes)])
 if test x"$samba_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS" = x"yes"; then
-   AC_DEFINE(BROKEN_REDHAT_7_SYSTEM_HEADERS)
+   AC_DEFINE(BROKEN_REDHAT_7_SYSTEM_HEADERS,1,[Broken RedHat 7.2 system header files])
 fi
 ;;
 esac
@@ -1840,7 +1865,7 @@ AC_TRY_COMPILE([#include <sys/acl.h>
 [int i;],
 samba_cv_BROKEN_NISPLUS_INCLUDE_FILES=no,samba_cv_BROKEN_NISPLUS_INCLUDE_FILES=yes)])
 if test x"$samba_cv_BROKEN_NISPLUS_INCLUDE_FILES" = x"yes"; then
-    AC_DEFINE(BROKEN_NISPLUS_INCLUDE_FILES)
+       AC_DEFINE(BROKEN_NISPLUS_INCLUDE_FILES,1,[Whether the nisplus include files are broken])
 fi
 
 
@@ -1852,8 +1877,9 @@ AC_ARG_WITH(smbwrapper,
 [ case "$withval" in
   yes)
     AC_MSG_RESULT(yes)
-    AC_DEFINE(WITH_SMBWRAPPER)
-       WRAP="bin/smbsh bin/smbwrapper.$SHLIBEXT"
+    AC_DEFINE(WITH_SMBWRAPPER,1,[Whether to include smbwrapper support])
+       WRAPPROG="bin/smbsh"
+       WRAP="bin/smbwrapper.$SHLIBEXT"
 
        if test x$ATTEMPT_WRAP32_BUILD = x; then
                WRAP32=""
@@ -1865,10 +1891,12 @@ AC_ARG_WITH(smbwrapper,
 
        if test x$PICFLAG = x; then
           echo No support for PIC code - disabling smbwrapper and smbsh
+          WRAPPROG=""
           WRAP=""
           WRAP32=""
        elif test x$ac_cv_func_syscall = xno; then
           AC_MSG_RESULT([No syscall() -- disabling smbwrapper and smbsh])
+          WRAPPROG=""
           WRAP=""
           WRAP32=""
        fi
@@ -1888,7 +1916,7 @@ AC_ARG_WITH(afs,
 [ case "$withval" in
   yes)
     AC_MSG_RESULT(yes)
-    AC_DEFINE(WITH_AFS)
+    AC_DEFINE(WITH_AFS,1,[Whether to include AFS clear-text auth support])
     ;;
   *)
     AC_MSG_RESULT(no)
@@ -1906,7 +1934,7 @@ AC_ARG_WITH(dfs,
 [ case "$withval" in
   yes)
     AC_MSG_RESULT(yes)
-    AC_DEFINE(WITH_DFS)
+    AC_DEFINE(WITH_DFS,1,[Whether to include DFS support])
     ;;
   *)
     AC_MSG_RESULT(no)
@@ -1915,7 +1943,66 @@ 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 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)
+  )
+
+
+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
+    CFLAGS="$CFLAGS -I/usr/include/heimdal"
+    CPPFLAGS="$CPPFLAGS -I/usr/include/heimdal"
+    AC_MSG_RESULT(yes)
+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)
@@ -1927,64 +2014,88 @@ if test -d /usr/kerberos; then
 else
     AC_MSG_RESULT(no)
 fi
+fi
 
-#################################################
-# 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"
-    ;;
-  esac ],
-  AC_MSG_RESULT(no)
-)
 
-# 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 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/gssapi_generic.h gssapi/gssapi.h)
+  # now check for gssapi headers.  This is also done here to allow for
+  # different kerberos include paths
+  AC_CHECK_HEADERS(gssapi/gssapi_generic.h gssapi/gssapi.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"])
+  ##################################################################
+  # 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"])
 
-########################################################
-# 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)])
+  ########################################################
+  # 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
 
 ########################################################
-# 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)])
+# Compile with LDAP support?
 
-##################################################################
-# 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"])
+with_ldap_support=yes
+AC_MSG_CHECKING([whether to use LDAP])
 
-########################################################
-# 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)])
+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_PDB_MYSQL=bin/pdb_mysql.so],[MODULE_PDB_MYSQL=])
+CFLAGS="$CFLAGS $MYSQL_CFLAGS"
+AC_SUBST(MODULE_PDB_MYSQL)
+
+########################################################
+# Compile with XML support?
+AM_PATH_XML2([2.0.0],[MODULE_PDB_XML=bin/pdb_xml.so],[MODULE_PDB_XML=])
+CFLAGS="$CFLAGS $XML_CFLAGS"
+AC_SUBST(MODULE_PDB_XML)
+
 #################################################
 # check for automount support
 AC_MSG_CHECKING(whether to use AUTOMOUNT)
@@ -1993,7 +2104,7 @@ AC_ARG_WITH(automount,
 [ case "$withval" in
   yes)
     AC_MSG_RESULT(yes)
-    AC_DEFINE(WITH_AUTOMOUNT)
+    AC_DEFINE(WITH_AUTOMOUNT,1,[Whether to include automount support])
     ;;
   *)
     AC_MSG_RESULT(no)
@@ -2012,7 +2123,7 @@ AC_ARG_WITH(smbmount,
        case "$host_os" in
        *linux*)
                AC_MSG_RESULT(yes)
-               AC_DEFINE(WITH_SMBMOUNT)
+               AC_DEFINE(WITH_SMBMOUNT,1,[Whether to build smbmount])
                MPROGS="bin/smbmount bin/smbmnt bin/smbumount"
                ;;
        *)
@@ -2039,8 +2150,8 @@ AC_ARG_WITH(pam,
 [ case "$withval" in
   yes)
     AC_MSG_RESULT(yes)
-    AC_DEFINE(WITH_PAM)
-    LIBS="$LIBS -lpam"
+    AC_DEFINE(WITH_PAM,1,[Whether to include PAM support])
+    AUTHLIBS="$AUTHLIBS -lpam"
     with_pam_for_crypt=yes
     ;;
   *)
@@ -2051,7 +2162,7 @@ AC_ARG_WITH(pam,
 )
 
 # we can't build a pam module if we don't have pam.
-AC_CHECK_LIB(pam, pam_get_data, [AC_DEFINE(HAVE_LIBPAM)])
+AC_CHECK_LIB(pam, pam_get_data, [AC_DEFINE(HAVE_LIBPAM,1,[Whether libpam is available])])
 
 #################################################
 # check for pam_smbpass support
@@ -2085,11 +2196,11 @@ AC_ARG_WITH(pam_smbpass,
 ###############################################
 # test for where we get crypt() from, but only
 # if not using PAM
-if test $with_pam_for_crypt = no; then
+if test x"$with_pam_for_crypt" = x"no"; then
 AC_CHECK_FUNCS(crypt)
 if test x"$ac_cv_func_crypt" = x"no"; then
-    AC_CHECK_LIB(crypt, crypt, [LIBS="$LIBS -lcrypt";
-       AC_DEFINE(HAVE_CRYPT)])
+    AC_CHECK_LIB(crypt, crypt, [AUTHLIBS="$AUTHLIBS -lcrypt";
+       AC_DEFINE(HAVE_CRYPT,1,[Whether crypt() is available])])
 fi
 fi
 
@@ -2101,13 +2212,32 @@ fi
 ##
 if test $with_pam_for_crypt = no; then
 AC_CACHE_CHECK([for a crypt that needs truncated salt],samba_cv_HAVE_TRUNCATED_SALT,[
+crypt_LIBS="$LIBS"
+LIBS="$AUTHLIBS $LIBS"
 AC_TRY_RUN([#include "${srcdir-.}/tests/crypttest.c"],
-       samba_cv_HAVE_TRUNCATED_SALT=no,samba_cv_HAVE_TRUNCATED_SALT=yes,samba_cv_HAVE_TRUNCATED_SALT=cross)])
+       samba_cv_HAVE_TRUNCATED_SALT=no,samba_cv_HAVE_TRUNCATED_SALT=yes,samba_cv_HAVE_TRUNCATED_SALT=cross)
+LIBS="$crypt_LIBS"])
 if test x"$samba_cv_HAVE_TRUNCATED_SALT" = x"yes"; then
-       AC_DEFINE(HAVE_TRUNCATED_SALT)
+       AC_DEFINE(HAVE_TRUNCATED_SALT,1,[Whether crypt needs truncated salt])
 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)
+)
 
 
 ########################################################################################
@@ -2117,14 +2247,14 @@ fi
 ########################################################################################
 
 #################################################
-# 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 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)],
 [ case "$withval" in
   yes)
     AC_MSG_RESULT(yes)
-    AC_DEFINE(WITH_TDB_SAM)
+    AC_DEFINE(WITH_LDAP_SAMCONFIG,1,[Whether to include 2.2 compatibel LDAP SAM configuration])
     ;;
   *)
     AC_MSG_RESULT(no)
@@ -2134,15 +2264,14 @@ AC_ARG_WITH(tdbsam,
 )
 
 #################################################
-# check for a LDAP password database
-AC_MSG_CHECKING(whether to use LDAP SAM database)
-AC_ARG_WITH(ldapsam,
-[  --with-ldapsam          Include experimental LDAP SAM support (default=no)],
+# 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)],
 [ case "$withval" in
   yes)
     AC_MSG_RESULT(yes)
-    AC_DEFINE(WITH_LDAP_SAM)
-    LIBS="-lldap -llber $LIBS"
+    AC_DEFINE(WITH_TDB_SAM,1,[Whether to include experimental TDB SAM support])
     ;;
   *)
     AC_MSG_RESULT(no)
@@ -2159,7 +2288,7 @@ AC_ARG_WITH(nisplussam,
 [ case "$withval" in
   yes)
     AC_MSG_RESULT(yes)
-    AC_DEFINE(WITH_NISPLUS_SAM)
+    AC_DEFINE(WITH_NISPLUS_SAM,1,[Whether to include nisplus SAM support])
     ;;
   *)
     AC_MSG_RESULT(no)
@@ -2182,75 +2311,7 @@ AC_ARG_WITH(nisplus-home,
 [ case "$withval" in
   yes)
     AC_MSG_RESULT(yes)
-    AC_DEFINE(WITH_NISPLUS_HOME)
-    ;;
-  *)
-    AC_MSG_RESULT(no)
-    ;;
-  esac ],
-  AC_MSG_RESULT(no)
-)
-
-#################################################
-# check for the secure socket layer
-AC_MSG_CHECKING(whether to use SSL)
-AC_ARG_WITH(ssl,
-[  --with-ssl              Include SSL support (default=no)
-  --with-sslinc=DIR          Where the SSL includes are (defaults to /usr/local/ssl/include)
-  --with-ssllib=DIR          Where the SSL libraries are (defaults to /usr/local/ssl/lib)],
-[ case "$withval" in
-  yes)
-    AC_MSG_RESULT(yes)
-    AC_DEFINE(WITH_SSL)
-    withval="/usr/local/ssl"     # default
-
-    if test "${with_sslinc+set}" = set; then
-
-       withval="$with_sslinc"
-       case "$withval" in
-       yes|no)
-         echo "configure: warning: --with-sslinc called without argument - will use default" 1>&w
-         CFLAGS="-I/usr/local/ssl/include $CFLAGS"
-       ;;
-        * )
-          CFLAGS="-I${withval} $CFLAGS"
-       ;;
-       esac
-
-    else
-
-       CFLAGS="-I/usr/local/ssl/include $CFLAGS"   
-
-    fi
-
-    if test "${with_ssllib+set}" = set; then
-
-       withval="$with_ssllib"
-       case "$withval" in
-       yes|no)
-         echo "configure: warning: --with-ssllib called without argument - will use default" 1>&w
-         LDFLAGS="-L/usr/local/ssl/lib $LDFLAGS"
-       ;;
-        * )
-         LDFLAGS="-L${withval}/lib $LDFLAGS"
-       ;;
-       esac
-
-    else
-
-       LDFLAGS="-L/usr/local/ssl/lib $LDFLAGS"
-
-    fi
-
-    LIBS="-lssl -lcrypto $LIBS"
-
-#    if test ! -d ${withval}; then
-#      echo "configure: error: called with --with-ssl, but ssl base directory ${withval} does not exist or is not a directory. Aborting config" 1>&2
-#      exit 1
-#    fi 
-
-    CFLAGS="-DHAVE_CRYPT_DECL $CFLAGS"  # Damn, SSLeay defines its own
-
+    AC_DEFINE(WITH_NISPLUS_HOME,1,[Whether to include nisplus_home support])
     ;;
   *)
     AC_MSG_RESULT(no)
@@ -2267,7 +2328,7 @@ AC_ARG_WITH(syslog,
 [ case "$withval" in
   yes)
     AC_MSG_RESULT(yes)
-    AC_DEFINE(WITH_SYSLOG)
+    AC_DEFINE(WITH_SYSLOG,1,[Whether to include experimental syslog support])
     ;;
   *)
     AC_MSG_RESULT(no)
@@ -2284,7 +2345,7 @@ AC_ARG_WITH(profiling-data,
 [ case "$withval" in
   yes)
     AC_MSG_RESULT(yes)
-    AC_DEFINE(WITH_PROFILE)
+    AC_DEFINE(WITH_PROFILE,1,[Whether to use profiling])
     ;;
   *)
     AC_MSG_RESULT(no)
@@ -2316,16 +2377,16 @@ AC_ARG_WITH(quotas,
 #include <linux/unistd.h>],[struct mem_dqblk D;],
       samba_cv_linux_2_4_quota_braindamage=yes,samba_cv_linux_2_4_quota_braindamage=no)])
 if test x"$samba_cv_linux_2_4_quota_braindamage" = x"yes"; then
-        AC_DEFINE(LINUX_QUOTAS_2)
+        AC_DEFINE(LINUX_QUOTAS_2,1,[linux 2.4.x quota braindamage])
 else
-        AC_DEFINE(LINUX_QUOTAS_1)
+        AC_DEFINE(LINUX_QUOTAS_1,1,[linux quotas])
 fi
         ;;
       *)
         ;;
     esac
     QUOTAOBJS=smbd/quotas.o
-    AC_DEFINE(WITH_QUOTAS)
+    AC_DEFINE(WITH_QUOTAS,1,[Whether to include experimental quota support])
     ;;
   *)
     AC_MSG_RESULT(no)
@@ -2344,7 +2405,7 @@ AC_ARG_WITH(utmp,
 [ case "$withval" in
   yes)
     AC_MSG_RESULT(yes)
-    AC_DEFINE(WITH_UTMP)
+    AC_DEFINE(WITH_UTMP,1,[Whether to include experimental utmp accounting])
     ;;
   *)
     AC_MSG_RESULT(no)
@@ -2353,69 +2414,6 @@ AC_ARG_WITH(utmp,
   AC_MSG_RESULT(no)
 )
 
-#################################################
-# set private directory location
-AC_ARG_WITH(privatedir,
-[  --with-privatedir=DIR   Where to put smbpasswd ($ac_default_prefix/private)],
-[ case "$withval" in
-  yes|no)
-  #
-  # Just in case anybody calls it without argument
-  #
-    AC_MSG_WARN([--with-privatedir called without argument - will use default])
-    privatedir='${prefix}/private'
-  ;;
-  * )
-    privatedir="$withval"
-    ;;
-  esac
-  AC_SUBST(privatedir)],
-  [privatedir='${prefix}/private'
-   AC_SUBST(privatedir)]
-)
-
-#################################################
-# set lock directory location
-AC_ARG_WITH(lockdir,
-[  --with-lockdir=DIR      Where to put lock files ($ac_default_prefix/var/locks)],
-[ case "$withval" in
-  yes|no)
-  #
-  # Just in case anybody calls it without argument
-  #
-    AC_MSG_WARN([--with-lockdir called without argument - will use default])
-    lockdir='$(VARDIR)/locks'
-  ;;
-  * )
-    lockdir="$withval"
-    ;;
-  esac
-  AC_SUBST(lockdir)],
-  [lockdir='$(VARDIR)/locks'
-   AC_SUBST(lockdir)]
-)
-
-#################################################
-# 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='${prefix}/swat'
-  ;;
-  * )
-    swatdir="$withval"
-    ;;
-  esac
-  AC_SUBST(swatdir)],
-  [swatdir='${prefix}/swat'
-   AC_SUBST(swatdir)]
-)
-
 #################################################
 # choose native language(s) of man pages
 AC_MSG_CHECKING(chosen man pages' language(s))
@@ -2432,7 +2430,7 @@ AC_ARG_WITH(manpages-langs,
   esac
 
   AC_MSG_RESULT($manlangs)
-  manlangs=`echo $manlangs | sed "s/,/ /"`   # replacing commas with spaces to produce a list
+  manlangs=`echo $manlangs | sed "s/,/ /g"`   # replacing commas with spaces to produce a list
   AC_SUBST(manlangs)],
 
   [manlangs="en"
@@ -2440,6 +2438,32 @@ AC_ARG_WITH(manpages-langs,
   AC_SUBST(manlangs)]
 )
 
+#################################################
+# should we build libsmbclient?
+
+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)],
+[ case "$withval" in
+  no) 
+     AC_MSG_RESULT(no)
+     ;;
+  *)
+     if test $BLDSHARED = true; then
+        LIBSMBCLIENT_SHARED=bin/libsmbclient.$SHLIBEXT
+        LIBSMBCLIENT=libsmbclient
+        AC_MSG_RESULT(yes)
+     else
+        AC_MSG_RESULT(no shared library support)
+     fi
+     ;;
+  esac ],
+  AC_MSG_RESULT(yes)
+)
+
+
 #################################################
 # these tests are taken from the GNU fileutils package
 AC_CHECKING(how to get filesystem space usage)
@@ -2465,7 +2489,7 @@ if test $space = no; then
   fu_cv_sys_stat_statvfs64=cross)])
   if test $fu_cv_sys_stat_statvfs64 = yes; then
     space=yes
-    AC_DEFINE(STAT_STATVFS64)
+    AC_DEFINE(STAT_STATVFS64,1,[Whether statvfs64() is available])
   fi
 fi
 
@@ -2485,7 +2509,7 @@ if test $space = no; then
                              fu_cv_sys_stat_statvfs=no)])
   if test $fu_cv_sys_stat_statvfs = yes; then
     space=yes
-    AC_DEFINE(STAT_STATVFS)
+    AC_DEFINE(STAT_STATVFS,1,[Whether statvfs() is available])
   fi
 fi
 
@@ -2509,7 +2533,7 @@ if test $space = no; then
   AC_MSG_RESULT($fu_cv_sys_stat_statfs3_osf1)
   if test $fu_cv_sys_stat_statfs3_osf1 = yes; then
     space=yes
-    AC_DEFINE(STAT_STATFS3_OSF1)
+    AC_DEFINE(STAT_STATFS3_OSF1,1,[Whether statfs requires 3 arguments])
   fi
 fi
 
@@ -2540,7 +2564,7 @@ member (AIX, 4.3BSD)])
   AC_MSG_RESULT($fu_cv_sys_stat_statfs2_bsize)
   if test $fu_cv_sys_stat_statfs2_bsize = yes; then
     space=yes
-    AC_DEFINE(STAT_STATFS2_BSIZE)
+    AC_DEFINE(STAT_STATFS2_BSIZE,1,[Whether statfs requires two arguments and struct statfs has bsize property])
   fi
 fi
 
@@ -2561,7 +2585,7 @@ if test $space = no; then
   AC_MSG_RESULT($fu_cv_sys_stat_statfs4)
   if test $fu_cv_sys_stat_statfs4 = yes; then
     space=yes
-    AC_DEFINE(STAT_STATFS4)
+    AC_DEFINE(STAT_STATFS4,1,[Whether statfs requires 4 arguments])
   fi
 fi
 
@@ -2589,7 +2613,7 @@ member (4.4BSD and NetBSD)])
   AC_MSG_RESULT($fu_cv_sys_stat_statfs2_fsize)
   if test $fu_cv_sys_stat_statfs2_fsize = yes; then
     space=yes
-    AC_DEFINE(STAT_STATFS2_FSIZE)
+       AC_DEFINE(STAT_STATFS2_FSIZE,1,[Whether statfs requires 2 arguments and struct statfs has fsize])
   fi
 fi
 
@@ -2620,7 +2644,7 @@ if test $space = no; then
   AC_MSG_RESULT($fu_cv_sys_stat_fs_data)
   if test $fu_cv_sys_stat_fs_data = yes; then
     space=yes
-    AC_DEFINE(STAT_STATFS2_FS_DATA)
+    AC_DEFINE(STAT_STATFS2_FS_DATA,1,[Whether statfs requires 2 arguments and struct fs_data is available])
   fi
 fi
 
@@ -2643,30 +2667,30 @@ __COMPILE_ERROR_
 [int i],
 samba_cv_HAVE_EXPLICIT_LARGEFILE_SUPPORT=yes,samba_cv_HAVE_EXPLICIT_LARGEFILE_SUPPORT=no)
 if test x"$samba_cv_HAVE_EXPLICIT_LARGEFILE_SUPPORT" = x"yes"; then
-    AC_DEFINE(HAVE_EXPLICIT_LARGEFILE_SUPPORT)
+       AC_DEFINE(HAVE_EXPLICIT_LARGEFILE_SUPPORT,1,[Whether large file support can be enabled])
 fi
 AC_MSG_RESULT([$samba_cv_HAVE_EXPLICIT_LARGEFILE_SUPPORT])
 
 AC_ARG_WITH(spinlocks, 
 [  --with-spinlocks        Use spin locks instead of fcntl locks (default=no) ])
 if test "x$with_spinlocks" = "xyes"; then
-    AC_DEFINE(USE_SPINLOCKS)
+    AC_DEFINE(USE_SPINLOCKS,1,[Whether to use spin locks instead of fcntl locks])
 
     case "$host_cpu" in
         sparc)
-            AC_DEFINE(SPARC_SPINLOCKS)
+            AC_DEFINE(SPARC_SPINLOCKS,1,[Whether to use sparc spinlocks])
             ;;
 
         i386|i486|i586|i686)
-            AC_DEFINE(INTEL_SPINLOCKS)
+            AC_DEFINE(INTEL_SPINLOCKS,1,[Whether to use intel spinlocks])
             ;;
 
         mips)
-            AC_DEFINE(MIPS_SPINLOCKS)
+            AC_DEFINE(MIPS_SPINLOCKS,1,[Whether to use mips spinlocks])
             ;;
 
         powerpc)
-            AC_DEFINE(POWERPC_SPINLOCKS)
+            AC_DEFINE(POWERPC_SPINLOCKS,1,[Whether to use powerpc spinlocks])
             ;;
     esac
 fi
@@ -2683,27 +2707,27 @@ AC_ARG_WITH(acl-support,
        case "$host_os" in
        *sysv5*)
                AC_MSG_RESULT(Using UnixWare ACLs)
-               AC_DEFINE(HAVE_UNIXWARE_ACLS)
+               AC_DEFINE(HAVE_UNIXWARE_ACLS,1,[Whether UnixWare ACLs are available])
                ;;
        *solaris*)
                AC_MSG_RESULT(Using solaris ACLs)
-               AC_DEFINE(HAVE_SOLARIS_ACLS)
+               AC_DEFINE(HAVE_SOLARIS_ACLS,1,[Whether solaris ACLs are available])
                ;;
        *hpux*)
                AC_MSG_RESULT(Using HPUX ACLs)
-               AC_DEFINE(HAVE_HPUX_ACLS)
+               AC_DEFINE(HAVE_HPUX_ACLS,1,[Whether HPUX ACLs are available])
                ;;
        *irix*)
                AC_MSG_RESULT(Using IRIX ACLs)
-               AC_DEFINE(HAVE_IRIX_ACLS)
+               AC_DEFINE(HAVE_IRIX_ACLS,1,[Whether IRIX ACLs are available])
                ;;
        *aix*)
                AC_MSG_RESULT(Using AIX ACLs)
-               AC_DEFINE(HAVE_AIX_ACLS)
+               AC_DEFINE(HAVE_AIX_ACLS,1,[Whether AIX ACLs are available])
                ;;
        *osf*)
                AC_MSG_RESULT(Using Tru64 ACLs)
-               AC_DEFINE(HAVE_TRU64_ACLS)
+               AC_DEFINE(HAVE_TRU64_ACLS,1,[Whether Tru64 ACLs are available])
                LIBS="$LIBS -lpacl"
                ;;
         *)
@@ -2715,14 +2739,14 @@ AC_ARG_WITH(acl-support,
 samba_cv_HAVE_POSIX_ACLS=yes,samba_cv_HAVE_POSIX_ACLS=no)])
                        if test x"$samba_cv_HAVE_POSIX_ACLS" = x"yes"; then
                                AC_MSG_RESULT(Using posix ACLs)
-                               AC_DEFINE(HAVE_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,[
                                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)])
                                if test x"$samba_cv_HAVE_ACL_GET_PERM_NP" = x"yes"; then
-                                       AC_DEFINE(HAVE_ACL_GET_PERM_NP)
+                                       AC_DEFINE(HAVE_ACL_GET_PERM_NP,1,[Whether acl_get_perm_np() is available])
                                fi
                        fi
             ;;
@@ -2730,13 +2754,241 @@ samba_cv_HAVE_ACL_GET_PERM_NP=yes,samba_cv_HAVE_ACL_GET_PERM_NP=no)])
         ;;
   *)
     AC_MSG_RESULT(no)
-    AC_DEFINE(HAVE_NO_ACLS)
+    AC_DEFINE(HAVE_NO_ACLS,1,[Whether no ACLs support is available])
     ;;
   esac ],
-  AC_DEFINE(HAVE_NO_ACLS)
+  AC_DEFINE(HAVE_NO_ACLS,1,[Whether no ACLs support should be built in])
   AC_MSG_RESULT(no)
 )
 
+#################################################
+# check for sendfile support
+
+with_sendfile_support=yes
+AC_MSG_CHECKING(whether to check to support sendfile)
+AC_ARG_WITH(sendfile-support,
+[  --with-sendfile-support      Check for sendfile support (default=yes)],
+[ case "$withval" in
+  yes)
+
+       AC_MSG_RESULT(yes);
+
+       case "$host_os" in
+       *linux*)
+               AC_CACHE_CHECK([for linux sendfile64 support],samba_cv_HAVE_SENDFILE64,[
+               AC_TRY_LINK([#include <sys/sendfile.h>],
+[\
+int tofd, fromfd;
+off64_t offset;
+size_t total;
+ssize_t nwritten = sendfile64(tofd, fromfd, &offset, total);
+],
+samba_cv_HAVE_SENDFILE64=yes,samba_cv_HAVE_SENDFILE64=no)])
+
+               AC_CACHE_CHECK([for linux sendfile support],samba_cv_HAVE_SENDFILE,[
+               AC_TRY_LINK([#include <sys/sendfile.h>],
+[\
+int tofd, fromfd;
+off_t offset;
+size_t total;
+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_SENDFILE64" = x"yes"; then
+               AC_DEFINE(HAVE_SENDFILE64,1,[Whether 64-bit 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_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
+
+       ;;
+       *freebsd*)
+               AC_CACHE_CHECK([for freebsd sendfile support],samba_cv_HAVE_SENDFILE,[
+               AC_TRY_LINK([\
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/uio.h>],
+[\
+       int fromfd, tofd;
+       off_t offset, nwritten;
+       struct sf_hdtr hdr;
+       struct iovec hdtrl;
+       hdr->headers = &hdtrl;
+       hdr->hdr_cnt = 1;
+       hdr->trailers = NULL;
+       hdr->trl_cnt = 0;
+       hdtrl.iov_base = NULL;
+       hdtrl.iov_len = 0;
+       int ret = sendfile(fromfd, tofd, offset, total, &hdr, &nwritten, 0);
+],
+samba_cv_HAVE_SENDFILE=yes,samba_cv_HAVE_SENDFILE=no)])
+
+       if test x"$samba_cv_HAVE_SENDFILE" = x"yes"; then
+               AC_DEFINE(HAVE_SENDFILE,1,[Whether sendfile() support is available])
+               AC_DEFINE(FREEBSD_SENDFILE_API,1,[Whether the FreeBSD sendfile() API is available])
+               AC_DEFINE(WITH_SENDFILE,1,[Whether sendfile() support should be included])
+       else
+               AC_MSG_RESULT(no);
+       fi
+       ;;
+
+       *hpux*)
+               AC_CACHE_CHECK([for hpux sendfile64 support],samba_cv_HAVE_SENDFILE64,[
+               AC_TRY_LINK([\
+#include <sys/socket.h>
+#include <sys/uio.h>],
+[\
+       int fromfd, tofd;
+       size_t total=0;
+       struct iovec hdtrl[2];
+       ssize_t nwritten;
+       off64_t offset;
+
+       hdtrl[0].iov_base = 0;
+       hdtrl[0].iov_len = 0;
+
+       nwritten = sendfile64(tofd, fromfd, offset, total, &hdtrl[0], 0);
+],
+samba_cv_HAVE_SENDFILE64=yes,samba_cv_HAVE_SENDFILE64=no)])
+       if test x"$samba_cv_HAVE_SENDFILE64" = x"yes"; then
+               AC_DEFINE(HAVE_SENDFILE64,1,[Whether sendfile64() is available])
+               AC_DEFINE(HPUX_SENDFILE_API,1,[Whether the hpux sendfile() API is available])
+               AC_DEFINE(WITH_SENDFILE,1,[Whether sendfile() support should be included])
+       else
+               AC_MSG_RESULT(no);
+       fi
+
+               AC_CACHE_CHECK([for hpux sendfile support],samba_cv_HAVE_SENDFILE,[
+               AC_TRY_LINK([\
+#include <sys/socket.h>
+#include <sys/uio.h>],
+[\
+       int fromfd, tofd;
+       size_t total=0;
+       struct iovec hdtrl[2];
+       ssize_t nwritten;
+       off_t offset;
+
+       hdtrl[0].iov_base = 0;
+       hdtrl[0].iov_len = 0;
+
+       nwritten = sendfile(tofd, fromfd, offset, total, &hdtrl[0], 0);
+],
+samba_cv_HAVE_SENDFILE=yes,samba_cv_HAVE_SENDFILE=no)])
+       if test x"$samba_cv_HAVE_SENDFILE" = x"yes"; then
+               AC_DEFINE(HAVE_SENDFILE,1,[Whether sendfile() is available])
+               AC_DEFINE(HPUX_SENDFILE_API,1,[Whether the hpux sendfile() API is available])
+               AC_DEFINE(WITH_SENDFILE,1,[Whether sendfile() support should be included])
+       else
+               AC_MSG_RESULT(no);
+       fi
+       ;;
+
+       *solaris*)
+               LIBS="$LIBS -lsendfile"
+               AC_CACHE_CHECK([for solaris sendfilev64 support],samba_cv_HAVE_SENDFILEV64,[
+               AC_TRY_LINK([\
+#include <sys/sendfile.h>],
+[\
+        int sfvcnt;
+        size_t xferred;
+        struct sendfilevec vec[2];
+       ssize_t nwritten;
+       int tofd;
+
+       sfvcnt = 2;
+
+       vec[0].sfv_fd = SFV_FD_SELF;
+       vec[0].sfv_flag = 0;
+       vec[0].sfv_off = 0;
+       vec[0].sfv_len = 0;
+
+       vec[1].sfv_fd = 0;
+       vec[1].sfv_flag = 0;
+       vec[1].sfv_off = 0;
+       vec[1].sfv_len = 0;
+       nwritten = sendfilev64(tofd, vec, sfvcnt, &xferred);
+],
+samba_cv_HAVE_SENDFILEV64=yes,samba_cv_HAVE_SENDFILEV64=no)])
+
+       if test x"$samba_cv_HAVE_SENDFILEV64" = x"yes"; then
+               AC_DEFINE(HAVE_SENDFILEV64,1,[Whether sendfilev64() is available])
+               AC_DEFINE(SOLARIS_SENDFILE_API,1,[Whether the soloris sendfile() API is available])
+               AC_DEFINE(WITH_SENDFILE,1,[Whether sendfile() support should be included])
+       else
+               AC_MSG_RESULT(no);
+       fi
+
+               AC_CACHE_CHECK([for solaris sendfilev support],samba_cv_HAVE_SENDFILEV,[
+               AC_TRY_LINK([\
+#include <sys/sendfile.h>],
+[\
+        int sfvcnt;
+        size_t xferred;
+        struct sendfilevec vec[2];
+       ssize_t nwritten;
+       int tofd;
+
+       sfvcnt = 2;
+
+       vec[0].sfv_fd = SFV_FD_SELF;
+       vec[0].sfv_flag = 0;
+       vec[0].sfv_off = 0;
+       vec[0].sfv_len = 0;
+
+       vec[1].sfv_fd = 0;
+       vec[1].sfv_flag = 0;
+       vec[1].sfv_off = 0;
+       vec[1].sfv_len = 0;
+       nwritten = sendfilev(tofd, vec, sfvcnt, &xferred);
+],
+samba_cv_HAVE_SENDFILEV=yes,samba_cv_HAVE_SENDFILEV=no)])
+
+       if test x"$samba_cv_HAVE_SENDFILEV" = x"yes"; then
+               AC_DEFINE(HAVE_SENDFILEV,1,[Whether sendfilev() is available])
+               AC_DEFINE(SOLARIS_SENDFILE_API,1,[Whether the solaris sendfile() API is available])
+               AC_DEFINE(WITH_SENDFILE,1,[Whether to include sendfile() support])
+       else
+               AC_MSG_RESULT(no);
+       fi
+       ;;
+
+       *)
+       ;;
+        esac
+        ;;
+  *)
+    AC_MSG_RESULT(no)
+    ;;
+  esac ],
+  AC_MSG_RESULT(yes)
+)
+
+
 #################################################
 # Check whether winbind is supported on this platform.  If so we need to
 # build and install client programs (WINBIND_TARGETS), sbin programs
@@ -2799,6 +3051,7 @@ WINBIND_PAM_PROGS=""
 
 if test x"$HAVE_WINBIND" = x"yes"; then
         AC_MSG_RESULT(yes)
+       AC_DEFINE(WITH_WINBIND,1,[Whether to build winbind])
 
        WINBIND_TARGETS="bin/wbinfo"
        WINBIND_STARGETS="bin/winbindd"
@@ -2812,6 +3065,7 @@ else
         AC_MSG_RESULT(no$winbind_no_reason)
 fi
 
+
 # Substitution time!
 
 AC_SUBST(WINBIND_TARGETS)
@@ -2834,7 +3088,7 @@ 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)
+   AC_DEFINE(HAVE_PASSWD_PW_COMMENT,1,[Whether struct passwd has pw_comment])
 fi
 
 #AC_CHECK_MEMBER(struct passwd.pw_age,
@@ -2845,7 +3099,7 @@ 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)
+   AC_DEFINE(HAVE_PASSWD_PW_AGE,1,[Whether struct passwd has pw_age])
 fi
 
 #################################################
@@ -2870,7 +3124,7 @@ fi
 
 AC_MSG_CHECKING(whether to use included popt)
 if test x"$INCLUDED_POPT" = x"yes"; then
-    AC_MSG_RESULT($srcdir/popt)
+    AC_MSG_RESULT(yes)
     BUILD_POPT='$(POPT_OBJS)'
     FLAGS1="-I$srcdir/popt"
 else
@@ -2880,6 +3134,26 @@ fi
 AC_SUBST(BUILD_POPT)
 AC_SUBST(FLAGS1)
 
+#################################################
+# Check if the user wants Python
+
+# 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(python,
+[  --with-python=PYTHONNAME  build Python libraries],
+[ case "${withval-python}" in
+  yes)
+       PYTHON=python
+       ;;
+  *)
+       PYTHON=${withval-python}
+       ;;
+  esac ])
+AC_SUBST(PYTHON)
+
 #################################################
 # do extra things if we are running insure
 
@@ -2899,7 +3173,10 @@ AC_TRY_RUN([#include "${srcdir-.}/tests/summary.c"],
 builddir=`pwd`
 AC_SUBST(builddir)
 
-AC_OUTPUT(include/stamp-h Makefile script/findsmb)
+# I added make files that are outside /source directory.
+# I know this is not a good solution, will work out a better
+# solution soon.                       --simo
+AC_OUTPUT(include/stamp-h Makefile script/findsmb ../examples/sam/Makefile)
 
 #################################################
 # Print very concise instructions on building/use