]> arthur.barton.de Git - netatalk.git/blobdiff - macros/netatalk.m4
Merge remote-tracking branch 'origin/develop' into spotlight
[netatalk.git] / macros / netatalk.m4
index 7da9e64b4facf1e11ae7869f3cc5514041204e51..f5e48b8bbed810a658d3f1f343c5c217ab6c42b2 100644 (file)
 dnl Kitchen sink for configuration macros
 
+dnl Check for dtrace
+AC_DEFUN([AC_NETATALK_DTRACE], [
+  AC_ARG_WITH(dtrace,
+    AS_HELP_STRING(
+      [--with-dtrace],
+      [Enable dtrace probes (default: enabled if dtrace found)]
+    ),
+    [WDTRACE=$withval],
+    [WDTRACE=auto]
+  )
+  if test "x$WDTRACE" = "xyes" -o "x$WDTRACE" = "xauto" ; then
+    AC_CHECK_PROG([atalk_cv_have_dtrace], [dtrace], [yes], [no])
+    if test "x$atalk_cv_have_dtrace" = "xno" ; then
+      if test "x$WDTRACE" = "xyes" ; then
+        AC_MSG_FAILURE([dtrace requested but not found])
+      fi
+      WDTRACE="no"
+    else
+      WDTRACE="yes"
+    fi
+  fi
+
+  if test x"$WDTRACE" = x"yes" ; then
+    AC_DEFINE([WITH_DTRACE], [1], [dtrace probes])
+    DTRACE_LIBS=""
+    if test x"$this_os" = x"freebsd" ; then
+      DTRACE_LIBS="-lelf"
+    fi
+    AC_SUBST(DTRACE_LIBS)
+  fi
+  AM_CONDITIONAL(WITH_DTRACE, test "x$WDTRACE" = "xyes")
+])
+
+dnl Check for dbus-glib, for AFP stats
+AC_DEFUN([AC_NETATALK_DBUS_GLIB], [
+    atalk_cv_with_dbus=no
+    PKG_CHECK_MODULES(DBUS, dbus-1 >= 1.1, have_dbus=yes, have_dbus=no)
+    PKG_CHECK_MODULES(DBUS_GLIB, dbus-glib-1, have_dbus_glib=yes, have_dbus_glib=no)
+    PKG_CHECK_MODULES(DBUS_GTHREAD, gthread-2.0, have_dbus_gthread=yes, have_dbus_gthread=no)
+    AC_SUBST(DBUS_CFLAGS)
+    AC_SUBST(DBUS_LIBS)
+    AC_SUBST(DBUS_GLIB_CFLAGS)
+    AC_SUBST(DBUS_GLIB_LIBS)
+    AC_SUBST(DBUS_GTHREAD_CFLAGS)
+    AC_SUBST(DBUS_GTHREAD_LIBS)
+    if test x$have_dbus_glib = xyes -a x$have_dbus = xyes -a x$have_dbus_gthread = xyes ; then
+        saved_CFLAGS=$CFLAGS
+        saved_LIBS=$LIBS
+        CFLAGS="$CFLAGS $DBUS_GLIB_CFLAGS"
+        LIBS="$LIBS $DBUS_GLIB_LIBS"
+        AC_CHECK_FUNC([dbus_g_bus_get_private], [atalk_cv_with_dbus=yes], [atalk_cv_with_dbus=no])
+        CFLAGS="$saved_CFLAGS"
+        LIBS="$saved_LIBS"
+    fi
+    AM_CONDITIONAL(HAVE_DBUS_GLIB, test x$atalk_cv_with_dbus = xyes)
+
+    AC_ARG_WITH(
+        dbus-sysconf-dir,
+        [AS_HELP_STRING([--with-dbus-sysconf-dir=PATH],[Path to dbus system bus security configuration directory (default: ${sysconfdir}/dbus-1/system.d/)])],
+        ac_cv_dbus_sysdir=$withval,
+        ac_cv_dbus_sysdir='${sysconfdir}/dbus-1/system.d'
+    )
+
+    if test x$atalk_cv_with_dbus = xyes ; then
+        AC_DEFINE(HAVE_DBUS_GLIB, 1, [Define if support for dbus-glib was found])
+        DBUS_SYS_DIR="$ac_cv_dbus_sysdir"
+        AC_SUBST(DBUS_SYS_DIR)
+    fi
+])
+
+dnl Whether to enable developer build
+AC_DEFUN([AC_DEVELOPER], [
+    AC_MSG_CHECKING([whether to enable developer build])
+    AC_ARG_ENABLE(
+        developer,
+        AS_HELP_STRING([--enable-developer], [whether to enable developer build (ABI checking)]),
+        enable_dev=$enableval,
+        enable_dev=no
+    )
+    AC_MSG_RESULT([$enable_dev])
+    AM_CONDITIONAL(DEVELOPER, test x"$enable_dev" = x"yes")
+])
+
+dnl Tracker, for Spotlight
+AC_DEFUN([AC_NETATALK_SPOTLIGHT], [
+    ac_cv_have_tracker=no
+    dnl Tracker SPARQL
+    ac_cv_tracker_pkg_default=tracker-sparql-0.12
+    AC_ARG_WITH([tracker-pkg-config],
+       [AS_HELP_STRING([--with-tracker-pkg-config],[name of the Tracker SPARQL pkg in pkg-config])],
+       [ac_cv_tracker_pkg=$withval],
+       [ac_cv_tracker_pkg=$ac_cv_tracker_pkg_default])
+
+    PKG_CHECK_MODULES([TRACKER], [$ac_cv_tracker_pkg >= 0.12], [ac_cv_have_tracker_sparql=yes], [ac_cv_have_tracker_sparql=no])
+
+    if test x"$ac_cv_have_tracker_sparql" = x"no" ; then
+        if test x"$need_tracker" = x"yes" ; then
+            AC_MSG_ERROR([$ac_cv_tracker_pkg not found])
+        fi
+    else
+        AC_DEFINE(HAVE_TRACKER, 1, [Define if Tracker is available])
+        AC_DEFINE(HAVE_TRACKER_SPARQL, 1, [Define if Tracker SPARQL is available])
+        ac_cv_tracker_prefix=`pkg-config --variable=prefix $ac_cv_tracker_pkg`
+        AC_DEFINE_UNQUOTED(TRACKER_PREFIX, ["$ac_cv_tracker_prefix"], [Path to Tracker])
+       fi
+
+    ac_cv_tracker_miner_pkg_default=tracker-miner-0.12
+    AC_ARG_WITH([tracker-miner-pkg-config],
+       [AS_HELP_STRING([--with-tracker-miner-pkg-config],[name of the Tracker miner pkg in pkg-config])],
+       [ac_cv_tracker_miner_pkg=$withval],
+       [ac_cv_tracker_miner_pkg=$ac_cv_tracker_miner_pkg_default])
+
+    PKG_CHECK_MODULES([TRACKER_MINER], [$ac_cv_tracker_miner_pkg >= 0.12], [ac_cv_have_tracker_miner=yes], [ac_cv_have_tracker_miner=no])
+
+    if test x"$ac_cv_have_tracker_miner" = x"yes" ; then
+        AC_DEFINE(HAVE_TRACKER_MINER, 1, [Define if Tracker miner library is available])
+        AC_SUBST(TRACKER_MINER_CFLAGS)
+        AC_SUBST(TRACKER_MINER_LIBS)
+       fi
+
+    dnl Test for Tracker 0.6 on Solaris and derived platforms
+    if test x"$this_os" = x"solaris" ; then
+        PKG_CHECK_MODULES([TRACKER], [tracker >= 0.6], [ac_cv_have_tracker_rdf=yes], [ac_cv_have_tracker_rdf=no])
+        if test x"$ac_cv_have_tracker_rdf" = x"yes" ; then
+            AC_DEFINE(HAVE_TRACKER, 1, [Define if Tracker is available])
+            AC_DEFINE(HAVE_TRACKER_RDF, 1, [Define if Tracker 0.6 with support for RDF queries is available])
+            ac_cv_tracker_prefix=`pkg-config --variable=prefix tracker`
+            AC_DEFINE_UNQUOTED(TRACKER_RDF_PREFIX, ["$ac_cv_tracker_prefix"], [Path to Tracker])
+           fi
+    fi
+
+    if test x"$ac_cv_have_tracker_sparql" = x"yes" -o x"$ac_cv_have_tracker_rdf" = x"yes" ; then
+       ac_cv_have_tracker=yes
+    fi
+    AC_SUBST(TRACKER_CFLAGS)
+    AC_SUBST(TRACKER_LIBS)
+    AM_CONDITIONAL(HAVE_TRACKER_SPARQL, [test x"$ac_cv_have_tracker_sparql" = x"yes"])
+    AM_CONDITIONAL(HAVE_TRACKER_RDF, [test x"$ac_cv_have_tracker_rdf" = x"yes"])
+])
+
 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,
