Better explanation message for dmalloc.
[ira/wip.git] / source3 / configure.in
index a306c8c4798ef5108905dc356cc249d5efb5bb48..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 ldap.h sasl.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)
@@ -546,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 strlcpy strlcat)
+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)
@@ -554,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)
 
@@ -661,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
@@ -672,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
@@ -749,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
@@ -1645,10 +1689,15 @@ AC_ARG_WITH(krb5,
 # 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"])
 
 
 ########################################################
@@ -1657,6 +1706,10 @@ AC_CHECK_LIB(k5crypto, krb5_encrypt_data, [LIBS="$LIBS -lk5crypto"])
 AC_CHECK_LIB(krb5, krb5_mk_req_extended, [LIBS="$LIBS -lkrb5";
        AC_DEFINE(HAVE_KRB5)])
 
+########################################################
+# 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
@@ -1666,11 +1719,10 @@ 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_open, [LIBS="$LIBS -lldap";
+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)
@@ -2385,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)])
@@ -2448,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
                 ;;
         *)
@@ -2484,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!
@@ -2510,7 +2566,7 @@ 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 
@@ -2556,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