s3-param: Rename loadparm_s3_context -> loadparm_s3_helpers
[kai/samba.git] / source3 / configure.in
index 37f37f603026f3f12fad8c6c12593be9a2176720..6e324a16a0278c9ee8fdf5e22d6d94285d33ffaa 100644 (file)
@@ -35,7 +35,8 @@ done
 AC_SUBST(LIBTEVENT_OBJ0)
 LIBS="${LIBS} ${TEVENT_LIBS}"
 
-SAMBA_CPPFLAGS="-Iinclude/autoconf -Iinclude -I${srcdir-.}/include  -I. -I${srcdir-.}"
+SAMBA_CPPFLAGS="-Iinclude/autoconf -Iautoconf -Iautoconf/source3"
+SAMBA_CPPFLAGS="${SAMBA_CPPFLAGS} -Iinclude -I${srcdir-.}/include  -I. -I${srcdir-.}"
 SAMBA_CPPFLAGS="${SAMBA_CPPFLAGS} -I${srcdir-.}/../lib/replace"
 SAMBA_CPPFLAGS="${SAMBA_CPPFLAGS} ${TEVENT_CFLAGS}"
 SAMBA_CPPFLAGS="${SAMBA_CPPFLAGS} ${CCAN_CFLAGS}"
@@ -466,10 +467,11 @@ default_shared_modules="$default_shared_modules vfs_crossrename"
 default_shared_modules="$default_shared_modules vfs_linux_xfs_sgid"
 default_shared_modules="$default_shared_modules vfs_time_audit"
 default_shared_modules="$default_shared_modules idmap_autorid"
+default_shared_modules="$default_shared_modules idmap_tdb2"
+default_shared_modules="$default_shared_modules idmap_rid"
+default_shared_modules="$default_shared_modules idmap_hash"
 
 if test "x$developer" = xyes; then
-   default_static_modules="$default_static_modules rpc_rpcecho pdb_ads"
-   default_static_modules="$default_static_modules auth_netlogond"
    default_shared_modules="$default_shared_modules perfcount_test"
 fi
 
@@ -586,7 +588,7 @@ LIBREPLACE_DIR=`echo ${libreplacedir} | sed -e "s;${srcdir};;" -e "s;^/;;"`
 LIBREPLACE_OBJS="${LIBREPLACEOBJ}"
 AC_SUBST(LIBREPLACE_OBJS)
 
-LIBREPLACE_LIBS="${LIBREPLACE_NETWORK_LIBS}"
+LIBREPLACE_LIBS="${LIBREPLACE_NETWORK_LIBS} ${LIBREPLACE_FILESYS_LIBS}"
 AC_SUBST(LIBREPLACE_LIBS)
 
 
@@ -1203,11 +1205,11 @@ fi
 AC_CACHE_CHECK([whether we can compile with __attribute__((destructor))],
               samba_cv_function_attribute_destructor,
               [
-                AC_COMPILE_IFELSE(
+                AC_COMPILE_IFELSE([AC_LANG_SOURCE(
                        [
                                __attribute__((destructor))
                                static void cleanup(void) { }
-                       ],
+                       ])],
                        samba_cv_function_attribute_destructor=yes)
                ])
 
@@ -1911,6 +1913,53 @@ then
        AC_SUBST(TDBTORTURE)
 fi
 
+AC_ARG_ENABLE(external_libntdb,
+       [AS_HELP_STRING([--enable-external-libntdb],
+               [Enable external ntdb [default=auto]])],
+               [ enable_external_libntdb=$enableval ],
+               [ enable_external_libntdb=auto ])
+
+if test "x$enable_external_libntdb" != xno
+then
+       PKG_CHECK_MODULES(LIBNTDB, ntdb >= 1.0,
+               [ enable_external_libntdb=yes ],
+               [
+               if test x$enable_external_libntdb = xyes; then
+                       AC_MSG_ERROR([Unable to find libntdb])
+               else
+                       enable_external_libntdb=no
+               fi
+               ])
+fi
+
+AC_SUBST(LIBNTDB_OBJ0)
+if test "x$enable_external_libntdb" = xno
+then
+       m4_include(../lib/ntdb/libntdb.m4)
+       LINK_LIBNTDB=STATIC
+       LIBNTDBVERSION=`grep ^VERSION ${ntdbdir}/wscript | sed -e "s/'//g" -e 's/.* //'`
+       SMB_LIBRARY(ntdb, 1, ${LIBNTDBVERSION})
+       LIBNTDB_OBJ0=""
+       LIBNTDB_LIBS="$LIBNTDB_LIBS $NTDB_DEPS"
+       for obj in ${NTDB_OBJ}; do
+               LIBNTDB_OBJ0="${LIBNTDB_OBJ0} ${ntdbdir}/${obj}"
+       done
+       AC_SUBST(LIBNTDB_OBJ0)
+       SAMBA_CPPFLAGS="${SAMBA_CPPFLAGS} ${NTDB_CFLAGS}"
+       SAMBA_CONFIGURE_CPPFLAGS="${SAMBA_CONFIGURE_CPPFLAGS} ${NTDB_CFLAGS}"
+
+       NTDBBACKUP="bin/ntdbbackup"
+       AC_SUBST(NTDBBACKUP)
+       NTDBDUMP="bin/ntdbdump"
+       AC_SUBST(NTDBDUMP)
+       NTDBRESTORE="bin/ntdbrestore"
+       AC_SUBST(NTDBRESTORE)
+       NTDBTOOL="bin/ntdbtool"
+       AC_SUBST(NTDBTOOL)
+       NTDBTORTURE="bin/ntdbtorture"
+       AC_SUBST(NTDBTORTURE)
+fi
+
 SMB_LIBRARY(netapi, 0)
 SMB_LIBRARY(smbclient, 0)
 SMB_LIBRARY(smbsharemodes, 0)
