Better explanation message for dmalloc.
[ira/wip.git] / source3 / configure.in
index dab7ab4ab32ced78d8ac6536316c8c653e7e139f..e65654f3b62a7f105d0eec8e64815b7192ceec6e 100644 (file)
@@ -1,7 +1,7 @@
 dnl Process this file with autoconf to produce a configure script.
 AC_INIT(include/includes.h)
 AC_CONFIG_HEADER(include/config.h)
-# we want to be compatibe with older versions of Samba
+# we want to be compatible with older versions of Samba
 AC_PREFIX_DEFAULT(/usr/local/samba)
 
 dnl Unique-to-Samba variables we'll be playing with.
@@ -33,6 +33,16 @@ AC_ARG_ENABLE(developer, [  --enable-developer      turn on developer warnings a
        CFLAGS="${CFLAGS} -g -Wall -Wshadow -Wstrict-prototypes -Wpointer-arith -Wcast-qual -Wcast-align -DDEBUG_PASSWORD -DDEVELOPER"
     fi])
 
+AC_ARG_ENABLE(dmalloc, [  --enable-dmalloc          enable heap debugging [default=no]])
+
+if test "x$enable_dmalloc" = xyes
+then
+       AC_DEFINE(ENABLE_DMALLOC, 1, [Define to turn on dmalloc debugging])
+       AC_DEFINE(DMALLOC_FUNC_CHECK, 1, 
+                  [Define to check invariants around some common functions])
+       LIBS="$LIBS -ldmalloc"  
+fi
+
 dnl Checks for programs.
 AC_PROG_CC
 AC_PROG_INSTALL
@@ -98,6 +108,14 @@ case "$host_os" in
                                ;;
       esac
       ;;
+
+#
+# CRAY Unicos has broken const handling
+       *unicos*)
+         AC_MSG_RESULT([disabling const])
+         CPPFLAGS="$CPPFLAGS -Dconst="
+         ;;
+       
 #
 # AIX4.x doesn't even admit to having large
 # files *at all* unless the -D_LARGE_FILE or -D_LARGE_FILE_API flags are set.