+    AC_MSG_CHECKING([whether to use bundled libevent])
+    AC_ARG_WITH(
+        libevent,
+        [AS_HELP_STRING([--with-libevent],[whether to use the bundled libevent (default: yes)])],
+        use_bundled_libevent=$withval,
         use_bundled_libevent=yes
     )
-
+    AC_ARG_WITH(
+        libevent-header,
+        [AS_HELP_STRING([--with-libevent-header],[path to libevent header files])],
+        [use_bundled_libevent=no; LIBEVENT_CFLAGS=-I$withval]
+    )
+    AC_ARG_WITH(
+        libevent-lib,
+        [AS_HELP_STRING([--with-libevent-lib],[path to libevent library])],
+        [use_bundled_libevent=no; LIBEVENT_LDFLAGS=-L$withval]
+    )
+    if test x"$LIBEVENT_CFLAGS" = x"-Iyes" -o x"$LIBEVENT_LDFLAGS" = x"-Lyes" ; then
+        AC_MSG_ERROR([--with-libevent requires a path])
+    fi
+    AC_MSG_RESULT([$use_bundled_libevent])
     if test x"$use_bundled_libevent" = x"yes" ; then
         AC_CONFIG_SUBDIRS([libevent])
     fi
+    AC_SUBST(LIBEVENT_CFLAGS)
+    AC_SUBST(LIBEVENT_LDFLAGS)
     AM_CONDITIONAL(USE_BUILTIN_LIBEVENT, test x"$use_bundled_libevent" = x"yes")
 ])
 