@@ -2053,14 +2102,6 @@ if test x"$samba_cv_HAVE_MAKEDEV" = x"yes"; then
     AC_DEFINE(HAVE_MAKEDEV,1,[Whether the macro for makedev is available])
 fi
 
-AC_CACHE_CHECK([for unsigned char],samba_cv_HAVE_UNSIGNED_CHAR,[
-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,1,[Whether the 'unsigned char' type is available])
-fi
-
 AC_CACHE_CHECK([whether seekdir returns void],samba_cv_SEEKDIR_RETURNS_VOID,[
 AC_TRY_COMPILE([#include <sys/types.h>
 #include <dirent.h>
@@ -2808,13 +2849,13 @@ AC_TRY_COMPILE([
   #define _XOPEN_SOURCE 600
   #include <stdlib.h>
   #if defined(__GLIBC__) && ((__GLIBC__ < 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 4))
-    probably broken posix_fallocate
+  #error probably broken posix_fallocate
   #endif
 ], [
 ], 
 samba_cv_HAVE_BROKEN_POSIX_FALLOCATE=no,samba_cv_HAVE_BROKEN_POSIX_FALLOCATE=yes)])
 if test x"$samba_cv_HAVE_BROKEN_POSIX_FALLOCATE" = xyes; then
-       AC_DEFINE(HAVE_BROKEN_POSIX_FALLOCATE,, Whether we have a broken posix_fallocate)
+       AC_DEFINE(HAVE_BROKEN_POSIX_FALLOCATE, 1, Whether we have a broken posix_fallocate)
 fi
 
 
@@ -5347,15 +5388,21 @@ esac
 #################################################
 # check for AIO support
 
+with_aio=auto
 AC_MSG_CHECKING(whether to support asynchronous io)
 AC_ARG_WITH(aio-support,
-[AS_HELP_STRING([--with-aio-support], [Include asynchronous io support (default=no)])],
-[ case "$withval" in
-  yes)
+[AS_HELP_STRING([--with-aio-support], [Include asynchronous io support (default=auto)])],
+[  case "$withval" in
+    yes|no)
+       with_aio=$withval
+       ;;
+   esac ])
 
-       AC_MSG_RESULT(yes)
-       case "$host_os" in
-       *)
+AC_MSG_RESULT($with_aio)
+
+if test x"$with_aio" = x"no"; then
+    AC_DEFINE(HAVE_NO_AIO,1,[Whether no asynchronous io support should be built in])
+else
                AIO_LIBS=$LIBS
                no_rt_LIBS=$LIBS
                AC_CHECK_LIB(rt,aio_read,[AIO_LIBS="$LIBS -lrt"])
@@ -5370,62 +5417,54 @@ AC_ARG_WITH(aio-support,
 samba_cv_HAVE_AIO=yes,samba_cv_HAVE_AIO=no)
                LIBS=$aio_LIBS])
                if test x"$samba_cv_HAVE_AIO" = x"yes"; then
-                       AC_DEFINE(WITH_AIO, 1, [Using asynchronous io])
+                       AC_DEFINE(HAVE_AIO, 1, [Using asynchronous io])
                        LIBS=$AIO_LIBS
                        AC_MSG_CHECKING(for aio_read)
