1 dnl Kitchen sink for configuration macros
3 dnl Whether to disable bundled libevent
4 AC_DEFUN([AC_NETATALK_LIBEVENT], [
5 AC_MSG_CHECKING([whether to disable bundled libevent (define CPPFLAGS and LDFLAGS otherwise appropiately to pick up installed version)])
9 [--disable-bundled-libevent],
10 [whether the bundled version of libevent shall not be used (define CPPFLAGS and LDFLAGS otherwise appropiately to pick up installed version)]
12 use_bundled_libevent=$enableval,
13 use_bundled_libevent=yes
16 if test x"$use_bundled_libevent" = x"yes" ; then
17 AC_CONFIG_SUBDIRS([libevent])
19 AM_CONDITIONAL(USE_BUILTIN_LIBEVENT, test x"$use_bundled_libevent" = x"yes")
22 dnl Filesystem Hierarchy Standard (FHS) compatibility
23 AC_DEFUN([AC_NETATALK_FHS], [
24 AC_MSG_CHECKING([whether to use Filesystem Hierarchy Standard (FHS) compatibility])
26 [ --enable-fhs use Filesystem Hierarchy Standard (FHS) compatibility],[
27 if test "$enableval" = "yes"; then
28 uams_path="${libdir}/netatalk"
30 PKGCONFDIR=${sysconfdir}/netatalk
31 SERVERTEXT="${PKGCONFDIR}/msg"
33 mandir="/usr/share/man"
34 AC_DEFINE(FHS_COMPATIBILITY, 1, [Define if you want compatibily with the FHS])
44 dnl 64bit platform check
45 AC_DEFUN([AC_NETATALK_64BIT_LIBS], [
46 AC_MSG_CHECKING([whether to check for 64bit libraries])
47 # Test if the compiler is in 64bit mode
48 echo 'int i;' > conftest.$ac_ext
49 atalk_cv_cc_64bit_output=no
50 if AC_TRY_EVAL(ac_compile); then
51 case `/usr/bin/file conftest.$ac_objext` in
53 atalk_cv_cc_64bit_output=yes
59 case $host_cpu:$atalk_cv_cc_64bit_output in
60 powerpc64:yes | s390x:yes | sparc*:yes | x86_64:yes | i386:yes)
64 atalk_libname="lib/64"
83 dnl Check for optional admin group support
84 AC_DEFUN([AC_NETATALK_ADMIN_GROUP], [
85 netatalk_cv_admin_group=yes
86 AC_MSG_CHECKING([for administrative group support])
87 AC_ARG_ENABLE(admin-group,
88 [ --disable-admin-group disable admin group],[
89 if test x"$enableval" = x"no"; then
90 AC_DEFINE(ADMIN_GRP, 0, [Define if the admin group should be enabled])
91 netatalk_cv_admin_group=no
94 AC_DEFINE(ADMIN_GRP, 1, [Define if the admin group should be enabled])
97 AC_DEFINE(ADMIN_GRP, 1, [Define if the admin group should be enabled])
102 dnl Check for optional cracklib support
103 AC_DEFUN([AC_NETATALK_CRACKLIB], [
104 netatalk_cv_with_cracklib=no
105 AC_ARG_WITH(cracklib,
106 [ --with-cracklib=DICT enable/set location of cracklib dictionary],[
107 if test "x$withval" != "xno" ; then
109 AC_CHECK_LIB(crack, main, [
110 AC_DEFINE(USE_CRACKLIB, 1, [Define if cracklib should be used])
112 if test "$cracklib" = "yes"; then
113 cracklib="/usr/$atalk_libname/cracklib_dict"
115 AC_DEFINE_UNQUOTED(_PATH_CRACKLIB, "$cracklib",
116 [path to cracklib dictionary])
117 AC_MSG_RESULT([setting cracklib dictionary to $cracklib])
118 netatalk_cv_with_cracklib=yes
120 AC_MSG_ERROR([cracklib not found!])
126 AC_MSG_CHECKING([for cracklib support])
127 AC_MSG_RESULT([$netatalk_cv_with_cracklib])
130 dnl Check whether to enable debug code
131 AC_DEFUN([AC_NETATALK_DEBUG], [
132 AC_MSG_CHECKING([whether to enable verbose debug code])
134 [ --enable-debug enable verbose debug code],[
135 if test "$enableval" != "no"; then
136 if test "$enableval" = "yes"; then
137 AC_DEFINE(DEBUG, 1, [Define if verbose debugging information should be included])
139 AC_DEFINE_UNQUOTED(DEBUG, $enableval, [Define if verbose debugging information should be included])
144 AC_DEFINE(NDEBUG, 1, [Disable assertions])
148 AC_DEFINE(NDEBUG, 1, [Disable assertions])
153 dnl Check whethe to disable tickle SIGALARM stuff, which eases debugging
154 AC_DEFUN([AC_NETATALK_DEBUGGING], [
155 AC_MSG_CHECKING([whether to enable debugging with debuggers])
156 AC_ARG_ENABLE(debugging,
157 [ --enable-debugging disable SIGALRM timers and DSI tickles (eg for debugging with gdb/dbx/...)],[
158 if test "$enableval" != "no"; then
159 if test "$enableval" = "yes"; then
160 AC_DEFINE(DEBUGGING, 1, [Define if you want to disable SIGALRM timers and DSI tickles])
162 AC_DEFINE_UNQUOTED(DEBUGGING, $enableval, [Define if you want to disable SIGALRM timers and DSI tickles])
175 dnl Check for optional shadow password support
176 AC_DEFUN([AC_NETATALK_SHADOW], [
177 netatalk_cv_use_shadowpw=no
179 [ --with-shadow enable shadow password support [[auto]]],
180 [netatalk_cv_use_shadowpw="$withval"],
181 [netatalk_cv_use_shadowpw=auto]
184 if test "x$netatalk_cv_use_shadowpw" != "xno"; then
185 AC_CHECK_HEADER([shadow.h])
186 if test x"$ac_cv_header_shadow_h" = x"yes"; then
187 netatalk_cv_use_shadowpw=yes
188 AC_DEFINE(SHADOWPW, 1, [Define if shadow passwords should be used])
190 if test "x$shadowpw" = "xyes"; then
191 AC_MSG_ERROR([shadow support not available])
193 netatalk_cv_use_shadowpw=no
198 AC_MSG_CHECKING([whether shadow support should be enabled])
199 if test "x$netatalk_cv_use_shadowpw" = "xyes"; then
206 dnl Check for optional valid-shell-check support
207 AC_DEFUN([AC_NETATALK_SHELL_CHECK], [
208 netatalk_cv_use_shellcheck=yes
209 AC_MSG_CHECKING([whether checking for a valid shell should be enabled])
210 AC_ARG_ENABLE(shell-check,
211 [ --disable-shell-check disable checking for a valid shell],[
212 if test "$enableval" = "no"; then
213 AC_DEFINE(DISABLE_SHELLCHECK, 1, [Define if shell check should be disabled])
215 netatalk_cv_use_shellcheck=no
225 dnl Check for optional sysv initscript install
226 AC_DEFUN([AC_NETATALK_INIT_STYLE], [
227 AC_ARG_WITH(init-style,
228 [ --with-init-style use OS specific init config [[redhat-sysv|redhat-systemd|suse-sysv|suse-systemd|gentoo|netbsd|debian|systemd]]],
229 init_style="$withval", init_style=none
231 case "$init_style" in
233 AC_MSG_ERROR([--with-init-style=redhat is obsoleted. Use redhat-sysv or redhat-systemd.])
236 AC_MSG_RESULT([enabling redhat-style sysv (upstart) configuration])
239 AC_MSG_RESULT([enabling redhat-style systemd support])
242 AC_MSG_ERROR([--with-init-style=suse is obsoleted. Use suse-sysv or suse-systemd.])
245 AC_MSG_RESULT([enabling suse-style sysv configuration])
248 AC_MSG_RESULT([enabling suse-style systemd support (>=openSUSE12.1)])
251 AC_MSG_RESULT([enabling gentoo-style sysv support])
254 AC_MSG_RESULT([enabling netbsd-style sysv support])
257 AC_MSG_RESULT([enabling debian-style sysv support])
260 AC_MSG_RESULT([use general systemd configuration])
263 AC_MSG_RESULT([disabling sysv support])
266 AM_CONDITIONAL(USE_NETBSD, test x$init_style = xnetbsd)
267 AM_CONDITIONAL(USE_REDHAT_SYSV, test x$init_style = xredhat-sysv)
268 AM_CONDITIONAL(USE_SUSE_SYSV, test x$init_style = xsuse-sysv)
269 AM_CONDITIONAL(USE_SHADOWPW, test x$shadowpw = xyes)
270 AM_CONDITIONAL(USE_TRU64, test x$init_style = xtru64)
271 AM_CONDITIONAL(USE_SOLARIS, test x$init_style = xsolaris)
272 AM_CONDITIONAL(USE_GENTOO, test x$init_style = xgentoo)
273 AM_CONDITIONAL(USE_DEBIAN, test x$init_style = xdebian)
274 AM_CONDITIONAL(USE_SYSTEMD, test x$init_style = xsystemd || test x$init_style = xredhat-systemd || test x$init_style = xsuse-systemd)
275 AM_CONDITIONAL(USE_UNDEF, test x$init_style = xnone)
279 dnl OS specific configuration
280 AC_DEFUN([AC_NETATALK_OS_SPECIFIC], [
282 *aix*) this_os=aix ;;
283 *freebsd*) this_os=freebsd ;;
284 *hpux11*) this_os=hpux11 ;;
285 *irix*) this_os=irix ;;
286 *linux*) this_os=linux ;;
287 *osx*) this_os=macosx ;;
288 *darwin*) this_os=macosx ;;
289 *netbsd*) this_os=netbsd ;;
290 *openbsd*) this_os=openbsd ;;
291 *osf*) this_os=tru64 ;;
292 *solaris*) this_os=solaris ;;
296 i386|i486|i586|i686|k7) this_cpu=x86 ;;
297 alpha) this_cpu=alpha ;;
298 mips) this_cpu=mips ;;
299 powerpc|ppc) this_cpu=ppc ;;
302 dnl --------------------- GNU source
304 linux) AC_DEFINE(_GNU_SOURCE, 1, [Whether to use GNU libc extensions])
306 kfreebsd-gnu) AC_DEFINE(_GNU_SOURCE, 1, [Whether to use GNU libc extensions])
310 dnl --------------------- operating system specific flags (port from sys/*)
312 dnl ----- FreeBSD specific -----
313 if test x"$this_os" = "xfreebsd"; then
314 AC_MSG_RESULT([ * FreeBSD specific configuration])
315 AC_DEFINE(BSD4_4, 1, [BSD compatiblity macro])
316 AC_DEFINE(FREEBSD, 1, [Define if OS is FreeBSD])
317 AC_DEFINE(OPEN_NOFOLLOW_ERRNO, EMLINK, errno returned by open with O_NOFOLLOW)
320 dnl ----- GNU/kFreeBSD specific -----
321 if test x"$this_os" = "xkfreebsd-gnu"; then
322 AC_MSG_RESULT([ * GNU/kFreeBSD specific configuration])
323 AC_DEFINE(BSD4_4, 1, [BSD compatiblity macro])
324 AC_DEFINE(FREEBSD, 1, [Define if OS is FreeBSD])
325 AC_DEFINE(OPEN_NOFOLLOW_ERRNO, EMLINK, errno returned by open with O_NOFOLLOW)
328 dnl ----- Linux specific -----
329 if test x"$this_os" = "xlinux"; then
330 AC_MSG_RESULT([ * Linux specific configuration])
332 dnl ----- check if we need the quotactl wrapper
333 AC_CHECK_HEADERS(linux/dqblk_xfs.h,,
334 [AC_CHECK_HEADERS(linux/xqm.h linux/xfs_fs.h)
335 AC_CHECK_HEADERS(xfs/libxfs.h xfs/xqm.h xfs/xfs_fs.h)]
339 dnl ----- as far as I can tell, dbtob always does the wrong thing
340 dnl ----- on every single version of linux I've ever played with.
341 dnl ----- see etc/afpd/quota.c
342 AC_DEFINE(HAVE_BROKEN_DBTOB, 1, [Define if dbtob is broken])
347 dnl ----- NetBSD specific -----
348 if test x"$this_os" = "xnetbsd"; then
349 AC_MSG_RESULT([ * NetBSD specific configuration])
350 AC_DEFINE(BSD4_4, 1, [BSD compatiblity macro])
351 AC_DEFINE(NETBSD, 1, [Define if OS is NetBSD])
352 AC_DEFINE(OPEN_NOFOLLOW_ERRNO, EFTYPE, errno returned by open with O_NOFOLLOW)
354 CFLAGS="-I\$(top_srcdir)/sys/netbsd $CFLAGS"
357 dnl ----- NetBSD does not have crypt.h, uses unistd.h -----
358 AC_DEFINE(UAM_DHX, 1, [Define if the DHX UAM modules should be compiled])
361 dnl ----- OpenBSD specific -----
362 if test x"$this_os" = "xopenbsd"; then
363 AC_MSG_RESULT([ * OpenBSD specific configuration])
364 AC_DEFINE(BSD4_4, 1, [BSD compatiblity macro])
365 dnl ----- OpenBSD does not have crypt.h, uses unistd.h -----
366 AC_DEFINE(UAM_DHX, 1, [Define if the DHX UAM modules should be compiled])
369 dnl ----- Solaris specific -----
370 if test x"$this_os" = "xsolaris"; then
371 AC_MSG_RESULT([ * Solaris specific configuration])
372 AC_DEFINE(__svr4__, 1, [Solaris compatibility macro])
373 AC_DEFINE(_ISOC9X_SOURCE, 1, [Compatibility macro])
374 AC_DEFINE(NO_STRUCT_TM_GMTOFF, 1, [Define if the gmtoff member of struct tm is not available])
375 AC_DEFINE(SOLARIS, 1, [Solaris compatibility macro])
376 AC_DEFINE(_XOPEN_SOURCE, 600, [Solaris compilation environment])
377 AC_DEFINE(__EXTENSIONS__, 1, [Solaris compilation environment])
378 CFLAGS="-I\$(top_srcdir)/sys/generic $CFLAGS"
383 AC_MSG_CHECKING([if we can build Solaris kernel module])
384 if test -x /usr/ccs/bin/ld && test x"$netatalk_cv_ddp_enabled" = x"yes" ; then
387 AC_MSG_RESULT([$solaris_module])
389 COMPILE_64BIT_KMODULE=no
392 COMPILE_KERNEL_GCC=no
394 if test "$solaris_module" = "yes"; then
395 dnl Solaris kernel module stuff
396 AC_MSG_CHECKING([if we have to build a 64bit kernel module])
398 # check for isainfo, if not found it has to be a 32 bit kernel (<=2.6)
399 if test -x /usr/bin/isainfo; then
400 # check for 64 bit platform
401 if isainfo -kv | grep '^64-bit'; then
402 COMPILE_64BIT_KMODULE=yes
406 AC_MSG_RESULT([$COMPILE_64BIT_KMODULE])
408 if test "${GCC}" = yes; then
409 COMPILE_KERNEL_GCC=yes
410 if test "$COMPILE_64BIT_KMODULE" = yes; then
412 AC_MSG_CHECKING([if we can build a 64bit kernel module])
414 case `$CC --version 2>/dev/null` in
416 COMPILE_64BIT_KMODULE=no
417 COMPILE_KERNEL_GCC=no
422 #KLDFLAGS="-melf64_sparc"
426 AC_MSG_RESULT([$COMPILE_64BIT_KMODULE])
432 KCFLAGS="$KCFLAGS -D_KERNEL -Wall -Wstrict-prototypes"
434 if test "$COMPILE_64BIT_KMODULE" = yes; then
435 # use Sun CC (for a 64-bit kernel, uncomment " -xarch=v9 -xregs=no%appl ")
436 KCFLAGS="-xarch=v9 -xregs=no%appl"
442 KCFLAGS="-D_KERNEL $KCFLAGS -mno-app-regs -munaligned-doubles -fpcc-struct-return"
445 AC_CACHE_CHECK([for timeout_id_t],netatalk_cv_HAVE_TIMEOUT_ID_T,[
447 #include <sys/stream.h>
448 #include <sys/ddi.h>],
452 netatalk_cv_HAVE_TIMEOUT_ID_T=yes,netatalk_cv_HAVE_TIMEOUT_ID_T=no,netatalk_cv_HAVE_TIMEOUT_ID_T=cross)])
454 AC_DEFINE(HAVE_TIMEOUT_ID_T, test x"$netatalk_cv_HAVE_TIMEOUT_ID" = x"yes", [define for timeout_id_t])
457 AC_SUBST(COMPILE_KERNEL_GCC)
458 AC_SUBST(COMPILE_64BIT_KMODULE)
463 dnl Whether to run ldconfig after installing libraries
464 AC_PATH_PROG(NETA_LDCONFIG, ldconfig, , [$PATH$PATH_SEPARATOR/sbin$PATH_SEPARATOR/bin$PATH_SEPARATOR/usr/sbin$PATH_SEPARATOR/usr/bin])
465 echo NETA_LDCONFIG = $NETA_LDCONFIG
466 AM_CONDITIONAL(RUN_LDCONFIG, test x"$this_os" = x"linux" -a x"$NETA_LDCONFIG" != x"")
469 dnl Check for building PGP UAM module
470 AC_DEFUN([AC_NETATALK_PGP_UAM], [
471 AC_MSG_CHECKING([whether the PGP UAM should be build])
472 AC_ARG_ENABLE(pgp-uam,
473 [ --enable-pgp-uam enable build of PGP UAM module],[
474 if test "$enableval" = "yes"; then
475 if test "x$neta_cv_have_openssl" = "xyes"; then
476 AC_DEFINE(UAM_PGP, 1, [Define if the PGP UAM module should be compiled])
489 dnl Check for building Kerberos V UAM module
490 AC_DEFUN([AC_NETATALK_KRB5_UAM], [
491 netatalk_cv_build_krb5_uam=no
492 AC_ARG_ENABLE(krbV-uam,
493 [ --enable-krbV-uam enable build of Kerberos V UAM module],
495 if test x"$enableval" = x"yes"; then
496 NETATALK_GSSAPI_CHECK([
497 netatalk_cv_build_krb5_uam=yes
499 AC_MSG_ERROR([need GSSAPI to build Kerberos V UAM])
506 AC_MSG_CHECKING([whether Kerberos V UAM should be build])
507 if test x"$netatalk_cv_build_krb5_uam" = x"yes"; then
512 AM_CONDITIONAL(USE_GSSAPI, test x"$netatalk_cv_build_krb5_uam" = x"yes")
515 dnl Check if we can directly use Kerberos 5 API, used for reading keytabs
516 dnl and automatically construction DirectoryService names from that, instead
517 dnl of requiring special configuration in afp.conf
518 AC_DEFUN([AC_NETATALK_KERBEROS], [
519 AC_MSG_CHECKING([for Kerberos 5 (necessary for GetSrvrInfo:DirectoryNames support)])
520 AC_ARG_WITH([kerberos],
521 [AS_HELP_STRING([--with-kerberos], [Kerberos 5 support (default=auto)])],
523 [with_kerberos=auto])
524 AC_MSG_RESULT($with_kerberos)
526 if test x"$with_kerberos" != x"no"; then
527 have_krb5_header="no"
528 AC_CHECK_HEADERS([krb5/krb5.h krb5.h], [have_krb5_header="yes"; break])
529 if test x"$have_krb5_header" = x"no" && test x"$with_kerberos" != x"auto"; then
530 AC_MSG_FAILURE([--with-kerberos was given, but no headers found])
533 AC_PATH_PROG([KRB5_CONFIG], [krb5-config])
534 AC_MSG_CHECKING([for krb5-config])
535 if test -x "$KRB5_CONFIG"; then
536 AC_MSG_RESULT([$KRB5_CONFIG])
537 KRB5_CFLAGS="`$KRB5_CONFIG --cflags krb5`"
538 KRB5_LIBS="`$KRB5_CONFIG --libs krb5`"
539 AC_SUBST(KRB5_CFLAGS)
543 AC_MSG_RESULT([not found])
544 if test x"$with_kerberos" != x"auto"; then
545 AC_MSG_FAILURE([--with-kerberos was given, but krb5-config could not be found])
550 if test x"$with_kerberos" = x"yes"; then
551 AC_DEFINE([HAVE_KERBEROS], [1], [Define if Kerberos 5 is available])
555 dnl Check for overwrite the config files or not
556 AC_DEFUN([AC_NETATALK_OVERWRITE_CONFIG], [
557 AC_MSG_CHECKING([whether configuration files should be overwritten])
558 AC_ARG_ENABLE(overwrite,
559 [ --enable-overwrite overwrite configuration files during installation],
560 [OVERWRITE_CONFIG="${enable_overwrite}"],
561 [OVERWRITE_CONFIG="no"]
563 AC_MSG_RESULT([$OVERWRITE_CONFIG])
564 AC_SUBST(OVERWRITE_CONFIG)
567 dnl Check for LDAP support, for client-side ACL visibility
568 AC_DEFUN([AC_NETATALK_LDAP], [
569 AC_MSG_CHECKING(for LDAP (necessary for client-side ACL visibility))
571 [AS_HELP_STRING([--with-ldap],
572 [LDAP support (default=auto)])],
573 netatalk_cv_ldap=$withval,
574 netatalk_cv_ldap=auto
576 AC_MSG_RESULT($netatalk_cv_ldap)
579 save_LDLFLAGS=$LDLFLAGS
583 if test x"$netatalk_cv_ldap" != x"no" ; then
584 if test x"$netatalk_cv_ldap" != x"yes" -a x"$netatalk_cv_ldap" != x"auto"; then
585 CFLAGS=-I$netatalk_cv_ldap/include
586 LDLFLAGS=-L$netatalk_cv_ldap/lib
588 AC_CHECK_HEADER([ldap.h], netatalk_cv_ldap=yes,
589 [ if test x"$netatalk_cv_ldap" = x"yes" ; then
590 AC_MSG_ERROR([Missing LDAP headers])
594 AC_CHECK_LIB(ldap, ldap_init, netatalk_cv_ldap=yes,
595 [ if test x"$netatalk_cv_ldap" = x"yes" ; then
596 AC_MSG_ERROR([Missing LDAP library])
602 if test x"$netatalk_cv_ldap" = x"yes"; then
603 echo "********************************************************************"
605 LDAP_LDLFLAGS=$LDLFLAGS
607 AC_DEFINE(HAVE_LDAP,1,[Whether LDAP is available])
608 AC_SUBST(LDAP_CFLAGS)
609 AC_SUBST(LDAP_LDLFLAGS)
614 LDLFLAGS=$save_LDLFLAGS
617 dnl Check for ACL support
618 AC_DEFUN([AC_NETATALK_ACL], [
619 AC_MSG_CHECKING(whether to support ACLs)
621 [AS_HELP_STRING([--with-acls],
622 [Include ACL support (default=auto)])],
625 with_acl_support="$withval"
628 with_acl_support=auto
631 [with_acl_support=auto])
632 AC_MSG_RESULT($with_acl_support)
634 if test x"$with_acl_support" = x"no"; then
635 AC_MSG_RESULT(Disabling ACL support)
636 AC_DEFINE(HAVE_NO_ACLS,1,[Whether no ACLs support should be built in])
641 if test x"$with_acl_support" = x"yes" ; then
642 AC_MSG_NOTICE(checking whether ACL support is available:)
645 AC_MSG_NOTICE(Using UnixWare ACLs)
646 AC_DEFINE(HAVE_UNIXWARE_ACLS,1,[Whether UnixWare ACLs are available])
649 AC_MSG_NOTICE(Using solaris ACLs)
650 AC_DEFINE(HAVE_SOLARIS_ACLS,1,[Whether solaris ACLs are available])
651 ACL_LIBS="$ACL_LIBS -lsec"
654 AC_MSG_NOTICE(Using HPUX ACLs)
655 AC_DEFINE(HAVE_HPUX_ACLS,1,[Whether HPUX ACLs are available])
658 AC_MSG_NOTICE(Using IRIX ACLs)
659 AC_DEFINE(HAVE_IRIX_ACLS,1,[Whether IRIX ACLs are available])
662 AC_MSG_NOTICE(Using AIX ACLs)
663 AC_DEFINE(HAVE_AIX_ACLS,1,[Whether AIX ACLs are available])
666 AC_MSG_NOTICE(Using Tru64 ACLs)
667 AC_DEFINE(HAVE_TRU64_ACLS,1,[Whether Tru64 ACLs are available])
668 ACL_LIBS="$ACL_LIBS -lpacl"
671 AC_MSG_NOTICE(ACLs on Darwin currently not supported)
672 AC_DEFINE(HAVE_NO_ACLS,1,[Whether no ACLs support is available])
675 AC_CHECK_LIB(acl,acl_get_file,[ACL_LIBS="$ACL_LIBS -lacl"])
678 AC_CHECK_LIB(attr,getxattr,[ACL_LIBS="$ACL_LIBS -lattr"])
681 AC_CACHE_CHECK([for POSIX ACL support],netatalk_cv_HAVE_POSIX_ACLS,[
683 LIBS="$LIBS $ACL_LIBS"
685 #include <sys/types.h>
690 acl_entry_t *entry_p;
691 return acl_get_entry(acl, entry_id, entry_p);
693 [netatalk_cv_HAVE_POSIX_ACLS=yes],
694 [netatalk_cv_HAVE_POSIX_ACLS=no
695 with_acl_support=no])
698 if test x"$netatalk_cv_HAVE_POSIX_ACLS" = x"yes"; then
699 AC_MSG_NOTICE(Using POSIX ACLs)
700 AC_DEFINE(HAVE_POSIX_ACLS,1,[Whether POSIX ACLs are available])
701 AC_CACHE_CHECK([for acl_get_perm_np],netatalk_cv_HAVE_ACL_GET_PERM_NP,[
703 LIBS="$LIBS $ACL_LIBS"
705 #include <sys/types.h>
708 acl_permset_t permset_d;
710 return acl_get_perm_np(permset_d, perm);
712 [netatalk_cv_HAVE_ACL_GET_PERM_NP=yes],
713 [netatalk_cv_HAVE_ACL_GET_PERM_NP=no])
716 if test x"$netatalk_cv_HAVE_ACL_GET_PERM_NP" = x"yes"; then
717 AC_DEFINE(HAVE_ACL_GET_PERM_NP,1,[Whether acl_get_perm_np() is available])
721 AC_CACHE_CHECK([for acl_from_mode], netatalk_cv_HAVE_ACL_FROM_MODE,[
723 LIBS="$LIBS $ACL_LIBS"
724 AC_CHECK_FUNCS(acl_from_mode,
725 [netatalk_cv_HAVE_ACL_FROM_MODE=yes],
726 [netatalk_cv_HAVE_ACL_FROM_MODE=no])
729 if test x"netatalk_cv_HAVE_ACL_FROM_MODE" = x"yes"; then
730 AC_DEFINE(HAVE_ACL_FROM_MODE,1,[Whether acl_from_mode() is available])
734 AC_MSG_NOTICE(ACL support is not avaliable)
735 AC_DEFINE(HAVE_NO_ACLS,1,[Whether no ACLs support is available])
741 if test x"$with_acl_support" = x"yes" ; then
742 AC_CHECK_HEADERS([acl/libacl.h])
743 AC_DEFINE(HAVE_ACLS,1,[Whether ACLs support is available])
748 dnl Check for Extended Attributes support
749 AC_DEFUN([AC_NETATALK_EXTENDED_ATTRIBUTES], [
751 neta_cv_eas_sys_found=no
752 neta_cv_eas_sys_not_found=no
754 AC_CHECK_HEADERS(sys/attributes.h attr/xattr.h sys/xattr.h sys/extattr.h sys/uio.h sys/ea.h)
759 AC_SEARCH_LIBS(getproplist, [proplist])
760 AC_CHECK_FUNCS([getproplist fgetproplist setproplist fsetproplist],
761 [neta_cv_eas_sys_found=yes],
762 [neta_cv_eas_sys_not_found=yes])
763 AC_CHECK_FUNCS([delproplist fdelproplist add_proplist_entry get_proplist_entry],,
764 [neta_cv_eas_sys_not_found=yes])
765 AC_CHECK_FUNCS([sizeof_proplist_entry],,
766 [neta_cv_eas_sys_not_found=yes])
770 AC_CHECK_FUNCS([attropen],
771 [neta_cv_eas_sys_found=yes; AC_DEFINE(HAVE_EAFD, 1, [extattr API has full fledged fds for EAs])],
772 [neta_cv_eas_sys_not_found=yes])
776 AC_CHECK_FUNCS([extattr_delete_fd extattr_delete_file extattr_delete_link],
777 [neta_cv_eas_sys_found=yes],
778 [neta_cv_eas_sys_not_found=yes])
779 AC_CHECK_FUNCS([extattr_get_fd extattr_get_file extattr_get_link],,
780 [neta_cv_eas_sys_not_found=yes])
781 AC_CHECK_FUNCS([extattr_list_fd extattr_list_file extattr_list_link],,
782 [neta_cv_eas_sys_not_found=yes])
783 AC_CHECK_FUNCS([extattr_set_fd extattr_set_file extattr_set_link],,
784 [neta_cv_eas_sys_not_found=yes])
787 *freebsd4* | *dragonfly* )
788 AC_DEFINE(BROKEN_EXTATTR, 1, [Does extattr API work])
792 AC_SEARCH_LIBS(getxattr, [attr])
794 if test "x$neta_cv_eas_sys_found" != "xyes" ; then
795 AC_CHECK_FUNCS([getxattr lgetxattr fgetxattr listxattr llistxattr],
796 [neta_cv_eas_sys_found=yes],
797 [neta_cv_eas_sys_not_found=yes])
798 AC_CHECK_FUNCS([flistxattr removexattr lremovexattr fremovexattr],,
799 [neta_cv_eas_sys_not_found=yes])
800 AC_CHECK_FUNCS([setxattr lsetxattr fsetxattr],,
801 [neta_cv_eas_sys_not_found=yes])
804 if test "x$neta_cv_eas_sys_found" != "xyes" ; then
805 AC_CHECK_FUNCS([getea fgetea lgetea listea flistea llistea],
806 [neta_cv_eas_sys_found=yes],
807 [neta_cv_eas_sys_not_found=yes])
808 AC_CHECK_FUNCS([removeea fremoveea lremoveea setea fsetea lsetea],,
809 [neta_cv_eas_sys_not_found=yes])
812 if test "x$neta_cv_eas_sys_found" != "xyes" ; then
813 AC_CHECK_FUNCS([attr_get attr_list attr_set attr_remove],,
814 [neta_cv_eas_sys_not_found=yes])
815 AC_CHECK_FUNCS([attr_getf attr_listf attr_setf attr_removef],,
816 [neta_cv_eas_sys_not_found=yes])
821 # Do xattr functions take additional options like on Darwin?
822 if test x"$ac_cv_func_getxattr" = x"yes" ; then
823 AC_CACHE_CHECK([whether xattr interface takes additional options], smb_attr_cv_xattr_add_opt, [
825 LIBS="$LIBS $ACL_LIBS"
827 #include <sys/types.h>
828 #if HAVE_ATTR_XATTR_H
829 #include <attr/xattr.h>
830 #elif HAVE_SYS_XATTR_H
831 #include <sys/xattr.h>
834 getxattr(0, 0, 0, 0, 0, 0);
836 [smb_attr_cv_xattr_add_opt=yes],
837 [smb_attr_cv_xattr_add_opt=no;LIBS=$old_LIBS])
839 if test x"$smb_attr_cv_xattr_add_opt" = x"yes"; then
840 AC_DEFINE(XATTR_ADD_OPT, 1, [xattr functions have additional options])
844 if test "x$neta_cv_eas_sys_found" = "xyes" ; then
845 if test "x$neta_cv_eas_sys_not_found" != "xyes" ; then
846 neta_cv_eas="$neta_cv_eas | sys"
849 AC_DEFINE_UNQUOTED(EA_MODULES,["$neta_cv_eas"],[Available Extended Attributes modules])
852 dnl Check for libsmbsharemodes from Samba for Samba/Netatalk access/deny/share modes interop
853 dnl Defines "neta_cv_have_smbshmd" to "yes" or "no"
854 dnl AC_SUBST's "SMB_SHAREMODES_CFLAGS" and "SMB_SHAREMODES_LDFLAGS"
855 dnl AM_CONDITIONAL's "USE_SMB_SHAREMODES"
856 AC_DEFUN([AC_NETATALK_SMB_SHAREMODES], [
857 neta_cv_have_smbshmd=no
858 AC_ARG_WITH(smbsharemodes-lib,
859 [ --with-smbsharemodes-lib=PATH PATH to libsmbsharemodes lib from Samba],
860 [SMB_SHAREMODES_LDFLAGS="-L$withval -lsmbsharemodes"]
862 AC_ARG_WITH(smbsharemodes-include,
863 [ --with-smbsharemodes-include=PATH PATH to libsmbsharemodes header from Samba],
864 [SMB_SHAREMODES_CFLAGS="-I$withval"]
866 AC_ARG_WITH(smbsharemodes,
867 [AS_HELP_STRING([--with-smbsharemodes],[Samba interop (default is yes)])],
868 [use_smbsharemodes=$withval],
869 [use_smbsharemodes=yes]
872 if test x"$use_smbsharemodes" = x"yes" ; then
873 AC_MSG_CHECKING([whether to enable Samba/Netatalk access/deny/share-modes interop])
875 saved_CFLAGS="$CFLAGS"
876 saved_LDFLAGS="$LDFLAGS"
877 CFLAGS="$SMB_SHAREMODES_CFLAGS $CFLAGS"
878 LDFLAGS="$SMB_SHAREMODES_LDFLAGS $LDFLAGS"
883 #include <sys/time.h>
886 /* From messages.h */
890 #include "smb_share_modes.h"
891 int main(void) { (void)smb_share_mode_db_open(""); return 0;}],
892 [neta_cv_have_smbshmd=yes]
895 AC_MSG_RESULT($neta_cv_have_smbshmd)
896 AC_SUBST(SMB_SHAREMODES_CFLAGS, [$SMB_SHAREMODES_CFLAGS])
897 AC_SUBST(SMB_SHAREMODES_LDFLAGS, [$SMB_SHAREMODES_LDFLAGS])
898 CFLAGS="$saved_CFLAGS"
899 LDFLAGS="$saved_LDFLAGS"
902 AM_CONDITIONAL(USE_SMB_SHAREMODES, test x"$neta_cv_have_smbshmd" = x"yes")
905 dnl ------ Check for sendfile() --------
906 AC_DEFUN([AC_NETATALK_SENDFILE], [
907 netatalk_cv_search_sendfile=yes
908 AC_ARG_ENABLE(sendfile,
909 [ --disable-sendfile disable sendfile syscall],
910 [if test x"$enableval" = x"no"; then
911 netatalk_cv_search_sendfile=no
915 if test x"$netatalk_cv_search_sendfile" = x"yes"; then
918 AC_DEFINE(SENDFILE_FLAVOR_LINUX,1,[Whether linux sendfile() API is available])
919 AC_CHECK_FUNC([sendfile], [netatalk_cv_HAVE_SENDFILE=yes])
923 AC_DEFINE(SENDFILE_FLAVOR_SOLARIS, 1, [Solaris sendfile()])
924 AC_SEARCH_LIBS(sendfile, sendfile)
925 AC_CHECK_FUNC([sendfile], [netatalk_cv_HAVE_SENDFILE=yes])
929 AC_DEFINE(SENDFILE_FLAVOR_BSD, 1, [Define if the sendfile() function uses BSD semantics])
930 AC_CHECK_FUNC([sendfile], [netatalk_cv_HAVE_SENDFILE=yes])
938 if test x"$netatalk_cv_HAVE_SENDFILE" = x"yes"; then
939 AC_DEFINE(WITH_SENDFILE,1,[Whether sendfile() should be used])
944 dnl --------------------- Check if realpath() takes NULL
945 AC_DEFUN([AC_NETATALK_REALPATH], [
946 AC_CACHE_CHECK([if the realpath function allows a NULL argument],
947 neta_cv_REALPATH_TAKES_NULL, [
953 void exit_on_core(int ignored) {
959 signal(SIGSEGV, exit_on_core);
960 newpath = realpath("/tmp", NULL);
961 exit((newpath != NULL) ? 0 : 1);
963 neta_cv_REALPATH_TAKES_NULL=yes,
964 neta_cv_REALPATH_TAKES_NULL=no,
965 neta_cv_REALPATH_TAKES_NULL=cross
970 if test x"$neta_cv_REALPATH_TAKES_NULL" = x"yes"; then
971 AC_DEFINE(REALPATH_TAKES_NULL,1,[Whether the realpath function allows NULL])