@@ -25,21 +177,59 @@ AC_MSG_CHECKING([whether to use Filesystem Hierarchy Standard (FHS) compatibilit
 AC_ARG_ENABLE(fhs,
        [  --enable-fhs            use Filesystem Hierarchy Standard (FHS) compatibility],[
        if test "$enableval" = "yes"; then
-               uams_path="${libdir}/netatalk"
+               bindir="/bin"
+               sbindir="/sbin"
                sysconfdir="/etc"
-               PKGCONFDIR=${sysconfdir}/netatalk
-               SERVERTEXT="${PKGCONFDIR}/msg"
-               use_pam_so=yes
+               libdir="/lib"
+               localstatedir="/var"
                mandir="/usr/share/man"
+               uams_path="${libdir}/netatalk"
+               PKGCONFDIR="${sysconfdir}"
+               SERVERTEXT="${localstatedir}/netatalk/msg"
+               use_pam_so=yes
                AC_DEFINE(FHS_COMPATIBILITY, 1, [Define if you want compatibily with the FHS])
                AC_MSG_RESULT([yes])
+        atalk_cv_fhs_compat=yes
        else
                AC_MSG_RESULT([no])
+        atalk_cv_fhs_compat=no
        fi
        ],[
                AC_MSG_RESULT([no])
-       ]
-)])
+        atalk_cv_fhs_compat=no
+])])
+
+dnl netatalk lockfile path
+AC_DEFUN([AC_NETATALK_LOCKFILE], [
+    AC_MSG_CHECKING([netatalk lockfile path])
+    AC_ARG_WITH(
+        lockfile,
+        [AS_HELP_STRING([--with-lockfile=PATH],[Path of netatalk lockfile])],
+        ac_cv_netatalk_lock=$withval,
+        ac_cv_netatalk_lock=""
+    )
+    if test -z "$ac_cv_netatalk_lock" ; then
+        ac_cv_netatalk_lock=/var/spool/locks/netatalk
+        if test x"$atalk_cv_fhs_compat" = x"yes" ; then
+            ac_cv_netatalk_lock=/var/run/netatalk.pid
+        else
+            case "$host_os" in
+            *freebsd*)
+                ac_cv_netatalk_lock=/var/spool/lock/netatalk
+                ;;
+            *netbsd*|*openbsd*)
+                ac_cv_netatalk_lock=/var/run/netatalk.pid
+                ;;
+            *linux*)
+                ac_cv_netatalk_lock=/var/lock/netatalk
+                ;;
+            esac
+        fi
+    fi
+    AC_DEFINE_UNQUOTED(PATH_NETATALK_LOCK, ["$ac_cv_netatalk_lock"], [netatalk lockfile path])
+    AC_SUBST(PATH_NETATALK_LOCK, ["$ac_cv_netatalk_lock"])
+    AC_MSG_RESULT([$ac_cv_netatalk_lock])
+])
 
 dnl 64bit platform check
 AC_DEFUN([AC_NETATALK_64BIT_LIBS], [
@@ -103,7 +293,7 @@ dnl Check for optional cracklib support
 AC_DEFUN([AC_NETATALK_CRACKLIB], [
 netatalk_cv_with_cracklib=no
 AC_ARG_WITH(cracklib,
-       [  --with-cracklib=DICT    enable/set location of cracklib dictionary],[
+       [  --with-cracklib[[=DICT]]  enable/set location of cracklib dictionary [[no]]],[
        if test "x$withval" != "xno" ; then
                cracklib="$withval"
                AC_CHECK_LIB(crack, main, [
@@ -222,10 +412,10 @@ AC_ARG_ENABLE(shell-check,
 )
 ])
 
-dnl Check for optional sysv initscript install
+dnl Check for optional initscript install
 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]]],
+                [  --with-init-style       use OS specific init config [[redhat-sysv|redhat-systemd|suse-sysv|suse-systemd|gentoo|netbsd|debian|solaris|systemd]]],
                 init_style="$withval", init_style=none
     )
     case "$init_style" in 
@@ -233,47 +423,67 @@ AC_DEFUN([AC_NETATALK_INIT_STYLE], [
            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])
+           AC_MSG_RESULT([enabling redhat-style sysv initscript support])
+           ac_cv_init_dir="/etc/rc.d/init.d"
            ;;
     "redhat-systemd")
            AC_MSG_RESULT([enabling redhat-style systemd support])
+           ac_cv_init_dir="/lib/systemd/system"
            ;;
     "suse")
            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])