-                       AC_LINK_IFELSE([#include <aio.h>
-int main() { struct aiocb a; return aio_read(&a); }],
+                       AC_LINK_IFELSE([AC_LANG_SOURCE([#include <aio.h>
+int main() { struct aiocb a; return aio_read(&a); }])],
 [AC_DEFINE(HAVE_AIO_READ, 1, [Have aio_read]) AC_MSG_RESULT(yes)],
 [AC_MSG_RESULT(no)])
 
                        AC_MSG_CHECKING(for aio_write)
-                       AC_LINK_IFELSE([#include <aio.h>
-int main() { struct aiocb a; return aio_write(&a); }],
+                       AC_LINK_IFELSE([AC_LANG_SOURCE([#include <aio.h>
+int main() { struct aiocb a; return aio_write(&a); }])],
 [AC_DEFINE(HAVE_AIO_WRITE, 1, [Have aio_write]) AC_MSG_RESULT(yes)],
 [AC_MSG_RESULT(no)])
 
                        AC_MSG_CHECKING(for aio_fsync)
-                       AC_LINK_IFELSE([#include <aio.h>
-int main() { struct aiocb a; return aio_fsync(1, &a); }],
+                       AC_LINK_IFELSE([AC_LANG_SOURCE([#include <aio.h>
+int main() { struct aiocb a; return aio_fsync(1, &a); }])],
 [AC_DEFINE(HAVE_AIO_FSYNC, 1, [Have aio_fsync]) AC_MSG_RESULT(yes)],
 [AC_MSG_RESULT(no)])
 
                        AC_MSG_CHECKING(for aio_return)
-                       AC_LINK_IFELSE([#include <aio.h>
-int main() { struct aiocb a; return aio_return(&a); }],
+                       AC_LINK_IFELSE([AC_LANG_SOURCE([#include <aio.h>
+int main() { struct aiocb a; return aio_return(&a); }])],
 [AC_DEFINE(HAVE_AIO_RETURN, 1, [Have aio_return]) AC_MSG_RESULT(yes)],
 [AC_MSG_RESULT(no)])
 
                        AC_MSG_CHECKING(for aio_error)
-                       AC_LINK_IFELSE([#include <aio.h>
-int main() { struct aiocb a; return aio_error(&a); }],
+                       AC_LINK_IFELSE([AC_LANG_SOURCE([#include <aio.h>
+int main() { struct aiocb a; return aio_error(&a); }])],
 [AC_DEFINE(HAVE_AIO_ERROR, 1, [Have aio_error]) AC_MSG_RESULT(yes)],
 [AC_MSG_RESULT(no)])
 
                        AC_MSG_CHECKING(for aio_cancel)
-                       AC_LINK_IFELSE([#include <aio.h>
-int main() { struct aiocb a; return aio_cancel(1, &a); }],
+                       AC_LINK_IFELSE([AC_LANG_SOURCE([#include <aio.h>
+int main() { struct aiocb a; return aio_cancel(1, &a); }])],
 [AC_DEFINE(HAVE_AIO_CANCEL, 1, [Have aio_cancel]) AC_MSG_RESULT(yes)],
 [AC_MSG_RESULT(no)])
 
                        AC_MSG_CHECKING(for aio_suspend)
-                       AC_LINK_IFELSE([#include <aio.h>
-int main() { struct aiocb a; return aio_suspend(&a, 1, NULL); }],
+                       AC_LINK_IFELSE([AC_LANG_SOURCE([#include <aio.h>
+int main() { struct aiocb a; return aio_suspend(&a, 1, NULL); }])],
 [AC_DEFINE(HAVE_AIO_SUSPEND, 1, [Have aio_suspend]) AC_MSG_RESULT(yes)],
 [AC_MSG_RESULT(no)])
+               else
+                       AC_DEFINE(HAVE_NO_AIO,1,[Whether no asynchronous io support is available])
+                       AC_MSG_RESULT(no)
                fi
-
-            ;;
-        esac
-        ;;
-  *)
-    AC_MSG_RESULT(no)
-    AC_DEFINE(HAVE_NO_AIO,1,[Whether no asynchronous io support is available])
-    ;;
-  esac ],
-  AC_DEFINE(HAVE_NO_AIO,1,[Whether no asynchronous io support should be built in])
-  AC_MSG_RESULT(no)
-)
+fi
 
 if test x"$samba_cv_HAVE_AIO" = x"yes"; then
        if test x"$samba_cv_msghdr_msg_control" = x"yes" -o \
@@ -5463,7 +5502,7 @@ io_getevents(ctx, 1, 1, &ioev, &ts);],
 samba_cv_HAVE_LINUX_KERNEL_AIO=yes,samba_cv_HAVE_LINUX_KERNEL_AIO=no)
                LIBS=$aio_LIBS])
            if test x"$samba_cv_HAVE_LINUX_KERNEL_AIO" = x"yes"; then
-               AC_DEFINE(WITH_AIO, 1, [Using asynchronous io])
+               AC_DEFINE(HAVE_AIO, 1, [Using asynchronous io])
                default_shared_modules="$default_shared_modules vfs_aio_linux"
            fi
             ;;
