]> arthur.barton.de Git - netatalk.git/blobdiff - macros/netatalk.m4
Fix LDAP test
[netatalk.git] / macros / netatalk.m4
index 4b136177b25b21620740aba4f432b26effcca2e7..7c5210342b4fc934c4f76322f4f7ac08c7802657 100644 (file)
@@ -1,5 +1,85 @@
 dnl Kitchen sink for configuration macros
 
+dnl Whether to disable bundled libevent
+AC_DEFUN([AC_NETATALK_LIBEVENT], [
+    AC_MSG_CHECKING([whether to disable bundled libevent (define CPPFLAGS and LDFLAGS otherwise appropiately to pick up installed version)])
+    AC_ARG_ENABLE(
+        bundled-libevent,
+        [AC_HELP_STRING(
+            [--disable-bundled-libevent],
+            [whether the bundled version of libevent shall not be used (define CPPFLAGS and LDFLAGS otherwise appropiately to pick up installed version)]
+        )],
+        use_bundled_libevent=$enableval,
+        use_bundled_libevent=yes
+    )
+
+    if test x"$use_bundled_libevent" = x"yes" ; then
+        AC_CONFIG_SUBDIRS([libevent])
+    fi
+    AM_CONDITIONAL(USE_BUILTIN_LIBEVENT, test x"$use_bundled_libevent" = x"yes")
+])
+
+dnl Filesystem Hierarchy Standard (FHS) compatibility
+AC_DEFUN([AC_NETATALK_FHS], [
+AC_MSG_CHECKING([whether to use Filesystem Hierarchy Standard (FHS) compatibility])
+AC_ARG_ENABLE(fhs,
+       [  --enable-fhs            use Filesystem Hierarchy Standard (FHS) compatibility],[
+       if test "$enableval" = "yes"; then
+               uams_path="${libdir}/netatalk"
+               sysconfdir="/etc"
+               PKGCONFDIR=${sysconfdir}/netatalk
+               SERVERTEXT="${PKGCONFDIR}/msg"
+               use_pam_so=yes
+               mandir="/usr/share/man"
+               AC_DEFINE(FHS_COMPATIBILITY, 1, [Define if you want compatibily with the FHS])
+               AC_MSG_RESULT([yes])
+       else
+               AC_MSG_RESULT([no])
+       fi
+       ],[
+               AC_MSG_RESULT([no])
+       ]
+)])
+
+dnl 64bit platform check
+AC_DEFUN([AC_NETATALK_64BIT_LIBS], [
+AC_MSG_CHECKING([whether to check for 64bit libraries])
+# Test if the compiler is in 64bit mode
+echo 'int i;' > conftest.$ac_ext
+atalk_cv_cc_64bit_output=no
+if AC_TRY_EVAL(ac_compile); then
+    case `/usr/bin/file conftest.$ac_objext` in
+    *"ELF 64"*)
+      atalk_cv_cc_64bit_output=yes
+      ;;
+    esac
+fi
+rm -rf conftest*
+
+case $host_cpu:$atalk_cv_cc_64bit_output in
+powerpc64:yes | s390x:yes | sparc*:yes | x86_64:yes | i386:yes)
+    case $target_os in
+    solaris2*)
+        AC_MSG_RESULT([yes])
+        atalk_libname="lib/64"
+        ;;
+    *bsd* | dragonfly*)
+        AC_MSG_RESULT([no])
+        atalk_libname="lib"
+        ;;
+    *)
+        AC_MSG_RESULT([yes])
+        atalk_libname="lib64"
+        ;;
+    esac
+    ;;
+*:*)
+    AC_MSG_RESULT([no])
+    atalk_libname="lib"
+    ;;
+esac
+])
+
 dnl Check for optional admin group support
 AC_DEFUN([AC_NETATALK_ADMIN_GROUP], [
     netatalk_cv_admin_group=yes
@@ -143,14 +223,14 @@ AC_ARG_ENABLE(shell-check,
 ])
 
 dnl Check for optional sysv initscript install
-AC_DEFUN([AC_NETATALK_SYSV_STYLE], [
-    AC_ARG_WITH(sysv-style,
-                [  --with-sysv-style       use OS specific sysv config [[redhat-sysv|redhat-systemd|suse-sysv|suse-systemd|gentoo|netbsd|debian|systemd]]],
-                sysv_style="$withval", sysv_style=none
+AC_DEFUN([AC_NETATALK_INIT_STYLE], [
+    AC_ARG_WITH(init-style,
+                [  --with-init-style       use OS specific init config [[redhat-sysv|redhat-systemd|suse-sysv|suse-systemd|gentoo|netbsd|debian|systemd]]],
+                init_style="$withval", init_style=none
     )
-    case "$sysv_style" in 
+    case "$init_style" in 
     "redhat")
-           AC_MSG_ERROR([--enable-redhat is obsoleted. Use --enable-redhat-sysv or --enable-redhat-systemd.])
+           AC_MSG_ERROR([--with-init-style=redhat is obsoleted. Use redhat-sysv or redhat-systemd.])
         ;;
     "redhat-sysv")
            AC_MSG_RESULT([enabling redhat-style sysv (upstart) configuration])
@@ -159,7 +239,7 @@ AC_DEFUN([AC_NETATALK_SYSV_STYLE], [
            AC_MSG_RESULT([enabling redhat-style systemd support])
            ;;
     "suse")
-           AC_MSG_RESULT([--enable-suse is obsoleted. Use --enable-suse-sysv or --enable-suse-systemd])
+           AC_MSG_ERROR([--with-init-style=suse is obsoleted. Use suse-sysv or suse-systemd.])
         ;;
     "suse-sysv")
            AC_MSG_RESULT([enabling suse-style sysv configuration])
@@ -183,16 +263,16 @@ AC_DEFUN([AC_NETATALK_SYSV_STYLE], [
            AC_MSG_RESULT([disabling sysv support])
         ;;
     esac
-    AM_CONDITIONAL(USE_NETBSD, test x$sysv_style = xnetbsd)
-    AM_CONDITIONAL(USE_REDHAT_SYSV, test x$sysv_style = xredhat-sysv)
-    AM_CONDITIONAL(USE_SUSE_SYSV, test x$sysv_style = xsuse-sysv)
+    AM_CONDITIONAL(USE_NETBSD, test x$init_style = xnetbsd)
+    AM_CONDITIONAL(USE_REDHAT_SYSV, test x$init_style = xredhat-sysv)
+    AM_CONDITIONAL(USE_SUSE_SYSV, test x$init_style = xsuse-sysv)
     AM_CONDITIONAL(USE_SHADOWPW, test x$shadowpw = xyes)
-    AM_CONDITIONAL(USE_TRU64, test x$sysv_style = xtru64)
-    AM_CONDITIONAL(USE_SOLARIS, test x$sysv_style = xsolaris)
-    AM_CONDITIONAL(USE_GENTOO, test x$sysv_style = xgentoo)
-    AM_CONDITIONAL(USE_DEBIAN, test x$sysv_style = xdebian)
-    AM_CONDITIONAL(USE_SYSTEMD, test x$sysv_style = xsystemd || test x$sysv_style = xredhat-systemd || test x$sysv_style = xsuse-systemd)
-    AM_CONDITIONAL(USE_UNDEF, test x$sysv_style = xnone)
+    AM_CONDITIONAL(USE_TRU64, test x$init_style = xtru64)
+    AM_CONDITIONAL(USE_SOLARIS, test x$init_style = xsolaris)
+    AM_CONDITIONAL(USE_GENTOO, test x$init_style = xgentoo)
+    AM_CONDITIONAL(USE_DEBIAN, test x$init_style = xdebian)
+    AM_CONDITIONAL(USE_SYSTEMD, test x$init_style = xsystemd || test x$init_style = xredhat-systemd || test x$init_style = xsuse-systemd)
+    AM_CONDITIONAL(USE_UNDEF, test x$init_style = xnone)
 
 ])
 
@@ -297,7 +377,7 @@ if test x"$this_os" = "xsolaris"; then
     AC_DEFINE(__EXTENSIONS__,  1, [Solaris compilation environment])
        CFLAGS="-I\$(top_srcdir)/sys/generic $CFLAGS"
        need_dash_r=yes
-       sysv_style=solaris
+       init_style=solaris
 
        solaris_module=no
        AC_MSG_CHECKING([if we can build Solaris kernel module])
@@ -380,6 +460,10 @@ netatalk_cv_HAVE_TIMEOUT_ID_T=yes,netatalk_cv_HAVE_TIMEOUT_ID_T=no,netatalk_cv_H
        AC_SUBST(KLDFLAGS)
 fi
 
+dnl Whether to run ldconfig after installing libraries
+AC_PATH_PROG(NETA_LDCONFIG, ldconfig, , [$PATH$PATH_SEPARATOR/sbin$PATH_SEPARATOR/bin$PATH_SEPARATOR/usr/sbin$PATH_SEPARATOR/usr/bin])
+echo NETA_LDCONFIG = $NETA_LDCONFIG
+AM_CONDITIONAL(RUN_LDCONFIG, test x"$this_os" = x"linux" -a x"$NETA_LDCONFIG" != x"")
 ])
 
 dnl Check for building PGP UAM module
@@ -428,6 +512,46 @@ fi
 AM_CONDITIONAL(USE_GSSAPI, test x"$netatalk_cv_build_krb5_uam" = x"yes")
 ])
 
