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 use bundled libevent])
21 [AS_HELP_STRING([--with-libevent],[whether to use the bundled libevent (default: yes)])],
22 use_bundled_libevent=$withval,
23 use_bundled_libevent=yes
27 [AS_HELP_STRING([--with-libevent-header],[path to libevent header files])],
28 [use_bundled_libevent=no; LIBEVENT_CFLAGS=-I$withval]
32 [AS_HELP_STRING([--with-libevent-lib],[path to libevent library])],
33 [use_bundled_libevent=no; LIBEVENT_LDFLAGS=-L$withval]
35 if test x"$LIBEVENT_CFLAGS" = x"-Iyes" -o x"$LIBEVENT_LDFLAGS" = x"-Lyes" ; then
36 AC_MSG_ERROR([--with-libevent requires a path])
38 AC_MSG_RESULT([$use_bundled_libevent])
39 AC_CONFIG_SUBDIRS([libevent])
40 AC_SUBST(LIBEVENT_CFLAGS)
41 AC_SUBST(LIBEVENT_LDFLAGS)
42 AM_CONDITIONAL(USE_BUILTIN_LIBEVENT, test x"$use_bundled_libevent" = x"yes")
45 dnl Filesystem Hierarchy Standard (FHS) compatibility
46 AC_DEFUN([AC_NETATALK_FHS], [
47 AC_MSG_CHECKING([whether to use Filesystem Hierarchy Standard (FHS) compatibility])
49 [ --enable-fhs use Filesystem Hierarchy Standard (FHS) compatibility],[
50 if test "$enableval" = "yes"; then
56 mandir="/usr/share/man"
57 uams_path="${libdir}/netatalk"
58 PKGCONFDIR="${sysconfdir}"
59 SERVERTEXT="${localstatedir}/netatalk/msg"
61 AC_DEFINE(FHS_COMPATIBILITY, 1, [Define if you want compatibily with the FHS])
63 atalk_cv_fhs_compat=yes
66 atalk_cv_fhs_compat=no
70 atalk_cv_fhs_compat=no
73 dnl netatalk lockfile path
74 AC_DEFUN([AC_NETATALK_LOCKFILE], [
75 AC_MSG_CHECKING([netatalk lockfile path])
78 [AS_HELP_STRING([--with-lockfile=PATH],[Path of netatalk lockfile])],
79 ac_cv_netatalk_lock=$withval,
80 ac_cv_netatalk_lock=""
82 if test -z "$ac_cv_netatalk_lock" ; then
83 ac_cv_netatalk_lock=/var/spool/locks/netatalk
84 if test x"$atalk_cv_fhs_compat" = x"yes" ; then
85 ac_cv_netatalk_lock=/var/run/netatalk.pid
89 ac_cv_netatalk_lock=/var/spool/lock/netatalk
92 ac_cv_netatalk_lock=/var/run/netatalk.pid
95 ac_cv_netatalk_lock=/var/lock/netatalk
100 AC_DEFINE_UNQUOTED(PATH_NETATALK_LOCK, ["$ac_cv_netatalk_lock"], [netatalk lockfile path])
101 AC_SUBST(PATH_NETATALK_LOCK, ["$ac_cv_netatalk_lock"])
102 AC_MSG_RESULT([$ac_cv_netatalk_lock])
105 dnl 64bit platform check
106 AC_DEFUN([AC_NETATALK_64BIT_LIBS], [
107 AC_MSG_CHECKING([whether to check for 64bit libraries])
108 # Test if the compiler is in 64bit mode
109 echo 'int i;' > conftest.$ac_ext
110 atalk_cv_cc_64bit_output=no
111 if AC_TRY_EVAL(ac_compile); then
112 case `/usr/bin/file conftest.$ac_objext` in
114 atalk_cv_cc_64bit_output=yes
120 case $host_cpu:$atalk_cv_cc_64bit_output in
121 powerpc64:yes | s390x:yes | sparc*:yes | x86_64:yes | i386:yes)
125 atalk_libname="lib/64"
133 atalk_libname="lib64"
144 dnl Check for optional admin group support
145 AC_DEFUN([AC_NETATALK_ADMIN_GROUP], [
146 netatalk_cv_admin_group=yes
147 AC_MSG_CHECKING([for administrative group support])
148 AC_ARG_ENABLE(admin-group,
149 [ --disable-admin-group disable admin group],[
150 if test x"$enableval" = x"no"; then
151 AC_DEFINE(ADMIN_GRP, 0, [Define if the admin group should be enabled])
152 netatalk_cv_admin_group=no
155 AC_DEFINE(ADMIN_GRP, 1, [Define if the admin group should be enabled])
158 AC_DEFINE(ADMIN_GRP, 1, [Define if the admin group should be enabled])
163 dnl Check for optional cracklib support
164 AC_DEFUN([AC_NETATALK_CRACKLIB], [
165 netatalk_cv_with_cracklib=no
166 AC_ARG_WITH(cracklib,
167 [ --with-cracklib[[=DICT]] enable/set location of cracklib dictionary [[no]]],[
168 if test "x$withval" != "xno" ; then
170 AC_CHECK_LIB(crack, main, [
171 AC_DEFINE(USE_CRACKLIB, 1, [Define if cracklib should be used])
173 if test "$cracklib" = "yes"; then
174 cracklib="/usr/$atalk_libname/cracklib_dict"
176 AC_DEFINE_UNQUOTED(_PATH_CRACKLIB, "$cracklib",
177 [path to cracklib dictionary])
178 AC_MSG_RESULT([setting cracklib dictionary to $cracklib])
179 netatalk_cv_with_cracklib=yes
181 AC_MSG_ERROR([cracklib not found!])
187 AC_MSG_CHECKING([for cracklib support])
188 AC_MSG_RESULT([$netatalk_cv_with_cracklib])
191 dnl Check whether to enable debug code
192 AC_DEFUN([AC_NETATALK_DEBUG], [
193 AC_MSG_CHECKING([whether to enable verbose debug code])
195 [ --enable-debug enable verbose debug code],[
196 if test "$enableval" != "no"; then
197 if test "$enableval" = "yes"; then
198 AC_DEFINE(DEBUG, 1, [Define if verbose debugging information should be included])
200 AC_DEFINE_UNQUOTED(DEBUG, $enableval, [Define if verbose debugging information should be included])
205 AC_DEFINE(NDEBUG, 1, [Disable assertions])
209 AC_DEFINE(NDEBUG, 1, [Disable assertions])
214 dnl Check whethe to disable tickle SIGALARM stuff, which eases debugging
215 AC_DEFUN([AC_NETATALK_DEBUGGING], [
216 AC_MSG_CHECKING([whether to enable debugging with debuggers])
217 AC_ARG_ENABLE(debugging,
218 [ --enable-debugging disable SIGALRM timers and DSI tickles (eg for debugging with gdb/dbx/...)],[
219 if test "$enableval" != "no"; then
220 if test "$enableval" = "yes"; then
221 AC_DEFINE(DEBUGGING, 1, [Define if you want to disable SIGALRM timers and DSI tickles])
223 AC_DEFINE_UNQUOTED(DEBUGGING, $enableval, [Define if you want to disable SIGALRM timers and DSI tickles])
236 dnl Check for optional shadow password support
237 AC_DEFUN([AC_NETATALK_SHADOW], [
238 netatalk_cv_use_shadowpw=no
240 [ --with-shadow enable shadow password support [[auto]]],
241 [netatalk_cv_use_shadowpw="$withval"],
242 [netatalk_cv_use_shadowpw=auto]
245 if test "x$netatalk_cv_use_shadowpw" != "xno"; then
246 AC_CHECK_HEADER([shadow.h])
247 if test x"$ac_cv_header_shadow_h" = x"yes"; then
248 netatalk_cv_use_shadowpw=yes
249 AC_DEFINE(SHADOWPW, 1, [Define if shadow passwords should be used])
251 if test "x$shadowpw" = "xyes"; then
252 AC_MSG_ERROR([shadow support not available])
254 netatalk_cv_use_shadowpw=no
259 AC_MSG_CHECKING([whether shadow support should be enabled])
260 if test "x$netatalk_cv_use_shadowpw" = "xyes"; then
267 dnl Check for optional valid-shell-check support
268 AC_DEFUN([AC_NETATALK_SHELL_CHECK], [
269 netatalk_cv_use_shellcheck=yes
270 AC_MSG_CHECKING([whether checking for a valid shell should be enabled])
271 AC_ARG_ENABLE(shell-check,
272 [ --disable-shell-check disable checking for a valid shell],[
273 if test "$enableval" = "no"; then
274 AC_DEFINE(DISABLE_SHELLCHECK, 1, [Define if shell check should be disabled])
276 netatalk_cv_use_shellcheck=no
286 dnl Check for optional sysv initscript install
287 AC_DEFUN([AC_NETATALK_INIT_STYLE], [
288 AC_ARG_WITH(init-style,
289 [ --with-init-style use OS specific init config [[redhat-sysv|redhat-systemd|suse-sysv|suse-systemd|gentoo|netbsd|debian|solaris|systemd]]],
290 init_style="$withval", init_style=none
292 case "$init_style" in
294 AC_MSG_ERROR([--with-init-style=redhat is obsoleted. Use redhat-sysv or redhat-systemd.])
297 AC_MSG_RESULT([enabling redhat-style sysv initscript support])
300 AC_MSG_RESULT([enabling redhat-style systemd support])
303 AC_MSG_ERROR([--with-init-style=suse is obsoleted. Use suse-sysv or suse-systemd.])
306 AC_MSG_RESULT([enabling suse-style sysv initscript support])
309 AC_MSG_RESULT([enabling suse-style systemd support (>=openSUSE12.1)])
312 AC_MSG_RESULT([enabling gentoo-style initscript support])
315 AC_MSG_RESULT([enabling netbsd-style initscript support])
318 AC_MSG_RESULT([enabling debian-style initscript support])
321 AC_MSG_RESULT([enabling solaris-style SMF support])
324 AC_MSG_RESULT([enabling general systemd support])
327 AC_MSG_RESULT([disabling init-style support])
330 AC_MSG_ERROR([illegal init-style])
333 AM_CONDITIONAL(USE_NETBSD, test x$init_style = xnetbsd)
334 AM_CONDITIONAL(USE_REDHAT_SYSV, test x$init_style = xredhat-sysv)
335 AM_CONDITIONAL(USE_SUSE_SYSV, test x$init_style = xsuse-sysv)
336 AM_CONDITIONAL(USE_SOLARIS, test x$init_style = xsolaris)
337 AM_CONDITIONAL(USE_GENTOO, test x$init_style = xgentoo)
338 AM_CONDITIONAL(USE_DEBIAN, test x$init_style = xdebian)
339 AM_CONDITIONAL(USE_SYSTEMD, test x$init_style = xsystemd || test x$init_style = xredhat-systemd || test x$init_style = xsuse-systemd)
340 AM_CONDITIONAL(USE_UNDEF, test x$init_style = xnone)
344 dnl OS specific configuration
345 AC_DEFUN([AC_NETATALK_OS_SPECIFIC], [
347 *aix*) this_os=aix ;;
348 *freebsd*) this_os=freebsd ;;
349 *hpux11*) this_os=hpux11 ;;
350 *irix*) this_os=irix ;;
351 *linux*) this_os=linux ;;
352 *osx*) this_os=macosx ;;
353 *darwin*) this_os=macosx ;;
354 *netbsd*) this_os=netbsd ;;
355 *openbsd*) this_os=openbsd ;;
356 *osf*) this_os=tru64 ;;
357 *solaris*) this_os=solaris ;;
361 i386|i486|i586|i686|k7) this_cpu=x86 ;;
362 alpha) this_cpu=alpha ;;
363 mips) this_cpu=mips ;;
364 powerpc|ppc) this_cpu=ppc ;;
367 dnl --------------------- GNU source
369 linux) AC_DEFINE(_GNU_SOURCE, 1, [Whether to use GNU libc extensions])
371 kfreebsd-gnu) AC_DEFINE(_GNU_SOURCE, 1, [Whether to use GNU libc extensions])
375 dnl --------------------- operating system specific flags (port from sys/*)
377 dnl ----- FreeBSD specific -----
378 if test x"$this_os" = "xfreebsd"; then
379 AC_MSG_RESULT([ * FreeBSD specific configuration])
380 AC_DEFINE(BSD4_4, 1, [BSD compatiblity macro])
381 AC_DEFINE(FREEBSD, 1, [Define if OS is FreeBSD])
382 AC_DEFINE(OPEN_NOFOLLOW_ERRNO, EMLINK, errno returned by open with O_NOFOLLOW)
385 dnl ----- GNU/kFreeBSD specific -----
386 if test x"$this_os" = "xkfreebsd-gnu"; then
387 AC_MSG_RESULT([ * GNU/kFreeBSD specific configuration])
388 AC_DEFINE(BSD4_4, 1, [BSD compatiblity macro])
389 AC_DEFINE(FREEBSD, 1, [Define if OS is FreeBSD])
390 AC_DEFINE(OPEN_NOFOLLOW_ERRNO, EMLINK, errno returned by open with O_NOFOLLOW)
393 dnl ----- Linux specific -----
394 if test x"$this_os" = "xlinux"; then
395 AC_MSG_RESULT([ * Linux specific configuration])
396 AC_DEFINE(LINUX, 1, [OS is Linux])
397 dnl ----- check if we need the quotactl wrapper
398 AC_CHECK_HEADERS(linux/dqblk_xfs.h,,
399 [AC_CHECK_HEADERS(linux/xqm.h linux/xfs_fs.h)
400 AC_CHECK_HEADERS(xfs/libxfs.h xfs/xqm.h xfs/xfs_fs.h)]
404 dnl ----- as far as I can tell, dbtob always does the wrong thing
405 dnl ----- on every single version of linux I've ever played with.
406 dnl ----- see etc/afpd/quota.c
407 AC_DEFINE(HAVE_BROKEN_DBTOB, 1, [Define if dbtob is broken])
412 dnl ----- NetBSD specific -----
413 if test x"$this_os" = "xnetbsd"; then
414 AC_MSG_RESULT([ * NetBSD specific configuration])
415 AC_DEFINE(BSD4_4, 1, [BSD compatiblity macro])
416 AC_DEFINE(NETBSD, 1, [Define if OS is NetBSD])
417 AC_DEFINE(OPEN_NOFOLLOW_ERRNO, EFTYPE, errno returned by open with O_NOFOLLOW)
419 CFLAGS="-I\$(top_srcdir)/sys/netbsd $CFLAGS"
422 dnl ----- NetBSD does not have crypt.h, uses unistd.h -----
423 AC_DEFINE(UAM_DHX, 1, [Define if the DHX UAM modules should be compiled])
426 dnl ----- OpenBSD specific -----
427 if test x"$this_os" = "xopenbsd"; then
428 AC_MSG_RESULT([ * OpenBSD specific configuration])
429 AC_DEFINE(BSD4_4, 1, [BSD compatiblity macro])
430 dnl ----- OpenBSD does not have crypt.h, uses unistd.h -----
431 AC_DEFINE(UAM_DHX, 1, [Define if the DHX UAM modules should be compiled])
434 dnl ----- Solaris specific -----
435 if test x"$this_os" = "xsolaris"; then
436 AC_MSG_RESULT([ * Solaris specific configuration])
437 AC_DEFINE(__svr4__, 1, [Solaris compatibility macro])
438 AC_DEFINE(_ISOC9X_SOURCE, 1, [Compatibility macro])
439 AC_DEFINE(NO_STRUCT_TM_GMTOFF, 1, [Define if the gmtoff member of struct tm is not available])
440 AC_DEFINE(SOLARIS, 1, [Solaris compatibility macro])
441 AC_DEFINE(_XOPEN_SOURCE, 600, [Solaris compilation environment])
442 AC_DEFINE(__EXTENSIONS__, 1, [Solaris compilation environment])
443 CFLAGS="-I\$(top_srcdir)/sys/generic $CFLAGS"
448 AC_MSG_CHECKING([if we can build Solaris kernel module])
449 if test -x /usr/ccs/bin/ld && test x"$netatalk_cv_ddp_enabled" = x"yes" ; then
452 AC_MSG_RESULT([$solaris_module])
454 COMPILE_64BIT_KMODULE=no
457 COMPILE_KERNEL_GCC=no
459 if test "$solaris_module" = "yes"; then
460 dnl Solaris kernel module stuff
461 AC_MSG_CHECKING([if we have to build a 64bit kernel module])
463 # check for isainfo, if not found it has to be a 32 bit kernel (<=2.6)
464 if test -x /usr/bin/isainfo; then
465 # check for 64 bit platform
466 if isainfo -kv | grep '^64-bit'; then
467 COMPILE_64BIT_KMODULE=yes
471 AC_MSG_RESULT([$COMPILE_64BIT_KMODULE])
473 if test "${GCC}" = yes; then
474 COMPILE_KERNEL_GCC=yes
475 if test "$COMPILE_64BIT_KMODULE" = yes; then
477 AC_MSG_CHECKING([if we can build a 64bit kernel module])
479 case `$CC --version 2>/dev/null` in
481 COMPILE_64BIT_KMODULE=no
482 COMPILE_KERNEL_GCC=no
487 #KLDFLAGS="-melf64_sparc"
491 AC_MSG_RESULT([$COMPILE_64BIT_KMODULE])
497 KCFLAGS="$KCFLAGS -D_KERNEL -Wall -Wstrict-prototypes"
499 if test "$COMPILE_64BIT_KMODULE" = yes; then
500 # use Sun CC (for a 64-bit kernel, uncomment " -xarch=v9 -xregs=no%appl ")
501 KCFLAGS="-xarch=v9 -xregs=no%appl"
507 KCFLAGS="-D_KERNEL $KCFLAGS -mno-app-regs -munaligned-doubles -fpcc-struct-return"
510 AC_CACHE_CHECK([for timeout_id_t],netatalk_cv_HAVE_TIMEOUT_ID_T,[
511 AC_LINK_IFELSE([AC_LANG_PROGRAM([[\
512 #include <sys/stream.h>
513 #include <sys/ddi.h>]], [[\
515 ]])],[netatalk_cv_HAVE_TIMEOUT_ID_T=yes],[netatalk_cv_HAVE_TIMEOUT_ID_T=no])])
517 AC_DEFINE(HAVE_TIMEOUT_ID_T, test x"$netatalk_cv_HAVE_TIMEOUT_ID" = x"yes", [define for timeout_id_t])
520 AC_SUBST(COMPILE_KERNEL_GCC)
521 AC_SUBST(COMPILE_64BIT_KMODULE)
526 dnl Whether to run ldconfig after installing libraries
527 AC_PATH_PROG(NETA_LDCONFIG, ldconfig, , [$PATH$PATH_SEPARATOR/sbin$PATH_SEPARATOR/bin$PATH_SEPARATOR/usr/sbin$PATH_SEPARATOR/usr/bin])
528 echo NETA_LDCONFIG = $NETA_LDCONFIG
529 AM_CONDITIONAL(RUN_LDCONFIG, test x"$this_os" = x"linux" -a x"$NETA_LDCONFIG" != x"")
532 dnl Check for building PGP UAM module
533 AC_DEFUN([AC_NETATALK_PGP_UAM], [
534 AC_MSG_CHECKING([whether the PGP UAM should be build])
535 AC_ARG_ENABLE(pgp-uam,
536 [ --enable-pgp-uam enable build of PGP UAM module],[
537 if test "$enableval" = "yes"; then
538 if test "x$neta_cv_have_openssl" = "xyes"; then
539 AC_DEFINE(UAM_PGP, 1, [Define if the PGP UAM module should be compiled])
552 dnl Check for building Kerberos V UAM module
553 AC_DEFUN([AC_NETATALK_KRB5_UAM], [
554 netatalk_cv_build_krb5_uam=no
555 AC_ARG_ENABLE(krbV-uam,
556 [ --enable-krbV-uam enable build of Kerberos V UAM module],
558 if test x"$enableval" = x"yes"; then
559 NETATALK_GSSAPI_CHECK([
560 netatalk_cv_build_krb5_uam=yes
562 AC_MSG_ERROR([need GSSAPI to build Kerberos V UAM])
569 AC_MSG_CHECKING([whether Kerberos V UAM should be build])
570 if test x"$netatalk_cv_build_krb5_uam" = x"yes"; then
575 AM_CONDITIONAL(USE_GSSAPI, test x"$netatalk_cv_build_krb5_uam" = x"yes")
578 dnl Check if we can directly use Kerberos 5 API, used for reading keytabs
579 dnl and automatically construction DirectoryService names from that, instead
580 dnl of requiring special configuration in afp.conf
581 AC_DEFUN([AC_NETATALK_KERBEROS], [
582 AC_MSG_CHECKING([for Kerberos 5 (necessary for GetSrvrInfo:DirectoryNames support)])
583 AC_ARG_WITH([kerberos],
584 [AS_HELP_STRING([--with-kerberos], [Kerberos 5 support (default=auto)])],
586 [with_kerberos=auto])
587 AC_MSG_RESULT($with_kerberos)
589 if test x"$with_kerberos" != x"no"; then
590 have_krb5_header="no"
591 AC_CHECK_HEADERS([krb5/krb5.h krb5.h], [have_krb5_header="yes"; break])
592 if test x"$have_krb5_header" = x"no" && test x"$with_kerberos" != x"auto"; then
593 AC_MSG_FAILURE([--with-kerberos was given, but no headers found])
596 AC_PATH_PROG([KRB5_CONFIG], [krb5-config])
597 AC_MSG_CHECKING([for krb5-config])
598 if test -x "$KRB5_CONFIG"; then
599 AC_MSG_RESULT([$KRB5_CONFIG])
600 KRB5_CFLAGS="`$KRB5_CONFIG --cflags krb5`"
601 KRB5_LIBS="`$KRB5_CONFIG --libs krb5`"
602 AC_SUBST(KRB5_CFLAGS)
606 AC_MSG_RESULT([not found])
607 if test x"$with_kerberos" != x"auto"; then
608 AC_MSG_FAILURE([--with-kerberos was given, but krb5-config could not be found])
613 if test x"$with_kerberos" = x"yes"; then
614 AC_DEFINE([HAVE_KERBEROS], [1], [Define if Kerberos 5 is available])
617 dnl Check for krb5_free_unparsed_name and krb5_free_error_message
618 save_CFLAGS="$CFLAGS"
620 CFLAGS="$KRB5_CFLAGS"
622 AC_CHECK_FUNCS([krb5_free_unparsed_name krb5_free_error_message krb5_free_keytab_entry_contents krb5_kt_free_entry])
623 CFLAGS="$save_CFLAGS"
627 dnl Check for overwrite the config files or not
628 AC_DEFUN([AC_NETATALK_OVERWRITE_CONFIG], [
629 AC_MSG_CHECKING([whether configuration files should be overwritten])
630 AC_ARG_ENABLE(overwrite,
631 [ --enable-overwrite overwrite configuration files during installation],
632 [OVERWRITE_CONFIG="${enable_overwrite}"],
633 [OVERWRITE_CONFIG="no"]
635 AC_MSG_RESULT([$OVERWRITE_CONFIG])
636 AC_SUBST(OVERWRITE_CONFIG)
639 dnl Check for LDAP support, for client-side ACL visibility
640 AC_DEFUN([AC_NETATALK_LDAP], [
641 AC_MSG_CHECKING(for LDAP (necessary for client-side ACL visibility))
643 [AS_HELP_STRING([--with-ldap],
644 [LDAP support (default=auto)])],
645 netatalk_cv_ldap=$withval,
646 netatalk_cv_ldap=auto
648 AC_MSG_RESULT($netatalk_cv_ldap)
650 save_CFLAGS="$CFLAGS"
651 save_LDFLAGS="$LDFLAGS"
660 if test x"$netatalk_cv_ldap" != x"no" ; then
661 if test x"$netatalk_cv_ldap" != x"yes" -a x"$netatalk_cv_ldap" != x"auto"; then
662 CFLAGS="-I$netatalk_cv_ldap/include"
663 LDFLAGS="-L$netatalk_cv_ldap/lib"
665 AC_CHECK_HEADER([ldap.h], netatalk_cv_ldap=yes,
666 [ if test x"$netatalk_cv_ldap" = x"yes" ; then
667 AC_MSG_ERROR([Missing LDAP headers])
671 AC_CHECK_LIB(ldap, ldap_init, netatalk_cv_ldap=yes,
672 [ if test x"$netatalk_cv_ldap" = x"yes" ; then
673 AC_MSG_ERROR([Missing LDAP library])
679 if test x"$netatalk_cv_ldap" = x"yes"; then
680 LDAP_CFLAGS="$CFLAGS"
681 LDAP_LDFLAGS="$LDFLAGS"
683 AC_DEFINE(HAVE_LDAP,1,[Whether LDAP is available])
686 AC_SUBST(LDAP_CFLAGS)
687 AC_SUBST(LDAP_LDFLAGS)
689 CFLAGS="$save_CFLAGS"
690 LDLFLAGS="$save_LDLFLAGS"
694 dnl Check for ACL support
695 AC_DEFUN([AC_NETATALK_ACL], [
696 AC_MSG_CHECKING(whether to support ACLs)
698 [AS_HELP_STRING([--with-acls],
699 [Include ACL support (default=auto)])],
702 with_acl_support="$withval"
705 with_acl_support=auto
708 [with_acl_support=auto])
709 AC_MSG_RESULT($with_acl_support)
711 if test x"$with_acl_support" = x"no"; then
712 AC_MSG_RESULT(Disabling ACL support)
713 AC_DEFINE(HAVE_NO_ACLS,1,[Whether no ACLs support should be built in])
718 if test x"$with_acl_support" = x"yes" ; then
719 AC_MSG_NOTICE(checking whether ACL support is available:)
722 AC_MSG_NOTICE(Using UnixWare ACLs)
723 AC_DEFINE(HAVE_UNIXWARE_ACLS,1,[Whether UnixWare ACLs are available])
726 AC_MSG_NOTICE(Using solaris ACLs)
727 AC_DEFINE(HAVE_SOLARIS_ACLS,1,[Whether solaris ACLs are available])
728 ACL_LIBS="$ACL_LIBS -lsec"
731 AC_MSG_NOTICE(Using HPUX ACLs)
732 AC_DEFINE(HAVE_HPUX_ACLS,1,[Whether HPUX ACLs are available])
735 AC_MSG_NOTICE(Using IRIX ACLs)
736 AC_DEFINE(HAVE_IRIX_ACLS,1,[Whether IRIX ACLs are available])
739 AC_MSG_NOTICE(Using AIX ACLs)
740 AC_DEFINE(HAVE_AIX_ACLS,1,[Whether AIX ACLs are available])
743 AC_MSG_NOTICE(Using Tru64 ACLs)
744 AC_DEFINE(HAVE_TRU64_ACLS,1,[Whether Tru64 ACLs are available])
745 ACL_LIBS="$ACL_LIBS -lpacl"
748 AC_MSG_NOTICE(ACLs on Darwin currently not supported)
749 AC_DEFINE(HAVE_NO_ACLS,1,[Whether no ACLs support is available])
752 AC_CHECK_LIB(acl,acl_get_file,[ACL_LIBS="$ACL_LIBS -lacl"])
755 AC_CHECK_LIB(attr,getxattr,[ACL_LIBS="$ACL_LIBS -lattr"])
758 AC_CACHE_CHECK([for POSIX ACL support],netatalk_cv_HAVE_POSIX_ACLS,[
760 LIBS="$LIBS $ACL_LIBS"
761 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
762 #include <sys/types.h>
767 acl_entry_t *entry_p;
768 return acl_get_entry(acl, entry_id, entry_p);
769 ]])],[netatalk_cv_HAVE_POSIX_ACLS=yes],[netatalk_cv_HAVE_POSIX_ACLS=no
770 with_acl_support=no])
773 if test x"$netatalk_cv_HAVE_POSIX_ACLS" = x"yes"; then
774 AC_MSG_NOTICE(Using POSIX ACLs)
775 AC_DEFINE(HAVE_POSIX_ACLS,1,[Whether POSIX ACLs are available])
776 AC_CACHE_CHECK([for acl_get_perm_np],netatalk_cv_HAVE_ACL_GET_PERM_NP,[
778 LIBS="$LIBS $ACL_LIBS"
779 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
780 #include <sys/types.h>
783 acl_permset_t permset_d;
785 return acl_get_perm_np(permset_d, perm);
786 ]])],[netatalk_cv_HAVE_ACL_GET_PERM_NP=yes],[netatalk_cv_HAVE_ACL_GET_PERM_NP=no])
789 if test x"$netatalk_cv_HAVE_ACL_GET_PERM_NP" = x"yes"; then
790 AC_DEFINE(HAVE_ACL_GET_PERM_NP,1,[Whether acl_get_perm_np() is available])
794 AC_CACHE_CHECK([for acl_from_mode], netatalk_cv_HAVE_ACL_FROM_MODE,[
796 LIBS="$LIBS $ACL_LIBS"
797 AC_CHECK_FUNCS(acl_from_mode,
798 [netatalk_cv_HAVE_ACL_FROM_MODE=yes],
799 [netatalk_cv_HAVE_ACL_FROM_MODE=no])
802 if test x"netatalk_cv_HAVE_ACL_FROM_MODE" = x"yes"; then
803 AC_DEFINE(HAVE_ACL_FROM_MODE,1,[Whether acl_from_mode() is available])
807 AC_MSG_NOTICE(ACL support is not avaliable)
808 AC_DEFINE(HAVE_NO_ACLS,1,[Whether no ACLs support is available])
814 if test x"$with_acl_support" = x"yes" ; then
815 AC_CHECK_HEADERS([acl/libacl.h])
816 AC_DEFINE(HAVE_ACLS,1,[Whether ACLs support is available])
821 dnl Check for Extended Attributes support
822 AC_DEFUN([AC_NETATALK_EXTENDED_ATTRIBUTES], [
824 neta_cv_eas_sys_found=no
825 neta_cv_eas_sys_not_found=no
827 AC_CHECK_HEADERS(sys/attributes.h attr/xattr.h sys/xattr.h sys/extattr.h sys/uio.h sys/ea.h)
832 AC_SEARCH_LIBS(getproplist, [proplist])
833 AC_CHECK_FUNCS([getproplist fgetproplist setproplist fsetproplist],
834 [neta_cv_eas_sys_found=yes],
835 [neta_cv_eas_sys_not_found=yes])
836 AC_CHECK_FUNCS([delproplist fdelproplist add_proplist_entry get_proplist_entry],,
837 [neta_cv_eas_sys_not_found=yes])
838 AC_CHECK_FUNCS([sizeof_proplist_entry],,
839 [neta_cv_eas_sys_not_found=yes])
843 AC_CHECK_FUNCS([attropen],
844 [neta_cv_eas_sys_found=yes; AC_DEFINE(HAVE_EAFD, 1, [extattr API has full fledged fds for EAs])],
845 [neta_cv_eas_sys_not_found=yes])
849 AC_CHECK_FUNCS([extattr_delete_fd extattr_delete_file extattr_delete_link],
850 [neta_cv_eas_sys_found=yes],
851 [neta_cv_eas_sys_not_found=yes])
852 AC_CHECK_FUNCS([extattr_get_fd extattr_get_file extattr_get_link],,
853 [neta_cv_eas_sys_not_found=yes])
854 AC_CHECK_FUNCS([extattr_list_fd extattr_list_file extattr_list_link],,
855 [neta_cv_eas_sys_not_found=yes])
856 AC_CHECK_FUNCS([extattr_set_fd extattr_set_file extattr_set_link],,
857 [neta_cv_eas_sys_not_found=yes])
860 *freebsd4* | *dragonfly* )
861 AC_DEFINE(BROKEN_EXTATTR, 1, [Does extattr API work])
865 AC_SEARCH_LIBS(getxattr, [attr])
867 if test "x$neta_cv_eas_sys_found" != "xyes" ; then
868 AC_CHECK_FUNCS([getxattr lgetxattr fgetxattr listxattr llistxattr],
869 [neta_cv_eas_sys_found=yes],
870 [neta_cv_eas_sys_not_found=yes])
871 AC_CHECK_FUNCS([flistxattr removexattr lremovexattr fremovexattr],,
872 [neta_cv_eas_sys_not_found=yes])
873 AC_CHECK_FUNCS([setxattr lsetxattr fsetxattr],,
874 [neta_cv_eas_sys_not_found=yes])
877 if test "x$neta_cv_eas_sys_found" != "xyes" ; then
878 AC_CHECK_FUNCS([getea fgetea lgetea listea flistea llistea],
879 [neta_cv_eas_sys_found=yes],
880 [neta_cv_eas_sys_not_found=yes])
881 AC_CHECK_FUNCS([removeea fremoveea lremoveea setea fsetea lsetea],,
882 [neta_cv_eas_sys_not_found=yes])
885 if test "x$neta_cv_eas_sys_found" != "xyes" ; then
886 AC_CHECK_FUNCS([attr_get attr_list attr_set attr_remove],,
887 [neta_cv_eas_sys_not_found=yes])
888 AC_CHECK_FUNCS([attr_getf attr_listf attr_setf attr_removef],,
889 [neta_cv_eas_sys_not_found=yes])
894 # Do xattr functions take additional options like on Darwin?
895 if test x"$ac_cv_func_getxattr" = x"yes" ; then
896 AC_CACHE_CHECK([whether xattr interface takes additional options], smb_attr_cv_xattr_add_opt, [
898 LIBS="$LIBS $ACL_LIBS"
899 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
900 #include <sys/types.h>
901 #if HAVE_ATTR_XATTR_H
902 #include <attr/xattr.h>
903 #elif HAVE_SYS_XATTR_H
904 #include <sys/xattr.h>
907 getxattr(0, 0, 0, 0, 0, 0);
908 ]])],[smb_attr_cv_xattr_add_opt=yes],[smb_attr_cv_xattr_add_opt=no;LIBS=$old_LIBS])
910 if test x"$smb_attr_cv_xattr_add_opt" = x"yes"; then
911 AC_DEFINE(XATTR_ADD_OPT, 1, [xattr functions have additional options])
915 if test "x$neta_cv_eas_sys_found" = "xyes" ; then
916 if test "x$neta_cv_eas_sys_not_found" != "xyes" ; then
917 neta_cv_eas="$neta_cv_eas | sys"
920 AC_DEFINE_UNQUOTED(EA_MODULES,["$neta_cv_eas"],[Available Extended Attributes modules])
923 dnl Check for libsmbsharemodes from Samba for Samba/Netatalk access/deny/share modes interop
924 dnl Defines "neta_cv_have_smbshmd" to "yes" or "no"
925 dnl AC_SUBST's "SMB_SHAREMODES_CFLAGS" and "SMB_SHAREMODES_LDFLAGS"
926 dnl AM_CONDITIONAL's "USE_SMB_SHAREMODES"
927 AC_DEFUN([AC_NETATALK_SMB_SHAREMODES], [
928 neta_cv_have_smbshmd=no
929 AC_ARG_WITH(smbsharemodes-lib,
930 [ --with-smbsharemodes-lib=PATH PATH to libsmbsharemodes lib from Samba],
931 [SMB_SHAREMODES_LDFLAGS="-L$withval -lsmbsharemodes"]
933 AC_ARG_WITH(smbsharemodes-include,
934 [ --with-smbsharemodes-include=PATH PATH to libsmbsharemodes header from Samba],
935 [SMB_SHAREMODES_CFLAGS="-I$withval"]
937 AC_ARG_WITH(smbsharemodes,
938 [AS_HELP_STRING([--with-smbsharemodes],[Samba interop (default is yes)])],
939 [use_smbsharemodes=$withval],
940 [use_smbsharemodes=yes]
943 if test x"$use_smbsharemodes" = x"yes" ; then
944 AC_MSG_CHECKING([whether to enable Samba/Netatalk access/deny/share-modes interop])
946 saved_CFLAGS="$CFLAGS"
947 saved_LDFLAGS="$LDFLAGS"
948 CFLAGS="$SMB_SHAREMODES_CFLAGS $CFLAGS"
949 LDFLAGS="$SMB_SHAREMODES_LDFLAGS $LDFLAGS"
954 #include <sys/time.h>
957 /* From messages.h */
961 #include "smb_share_modes.h"
962 int main(void) { (void)smb_share_mode_db_open(""); return 0;}],
963 [neta_cv_have_smbshmd=yes]
966 AC_MSG_RESULT($neta_cv_have_smbshmd)
967 AC_SUBST(SMB_SHAREMODES_CFLAGS, [$SMB_SHAREMODES_CFLAGS])
968 AC_SUBST(SMB_SHAREMODES_LDFLAGS, [$SMB_SHAREMODES_LDFLAGS])
969 CFLAGS="$saved_CFLAGS"
970 LDFLAGS="$saved_LDFLAGS"
973 AM_CONDITIONAL(USE_SMB_SHAREMODES, test x"$neta_cv_have_smbshmd" = x"yes")
976 dnl ------ Check for sendfile() --------
977 AC_DEFUN([AC_NETATALK_SENDFILE], [
978 netatalk_cv_search_sendfile=yes
979 AC_ARG_ENABLE(sendfile,
980 [ --disable-sendfile disable sendfile syscall],
981 [if test x"$enableval" = x"no"; then
982 netatalk_cv_search_sendfile=no
986 if test x"$netatalk_cv_search_sendfile" = x"yes"; then
989 AC_DEFINE(SENDFILE_FLAVOR_LINUX,1,[Whether linux sendfile() API is available])
990 AC_CHECK_FUNC([sendfile], [netatalk_cv_HAVE_SENDFILE=yes])
994 AC_DEFINE(SENDFILE_FLAVOR_SOLARIS, 1, [Solaris sendfile()])
995 AC_SEARCH_LIBS(sendfile, sendfile)
996 AC_CHECK_FUNC([sendfile], [netatalk_cv_HAVE_SENDFILE=yes])
997 AC_CHECK_FUNCS([sendfilev])
1001 AC_DEFINE(SENDFILE_FLAVOR_BSD, 1, [Define if the sendfile() function uses BSD semantics])
1002 AC_CHECK_FUNC([sendfile], [netatalk_cv_HAVE_SENDFILE=yes])
1010 if test x"$netatalk_cv_HAVE_SENDFILE" = x"yes"; then
1011 AC_DEFINE(WITH_SENDFILE,1,[Whether sendfile() should be used])
1016 dnl --------------------- Check if realpath() takes NULL
1017 AC_DEFUN([AC_NETATALK_REALPATH], [
1018 AC_CACHE_CHECK([if the realpath function allows a NULL argument],
1019 neta_cv_REALPATH_TAKES_NULL, [
1020 AC_RUN_IFELSE([AC_LANG_SOURCE([[
1025 void exit_on_core(int ignored) {
1031 signal(SIGSEGV, exit_on_core);
1032 newpath = realpath("/tmp", NULL);
1033 exit((newpath != NULL) ? 0 : 1);
1034 }]])],[neta_cv_REALPATH_TAKES_NULL=yes],[neta_cv_REALPATH_TAKES_NULL=no],[neta_cv_REALPATH_TAKES_NULL=cross
1039 if test x"$neta_cv_REALPATH_TAKES_NULL" = x"yes"; then
1040 AC_DEFINE(REALPATH_TAKES_NULL,1,[Whether the realpath function allows NULL])