tdb: raise version to 1.2.1
[ira/wip.git] / source3 / configure.in
index e31a6d37388fd12eb3a46a5544f75271f0aa88f6..14b57b688a19e9fa2483086055a67a25b510e72d 100644 (file)
@@ -709,7 +709,7 @@ AUTH_LIBS="${AUTH_LIBS} ${CRYPT_LIBS}"
 
 AC_CHECK_HEADERS(aio.h sys/fcntl.h sys/select.h fcntl.h sys/time.h sys/unistd.h rpc/nettype.h)
 AC_CHECK_HEADERS(unistd.h grp.h sys/id.h memory.h alloca.h)
-AC_CHECK_HEADERS(limits.h float.h pthread.h libintl.h)
+AC_CHECK_HEADERS(limits.h float.h libintl.h)
 AC_CHECK_HEADERS(rpc/rpc.h rpcsvc/nis.h rpcsvc/ypclnt.h)
 AC_CHECK_HEADERS(sys/param.h ctype.h sys/wait.h sys/resource.h sys/ioctl.h sys/ipc.h sys/prctl.h sys/sysctl.h)
 AC_CHECK_HEADERS(sys/mman.h sys/filio.h sys/priv.h sys/shm.h string.h strings.h stdlib.h)
@@ -1398,7 +1398,7 @@ AC_LIBTESTFUNC(sec, getprpwnam)
 AC_CHECK_FUNCS(strsignal)
 
 ############################################
-# Check if we have libattr
+# Check for EA implementations
 case "$host_os" in
   *osf*)
        AC_SEARCH_LIBS(getproplist, [proplist])
@@ -1406,24 +1406,27 @@ case "$host_os" in
        AC_CHECK_FUNCS(delproplist fdelproplist add_proplist_entry get_proplist_entry)
        AC_CHECK_FUNCS(sizeof_proplist_entry)
   ;;
-  *)
-       AC_SEARCH_LIBS(getxattr, [attr])
-       AC_CHECK_FUNCS(getxattr lgetxattr fgetxattr listxattr llistxattr)
-       AC_CHECK_FUNCS(getea fgetea lgetea listea flistea llistea)
-       AC_CHECK_FUNCS(removeea fremoveea lremoveea setea fsetea lsetea)
-       AC_CHECK_FUNCS(flistxattr removexattr lremovexattr fremovexattr)
-       AC_CHECK_FUNCS(setxattr lsetxattr fsetxattr)
-       AC_CHECK_FUNCS(attr_get attr_list attr_set attr_remove)
-       AC_CHECK_FUNCS(attr_getf attr_listf attr_setf attr_removef)
+  *freebsd4* | *dragonfly* )
+       AC_DEFINE(BROKEN_EXTATTR, 1, [Does extattr API work])
   ;;
-esac
-
-########################################################
-# Check if attropen() is present if this is Solaris
-case "$host_os" in
   *solaris*)
        AC_CHECK_FUNCS(attropen)
   ;;
+  *)
+       AC_SEARCH_LIBS(getxattr, [attr])
+       AC_CHECK_FUNCS(getxattr,[
+               AC_CHECK_FUNCS(lgetxattr fgetxattr listxattr llistxattr flistxattr removexattr lremovexattr fremovexattr setxattr lsetxattr fsetxattr)
+               ])
+       AC_CHECK_FUNCS(getea,[
+               AC_CHECK_FUNCS(fgetea lgetea listea flistea llistea removeea fremoveea lremoveea setea fsetea lsetea)
+               ])
+       AC_CHECK_FUNCS(attr_get,[
+               AC_CHECK_FUNCS(attr_list attr_set attr_remove attr_getf attr_listf attr_setf attr_removef)
+               ])
+       AC_CHECK_FUNCS(extattr_delete_file,[
+               AC_CHECK_FUNCS(extattr_delete_fd extattr_delete_link extattr_get_fd extattr_get_file extattr_get_link extattr_list_fd extattr_list_file extattr_list_link extattr_set_fd extattr_set_file extattr_set_link)
+               ])
+  ;;
 esac
 
 ########################################################