+           AC_MSG_RESULT([enabling suse-style sysv initscript support])
+           ac_cv_init_dir="/etc/init.d"
            ;;
     "suse-systemd")
            AC_MSG_RESULT([enabling suse-style systemd support (>=openSUSE12.1)])
+           ac_cv_init_dir="/lib/systemd/system"
            ;;
     "gentoo")
-           AC_MSG_RESULT([enabling gentoo-style sysv support])
+           AC_MSG_RESULT([enabling gentoo-style initscript support])
+           ac_cv_init_dir="/etc/init.d"
         ;;
     "netbsd")
-           AC_MSG_RESULT([enabling netbsd-style sysv support])
+           AC_MSG_RESULT([enabling netbsd-style initscript support])
+           ac_cv_init_dir="/etc/rc.d"
         ;;
     "debian")
-           AC_MSG_RESULT([enabling debian-style sysv support])
+           AC_MSG_RESULT([enabling debian-style initscript support])
+           ac_cv_init_dir="/etc/init.d"
+        ;;
+    "solaris")
+           AC_MSG_RESULT([enabling solaris-style SMF support])
+           ac_cv_init_dir="/lib/svc/manifest/network/"
         ;;
     "systemd")
-           AC_MSG_RESULT([use general systemd configuration])
+           AC_MSG_RESULT([enabling general systemd support])
+           ac_cv_init_dir="/lib/systemd/system"
+        ;;
+    "none")
+           AC_MSG_RESULT([disabling init-style support])
+           ac_cv_init_dir="none"
         ;;
     *)
-           AC_MSG_RESULT([disabling sysv support])
+           AC_MSG_ERROR([illegal init-style])
         ;;
     esac
     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$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)
 