@@ -249,7 +267,7 @@ AC_CHECK_HEADERS(sys/param.h ctype.h sys/wait.h sys/resource.h sys/ioctl.h sys/i
 AC_CHECK_HEADERS(sys/mman.h sys/filio.h sys/priv.h sys/shm.h string.h strings.h stdlib.h sys/socket.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)
+AC_CHECK_HEADERS(security/pam_modules.h security/_pam_macros.h ldap.h lber.h)
 
 #
 # HPUX has a bug in that including shadow.h causes a re-definition of MAXINT.
@@ -265,7 +283,7 @@ case "$host_os" in
        ;;
 esac
 AC_CHECK_HEADERS(shadow.h netinet/ip.h netinet/tcp.h netinet/in_systm.h netinet/in_ip.h)
-AC_CHECK_HEADERS(nss.h nss_common.h sys/security.h security/pam_appl.h security/pam_modules.h)
+AC_CHECK_HEADERS(nss.h nss_common.h ns_api.h sys/security.h security/pam_appl.h security/pam_modules.h)
 AC_CHECK_HEADERS(stropts.h poll.h)
 AC_CHECK_HEADERS(sys/capability.h syscall.h sys/syscall.h)
 AC_CHECK_HEADERS(sys/acl.h sys/cdefs.h glob.h)
@@ -276,6 +294,9 @@ AC_CHECK_HEADERS(utmp.h utmpx.h lastlog.h)
 # For quotas on Veritas VxFS filesystems
 AC_CHECK_HEADERS(sys/fs/vx_quota.h)
 
+# For quotas on Linux XFS filesystems
+AC_CHECK_HEADERS(linux/xqm.h)
+
 AC_CHECK_SIZEOF(int,cross)
 AC_CHECK_SIZEOF(long,cross)
 AC_CHECK_SIZEOF(short,cross)
@@ -483,6 +504,15 @@ AC_ARG_WITH(readline,
 AC_SUBST(TERMLIBS)
 AC_SUBST(TERMLDFLAGS)
 
+# The readline API changed slightly from readline3 to readline4, so
+# code will generate warnings on one of them unless we have a few
+# special cases.
+AC_CHECK_LIB(readline, rl_completion_matches,
+            [AC_DEFINE(HAVE_NEW_LIBREADLINE, 1, 
+                       [Do we have rl_completion_matches?])],
+            [],
+            [$TERMLIBS])
+
 # The following test taken from the cvs sources
 # If we can't find connect, try looking in -lsocket, -lnsl, and -linet.
 # The Irix 5 libc.so has connect and gethostbyname, but Irix 5 also has
@@ -534,7 +564,7 @@ else
 fi
 
 AC_CHECK_FUNCS(waitpid getcwd strdup strtoul strerror chown fchown chmod fchmod chroot)
-AC_CHECK_FUNCS(fstat strchr utime utimes getrlimit fsync bzero memset)
+AC_CHECK_FUNCS(fstat strchr utime utimes getrlimit fsync bzero memset strlcpy strlcat setpgid)
 AC_CHECK_FUNCS(memmove vsnprintf snprintf asprintf vasprintf setsid glob strpbrk pipe crypt16 getauthuid)
 AC_CHECK_FUNCS(strftime sigprocmask sigblock sigaction sigset innetgr setnetgrent getnetgrent endnetgrent)
 AC_CHECK_FUNCS(initgroups select poll rdchk getgrnam getgrent pathconf)
@@ -542,6 +572,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)
 # setbuffer is needed for smbtorture
 AC_CHECK_FUNCS(setbuffer)
 
@@ -649,7 +680,9 @@ PICFLAG=""
 PICSUFFIX="po"
 POBAD_CC="#"
 SHLIBEXT="so"
+# Assume non-shared by default and override below
 BLDSHARED="false"
+AC_MSG_CHECKING([ability to build shared libraries])
 
 # and these are for particular systems
 case "$host_os" in
@@ -660,7 +693,7 @@ case "$host_os" in
                ;;
                *solaris*) AC_DEFINE(SUNOS5)
                        BLDSHARED="true"
-                       LDSHFLAGS="-Wl,-h,\$@.so -G"
+                       LDSHFLAGS="-h \$@ -G"
                        if test "${ac_cv_prog_CC}" = "gcc"; then
                                PICFLAG="-fPIC"
                        else
@@ -737,6 +770,29 @@ case "$host_os" in
                        LDSHFLAGS="-G"
                        ;;
 esac
+AC_MSG_RESULT($BLDSHARED)
+AC_MSG_CHECKING([linker flags for shared libraries])
+AC_MSG_RESULT([$LDSHFLAGS])
+AC_MSG_CHECKING([compiler flags for position-independent code])
+AC_MSG_RESULT([$PICFLAGS])
+
+#######################################################
+# test whether building a shared library actually works
+if test $BLDSHARED = true; then
+AC_CACHE_CHECK([whether building shared libraries actually works], 
+               [ac_cv_shlib_works],[
+   ac_cv_shlib_works=no
+   # try building a trivial shared library
+   $CC $CPPFLAGS $CFLAGS $PICFLAG -c -o shlib.po ${srcdir-.}/tests/shlib.c &&
+     $CC $CPPFLAGS $CFLAGS $LDSHFLAGS -o shlib.so shlib.po &&
+     ac_cv_shlib_works=yes
+   rm -f shlib.so shlib.po
+])
+if test $ac_cv_shlib_works = no; then
+   BLDSHARED=false
+fi
+fi
+
 
 # this updates our target list if we can build shared libs
 if test $BLDSHARED = true; then
@@ -1493,12 +1549,31 @@ exit(1);
   fi
 fi
 
