X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=macros%2Fnetatalk.m4;h=6ae3fab2b0d51ac2a6191652376333e40c817c2f;hb=071887b8a84c7111477d9e1fcc8be9ea2b0c47e5;hp=f90603d0d37e20e4bf6c30cc2e0a764656398c68;hpb=5ab4f0463c00263b3d842f1e1a3648ecf35b4d65;p=netatalk.git diff --git a/macros/netatalk.m4 b/macros/netatalk.m4 index f90603d0..ddbd3498 100644 --- a/macros/netatalk.m4 +++ b/macros/netatalk.m4 @@ -1,5 +1,344 @@ dnl Kitchen sink for configuration macros +dnl Check for docbook +AC_DEFUN(AX_CHECK_DOCBOOK, [ + # It's just rude to go over the net to build + XSLTPROC_FLAGS=--nonet + DOCBOOK_ROOT= + XSLTPROC_WORKS=no + + AC_ARG_WITH(docbook, + AS_HELP_STRING( + [--with-docbook], + [Path to Docbook XSL directory] + ), + [DOCBOOK_ROOT=$withval] + ) + + if test -n "$DOCBOOK_ROOT" ; then + AC_CHECK_PROG(XSLTPROC,xsltproc,xsltproc,) + if test -n "$XSLTPROC"; then + AC_MSG_CHECKING([whether xsltproc works]) + DB_FILE="$DOCBOOK_ROOT/html/docbook.xsl" + $XSLTPROC $XSLTPROC_FLAGS $DB_FILE >/dev/null 2>&1 << END + + + + +END + if test "$?" = 0; then + XSLTPROC_WORKS=yes + fi + AC_MSG_RESULT($XSLTPROC_WORKS) + fi + fi + + AC_MSG_CHECKING([whether to build Docbook documentation]) + AC_MSG_RESULT($XSLTPROC_WORKS) + + AM_CONDITIONAL(HAVE_XSLTPROC, test x"$XSLTPROC_WORKS" = x"yes") + AC_SUBST(XSLTPROC_FLAGS) + AC_SUBST(DOCBOOK_ROOT) + AC_SUBST(XSLTPROC) +]) + +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 + + AC_ARG_WITH(afpstats, + AS_HELP_STRING( + [--with-afpstats], + [Enable AFP statistics via dbus (default: enabled if dbus found)] + ),,[withval=auto] + ) + + if test x"$withval" != x"no" ; then + 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) + 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 + fi + + if test x"$withval" = x"yes" -a x"$atalk_cv_with_dbus" = x"no"; then + AC_MSG_ERROR([afpstats requested but dbus-glib not found]) + fi + + 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' + ) + DBUS_SYS_DIR="" + 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" + fi + + AC_SUBST(DBUS_SYS_DIR) + 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) + AM_CONDITIONAL(HAVE_DBUS_GLIB, test x$atalk_cv_with_dbus = xyes) +]) + +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 + ac_cv_tracker_pkg_version_default=0.12 + ac_cv_tracker_pkg_version_min=0.12 + + dnl Tracker SPARQL + AC_ARG_WITH([tracker-pkgconfig-version], + [AS_HELP_STRING([--with-tracker-pkgconfig-version=VERSION],[Version suffix of the Tracker SPARQL and tracker-miner pkg in pkg-config (default: 0.12)])], + [ac_cv_tracker_pkg_version=$withval], + [ac_cv_tracker_pkg_version=$ac_cv_tracker_pkg_version_default] + ) + + AC_ARG_WITH([tracker-prefix], + [AS_HELP_STRING([--with-tracker-prefix=PATH],[Prefix of Tracker installation (default: none)])], + [ac_cv_tracker_prefix=$withval], + [ac_cv_tracker_prefix="`pkg-config --variable=prefix tracker-sparql-$ac_cv_tracker_pkg_version`"] + ) + + AC_ARG_VAR([PKG_CONFIG_PATH], [Path to additional pkg-config packages]) + PKG_CHECK_MODULES([TRACKER], [tracker-sparql-$ac_cv_tracker_pkg_version >= $ac_cv_tracker_pkg_version_min], [ac_cv_have_tracker_sparql=yes], [ac_cv_have_tracker_sparql=no]) + PKG_CHECK_MODULES([TRACKER_MINER], [tracker-miner-$ac_cv_tracker_pkg_version >= $ac_cv_tracker_pkg_version_min], [ac_cv_have_tracker_miner=yes], [ac_cv_have_tracker_miner=no]) + + if test x"$ac_cv_have_tracker_sparql" = x"no" -o x"$ac_cv_have_tracker_miner" = x"no" ; then + if test x"$need_tracker_sparql" = 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_UNQUOTED(TRACKER_PREFIX, ["$ac_cv_tracker_prefix"], [Path to Tracker]) + AC_DEFINE([DBUS_DAEMON_PATH], ["/bin/dbus-daemon"], [Path to dbus-daemon]) + fi + + if test x"$ac_cv_have_tracker_sparql" = x"yes" ; then + ac_cv_have_tracker=yes + fi + + AC_SUBST(TRACKER_CFLAGS) + AC_SUBST(TRACKER_LIBS) + AC_SUBST(TRACKER_MINER_CFLAGS) + AC_SUBST(TRACKER_MINER_LIBS) + AM_CONDITIONAL(HAVE_TRACKER, [test x"$ac_cv_have_tracker_sparql" = x"yes"]) +]) + +dnl Whether to disable bundled libevent +AC_DEFUN([AC_NETATALK_LIBEVENT], [ + 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") +]) + +dnl Whether to disable bundled tdb +AC_DEFUN([AC_NETATALK_TDB], [ + AC_ARG_WITH( + tdb, + [AS_HELP_STRING([--with-tdb],[whether to use the bundled tdb (default: yes)])], + use_bundled_tdb=$withval, + use_bundled_tdb=yes + ) + AC_MSG_CHECKING([whether to use bundled tdb]) + AC_MSG_RESULT([$use_bundled_tdb]) + + if test x"$use_bundled_tdb" = x"yes" ; then + AC_DEFINE(USE_BUILTIN_TDB, 1, [Use internal tbd]) + else + if test -z "$TDB_LIBS" ; then + PKG_CHECK_MODULES(TDB, tdb, , [AC_MSG_ERROR([couldn't find tdb with pkg-config])]) + fi + use_bundled_tdb=no + fi + + AC_SUBST(TDB_CFLAGS) + AC_SUBST(TDB_LIBS) + AM_CONDITIONAL(USE_BUILTIN_TDB, test x"$use_bundled_tdb" = 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 + bindir="/bin" + sbindir="/sbin" + sysconfdir="/etc" + 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], [ +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 @@ -23,7 +362,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, [ @@ -142,32 +481,78 @@ 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|suse|gentoo|netbsd|debian]]], - sysv_style="$withval", sysv_style=none +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|solaris|systemd]]], + init_style="$withval", init_style=none ) - case "$sysv_style" in + case "$init_style" in "redhat") - AC_MSG_RESULT([enabling redhat-style sysv support]) + AC_MSG_ERROR([--with-init-style=redhat is obsoleted. Use redhat-sysv or redhat-systemd.]) ;; + "redhat-sysv") + 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="/usr/lib/systemd/system" + ;; "suse") - AC_MSG_RESULT([enabling suse-style sysv support]) + AC_MSG_ERROR([--with-init-style=suse is obsoleted. Use suse-sysv or suse-systemd.]) ;; + "suse-sysv") + 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="/usr/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([enabling general systemd support]) + ac_cv_init_dir="/usr/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_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 @@ -193,6 +578,14 @@ case "$host_cpu" in powerpc|ppc) this_cpu=ppc ;; esac +dnl --------------------- GNU source +case "$this_os" in + linux) AC_DEFINE(_GNU_SOURCE, 1, [Whether to use GNU libc extensions]) + ;; + kfreebsd-gnu) AC_DEFINE(_GNU_SOURCE, 1, [Whether to use GNU libc extensions]) + ;; +esac + dnl --------------------- operating system specific flags (port from sys/*) dnl ----- FreeBSD specific ----- @@ -200,14 +593,21 @@ if test x"$this_os" = "xfreebsd"; then AC_MSG_RESULT([ * FreeBSD specific configuration]) AC_DEFINE(BSD4_4, 1, [BSD compatiblity macro]) AC_DEFINE(FREEBSD, 1, [Define if OS is FreeBSD]) - AC_DEFINE(SENDFILE_FLAVOR_BSD, 1, [Define if the sendfile() function uses BSD semantics]) + AC_DEFINE(OPEN_NOFOLLOW_ERRNO, EMLINK, errno returned by open with O_NOFOLLOW) +fi + +dnl ----- GNU/kFreeBSD specific ----- +if test x"$this_os" = "xkfreebsd-gnu"; then + AC_MSG_RESULT([ * GNU/kFreeBSD specific configuration]) + AC_DEFINE(BSD4_4, 1, [BSD compatiblity macro]) + AC_DEFINE(FREEBSD, 1, [Define if OS is FreeBSD]) AC_DEFINE(OPEN_NOFOLLOW_ERRNO, EMLINK, errno returned by open with O_NOFOLLOW) 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) @@ -220,76 +620,9 @@ if test x"$this_os" = "xlinux"; then dnl ----- see etc/afpd/quota.c AC_DEFINE(HAVE_BROKEN_DBTOB, 1, [Define if dbtob is broken]) - netatalk_cv_linux_sendfile=yes - AC_MSG_CHECKING([use sendfile syscall]) - AC_ARG_ENABLE(sendfile, - [ --disable-sendfile disable linux sendfile syscall],[ - if test x"$enableval" = x"no"; then - netatalk_cv_linux_sendfile=no - AC_MSG_RESULT([no]) - else - AC_MSG_RESULT([yes]) - - fi - ],[ - AC_MSG_RESULT([yes]) - ] - - ) - - if test x"$netatalk_cv_linux_sendfile" = "xyes"; then - AC_CACHE_CHECK([for linux sendfile support],netatalk_cv_HAVE_SENDFILE,[ - AC_TRY_LINK([#include ], -[\ -int tofd, fromfd; -off_t offset; -size_t total; -ssize_t nwritten = sendfile(tofd, fromfd, &offset, total); -], -netatalk_cv_HAVE_SENDFILE=yes,netatalk_cv_HAVE_SENDFILE=no)]) - -# Try and cope with broken Linux sendfile.... - AC_CACHE_CHECK([for broken linux sendfile support],netatalk_cv_HAVE_BROKEN_LINUX_SENDFILE,[ - AC_TRY_LINK([\ -#if defined(_FILE_OFFSET_BITS) && (_FILE_OFFSET_BITS == 64) -#undef _FILE_OFFSET_BITS -#endif -#include ], -[\ -int tofd, fromfd; -off_t offset; -size_t total; -ssize_t nwritten = sendfile(tofd, fromfd, &offset, total); -], -netatalk_cv_HAVE_BROKEN_LINUX_SENDFILE=yes,netatalk_cv_HAVE_BROKEN_LINUX_SENDFILE=no,netatalk_cv_HAVE_BROKEN_SENDFILE=cross)]) - - if test x"$netatalk_cv_HAVE_SENDFILE" = x"yes"; then - AC_DEFINE(HAVE_SENDFILE,1,[Whether sendfile() is available]) - AC_DEFINE(SENDFILE_FLAVOR_LINUX,1,[Whether linux sendfile() API is available]) - AC_DEFINE(WITH_SENDFILE,1,[Whether sendfile() should be used]) - elif test x"$netatalk_cv_HAVE_BROKEN_LINUX_SENDFILE" = x"yes"; then - AC_DEFINE(SENDFILE_FLAVOR_LINUX,1,[Whether linux sendfile() API is available]) - AC_DEFINE(LINUX_BROKEN_SENDFILE_API,1,[Whether (linux) sendfile() is broken]) - AC_DEFINE(WITH_SENDFILE,1,[Whether sendfile should be used]) - else - netatalk_cv_linux_sendfile=no - AC_MSG_RESULT(no); - fi - fi - need_dash_r=no fi -dnl ----- Mac OSX specific ----- -if test x"$this_os" = "xmacosx"; then - AC_MSG_RESULT([ * Mac OSX specific configuration]) - AC_DEFINE(BSD4_4, 1, [BSD compatiblity macro]) - AC_DEFINE(HAVE_2ARG_DBTOB, 1, [Define if dbtob takes two arguments]) - dnl AC_DEFINE(NO_DLFCN_H) - AC_DEFINE(NO_QUOTA_SUPPORT, 1, [Define if Quota support should be disabled]) - AC_DEFINE(MACOSX_SERVER, 1, [Define if compiling for MacOS X Server]) -fi - dnl ----- NetBSD specific ----- if test x"$this_os" = "xnetbsd"; then AC_MSG_RESULT([ * NetBSD specific configuration]) @@ -307,6 +640,7 @@ fi dnl ----- OpenBSD specific ----- if test x"$this_os" = "xopenbsd"; then AC_MSG_RESULT([ * OpenBSD specific configuration]) + AC_DEFINE(BSD4_4, 1, [BSD compatiblity macro]) dnl ----- OpenBSD does not have crypt.h, uses unistd.h ----- AC_DEFINE(UAM_DHX, 1, [Define if the DHX UAM modules should be compiled]) fi @@ -318,91 +652,16 @@ if test x"$this_os" = "xsolaris"; then AC_DEFINE(_ISOC9X_SOURCE, 1, [Compatibility macro]) AC_DEFINE(NO_STRUCT_TM_GMTOFF, 1, [Define if the gmtoff member of struct tm is not available]) AC_DEFINE(SOLARIS, 1, [Solaris compatibility macro]) - CFLAGS="-I\$(top_srcdir)/sys/generic $CFLAGS" + AC_DEFINE(_XOPEN_SOURCE, 600, [Solaris compilation environment]) + AC_DEFINE(__EXTENSIONS__, 1, [Solaris compilation environment]) need_dash_r=yes - sysv_style=solaris - - solaris_module=no - AC_MSG_CHECKING([if we can build Solaris kernel module]) - if test -x /usr/ccs/bin/ld && test x"$netatalk_cv_ddp_enabled" = x"yes" ; then - solaris_module=yes - fi - AC_MSG_RESULT([$solaris_module]) - - COMPILE_64BIT_KMODULE=no - KCFLAGS="" - KLDFLAGS="" - COMPILE_KERNEL_GCC=no - - if test "$solaris_module" = "yes"; then - dnl Solaris kernel module stuff - AC_MSG_CHECKING([if we have to build a 64bit kernel module]) - - # check for isainfo, if not found it has to be a 32 bit kernel (<=2.6) - if test -x /usr/bin/isainfo; then - # check for 64 bit platform - if isainfo -kv | grep '^64-bit'; then - COMPILE_64BIT_KMODULE=yes - fi - fi - - AC_MSG_RESULT([$COMPILE_64BIT_KMODULE]) - - if test "${GCC}" = yes; then - COMPILE_KERNEL_GCC=yes - if test "$COMPILE_64BIT_KMODULE" = yes; then - - AC_MSG_CHECKING([if we can build a 64bit kernel module]) - - case `$CC --version 2>/dev/null` in - [[12]].* | 3.0.*) - COMPILE_64BIT_KMODULE=no - COMPILE_KERNEL_GCC=no - solaris_module=no;; - *) - # use for 64 bit - KCFLAGS="-m64" - #KLDFLAGS="-melf64_sparc" - KLDFLAGS="-64";; - esac - - AC_MSG_RESULT([$COMPILE_64BIT_KMODULE]) - - else - KCFLAGS="" - KLDFLAGS="" - fi - KCFLAGS="$KCFLAGS -D_KERNEL -Wall -Wstrict-prototypes" - else - if test "$COMPILE_64BIT_KMODULE" = yes; then - # use Sun CC (for a 64-bit kernel, uncomment " -xarch=v9 -xregs=no%appl ") - KCFLAGS="-xarch=v9 -xregs=no%appl" - KLDFLAGS="-64" - else - KCFLAGS="" - KLDFLAGS="" - fi - KCFLAGS="-D_KERNEL $KCFLAGS -mno-app-regs -munaligned-doubles -fpcc-struct-return" - fi - - AC_CACHE_CHECK([for timeout_id_t],netatalk_cv_HAVE_TIMEOUT_ID_T,[ - AC_TRY_LINK([\ -#include -#include ], -[\ -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)]) - - AC_DEFINE(HAVE_TIMEOUT_ID_T, test x"$netatalk_cv_HAVE_TIMEOUT_ID" = x"yes", [define for timeout_id_t]) - fi - - AC_SUBST(COMPILE_KERNEL_GCC) - AC_SUBST(COMPILE_64BIT_KMODULE) - AC_SUBST(KCFLAGS) - AC_SUBST(KLDFLAGS) + init_style=solaris 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 @@ -451,6 +710,55 @@ 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 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 AC_DEFUN([AC_NETATALK_OVERWRITE_CONFIG], [ AC_MSG_CHECKING([whether configuration files should be overwritten]) @@ -467,40 +775,60 @@ dnl Check for LDAP support, for client-side ACL visibility AC_DEFUN([AC_NETATALK_LDAP], [ AC_MSG_CHECKING(for LDAP (necessary for client-side ACL visibility)) AC_ARG_WITH(ldap, - [AS_HELP_STRING([--with-ldap], + [AS_HELP_STRING([--with-ldap[[=PATH]]], [LDAP support (default=auto)])], - [ case "$withval" in - yes|no) - with_ldap="$withval" - ;; - *) - with_ldap=auto - ;; - esac ]) -AC_MSG_RESULT($with_ldap) - -if test x"$with_ldap" != x"no" ; then - AC_CHECK_HEADER([ldap.h], with_ldap=yes, - [ if test x"$with_ldap" = x"yes" ; then + netatalk_cv_ldap=$withval, + netatalk_cv_ldap=auto + ) +AC_MSG_RESULT($netatalk_cv_ldap) + +save_CFLAGS="$CFLAGS" +save_LDFLAGS="$LDFLAGS" +save_LIBS="$LIBS" +CFLAGS="" +LDFLAGS="" +LIBS="" +LDAP_CFLAGS="" +LDAP_LDFLAGS="" +LDAP_LIBS="" + +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" + LDFLAGS="-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 + LDAP_CFLAGS="$CFLAGS" + LDAP_LDFLAGS="$LDFLAGS" + LDAP_LIBS="-lldap" AC_DEFINE(HAVE_LDAP,1,[Whether LDAP is available]) fi + +AC_SUBST(LDAP_CFLAGS) +AC_SUBST(LDAP_LDFLAGS) +AC_SUBST(LDAP_LIBS) +CFLAGS="$save_CFLAGS" +LDFLAGS="$save_LDFLAGS" +LIBS="$save_LIBS" ]) dnl Check for ACL support AC_DEFUN([AC_NETATALK_ACL], [ +ac_cv_have_acls=no AC_MSG_CHECKING(whether to support ACLs) AC_ARG_WITH(acls, [AS_HELP_STRING([--with-acls], @@ -518,101 +846,125 @@ AC_MSG_RESULT($with_acl_support) if test x"$with_acl_support" = x"no"; then AC_MSG_RESULT(Disabling ACL support) - AC_DEFINE(HAVE_NO_ACLS,1,[Whether no ACLs support should be built in]) -else - with_acl_support=yes fi -if test x"$with_acl_support" = x"yes" ; then - AC_MSG_NOTICE(checking whether ACL support is available:) +# Platform specific checks +if test x"$with_acl_support" != x"no" ; then case "$host_os" in - *sysv5*) - AC_MSG_NOTICE(Using UnixWare ACLs) - AC_DEFINE(HAVE_UNIXWARE_ACLS,1,[Whether UnixWare ACLs are available]) - ;; *solaris*) AC_MSG_NOTICE(Using solaris ACLs) - AC_DEFINE(HAVE_SOLARIS_ACLS,1,[Whether solaris ACLs are available]) + AC_DEFINE(HAVE_SOLARIS_ACLS,1,[Whether Solaris ACLs are available]) + AC_DEFINE(HAVE_NFSV4_ACLS,1,[Whether NFSv4 ACLs are available]) ACL_LIBS="$ACL_LIBS -lsec" + ac_cv_have_acls=yes ;; - *hpux*) - AC_MSG_NOTICE(Using HPUX ACLs) - AC_DEFINE(HAVE_HPUX_ACLS,1,[Whether HPUX ACLs are available]) - ;; - *irix*) - AC_MSG_NOTICE(Using IRIX ACLs) - AC_DEFINE(HAVE_IRIX_ACLS,1,[Whether IRIX ACLs are available]) - ;; - *aix*) - AC_MSG_NOTICE(Using AIX ACLs) - AC_DEFINE(HAVE_AIX_ACLS,1,[Whether AIX ACLs are available]) - ;; - *osf*) - AC_MSG_NOTICE(Using Tru64 ACLs) - AC_DEFINE(HAVE_TRU64_ACLS,1,[Whether Tru64 ACLs are available]) - ACL_LIBS="$ACL_LIBS -lpacl" + *freebsd*) + AC_MSG_NOTICE(checking whether libsunacl is available) + sunacl_include_path="/usr/local/include" + sunacl_lib_path="/usr/local/lib" + + save_CPPFLAGS=$CPPFLAGS + save_LDFLAGS=$LDFLAGS + save_LIBS=$LIBS + + CPPFLAGS="-I$sunacl_include_path $CPPFLAGS" + AC_CHECK_HEADER([sunacl.h]) + + LDFLAGS="-L$sunacl_lib_path $LDFLAGS" + AC_CHECK_LIB([sunacl], [acl]) + + if test x"$ac_cv_header_sunacl_h" = x"yes" -a x"$ac_cv_lib_sunacl_acl" = x"yes" ; then + AC_MSG_NOTICE([Enabling support for ZFS ACLs using libsunacl]) + ac_cv_have_acls=yes + CFLAGS="-I$sunacl_include_path $CFLAGS" + ACL_LIBS="$ACL_LIBS -L$sunacl_lib_path -lsunacl" + AC_DEFINE(HAVE_FREEBSD_SUNACL, 1, [Whether FreeBSD ZFS ACLs with libsunacl are available]) + AC_DEFINE(HAVE_NFSV4_ACLS,1,[Whether NFSv4 ACLs are available]) + else + AC_MSG_NOTICE([libsunacl not found, disabling ZFS ACL support]) + fi + + CPPFLAGS=$save_CPPFLAGS + LDFLAGS=$save_LDFLAGS + LIBS=$save_LIBS ;; - *darwin*) - AC_MSG_NOTICE(ACLs on Darwin currently not supported) - AC_DEFINE(HAVE_NO_ACLS,1,[Whether no ACLs support is available]) + esac +fi + +if test x"$with_acl_support" != x"no" -a x"$ac_cv_have_acls" != x"yes" ; then + # Runtime checks for POSIX ACLs + AC_CHECK_LIB(acl,acl_get_file,[ACL_LIBS="$ACL_LIBS -lacl"]) + case "$host_os" in + *linux*) + AC_CHECK_LIB(attr,getxattr,[ACL_LIBS="$ACL_LIBS -lattr"]) ;; - *) - AC_CHECK_LIB(acl,acl_get_file,[ACL_LIBS="$ACL_LIBS -lacl"]) - case "$host_os" in - *linux*) - AC_CHECK_LIB(attr,getxattr,[ACL_LIBS="$ACL_LIBS -lattr"]) - ;; - esac - AC_CACHE_CHECK([for POSIX ACL support],netatalk_cv_HAVE_POSIX_ACLS,[ + esac + + AC_CACHE_CHECK([for POSIX ACL support],netatalk_cv_HAVE_POSIX_ACLS,[ + acl_LIBS=$LIBS + LIBS="$LIBS $ACL_LIBS" + AC_LINK_IFELSE([AC_LANG_PROGRAM([[ + #include + #include + ]], [[ + 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; ac_cv_have_acls=yes], + [netatalk_cv_HAVE_POSIX_ACLS=no; ac_cv_have_acls=no] + ) + LIBS=$acl_LIBS + ]) + + if test x"$netatalk_cv_HAVE_POSIX_ACLS" = x"yes"; then + AC_MSG_NOTICE(Using POSIX ACLs) + AC_DEFINE(HAVE_POSIX_ACLS,1,[Whether POSIX ACLs are available]) + + 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 #include - ],[ - 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 - with_acl_support=no]) + ]], [[ + 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]) LIBS=$acl_LIBS ]) - if test x"$netatalk_cv_HAVE_POSIX_ACLS" = x"yes"; then - AC_MSG_NOTICE(Using POSIX ACLs) - AC_DEFINE(HAVE_POSIX_ACLS,1,[Whether POSIX ACLs are available]) - 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([ - #include - #include - ],[ - acl_permset_t permset_d; - acl_perm_t perm; - return acl_get_perm_np(permset_d, perm); - ], - [samba_cv_HAVE_ACL_GET_PERM_NP=yes], - [samba_cv_HAVE_ACL_GET_PERM_NP=no]) - LIBS=$acl_LIBS - ]) - if test x"netatalk_cv_HAVE_ACL_GET_PERM_NP" = x"yes"; then - AC_DEFINE(HAVE_ACL_GET_PERM_NP,1,[Whether acl_get_perm_np() is available]) - fi - else - AC_MSG_NOTICE(ACL support is not avaliable) - AC_DEFINE(HAVE_NO_ACLS,1,[Whether no ACLs support is available]) + if test x"$netatalk_cv_HAVE_ACL_GET_PERM_NP" = x"yes"; then + AC_DEFINE(HAVE_ACL_GET_PERM_NP,1,[Whether acl_get_perm_np() is available]) fi - ;; - esac + + AC_CACHE_CHECK([for acl_from_mode], netatalk_cv_HAVE_ACL_FROM_MODE,[ + acl_LIBS=$LIBS + LIBS="$LIBS $ACL_LIBS" + AC_CHECK_FUNCS(acl_from_mode, + [netatalk_cv_HAVE_ACL_FROM_MODE=yes], + [netatalk_cv_HAVE_ACL_FROM_MODE=no] + ) + LIBS=$acl_LIBS + ]) + if test x"netatalk_cv_HAVE_ACL_FROM_MODE" = x"yes"; then + AC_DEFINE(HAVE_ACL_FROM_MODE,1,[Whether acl_from_mode() is available]) + fi + fi fi -if test x"$with_acl_support" = x"yes" ; then - AC_DEFINE(HAVE_ACLS,1,[Whether ACLs support is available]) - AC_SUBST(ACL_LIBS) +if test x"$ac_cv_have_acls" = x"no" ; then + if test x"$with_acl_support" = x"yes" ; then + AC_MSG_ERROR(ACL support requested but not found) + else + AC_MSG_NOTICE(ACL support is not avaliable) + fi +else + AC_CHECK_HEADERS([acl/libacl.h]) + AC_DEFINE(HAVE_ACLS,1,[Whether ACLs support is available]) fi +AC_SUBST(ACL_LIBS) ]) dnl Check for Extended Attributes support @@ -638,7 +990,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]) ;; @@ -693,18 +1045,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 #if HAVE_ATTR_XATTR_H #include #elif HAVE_SYS_XATTR_H #include #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]) @@ -771,3 +1121,88 @@ AC_DEFUN([AC_NETATALK_SMB_SHAREMODES], [ AM_CONDITIONAL(USE_SMB_SHAREMODES, test x"$neta_cv_have_smbshmd" = x"yes") ]) + +dnl ------ Check for sendfile() -------- +AC_DEFUN([AC_NETATALK_SENDFILE], [ +netatalk_cv_search_sendfile=yes +AC_ARG_ENABLE(sendfile, + [ --disable-sendfile disable sendfile syscall], + [if test x"$enableval" = x"no"; then + netatalk_cv_search_sendfile=no + fi] +) + +if test x"$netatalk_cv_search_sendfile" = x"yes"; then + case "$host_os" in + *linux*) + AC_DEFINE(SENDFILE_FLAVOR_LINUX,1,[Whether linux sendfile() API is available]) + AC_CHECK_FUNC([sendfile], [netatalk_cv_HAVE_SENDFILE=yes]) + ;; + + *solaris*) + 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*) + AC_DEFINE(SENDFILE_FLAVOR_BSD, 1, [Define if the sendfile() function uses BSD semantics]) + AC_CHECK_FUNC([sendfile], [netatalk_cv_HAVE_SENDFILE=yes]) + ;; + + *) + ;; + + esac + + if test x"$netatalk_cv_HAVE_SENDFILE" = x"yes"; then + AC_DEFINE(WITH_SENDFILE,1,[Whether sendfile() should be used]) + fi +fi +]) + +dnl ------ Check for recvfile() -------- +AC_DEFUN([AC_NETATALK_RECVFILE], [ +case "$host_os" in +*linux*) + AC_CHECK_FUNCS([splice], [atalk_cv_use_recvfile=yes]) + ;; + +*) + ;; + +esac + +if test x"$atalk_cv_use_recvfile" = x"yes"; then + AC_DEFINE(WITH_RECVFILE, 1, [Whether recvfile should be used]) +fi +]) + +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_RUN_IFELSE([AC_LANG_SOURCE([[ + #include + #include + #include + + void exit_on_core(int ignored) { + exit(1); + } + + main() { + char *newpath; + 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 + ]) + ] +) + +if test x"$neta_cv_REALPATH_TAKES_NULL" = x"yes"; then + AC_DEFINE(REALPATH_TAKES_NULL,1,[Whether the realpath function allows NULL]) +fi +])