@@ -1450,19 +1453,6 @@ if test x"$ac_cv_func_getxattr" = x"yes" ; then
        fi
 fi
 
-# Check if we have extattr
-case "$host_os" in
-  *freebsd4* | *dragonfly* )
-    AC_DEFINE(BROKEN_EXTATTR, 1, [Does extattr API work])
-    ;;
-  *)
-    AC_CHECK_FUNCS(extattr_delete_fd extattr_delete_file extattr_delete_link)
-    AC_CHECK_FUNCS(extattr_get_fd extattr_get_file extattr_get_link)
-    AC_CHECK_FUNCS(extattr_list_fd extattr_list_file extattr_list_link)
-    AC_CHECK_FUNCS(extattr_set_fd extattr_set_file extattr_set_link)
-    ;;
-esac
-
 AC_DISABLE_STATIC
 AC_ENABLE_SHARED
 
@@ -1975,7 +1965,7 @@ AC_ARG_ENABLE(external_libtdb,
 
 if test "x$enable_external_libtdb" != xno
 then
-       PKG_CHECK_MODULES(LIBTDB, tdb >= 1.1.7,
+       PKG_CHECK_MODULES(LIBTDB, tdb >= 1.2.1,
                [ enable_external_libtdb=yes ],
                [
                if test x$enable_external_libtdb = xyes; then
@@ -3186,7 +3176,7 @@ with_ldap_support=auto
 AC_MSG_CHECKING([for LDAP support])
 
 AC_ARG_WITH(ldap,
-[AS_HELP_STRING([--with-ldap], [LDAP support (default yes)])],
+[AS_HELP_STRING([--with-ldap], [LDAP support (default=yes)])],
 [ case "$withval" in
     yes|no)
        with_ldap_support=$withval
@@ -3336,7 +3326,7 @@ with_ads_support=auto
 AC_MSG_CHECKING([for Active Directory and krb5 support])
 
 AC_ARG_WITH(ads,
-[AS_HELP_STRING([--with-ads], [Active Directory support (default auto)])],
+[AS_HELP_STRING([--with-ads], [Active Directory support (default=auto)])],
 [ case "$withval" in
     yes|no)
        with_ads_support="$withval"
@@ -3660,6 +3650,9 @@ if test x"$with_ads_support" != x"no"; then
   AC_CHECK_FUNC_EXT(krb5_get_creds_opt_set_impersonate, $KRB5_LIBS)
   AC_CHECK_FUNC_EXT(krb5_get_creds, $KRB5_LIBS)
   AC_CHECK_FUNC_EXT(krb5_get_credentials_for_user, $KRB5_LIBS)
+  AC_CHECK_FUNC_EXT(krb5_get_host_realm, $KRB5_LIBS)
+  AC_CHECK_FUNC_EXT(krb5_free_host_realm, $KRB5_LIBS)
+
   # MIT krb5 1.8 does not expose this call (yet)
   AC_CHECK_DECLS(krb5_get_credentials_for_user, [], [], [#include <krb5.h>])
 
@@ -4002,6 +3995,18 @@ if test x"$with_ads_support" != x"no"; then
                [Whether the WRFILE:-keytab is supported])
   fi
 
+  AC_CACHE_CHECK([for krb5_realm type],
+                samba_cv_HAVE_KRB5_REALM_TYPE,[
+    AC_TRY_COMPILE([#include <krb5.h>],
+      [krb5_realm realm;],
+      samba_cv_HAVE_KRB5_REALM_TYPE=yes,
+      samba_cv_HAVE_KRB5_REALM_TYPE=no)])
+
+  if test x"$samba_cv_HAVE_KRB5_REALM_TYPE" = x"yes"; then
+    AC_DEFINE(HAVE_KRB5_REALM_TYPE,1,
+               [Whether the type krb5_realm exists])
+  fi
+
   AC_CACHE_CHECK([for krb5_princ_realm returns krb5_realm or krb5_data],
                samba_cv_KRB5_PRINC_REALM_RETURNS_REALM,[
     AC_TRY_COMPILE([#include <krb5.h>],
@@ -4206,7 +4211,7 @@ with_dnsupdate_support=auto
 AC_MSG_CHECKING([whether to enable DNS Updates support])
 
 AC_ARG_WITH(dnsupdate,
-[AS_HELP_STRING([--with-dnsupdate], [Enable DNS Updates support (default no)])],
+[AS_HELP_STRING([--with-dnsupdate], [Enable DNS Updates support (default=auto)])],
 [ case "$withval" in
     yes|no)
        with_dnsupdate_support=$withval
@@ -4218,24 +4223,29 @@ AC_MSG_RESULT($with_dnsupdate_support)
 if test x"$with_dnsupdate_support" != x"no"; then
 
   ################################################################
-  # first test for Active Directory support being enabled
-  #if test x"$with_ads_support" = x"no"; then
-  #            AC_MSG_ERROR(Active Directory support is required to enable DNS Update support)
-  #            with_dnsupdate_support=no
-  #fi          
+  # first test for AD / GSSAPI support being enabled
+       if test x"$have_gssapi" != xyes ; then
+               if test x"$with_dnsupdate_support" = x"yes" ; then
+                       AC_MSG_ERROR(DNS Updates support only possible with AD and GSSAPI support)
+               else
+                       AC_MSG_NOTICE(DNS Updates support only possible with AD and GSSAPI support)
+                       with_dnsupdate_support=no
+               fi
+       fi
   ##################################################################
   # then test for uuid.h (necessary to generate unique DNS keynames
   # (uuid.h is required for this test)
-  AC_CHECK_HEADERS(uuid/uuid.h)
+       AC_CHECK_HEADERS(uuid/uuid.h)
 
-  if test x"$ac_cv_header_uuid_uuid_h" != x"yes"; then
-       if test x"$with_dnsupdate_support" = x"yes"; then
-        AC_MSG_ERROR(uuid.h is needed to enable DNS Updates support)
-       else
-        AC_MSG_WARN(uuid.h is needed to enable DNS Updates support)
+       
+       if test x"$ac_cv_header_uuid_uuid_h" != x"yes"; then
+               if test x"$with_dnsupdate_support" = x"yes"; then
+                       AC_MSG_ERROR(uuid.h is needed to enable DNS Updates support)
+               else
+                       AC_MSG_NOTICE(uuid.h is needed to enable DNS Updates support)
+               fi
+               with_dnsupdate_support=no
        fi
-       with_dnsupdate_support=no
-  fi
 fi
 
 if test x"$with_dnsupdate_support" != x"no"; then
@@ -4267,6 +4277,10 @@ if test x"$with_dnsupdate_support" != x"no"; then
            with_dnsupdate_support=no
        ])
 fi
+  # finally print out the result:
+AC_MSG_CHECKING(whether DNS Updates support is used)
+AC_MSG_RESULT([$with_dnsupdate_support])
+
 
 #################################################
 # check for automount support
@@ -6023,7 +6037,6 @@ WINBIND_NSS="../nsswitch/libnss_winbind.$SHLIBEXT"
 WINBIND_WINS_NSS="../nsswitch/libnss_wins.$SHLIBEXT"
 WINBIND_NSS_LDSHFLAGS=$LDSHFLAGS
 NSSSONAMEVERSIONSUFFIX=""
-WINBIND_NSS_PTHREAD=""
 
 case "$host_os" in
        *linux* | gnu* | k*bsd*-gnu | kopensolaris*-gnu)
@@ -6165,12 +6178,6 @@ else
         AC_MSG_RESULT(no$winbind_no_reason)
 fi
 
-AC_CHECK_LIB(pthread, pthread_mutex_lock, [WINBIND_NSS_PTHREAD="-lpthread"
-                       AC_DEFINE(HAVE_PTHREAD, 1, [whether pthread exists])
-                       samba_cv_HAVE_PTHREAD=yes],
-                       samba_cv_HAVE_PTHREAD=no)
-
-AC_SUBST(WINBIND_NSS_PTHREAD)
 AC_SUBST(WINBIND_NSS)
 AC_SUBST(WINBIND_WINS_NSS)
 AC_SUBST(WINBIND_NSS_LDSHFLAGS)
@@ -6326,16 +6333,76 @@ if test x"$enable_avahi" != x"no"; then
     fi
 fi
 
+
+#################################################
+# Set pthread stuff
+
+PTHREAD_CFLAGS=error
+PTHREAD_LDFLAGS=error
+
+# If it's error, then the user didn't 
+# define it.
+if test "x$PTHREAD_LDFLAGS" = xerror; then
+  AC_CHECK_LIB(pthread, pthread_attr_init, [
+            PTHREAD_CFLAGS="-D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS"
+            PTHREAD_LDFLAGS="-lpthread" ])
+fi
+
+if test "x$PTHREAD_LDFLAGS" = xerror; then
+  AC_CHECK_LIB(pthreads, pthread_attr_init, [
+            PTHREAD_CFLAGS="-D_THREAD_SAFE"
+            PTHREAD_LDFLAGS="-lpthreads" ])
+fi
+
+if test "x$PTHREAD_LDFLAGS" = xerror; then
+   AC_CHECK_LIB(c_r, pthread_attr_init, [
+               PTHREAD_CFLAGS="-D_THREAD_SAFE -pthread"
+               PTHREAD_LDFLAGS="-pthread" ])
+fi
+
+if test "x$PTHREAD_LDFLAGS" = xerror; then
+   AC_CHECK_FUNC(pthread_attr_init, [
+                PTHREAD_CFLAGS="-D_REENTRANT"
+                PTHREAD_LDFLAGS="-lpthread" ])
+fi
+
+# especially for HP-UX, where the AC_CHECK_FUNC macro fails to test for
+# pthread_attr_init. On pthread_mutex_lock it works there...
+if test "x$PTHREAD_LDFLAGS" = xerror; then
+   AC_CHECK_LIB(pthread, pthread_mutex_lock, [
+               PTHREAD_CFLAGS="-D_REENTRANT"
+               PTHREAD_LDFLAGS="-lpthread" ])
+fi
+
+AC_SUBST(PTHREAD_CFLAGS)
+AC_SUBST(PTHREAD_LDFLAGS)
+
+samba_cv_HAVE_PTHREAD=no
+if test x"$PTHREAD_CFLAGS" != xerror -a x"$PTHREAD_LDFLAGS" != xerror; then
+       samba_cv_HAVE_PTHREAD=yes
+       # now check for pthread.h with pthread-correct CFLAGS and LDFLAGS:
+       ac_save_CFLAGS=$CFLAGS
+       CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+       ac_save_LDFLAGS=$LDFLAGS
+       LDFLAGS="$LDFLAGS $PTHREAD_LDFLAGS"
+       AC_CHECK_HEADERS(pthread.h)
+       CFLAGS=$ac_save_CFLAGS
+       LDFLAGS=$ac_save_LDFLAGS
+fi
+
 #################################################
 # Check if user wants pthreadpool support
 
 AC_ARG_ENABLE(pthreadpool,
-[AS_HELP_STRING([--enable-pthreadpool], [Enable pthreads pool helper support (default=auto)])])
+[AS_HELP_STRING([--enable-pthreadpool], [Enable pthreads pool helper support (default=no)])])
+
+if test x"$enable_pthreadpool" = xyes -a x"$samba_cv_HAVE_PTHREAD" != x"yes"; then
+       AC_MSG_ERROR([pthreadpool support cannot be enabled when pthread support was found])
+fi
 
-if test x"$enable_pthreadpool" != x"no" -a x"$samba_cv_HAVE_PTHREAD" = x"yes"; then
-    AC_TRY_LINK([#include "pthread.h"],
-    [pthread_create(NULL, NULL, NULL, NULL)],
-                   ,LIBS="$LIBS -lpthread")
+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.o")
 fi