+
+case "$host_os" in
+*linux*)
+AC_CACHE_CHECK([for broken RedHat 7.2 system header files],samba_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS,[
+AC_TRY_COMPILE([
+#ifdef HAVE_SYS_VFS_H
+#include <sys/vfs.h>
+#endif
+#ifdef HAVE_SYS_CAPABILITY_H
+#include <sys/capability.h>
+#endif
+],[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)
+fi
+;;
+esac
+
 AC_CACHE_CHECK([for broken nisplus include files],samba_cv_BROKEN_NISPLUS_INCLUDE_FILES,[
 AC_TRY_COMPILE([#include <sys/acl.h>
 #if defined(HAVE_RPCSVC_NIS_H)
 #include <rpcsvc/nis.h>
 #endif],
-[return 0;],
+[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)
@@ -1542,10 +1617,10 @@ AC_ARG_WITH(smbwrapper,
 )
 
 #################################################
-# check for the AFS filesystem
-AC_MSG_CHECKING(whether to use AFS)
+# check for AFS clear-text auth support
+AC_MSG_CHECKING(whether to use AFS clear-text auth)
 AC_ARG_WITH(afs,
-[  --with-afs              Include AFS support (default=no) ],
+[  --with-afs              Include AFS clear-text auth support (default=no) ],
 [ case "$withval" in
   yes)
     AC_MSG_RESULT(yes)
@@ -1560,10 +1635,10 @@ AC_ARG_WITH(afs,
 
 
 #################################################
-# check for the DFS auth system
-AC_MSG_CHECKING(whether to use DFS auth)
+# check for the DFS clear-text auth system
+AC_MSG_CHECKING(whether to use DFS clear-text auth)
 AC_ARG_WITH(dfs,
-[  --with-dce-dfs          Include DCE/DFS support (default=no)],
+[  --with-dce-dfs          Include DCE/DFS clear-text auth support (default=no)],
 [ case "$withval" in
   yes)
     AC_MSG_RESULT(yes)
@@ -1576,61 +1651,78 @@ AC_ARG_WITH(dfs,
   AC_MSG_RESULT(no)
 )
 
+
 #################################################
-# check for Kerberos IV auth system
-AC_MSG_CHECKING(whether to use Kerberos IV)
-AC_ARG_WITH(krb4,
-[  --with-krb4=base-dir    Include Kerberos IV support (default=no)],
-[ case "$withval" in
-  yes)
+# see if this box has the RedHat location for kerberos
+AC_MSG_CHECKING(for /usr/kerberos)
+if test -d /usr/kerberos; then
+    LDFLAGS="$LDFLAGS -L/usr/kerberos/lib"
+    CFLAGS="$CFLAGS -I/usr/kerberos/include"
+    CPPFLAGS="$CPPFLAGS -I/usr/kerberos/include"
     AC_MSG_RESULT(yes)
-    AC_DEFINE(KRB4_AUTH)
-    LIBS="$LIBS -lkrb -ldes"
-    CFLAGS="$CFLAGS -I$withval/include"
-    LDFLAGS="$LDFLAGS -L$withval/lib"
-    AC_DEFINE_UNQUOTED(KRB4_DIR, ${withval})
-    ;;
-  *)
+else
     AC_MSG_RESULT(no)
-    ;;
-  esac ],
-  AC_MSG_RESULT(no)
-)
-
-
+fi
 
 #################################################
 # check for location of Kerberos 5 install
 AC_MSG_CHECKING(for kerberos 5 install path)
 AC_ARG_WITH(krb5,
-[  --with-krb5=base-dir    Include Kerberos 5 support (default=no)],
+[  --with-krb5=base-dir    Locate Kerberos 5 support (default=/usr)],
 [ case "$withval" in
   no)
     AC_MSG_RESULT(no)
     ;;
   *)
     AC_MSG_RESULT(yes)
-    AC_DEFINE(KRB5_AUTH)
-    LIBS="$LIBS -lkrb5 -lk5crypto -lcom_err"
+    LIBS="$LIBS -lkrb5"
     CFLAGS="$CFLAGS -I$withval/include"
+    CPPFLAGS="$CPPFLAGS -I$withval/include"
     LDFLAGS="$LDFLAGS -L$withval/lib"
-    AC_DEFINE(HAVE_KRB5)
-    AC_DEFINE_UNQUOTED(KRB5_DIR,${withval})
-    have_krb5=yes;
     ;;
   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 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"])
+AC_CHECK_LIB(gssapi_krb5, gss_display_status, [LIBS="$LIBS -lgssapi_krb5"])
+
 
 ########################################################
 # now see if we can find the krb5 libs in standard paths
-if test x$have_krb5 != xyes; then
-AC_CHECK_LIB(krb5, krb5_mk_req_extended, [LIBS="$LIBS -lkrb5 -lk5crypto -lcom_err";
+# or as specified above
+AC_CHECK_LIB(krb5, krb5_mk_req_extended, [LIBS="$LIBS -lkrb5";
        AC_DEFINE(HAVE_KRB5)])
-fi
+
+########################################################
+# now see if we can find the gssapi libs in standard paths
+AC_CHECK_LIB(gssapi_krb5, gss_display_status, [AC_DEFINE(HAVE_GSSAPI)])
 
 
+##################################################################
+# 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)])
+fi
+
 #################################################
 # check for automount support
 AC_MSG_CHECKING(whether to use AUTOMOUNT)
@@ -1677,11 +1769,11 @@ AC_ARG_WITH(smbmount,
 
 
 #################################################
-# check for a PAM password database
+# check for a PAM clear-text auth, accounts, password and session support
 with_pam_for_crypt=no
-AC_MSG_CHECKING(whether to use PAM password database)
+AC_MSG_CHECKING(whether to use PAM)
 AC_ARG_WITH(pam,
-[  --with-pam              Include PAM password database support (default=no)],
+[  --with-pam              Include PAM support (default=no)],
 [ case "$withval" in
   yes)
     AC_MSG_RESULT(yes)
@@ -2345,32 +2437,36 @@ AC_ARG_WITH(acl-support,
 [ case "$withval" in
   yes)
 
-        case "$host_os" in
-        *sysv5*)
-            AC_MSG_RESULT(Using UnixWare ACLs)
-            AC_DEFINE(HAVE_UNIXWARE_ACLS)
-            ;;
-        *solaris*)
-            AC_MSG_RESULT(Using solaris ACLs)
-            AC_DEFINE(HAVE_SOLARIS_ACLS)
-            ;;
-               *irix*)
-                       AC_MSG_RESULT(Using IRIX ACLs)
-                       AC_DEFINE(HAVE_IRIX_ACLS)
-                       ;;
-               *aix*)
-                       AC_MSG_RESULT(Using AIX ACLs)
-                       AC_DEFINE(HAVE_AIX_ACLS)
-                       ;;
-               *osf*)
-                       AC_MSG_RESULT(Using Tru64 ACLs)
-                       AC_DEFINE(HAVE_TRU64_ACLS)
-                       LIBS="$LIBS -lpacl"
-                       ;;
+       case "$host_os" in
+       *sysv5*)
+               AC_MSG_RESULT(Using UnixWare ACLs)
+               AC_DEFINE(HAVE_UNIXWARE_ACLS)
+               ;;
+       *solaris*)
+               AC_MSG_RESULT(Using solaris ACLs)
+               AC_DEFINE(HAVE_SOLARIS_ACLS)
+               ;;
+       *hpux*)
+               AC_MSG_RESULT(Using HPUX ACLs)
+               AC_DEFINE(HAVE_HPUX_ACLS)
+               ;;
+       *irix*)
+               AC_MSG_RESULT(Using IRIX ACLs)
+               AC_DEFINE(HAVE_IRIX_ACLS)
+               ;;
+       *aix*)
+               AC_MSG_RESULT(Using AIX ACLs)
+               AC_DEFINE(HAVE_AIX_ACLS)
+               ;;
+       *osf*)
+               AC_MSG_RESULT(Using Tru64 ACLs)
+               AC_DEFINE(HAVE_TRU64_ACLS)
+               LIBS="$LIBS -lpacl"
+               ;;
         *)
-                       AC_CHECK_LIB(acl,acl_get_file)
-                       AC_CACHE_CHECK([for ACL support],samba_cv_HAVE_POSIX_ACLS,[
-                       AC_TRY_LINK([#include <sys/types.h>
+               AC_CHECK_LIB(acl,acl_get_file)
+               AC_CACHE_CHECK([for ACL support],samba_cv_HAVE_POSIX_ACLS,[
+               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)])
@@ -2408,7 +2504,7 @@ AC_MSG_CHECKING(whether to build winbind)
 # Initially, the value of $host_os decides whether winbind is supported
 
 case "$host_os" in 
-        *linux*|*solaris*)
+        *linux*|*solaris*|*irix*)
                HAVE_WINBIND=yes
                 ;;
         *)
@@ -2444,25 +2540,25 @@ fi
 
 # Display test results
 
-if test x"$HAVE_WINBIND" = x"yes"; then
 
+WINBIND_TARGETS=""
+WINBIND_STARGETS=""
+WINBIND_LTARGETS=""
+WINBIND_PAM_PROGS=""
+
+if test x"$HAVE_WINBIND" = x"yes"; then
         AC_MSG_RESULT(yes)
 
-       WINBIND_TARGETS="\$(WINBIND_PROGS)"
-       WINBIND_STARGETS="\$(WINBIND_SPROGS)"
-       WINBIND_LTARGETS="\$(WINBIND_LPROGS)"
-       case "$with_pam" in
-               yes)
-                       WINBIND_PAM_PROGS="\$(WINBIND_PAM_PROGS)"
-               ;;
-       esac
+       WINBIND_TARGETS="bin/wbinfo"
+       WINBIND_STARGETS="bin/winbindd"
+        if test x"$BLDSHARED" = x"true"; then
+               WINBIND_LTARGETS="nsswitch/libnss_winbind.so"
+               if test x"$with_pam" = x"yes"; then
+                       WINBIND_PAM_TARGETS="nsswitch/pam_winbind.so"
+               fi
+       fi
 else
         AC_MSG_RESULT(no$winbind_no_reason)
