sync'ing up for 3.0alpha20 release
[samba.git] / source3 / configure.in
index db34c266c584a72442e06b518b066e1e8da48638..5221b8ec2b4279ef91d5ed6f384d160ec9372e4f 100644 (file)
@@ -147,6 +147,7 @@ AC_SUBST(POBAD_CC)
 AC_SUBST(SHLIBEXT)
 AC_SUBST(LIBSMBCLIENT_SHARED)
 AC_SUBST(LIBSMBCLIENT)
+AC_SUBST(PRINTLIBS)
 
 # compile with optimization and without debugging by default
 CFLAGS="-O ${CFLAGS}"
@@ -431,6 +432,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.
@@ -496,7 +498,7 @@ if test x$enable_cups != xno; then
                         AC_DEFINE(HAVE_CUPS)
                CFLAGS="$CFLAGS `$CUPS_CONFIG --cflags`"
                LDFLAGS="$LDFLAGS `$CUPS_CONFIG --ldflags`"
-               LIBS="$LIBS `$CUPS_CONFIG --libs`"
+               PRINTLIBS="$PRINTLIBS `$CUPS_CONFIG --libs`"
         fi
 fi
 
@@ -894,7 +896,14 @@ case "$host_os" in
                        SONAMEFLAG="-Wl,-h,"
                        PICFLAG="-KPIC"   # Is this correct for SunOS
                ;;
-               *bsd*)  BLDSHARED="true"
+               *freebsd*)  BLDSHARED="true"
+                       LDSHFLAGS="-shared"
+                       DYNEXP="-Wl,--export-dynamic"
+                       SONAMEFLAG="-Wl,-soname,"
+                       PICFLAG="-fPIC -DPIC"
+                       AC_DEFINE(STAT_ST_BLOCKSIZE,512)
+               ;;
+               *openbsd*)  BLDSHARED="true"
                        LDSHFLAGS="-shared"
                        DYNEXP="-Wl,-Bdynamic"
                        SONAMEFLAG="-Wl,-soname,"
@@ -922,12 +931,10 @@ case "$host_os" in
                        BLDSHARED="true"
                        LDSHFLAGS="-Wl,-bexpall,-bM:SRE,-bnoentry"
                        DYNEXP="-Wl,-brtl,-bexpall"
-                       if test "${GCC}" = "yes"; then
-                               PICFLAG="-O2"
-                       else
-                       PICFLAG="-O2 -qmaxmem=6000"
+                       PICFLAG="-O2"
+                       if test "${GCC}" != "yes"; then
                                ## for funky AIX compiler using strncpy()
-                               CFLAGS="$CFLAGS -D_LINUX_SOURCE_COMPAT"
+                               CFLAGS="$CFLAGS -D_LINUX_SOURCE_COMPAT -qmaxmem=32000"
                        fi
 
                        AC_DEFINE(STAT_ST_BLOCKSIZE,DEV_BSIZE)
@@ -1820,6 +1827,16 @@ if test x"$samba_cv_HAVE_STAT_ST_BLOCKS" = x"yes"; then
     AC_DEFINE(HAVE_STAT_ST_BLOCKS)
 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)