@@ -5494,28 +5533,10 @@ 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_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
@@ -5706,7 +5727,7 @@ AC_CACHE_CHECK([for Linux splice],
 #include <unistd.h>
 #endif
 #include <fcntl.h>],
-    [long ret = splice(0,0,1,0,400,0);],
+    [long ret = splice(0,0,1,0,400,SPLICE_F_MOVE);],
     samba_cv_HAVE_LINUX_SPLICE=yes,
     samba_cv_HAVE_LINUX_SPLICE=no)])
 ;;
@@ -5784,7 +5805,7 @@ case "$host_os" in
                NSSSONAMEVERSIONSUFFIX=".2"
                WINBIND_NSS_EXTRA_OBJS="../nsswitch/winbind_nss_linux.o"
                ;;
-       *freebsd[[5-9]]*)
+       *freebsd[[5-9]]* | *freebsd1[[0-9]]*)
                # FreeBSD winbind client is implemented as a wrapper around
                # the Linux version.
                NSSSONAMEVERSIONSUFFIX=".1"
@@ -5794,7 +5815,7 @@ case "$host_os" in
                WINBIND_WINS_NSS="../nsswitch/nss_wins.$SHLIBEXT"
                ;;
 
-       *netbsd*[[3-9]]*)
+       *netbsd*[[3-9]]* | *netbsd1[[0-9]]*)
                # NetBSD winbind client is implemented as a wrapper
                # around the Linux version. It needs getpwent_r() to
                # indicate libc's use of the correct nsdispatch API.
@@ -6151,15 +6172,17 @@ fi
 if test x"$enable_pthreadpool" = x"yes" -a x"$samba_cv_HAVE_PTHREAD" = x"yes"; then
     LIBS="$LIBS $PTHREAD_LDFLAGS"
     CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
-    AC_DEFINE(WITH_PTHREADPOOL, 1, [Whether to include pthreadpool helpers])
     AC_SUBST(PTHREADPOOL_OBJ, "lib/pthreadpool/pthreadpool.o")
-    PTHREADPOOLTEST="bin/pthreadpooltest"
-    AC_SUBST(PTHREADPOOLTEST)
     if test x"$samba_cv_HAVE_AIO" = x"yes"; then
         default_shared_modules="$default_shared_modules vfs_aio_pthread"
     fi
+else
+    AC_SUBST(PTHREADPOOL_OBJ, "lib/pthreadpool/pthreadpool_sync.o")
 fi
 
+PTHREADPOOLTEST="bin/pthreadpooltest"
+AC_SUBST(PTHREADPOOLTEST)
+
 
 #################################################
 # Check to see if we should use the included iniparser
@@ -6351,7 +6374,6 @@ fi
 SMB_MODULE(pdb_ldap, passdb/pdb_ldap.o passdb/pdb_nds.o passdb/pdb_ipa.o passdb/pdb_ldap_util.o,
                   "bin/ldapsam.$SHLIBEXT", PDB,
                   [ PASSDB_LIBS="$PASSDB_LIBS $LDAP_LIBS" ] )
-SMB_MODULE(pdb_ads, passdb/pdb_ads.o \$(TLDAP_OBJ), "bin/ads.$SHLIBEXT", PDB)
 SMB_MODULE(pdb_smbpasswd, passdb/pdb_smbpasswd.o, "bin/smbpasswd.$SHLIBEXT", PDB)
 SMB_MODULE(pdb_tdbsam, passdb/pdb_tdb.o, "bin/tdbsam.$SHLIBEXT", PDB)
 SMB_MODULE(pdb_wbc_sam, passdb/pdb_wbc_sam.o, "bin/wbc_sam.$SHLIBEXT", PDB)
@@ -6379,7 +6401,6 @@ SMB_MODULE(auth_wbc, \$(AUTH_WBC_OBJ), "bin/wbc.$SHLIBEXT", AUTH)
 SMB_MODULE(auth_domain, \$(AUTH_DOMAIN_OBJ), "bin/domain.$SHLIBEXT", AUTH)
 SMB_MODULE(auth_builtin, \$(AUTH_BUILTIN_OBJ), "bin/builtin.$SHLIBEXT", AUTH)
 SMB_MODULE(auth_script, \$(AUTH_SCRIPT_OBJ), "bin/script.$SHLIBEXT", AUTH)
-SMB_MODULE(auth_netlogond, \$(AUTH_NETLOGOND_OBJ), "bin/netlogond.$SHLIBEXT", AUTH)
 SMB_SUBSYSTEM(AUTH,auth/auth.o)
 
 SMB_MODULE(vfs_default, \$(VFS_DEFAULT_OBJ), "bin/default.$SHLIBEXT", VFS)