+dnl Check if we can directly use Kerberos 5 API, used for reading keytabs
+dnl and automatically construction DirectoryService names from that, instead
+dnl of requiring special configuration in afp.conf
+AC_DEFUN([AC_NETATALK_KERBEROS], [
+AC_MSG_CHECKING([for Kerberos 5 (necessary for GetSrvrInfo:DirectoryNames support)])
+AC_ARG_WITH([kerberos],
+    [AS_HELP_STRING([--with-kerberos], [Kerberos 5 support (default=auto)])],
+    [],
+    [with_kerberos=auto])
+AC_MSG_RESULT($with_kerberos)
+
+if test x"$with_kerberos" != x"no"; then
+   have_krb5_header="no"
+   AC_CHECK_HEADERS([krb5/krb5.h krb5.h], [have_krb5_header="yes"; break])
+   if test x"$have_krb5_header" = x"no" && test x"$with_kerberos" != x"auto"; then
+      AC_MSG_FAILURE([--with-kerberos was given, but no headers found])
+   fi
+
+   AC_PATH_PROG([KRB5_CONFIG], [krb5-config])
+   AC_MSG_CHECKING([for krb5-config])
+   if test -x "$KRB5_CONFIG"; then
+      AC_MSG_RESULT([$KRB5_CONFIG])
+      KRB5_CFLAGS="`$KRB5_CONFIG --cflags krb5`"
+      KRB5_LIBS="`$KRB5_CONFIG --libs krb5`"
+      AC_SUBST(KRB5_CFLAGS)
+      AC_SUBST(KRB5_LIBS)
+      with_kerberos="yes"
+   else
+      AC_MSG_RESULT([not found])
+      if test x"$with_kerberos" != x"auto"; then
+         AC_MSG_FAILURE([--with-kerberos was given, but krb5-config could not be found])
+      fi
+   fi
+fi
+
+if test x"$with_kerberos" = x"yes"; then
+   AC_DEFINE([HAVE_KERBEROS], [1], [Define if Kerberos 5 is available])
+fi
+])
+
 dnl Check for overwrite the config files or not
 AC_DEFUN([AC_NETATALK_OVERWRITE_CONFIG], [
 AC_MSG_CHECKING([whether configuration files should be overwritten])
@@ -446,34 +570,48 @@ AC_MSG_CHECKING(for LDAP (necessary for client-side ACL visibility))
 AC_ARG_WITH(ldap,
     [AS_HELP_STRING([--with-ldap],
         [LDAP support (default=auto)])],
-    [ case "$withval" in
-      yes|no)
-          with_ldap="$withval"
-                 ;;
-      *)
-          with_ldap=auto
-          ;;
-      esac ])
-AC_MSG_RESULT($with_ldap)
+        netatalk_cv_ldap=$withval,
+        netatalk_cv_ldap=auto
+        )
+AC_MSG_RESULT($netatalk_cv_ldap)
+
+save_CFLAGS=$CFLAGS
+save_LDLFLAGS=$LDLFLAGS
+CFLAGS=""
+LDLFLAGS=""
 
