s3: only include smb profiling where needed.
[nivanova/samba-autobuild/.git] / source3 / configure.in
index 5f81a193ca8ed5e0fb9f48bc5ce11d010ee3308f..f0d54ccc3d6f4aa4b2d2f1135b6b30ad64d0d438 100644 (file)
@@ -37,7 +37,6 @@ LIBS="${LIBS} ${TEVENT_LIBS}"
 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} -I${srcdir-.}/libaddns"
 SAMBA_CPPFLAGS="${SAMBA_CPPFLAGS} -I${srcdir-.}/librpc"
 SAMBA_CPPFLAGS="${SAMBA_CPPFLAGS} -I${srcdir-.}/.."
 
@@ -426,7 +425,6 @@ default_static_modules="$default_static_modules auth_wbc"
 default_static_modules="$default_static_modules auth_server"
 default_static_modules="$default_static_modules auth_domain"
 default_static_modules="$default_static_modules auth_builtin"
-default_static_modules="$default_static_modules auth_netlogond"
 default_static_modules="$default_static_modules vfs_default"
 default_static_modules="$default_static_modules nss_info_template"
 
@@ -464,6 +462,7 @@ default_shared_modules="$default_shared_modules idmap_autorid"
 
 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 charset_weird perfcount_test"
 fi
 
@@ -741,6 +740,7 @@ AC_CHECK_HEADERS(sys/syslog.h syslog.h)
 AC_CHECK_HEADERS(langinfo.h locale.h)
 AC_CHECK_HEADERS(xfs/libxfs.h)
 AC_CHECK_HEADERS(netgroup.h)
