1 dnl Kitchen sink for configuration macros
3 dnl Whether to enable developer build
4 AC_DEFUN([AC_DEVELOPER], [
5 AC_MSG_CHECKING([whether to enable developer build])
8 AS_HELP_STRING([--enable-developer], [whether to enable developer build (ABI checking)]),
12 AC_MSG_RESULT([$enable_dev])
13 AM_CONDITIONAL(DEVELOPER, test x"$enable_dev" = x"yes")
16 dnl Tracker, for Spotlight
17 AC_DEFUN([AC_NETATALK_SPOTLIGHT], [
19 ac_cv_tracker_pkg_default=tracker-sparql-0.12
20 AC_ARG_WITH([tracker-pkg-config],
21 [AS_HELP_STRING([--with-tracker-pkg-config],[name of the Tracker SPARQL pkg in pkg-config])],
22 [ac_cv_tracker_pkg=$withval],
23 [ac_cv_tracker_pkg=$ac_cv_tracker_pkg_default])
25 PKG_CHECK_MODULES([TRACKER], [$ac_cv_tracker_pkg >= 0.12], [ac_cv_have_tracker=yes], [ac_cv_have_tracker=no])
27 if test x"$ac_cv_have_tracker" = x"no" ; then
28 if test x"$need_tracker" = x"yes" ; then
29 AC_MSG_ERROR([$ac_cv_tracker_pkg not found])
32 AC_DEFINE(HAVE_TRACKER, 1, [Define if Tracker is available])
33 AC_DEFINE(HAVE_TRACKER_SPARQL, 1, [Define if Tracker SPARQL is available])
34 ac_cv_tracker_prefix=`pkg-config --variable=prefix $ac_cv_tracker_pkg`
35 AC_DEFINE_UNQUOTED(TRACKER_PREFIX, ["$ac_cv_tracker_prefix"], [Path to Tracker])
38 ac_cv_tracker_miner_pkg_default=tracker-miner-0.12
39 AC_ARG_WITH([tracker-miner-pkg-config],
40 [AS_HELP_STRING([--with-tracker-miner-pkg-config],[name of the Tracker miner pkg in pkg-config])],
41 [ac_cv_tracker_miner_pkg=$withval],
42 [ac_cv_tracker_miner_pkg=$ac_cv_tracker_miner_pkg_default])
44 PKG_CHECK_MODULES([TRACKER_MINER], [$ac_cv_tracker_miner_pkg >= 0.12], [ac_cv_have_tracker_miner=yes], [ac_cv_have_tracker_miner=no])
46 if test x"$ac_cv_have_tracker_miner" = x"yes" ; then
47 AC_DEFINE(HAVE_TRACKER_MINER, 1, [Define if Tracker miner library is available])
48 AC_SUBST(TRACKER_MINER_CFLAGS)
49 AC_SUBST(TRACKER_MINER_LIBS)
52 dnl Test for Tracker 0.6 on Solaris and derived platforms
53 if test x"$this_os" = x"solaris" -a x"$ac_cv_have_tracker" = x"no" ; then
54 PKG_CHECK_MODULES([TRACKER], [tracker >= 0.6], [ac_cv_have_tracker_0_6=yes], [ac_cv_have_tracker_0_6=no])
55 if test x"$ac_cv_have_tracker_0_6" = x"yes" ; then
56 AC_DEFINE(HAVE_TRACKER, 1, [Define if Tracker is available])
57 AC_DEFINE(HAVE_TRACKER_0_6, 1, [Define if Tracker 0.6 is available])
58 ac_cv_tracker_prefix=`pkg-config --variable=prefix tracker`
59 AC_DEFINE_UNQUOTED(TRACKER_0_6_PREFIX, ["$ac_cv_tracker_prefix"], [Path to Tracker])
63 AC_SUBST(TRACKER_CFLAGS)
64 AC_SUBST(TRACKER_LIBS)
65 AM_CONDITIONAL(HAVE_TRACKER_SPARQL, [test x"$ac_cv_have_tracker" = x"yes"])
66 AM_CONDITIONAL(HAVE_TRACKER_0_6, [test x"$ac_cv_have_tracker_0_6" = x"yes"])
69 dnl Whether to disable bundled libevent
70 AC_DEFUN([AC_NETATALK_LIBEVENT], [
71 AC_MSG_CHECKING([whether to use bundled libevent])
74 [AS_HELP_STRING([--with-libevent],[whether to use the bundled libevent (default: yes)])],
75 use_bundled_libevent=$withval,
76 use_bundled_libevent=yes
80 [AS_HELP_STRING([--with-libevent-header],[path to libevent header files])],
81 [use_bundled_libevent=no; LIBEVENT_CFLAGS=-I$withval]
85 [AS_HELP_STRING([--with-libevent-lib],[path to libevent library])],
86 [use_bundled_libevent=no; LIBEVENT_LDFLAGS=-L$withval]
88 if test x"$LIBEVENT_CFLAGS" = x"-Iyes" -o x"$LIBEVENT_LDFLAGS" = x"-Lyes" ; then
89 AC_MSG_ERROR([--with-libevent requires a path])
91 AC_MSG_RESULT([$use_bundled_libevent])
92 AC_CONFIG_SUBDIRS([libevent])
93 AC_SUBST(LIBEVENT_CFLAGS)
94 AC_SUBST(LIBEVENT_LDFLAGS)
95 AM_CONDITIONAL(USE_BUILTIN_LIBEVENT, test x"$use_bundled_libevent" = x"yes")
98 dnl Filesystem Hierarchy Standard (FHS) compatibility
99 AC_DEFUN([AC_NETATALK_FHS], [
100 AC_MSG_CHECKING([whether to use Filesystem Hierarchy Standard (FHS) compatibility])
102 [ --enable-fhs use Filesystem Hierarchy Standard (FHS) compatibility],[
103 if test "$enableval" = "yes"; then
109 mandir="/usr/share/man"
110 uams_path="${libdir}/netatalk"
111 PKGCONFDIR="${sysconfdir}"
112 SERVERTEXT="${localstatedir}/netatalk/msg"
114 AC_DEFINE(FHS_COMPATIBILITY, 1, [Define if you want compatibily with the FHS])
116 atalk_cv_fhs_compat=yes
119 atalk_cv_fhs_compat=no
123 atalk_cv_fhs_compat=no
126 dnl netatalk lockfile path
127 AC_DEFUN([AC_NETATALK_LOCKFILE], [
128 AC_MSG_CHECKING([netatalk lockfile path])
131 [AS_HELP_STRING([--with-lockfile=PATH],[Path of netatalk lockfile])],
132 ac_cv_netatalk_lock=$withval,
133 ac_cv_netatalk_lock=""
135 if test -z "$ac_cv_netatalk_lock" ; then
136 ac_cv_netatalk_lock=/var/spool/locks/netatalk
137 if test x"$atalk_cv_fhs_compat" = x"yes" ; then
138 ac_cv_netatalk_lock=/var/run/netatalk.pid
142 ac_cv_netatalk_lock=/var/spool/lock/netatalk
145 ac_cv_netatalk_lock=/var/run/netatalk.pid
148 ac_cv_netatalk_lock=/var/lock/netatalk
153 AC_DEFINE_UNQUOTED(PATH_NETATALK_LOCK, ["$ac_cv_netatalk_lock"], [netatalk lockfile path])
154 AC_SUBST(PATH_NETATALK_LOCK, ["$ac_cv_netatalk_lock"])
155 AC_MSG_RESULT([$ac_cv_netatalk_lock])
158 dnl 64bit platform check
159 AC_DEFUN([AC_NETATALK_64BIT_LIBS], [
160 AC_MSG_CHECKING([whether to check for 64bit libraries])
161 # Test if the compiler is in 64bit mode
162 echo 'int i;' > conftest.$ac_ext
163 atalk_cv_cc_64bit_output=no
164 if AC_TRY_EVAL(ac_compile); then
165 case `/usr/bin/file conftest.$ac_objext` in
167 atalk_cv_cc_64bit_output=yes
173 case $host_cpu:$atalk_cv_cc_64bit_output in
174 powerpc64:yes | s390x:yes | sparc*:yes | x86_64:yes | i386:yes)
178 atalk_libname="lib/64"
186 atalk_libname="lib64"
197 dnl Check for optional admin group support
198 AC_DEFUN([AC_NETATALK_ADMIN_GROUP], [
199 netatalk_cv_admin_group=yes
200 AC_MSG_CHECKING([for administrative group support])
201 AC_ARG_ENABLE(admin-group,
202 [ --disable-admin-group disable admin group],[
203 if test x"$enableval" = x"no"; then
204 AC_DEFINE(ADMIN_GRP, 0, [Define if the admin group should be enabled])
205 netatalk_cv_admin_group=no
208 AC_DEFINE(ADMIN_GRP, 1, [Define if the admin group should be enabled])
211 AC_DEFINE(ADMIN_GRP, 1, [Define if the admin group should be enabled])
216 dnl Check for optional cracklib support
217 AC_DEFUN([AC_NETATALK_CRACKLIB], [
218 netatalk_cv_with_cracklib=no
219 AC_ARG_WITH(cracklib,
220 [ --with-cracklib[[=DICT]] enable/set location of cracklib dictionary [[no]]],[
221 if test "x$withval" != "xno" ; then
223 AC_CHECK_LIB(crack, main, [
224 AC_DEFINE(USE_CRACKLIB, 1, [Define if cracklib should be used])
226 if test "$cracklib" = "yes"; then
227 cracklib="/usr/$atalk_libname/cracklib_dict"
229 AC_DEFINE_UNQUOTED(_PATH_CRACKLIB, "$cracklib",
230 [path to cracklib dictionary])
231 AC_MSG_RESULT([setting cracklib dictionary to $cracklib])
232 netatalk_cv_with_cracklib=yes
234 AC_MSG_ERROR([cracklib not found!])
240 AC_MSG_CHECKING([for cracklib support])
241 AC_MSG_RESULT([$netatalk_cv_with_cracklib])
244 dnl Check whether to enable debug code
245 AC_DEFUN([AC_NETATALK_DEBUG], [
246 AC_MSG_CHECKING([whether to enable verbose debug code])
248 [ --enable-debug enable verbose debug code],[
249 if test "$enableval" != "no"; then
250 if test "$enableval" = "yes"; then
251 AC_DEFINE(DEBUG, 1, [Define if verbose debugging information should be included])
253 AC_DEFINE_UNQUOTED(DEBUG, $enableval, [Define if verbose debugging information should be included])
258 AC_DEFINE(NDEBUG, 1, [Disable assertions])
262 AC_DEFINE(NDEBUG, 1, [Disable assertions])
267 dnl Check whethe to disable tickle SIGALARM stuff, which eases debugging
268 AC_DEFUN([AC_NETATALK_DEBUGGING], [
269 AC_MSG_CHECKING([whether to enable debugging with debuggers])
270 AC_ARG_ENABLE(debugging,
271 [ --enable-debugging disable SIGALRM timers and DSI tickles (eg for debugging with gdb/dbx/...)],[
272 if test "$enableval" != "no"; then
273 if test "$enableval" = "yes"; then
274 AC_DEFINE(DEBUGGING, 1, [Define if you want to disable SIGALRM timers and DSI tickles])
276 AC_DEFINE_UNQUOTED(DEBUGGING, $enableval, [Define if you want to disable SIGALRM timers and DSI tickles])
289 dnl Check for optional shadow password support
290 AC_DEFUN([AC_NETATALK_SHADOW], [
291 netatalk_cv_use_shadowpw=no
293 [ --with-shadow enable shadow password support [[auto]]],
294 [netatalk_cv_use_shadowpw="$withval"],
295 [netatalk_cv_use_shadowpw=auto]
298 if test "x$netatalk_cv_use_shadowpw" != "xno"; then
299 AC_CHECK_HEADER([shadow.h])
300 if test x"$ac_cv_header_shadow_h" = x"yes"; then
301 netatalk_cv_use_shadowpw=yes
302 AC_DEFINE(SHADOWPW, 1, [Define if shadow passwords should be used])
304 if test "x$shadowpw" = "xyes"; then
305 AC_MSG_ERROR([shadow support not available])
307 netatalk_cv_use_shadowpw=no
312 AC_MSG_CHECKING([whether shadow support should be enabled])
313 if test "x$netatalk_cv_use_shadowpw" = "xyes"; then
320 dnl Check for optional valid-shell-check support
321 AC_DEFUN([AC_NETATALK_SHELL_CHECK], [
322 netatalk_cv_use_shellcheck=yes
323 AC_MSG_CHECKING([whether checking for a valid shell should be enabled])
324 AC_ARG_ENABLE(shell-check,
325 [ --disable-shell-check disable checking for a valid shell],[
326 if test "$enableval" = "no"; then
327 AC_DEFINE(DISABLE_SHELLCHECK, 1, [Define if shell check should be disabled])
329 netatalk_cv_use_shellcheck=no
339 dnl Check for optional sysv initscript install
340 AC_DEFUN([AC_NETATALK_INIT_STYLE], [
341 AC_ARG_WITH(init-style,
342 [ --with-init-style use OS specific init config [[redhat-sysv|redhat-systemd|suse-sysv|suse-systemd|gentoo|netbsd|debian|solaris|systemd]]],
343 init_style="$withval", init_style=none
345 case "$init_style" in
347 AC_MSG_ERROR([--with-init-style=redhat is obsoleted. Use redhat-sysv or redhat-systemd.])
350 AC_MSG_RESULT([enabling redhat-style sysv initscript support])
353 AC_MSG_RESULT([enabling redhat-style systemd support])
356 AC_MSG_ERROR([--with-init-style=suse is obsoleted. Use suse-sysv or suse-systemd.])
359 AC_MSG_RESULT([enabling suse-style sysv initscript support])
362 AC_MSG_RESULT([enabling suse-style systemd support (>=openSUSE12.1)])
365 AC_MSG_RESULT([enabling gentoo-style initscript support])
368 AC_MSG_RESULT([enabling netbsd-style initscript support])
371 AC_MSG_RESULT([enabling debian-style initscript support])
374 AC_MSG_RESULT([enabling solaris-style SMF support])
377 AC_MSG_RESULT([enabling general systemd support])
380 AC_MSG_RESULT([disabling init-style support])
383 AC_MSG_ERROR([illegal init-style])
386 AM_CONDITIONAL(USE_NETBSD, test x$init_style = xnetbsd)
387 AM_CONDITIONAL(USE_REDHAT_SYSV, test x$init_style = xredhat-sysv)
388 AM_CONDITIONAL(USE_SUSE_SYSV, test x$init_style = xsuse-sysv)
389 AM_CONDITIONAL(USE_SOLARIS, test x$init_style = xsolaris)
390 AM_CONDITIONAL(USE_GENTOO, test x$init_style = xgentoo)
391 AM_CONDITIONAL(USE_DEBIAN, test x$init_style = xdebian)
392 AM_CONDITIONAL(USE_SYSTEMD, test x$init_style = xsystemd || test x$init_style = xredhat-systemd || test x$init_style = xsuse-systemd)
393 AM_CONDITIONAL(USE_UNDEF, test x$init_style = xnone)
397 dnl OS specific configuration
398 AC_DEFUN([AC_NETATALK_OS_SPECIFIC], [
400 *aix*) this_os=aix ;;
401 *freebsd*) this_os=freebsd ;;
402 *hpux11*) this_os=hpux11 ;;
403 *irix*) this_os=irix ;;
404 *linux*) this_os=linux ;;
405 *osx*) this_os=macosx ;;
406 *darwin*) this_os=macosx ;;
407 *netbsd*) this_os=netbsd ;;
408 *openbsd*) this_os=openbsd ;;
409 *osf*) this_os=tru64 ;;
410 *solaris*) this_os=solaris ;;
414 i386|i486|i586|i686|k7) this_cpu=x86 ;;
415 alpha) this_cpu=alpha ;;
416 mips) this_cpu=mips ;;
417 powerpc|ppc) this_cpu=ppc ;;
420 dnl --------------------- GNU source
422 linux) AC_DEFINE(_GNU_SOURCE, 1, [Whether to use GNU libc extensions])
424 kfreebsd-gnu) AC_DEFINE(_GNU_SOURCE, 1, [Whether to use GNU libc extensions])
428 dnl --------------------- operating system specific flags (port from sys/*)
430 dnl ----- FreeBSD specific -----
431 if test x"$this_os" = "xfreebsd"; then
432 AC_MSG_RESULT([ * FreeBSD specific configuration])
433 AC_DEFINE(BSD4_4, 1, [BSD compatiblity macro])
434 AC_DEFINE(FREEBSD, 1, [Define if OS is FreeBSD])
435 AC_DEFINE(OPEN_NOFOLLOW_ERRNO, EMLINK, errno returned by open with O_NOFOLLOW)
438 dnl ----- GNU/kFreeBSD specific -----
439 if test x"$this_os" = "xkfreebsd-gnu"; then
440 AC_MSG_RESULT([ * GNU/kFreeBSD specific configuration])
441 AC_DEFINE(BSD4_4, 1, [BSD compatiblity macro])
442 AC_DEFINE(FREEBSD, 1, [Define if OS is FreeBSD])
443 AC_DEFINE(OPEN_NOFOLLOW_ERRNO, EMLINK, errno returned by open with O_NOFOLLOW)
446 dnl ----- Linux specific -----
447 if test x"$this_os" = "xlinux"; then
448 AC_MSG_RESULT([ * Linux specific configuration])
449 AC_DEFINE(LINUX, 1, [OS is Linux])
450 dnl ----- check if we need the quotactl wrapper
451 AC_CHECK_HEADERS(linux/dqblk_xfs.h,,
452 [AC_CHECK_HEADERS(linux/xqm.h linux/xfs_fs.h)
453 AC_CHECK_HEADERS(xfs/libxfs.h xfs/xqm.h xfs/xfs_fs.h)]
457 dnl ----- as far as I can tell, dbtob always does the wrong thing
458 dnl ----- on every single version of linux I've ever played with.
459 dnl ----- see etc/afpd/quota.c
460 AC_DEFINE(HAVE_BROKEN_DBTOB, 1, [Define if dbtob is broken])
465 dnl ----- NetBSD specific -----
466 if test x"$this_os" = "xnetbsd"; then
467 AC_MSG_RESULT([ * NetBSD specific configuration])
468 AC_DEFINE(BSD4_4, 1, [BSD compatiblity macro])
469 AC_DEFINE(NETBSD, 1, [Define if OS is NetBSD])
470 AC_DEFINE(OPEN_NOFOLLOW_ERRNO, EFTYPE, errno returned by open with O_NOFOLLOW)
472 CFLAGS="-I\$(top_srcdir)/sys/netbsd $CFLAGS"
475 dnl ----- NetBSD does not have crypt.h, uses unistd.h -----
476 AC_DEFINE(UAM_DHX, 1, [Define if the DHX UAM modules should be compiled])
479 dnl ----- OpenBSD specific -----
480 if test x"$this_os" = "xopenbsd"; then
481 AC_MSG_RESULT([ * OpenBSD specific configuration])
482 AC_DEFINE(BSD4_4, 1, [BSD compatiblity macro])
483 dnl ----- OpenBSD does not have crypt.h, uses unistd.h -----
484 AC_DEFINE(UAM_DHX, 1, [Define if the DHX UAM modules should be compiled])
487 dnl ----- Solaris specific -----
488 if test x"$this_os" = "xsolaris"; then
489 AC_MSG_RESULT([ * Solaris specific configuration])
490 AC_DEFINE(__svr4__, 1, [Solaris compatibility macro])
491 AC_DEFINE(_ISOC9X_SOURCE, 1, [Compatibility macro])
492 AC_DEFINE(NO_STRUCT_TM_GMTOFF, 1, [Define if the gmtoff member of struct tm is not available])
493 AC_DEFINE(SOLARIS, 1, [Solaris compatibility macro])
494 AC_DEFINE(_XOPEN_SOURCE, 600, [Solaris compilation environment])
495 AC_DEFINE(__EXTENSIONS__, 1, [Solaris compilation environment])
496 CFLAGS="-I\$(top_srcdir)/sys/generic $CFLAGS"
501 AC_MSG_CHECKING([if we can build Solaris kernel module])
502 if test -x /usr/ccs/bin/ld && test x"$netatalk_cv_ddp_enabled" = x"yes" ; then
505 AC_MSG_RESULT([$solaris_module])
507 COMPILE_64BIT_KMODULE=no
510 COMPILE_KERNEL_GCC=no
512 if test "$solaris_module" = "yes"; then
513 dnl Solaris kernel module stuff
514 AC_MSG_CHECKING([if we have to build a 64bit kernel module])
516 # check for isainfo, if not found it has to be a 32 bit kernel (<=2.6)
517 if test -x /usr/bin/isainfo; then
518 # check for 64 bit platform
519 if isainfo -kv | grep '^64-bit'; then
520 COMPILE_64BIT_KMODULE=yes
524 AC_MSG_RESULT([$COMPILE_64BIT_KMODULE])
526 if test "${GCC}" = yes; then
527 COMPILE_KERNEL_GCC=yes
528 if test "$COMPILE_64BIT_KMODULE" = yes; then
530 AC_MSG_CHECKING([if we can build a 64bit kernel module])
532 case `$CC --version 2>/dev/null` in
534 COMPILE_64BIT_KMODULE=no
535 COMPILE_KERNEL_GCC=no
540 #KLDFLAGS="-melf64_sparc"
544 AC_MSG_RESULT([$COMPILE_64BIT_KMODULE])
550 KCFLAGS="$KCFLAGS -D_KERNEL -Wall -Wstrict-prototypes"
552 if test "$COMPILE_64BIT_KMODULE" = yes; then
553 # use Sun CC (for a 64-bit kernel, uncomment " -xarch=v9 -xregs=no%appl ")
554 KCFLAGS="-xarch=v9 -xregs=no%appl"
560 KCFLAGS="-D_KERNEL $KCFLAGS -mno-app-regs -munaligned-doubles -fpcc-struct-return"
563 AC_CACHE_CHECK([for timeout_id_t],netatalk_cv_HAVE_TIMEOUT_ID_T,[
564 AC_LINK_IFELSE([AC_LANG_PROGRAM([[\
565 #include <sys/stream.h>
566 #include <sys/ddi.h>]], [[\
568 ]])],[netatalk_cv_HAVE_TIMEOUT_ID_T=yes],[netatalk_cv_HAVE_TIMEOUT_ID_T=no])])
570 AC_DEFINE(HAVE_TIMEOUT_ID_T, test x"$netatalk_cv_HAVE_TIMEOUT_ID" = x"yes", [define for timeout_id_t])
573 AC_SUBST(COMPILE_KERNEL_GCC)
574 AC_SUBST(COMPILE_64BIT_KMODULE)
579 dnl Whether to run ldconfig after installing libraries
580 AC_PATH_PROG(NETA_LDCONFIG, ldconfig, , [$PATH$PATH_SEPARATOR/sbin$PATH_SEPARATOR/bin$PATH_SEPARATOR/usr/sbin$PATH_SEPARATOR/usr/bin])
581 echo NETA_LDCONFIG = $NETA_LDCONFIG
582 AM_CONDITIONAL(RUN_LDCONFIG, test x"$this_os" = x"linux" -a x"$NETA_LDCONFIG" != x"")
585 dnl Check for building PGP UAM module
586 AC_DEFUN([AC_NETATALK_PGP_UAM], [
587 AC_MSG_CHECKING([whether the PGP UAM should be build])
588 AC_ARG_ENABLE(pgp-uam,
589 [ --enable-pgp-uam enable build of PGP UAM module],[
590 if test "$enableval" = "yes"; then
591 if test "x$neta_cv_have_openssl" = "xyes"; then
592 AC_DEFINE(UAM_PGP, 1, [Define if the PGP UAM module should be compiled])
605 dnl Check for building Kerberos V UAM module
606 AC_DEFUN([AC_NETATALK_KRB5_UAM], [
607 netatalk_cv_build_krb5_uam=no
608 AC_ARG_ENABLE(krbV-uam,
609 [ --enable-krbV-uam enable build of Kerberos V UAM module],
611 if test x"$enableval" = x"yes"; then
612 NETATALK_GSSAPI_CHECK([
613 netatalk_cv_build_krb5_uam=yes
615 AC_MSG_ERROR([need GSSAPI to build Kerberos V UAM])
622 AC_MSG_CHECKING([whether Kerberos V UAM should be build])
623 if test x"$netatalk_cv_build_krb5_uam" = x"yes"; then
628 AM_CONDITIONAL(USE_GSSAPI, test x"$netatalk_cv_build_krb5_uam" = x"yes")
631 dnl Check if we can directly use Kerberos 5 API, used for reading keytabs
632 dnl and automatically construction DirectoryService names from that, instead
633 dnl of requiring special configuration in afp.conf
634 AC_DEFUN([AC_NETATALK_KERBEROS], [
635 AC_MSG_CHECKING([for Kerberos 5 (necessary for GetSrvrInfo:DirectoryNames support)])
636 AC_ARG_WITH([kerberos],
637 [AS_HELP_STRING([--with-kerberos], [Kerberos 5 support (default=auto)])],
639 [with_kerberos=auto])
640 AC_MSG_RESULT($with_kerberos)
642 if test x"$with_kerberos" != x"no"; then
643 have_krb5_header="no"
644 AC_CHECK_HEADERS([krb5/krb5.h krb5.h], [have_krb5_header="yes"; break])
645 if test x"$have_krb5_header" = x"no" && test x"$with_kerberos" != x"auto"; then
646 AC_MSG_FAILURE([--with-kerberos was given, but no headers found])
649 AC_PATH_PROG([KRB5_CONFIG], [krb5-config])
650 AC_MSG_CHECKING([for krb5-config])
651 if test -x "$KRB5_CONFIG"; then
652 AC_MSG_RESULT([$KRB5_CONFIG])
653 KRB5_CFLAGS="`$KRB5_CONFIG --cflags krb5`"
654 KRB5_LIBS="`$KRB5_CONFIG --libs krb5`"
655 AC_SUBST(KRB5_CFLAGS)
659 AC_MSG_RESULT([not found])
660 if test x"$with_kerberos" != x"auto"; then
661 AC_MSG_FAILURE([--with-kerberos was given, but krb5-config could not be found])
666 if test x"$with_kerberos" = x"yes"; then
667 AC_DEFINE([HAVE_KERBEROS], [1], [Define if Kerberos 5 is available])
670 dnl Check for krb5_free_unparsed_name and krb5_free_error_message
671 save_CFLAGS="$CFLAGS"
673 CFLAGS="$KRB5_CFLAGS"
675 AC_CHECK_FUNCS([krb5_free_unparsed_name krb5_free_error_message krb5_free_keytab_entry_contents krb5_kt_free_entry])
676 CFLAGS="$save_CFLAGS"
680 dnl Check for overwrite the config files or not
681 AC_DEFUN([AC_NETATALK_OVERWRITE_CONFIG], [
682 AC_MSG_CHECKING([whether configuration files should be overwritten])
683 AC_ARG_ENABLE(overwrite,
684 [ --enable-overwrite overwrite configuration files during installation],
685 [OVERWRITE_CONFIG="${enable_overwrite}"],
686 [OVERWRITE_CONFIG="no"]
688 AC_MSG_RESULT([$OVERWRITE_CONFIG])
689 AC_SUBST(OVERWRITE_CONFIG)
692 dnl Check for LDAP support, for client-side ACL visibility
693 AC_DEFUN([AC_NETATALK_LDAP], [
694 AC_MSG_CHECKING(for LDAP (necessary for client-side ACL visibility))
696 [AS_HELP_STRING([--with-ldap],
697 [LDAP support (default=auto)])],
698 netatalk_cv_ldap=$withval,
699 netatalk_cv_ldap=auto
701 AC_MSG_RESULT($netatalk_cv_ldap)
703 save_CFLAGS="$CFLAGS"
704 save_LDFLAGS="$LDFLAGS"
713 if test x"$netatalk_cv_ldap" != x"no" ; then
714 if test x"$netatalk_cv_ldap" != x"yes" -a x"$netatalk_cv_ldap" != x"auto"; then
715 CFLAGS="-I$netatalk_cv_ldap/include"
716 LDFLAGS="-L$netatalk_cv_ldap/lib"
718 AC_CHECK_HEADER([ldap.h], netatalk_cv_ldap=yes,
719 [ if test x"$netatalk_cv_ldap" = x"yes" ; then
720 AC_MSG_ERROR([Missing LDAP headers])
724 AC_CHECK_LIB(ldap, ldap_init, netatalk_cv_ldap=yes,
725 [ if test x"$netatalk_cv_ldap" = x"yes" ; then
726 AC_MSG_ERROR([Missing LDAP library])
732 if test x"$netatalk_cv_ldap" = x"yes"; then
733 LDAP_CFLAGS="$CFLAGS"
734 LDAP_LDFLAGS="$LDFLAGS"
736 AC_DEFINE(HAVE_LDAP,1,[Whether LDAP is available])
739 AC_SUBST(LDAP_CFLAGS)
740 AC_SUBST(LDAP_LDFLAGS)
742 CFLAGS="$save_CFLAGS"
743 LDLFLAGS="$save_LDLFLAGS"
747 dnl Check for ACL support
748 AC_DEFUN([AC_NETATALK_ACL], [
749 AC_MSG_CHECKING(whether to support ACLs)
751 [AS_HELP_STRING([--with-acls],
752 [Include ACL support (default=auto)])],
755 with_acl_support="$withval"
758 with_acl_support=auto
761 [with_acl_support=auto])
762 AC_MSG_RESULT($with_acl_support)
764 if test x"$with_acl_support" = x"no"; then
765 AC_MSG_RESULT(Disabling ACL support)
766 AC_DEFINE(HAVE_NO_ACLS,1,[Whether no ACLs support should be built in])
771 if test x"$with_acl_support" = x"yes" ; then
772 AC_MSG_NOTICE(checking whether ACL support is available:)
775 AC_MSG_NOTICE(Using UnixWare ACLs)
776 AC_DEFINE(HAVE_UNIXWARE_ACLS,1,[Whether UnixWare ACLs are available])
779 AC_MSG_NOTICE(Using solaris ACLs)
780 AC_DEFINE(HAVE_SOLARIS_ACLS,1,[Whether solaris ACLs are available])
781 ACL_LIBS="$ACL_LIBS -lsec"
784 AC_MSG_NOTICE(Using HPUX ACLs)
785 AC_DEFINE(HAVE_HPUX_ACLS,1,[Whether HPUX ACLs are available])
788 AC_MSG_NOTICE(Using IRIX ACLs)
789 AC_DEFINE(HAVE_IRIX_ACLS,1,[Whether IRIX ACLs are available])
792 AC_MSG_NOTICE(Using AIX ACLs)
793 AC_DEFINE(HAVE_AIX_ACLS,1,[Whether AIX ACLs are available])
796 AC_MSG_NOTICE(Using Tru64 ACLs)
797 AC_DEFINE(HAVE_TRU64_ACLS,1,[Whether Tru64 ACLs are available])
798 ACL_LIBS="$ACL_LIBS -lpacl"
801 AC_MSG_NOTICE(ACLs on Darwin currently not supported)
802 AC_DEFINE(HAVE_NO_ACLS,1,[Whether no ACLs support is available])
805 AC_CHECK_LIB(acl,acl_get_file,[ACL_LIBS="$ACL_LIBS -lacl"])
808 AC_CHECK_LIB(attr,getxattr,[ACL_LIBS="$ACL_LIBS -lattr"])
811 AC_CACHE_CHECK([for POSIX ACL support],netatalk_cv_HAVE_POSIX_ACLS,[
813 LIBS="$LIBS $ACL_LIBS"
814 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
815 #include <sys/types.h>
820 acl_entry_t *entry_p;
821 return acl_get_entry(acl, entry_id, entry_p);
822 ]])],[netatalk_cv_HAVE_POSIX_ACLS=yes],[netatalk_cv_HAVE_POSIX_ACLS=no
823 with_acl_support=no])
826 if test x"$netatalk_cv_HAVE_POSIX_ACLS" = x"yes"; then
827 AC_MSG_NOTICE(Using POSIX ACLs)
828 AC_DEFINE(HAVE_POSIX_ACLS,1,[Whether POSIX ACLs are available])
829 AC_CACHE_CHECK([for acl_get_perm_np],netatalk_cv_HAVE_ACL_GET_PERM_NP,[
831 LIBS="$LIBS $ACL_LIBS"
832 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
833 #include <sys/types.h>
836 acl_permset_t permset_d;
838 return acl_get_perm_np(permset_d, perm);
839 ]])],[netatalk_cv_HAVE_ACL_GET_PERM_NP=yes],[netatalk_cv_HAVE_ACL_GET_PERM_NP=no])
842 if test x"$netatalk_cv_HAVE_ACL_GET_PERM_NP" = x"yes"; then
843 AC_DEFINE(HAVE_ACL_GET_PERM_NP,1,[Whether acl_get_perm_np() is available])
847 AC_CACHE_CHECK([for acl_from_mode], netatalk_cv_HAVE_ACL_FROM_MODE,[
849 LIBS="$LIBS $ACL_LIBS"
850 AC_CHECK_FUNCS(acl_from_mode,
851 [netatalk_cv_HAVE_ACL_FROM_MODE=yes],
852 [netatalk_cv_HAVE_ACL_FROM_MODE=no])
855 if test x"netatalk_cv_HAVE_ACL_FROM_MODE" = x"yes"; then
856 AC_DEFINE(HAVE_ACL_FROM_MODE,1,[Whether acl_from_mode() is available])
860 AC_MSG_NOTICE(ACL support is not avaliable)
861 AC_DEFINE(HAVE_NO_ACLS,1,[Whether no ACLs support is available])
867 if test x"$with_acl_support" = x"yes" ; then
868 AC_CHECK_HEADERS([acl/libacl.h])
869 AC_DEFINE(HAVE_ACLS,1,[Whether ACLs support is available])
874 dnl Check for Extended Attributes support
875 AC_DEFUN([AC_NETATALK_EXTENDED_ATTRIBUTES], [
877 neta_cv_eas_sys_found=no
878 neta_cv_eas_sys_not_found=no
880 AC_CHECK_HEADERS(sys/attributes.h attr/xattr.h sys/xattr.h sys/extattr.h sys/uio.h sys/ea.h)
885 AC_SEARCH_LIBS(getproplist, [proplist])
886 AC_CHECK_FUNCS([getproplist fgetproplist setproplist fsetproplist],
887 [neta_cv_eas_sys_found=yes],
888 [neta_cv_eas_sys_not_found=yes])
889 AC_CHECK_FUNCS([delproplist fdelproplist add_proplist_entry get_proplist_entry],,
890 [neta_cv_eas_sys_not_found=yes])
891 AC_CHECK_FUNCS([sizeof_proplist_entry],,
892 [neta_cv_eas_sys_not_found=yes])
896 AC_CHECK_FUNCS([attropen],
897 [neta_cv_eas_sys_found=yes; AC_DEFINE(HAVE_EAFD, 1, [extattr API has full fledged fds for EAs])],
898 [neta_cv_eas_sys_not_found=yes])
902 AC_CHECK_FUNCS([extattr_delete_fd extattr_delete_file extattr_delete_link],
903 [neta_cv_eas_sys_found=yes],
904 [neta_cv_eas_sys_not_found=yes])
905 AC_CHECK_FUNCS([extattr_get_fd extattr_get_file extattr_get_link],,
906 [neta_cv_eas_sys_not_found=yes])
907 AC_CHECK_FUNCS([extattr_list_fd extattr_list_file extattr_list_link],,
908 [neta_cv_eas_sys_not_found=yes])
909 AC_CHECK_FUNCS([extattr_set_fd extattr_set_file extattr_set_link],,
910 [neta_cv_eas_sys_not_found=yes])
913 *freebsd4* | *dragonfly* )
914 AC_DEFINE(BROKEN_EXTATTR, 1, [Does extattr API work])
918 AC_SEARCH_LIBS(getxattr, [attr])
920 if test "x$neta_cv_eas_sys_found" != "xyes" ; then
921 AC_CHECK_FUNCS([getxattr lgetxattr fgetxattr listxattr llistxattr],
922 [neta_cv_eas_sys_found=yes],
923 [neta_cv_eas_sys_not_found=yes])
924 AC_CHECK_FUNCS([flistxattr removexattr lremovexattr fremovexattr],,
925 [neta_cv_eas_sys_not_found=yes])
926 AC_CHECK_FUNCS([setxattr lsetxattr fsetxattr],,
927 [neta_cv_eas_sys_not_found=yes])
930 if test "x$neta_cv_eas_sys_found" != "xyes" ; then
931 AC_CHECK_FUNCS([getea fgetea lgetea listea flistea llistea],
932 [neta_cv_eas_sys_found=yes],
933 [neta_cv_eas_sys_not_found=yes])
934 AC_CHECK_FUNCS([removeea fremoveea lremoveea setea fsetea lsetea],,
935 [neta_cv_eas_sys_not_found=yes])
938 if test "x$neta_cv_eas_sys_found" != "xyes" ; then
939 AC_CHECK_FUNCS([attr_get attr_list attr_set attr_remove],,
940 [neta_cv_eas_sys_not_found=yes])
941 AC_CHECK_FUNCS([attr_getf attr_listf attr_setf attr_removef],,
942 [neta_cv_eas_sys_not_found=yes])
947 # Do xattr functions take additional options like on Darwin?
948 if test x"$ac_cv_func_getxattr" = x"yes" ; then
949 AC_CACHE_CHECK([whether xattr interface takes additional options], smb_attr_cv_xattr_add_opt, [
951 LIBS="$LIBS $ACL_LIBS"
952 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
953 #include <sys/types.h>
954 #if HAVE_ATTR_XATTR_H
955 #include <attr/xattr.h>
956 #elif HAVE_SYS_XATTR_H
957 #include <sys/xattr.h>
960 getxattr(0, 0, 0, 0, 0, 0);
961 ]])],[smb_attr_cv_xattr_add_opt=yes],[smb_attr_cv_xattr_add_opt=no;LIBS=$old_LIBS])
963 if test x"$smb_attr_cv_xattr_add_opt" = x"yes"; then
964 AC_DEFINE(XATTR_ADD_OPT, 1, [xattr functions have additional options])
968 if test "x$neta_cv_eas_sys_found" = "xyes" ; then
969 if test "x$neta_cv_eas_sys_not_found" != "xyes" ; then
970 neta_cv_eas="$neta_cv_eas | sys"
973 AC_DEFINE_UNQUOTED(EA_MODULES,["$neta_cv_eas"],[Available Extended Attributes modules])
976 dnl Check for libsmbsharemodes from Samba for Samba/Netatalk access/deny/share modes interop
977 dnl Defines "neta_cv_have_smbshmd" to "yes" or "no"
978 dnl AC_SUBST's "SMB_SHAREMODES_CFLAGS" and "SMB_SHAREMODES_LDFLAGS"
979 dnl AM_CONDITIONAL's "USE_SMB_SHAREMODES"
980 AC_DEFUN([AC_NETATALK_SMB_SHAREMODES], [
981 neta_cv_have_smbshmd=no
982 AC_ARG_WITH(smbsharemodes-lib,
983 [ --with-smbsharemodes-lib=PATH PATH to libsmbsharemodes lib from Samba],
984 [SMB_SHAREMODES_LDFLAGS="-L$withval -lsmbsharemodes"]
986 AC_ARG_WITH(smbsharemodes-include,
987 [ --with-smbsharemodes-include=PATH PATH to libsmbsharemodes header from Samba],
988 [SMB_SHAREMODES_CFLAGS="-I$withval"]
990 AC_ARG_WITH(smbsharemodes,
991 [AS_HELP_STRING([--with-smbsharemodes],[Samba interop (default is yes)])],
992 [use_smbsharemodes=$withval],
993 [use_smbsharemodes=yes]
996 if test x"$use_smbsharemodes" = x"yes" ; then
997 AC_MSG_CHECKING([whether to enable Samba/Netatalk access/deny/share-modes interop])
999 saved_CFLAGS="$CFLAGS"
1000 saved_LDFLAGS="$LDFLAGS"
1001 CFLAGS="$SMB_SHAREMODES_CFLAGS $CFLAGS"
1002 LDFLAGS="$SMB_SHAREMODES_LDFLAGS $LDFLAGS"
1005 [#include <unistd.h>
1007 #include <sys/time.h>
1010 /* From messages.h */
1014 #include "smb_share_modes.h"
1015 int main(void) { (void)smb_share_mode_db_open(""); return 0;}],
1016 [neta_cv_have_smbshmd=yes]
1019 AC_MSG_RESULT($neta_cv_have_smbshmd)
1020 AC_SUBST(SMB_SHAREMODES_CFLAGS, [$SMB_SHAREMODES_CFLAGS])
1021 AC_SUBST(SMB_SHAREMODES_LDFLAGS, [$SMB_SHAREMODES_LDFLAGS])
1022 CFLAGS="$saved_CFLAGS"
1023 LDFLAGS="$saved_LDFLAGS"
1026 AM_CONDITIONAL(USE_SMB_SHAREMODES, test x"$neta_cv_have_smbshmd" = x"yes")
1029 dnl ------ Check for sendfile() --------
1030 AC_DEFUN([AC_NETATALK_SENDFILE], [
1031 netatalk_cv_search_sendfile=yes
1032 AC_ARG_ENABLE(sendfile,
1033 [ --disable-sendfile disable sendfile syscall],
1034 [if test x"$enableval" = x"no"; then
1035 netatalk_cv_search_sendfile=no
1039 if test x"$netatalk_cv_search_sendfile" = x"yes"; then
1042 AC_DEFINE(SENDFILE_FLAVOR_LINUX,1,[Whether linux sendfile() API is available])
1043 AC_CHECK_FUNC([sendfile], [netatalk_cv_HAVE_SENDFILE=yes])
1047 AC_DEFINE(SENDFILE_FLAVOR_SOLARIS, 1, [Solaris sendfile()])
1048 AC_SEARCH_LIBS(sendfile, sendfile)
1049 AC_CHECK_FUNC([sendfile], [netatalk_cv_HAVE_SENDFILE=yes])
1050 AC_CHECK_FUNCS([sendfilev])
1054 AC_DEFINE(SENDFILE_FLAVOR_BSD, 1, [Define if the sendfile() function uses BSD semantics])
1055 AC_CHECK_FUNC([sendfile], [netatalk_cv_HAVE_SENDFILE=yes])
1063 if test x"$netatalk_cv_HAVE_SENDFILE" = x"yes"; then
1064 AC_DEFINE(WITH_SENDFILE,1,[Whether sendfile() should be used])
1069 dnl --------------------- Check if realpath() takes NULL
1070 AC_DEFUN([AC_NETATALK_REALPATH], [
1071 AC_CACHE_CHECK([if the realpath function allows a NULL argument],
1072 neta_cv_REALPATH_TAKES_NULL, [
1073 AC_RUN_IFELSE([AC_LANG_SOURCE([[
1078 void exit_on_core(int ignored) {
1084 signal(SIGSEGV, exit_on_core);
1085 newpath = realpath("/tmp", NULL);
1086 exit((newpath != NULL) ? 0 : 1);
1087 }]])],[neta_cv_REALPATH_TAKES_NULL=yes],[neta_cv_REALPATH_TAKES_NULL=no],[neta_cv_REALPATH_TAKES_NULL=cross
1092 if test x"$neta_cv_REALPATH_TAKES_NULL" = x"yes"; then
1093 AC_DEFINE(REALPATH_TAKES_NULL,1,[Whether the realpath function allows NULL])