-if test x"$with_ldap" != x"no" ; then
-       AC_CHECK_HEADER([ldap.h], with_ldap=yes,
-        [ if test x"$with_ldap" = x"yes" ; then
+if test x"$netatalk_cv_ldap" != x"no" ; then
+   if test x"$netatalk_cv_ldap" != x"yes" -a x"$netatalk_cv_ldap" != x"auto"; then
+       CFLAGS=-I$netatalk_cv_ldap/include
+       LDLFLAGS=-L$netatalk_cv_ldap/lib
+   fi
+       AC_CHECK_HEADER([ldap.h], netatalk_cv_ldap=yes,
+        [ if test x"$netatalk_cv_ldap" = x"yes" ; then
             AC_MSG_ERROR([Missing LDAP headers])
         fi
-               with_ldap=no
+               netatalk_cv_ldap=no
         ])
-       AC_CHECK_LIB(ldap, ldap_init, with_ldap=yes,
-        [ if test x"$with_ldap" = x"yes" ; then
+       AC_CHECK_LIB(ldap, ldap_init, netatalk_cv_ldap=yes,
+        [ if test x"$netatalk_cv_ldap" = x"yes" ; then
             AC_MSG_ERROR([Missing LDAP library])
         fi
-               with_ldap=no
+               netatalk_cv_ldap=no
         ])
 fi
 
-if test x"$with_ldap" = x"yes"; then
+if test x"$netatalk_cv_ldap" = x"yes"; then
+   echo "********************************************************************"
+    LDAP_CFLAGS=$CFLAGS
+    LDAP_LDLFLAGS=$LDLFLAGS
+    LDAP_LIBS=-lldap
        AC_DEFINE(HAVE_LDAP,1,[Whether LDAP is available])
+    AC_SUBST(LDAP_CFLAGS)
+    AC_SUBST(LDAP_LDLFLAGS)
+    AC_SUBST(LDAP_LIBS)
 fi
+
+CFLAGS=$save_CFLAGS
+LDLFLAGS=$save_LDLFLAGS
 ])
 
 dnl Check for ACL support
@@ -630,7 +768,7 @@ case "$this_os" in
 
   *solaris*)
        AC_CHECK_FUNCS([attropen],
-                   [neta_cv_eas_sys_found=yes],
+                   [neta_cv_eas_sys_found=yes; AC_DEFINE(HAVE_EAFD, 1, [extattr API has full fledged fds for EAs])],
                    [neta_cv_eas_sys_not_found=yes])
   ;;