1 dnl Kitchen sink for configuration macros
3 dnl Filesystem Hierarchy Standard (FHS) compatibility
4 AC_DEFUN([AC_NETATALK_FHS], [
5 AC_MSG_CHECKING([whether to use Filesystem Hierarchy Standard (FHS) compatibility])
7 [ --enable-fhs use Filesystem Hierarchy Standard (FHS) compatibility],[
8 if test "$enableval" = "yes"; then
9 uams_path="${libdir}/netatalk"
11 PKGCONFDIR=${sysconfdir}/netatalk
12 SERVERTEXT="${PKGCONFDIR}/msg"
14 mandir="/usr/share/man"
15 AC_DEFINE(FHS_COMPATIBILITY, 1, [Define if you want compatibily with the FHS])
25 dnl 64bit platform check
26 AC_DEFUN([AC_NETATALK_64BIT_LIBS], [
27 AC_MSG_CHECKING([whether to check for 64bit libraries])
28 # Test if the compiler is in 64bit mode
29 echo 'int i;' > conftest.$ac_ext
30 atalk_cv_cc_64bit_output=no
31 if AC_TRY_EVAL(ac_compile); then
32 case `/usr/bin/file conftest.$ac_objext` in
34 atalk_cv_cc_64bit_output=yes
40 case $host_cpu:$atalk_cv_cc_64bit_output in
41 powerpc64:yes | s390x:yes | sparc*:yes | x86_64:yes | i386:yes)
45 atalk_libname="lib/64"
64 dnl Check for optional admin group support
65 AC_DEFUN([AC_NETATALK_ADMIN_GROUP], [
66 netatalk_cv_admin_group=yes
67 AC_MSG_CHECKING([for administrative group support])
68 AC_ARG_ENABLE(admin-group,
69 [ --disable-admin-group disable admin group],[
70 if test x"$enableval" = x"no"; then
71 AC_DEFINE(ADMIN_GRP, 0, [Define if the admin group should be enabled])
72 netatalk_cv_admin_group=no
75 AC_DEFINE(ADMIN_GRP, 1, [Define if the admin group should be enabled])
78 AC_DEFINE(ADMIN_GRP, 1, [Define if the admin group should be enabled])
83 dnl Check for optional cracklib support
84 AC_DEFUN([AC_NETATALK_CRACKLIB], [
85 netatalk_cv_with_cracklib=no
87 [ --with-cracklib=DICT enable/set location of cracklib dictionary],[
88 if test "x$withval" != "xno" ; then
90 AC_CHECK_LIB(crack, main, [
91 AC_DEFINE(USE_CRACKLIB, 1, [Define if cracklib should be used])
93 if test "$cracklib" = "yes"; then
94 cracklib="/usr/$atalk_libname/cracklib_dict"
96 AC_DEFINE_UNQUOTED(_PATH_CRACKLIB, "$cracklib",
97 [path to cracklib dictionary])
98 AC_MSG_RESULT([setting cracklib dictionary to $cracklib])
99 netatalk_cv_with_cracklib=yes
101 AC_MSG_ERROR([cracklib not found!])
107 AC_MSG_CHECKING([for cracklib support])
108 AC_MSG_RESULT([$netatalk_cv_with_cracklib])
111 dnl Check whether to enable debug code
112 AC_DEFUN([AC_NETATALK_DEBUG], [
113 AC_MSG_CHECKING([whether to enable verbose debug code])
115 [ --enable-debug enable verbose debug code],[
116 if test "$enableval" != "no"; then
117 if test "$enableval" = "yes"; then
118 AC_DEFINE(DEBUG, 1, [Define if verbose debugging information should be included])
120 AC_DEFINE_UNQUOTED(DEBUG, $enableval, [Define if verbose debugging information should be included])
125 AC_DEFINE(NDEBUG, 1, [Disable assertions])
129 AC_DEFINE(NDEBUG, 1, [Disable assertions])
134 dnl Check whethe to disable tickle SIGALARM stuff, which eases debugging
135 AC_DEFUN([AC_NETATALK_DEBUGGING], [
136 AC_MSG_CHECKING([whether to enable debugging with debuggers])
137 AC_ARG_ENABLE(debugging,
138 [ --enable-debugging disable SIGALRM timers and DSI tickles (eg for debugging with gdb/dbx/...)],[
139 if test "$enableval" != "no"; then
140 if test "$enableval" = "yes"; then
141 AC_DEFINE(DEBUGGING, 1, [Define if you want to disable SIGALRM timers and DSI tickles])
143 AC_DEFINE_UNQUOTED(DEBUGGING, $enableval, [Define if you want to disable SIGALRM timers and DSI tickles])
156 dnl Check for optional shadow password support
157 AC_DEFUN([AC_NETATALK_SHADOW], [
158 netatalk_cv_use_shadowpw=no
160 [ --with-shadow enable shadow password support [[auto]]],
161 [netatalk_cv_use_shadowpw="$withval"],
162 [netatalk_cv_use_shadowpw=auto]
165 if test "x$netatalk_cv_use_shadowpw" != "xno"; then
166 AC_CHECK_HEADER([shadow.h])
167 if test x"$ac_cv_header_shadow_h" = x"yes"; then
168 netatalk_cv_use_shadowpw=yes
169 AC_DEFINE(SHADOWPW, 1, [Define if shadow passwords should be used])
171 if test "x$shadowpw" = "xyes"; then
172 AC_MSG_ERROR([shadow support not available])
174 netatalk_cv_use_shadowpw=no
179 AC_MSG_CHECKING([whether shadow support should be enabled])
180 if test "x$netatalk_cv_use_shadowpw" = "xyes"; then
187 dnl Check for optional valid-shell-check support
188 AC_DEFUN([AC_NETATALK_SHELL_CHECK], [
189 netatalk_cv_use_shellcheck=yes
190 AC_MSG_CHECKING([whether checking for a valid shell should be enabled])
191 AC_ARG_ENABLE(shell-check,
192 [ --disable-shell-check disable checking for a valid shell],[
193 if test "$enableval" = "no"; then
194 AC_DEFINE(DISABLE_SHELLCHECK, 1, [Define if shell check should be disabled])
196 netatalk_cv_use_shellcheck=no
206 dnl Check for optional sysv initscript install
207 AC_DEFUN([AC_NETATALK_INIT_STYLE], [
208 AC_ARG_WITH(init-style,
209 [ --with-init-style use OS specific init config [[redhat-sysv|redhat-systemd|suse-sysv|suse-systemd|gentoo|netbsd|debian|systemd]]],
210 init_style="$withval", init_style=none
212 case "$init_style" in
214 AC_MSG_ERROR([--with-init-style=redhat is obsoleted. Use redhat-sysv or redhat-systemd.])
217 AC_MSG_RESULT([enabling redhat-style sysv (upstart) configuration])
220 AC_MSG_RESULT([enabling redhat-style systemd support])
223 AC_MSG_ERROR([--with-init-style=suse is obsoleted. Use suse-sysv or suse-systemd.])
226 AC_MSG_RESULT([enabling suse-style sysv configuration])
229 AC_MSG_RESULT([enabling suse-style systemd support (>=openSUSE12.1)])
232 AC_MSG_RESULT([enabling gentoo-style sysv support])
235 AC_MSG_RESULT([enabling netbsd-style sysv support])
238 AC_MSG_RESULT([enabling debian-style sysv support])
241 AC_MSG_RESULT([use general systemd configuration])
244 AC_MSG_RESULT([disabling sysv support])
247 AM_CONDITIONAL(USE_NETBSD, test x$init_style = xnetbsd)
248 AM_CONDITIONAL(USE_REDHAT_SYSV, test x$init_style = xredhat-sysv)
249 AM_CONDITIONAL(USE_SUSE_SYSV, test x$init_style = xsuse-sysv)
250 AM_CONDITIONAL(USE_SHADOWPW, test x$shadowpw = xyes)
251 AM_CONDITIONAL(USE_TRU64, test x$init_style = xtru64)
252 AM_CONDITIONAL(USE_SOLARIS, test x$init_style = xsolaris)
253 AM_CONDITIONAL(USE_GENTOO, test x$init_style = xgentoo)
254 AM_CONDITIONAL(USE_DEBIAN, test x$init_style = xdebian)
255 AM_CONDITIONAL(USE_SYSTEMD, test x$init_style = xsystemd || test x$init_style = xredhat-systemd || test x$init_style = xsuse-systemd)
256 AM_CONDITIONAL(USE_UNDEF, test x$init_style = xnone)
260 dnl OS specific configuration
261 AC_DEFUN([AC_NETATALK_OS_SPECIFIC], [
263 *aix*) this_os=aix ;;
264 *freebsd*) this_os=freebsd ;;
265 *hpux11*) this_os=hpux11 ;;
266 *irix*) this_os=irix ;;
267 *linux*) this_os=linux ;;
268 *osx*) this_os=macosx ;;
269 *darwin*) this_os=macosx ;;
270 *netbsd*) this_os=netbsd ;;
271 *openbsd*) this_os=openbsd ;;
272 *osf*) this_os=tru64 ;;
273 *solaris*) this_os=solaris ;;
277 i386|i486|i586|i686|k7) this_cpu=x86 ;;
278 alpha) this_cpu=alpha ;;
279 mips) this_cpu=mips ;;
280 powerpc|ppc) this_cpu=ppc ;;
283 dnl --------------------- GNU source
285 linux) AC_DEFINE(_GNU_SOURCE, 1, [Whether to use GNU libc extensions])
287 kfreebsd-gnu) AC_DEFINE(_GNU_SOURCE, 1, [Whether to use GNU libc extensions])
291 dnl --------------------- operating system specific flags (port from sys/*)
293 dnl ----- FreeBSD specific -----
294 if test x"$this_os" = "xfreebsd"; then
295 AC_MSG_RESULT([ * FreeBSD specific configuration])
296 AC_DEFINE(BSD4_4, 1, [BSD compatiblity macro])
297 AC_DEFINE(FREEBSD, 1, [Define if OS is FreeBSD])
298 AC_DEFINE(OPEN_NOFOLLOW_ERRNO, EMLINK, errno returned by open with O_NOFOLLOW)
301 dnl ----- GNU/kFreeBSD specific -----
302 if test x"$this_os" = "xkfreebsd-gnu"; then
303 AC_MSG_RESULT([ * GNU/kFreeBSD specific configuration])
304 AC_DEFINE(BSD4_4, 1, [BSD compatiblity macro])
305 AC_DEFINE(FREEBSD, 1, [Define if OS is FreeBSD])
306 AC_DEFINE(OPEN_NOFOLLOW_ERRNO, EMLINK, errno returned by open with O_NOFOLLOW)
309 dnl ----- Linux specific -----
310 if test x"$this_os" = "xlinux"; then
311 AC_MSG_RESULT([ * Linux specific configuration])
313 dnl ----- check if we need the quotactl wrapper
314 AC_CHECK_HEADERS(linux/dqblk_xfs.h,,
315 [AC_CHECK_HEADERS(linux/xqm.h linux/xfs_fs.h)
316 AC_CHECK_HEADERS(xfs/libxfs.h xfs/xqm.h xfs/xfs_fs.h)]
320 dnl ----- as far as I can tell, dbtob always does the wrong thing
321 dnl ----- on every single version of linux I've ever played with.
322 dnl ----- see etc/afpd/quota.c
323 AC_DEFINE(HAVE_BROKEN_DBTOB, 1, [Define if dbtob is broken])
328 dnl ----- NetBSD specific -----
329 if test x"$this_os" = "xnetbsd"; then
330 AC_MSG_RESULT([ * NetBSD specific configuration])
331 AC_DEFINE(BSD4_4, 1, [BSD compatiblity macro])
332 AC_DEFINE(NETBSD, 1, [Define if OS is NetBSD])
333 AC_DEFINE(OPEN_NOFOLLOW_ERRNO, EFTYPE, errno returned by open with O_NOFOLLOW)
335 CFLAGS="-I\$(top_srcdir)/sys/netbsd $CFLAGS"
338 dnl ----- NetBSD does not have crypt.h, uses unistd.h -----
339 AC_DEFINE(UAM_DHX, 1, [Define if the DHX UAM modules should be compiled])
342 dnl ----- OpenBSD specific -----
343 if test x"$this_os" = "xopenbsd"; then
344 AC_MSG_RESULT([ * OpenBSD specific configuration])
345 AC_DEFINE(BSD4_4, 1, [BSD compatiblity macro])
346 dnl ----- OpenBSD does not have crypt.h, uses unistd.h -----
347 AC_DEFINE(UAM_DHX, 1, [Define if the DHX UAM modules should be compiled])
350 dnl ----- Solaris specific -----
351 if test x"$this_os" = "xsolaris"; then
352 AC_MSG_RESULT([ * Solaris specific configuration])
353 AC_DEFINE(__svr4__, 1, [Solaris compatibility macro])
354 AC_DEFINE(_ISOC9X_SOURCE, 1, [Compatibility macro])
355 AC_DEFINE(NO_STRUCT_TM_GMTOFF, 1, [Define if the gmtoff member of struct tm is not available])
356 AC_DEFINE(SOLARIS, 1, [Solaris compatibility macro])
357 AC_DEFINE(_XOPEN_SOURCE, 600, [Solaris compilation environment])
358 AC_DEFINE(__EXTENSIONS__, 1, [Solaris compilation environment])
359 CFLAGS="-I\$(top_srcdir)/sys/generic $CFLAGS"
364 AC_MSG_CHECKING([if we can build Solaris kernel module])
365 if test -x /usr/ccs/bin/ld && test x"$netatalk_cv_ddp_enabled" = x"yes" ; then
368 AC_MSG_RESULT([$solaris_module])
370 COMPILE_64BIT_KMODULE=no
373 COMPILE_KERNEL_GCC=no
375 if test "$solaris_module" = "yes"; then
376 dnl Solaris kernel module stuff
377 AC_MSG_CHECKING([if we have to build a 64bit kernel module])
379 # check for isainfo, if not found it has to be a 32 bit kernel (<=2.6)
380 if test -x /usr/bin/isainfo; then
381 # check for 64 bit platform
382 if isainfo -kv | grep '^64-bit'; then
383 COMPILE_64BIT_KMODULE=yes
387 AC_MSG_RESULT([$COMPILE_64BIT_KMODULE])
389 if test "${GCC}" = yes; then
390 COMPILE_KERNEL_GCC=yes
391 if test "$COMPILE_64BIT_KMODULE" = yes; then
393 AC_MSG_CHECKING([if we can build a 64bit kernel module])
395 case `$CC --version 2>/dev/null` in
397 COMPILE_64BIT_KMODULE=no
398 COMPILE_KERNEL_GCC=no
403 #KLDFLAGS="-melf64_sparc"
407 AC_MSG_RESULT([$COMPILE_64BIT_KMODULE])
413 KCFLAGS="$KCFLAGS -D_KERNEL -Wall -Wstrict-prototypes"
415 if test "$COMPILE_64BIT_KMODULE" = yes; then
416 # use Sun CC (for a 64-bit kernel, uncomment " -xarch=v9 -xregs=no%appl ")
417 KCFLAGS="-xarch=v9 -xregs=no%appl"
423 KCFLAGS="-D_KERNEL $KCFLAGS -mno-app-regs -munaligned-doubles -fpcc-struct-return"
426 AC_CACHE_CHECK([for timeout_id_t],netatalk_cv_HAVE_TIMEOUT_ID_T,[
428 #include <sys/stream.h>
429 #include <sys/ddi.h>],
433 netatalk_cv_HAVE_TIMEOUT_ID_T=yes,netatalk_cv_HAVE_TIMEOUT_ID_T=no,netatalk_cv_HAVE_TIMEOUT_ID_T=cross)])
435 AC_DEFINE(HAVE_TIMEOUT_ID_T, test x"$netatalk_cv_HAVE_TIMEOUT_ID" = x"yes", [define for timeout_id_t])
438 AC_SUBST(COMPILE_KERNEL_GCC)
439 AC_SUBST(COMPILE_64BIT_KMODULE)
444 dnl Whether to run ldconfig after installing libraries
445 AC_PATH_PROG(NETA_LDCONFIG, ldconfig, , [$PATH$PATH_SEPARATOR/sbin$PATH_SEPARATOR/bin$PATH_SEPARATOR/usr/sbin$PATH_SEPARATOR/usr/bin])
446 echo NETA_LDCONFIG = $NETA_LDCONFIG
447 AM_CONDITIONAL(RUN_LDCONFIG, test x"$this_os" = x"linux" -a x"$NETA_LDCONFIG" != x"")
450 dnl Check for building PGP UAM module
451 AC_DEFUN([AC_NETATALK_PGP_UAM], [
452 AC_MSG_CHECKING([whether the PGP UAM should be build])
453 AC_ARG_ENABLE(pgp-uam,
454 [ --enable-pgp-uam enable build of PGP UAM module],[
455 if test "$enableval" = "yes"; then
456 if test "x$neta_cv_have_openssl" = "xyes"; then
457 AC_DEFINE(UAM_PGP, 1, [Define if the PGP UAM module should be compiled])
470 dnl Check for building Kerberos V UAM module
471 AC_DEFUN([AC_NETATALK_KRB5_UAM], [
472 netatalk_cv_build_krb5_uam=no
473 AC_ARG_ENABLE(krbV-uam,
474 [ --enable-krbV-uam enable build of Kerberos V UAM module],
476 if test x"$enableval" = x"yes"; then
477 NETATALK_GSSAPI_CHECK([
478 netatalk_cv_build_krb5_uam=yes
480 AC_MSG_ERROR([need GSSAPI to build Kerberos V UAM])
487 AC_MSG_CHECKING([whether Kerberos V UAM should be build])
488 if test x"$netatalk_cv_build_krb5_uam" = x"yes"; then
493 AM_CONDITIONAL(USE_GSSAPI, test x"$netatalk_cv_build_krb5_uam" = x"yes")
496 AC_DEFUN([AC_NETATALK_KERBEROS], [
497 AC_MSG_CHECKING([for Kerberos 5 (necessary for GetSrvrInfo:DirectoryNames support)])
498 AC_ARG_WITH([kerberos],
499 [AS_HELP_STRING([--with-kerberos], [Kerberos 5 support (default=auto)])],
501 [with_kerberos=auto])
502 AC_MSG_RESULT($with_kerberos)
504 if test x"$with_kerberos" != x"no"; then
505 have_krb5_header="no"
506 AC_CHECK_HEADERS([krb5/krb5.h krb5.h], [have_krb5_header="yes"; break])
507 if test x"$have_krb5_header" = x"no" && test x"$with_kerberos" != x"auto"; then
508 AC_MSG_FAILURE([--with-kerberos was given, but no headers found])
511 AC_PATH_PROG([KRB5_CONFIG], [krb5-config])
512 AC_MSG_CHECKING([for krb5-config])
513 if test -x "$KRB5_CONFIG"; then
514 AC_MSG_RESULT([$KRB5_CONFIG])
515 CFLAGS="$CFLAGS `$KRB5_CONFIG --cflags krb5`"
516 LIBS="`$KRB5_CONFIG --libs krb5` $LIBS"
519 AC_MSG_RESULT([not found])
520 if test x"$with_kerberos" != x"auto"; then
521 AC_MSG_FAILURE([--with-kerberos was given, but krb5-config could not be found])
526 if test x"$with_kerberos" = x"yes"; then
527 AC_DEFINE([HAVE_KERBEROS], [1], [Define if Kerberos 5 is available])
531 dnl Check for overwrite the config files or not
532 AC_DEFUN([AC_NETATALK_OVERWRITE_CONFIG], [
533 AC_MSG_CHECKING([whether configuration files should be overwritten])
534 AC_ARG_ENABLE(overwrite,
535 [ --enable-overwrite overwrite configuration files during installation],
536 [OVERWRITE_CONFIG="${enable_overwrite}"],
537 [OVERWRITE_CONFIG="no"]
539 AC_MSG_RESULT([$OVERWRITE_CONFIG])
540 AC_SUBST(OVERWRITE_CONFIG)
543 dnl Check for LDAP support, for client-side ACL visibility
544 AC_DEFUN([AC_NETATALK_LDAP], [
545 AC_MSG_CHECKING(for LDAP (necessary for client-side ACL visibility))
547 [AS_HELP_STRING([--with-ldap],
548 [LDAP support (default=auto)])],
557 AC_MSG_RESULT($with_ldap)
559 if test x"$with_ldap" != x"no" ; then
560 AC_CHECK_HEADER([ldap.h], with_ldap=yes,
561 [ if test x"$with_ldap" = x"yes" ; then
562 AC_MSG_ERROR([Missing LDAP headers])
566 AC_CHECK_LIB(ldap, ldap_init, with_ldap=yes,
567 [ if test x"$with_ldap" = x"yes" ; then
568 AC_MSG_ERROR([Missing LDAP library])
574 if test x"$with_ldap" = x"yes"; then
575 AC_DEFINE(HAVE_LDAP,1,[Whether LDAP is available])
579 dnl Check for ACL support
580 AC_DEFUN([AC_NETATALK_ACL], [
581 AC_MSG_CHECKING(whether to support ACLs)
583 [AS_HELP_STRING([--with-acls],
584 [Include ACL support (default=auto)])],
587 with_acl_support="$withval"
590 with_acl_support=auto
593 [with_acl_support=auto])
594 AC_MSG_RESULT($with_acl_support)
596 if test x"$with_acl_support" = x"no"; then
597 AC_MSG_RESULT(Disabling ACL support)
598 AC_DEFINE(HAVE_NO_ACLS,1,[Whether no ACLs support should be built in])
603 if test x"$with_acl_support" = x"yes" ; then
604 AC_MSG_NOTICE(checking whether ACL support is available:)
607 AC_MSG_NOTICE(Using UnixWare ACLs)
608 AC_DEFINE(HAVE_UNIXWARE_ACLS,1,[Whether UnixWare ACLs are available])
611 AC_MSG_NOTICE(Using solaris ACLs)
612 AC_DEFINE(HAVE_SOLARIS_ACLS,1,[Whether solaris ACLs are available])
613 ACL_LIBS="$ACL_LIBS -lsec"
616 AC_MSG_NOTICE(Using HPUX ACLs)
617 AC_DEFINE(HAVE_HPUX_ACLS,1,[Whether HPUX ACLs are available])
620 AC_MSG_NOTICE(Using IRIX ACLs)
621 AC_DEFINE(HAVE_IRIX_ACLS,1,[Whether IRIX ACLs are available])
624 AC_MSG_NOTICE(Using AIX ACLs)
625 AC_DEFINE(HAVE_AIX_ACLS,1,[Whether AIX ACLs are available])
628 AC_MSG_NOTICE(Using Tru64 ACLs)
629 AC_DEFINE(HAVE_TRU64_ACLS,1,[Whether Tru64 ACLs are available])
630 ACL_LIBS="$ACL_LIBS -lpacl"
633 AC_MSG_NOTICE(ACLs on Darwin currently not supported)
634 AC_DEFINE(HAVE_NO_ACLS,1,[Whether no ACLs support is available])
637 AC_CHECK_LIB(acl,acl_get_file,[ACL_LIBS="$ACL_LIBS -lacl"])
640 AC_CHECK_LIB(attr,getxattr,[ACL_LIBS="$ACL_LIBS -lattr"])
643 AC_CACHE_CHECK([for POSIX ACL support],netatalk_cv_HAVE_POSIX_ACLS,[
645 LIBS="$LIBS $ACL_LIBS"
647 #include <sys/types.h>
652 acl_entry_t *entry_p;
653 return acl_get_entry(acl, entry_id, entry_p);
655 [netatalk_cv_HAVE_POSIX_ACLS=yes],
656 [netatalk_cv_HAVE_POSIX_ACLS=no
657 with_acl_support=no])
660 if test x"$netatalk_cv_HAVE_POSIX_ACLS" = x"yes"; then
661 AC_MSG_NOTICE(Using POSIX ACLs)
662 AC_DEFINE(HAVE_POSIX_ACLS,1,[Whether POSIX ACLs are available])
663 AC_CACHE_CHECK([for acl_get_perm_np],netatalk_cv_HAVE_ACL_GET_PERM_NP,[
665 LIBS="$LIBS $ACL_LIBS"
667 #include <sys/types.h>
670 acl_permset_t permset_d;
672 return acl_get_perm_np(permset_d, perm);
674 [netatalk_cv_HAVE_ACL_GET_PERM_NP=yes],
675 [netatalk_cv_HAVE_ACL_GET_PERM_NP=no])
678 if test x"$netatalk_cv_HAVE_ACL_GET_PERM_NP" = x"yes"; then
679 AC_DEFINE(HAVE_ACL_GET_PERM_NP,1,[Whether acl_get_perm_np() is available])
683 AC_CACHE_CHECK([for acl_from_mode], netatalk_cv_HAVE_ACL_FROM_MODE,[
685 LIBS="$LIBS $ACL_LIBS"
686 AC_CHECK_FUNCS(acl_from_mode,
687 [netatalk_cv_HAVE_ACL_FROM_MODE=yes],
688 [netatalk_cv_HAVE_ACL_FROM_MODE=no])
691 if test x"netatalk_cv_HAVE_ACL_FROM_MODE" = x"yes"; then
692 AC_DEFINE(HAVE_ACL_FROM_MODE,1,[Whether acl_from_mode() is available])
696 AC_MSG_NOTICE(ACL support is not avaliable)
697 AC_DEFINE(HAVE_NO_ACLS,1,[Whether no ACLs support is available])
703 if test x"$with_acl_support" = x"yes" ; then
704 AC_CHECK_HEADERS([acl/libacl.h])
705 AC_DEFINE(HAVE_ACLS,1,[Whether ACLs support is available])
710 dnl Check for Extended Attributes support
711 AC_DEFUN([AC_NETATALK_EXTENDED_ATTRIBUTES], [
713 neta_cv_eas_sys_found=no
714 neta_cv_eas_sys_not_found=no
716 AC_CHECK_HEADERS(sys/attributes.h attr/xattr.h sys/xattr.h sys/extattr.h sys/uio.h sys/ea.h)
721 AC_SEARCH_LIBS(getproplist, [proplist])
722 AC_CHECK_FUNCS([getproplist fgetproplist setproplist fsetproplist],
723 [neta_cv_eas_sys_found=yes],
724 [neta_cv_eas_sys_not_found=yes])
725 AC_CHECK_FUNCS([delproplist fdelproplist add_proplist_entry get_proplist_entry],,
726 [neta_cv_eas_sys_not_found=yes])
727 AC_CHECK_FUNCS([sizeof_proplist_entry],,
728 [neta_cv_eas_sys_not_found=yes])
732 AC_CHECK_FUNCS([attropen],
733 [neta_cv_eas_sys_found=yes; AC_DEFINE(HAVE_EAFD, 1, [extattr API has full fledged fds for EAs])],
734 [neta_cv_eas_sys_not_found=yes])
738 AC_CHECK_FUNCS([extattr_delete_fd extattr_delete_file extattr_delete_link],
739 [neta_cv_eas_sys_found=yes],
740 [neta_cv_eas_sys_not_found=yes])
741 AC_CHECK_FUNCS([extattr_get_fd extattr_get_file extattr_get_link],,
742 [neta_cv_eas_sys_not_found=yes])
743 AC_CHECK_FUNCS([extattr_list_fd extattr_list_file extattr_list_link],,
744 [neta_cv_eas_sys_not_found=yes])
745 AC_CHECK_FUNCS([extattr_set_fd extattr_set_file extattr_set_link],,
746 [neta_cv_eas_sys_not_found=yes])
749 *freebsd4* | *dragonfly* )
750 AC_DEFINE(BROKEN_EXTATTR, 1, [Does extattr API work])
754 AC_SEARCH_LIBS(getxattr, [attr])
756 if test "x$neta_cv_eas_sys_found" != "xyes" ; then
757 AC_CHECK_FUNCS([getxattr lgetxattr fgetxattr listxattr llistxattr],
758 [neta_cv_eas_sys_found=yes],
759 [neta_cv_eas_sys_not_found=yes])
760 AC_CHECK_FUNCS([flistxattr removexattr lremovexattr fremovexattr],,
761 [neta_cv_eas_sys_not_found=yes])
762 AC_CHECK_FUNCS([setxattr lsetxattr fsetxattr],,
763 [neta_cv_eas_sys_not_found=yes])
766 if test "x$neta_cv_eas_sys_found" != "xyes" ; then
767 AC_CHECK_FUNCS([getea fgetea lgetea listea flistea llistea],
768 [neta_cv_eas_sys_found=yes],
769 [neta_cv_eas_sys_not_found=yes])
770 AC_CHECK_FUNCS([removeea fremoveea lremoveea setea fsetea lsetea],,
771 [neta_cv_eas_sys_not_found=yes])
774 if test "x$neta_cv_eas_sys_found" != "xyes" ; then
775 AC_CHECK_FUNCS([attr_get attr_list attr_set attr_remove],,
776 [neta_cv_eas_sys_not_found=yes])
777 AC_CHECK_FUNCS([attr_getf attr_listf attr_setf attr_removef],,
778 [neta_cv_eas_sys_not_found=yes])
783 # Do xattr functions take additional options like on Darwin?
784 if test x"$ac_cv_func_getxattr" = x"yes" ; then
785 AC_CACHE_CHECK([whether xattr interface takes additional options], smb_attr_cv_xattr_add_opt, [
787 LIBS="$LIBS $ACL_LIBS"
789 #include <sys/types.h>
790 #if HAVE_ATTR_XATTR_H
791 #include <attr/xattr.h>
792 #elif HAVE_SYS_XATTR_H
793 #include <sys/xattr.h>
796 getxattr(0, 0, 0, 0, 0, 0);
798 [smb_attr_cv_xattr_add_opt=yes],
799 [smb_attr_cv_xattr_add_opt=no;LIBS=$old_LIBS])
801 if test x"$smb_attr_cv_xattr_add_opt" = x"yes"; then
802 AC_DEFINE(XATTR_ADD_OPT, 1, [xattr functions have additional options])
806 if test "x$neta_cv_eas_sys_found" = "xyes" ; then
807 if test "x$neta_cv_eas_sys_not_found" != "xyes" ; then
808 neta_cv_eas="$neta_cv_eas | sys"
811 AC_DEFINE_UNQUOTED(EA_MODULES,["$neta_cv_eas"],[Available Extended Attributes modules])
814 dnl Check for libsmbsharemodes from Samba for Samba/Netatalk access/deny/share modes interop
815 dnl Defines "neta_cv_have_smbshmd" to "yes" or "no"
816 dnl AC_SUBST's "SMB_SHAREMODES_CFLAGS" and "SMB_SHAREMODES_LDFLAGS"
817 dnl AM_CONDITIONAL's "USE_SMB_SHAREMODES"
818 AC_DEFUN([AC_NETATALK_SMB_SHAREMODES], [
819 neta_cv_have_smbshmd=no
820 AC_ARG_WITH(smbsharemodes-lib,
821 [ --with-smbsharemodes-lib=PATH PATH to libsmbsharemodes lib from Samba],
822 [SMB_SHAREMODES_LDFLAGS="-L$withval -lsmbsharemodes"]
824 AC_ARG_WITH(smbsharemodes-include,
825 [ --with-smbsharemodes-include=PATH PATH to libsmbsharemodes header from Samba],
826 [SMB_SHAREMODES_CFLAGS="-I$withval"]
828 AC_ARG_WITH(smbsharemodes,
829 [AS_HELP_STRING([--with-smbsharemodes],[Samba interop (default is yes)])],
830 [use_smbsharemodes=$withval],
831 [use_smbsharemodes=yes]
834 if test x"$use_smbsharemodes" = x"yes" ; then
835 AC_MSG_CHECKING([whether to enable Samba/Netatalk access/deny/share-modes interop])
837 saved_CFLAGS="$CFLAGS"
838 saved_LDFLAGS="$LDFLAGS"
839 CFLAGS="$SMB_SHAREMODES_CFLAGS $CFLAGS"
840 LDFLAGS="$SMB_SHAREMODES_LDFLAGS $LDFLAGS"
845 #include <sys/time.h>
848 /* From messages.h */
852 #include "smb_share_modes.h"
853 int main(void) { (void)smb_share_mode_db_open(""); return 0;}],
854 [neta_cv_have_smbshmd=yes]
857 AC_MSG_RESULT($neta_cv_have_smbshmd)
858 AC_SUBST(SMB_SHAREMODES_CFLAGS, [$SMB_SHAREMODES_CFLAGS])
859 AC_SUBST(SMB_SHAREMODES_LDFLAGS, [$SMB_SHAREMODES_LDFLAGS])
860 CFLAGS="$saved_CFLAGS"
861 LDFLAGS="$saved_LDFLAGS"
864 AM_CONDITIONAL(USE_SMB_SHAREMODES, test x"$neta_cv_have_smbshmd" = x"yes")
867 dnl ------ Check for sendfile() --------
868 AC_DEFUN([AC_NETATALK_SENDFILE], [
869 netatalk_cv_search_sendfile=yes
870 AC_ARG_ENABLE(sendfile,
871 [ --disable-sendfile disable sendfile syscall],
872 [if test x"$enableval" = x"no"; then
873 netatalk_cv_search_sendfile=no
877 if test x"$netatalk_cv_search_sendfile" = x"yes"; then
880 AC_DEFINE(SENDFILE_FLAVOR_LINUX,1,[Whether linux sendfile() API is available])
881 AC_CHECK_FUNC([sendfile], [netatalk_cv_HAVE_SENDFILE=yes])
885 AC_DEFINE(SENDFILE_FLAVOR_SOLARIS, 1, [Solaris sendfile()])
886 AC_SEARCH_LIBS(sendfile, sendfile)
887 AC_CHECK_FUNC([sendfile], [netatalk_cv_HAVE_SENDFILE=yes])
891 AC_DEFINE(SENDFILE_FLAVOR_BSD, 1, [Define if the sendfile() function uses BSD semantics])
892 AC_CHECK_FUNC([sendfile], [netatalk_cv_HAVE_SENDFILE=yes])
900 if test x"$netatalk_cv_HAVE_SENDFILE" = x"yes"; then
901 AC_DEFINE(WITH_SENDFILE,1,[Whether sendfile() should be used])
906 dnl --------------------- Check if realpath() takes NULL
907 AC_DEFUN([AC_NETATALK_REALPATH], [
908 AC_CACHE_CHECK([if the realpath function allows a NULL argument],
909 neta_cv_REALPATH_TAKES_NULL, [
915 void exit_on_core(int ignored) {
921 signal(SIGSEGV, exit_on_core);
922 newpath = realpath("/tmp", NULL);
923 exit((newpath != NULL) ? 0 : 1);
925 neta_cv_REALPATH_TAKES_NULL=yes,
926 neta_cv_REALPATH_TAKES_NULL=no,
927 neta_cv_REALPATH_TAKES_NULL=cross
932 if test x"$neta_cv_REALPATH_TAKES_NULL" = x"yes"; then
933 AC_DEFINE(REALPATH_TAKES_NULL,1,[Whether the realpath function allows NULL])