+    AC_ARG_WITH(init-dir,
+                [  --with-init-dir=PATH    path to OS specific init directory],
+                ac_cv_init_dir="$withval", ac_cv_init_dir="$ac_cv_init_dir"
+    )
+    INIT_DIR="$ac_cv_init_dir"
+    AC_SUBST(INIT_DIR, ["$ac_cv_init_dir"])
 ])
 
 dnl OS specific configuration
@@ -328,7 +538,7 @@ fi
 dnl ----- Linux specific -----
 if test x"$this_os" = "xlinux"; then 
        AC_MSG_RESULT([ * Linux specific configuration])
-       
+    AC_DEFINE(LINUX, 1, [OS is Linux]) 
        dnl ----- check if we need the quotactl wrapper
     AC_CHECK_HEADERS(linux/dqblk_xfs.h,,
                [AC_CHECK_HEADERS(linux/xqm.h linux/xfs_fs.h)
@@ -443,13 +653,11 @@ if test x"$this_os" = "xsolaris"; then
           fi
 
            AC_CACHE_CHECK([for timeout_id_t],netatalk_cv_HAVE_TIMEOUT_ID_T,[
-           AC_TRY_LINK([\
+           AC_LINK_IFELSE([AC_LANG_PROGRAM([[\
 #include <sys/stream.h>
-#include <sys/ddi.h>],
-[\
+#include <sys/ddi.h>]], [[\
 timeout_id_t dummy;
-],
-netatalk_cv_HAVE_TIMEOUT_ID_T=yes,netatalk_cv_HAVE_TIMEOUT_ID_T=no,netatalk_cv_HAVE_TIMEOUT_ID_T=cross)])
+]])],[netatalk_cv_HAVE_TIMEOUT_ID_T=yes],[netatalk_cv_HAVE_TIMEOUT_ID_T=no])])
 
           AC_DEFINE(HAVE_TIMEOUT_ID_T, test x"$netatalk_cv_HAVE_TIMEOUT_ID" = x"yes", [define for timeout_id_t])
        fi
@@ -550,6 +758,15 @@ fi
 if test x"$with_kerberos" = x"yes"; then
    AC_DEFINE([HAVE_KERBEROS], [1], [Define if Kerberos 5 is available])
 fi
+
+dnl Check for krb5_free_unparsed_name and krb5_free_error_message
+save_CFLAGS="$CFLAGS"
+save_LIBS="$LIBS"
+CFLAGS="$KRB5_CFLAGS"
+LIBS="$KRB5_LIBS"
+AC_CHECK_FUNCS([krb5_free_unparsed_name krb5_free_error_message krb5_free_keytab_entry_contents krb5_kt_free_entry])
+CFLAGS="$save_CFLAGS"
+LIBS="$save_LIBS"
 ])
 
 dnl Check for overwrite the config files or not
