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 Whether to disable bundled libevent
17 AC_DEFUN([AC_NETATALK_LIBEVENT], [
18 AC_MSG_CHECKING([whether to disable bundled libevent (define CPPFLAGS and LDFLAGS otherwise appropiately to pick up installed version)])
21 [AS_HELP_STRING([--disable-bundled-libevent],[whether the bundled version of libevent shall not be used (define CPPFLAGS and LDFLAGS otherwise appropiately to pick up installed version)
23 use_bundled_libevent=$enableval,
24 use_bundled_libevent=yes
27 if test x"$use_bundled_libevent" = x"yes" ; then
28 AC_CONFIG_SUBDIRS([libevent])
30 AM_CONDITIONAL(USE_BUILTIN_LIBEVENT, test x"$use_bundled_libevent" = x"yes")
33 dnl Filesystem Hierarchy Standard (FHS) compatibility
34 AC_DEFUN([AC_NETATALK_FHS], [
35 AC_MSG_CHECKING([whether to use Filesystem Hierarchy Standard (FHS) compatibility])
37 [ --enable-fhs use Filesystem Hierarchy Standard (FHS) compatibility],[
38 if test "$enableval" = "yes"; then
44 mandir="/usr/share/man"
45 uams_path="${libdir}/netatalk"
46 PKGCONFDIR="${sysconfdir}"
47 SERVERTEXT="${localstatedir}/netatalk/msg"
49 AC_DEFINE(FHS_COMPATIBILITY, 1, [Define if you want compatibily with the FHS])
59 dnl 64bit platform check
60 AC_DEFUN([AC_NETATALK_64BIT_LIBS], [
61 AC_MSG_CHECKING([whether to check for 64bit libraries])
62 # Test if the compiler is in 64bit mode
63 echo 'int i;' > conftest.$ac_ext
64 atalk_cv_cc_64bit_output=no
65 if AC_TRY_EVAL(ac_compile); then
66 case `/usr/bin/file conftest.$ac_objext` in
68 atalk_cv_cc_64bit_output=yes
74 case $host_cpu:$atalk_cv_cc_64bit_output in
75 powerpc64:yes | s390x:yes | sparc*:yes | x86_64:yes | i386:yes)
79 atalk_libname="lib/64"
98 dnl Check for optional admin group support
99 AC_DEFUN([AC_NETATALK_ADMIN_GROUP], [
100 netatalk_cv_admin_group=yes
101 AC_MSG_CHECKING([for administrative group support])
102 AC_ARG_ENABLE(admin-group,
103 [ --disable-admin-group disable admin group],[
104 if test x"$enableval" = x"no"; then
105 AC_DEFINE(ADMIN_GRP, 0, [Define if the admin group should be enabled])
106 netatalk_cv_admin_group=no
109 AC_DEFINE(ADMIN_GRP, 1, [Define if the admin group should be enabled])
112 AC_DEFINE(ADMIN_GRP, 1, [Define if the admin group should be enabled])
117 dnl Check for optional cracklib support
118 AC_DEFUN([AC_NETATALK_CRACKLIB], [
119 netatalk_cv_with_cracklib=no
120 AC_ARG_WITH(cracklib,
121 [ --with-cracklib[[=DICT]] enable/set location of cracklib dictionary [[no]]],[
122 if test "x$withval" != "xno" ; then
124 AC_CHECK_LIB(crack, main, [
125 AC_DEFINE(USE_CRACKLIB, 1, [Define if cracklib should be used])
127 if test "$cracklib" = "yes"; then
128 cracklib="/usr/$atalk_libname/cracklib_dict"
130 AC_DEFINE_UNQUOTED(_PATH_CRACKLIB, "$cracklib",
131 [path to cracklib dictionary])
132 AC_MSG_RESULT([setting cracklib dictionary to $cracklib])
133 netatalk_cv_with_cracklib=yes
135 AC_MSG_ERROR([cracklib not found!])
141 AC_MSG_CHECKING([for cracklib support])
142 AC_MSG_RESULT([$netatalk_cv_with_cracklib])
145 dnl Check whether to enable debug code
146 AC_DEFUN([AC_NETATALK_DEBUG], [
147 AC_MSG_CHECKING([whether to enable verbose debug code])
149 [ --enable-debug enable verbose debug code],[
150 if test "$enableval" != "no"; then
151 if test "$enableval" = "yes"; then
152 AC_DEFINE(DEBUG, 1, [Define if verbose debugging information should be included])
154 AC_DEFINE_UNQUOTED(DEBUG, $enableval, [Define if verbose debugging information should be included])
159 AC_DEFINE(NDEBUG, 1, [Disable assertions])
163 AC_DEFINE(NDEBUG, 1, [Disable assertions])
168 dnl Check whethe to disable tickle SIGALARM stuff, which eases debugging
169 AC_DEFUN([AC_NETATALK_DEBUGGING], [
170 AC_MSG_CHECKING([whether to enable debugging with debuggers])
171 AC_ARG_ENABLE(debugging,
172 [ --enable-debugging disable SIGALRM timers and DSI tickles (eg for debugging with gdb/dbx/...)],[
173 if test "$enableval" != "no"; then
174 if test "$enableval" = "yes"; then
175 AC_DEFINE(DEBUGGING, 1, [Define if you want to disable SIGALRM timers and DSI tickles])
177 AC_DEFINE_UNQUOTED(DEBUGGING, $enableval, [Define if you want to disable SIGALRM timers and DSI tickles])
190 dnl Check for optional shadow password support
191 AC_DEFUN([AC_NETATALK_SHADOW], [
192 netatalk_cv_use_shadowpw=no
194 [ --with-shadow enable shadow password support [[auto]]],
195 [netatalk_cv_use_shadowpw="$withval"],
196 [netatalk_cv_use_shadowpw=auto]
199 if test "x$netatalk_cv_use_shadowpw" != "xno"; then
200 AC_CHECK_HEADER([shadow.h])
201 if test x"$ac_cv_header_shadow_h" = x"yes"; then
202 netatalk_cv_use_shadowpw=yes
203 AC_DEFINE(SHADOWPW, 1, [Define if shadow passwords should be used])
205 if test "x$shadowpw" = "xyes"; then
206 AC_MSG_ERROR([shadow support not available])
208 netatalk_cv_use_shadowpw=no
213 AC_MSG_CHECKING([whether shadow support should be enabled])
214 if test "x$netatalk_cv_use_shadowpw" = "xyes"; then
221 dnl Check for optional valid-shell-check support
222 AC_DEFUN([AC_NETATALK_SHELL_CHECK], [
223 netatalk_cv_use_shellcheck=yes
224 AC_MSG_CHECKING([whether checking for a valid shell should be enabled])
225 AC_ARG_ENABLE(shell-check,
226 [ --disable-shell-check disable checking for a valid shell],[
227 if test "$enableval" = "no"; then
228 AC_DEFINE(DISABLE_SHELLCHECK, 1, [Define if shell check should be disabled])
230 netatalk_cv_use_shellcheck=no
240 dnl Check for optional sysv initscript install
241 AC_DEFUN([AC_NETATALK_INIT_STYLE], [
242 AC_ARG_WITH(init-style,
243 [ --with-init-style use OS specific init config [[redhat-sysv|redhat-systemd|suse-sysv|suse-systemd|gentoo|netbsd|debian|solaris|systemd]]],
244 init_style="$withval", init_style=none
246 case "$init_style" in
248 AC_MSG_ERROR([--with-init-style=redhat is obsoleted. Use redhat-sysv or redhat-systemd.])
251 AC_MSG_RESULT([enabling redhat-style sysv (upstart) configuration])
254 AC_MSG_RESULT([enabling redhat-style systemd support])
257 AC_MSG_ERROR([--with-init-style=suse is obsoleted. Use suse-sysv or suse-systemd.])
260 AC_MSG_RESULT([enabling suse-style sysv configuration])
263 AC_MSG_RESULT([enabling suse-style systemd support (>=openSUSE12.1)])
266 AC_MSG_RESULT([enabling gentoo-style sysv support])
269 AC_MSG_RESULT([enabling netbsd-style sysv support])
272 AC_MSG_RESULT([enabling debian-style sysv support])
275 AC_MSG_RESULT([enabling solaris-style SMF support])
278 AC_MSG_RESULT([use general systemd configuration])
281 AC_MSG_RESULT([disabling init-style support])
284 AC_MSG_ERROR([illegal init-style])
287 AM_CONDITIONAL(USE_NETBSD, test x$init_style = xnetbsd)
288 AM_CONDITIONAL(USE_REDHAT_SYSV, test x$init_style = xredhat-sysv)
289 AM_CONDITIONAL(USE_SUSE_SYSV, test x$init_style = xsuse-sysv)
290 AM_CONDITIONAL(USE_SOLARIS, test x$init_style = xsolaris)
291 AM_CONDITIONAL(USE_GENTOO, test x$init_style = xgentoo)
292 AM_CONDITIONAL(USE_DEBIAN, test x$init_style = xdebian)
293 AM_CONDITIONAL(USE_SYSTEMD, test x$init_style = xsystemd || test x$init_style = xredhat-systemd || test x$init_style = xsuse-systemd)
294 AM_CONDITIONAL(USE_UNDEF, test x$init_style = xnone)
298 dnl OS specific configuration
299 AC_DEFUN([AC_NETATALK_OS_SPECIFIC], [
301 *aix*) this_os=aix ;;
302 *freebsd*) this_os=freebsd ;;
303 *hpux11*) this_os=hpux11 ;;
304 *irix*) this_os=irix ;;
305 *linux*) this_os=linux ;;
306 *osx*) this_os=macosx ;;
307 *darwin*) this_os=macosx ;;
308 *netbsd*) this_os=netbsd ;;
309 *openbsd*) this_os=openbsd ;;
310 *osf*) this_os=tru64 ;;
311 *solaris*) this_os=solaris ;;
315 i386|i486|i586|i686|k7) this_cpu=x86 ;;
316 alpha) this_cpu=alpha ;;
317 mips) this_cpu=mips ;;
318 powerpc|ppc) this_cpu=ppc ;;
321 dnl --------------------- GNU source
323 linux) AC_DEFINE(_GNU_SOURCE, 1, [Whether to use GNU libc extensions])
325 kfreebsd-gnu) AC_DEFINE(_GNU_SOURCE, 1, [Whether to use GNU libc extensions])
329 dnl --------------------- operating system specific flags (port from sys/*)
331 dnl ----- FreeBSD specific -----
332 if test x"$this_os" = "xfreebsd"; then
333 AC_MSG_RESULT([ * FreeBSD specific configuration])
334 AC_DEFINE(BSD4_4, 1, [BSD compatiblity macro])
335 AC_DEFINE(FREEBSD, 1, [Define if OS is FreeBSD])
336 AC_DEFINE(OPEN_NOFOLLOW_ERRNO, EMLINK, errno returned by open with O_NOFOLLOW)
339 dnl ----- GNU/kFreeBSD specific -----
340 if test x"$this_os" = "xkfreebsd-gnu"; then
341 AC_MSG_RESULT([ * GNU/kFreeBSD specific configuration])
342 AC_DEFINE(BSD4_4, 1, [BSD compatiblity macro])
343 AC_DEFINE(FREEBSD, 1, [Define if OS is FreeBSD])
344 AC_DEFINE(OPEN_NOFOLLOW_ERRNO, EMLINK, errno returned by open with O_NOFOLLOW)
347 dnl ----- Linux specific -----
348 if test x"$this_os" = "xlinux"; then
349 AC_MSG_RESULT([ * Linux specific configuration])
351 dnl ----- check if we need the quotactl wrapper
352 AC_CHECK_HEADERS(linux/dqblk_xfs.h,,
353 [AC_CHECK_HEADERS(linux/xqm.h linux/xfs_fs.h)
354 AC_CHECK_HEADERS(xfs/libxfs.h xfs/xqm.h xfs/xfs_fs.h)]
358 dnl ----- as far as I can tell, dbtob always does the wrong thing
359 dnl ----- on every single version of linux I've ever played with.
360 dnl ----- see etc/afpd/quota.c
361 AC_DEFINE(HAVE_BROKEN_DBTOB, 1, [Define if dbtob is broken])
366 dnl ----- NetBSD specific -----
367 if test x"$this_os" = "xnetbsd"; then
368 AC_MSG_RESULT([ * NetBSD specific configuration])
369 AC_DEFINE(BSD4_4, 1, [BSD compatiblity macro])
370 AC_DEFINE(NETBSD, 1, [Define if OS is NetBSD])
371 AC_DEFINE(OPEN_NOFOLLOW_ERRNO, EFTYPE, errno returned by open with O_NOFOLLOW)
373 CFLAGS="-I\$(top_srcdir)/sys/netbsd $CFLAGS"
376 dnl ----- NetBSD does not have crypt.h, uses unistd.h -----
377 AC_DEFINE(UAM_DHX, 1, [Define if the DHX UAM modules should be compiled])
380 dnl ----- OpenBSD specific -----
381 if test x"$this_os" = "xopenbsd"; then
382 AC_MSG_RESULT([ * OpenBSD specific configuration])
383 AC_DEFINE(BSD4_4, 1, [BSD compatiblity macro])
384 dnl ----- OpenBSD does not have crypt.h, uses unistd.h -----
385 AC_DEFINE(UAM_DHX, 1, [Define if the DHX UAM modules should be compiled])
388 dnl ----- Solaris specific -----
389 if test x"$this_os" = "xsolaris"; then
390 AC_MSG_RESULT([ * Solaris specific configuration])
391 AC_DEFINE(__svr4__, 1, [Solaris compatibility macro])
392 AC_DEFINE(_ISOC9X_SOURCE, 1, [Compatibility macro])
393 AC_DEFINE(NO_STRUCT_TM_GMTOFF, 1, [Define if the gmtoff member of struct tm is not available])
394 AC_DEFINE(SOLARIS, 1, [Solaris compatibility macro])
395 AC_DEFINE(_XOPEN_SOURCE, 600, [Solaris compilation environment])
396 AC_DEFINE(__EXTENSIONS__, 1, [Solaris compilation environment])
397 CFLAGS="-I\$(top_srcdir)/sys/generic $CFLAGS"
402 AC_MSG_CHECKING([if we can build Solaris kernel module])
403 if test -x /usr/ccs/bin/ld && test x"$netatalk_cv_ddp_enabled" = x"yes" ; then
406 AC_MSG_RESULT([$solaris_module])
408 COMPILE_64BIT_KMODULE=no
411 COMPILE_KERNEL_GCC=no
413 if test "$solaris_module" = "yes"; then
414 dnl Solaris kernel module stuff
415 AC_MSG_CHECKING([if we have to build a 64bit kernel module])
417 # check for isainfo, if not found it has to be a 32 bit kernel (<=2.6)
418 if test -x /usr/bin/isainfo; then
419 # check for 64 bit platform
420 if isainfo -kv | grep '^64-bit'; then
421 COMPILE_64BIT_KMODULE=yes
425 AC_MSG_RESULT([$COMPILE_64BIT_KMODULE])
427 if test "${GCC}" = yes; then
428 COMPILE_KERNEL_GCC=yes
429 if test "$COMPILE_64BIT_KMODULE" = yes; then
431 AC_MSG_CHECKING([if we can build a 64bit kernel module])
433 case `$CC --version 2>/dev/null` in
435 COMPILE_64BIT_KMODULE=no
436 COMPILE_KERNEL_GCC=no
441 #KLDFLAGS="-melf64_sparc"
445 AC_MSG_RESULT([$COMPILE_64BIT_KMODULE])
451 KCFLAGS="$KCFLAGS -D_KERNEL -Wall -Wstrict-prototypes"
453 if test "$COMPILE_64BIT_KMODULE" = yes; then
454 # use Sun CC (for a 64-bit kernel, uncomment " -xarch=v9 -xregs=no%appl ")
455 KCFLAGS="-xarch=v9 -xregs=no%appl"
461 KCFLAGS="-D_KERNEL $KCFLAGS -mno-app-regs -munaligned-doubles -fpcc-struct-return"
464 AC_CACHE_CHECK([for timeout_id_t],netatalk_cv_HAVE_TIMEOUT_ID_T,[
465 AC_LINK_IFELSE([AC_LANG_PROGRAM([[\
466 #include <sys/stream.h>
467 #include <sys/ddi.h>]], [[\
469 ]])],[netatalk_cv_HAVE_TIMEOUT_ID_T=yes],[netatalk_cv_HAVE_TIMEOUT_ID_T=no])])
471 AC_DEFINE(HAVE_TIMEOUT_ID_T, test x"$netatalk_cv_HAVE_TIMEOUT_ID" = x"yes", [define for timeout_id_t])
474 AC_SUBST(COMPILE_KERNEL_GCC)
475 AC_SUBST(COMPILE_64BIT_KMODULE)
480 dnl Whether to run ldconfig after installing libraries
481 AC_PATH_PROG(NETA_LDCONFIG, ldconfig, , [$PATH$PATH_SEPARATOR/sbin$PATH_SEPARATOR/bin$PATH_SEPARATOR/usr/sbin$PATH_SEPARATOR/usr/bin])
482 echo NETA_LDCONFIG = $NETA_LDCONFIG
483 AM_CONDITIONAL(RUN_LDCONFIG, test x"$this_os" = x"linux" -a x"$NETA_LDCONFIG" != x"")
486 dnl Check for building PGP UAM module
487 AC_DEFUN([AC_NETATALK_PGP_UAM], [
488 AC_MSG_CHECKING([whether the PGP UAM should be build])
489 AC_ARG_ENABLE(pgp-uam,
490 [ --enable-pgp-uam enable build of PGP UAM module],[
491 if test "$enableval" = "yes"; then
492 if test "x$neta_cv_have_openssl" = "xyes"; then
493 AC_DEFINE(UAM_PGP, 1, [Define if the PGP UAM module should be compiled])
506 dnl Check for building Kerberos V UAM module
507 AC_DEFUN([AC_NETATALK_KRB5_UAM], [
508 netatalk_cv_build_krb5_uam=no
509 AC_ARG_ENABLE(krbV-uam,
510 [ --enable-krbV-uam enable build of Kerberos V UAM module],
512 if test x"$enableval" = x"yes"; then
513 NETATALK_GSSAPI_CHECK([
514 netatalk_cv_build_krb5_uam=yes
516 AC_MSG_ERROR([need GSSAPI to build Kerberos V UAM])
523 AC_MSG_CHECKING([whether Kerberos V UAM should be build])
524 if test x"$netatalk_cv_build_krb5_uam" = x"yes"; then
529 AM_CONDITIONAL(USE_GSSAPI, test x"$netatalk_cv_build_krb5_uam" = x"yes")
532 dnl Check if we can directly use Kerberos 5 API, used for reading keytabs
533 dnl and automatically construction DirectoryService names from that, instead
534 dnl of requiring special configuration in afp.conf
535 AC_DEFUN([AC_NETATALK_KERBEROS], [
536 AC_MSG_CHECKING([for Kerberos 5 (necessary for GetSrvrInfo:DirectoryNames support)])
537 AC_ARG_WITH([kerberos],
538 [AS_HELP_STRING([--with-kerberos], [Kerberos 5 support (default=auto)])],
540 [with_kerberos=auto])
541 AC_MSG_RESULT($with_kerberos)
543 if test x"$with_kerberos" != x"no"; then
544 have_krb5_header="no"
545 AC_CHECK_HEADERS([krb5/krb5.h krb5.h], [have_krb5_header="yes"; break])
546 if test x"$have_krb5_header" = x"no" && test x"$with_kerberos" != x"auto"; then
547 AC_MSG_FAILURE([--with-kerberos was given, but no headers found])
550 AC_PATH_PROG([KRB5_CONFIG], [krb5-config])
551 AC_MSG_CHECKING([for krb5-config])
552 if test -x "$KRB5_CONFIG"; then
553 AC_MSG_RESULT([$KRB5_CONFIG])
554 KRB5_CFLAGS="`$KRB5_CONFIG --cflags krb5`"
555 KRB5_LIBS="`$KRB5_CONFIG --libs krb5`"
556 AC_SUBST(KRB5_CFLAGS)
560 AC_MSG_RESULT([not found])
561 if test x"$with_kerberos" != x"auto"; then
562 AC_MSG_FAILURE([--with-kerberos was given, but krb5-config could not be found])
567 if test x"$with_kerberos" = x"yes"; then
568 AC_DEFINE([HAVE_KERBEROS], [1], [Define if Kerberos 5 is available])
571 dnl Check for krb5_free_unparsed_name and krb5_free_error_message
572 save_CFLAGS="$CFLAGS"
574 CFLAGS="$KRB5_CFLAGS"
576 AC_CHECK_FUNCS([krb5_free_unparsed_name krb5_free_error_message])
577 CFLAGS="$save_CFLAGS"
581 dnl Check for overwrite the config files or not
582 AC_DEFUN([AC_NETATALK_OVERWRITE_CONFIG], [
583 AC_MSG_CHECKING([whether configuration files should be overwritten])
584 AC_ARG_ENABLE(overwrite,
585 [ --enable-overwrite overwrite configuration files during installation],
586 [OVERWRITE_CONFIG="${enable_overwrite}"],
587 [OVERWRITE_CONFIG="no"]
589 AC_MSG_RESULT([$OVERWRITE_CONFIG])
590 AC_SUBST(OVERWRITE_CONFIG)
593 dnl Check for LDAP support, for client-side ACL visibility
594 AC_DEFUN([AC_NETATALK_LDAP], [
595 AC_MSG_CHECKING(for LDAP (necessary for client-side ACL visibility))
597 [AS_HELP_STRING([--with-ldap],
598 [LDAP support (default=auto)])],
599 netatalk_cv_ldap=$withval,
600 netatalk_cv_ldap=auto
602 AC_MSG_RESULT($netatalk_cv_ldap)
604 save_CFLAGS="$CFLAGS"
605 save_LDFLAGS="$LDFLAGS"
614 if test x"$netatalk_cv_ldap" != x"no" ; then
615 if test x"$netatalk_cv_ldap" != x"yes" -a x"$netatalk_cv_ldap" != x"auto"; then
616 CFLAGS="-I$netatalk_cv_ldap/include"
617 LDFLAGS="-L$netatalk_cv_ldap/lib"
619 AC_CHECK_HEADER([ldap.h], netatalk_cv_ldap=yes,
620 [ if test x"$netatalk_cv_ldap" = x"yes" ; then
621 AC_MSG_ERROR([Missing LDAP headers])
625 AC_CHECK_LIB(ldap, ldap_init, netatalk_cv_ldap=yes,
626 [ if test x"$netatalk_cv_ldap" = x"yes" ; then
627 AC_MSG_ERROR([Missing LDAP library])
633 if test x"$netatalk_cv_ldap" = x"yes"; then
634 LDAP_CFLAGS="$CFLAGS"
635 LDAP_LDFLAGS="$LDFLAGS"
637 AC_DEFINE(HAVE_LDAP,1,[Whether LDAP is available])
640 AC_SUBST(LDAP_CFLAGS)
641 AC_SUBST(LDAP_LDFLAGS)
643 CFLAGS="$save_CFLAGS"
644 LDLFLAGS="$save_LDLFLAGS"
648 dnl Check for ACL support
649 AC_DEFUN([AC_NETATALK_ACL], [
650 AC_MSG_CHECKING(whether to support ACLs)
652 [AS_HELP_STRING([--with-acls],
653 [Include ACL support (default=auto)])],
656 with_acl_support="$withval"
659 with_acl_support=auto
662 [with_acl_support=auto])
663 AC_MSG_RESULT($with_acl_support)
665 if test x"$with_acl_support" = x"no"; then
666 AC_MSG_RESULT(Disabling ACL support)
667 AC_DEFINE(HAVE_NO_ACLS,1,[Whether no ACLs support should be built in])
672 if test x"$with_acl_support" = x"yes" ; then
673 AC_MSG_NOTICE(checking whether ACL support is available:)
676 AC_MSG_NOTICE(Using UnixWare ACLs)
677 AC_DEFINE(HAVE_UNIXWARE_ACLS,1,[Whether UnixWare ACLs are available])
680 AC_MSG_NOTICE(Using solaris ACLs)
681 AC_DEFINE(HAVE_SOLARIS_ACLS,1,[Whether solaris ACLs are available])
682 ACL_LIBS="$ACL_LIBS -lsec"
685 AC_MSG_NOTICE(Using HPUX ACLs)
686 AC_DEFINE(HAVE_HPUX_ACLS,1,[Whether HPUX ACLs are available])
689 AC_MSG_NOTICE(Using IRIX ACLs)
690 AC_DEFINE(HAVE_IRIX_ACLS,1,[Whether IRIX ACLs are available])
693 AC_MSG_NOTICE(Using AIX ACLs)
694 AC_DEFINE(HAVE_AIX_ACLS,1,[Whether AIX ACLs are available])
697 AC_MSG_NOTICE(Using Tru64 ACLs)
698 AC_DEFINE(HAVE_TRU64_ACLS,1,[Whether Tru64 ACLs are available])
699 ACL_LIBS="$ACL_LIBS -lpacl"
702 AC_MSG_NOTICE(ACLs on Darwin currently not supported)
703 AC_DEFINE(HAVE_NO_ACLS,1,[Whether no ACLs support is available])
706 AC_CHECK_LIB(acl,acl_get_file,[ACL_LIBS="$ACL_LIBS -lacl"])
709 AC_CHECK_LIB(attr,getxattr,[ACL_LIBS="$ACL_LIBS -lattr"])
712 AC_CACHE_CHECK([for POSIX ACL support],netatalk_cv_HAVE_POSIX_ACLS,[
714 LIBS="$LIBS $ACL_LIBS"
715 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
716 #include <sys/types.h>
721 acl_entry_t *entry_p;
722 return acl_get_entry(acl, entry_id, entry_p);
723 ]])],[netatalk_cv_HAVE_POSIX_ACLS=yes],[netatalk_cv_HAVE_POSIX_ACLS=no
724 with_acl_support=no])
727 if test x"$netatalk_cv_HAVE_POSIX_ACLS" = x"yes"; then
728 AC_MSG_NOTICE(Using POSIX ACLs)
729 AC_DEFINE(HAVE_POSIX_ACLS,1,[Whether POSIX ACLs are available])
730 AC_CACHE_CHECK([for acl_get_perm_np],netatalk_cv_HAVE_ACL_GET_PERM_NP,[
732 LIBS="$LIBS $ACL_LIBS"
733 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
734 #include <sys/types.h>
737 acl_permset_t permset_d;
739 return acl_get_perm_np(permset_d, perm);
740 ]])],[netatalk_cv_HAVE_ACL_GET_PERM_NP=yes],[netatalk_cv_HAVE_ACL_GET_PERM_NP=no])
743 if test x"$netatalk_cv_HAVE_ACL_GET_PERM_NP" = x"yes"; then
744 AC_DEFINE(HAVE_ACL_GET_PERM_NP,1,[Whether acl_get_perm_np() is available])
748 AC_CACHE_CHECK([for acl_from_mode], netatalk_cv_HAVE_ACL_FROM_MODE,[
750 LIBS="$LIBS $ACL_LIBS"
751 AC_CHECK_FUNCS(acl_from_mode,
752 [netatalk_cv_HAVE_ACL_FROM_MODE=yes],
753 [netatalk_cv_HAVE_ACL_FROM_MODE=no])
756 if test x"netatalk_cv_HAVE_ACL_FROM_MODE" = x"yes"; then
757 AC_DEFINE(HAVE_ACL_FROM_MODE,1,[Whether acl_from_mode() is available])
761 AC_MSG_NOTICE(ACL support is not avaliable)
762 AC_DEFINE(HAVE_NO_ACLS,1,[Whether no ACLs support is available])
768 if test x"$with_acl_support" = x"yes" ; then
769 AC_CHECK_HEADERS([acl/libacl.h])
770 AC_DEFINE(HAVE_ACLS,1,[Whether ACLs support is available])
775 dnl Check for Extended Attributes support
776 AC_DEFUN([AC_NETATALK_EXTENDED_ATTRIBUTES], [
778 neta_cv_eas_sys_found=no
779 neta_cv_eas_sys_not_found=no
781 AC_CHECK_HEADERS(sys/attributes.h attr/xattr.h sys/xattr.h sys/extattr.h sys/uio.h sys/ea.h)
786 AC_SEARCH_LIBS(getproplist, [proplist])
787 AC_CHECK_FUNCS([getproplist fgetproplist setproplist fsetproplist],
788 [neta_cv_eas_sys_found=yes],
789 [neta_cv_eas_sys_not_found=yes])
790 AC_CHECK_FUNCS([delproplist fdelproplist add_proplist_entry get_proplist_entry],,
791 [neta_cv_eas_sys_not_found=yes])
792 AC_CHECK_FUNCS([sizeof_proplist_entry],,
793 [neta_cv_eas_sys_not_found=yes])
797 AC_CHECK_FUNCS([attropen],
798 [neta_cv_eas_sys_found=yes; AC_DEFINE(HAVE_EAFD, 1, [extattr API has full fledged fds for EAs])],
799 [neta_cv_eas_sys_not_found=yes])
803 AC_CHECK_FUNCS([extattr_delete_fd extattr_delete_file extattr_delete_link],
804 [neta_cv_eas_sys_found=yes],
805 [neta_cv_eas_sys_not_found=yes])
806 AC_CHECK_FUNCS([extattr_get_fd extattr_get_file extattr_get_link],,
807 [neta_cv_eas_sys_not_found=yes])
808 AC_CHECK_FUNCS([extattr_list_fd extattr_list_file extattr_list_link],,
809 [neta_cv_eas_sys_not_found=yes])
810 AC_CHECK_FUNCS([extattr_set_fd extattr_set_file extattr_set_link],,
811 [neta_cv_eas_sys_not_found=yes])
814 *freebsd4* | *dragonfly* )
815 AC_DEFINE(BROKEN_EXTATTR, 1, [Does extattr API work])
819 AC_SEARCH_LIBS(getxattr, [attr])
821 if test "x$neta_cv_eas_sys_found" != "xyes" ; then
822 AC_CHECK_FUNCS([getxattr lgetxattr fgetxattr listxattr llistxattr],
823 [neta_cv_eas_sys_found=yes],
824 [neta_cv_eas_sys_not_found=yes])
825 AC_CHECK_FUNCS([flistxattr removexattr lremovexattr fremovexattr],,
826 [neta_cv_eas_sys_not_found=yes])
827 AC_CHECK_FUNCS([setxattr lsetxattr fsetxattr],,
828 [neta_cv_eas_sys_not_found=yes])
831 if test "x$neta_cv_eas_sys_found" != "xyes" ; then
832 AC_CHECK_FUNCS([getea fgetea lgetea listea flistea llistea],
833 [neta_cv_eas_sys_found=yes],
834 [neta_cv_eas_sys_not_found=yes])
835 AC_CHECK_FUNCS([removeea fremoveea lremoveea setea fsetea lsetea],,
836 [neta_cv_eas_sys_not_found=yes])
839 if test "x$neta_cv_eas_sys_found" != "xyes" ; then
840 AC_CHECK_FUNCS([attr_get attr_list attr_set attr_remove],,
841 [neta_cv_eas_sys_not_found=yes])
842 AC_CHECK_FUNCS([attr_getf attr_listf attr_setf attr_removef],,
843 [neta_cv_eas_sys_not_found=yes])
848 # Do xattr functions take additional options like on Darwin?
849 if test x"$ac_cv_func_getxattr" = x"yes" ; then
850 AC_CACHE_CHECK([whether xattr interface takes additional options], smb_attr_cv_xattr_add_opt, [
852 LIBS="$LIBS $ACL_LIBS"
853 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
854 #include <sys/types.h>
855 #if HAVE_ATTR_XATTR_H
856 #include <attr/xattr.h>
857 #elif HAVE_SYS_XATTR_H
858 #include <sys/xattr.h>
861 getxattr(0, 0, 0, 0, 0, 0);
862 ]])],[smb_attr_cv_xattr_add_opt=yes],[smb_attr_cv_xattr_add_opt=no;LIBS=$old_LIBS])
864 if test x"$smb_attr_cv_xattr_add_opt" = x"yes"; then
865 AC_DEFINE(XATTR_ADD_OPT, 1, [xattr functions have additional options])
869 if test "x$neta_cv_eas_sys_found" = "xyes" ; then
870 if test "x$neta_cv_eas_sys_not_found" != "xyes" ; then
871 neta_cv_eas="$neta_cv_eas | sys"
874 AC_DEFINE_UNQUOTED(EA_MODULES,["$neta_cv_eas"],[Available Extended Attributes modules])
877 dnl Check for libsmbsharemodes from Samba for Samba/Netatalk access/deny/share modes interop
878 dnl Defines "neta_cv_have_smbshmd" to "yes" or "no"
879 dnl AC_SUBST's "SMB_SHAREMODES_CFLAGS" and "SMB_SHAREMODES_LDFLAGS"
880 dnl AM_CONDITIONAL's "USE_SMB_SHAREMODES"
881 AC_DEFUN([AC_NETATALK_SMB_SHAREMODES], [
882 neta_cv_have_smbshmd=no
883 AC_ARG_WITH(smbsharemodes-lib,
884 [ --with-smbsharemodes-lib=PATH PATH to libsmbsharemodes lib from Samba],
885 [SMB_SHAREMODES_LDFLAGS="-L$withval -lsmbsharemodes"]
887 AC_ARG_WITH(smbsharemodes-include,
888 [ --with-smbsharemodes-include=PATH PATH to libsmbsharemodes header from Samba],
889 [SMB_SHAREMODES_CFLAGS="-I$withval"]
891 AC_ARG_WITH(smbsharemodes,
892 [AS_HELP_STRING([--with-smbsharemodes],[Samba interop (default is yes)])],
893 [use_smbsharemodes=$withval],
894 [use_smbsharemodes=yes]
897 if test x"$use_smbsharemodes" = x"yes" ; then
898 AC_MSG_CHECKING([whether to enable Samba/Netatalk access/deny/share-modes interop])
900 saved_CFLAGS="$CFLAGS"
901 saved_LDFLAGS="$LDFLAGS"
902 CFLAGS="$SMB_SHAREMODES_CFLAGS $CFLAGS"
903 LDFLAGS="$SMB_SHAREMODES_LDFLAGS $LDFLAGS"
908 #include <sys/time.h>
911 /* From messages.h */
915 #include "smb_share_modes.h"
916 int main(void) { (void)smb_share_mode_db_open(""); return 0;}],
917 [neta_cv_have_smbshmd=yes]
920 AC_MSG_RESULT($neta_cv_have_smbshmd)
921 AC_SUBST(SMB_SHAREMODES_CFLAGS, [$SMB_SHAREMODES_CFLAGS])
922 AC_SUBST(SMB_SHAREMODES_LDFLAGS, [$SMB_SHAREMODES_LDFLAGS])
923 CFLAGS="$saved_CFLAGS"
924 LDFLAGS="$saved_LDFLAGS"
927 AM_CONDITIONAL(USE_SMB_SHAREMODES, test x"$neta_cv_have_smbshmd" = x"yes")
930 dnl ------ Check for sendfile() --------
931 AC_DEFUN([AC_NETATALK_SENDFILE], [
932 netatalk_cv_search_sendfile=yes
933 AC_ARG_ENABLE(sendfile,
934 [ --disable-sendfile disable sendfile syscall],
935 [if test x"$enableval" = x"no"; then
936 netatalk_cv_search_sendfile=no
940 if test x"$netatalk_cv_search_sendfile" = x"yes"; then
943 AC_DEFINE(SENDFILE_FLAVOR_LINUX,1,[Whether linux sendfile() API is available])
944 AC_CHECK_FUNC([sendfile], [netatalk_cv_HAVE_SENDFILE=yes])
948 AC_DEFINE(SENDFILE_FLAVOR_SOLARIS, 1, [Solaris sendfile()])
949 AC_SEARCH_LIBS(sendfile, sendfile)
950 AC_CHECK_FUNC([sendfile], [netatalk_cv_HAVE_SENDFILE=yes])
951 AC_CHECK_FUNCS([sendfilev])
955 AC_DEFINE(SENDFILE_FLAVOR_BSD, 1, [Define if the sendfile() function uses BSD semantics])
956 AC_CHECK_FUNC([sendfile], [netatalk_cv_HAVE_SENDFILE=yes])
964 if test x"$netatalk_cv_HAVE_SENDFILE" = x"yes"; then
965 AC_DEFINE(WITH_SENDFILE,1,[Whether sendfile() should be used])
970 dnl --------------------- Check if realpath() takes NULL
971 AC_DEFUN([AC_NETATALK_REALPATH], [
972 AC_CACHE_CHECK([if the realpath function allows a NULL argument],
973 neta_cv_REALPATH_TAKES_NULL, [
974 AC_RUN_IFELSE([AC_LANG_SOURCE([[
979 void exit_on_core(int ignored) {
985 signal(SIGSEGV, exit_on_core);
986 newpath = realpath("/tmp", NULL);
987 exit((newpath != NULL) ? 0 : 1);
988 }]])],[neta_cv_REALPATH_TAKES_NULL=yes],[neta_cv_REALPATH_TAKES_NULL=no],[neta_cv_REALPATH_TAKES_NULL=cross
993 if test x"$neta_cv_REALPATH_TAKES_NULL" = x"yes"; then
994 AC_DEFINE(REALPATH_TAKES_NULL,1,[Whether the realpath function allows NULL])