-
-       WINBIND_TARGETS=""
-       WINBIND_STARGETS=""
-       WINBIND_LTARGETS=""
-       WINBIND_PAM_PROGS=""
 fi
 
 # Substitution time!
@@ -2470,7 +2566,39 @@ fi
 AC_SUBST(WINBIND_TARGETS)
 AC_SUBST(WINBIND_STARGETS)
 AC_SUBST(WINBIND_LTARGETS)
-AC_SUBST(WINBIND_PAM_PROGS)
+AC_SUBST(WINBIND_PAM_TARGETS)
+
+#################################################
+# Check to see if we should use the included popt 
+
+AC_ARG_WITH(included-popt,
+[  --with-included-popt    use bundled popt library, not from system],
+[ 
+  case "$withval" in
+       yes)
+               INCLUDED_POPT=yes
+               ;;
+        no)
+               INCLUDED_POPT=no
+                ;;
+  esac ],
+)
+if test x"$INCLUDED_POPT" != x"yes"; then
+    AC_CHECK_LIB(popt, poptGetContext,
+                INCLUDED_POPT=no, INCLUDED_POPT=yes)
+fi
+
+AC_MSG_CHECKING(whether to use included popt)
+if test x"$INCLUDED_POPT" = x"yes"; then
+    AC_MSG_RESULT($srcdir/popt)
+    BUILD_POPT='$(POPT_OBJS)'
+    FLAGS1="-I$srcdir/popt"
+else
+    AC_MSG_RESULT(no)
+    LIBS="$LIBS -lpopt"
+fi
+AC_SUBST(BUILD_POPT)
+AC_SUBST(FLAGS1)
 
 #################################################
 # final configure stuff
@@ -2484,3 +2612,11 @@ builddir=`pwd`
 AC_SUBST(builddir)
 
 AC_OUTPUT(include/stamp-h Makefile)
+
+#################################################
+# Print very concise instructions on building/use
+if test "x$enable_dmalloc" = xyes
+then
+       AC_MSG_RESULT([Note: The dmalloc debug library will be included.  To turn it on use])
+       AC_MSG_RESULT([      \$ eval \`dmalloc samba\`.])
+fi
\ No newline at end of file