+AC_CHECK_HEADERS(linux/falloc.h)
 
 AC_CHECK_HEADERS(rpcsvc/yp_prot.h,,,[[
 #if HAVE_RPC_RPC_H
@@ -950,29 +950,6 @@ if test x"$samba_cv_struct_sigevent" = x"yes"; then
        [#include <signal.h>])
 fi
 
-AC_CACHE_CHECK([for struct timespec type],samba_cv_struct_timespec, [
-    AC_TRY_COMPILE([
-#include <sys/types.h>
-#if STDC_HEADERS
-#include <stdlib.h>
-#include <stddef.h>
-#endif
-#if TIME_WITH_SYS_TIME
-# include <sys/time.h>
-# include <time.h>
-#else
-# if HAVE_SYS_TIME_H
-#  include <sys/time.h>
-# else
-#  include <time.h>
-# endif
-#endif
-],[struct timespec ts;],
-       samba_cv_struct_timespec=yes,samba_cv_struct_timespec=no)])
-if test x"$samba_cv_struct_timespec" = x"yes"; then
-   AC_DEFINE(HAVE_STRUCT_TIMESPEC,1,[Whether we have struct timespec])
-fi
-
 # and glibc has setresuid under linux but the function does
 # nothing until kernel 2.1.44! very dumb.
 AC_CACHE_CHECK([for real setresuid],samba_cv_have_setresuid,[
@@ -1092,11 +1069,14 @@ AC_CHECK_FUNCS(getrlimit fsync setpgid)
 AC_CHECK_FUNCS(fdatasync,,[AC_CHECK_LIB_EXT(rt, LIBS, fdatasync)])
 AC_CHECK_FUNCS(setsid glob strpbrk crypt16 getauthuid)
 AC_CHECK_FUNCS(sigprocmask sigblock sigaction sigset innetgr setnetgrent getnetgrent endnetgrent)
-AC_CHECK_FUNCS(initgroups select poll rdchk getgrnam getgrent pathconf)
+AC_CHECK_FUNCS(initgroups select rdchk getgrnam getgrent pathconf)
+AC_CHECK_FUNCS(getgrset)
 AC_CHECK_FUNCS(setpriv setgidx setuidx setgroups sysconf stat64 fstat64)
 AC_CHECK_FUNCS(lstat64 fopen64 atexit grantpt lseek64 ftruncate64 posix_fallocate posix_fallocate64)
+AC_CHECK_FUNCS(fallocate fallocate64)
 AC_CHECK_FUNCS(fseek64 fseeko64 ftell64 ftello64 setluid getpwanam)
 AC_CHECK_FUNCS(opendir64 readdir64 seekdir64 telldir64 rewinddir64 closedir64)
+AC_CHECK_FUNCS(fdopendir fdopendir64)
 AC_CHECK_FUNCS(getpwent_r)
 AC_CHECK_FUNCS(getdents64)
 AC_CHECK_FUNCS(setenv strcasecmp fcvt fcvtl)
@@ -2563,6 +2543,39 @@ fi
 fi
 # end utmp details
 
+AC_CACHE_CHECK([for linux fallocate],samba_cv_HAVE_LINUX_FALLOCATE,[
+AC_TRY_COMPILE([
+#if defined(HAVE_UNISTD_H)
+#include <unistd.h>
+#endif
+#include <sys/types.h>
+#define _GNU_SOURCE
+#include <fcntl.h>
+#if defined(HAVE_LINUX_FALLOC_H)
+#include <linux/falloc.h>
+#endif],
+[int ret = fallocate(0, FALLOC_FL_KEEP_SIZE, 0, 10);],
+samba_cv_HAVE_LINUX_FALLOCATE=yes,samba_cv_HAVE_LINUX_FALLOCATE=no)])
+if test x"$samba_cv_HAVE_LINUX_FALLOCATE" = x"yes" && test x"$ac_cv_func_fallocate" = x"yes"; then
+    AC_DEFINE(HAVE_LINUX_FALLOCATE,1,[Whether the Linux 'fallocate' function is available])
+fi
+
+AC_CACHE_CHECK([for linux fallocate64],samba_cv_HAVE_LINUX_FALLOCATE64,[
+AC_TRY_COMPILE([
+#if defined(HAVE_UNISTD_H)
+#include <unistd.h>
+#endif
+#include <sys/types.h>
+#define _GNU_SOURCE
+#include <fcntl.h>
+#if defined(HAVE_LINUX_FALLOC_H)
+#include <linux/falloc.h>
+#endif],
+[int ret = fallocate64(0, FALLOC_FL_KEEP_SIZE, 0, 10);],
+samba_cv_HAVE_LINUX_FALLOCATE64=yes,samba_cv_HAVE_LINUX_FALLOCATE64=no)])
+if test x"$samba_cv_HAVE_LINUX_FALLOCATE64" = x"yes" && test x"$ac_cv_func_fallocate64" = x"yes"; then
+    AC_DEFINE(HAVE_LINUX_FALLOCATE64,1,[Whether the Linux 'fallocate64' function is available])
+fi
 
 ICONV_LOOK_DIRS="/usr /usr/local /sw /opt"
 AC_ARG_WITH(libiconv,
@@ -5386,11 +5399,20 @@ if test x"$samba_cv_HAVE_EXPLICIT_LARGEFILE_SUPPORT" = x"yes"; then
 fi
 AC_MSG_RESULT([$samba_cv_HAVE_EXPLICIT_LARGEFILE_SUPPORT])
 
+
 #################################################
 # check for cluster extensions
 
-CTDB_CFLAGS=""
-AC_SUBST(CTDB_CFLAGS)
+AC_MSG_CHECKING(cluster support)
+AC_ARG_WITH(cluster-support,
+[AS_HELP_STRING([--with-cluster-support], [Enable cluster extensions (default=auto)])])
+
+if test x"$with_cluster_support" = x ; then
+       with_cluster_support="auto"
+fi
+
+AC_MSG_RESULT($with_cluster_support)
+
 AC_ARG_WITH(ctdb,
 [AS_HELP_STRING([--with-ctdb=DIR], [Where to find ctdb sources])],
 [ case "$withval" in
@@ -5402,9 +5424,21 @@ AC_ARG_WITH(ctdb,
     ;;
   esac])
 
+AC_ARG_ENABLE(old-ctdb,
+       [AS_HELP_STRING([--enable-old-ctdb],
+               [Enable build against (too) old ctdb version (default=no)])],,
+               [enable_old_ctdb=no])
+
+
+if test "$with_cluster_support" != "no" ; then
+
+AC_MSG_NOTICE(checking whether cluster support is available)
+
+have_cluster_support="yes"
+ctdb_broken="no"
+
 SAVED_CPPFLAGS="$CPPFLAGS"
 CPPFLAGS="$CPPFLAGS ${SAMBA_CONFIGURE_CPPFLAGS} $CTDB_CPPFLAGS"
-ctdb_broken="missing or broken headers"
 
 AC_CHECK_HEADERS(ctdb.h ctdb_private.h,,,[
 #include "confdefs.h"
@@ -5418,99 +5452,150 @@ AC_CHECK_HEADERS(ctdb.h ctdb_private.h,,,[
 #include <ctdb.h>
 ])
 
-AC_HAVE_DECL(CTDB_CONTROL_TRANS3_COMMIT,[
-#include "confdefs.h"
-#define NO_CONFIG_H
-#include "replace.h"
-#include "system/wait.h"
-#include "system/network.h"
-#include <talloc.h>
-#include <tdb.h>
-#include <ctdb.h>
-#include <ctdb_private.h>
-])
-if test x"$ac_cv_have_CTDB_CONTROL_TRANS3_COMMIT_decl" = x"yes"; then
-       ctdb_broken=no
-else
-       ctdb_broken="ctdb transaction support missing or too old"
+if test "x$have_cluster_support" = "xyes" -a \
+       "x$ac_cv_header_ctdb_h" != "xyes"
+then
+       have_cluster_support=no
+       ctdb_broken="ctdb.h is required for cluster support"
 fi
 
-# in ctdb 1.0.57 ctdb_control_tcp was temparary renamed to ctdb_tcp_client
-AC_CHECK_TYPE(struct ctdb_tcp_client,[
-       AC_DEFINE([ctdb_control_tcp],[ctdb_tcp_client],[ctdb ipv4 support])
-],,[
-#include "confdefs.h"
-#define NO_CONFIG_H
-#include "replace.h"
-#include "system/wait.h"
-#include "system/network.h"
-#include <talloc.h>
-#include <tdb.h>
-#include <ctdb.h>
-#include <ctdb_private.h>
-])
-
-AC_CHECK_TYPE(struct ctdb_control_tcp,[
-       AC_DEFINE([HAVE_STRUCT_CTDB_CONTROL_TCP],[1],[ctdb ipv4 support])
-],[
-       ctdb_broken="missing struct ctdb_control_tcp"
-],[
-#include "confdefs.h"
-#define NO_CONFIG_H
-#include "replace.h"
-#include "system/wait.h"
-#include "system/network.h"
-#include <talloc.h>
-#include <tdb.h>
-#include <ctdb.h>
-#include <ctdb_private.h>
-])
+if test "x$have_cluster_support" = "xyes" -a \
+       "x$ac_cv_header_ctdb_h" != "xyes"
+then
+       have_cluster_support=no
+       ctdb_broken="ctdb_private.h is required for cluster support"
+fi
+
+
+if test "x$have_cluster_support" = "xyes" ; then
+       AC_HAVE_DECL(CTDB_CONTROL_TRANS3_COMMIT,[
+       #include "confdefs.h"
+       #define NO_CONFIG_H
+       #include "replace.h"
+       #include "system/wait.h"
+       #include "system/network.h"
+       #include <talloc.h>
+       #include <tdb.h>
+       #include <ctdb.h>
+       #include <ctdb_private.h>
+       ])
+       if test x"$ac_cv_have_CTDB_CONTROL_TRANS3_COMMIT_decl" != x"yes"; then
+               ctdb_broken="ctdb transaction support missing or too old"
+               have_cluster_support=no
+       fi
+fi
 
-AC_CHECK_TYPE(struct ctdb_control_tcp_addr,[
-       AC_DEFINE([HAVE_STRUCT_CTDB_CONTROL_TCP_ADDR],[1],[ctdb ipv6 support])
-],,[
-#include "confdefs.h"
-#define NO_CONFIG_H
-#include "replace.h"
-#include "system/wait.h"
-#include "system/network.h"
-#include <talloc.h>
-#include <tdb.h>
-#include <ctdb.h>
-#include <ctdb_private.h>
-])
-CPPFLAGS="$SAVED_CPPFLAGS"
+if test "x$have_cluster_support" = "xyes" ; then
+       AC_HAVE_DECL(CTDB_CONTROL_SCHEDULE_FOR_DELETION,[
+       #include "confdefs.h"
+       #define NO_CONFIG_H
+       #include "replace.h"
+       #include "system/wait.h"
+       #include "system/network.h"
+       #include <talloc.h>
+       #include <tdb.h>
+       #include <ctdb.h>
+       #include <ctdb_private.h>
+       ])
+       if test x"$ac_cv_have_CTDB_CONTROL_SCHEDULE_FOR_DELETION_decl" != x"yes"
+       then
+               if test "x$enable_old_ctdb" = "xyes" ; then
+                       AC_MSG_WARN([ignoring missing SCHEDULE_FOR_DELETION (--enable-old-ctdb)])
+               else
+                       ctdb_broken="support for SCHEDULE_FOR_DELETION control missing"
+                       have_cluster_support=no
+               fi
+       fi
+fi
 
-AC_MSG_CHECKING(cluster support)
-AC_ARG_WITH(cluster-support,
-[AS_HELP_STRING([--with-cluster-support], [Enable cluster extensions (default=auto)])])
+if test "x$have_cluster_support" = "xyes" ; then
+       # In ctdb 1.0.57, ctdb_control_tcp was temporarily renamed
+       # to ctdb_tcp_client.
+       AC_CHECK_TYPE(struct ctdb_tcp_client,[
+               AC_DEFINE([ctdb_control_tcp],[ctdb_tcp_client],[ctdb ipv4 support])
+       ],,[
+       #include "confdefs.h"
+       #define NO_CONFIG_H
+       #include "replace.h"
+       #include "system/wait.h"
+       #include "system/network.h"
+       #include <talloc.h>
+       #include <tdb.h>
+       #include <ctdb.h>
+       #include <ctdb_private.h>
+       ])
+fi
 
-if test x"$with_cluster_support" = x ; then
-       with_cluster_support="auto"
+if test "x$have_cluster_support" = "xyes" ; then
+       AC_CHECK_TYPE(struct ctdb_control_tcp,[
+               AC_DEFINE([HAVE_STRUCT_CTDB_CONTROL_TCP],[1],[ctdb ipv4 support])
+       ],[
+               ctdb_broken="missing struct ctdb_control_tcp"
+               have_cluster_support=no
+       ],[
+       #include "confdefs.h"
+       #define NO_CONFIG_H
+       #include "replace.h"
+       #include "system/wait.h"
+       #include "system/network.h"
+       #include <talloc.h>
+       #include <tdb.h>
+       #include <ctdb.h>
+       #include <ctdb_private.h>
+       ])
 fi
 
-if test x"$ac_cv_header_ctdb_private_h" != x"yes"; then
-       if test "x$with_cluster_support" = "xyes"; then
-               AC_MSG_ERROR("ctdb_private.h is required for cluster support")
-       fi
-       with_cluster_support=no
+# test for optional ipv6 support in ctdb:
+if test "x$have_cluster_support" = "xyes" ; then
+       AC_CHECK_TYPE(struct ctdb_control_tcp_addr,[
+               AC_DEFINE([HAVE_STRUCT_CTDB_CONTROL_TCP_ADDR],[1],[ctdb ipv6 support])
+       ],,[
+       #include "confdefs.h"
+       #define NO_CONFIG_H
+       #include "replace.h"
+       #include "system/wait.h"
+       #include "system/network.h"
+       #include <talloc.h>
+       #include <tdb.h>
+       #include <ctdb.h>
+       #include <ctdb_private.h>
+       ])
 fi
 
-if test x"$ctdb_broken" != x"no"; then
-       if test "x$with_cluster_support" = "xyes"; then
-               AC_MSG_ERROR(["cluster support: $ctdb_broken"])
-       fi
+CPPFLAGS="$SAVED_CPPFLAGS"
+
+fi # (if test "$with_cluster_support" != "no")
+
+if test x"$have_cluster_support" = "xno" ; then
+       case "$with_cluster_support" in
+       yes)
+               AC_MSG_ERROR(["cluster support not available: $ctdb_broken"])
+               ;;
+       auto)
+               AC_MSG_WARN(["cluster support not available: $ctdb_broken"])
+               ;;
+       esac
        with_cluster_support=no
 fi
 
 if test "x$with_cluster_support" != "xno"; then
     AC_DEFINE(CLUSTER_SUPPORT,1,[Whether to enable cluster extensions])
     SAMBA_CPPFLAGS="${SAMBA_CPPFLAGS} ${CTDB_CPPFLAGS}"
-    AC_MSG_RESULT(yes)
+    AC_MSG_NOTICE(Building with cluster support)
 else
-    AC_MSG_RESULT(no)
+    AC_MSG_NOTICE(Building without cluster support)
 fi
 
+
+#################################################
+# check for rtnetlink
+
+AC_CHECK_HEADERS([linux/netlink.h],
+  AC_CHECK_HEADERS([linux/rtnetlink.h],[],[],
+                   [#include <bits/sockaddr.h>
+                    #include <linux/netlink.h>]),
+  [],[#include <bits/sockaddr.h>])
+
 #################################################
 # check for ACL support
 
@@ -5624,7 +5709,19 @@ else
         esac
 fi # with_acl_support
 
-
+#################################################
+# check if we have FreeBSD sunacl
+case "$host_os" in
+*freebsd*)
+    AC_CHECK_HEADER(sunacl.h)
+    if test x"$ac_cv_header_sunacl_h" = xyes ; then
+       AC_DEFINE(HAVE_FREEBSD_SUNACL_H,1,[Whether we have FreeBSD sunacl around])
+       ZFSACL_LIBS=-lsunacl
+       AC_SUBST(ZFSACL_LIBS)
+       default_shared_modules="$default_shared_modules vfs_zfsacl"
+    fi
+    ;;
+esac
 
 #################################################
 # check for AIO support
@@ -6353,6 +6450,18 @@ if test x"$samba_cv_HAVE_PEERCRED" = x"yes"; then
     AC_DEFINE(HAVE_PEERCRED,1,[Whether we can use SO_PEERCRED to get socket credentials])
 fi
 
+AC_CACHE_CHECK([for getpeereid],samba_cv_HAVE_GETPEEREID,[
+AC_TRY_LINK([#include <sys/types.h>
+#include <unistd.h>],
+[uid_t uid; gid_t gid; int ret;
+ ret = getpeereid(0, &uid, &gid);
+],
+samba_cv_HAVE_GETPEEREID=yes,samba_cv_HAVE_GETPEEREID=no)])
+if test x"$samba_cv_HAVE_GETPEEREID" = xyes; then
+   AC_DEFINE(HAVE_GETPEEREID,1,
+            [Whether we have getpeereid to get socket credentials])
+fi
+
 
 #################################################
 # Check to see if we should use the included popt
@@ -6690,7 +6799,8 @@ if test x"$MODULE_DEFAULT_vfs_notify_fam" = xSTATIC -o \
        AC_SUBST(SMBD_FAM_LIBS)
 fi
 
-SMB_MODULE(pdb_ldap, passdb/pdb_ldap.o passdb/pdb_nds.o, "bin/ldapsam.$SHLIBEXT", PDB,
+SMB_MODULE(pdb_ldap, passdb/pdb_ldap.o passdb/pdb_nds.o passdb/pdb_ipa.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)
@@ -6698,23 +6808,6 @@ 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)
 SMB_SUBSYSTEM(PDB,passdb/pdb_interface.o)
 
-
-SMB_MODULE(rpc_lsarpc, \$(RPC_LSARPC_OBJ), "bin/librpc_lsarpc.$SHLIBEXT", RPC)
-SMB_MODULE(rpc_winreg, \$(RPC_WINREG_OBJ), "bin/librpc_winreg.$SHLIBEXT", RPC)
-SMB_MODULE(rpc_initshutdown, \$(RPC_INITSHUTDOWN_OBJ), "bin/librpc_initshutdown.$SHLIBEXT", RPC)
-SMB_MODULE(rpc_dssetup, \$(RPC_DSSETUP_OBJ), "bin/librpc_dssetup.$SHLIBEXT", RPC)
-SMB_MODULE(rpc_wkssvc, \$(RPC_WKSSVC_OBJ), "bin/librpc_wkssvc.$SHLIBEXT", RPC)
-SMB_MODULE(rpc_svcctl, \$(RPC_SVCCTL_OBJ), "bin/librpc_svcctl.$SHLIBEXT", RPC)
-SMB_MODULE(rpc_ntsvcs, \$(RPC_NTSVCS_OBJ), "bin/librpc_ntsvcs.$SHLIBEXT", RPC)
-SMB_MODULE(rpc_netlogon, \$(RPC_NETLOGON_OBJ), "bin/librpc_NETLOGON.$SHLIBEXT", RPC)
-SMB_MODULE(rpc_netdfs, \$(RPC_NETDFS_OBJ), "bin/librpc_netdfs.$SHLIBEXT", RPC)
-SMB_MODULE(rpc_srvsvc, \$(RPC_SRVSVC_OBJ), "bin/librpc_svcsvc.$SHLIBEXT", RPC)
-SMB_MODULE(rpc_spoolss, \$(RPC_SPOOLSS_OBJ), "bin/librpc_spoolss.$SHLIBEXT", RPC)
-SMB_MODULE(rpc_eventlog, \$(RPC_EVENTLOG_OBJ), "bin/librpc_eventlog.$SHLIBEXT", RPC)
-SMB_MODULE(rpc_samr, \$(RPC_SAMR_OBJ), "bin/librpc_samr.$SHLIBEXT", RPC)
-SMB_MODULE(rpc_rpcecho, \$(RPC_RPCECHO_OBJ), "bin/librpc_rpcecho.$SHLIBEXT", RPC)
-SMB_SUBSYSTEM(RPC,smbd/process.o)
-
 SMB_MODULE(idmap_ldap, winbindd/idmap_ldap.o, "bin/ldap.$SHLIBEXT", IDMAP)
 SMB_MODULE(idmap_tdb, winbindd/idmap_tdb.o, "bin/tdb.$SHLIBEXT", IDMAP)
 SMB_MODULE(idmap_tdb2, winbindd/idmap_tdb2.o, "bin/tdb2.$SHLIBEXT", IDMAP)