+fi
+
 case "$host_os" in
 *linux*)
 AC_CACHE_CHECK([for broken RedHat 7.2 system header files],samba_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS,[
@@ -1924,7 +1941,52 @@ 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)
+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 RedHat location for kerberos
 AC_MSG_CHECKING(for /usr/kerberos)
@@ -1936,61 +1998,62 @@ 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";
+  ########################################################
+  # 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 gssapi libs in standard paths
-AC_CHECK_LIB(gssapi_krb5, gss_display_status, [LIBS="$LIBS -lgssapi_krb5";
+  ########################################################
+  # 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)])
-
-##################################################################
-# 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"])
+fi
 
 ########################################################
-# 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";
+# Compile with LDAP support?
+
+with_ldap_support=yes
+AC_MSG_CHECKING([whether to use LDAP])
+
+AC_ARG_WITH(ldap,
+[   --with-ldap  LDAP support (default yes)],
+[ case "$withval" in
+    no)
+       with_ldap_support=no
+       ;;
+  esac ])
+
+AC_MSG_RESULT($with_ldap_support)
+
+if test x"$with_ldap_support" = x"yes"; then
+
+  ##################################################################
+  # we might need the lber lib on some systems. To avoid link errors
+  # this test must be before the libldap test
+  AC_CHECK_LIB(lber, ber_scanf, [LIBS="$LIBS -llber"])
+
+  ########################################################
+  # now see if we can find the ldap libs in standard paths
+  if test x$have_ldap != xyes; then
+  AC_CHECK_LIB(ldap, ldap_domain2hostlist, [LIBS="$LIBS -lldap";
        AC_DEFINE(HAVE_LDAP)])
 
        ########################################################
@@ -2002,6 +2065,7 @@ AC_CHECK_LIB(ldap, ldap_domain2hostlist, [LIBS="$LIBS -lldap";
        #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)
+  fi
 fi
 
 #################################################
@@ -2104,7 +2168,7 @@ 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";
@@ -2127,6 +2191,22 @@ if test x"$samba_cv_HAVE_TRUNCATED_SALT" = x"yes"; then
 fi
 fi
 
+# New experimental SAM system
+
+AC_MSG_CHECKING([whether to build the new (experimental) SAM database])
+AC_ARG_WITH(sam,
+[  --with-sam              Build new (experimental) SAM database (default=no)],
+[ case "$withval" in
+  yes)
+    AC_MSG_RESULT(yes)
+    AC_DEFINE(WITH_SAM)
+    ;;
+  *)
+    AC_MSG_RESULT(no)
+    ;;
+  esac ],
+  AC_MSG_RESULT(no)
+)
 
 
 ########################################################################################
@@ -2633,6 +2713,163 @@ samba_cv_HAVE_ACL_GET_PERM_NP=yes,samba_cv_HAVE_ACL_GET_PERM_NP=no)])
   AC_MSG_RESULT(no)
 )
 
+#################################################
+# check for sendfile support
+
+AC_MSG_CHECKING(whether to support sendfile)
+AC_ARG_WITH(sendfile-support,
+[  --with-sendfile-support      Include sendfile support (default=no)],
+[ case "$withval" in
+  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)
+               AC_DEFINE(LINUX_SENDFILE_API)
+               AC_DEFINE(WITH_SENDFILE)
+       elif test x"$samba_cv_HAVE_SENDFILE" = x"yes"; then
+               AC_DEFINE(HAVE_SENDFILE)
+               AC_DEFINE(LINUX_SENDFILE_API)
+               AC_DEFINE(WITH_SENDFILE)
+       elif test x"$samba_cv_HAVE_BROKEN_LINUX_SENDFILE" = x"yes"; then
+               AC_DEFINE(LINUX_BROKEN_SENDFILE_API)
+               AC_DEFINE(WITH_SENDFILE)
+       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)
+               AC_DEFINE(FREEBSD_SENDFILE_API)
+               AC_DEFINE(WITH_SENDFILE)
+       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)
+               AC_DEFINE(HPUX_SENDFILE_API)
+               AC_DEFINE(WITH_SENDFILE)
+       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)
+               AC_DEFINE(HPUX_SENDFILE_API)
+               AC_DEFINE(WITH_SENDFILE)
+       else
+               AC_MSG_RESULT(no);
+       fi
+
+       ;;
+
+       *)
+       ;;
+        esac
+        ;;
+  *)
+    AC_MSG_RESULT(no)
+    ;;
+  esac ],
+  AC_MSG_RESULT(no)
+)
+
+
 #################################################
 # Check whether winbind is supported on this platform.  If so we need to
 # build and install client programs (WINBIND_TARGETS), sbin programs
@@ -2778,6 +3015,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
 
@@ -2797,7 +3054,10 @@ AC_TRY_RUN([#include "${srcdir-.}/tests/summary.c"],
 builddir=`pwd`
 AC_SUBST(builddir)
 
-AC_OUTPUT(include/stamp-h Makefile script/findsmb ../examples/VFS/Makefile ../examples/VFS/block/Makefile)
+# 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/VFS/Makefile ../examples/pdb/mysql/Makefile ../examples/pdb/xml/Makefile ../examples/sam/Makefile)
 
 #################################################
 # Print very concise instructions on building/use