1 dnl Kitchen sink for configuration macros
4 AC_DEFUN(AX_CHECK_DOCBOOK, [
5 # It's just rude to go over the net to build
13 [Path to Docbook XSL directory]
15 [DOCBOOK_ROOT=$withval]
18 if test -n "$DOCBOOK_ROOT" ; then
19 AC_CHECK_PROG(XSLTPROC,xsltproc,xsltproc,)
20 if test -n "$XSLTPROC"; then
21 AC_MSG_CHECKING([whether xsltproc works])
22 DB_FILE="$DOCBOOK_ROOT/html/docbook.xsl"
23 $XSLTPROC $XSLTPROC_FLAGS $DB_FILE >/dev/null 2>&1 << END
24 <?xml version="1.0" encoding='ISO-8859-1'?>
25 <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
29 if test "$?" = 0; then
32 AC_MSG_RESULT($XSLTPROC_WORKS)
36 AC_MSG_CHECKING([whether to build Docbook documentation])
37 AC_MSG_RESULT($XSLTPROC_WORKS)
39 AM_CONDITIONAL(HAVE_XSLTPROC, test x"$XSLTPROC_WORKS" = x"yes")
40 AC_SUBST(XSLTPROC_FLAGS)
41 AC_SUBST(DOCBOOK_ROOT)
46 AC_DEFUN([AC_NETATALK_DTRACE], [
50 [Enable dtrace probes (default: enabled if dtrace found)]
55 if test "x$WDTRACE" = "xyes" -o "x$WDTRACE" = "xauto" ; then
56 AC_CHECK_PROG([atalk_cv_have_dtrace], [dtrace], [yes], [no])
57 if test "x$atalk_cv_have_dtrace" = "xno" ; then
58 if test "x$WDTRACE" = "xyes" ; then
59 AC_MSG_FAILURE([dtrace requested but not found])
67 if test x"$WDTRACE" = x"yes" ; then
68 AC_DEFINE([WITH_DTRACE], [1], [dtrace probes])
70 if test x"$this_os" = x"freebsd" ; then
75 AM_CONDITIONAL(WITH_DTRACE, test "x$WDTRACE" = "xyes")
78 dnl Check for dbus-glib, for AFP stats
79 AC_DEFUN([AC_NETATALK_DBUS_GLIB], [
81 PKG_CHECK_MODULES(DBUS, dbus-1 >= 1.1, have_dbus=yes, have_dbus=no)
82 PKG_CHECK_MODULES(DBUS_GLIB, dbus-glib-1, have_dbus_glib=yes, have_dbus_glib=no)
83 PKG_CHECK_MODULES(DBUS_GTHREAD, gthread-2.0, have_dbus_gthread=yes, have_dbus_gthread=no)
86 AC_SUBST(DBUS_GLIB_CFLAGS)
87 AC_SUBST(DBUS_GLIB_LIBS)
88 AC_SUBST(DBUS_GTHREAD_CFLAGS)
89 AC_SUBST(DBUS_GTHREAD_LIBS)
90 if test x$have_dbus_glib = xyes -a x$have_dbus = xyes -a x$have_dbus_gthread = xyes ; then
93 CFLAGS="$CFLAGS $DBUS_GLIB_CFLAGS"
94 LIBS="$LIBS $DBUS_GLIB_LIBS"
95 AC_CHECK_FUNC([dbus_g_bus_get_private], [atalk_cv_with_dbus=yes], [atalk_cv_with_dbus=no])
96 CFLAGS="$saved_CFLAGS"
99 AM_CONDITIONAL(HAVE_DBUS_GLIB, test x$atalk_cv_with_dbus = xyes)
103 [AS_HELP_STRING([--with-dbus-sysconf-dir=PATH],[Path to dbus system bus security configuration directory (default: ${sysconfdir}/dbus-1/system.d/)])],
104 ac_cv_dbus_sysdir=$withval,
105 ac_cv_dbus_sysdir='${sysconfdir}/dbus-1/system.d'
108 if test x$atalk_cv_with_dbus = xyes ; then
109 AC_DEFINE(HAVE_DBUS_GLIB, 1, [Define if support for dbus-glib was found])
110 DBUS_SYS_DIR="$ac_cv_dbus_sysdir"
111 AC_SUBST(DBUS_SYS_DIR)
115 dnl Whether to enable developer build
116 AC_DEFUN([AC_DEVELOPER], [
117 AC_MSG_CHECKING([whether to enable developer build])
120 AS_HELP_STRING([--enable-developer], [whether to enable developer build (ABI checking)]),
121 enable_dev=$enableval,
124 AC_MSG_RESULT([$enable_dev])
125 AM_CONDITIONAL(DEVELOPER, test x"$enable_dev" = x"yes")
128 dnl Whether to disable bundled libevent
129 AC_DEFUN([AC_NETATALK_LIBEVENT], [
130 AC_MSG_CHECKING([whether to use bundled libevent])
133 [AS_HELP_STRING([--with-libevent],[whether to use the bundled libevent (default: yes)])],
134 use_bundled_libevent=$withval,
135 use_bundled_libevent=yes
139 [AS_HELP_STRING([--with-libevent-header],[path to libevent header files])],
140 [use_bundled_libevent=no; LIBEVENT_CFLAGS=-I$withval]
144 [AS_HELP_STRING([--with-libevent-lib],[path to libevent library])],
145 [use_bundled_libevent=no; LIBEVENT_LDFLAGS=-L$withval]
147 if test x"$LIBEVENT_CFLAGS" = x"-Iyes" -o x"$LIBEVENT_LDFLAGS" = x"-Lyes" ; then
148 AC_MSG_ERROR([--with-libevent requires a path])
150 AC_MSG_RESULT([$use_bundled_libevent])
151 if test x"$use_bundled_libevent" = x"yes" ; then
152 AC_CONFIG_SUBDIRS([libevent])
154 AC_SUBST(LIBEVENT_CFLAGS)
155 AC_SUBST(LIBEVENT_LDFLAGS)
156 AM_CONDITIONAL(USE_BUILTIN_LIBEVENT, test x"$use_bundled_libevent" = x"yes")
159 dnl Whether to disable bundled tdb
160 AC_DEFUN([AC_NETATALK_TDB], [
163 [AS_HELP_STRING([--with-tdb],[whether to use the bundled tdb (default: yes)])],
164 use_bundled_tdb=$withval,
167 AC_MSG_CHECKING([whether to use bundled tdb])
168 AC_MSG_RESULT([$use_bundled_tdb])
170 if test x"$use_bundled_tdb" = x"yes" ; then
171 AC_DEFINE(USE_BUILTIN_TDB, 1, [Use internal tbd])
173 if test -z "$TDB_LIBS" ; then
174 PKG_CHECK_MODULES(TDB, tdb, , [AC_MSG_ERROR([couldn't find tdb with pkg-config])])
181 AM_CONDITIONAL(USE_BUILTIN_TDB, test x"$use_bundled_tdb" = x"yes")
184 dnl Filesystem Hierarchy Standard (FHS) compatibility
185 AC_DEFUN([AC_NETATALK_FHS], [
186 AC_MSG_CHECKING([whether to use Filesystem Hierarchy Standard (FHS) compatibility])
188 [ --enable-fhs use Filesystem Hierarchy Standard (FHS) compatibility],[
189 if test "$enableval" = "yes"; then
195 mandir="/usr/share/man"
196 uams_path="${libdir}/netatalk"
197 PKGCONFDIR="${sysconfdir}"
198 SERVERTEXT="${localstatedir}/netatalk/msg"
200 AC_DEFINE(FHS_COMPATIBILITY, 1, [Define if you want compatibily with the FHS])
202 atalk_cv_fhs_compat=yes
205 atalk_cv_fhs_compat=no
209 atalk_cv_fhs_compat=no
212 dnl netatalk lockfile path
213 AC_DEFUN([AC_NETATALK_LOCKFILE], [
214 AC_MSG_CHECKING([netatalk lockfile path])
217 [AS_HELP_STRING([--with-lockfile=PATH],[Path of netatalk lockfile])],
218 ac_cv_netatalk_lock=$withval,
219 ac_cv_netatalk_lock=""
221 if test -z "$ac_cv_netatalk_lock" ; then
222 ac_cv_netatalk_lock=/var/spool/locks/netatalk
223 if test x"$atalk_cv_fhs_compat" = x"yes" ; then
224 ac_cv_netatalk_lock=/var/run/netatalk.pid
228 ac_cv_netatalk_lock=/var/spool/lock/netatalk
231 ac_cv_netatalk_lock=/var/run/netatalk.pid
234 ac_cv_netatalk_lock=/var/lock/netatalk
239 AC_DEFINE_UNQUOTED(PATH_NETATALK_LOCK, ["$ac_cv_netatalk_lock"], [netatalk lockfile path])
240 AC_SUBST(PATH_NETATALK_LOCK, ["$ac_cv_netatalk_lock"])
241 AC_MSG_RESULT([$ac_cv_netatalk_lock])
244 dnl 64bit platform check
245 AC_DEFUN([AC_NETATALK_64BIT_LIBS], [
246 AC_MSG_CHECKING([whether to check for 64bit libraries])
247 # Test if the compiler is in 64bit mode
248 echo 'int i;' > conftest.$ac_ext
249 atalk_cv_cc_64bit_output=no
250 if AC_TRY_EVAL(ac_compile); then
251 case `/usr/bin/file conftest.$ac_objext` in
253 atalk_cv_cc_64bit_output=yes
259 case $host_cpu:$atalk_cv_cc_64bit_output in
260 powerpc64:yes | s390x:yes | sparc*:yes | x86_64:yes | i386:yes)
264 atalk_libname="lib/64"
272 atalk_libname="lib64"
283 dnl Check for optional admin group support
284 AC_DEFUN([AC_NETATALK_ADMIN_GROUP], [
285 netatalk_cv_admin_group=yes
286 AC_MSG_CHECKING([for administrative group support])
287 AC_ARG_ENABLE(admin-group,
288 [ --disable-admin-group disable admin group],[
289 if test x"$enableval" = x"no"; then
290 AC_DEFINE(ADMIN_GRP, 0, [Define if the admin group should be enabled])
291 netatalk_cv_admin_group=no
294 AC_DEFINE(ADMIN_GRP, 1, [Define if the admin group should be enabled])
297 AC_DEFINE(ADMIN_GRP, 1, [Define if the admin group should be enabled])
302 dnl Check for optional cracklib support
303 AC_DEFUN([AC_NETATALK_CRACKLIB], [
304 netatalk_cv_with_cracklib=no
305 AC_ARG_WITH(cracklib,
306 [ --with-cracklib[[=DICT]] enable/set location of cracklib dictionary [[no]]],[
307 if test "x$withval" != "xno" ; then
309 AC_CHECK_LIB(crack, main, [
310 AC_DEFINE(USE_CRACKLIB, 1, [Define if cracklib should be used])
312 if test "$cracklib" = "yes"; then
313 cracklib="/usr/$atalk_libname/cracklib_dict"
315 AC_DEFINE_UNQUOTED(_PATH_CRACKLIB, "$cracklib",
316 [path to cracklib dictionary])
317 AC_MSG_RESULT([setting cracklib dictionary to $cracklib])
318 netatalk_cv_with_cracklib=yes
320 AC_MSG_ERROR([cracklib not found!])
326 AC_MSG_CHECKING([for cracklib support])
327 AC_MSG_RESULT([$netatalk_cv_with_cracklib])
330 dnl Check whether to enable debug code
331 AC_DEFUN([AC_NETATALK_DEBUG], [
332 AC_MSG_CHECKING([whether to enable verbose debug code])
334 [ --enable-debug enable verbose debug code],[
335 if test "$enableval" != "no"; then
336 if test "$enableval" = "yes"; then
337 AC_DEFINE(DEBUG, 1, [Define if verbose debugging information should be included])
339 AC_DEFINE_UNQUOTED(DEBUG, $enableval, [Define if verbose debugging information should be included])
344 AC_DEFINE(NDEBUG, 1, [Disable assertions])
348 AC_DEFINE(NDEBUG, 1, [Disable assertions])
353 dnl Check whethe to disable tickle SIGALARM stuff, which eases debugging
354 AC_DEFUN([AC_NETATALK_DEBUGGING], [
355 AC_MSG_CHECKING([whether to enable debugging with debuggers])
356 AC_ARG_ENABLE(debugging,
357 [ --enable-debugging disable SIGALRM timers and DSI tickles (eg for debugging with gdb/dbx/...)],[
358 if test "$enableval" != "no"; then
359 if test "$enableval" = "yes"; then
360 AC_DEFINE(DEBUGGING, 1, [Define if you want to disable SIGALRM timers and DSI tickles])
362 AC_DEFINE_UNQUOTED(DEBUGGING, $enableval, [Define if you want to disable SIGALRM timers and DSI tickles])
375 dnl Check for optional shadow password support
376 AC_DEFUN([AC_NETATALK_SHADOW], [
377 netatalk_cv_use_shadowpw=no
379 [ --with-shadow enable shadow password support [[auto]]],
380 [netatalk_cv_use_shadowpw="$withval"],
381 [netatalk_cv_use_shadowpw=auto]
384 if test "x$netatalk_cv_use_shadowpw" != "xno"; then
385 AC_CHECK_HEADER([shadow.h])
386 if test x"$ac_cv_header_shadow_h" = x"yes"; then
387 netatalk_cv_use_shadowpw=yes
388 AC_DEFINE(SHADOWPW, 1, [Define if shadow passwords should be used])
390 if test "x$shadowpw" = "xyes"; then
391 AC_MSG_ERROR([shadow support not available])
393 netatalk_cv_use_shadowpw=no
398 AC_MSG_CHECKING([whether shadow support should be enabled])
399 if test "x$netatalk_cv_use_shadowpw" = "xyes"; then
406 dnl Check for optional valid-shell-check support
407 AC_DEFUN([AC_NETATALK_SHELL_CHECK], [
408 netatalk_cv_use_shellcheck=yes
409 AC_MSG_CHECKING([whether checking for a valid shell should be enabled])
410 AC_ARG_ENABLE(shell-check,
411 [ --disable-shell-check disable checking for a valid shell],[
412 if test "$enableval" = "no"; then
413 AC_DEFINE(DISABLE_SHELLCHECK, 1, [Define if shell check should be disabled])
415 netatalk_cv_use_shellcheck=no
425 dnl Check for optional initscript install
426 AC_DEFUN([AC_NETATALK_INIT_STYLE], [
427 AC_ARG_WITH(init-style,
428 [ --with-init-style use OS specific init config [[redhat-sysv|redhat-systemd|suse-sysv|suse-systemd|gentoo|netbsd|debian|solaris|systemd]]],
429 init_style="$withval", init_style=none
431 case "$init_style" in
433 AC_MSG_ERROR([--with-init-style=redhat is obsoleted. Use redhat-sysv or redhat-systemd.])
436 AC_MSG_RESULT([enabling redhat-style sysv initscript support])
437 ac_cv_init_dir="/etc/rc.d/init.d"
440 AC_MSG_RESULT([enabling redhat-style systemd support])
441 ac_cv_init_dir="/usr/lib/systemd/system"
444 AC_MSG_ERROR([--with-init-style=suse is obsoleted. Use suse-sysv or suse-systemd.])
447 AC_MSG_RESULT([enabling suse-style sysv initscript support])
448 ac_cv_init_dir="/etc/init.d"
451 AC_MSG_RESULT([enabling suse-style systemd support (>=openSUSE12.1)])
452 ac_cv_init_dir="/usr/lib/systemd/system"
455 AC_MSG_RESULT([enabling gentoo-style initscript support])
456 ac_cv_init_dir="/etc/init.d"
459 AC_MSG_RESULT([enabling netbsd-style initscript support])
460 ac_cv_init_dir="/etc/rc.d"
463 AC_MSG_RESULT([enabling debian-style initscript support])
464 ac_cv_init_dir="/etc/init.d"
467 AC_MSG_RESULT([enabling solaris-style SMF support])
468 ac_cv_init_dir="/lib/svc/manifest/network/"
471 AC_MSG_RESULT([enabling general systemd support])
472 ac_cv_init_dir="/usr/lib/systemd/system"
475 AC_MSG_RESULT([disabling init-style support])
476 ac_cv_init_dir="none"
479 AC_MSG_ERROR([illegal init-style])
482 AM_CONDITIONAL(USE_NETBSD, test x$init_style = xnetbsd)
483 AM_CONDITIONAL(USE_REDHAT_SYSV, test x$init_style = xredhat-sysv)
484 AM_CONDITIONAL(USE_SUSE_SYSV, test x$init_style = xsuse-sysv)
485 AM_CONDITIONAL(USE_SOLARIS, test x$init_style = xsolaris)
486 AM_CONDITIONAL(USE_GENTOO, test x$init_style = xgentoo)
487 AM_CONDITIONAL(USE_DEBIAN, test x$init_style = xdebian)
488 AM_CONDITIONAL(USE_SYSTEMD, test x$init_style = xsystemd || test x$init_style = xredhat-systemd || test x$init_style = xsuse-systemd)
489 AM_CONDITIONAL(USE_UNDEF, test x$init_style = xnone)
491 AC_ARG_WITH(init-dir,
492 [ --with-init-dir=PATH path to OS specific init directory],
493 ac_cv_init_dir="$withval", ac_cv_init_dir="$ac_cv_init_dir"
495 INIT_DIR="$ac_cv_init_dir"
496 AC_SUBST(INIT_DIR, ["$ac_cv_init_dir"])
499 dnl OS specific configuration
500 AC_DEFUN([AC_NETATALK_OS_SPECIFIC], [
502 *aix*) this_os=aix ;;
503 *freebsd*) this_os=freebsd ;;
504 *hpux11*) this_os=hpux11 ;;
505 *irix*) this_os=irix ;;
506 *linux*) this_os=linux ;;
507 *osx*) this_os=macosx ;;
508 *darwin*) this_os=macosx ;;
509 *netbsd*) this_os=netbsd ;;
510 *openbsd*) this_os=openbsd ;;
511 *osf*) this_os=tru64 ;;
512 *solaris*) this_os=solaris ;;
516 i386|i486|i586|i686|k7) this_cpu=x86 ;;
517 alpha) this_cpu=alpha ;;
518 mips) this_cpu=mips ;;
519 powerpc|ppc) this_cpu=ppc ;;
522 dnl --------------------- GNU source
524 linux) AC_DEFINE(_GNU_SOURCE, 1, [Whether to use GNU libc extensions])
526 kfreebsd-gnu) AC_DEFINE(_GNU_SOURCE, 1, [Whether to use GNU libc extensions])
530 dnl --------------------- operating system specific flags (port from sys/*)
532 dnl ----- FreeBSD specific -----
533 if test x"$this_os" = "xfreebsd"; then
534 AC_MSG_RESULT([ * FreeBSD specific configuration])
535 AC_DEFINE(BSD4_4, 1, [BSD compatiblity macro])
536 AC_DEFINE(FREEBSD, 1, [Define if OS is FreeBSD])
537 AC_DEFINE(OPEN_NOFOLLOW_ERRNO, EMLINK, errno returned by open with O_NOFOLLOW)
540 dnl ----- GNU/kFreeBSD specific -----
541 if test x"$this_os" = "xkfreebsd-gnu"; then
542 AC_MSG_RESULT([ * GNU/kFreeBSD specific configuration])
543 AC_DEFINE(BSD4_4, 1, [BSD compatiblity macro])
544 AC_DEFINE(FREEBSD, 1, [Define if OS is FreeBSD])
545 AC_DEFINE(OPEN_NOFOLLOW_ERRNO, EMLINK, errno returned by open with O_NOFOLLOW)
548 dnl ----- Linux specific -----
549 if test x"$this_os" = "xlinux"; then
550 AC_MSG_RESULT([ * Linux specific configuration])
551 AC_DEFINE(LINUX, 1, [OS is Linux])
552 dnl ----- check if we need the quotactl wrapper
553 AC_CHECK_HEADERS(linux/dqblk_xfs.h,,
554 [AC_CHECK_HEADERS(linux/xqm.h linux/xfs_fs.h)
555 AC_CHECK_HEADERS(xfs/libxfs.h xfs/xqm.h xfs/xfs_fs.h)]
559 dnl ----- as far as I can tell, dbtob always does the wrong thing
560 dnl ----- on every single version of linux I've ever played with.
561 dnl ----- see etc/afpd/quota.c
562 AC_DEFINE(HAVE_BROKEN_DBTOB, 1, [Define if dbtob is broken])
567 dnl ----- NetBSD specific -----
568 if test x"$this_os" = "xnetbsd"; then
569 AC_MSG_RESULT([ * NetBSD specific configuration])
570 AC_DEFINE(BSD4_4, 1, [BSD compatiblity macro])
571 AC_DEFINE(NETBSD, 1, [Define if OS is NetBSD])
572 AC_DEFINE(OPEN_NOFOLLOW_ERRNO, EFTYPE, errno returned by open with O_NOFOLLOW)
574 CFLAGS="-I\$(top_srcdir)/sys/netbsd $CFLAGS"
577 dnl ----- NetBSD does not have crypt.h, uses unistd.h -----
578 AC_DEFINE(UAM_DHX, 1, [Define if the DHX UAM modules should be compiled])
581 dnl ----- OpenBSD specific -----
582 if test x"$this_os" = "xopenbsd"; then
583 AC_MSG_RESULT([ * OpenBSD specific configuration])
584 AC_DEFINE(BSD4_4, 1, [BSD compatiblity macro])
585 dnl ----- OpenBSD does not have crypt.h, uses unistd.h -----
586 AC_DEFINE(UAM_DHX, 1, [Define if the DHX UAM modules should be compiled])
589 dnl ----- Solaris specific -----
590 if test x"$this_os" = "xsolaris"; then
591 AC_MSG_RESULT([ * Solaris specific configuration])
592 AC_DEFINE(__svr4__, 1, [Solaris compatibility macro])
593 AC_DEFINE(_ISOC9X_SOURCE, 1, [Compatibility macro])
594 AC_DEFINE(NO_STRUCT_TM_GMTOFF, 1, [Define if the gmtoff member of struct tm is not available])
595 AC_DEFINE(SOLARIS, 1, [Solaris compatibility macro])
596 AC_DEFINE(_XOPEN_SOURCE, 600, [Solaris compilation environment])
597 AC_DEFINE(__EXTENSIONS__, 1, [Solaris compilation environment])
602 dnl Whether to run ldconfig after installing libraries
603 AC_PATH_PROG(NETA_LDCONFIG, ldconfig, , [$PATH$PATH_SEPARATOR/sbin$PATH_SEPARATOR/bin$PATH_SEPARATOR/usr/sbin$PATH_SEPARATOR/usr/bin])
604 echo NETA_LDCONFIG = $NETA_LDCONFIG
605 AM_CONDITIONAL(RUN_LDCONFIG, test x"$this_os" = x"linux" -a x"$NETA_LDCONFIG" != x"")
608 dnl Check for building PGP UAM module
609 AC_DEFUN([AC_NETATALK_PGP_UAM], [
610 AC_MSG_CHECKING([whether the PGP UAM should be build])
611 AC_ARG_ENABLE(pgp-uam,
612 [ --enable-pgp-uam enable build of PGP UAM module],[
613 if test "$enableval" = "yes"; then
614 if test "x$neta_cv_have_openssl" = "xyes"; then
615 AC_DEFINE(UAM_PGP, 1, [Define if the PGP UAM module should be compiled])
628 dnl Check for building Kerberos V UAM module
629 AC_DEFUN([AC_NETATALK_KRB5_UAM], [
630 netatalk_cv_build_krb5_uam=no
631 AC_ARG_ENABLE(krbV-uam,
632 [ --enable-krbV-uam enable build of Kerberos V UAM module],
634 if test x"$enableval" = x"yes"; then
635 NETATALK_GSSAPI_CHECK([
636 netatalk_cv_build_krb5_uam=yes
638 AC_MSG_ERROR([need GSSAPI to build Kerberos V UAM])
645 AC_MSG_CHECKING([whether Kerberos V UAM should be build])
646 if test x"$netatalk_cv_build_krb5_uam" = x"yes"; then
651 AM_CONDITIONAL(USE_GSSAPI, test x"$netatalk_cv_build_krb5_uam" = x"yes")
654 dnl Check if we can directly use Kerberos 5 API, used for reading keytabs
655 dnl and automatically construction DirectoryService names from that, instead
656 dnl of requiring special configuration in afp.conf
657 AC_DEFUN([AC_NETATALK_KERBEROS], [
658 AC_MSG_CHECKING([for Kerberos 5 (necessary for GetSrvrInfo:DirectoryNames support)])
659 AC_ARG_WITH([kerberos],
660 [AS_HELP_STRING([--with-kerberos], [Kerberos 5 support (default=auto)])],
662 [with_kerberos=auto])
663 AC_MSG_RESULT($with_kerberos)
665 if test x"$with_kerberos" != x"no"; then
666 have_krb5_header="no"
667 AC_CHECK_HEADERS([krb5/krb5.h krb5.h], [have_krb5_header="yes"; break])
668 if test x"$have_krb5_header" = x"no" && test x"$with_kerberos" != x"auto"; then
669 AC_MSG_FAILURE([--with-kerberos was given, but no headers found])
672 AC_PATH_PROG([KRB5_CONFIG], [krb5-config])
673 AC_MSG_CHECKING([for krb5-config])
674 if test -x "$KRB5_CONFIG"; then
675 AC_MSG_RESULT([$KRB5_CONFIG])
676 KRB5_CFLAGS="`$KRB5_CONFIG --cflags krb5`"
677 KRB5_LIBS="`$KRB5_CONFIG --libs krb5`"
678 AC_SUBST(KRB5_CFLAGS)
682 AC_MSG_RESULT([not found])
683 if test x"$with_kerberos" != x"auto"; then
684 AC_MSG_FAILURE([--with-kerberos was given, but krb5-config could not be found])
689 if test x"$with_kerberos" = x"yes"; then
690 AC_DEFINE([HAVE_KERBEROS], [1], [Define if Kerberos 5 is available])
693 dnl Check for krb5_free_unparsed_name and krb5_free_error_message
694 save_CFLAGS="$CFLAGS"
696 CFLAGS="$KRB5_CFLAGS"
698 AC_CHECK_FUNCS([krb5_free_unparsed_name krb5_free_error_message krb5_free_keytab_entry_contents krb5_kt_free_entry])
699 CFLAGS="$save_CFLAGS"
703 dnl Check for overwrite the config files or not
704 AC_DEFUN([AC_NETATALK_OVERWRITE_CONFIG], [
705 AC_MSG_CHECKING([whether configuration files should be overwritten])
706 AC_ARG_ENABLE(overwrite,
707 [ --enable-overwrite overwrite configuration files during installation],
708 [OVERWRITE_CONFIG="${enable_overwrite}"],
709 [OVERWRITE_CONFIG="no"]
711 AC_MSG_RESULT([$OVERWRITE_CONFIG])
712 AC_SUBST(OVERWRITE_CONFIG)
715 dnl Check for LDAP support, for client-side ACL visibility
716 AC_DEFUN([AC_NETATALK_LDAP], [
717 AC_MSG_CHECKING(for LDAP (necessary for client-side ACL visibility))
719 [AS_HELP_STRING([--with-ldap[[=PATH]]],
720 [LDAP support (default=auto)])],
721 netatalk_cv_ldap=$withval,
722 netatalk_cv_ldap=auto
724 AC_MSG_RESULT($netatalk_cv_ldap)
726 save_CFLAGS="$CFLAGS"
727 save_LDFLAGS="$LDFLAGS"
736 if test x"$netatalk_cv_ldap" != x"no" ; then
737 if test x"$netatalk_cv_ldap" != x"yes" -a x"$netatalk_cv_ldap" != x"auto"; then
738 CFLAGS="-I$netatalk_cv_ldap/include"
739 LDFLAGS="-L$netatalk_cv_ldap/lib"
741 AC_CHECK_HEADER([ldap.h], netatalk_cv_ldap=yes,
742 [ if test x"$netatalk_cv_ldap" = x"yes" ; then
743 AC_MSG_ERROR([Missing LDAP headers])
747 AC_CHECK_LIB(ldap, ldap_init, netatalk_cv_ldap=yes,
748 [ if test x"$netatalk_cv_ldap" = x"yes" ; then
749 AC_MSG_ERROR([Missing LDAP library])
755 if test x"$netatalk_cv_ldap" = x"yes"; then
756 LDAP_CFLAGS="$CFLAGS"
757 LDAP_LDFLAGS="$LDFLAGS"
759 AC_DEFINE(HAVE_LDAP,1,[Whether LDAP is available])
762 AC_SUBST(LDAP_CFLAGS)
763 AC_SUBST(LDAP_LDFLAGS)
765 CFLAGS="$save_CFLAGS"
766 LDFLAGS="$save_LDFLAGS"
770 dnl Check for ACL support
771 AC_DEFUN([AC_NETATALK_ACL], [
773 AC_MSG_CHECKING(whether to support ACLs)
775 [AS_HELP_STRING([--with-acls],
776 [Include ACL support (default=auto)])],
779 with_acl_support="$withval"
782 with_acl_support=auto
785 [with_acl_support=auto])
786 AC_MSG_RESULT($with_acl_support)
788 if test x"$with_acl_support" = x"no"; then
789 AC_MSG_RESULT(Disabling ACL support)
792 # Platform specific checks
793 if test x"$with_acl_support" != x"no" ; then
796 AC_MSG_NOTICE(Using solaris ACLs)
797 AC_DEFINE(HAVE_SOLARIS_ACLS,1,[Whether Solaris ACLs are available])
798 AC_DEFINE(HAVE_NFSV4_ACLS,1,[Whether NFSv4 ACLs are available])
799 ACL_LIBS="$ACL_LIBS -lsec"
803 AC_MSG_NOTICE(checking whether libsunacl is available)
804 sunacl_include_path="/usr/local/include"
805 sunacl_lib_path="/usr/local/lib"
807 save_CPPFLAGS=$CPPFLAGS
808 save_LDFLAGS=$LDFLAGS
811 CPPFLAGS="-I$sunacl_include_path $CPPFLAGS"
812 AC_CHECK_HEADER([sunacl.h])
814 LDFLAGS="-L$sunacl_lib_path $LDFLAGS"
815 AC_CHECK_LIB([sunacl], [acl])
817 if test x"$ac_cv_header_sunacl_h" = x"yes" -a x"$ac_cv_lib_sunacl_acl" = x"yes" ; then
818 AC_MSG_NOTICE([Enabling support for ZFS ACLs using libsunacl])
820 CFLAGS="-I$sunacl_include_path $CFLAGS"
821 ACL_LIBS="$ACL_LIBS -L$sunacl_lib_path -lsunacl"
822 AC_DEFINE(HAVE_FREEBSD_SUNACL, 1, [Whether FreeBSD ZFS ACLs with libsunacl are available])
823 AC_DEFINE(HAVE_NFSV4_ACLS,1,[Whether NFSv4 ACLs are available])
825 AC_MSG_NOTICE([libsunacl not found, disabling ZFS ACL support])
828 CPPFLAGS=$save_CPPFLAGS
829 LDFLAGS=$save_LDFLAGS
835 if test x"$with_acl_support" != x"no" -a x"$ac_cv_have_acls" != x"yes" ; then
836 # Runtime checks for POSIX ACLs
837 AC_CHECK_LIB(acl,acl_get_file,[ACL_LIBS="$ACL_LIBS -lacl"])
840 AC_CHECK_LIB(attr,getxattr,[ACL_LIBS="$ACL_LIBS -lattr"])
844 AC_CACHE_CHECK([for POSIX ACL support],netatalk_cv_HAVE_POSIX_ACLS,[
846 LIBS="$LIBS $ACL_LIBS"
847 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
848 #include <sys/types.h>
853 acl_entry_t *entry_p;
854 return acl_get_entry(acl, entry_id, entry_p);
856 [netatalk_cv_HAVE_POSIX_ACLS=yes; ac_cv_have_acls=yes],
857 [netatalk_cv_HAVE_POSIX_ACLS=no; ac_cv_have_acls=no]
862 if test x"$netatalk_cv_HAVE_POSIX_ACLS" = x"yes"; then
863 AC_MSG_NOTICE(Using POSIX ACLs)
864 AC_DEFINE(HAVE_POSIX_ACLS,1,[Whether POSIX ACLs are available])
866 AC_CACHE_CHECK([for acl_get_perm_np],netatalk_cv_HAVE_ACL_GET_PERM_NP,[
868 LIBS="$LIBS $ACL_LIBS"
869 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
870 #include <sys/types.h>
873 acl_permset_t permset_d;
875 return acl_get_perm_np(permset_d, perm);
876 ]])],[netatalk_cv_HAVE_ACL_GET_PERM_NP=yes],[netatalk_cv_HAVE_ACL_GET_PERM_NP=no])
879 if test x"$netatalk_cv_HAVE_ACL_GET_PERM_NP" = x"yes"; then
880 AC_DEFINE(HAVE_ACL_GET_PERM_NP,1,[Whether acl_get_perm_np() is available])
883 AC_CACHE_CHECK([for acl_from_mode], netatalk_cv_HAVE_ACL_FROM_MODE,[
885 LIBS="$LIBS $ACL_LIBS"
886 AC_CHECK_FUNCS(acl_from_mode,
887 [netatalk_cv_HAVE_ACL_FROM_MODE=yes],
888 [netatalk_cv_HAVE_ACL_FROM_MODE=no]
892 if test x"netatalk_cv_HAVE_ACL_FROM_MODE" = x"yes"; then
893 AC_DEFINE(HAVE_ACL_FROM_MODE,1,[Whether acl_from_mode() is available])
898 if test x"$ac_cv_have_acls" = x"no" ; then
899 if test x"$with_acl_support" = x"yes" ; then
900 AC_MSG_ERROR(ACL support requested but not found)
902 AC_MSG_NOTICE(ACL support is not avaliable)
905 AC_CHECK_HEADERS([acl/libacl.h])
906 AC_DEFINE(HAVE_ACLS,1,[Whether ACLs support is available])
911 dnl Check for Extended Attributes support
912 AC_DEFUN([AC_NETATALK_EXTENDED_ATTRIBUTES], [
914 neta_cv_eas_sys_found=no
915 neta_cv_eas_sys_not_found=no
917 AC_CHECK_HEADERS(sys/attributes.h attr/xattr.h sys/xattr.h sys/extattr.h sys/uio.h sys/ea.h)
922 AC_SEARCH_LIBS(getproplist, [proplist])
923 AC_CHECK_FUNCS([getproplist fgetproplist setproplist fsetproplist],
924 [neta_cv_eas_sys_found=yes],
925 [neta_cv_eas_sys_not_found=yes])
926 AC_CHECK_FUNCS([delproplist fdelproplist add_proplist_entry get_proplist_entry],,
927 [neta_cv_eas_sys_not_found=yes])
928 AC_CHECK_FUNCS([sizeof_proplist_entry],,
929 [neta_cv_eas_sys_not_found=yes])
933 AC_CHECK_FUNCS([attropen],
934 [neta_cv_eas_sys_found=yes; AC_DEFINE(HAVE_EAFD, 1, [extattr API has full fledged fds for EAs])],
935 [neta_cv_eas_sys_not_found=yes])
939 AC_CHECK_FUNCS([extattr_delete_fd extattr_delete_file extattr_delete_link],
940 [neta_cv_eas_sys_found=yes],
941 [neta_cv_eas_sys_not_found=yes])
942 AC_CHECK_FUNCS([extattr_get_fd extattr_get_file extattr_get_link],,
943 [neta_cv_eas_sys_not_found=yes])
944 AC_CHECK_FUNCS([extattr_list_fd extattr_list_file extattr_list_link],,
945 [neta_cv_eas_sys_not_found=yes])
946 AC_CHECK_FUNCS([extattr_set_fd extattr_set_file extattr_set_link],,
947 [neta_cv_eas_sys_not_found=yes])
950 *freebsd4* | *dragonfly* )
951 AC_DEFINE(BROKEN_EXTATTR, 1, [Does extattr API work])
955 AC_SEARCH_LIBS(getxattr, [attr])
957 if test "x$neta_cv_eas_sys_found" != "xyes" ; then
958 AC_CHECK_FUNCS([getxattr lgetxattr fgetxattr listxattr llistxattr],
959 [neta_cv_eas_sys_found=yes],
960 [neta_cv_eas_sys_not_found=yes])
961 AC_CHECK_FUNCS([flistxattr removexattr lremovexattr fremovexattr],,
962 [neta_cv_eas_sys_not_found=yes])
963 AC_CHECK_FUNCS([setxattr lsetxattr fsetxattr],,
964 [neta_cv_eas_sys_not_found=yes])
967 if test "x$neta_cv_eas_sys_found" != "xyes" ; then
968 AC_CHECK_FUNCS([getea fgetea lgetea listea flistea llistea],
969 [neta_cv_eas_sys_found=yes],
970 [neta_cv_eas_sys_not_found=yes])
971 AC_CHECK_FUNCS([removeea fremoveea lremoveea setea fsetea lsetea],,
972 [neta_cv_eas_sys_not_found=yes])
975 if test "x$neta_cv_eas_sys_found" != "xyes" ; then
976 AC_CHECK_FUNCS([attr_get attr_list attr_set attr_remove],,
977 [neta_cv_eas_sys_not_found=yes])
978 AC_CHECK_FUNCS([attr_getf attr_listf attr_setf attr_removef],,
979 [neta_cv_eas_sys_not_found=yes])
984 # Do xattr functions take additional options like on Darwin?
985 if test x"$ac_cv_func_getxattr" = x"yes" ; then
986 AC_CACHE_CHECK([whether xattr interface takes additional options], smb_attr_cv_xattr_add_opt, [
988 LIBS="$LIBS $ACL_LIBS"
989 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
990 #include <sys/types.h>
991 #if HAVE_ATTR_XATTR_H
992 #include <attr/xattr.h>
993 #elif HAVE_SYS_XATTR_H
994 #include <sys/xattr.h>
997 getxattr(0, 0, 0, 0, 0, 0);
998 ]])],[smb_attr_cv_xattr_add_opt=yes],[smb_attr_cv_xattr_add_opt=no;LIBS=$old_LIBS])
1000 if test x"$smb_attr_cv_xattr_add_opt" = x"yes"; then
1001 AC_DEFINE(XATTR_ADD_OPT, 1, [xattr functions have additional options])
1005 if test "x$neta_cv_eas_sys_found" = "xyes" ; then
1006 if test "x$neta_cv_eas_sys_not_found" != "xyes" ; then
1007 neta_cv_eas="$neta_cv_eas | sys"
1010 AC_DEFINE_UNQUOTED(EA_MODULES,["$neta_cv_eas"],[Available Extended Attributes modules])
1013 dnl Check for libsmbsharemodes from Samba for Samba/Netatalk access/deny/share modes interop
1014 dnl Defines "neta_cv_have_smbshmd" to "yes" or "no"
1015 dnl AC_SUBST's "SMB_SHAREMODES_CFLAGS" and "SMB_SHAREMODES_LDFLAGS"
1016 dnl AM_CONDITIONAL's "USE_SMB_SHAREMODES"
1017 AC_DEFUN([AC_NETATALK_SMB_SHAREMODES], [
1018 neta_cv_have_smbshmd=no
1019 AC_ARG_WITH(smbsharemodes-lib,
1020 [ --with-smbsharemodes-lib=PATH PATH to libsmbsharemodes lib from Samba],
1021 [SMB_SHAREMODES_LDFLAGS="-L$withval -lsmbsharemodes"]
1023 AC_ARG_WITH(smbsharemodes-include,
1024 [ --with-smbsharemodes-include=PATH PATH to libsmbsharemodes header from Samba],
1025 [SMB_SHAREMODES_CFLAGS="-I$withval"]
1027 AC_ARG_WITH(smbsharemodes,
1028 [AS_HELP_STRING([--with-smbsharemodes],[Samba interop (default is yes)])],
1029 [use_smbsharemodes=$withval],
1030 [use_smbsharemodes=yes]
1033 if test x"$use_smbsharemodes" = x"yes" ; then
1034 AC_MSG_CHECKING([whether to enable Samba/Netatalk access/deny/share-modes interop])
1036 saved_CFLAGS="$CFLAGS"
1037 saved_LDFLAGS="$LDFLAGS"
1038 CFLAGS="$SMB_SHAREMODES_CFLAGS $CFLAGS"
1039 LDFLAGS="$SMB_SHAREMODES_LDFLAGS $LDFLAGS"
1042 [#include <unistd.h>
1044 #include <sys/time.h>
1047 /* From messages.h */
1051 #include "smb_share_modes.h"
1052 int main(void) { (void)smb_share_mode_db_open(""); return 0;}],
1053 [neta_cv_have_smbshmd=yes]
1056 AC_MSG_RESULT($neta_cv_have_smbshmd)
1057 AC_SUBST(SMB_SHAREMODES_CFLAGS, [$SMB_SHAREMODES_CFLAGS])
1058 AC_SUBST(SMB_SHAREMODES_LDFLAGS, [$SMB_SHAREMODES_LDFLAGS])
1059 CFLAGS="$saved_CFLAGS"
1060 LDFLAGS="$saved_LDFLAGS"
1063 AM_CONDITIONAL(USE_SMB_SHAREMODES, test x"$neta_cv_have_smbshmd" = x"yes")
1066 dnl ------ Check for sendfile() --------
1067 AC_DEFUN([AC_NETATALK_SENDFILE], [
1068 netatalk_cv_search_sendfile=yes
1069 AC_ARG_ENABLE(sendfile,
1070 [ --disable-sendfile disable sendfile syscall],
1071 [if test x"$enableval" = x"no"; then
1072 netatalk_cv_search_sendfile=no
1076 if test x"$netatalk_cv_search_sendfile" = x"yes"; then
1079 AC_DEFINE(SENDFILE_FLAVOR_LINUX,1,[Whether linux sendfile() API is available])
1080 AC_CHECK_FUNC([sendfile], [netatalk_cv_HAVE_SENDFILE=yes])
1084 AC_DEFINE(SENDFILE_FLAVOR_SOLARIS, 1, [Solaris sendfile()])
1085 AC_SEARCH_LIBS(sendfile, sendfile)
1086 AC_CHECK_FUNC([sendfile], [netatalk_cv_HAVE_SENDFILE=yes])
1087 AC_CHECK_FUNCS([sendfilev])
1091 AC_DEFINE(SENDFILE_FLAVOR_BSD, 1, [Define if the sendfile() function uses BSD semantics])
1092 AC_CHECK_FUNC([sendfile], [netatalk_cv_HAVE_SENDFILE=yes])
1100 if test x"$netatalk_cv_HAVE_SENDFILE" = x"yes"; then
1101 AC_DEFINE(WITH_SENDFILE,1,[Whether sendfile() should be used])
1106 dnl --------------------- Check if realpath() takes NULL
1107 AC_DEFUN([AC_NETATALK_REALPATH], [
1108 AC_CACHE_CHECK([if the realpath function allows a NULL argument],
1109 neta_cv_REALPATH_TAKES_NULL, [
1110 AC_RUN_IFELSE([AC_LANG_SOURCE([[
1115 void exit_on_core(int ignored) {
1121 signal(SIGSEGV, exit_on_core);
1122 newpath = realpath("/tmp", NULL);
1123 exit((newpath != NULL) ? 0 : 1);
1124 }]])],[neta_cv_REALPATH_TAKES_NULL=yes],[neta_cv_REALPATH_TAKES_NULL=no],[neta_cv_REALPATH_TAKES_NULL=cross
1129 if test x"$neta_cv_REALPATH_TAKES_NULL" = x"yes"; then
1130 AC_DEFINE(REALPATH_TAKES_NULL,1,[Whether the realpath function allows NULL])