@@ -686,17 +903,15 @@ if test x"$with_acl_support" = x"yes" ; then
                AC_CACHE_CHECK([for POSIX ACL support],netatalk_cv_HAVE_POSIX_ACLS,[
                        acl_LIBS=$LIBS
                        LIBS="$LIBS $ACL_LIBS"
-                       AC_TRY_LINK([
+                       AC_LINK_IFELSE([AC_LANG_PROGRAM([[
                                #include <sys/types.h>
                                #include <sys/acl.h>
-                       ],[
+                       ]], [[
                                acl_t acl;
                                int entry_id;
                                acl_entry_t *entry_p;
                                return acl_get_entry(acl, entry_id, entry_p);
-                       ],
-                       [netatalk_cv_HAVE_POSIX_ACLS=yes],
-                       [netatalk_cv_HAVE_POSIX_ACLS=no
+                       ]])],[netatalk_cv_HAVE_POSIX_ACLS=yes],[netatalk_cv_HAVE_POSIX_ACLS=no
                 with_acl_support=no])
                        LIBS=$acl_LIBS
                ])
@@ -706,16 +921,14 @@ if test x"$with_acl_support" = x"yes" ; then
                        AC_CACHE_CHECK([for acl_get_perm_np],netatalk_cv_HAVE_ACL_GET_PERM_NP,[
                                acl_LIBS=$LIBS
                                LIBS="$LIBS $ACL_LIBS"
-                               AC_TRY_LINK([
+                               AC_LINK_IFELSE([AC_LANG_PROGRAM([[
                                        #include <sys/types.h>
                                        #include <sys/acl.h>
-                               ],[
+                               ]], [[
                                        acl_permset_t permset_d;
                                        acl_perm_t perm;
                                        return acl_get_perm_np(permset_d, perm);
-                               ],
-                               [netatalk_cv_HAVE_ACL_GET_PERM_NP=yes],
-                               [netatalk_cv_HAVE_ACL_GET_PERM_NP=no])
+                               ]])],[netatalk_cv_HAVE_ACL_GET_PERM_NP=yes],[netatalk_cv_HAVE_ACL_GET_PERM_NP=no])
                                LIBS=$acl_LIBS
                        ])
                        if test x"$netatalk_cv_HAVE_ACL_GET_PERM_NP" = x"yes"; then
@@ -828,18 +1041,16 @@ if test x"$ac_cv_func_getxattr" = x"yes" ; then
        AC_CACHE_CHECK([whether xattr interface takes additional options], smb_attr_cv_xattr_add_opt, [
                old_LIBS=$LIBS
                LIBS="$LIBS $ACL_LIBS"
-               AC_TRY_COMPILE([
+               AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
                        #include <sys/types.h>
                        #if HAVE_ATTR_XATTR_H
                        #include <attr/xattr.h>
                        #elif HAVE_SYS_XATTR_H
                        #include <sys/xattr.h>
                        #endif
-               ],[
+               ]], [[
                        getxattr(0, 0, 0, 0, 0, 0);
-               ],
-               [smb_attr_cv_xattr_add_opt=yes],
-               [smb_attr_cv_xattr_add_opt=no;LIBS=$old_LIBS])
+               ]])],[smb_attr_cv_xattr_add_opt=yes],[smb_attr_cv_xattr_add_opt=no;LIBS=$old_LIBS])
        ])
        if test x"$smb_attr_cv_xattr_add_opt" = x"yes"; then
                AC_DEFINE(XATTR_ADD_OPT, 1, [xattr functions have additional options])
@@ -928,6 +1139,7 @@ if test x"$netatalk_cv_search_sendfile" = x"yes"; then
         AC_DEFINE(SENDFILE_FLAVOR_SOLARIS, 1, [Solaris sendfile()])
         AC_SEARCH_LIBS(sendfile, sendfile)
         AC_CHECK_FUNC([sendfile], [netatalk_cv_HAVE_SENDFILE=yes])
+        AC_CHECK_FUNCS([sendfilev])
         ;;
 
     *freebsd*)
@@ -950,7 +1162,7 @@ dnl --------------------- Check if realpath() takes NULL
 AC_DEFUN([AC_NETATALK_REALPATH], [
 AC_CACHE_CHECK([if the realpath function allows a NULL argument],
     neta_cv_REALPATH_TAKES_NULL, [
-        AC_TRY_RUN([
+        AC_RUN_IFELSE([AC_LANG_SOURCE([[
             #include <stdio.h>
             #include <limits.h>
             #include <signal.h>
@@ -964,15 +1176,12 @@ AC_CACHE_CHECK([if the realpath function allows a NULL argument],
                 signal(SIGSEGV, exit_on_core);
                 newpath = realpath("/tmp", NULL);
                 exit((newpath != NULL) ? 0 : 1);
-            }],
-            neta_cv_REALPATH_TAKES_NULL=yes,
-            neta_cv_REALPATH_TAKES_NULL=no,
-            neta_cv_REALPATH_TAKES_NULL=cross
-        )
+            }]])],[neta_cv_REALPATH_TAKES_NULL=yes],[neta_cv_REALPATH_TAKES_NULL=no],[neta_cv_REALPATH_TAKES_NULL=cross
+        ])
     ]
 )
 
 if test x"$neta_cv_REALPATH_TAKES_NULL" = x"yes"; then
     AC_DEFINE(REALPATH_TAKES_NULL,1,[Whether the realpath function allows NULL])
 fi
-])
\ No newline at end of file
+])