1 dnl Kitchen sink for configuration macros
4 AC_DEFUN([AC_NETATALK_DTRACE], [
8 [Enable dtrace probes (default: enabled if dtrace found)]
13 if test "x$WDTRACE" = "xyes" -o "x$WDTRACE" = "xauto" ; then
14 AC_CHECK_PROG([atalk_cv_have_dtrace], [dtrace], [yes], [no])
15 if test "x$atalk_cv_have_dtrace" = "xno" ; then
16 if test "x$WDTRACE" = "xyes" ; then
17 AC_MSG_FAILURE([dtrace requested but not found])
25 if test x"$WDTRACE" = x"yes" ; then
26 AC_DEFINE([WITH_DTRACE], [1], [dtrace probes])
28 if test x"$this_os" = x"freebsd" ; then
33 AM_CONDITIONAL(WITH_DTRACE, test "x$WDTRACE" = "xyes")
36 dnl Check for dbus-glib, for AFP stats
37 AC_DEFUN([AC_NETATALK_DBUS_GLIB], [
43 [Enable AFP statistics via dbus (default: enabled if dbus found)]
47 if test x"$withval" != x"no" ; then
48 PKG_CHECK_MODULES(DBUS, dbus-1 >= 1.1, have_dbus=yes, have_dbus=no)
49 PKG_CHECK_MODULES(DBUS_GLIB, dbus-glib-1, have_dbus_glib=yes, have_dbus_glib=no)
50 PKG_CHECK_MODULES(DBUS_GTHREAD, gthread-2.0, have_dbus_gthread=yes, have_dbus_gthread=no)
51 if test x$have_dbus_glib = xyes -a x$have_dbus = xyes -a x$have_dbus_gthread = xyes ; then
54 CFLAGS="$CFLAGS $DBUS_GLIB_CFLAGS"
55 LIBS="$LIBS $DBUS_GLIB_LIBS"
56 AC_CHECK_FUNC([dbus_g_bus_get_private], [atalk_cv_with_dbus=yes], [atalk_cv_with_dbus=no])
57 CFLAGS="$saved_CFLAGS"
62 if test x"$withval" = x"yes" -a x"$atalk_cv_with_dbus" = x"no"; then
63 AC_MSG_ERROR([afpstats requested but dbus-glib not found])
68 [AS_HELP_STRING([--with-dbus-sysconf-dir=PATH],[Path to dbus system bus security configuration directory (default: ${sysconfdir}/dbus-1/system.d/)])],
69 ac_cv_dbus_sysdir=$withval,
70 ac_cv_dbus_sysdir='${sysconfdir}/dbus-1/system.d'
73 if test x$atalk_cv_with_dbus = xyes ; then
74 AC_DEFINE(HAVE_DBUS_GLIB, 1, [Define if support for dbus-glib was found])
75 DBUS_SYS_DIR="$ac_cv_dbus_sysdir"
78 AC_SUBST(DBUS_SYS_DIR)
81 AC_SUBST(DBUS_GLIB_CFLAGS)
82 AC_SUBST(DBUS_GLIB_LIBS)
83 AC_SUBST(DBUS_GTHREAD_CFLAGS)
84 AC_SUBST(DBUS_GTHREAD_LIBS)
85 AM_CONDITIONAL(HAVE_DBUS_GLIB, test x$atalk_cv_with_dbus = xyes)
88 dnl Whether to enable developer build
89 AC_DEFUN([AC_DEVELOPER], [
90 AC_MSG_CHECKING([whether to enable developer build])
93 AS_HELP_STRING([--enable-developer], [whether to enable developer build (ABI checking)]),
94 enable_dev=$enableval,
97 AC_MSG_RESULT([$enable_dev])
98 AM_CONDITIONAL(DEVELOPER, test x"$enable_dev" = x"yes")
101 dnl Tracker, for Spotlight
102 AC_DEFUN([AC_NETATALK_SPOTLIGHT], [
103 ac_cv_have_tracker=no
105 ac_cv_tracker_pkg_default=tracker-sparql-0.12
106 AC_ARG_WITH([tracker-pkg-config],
107 [AS_HELP_STRING([--with-tracker-pkg-config],[name of the Tracker SPARQL pkg in pkg-config])],
108 [ac_cv_tracker_pkg=$withval],
109 [ac_cv_tracker_pkg=$ac_cv_tracker_pkg_default])
111 PKG_CHECK_MODULES([TRACKER], [$ac_cv_tracker_pkg >= 0.12], [ac_cv_have_tracker_sparql=yes], [ac_cv_have_tracker_sparql=no])
113 if test x"$ac_cv_have_tracker_sparql" = x"no" ; then
114 if test x"$need_tracker" = x"yes" ; then
115 AC_MSG_ERROR([$ac_cv_tracker_pkg not found])
118 AC_DEFINE(HAVE_TRACKER, 1, [Define if Tracker is available])
119 AC_DEFINE(HAVE_TRACKER_SPARQL, 1, [Define if Tracker SPARQL is available])
120 ac_cv_tracker_prefix=`pkg-config --variable=prefix $ac_cv_tracker_pkg`
121 AC_DEFINE_UNQUOTED(TRACKER_PREFIX, ["$ac_cv_tracker_prefix"], [Path to Tracker])
122 AC_DEFINE([DBUS_DAEMON_PATH], ["/bin/dbus-daemon"], [Path to dbus-daemon])
125 ac_cv_tracker_miner_pkg_default=tracker-miner-0.12
126 AC_ARG_WITH([tracker-miner-pkg-config],
127 [AS_HELP_STRING([--with-tracker-miner-pkg-config],[name of the Tracker miner pkg in pkg-config])],
128 [ac_cv_tracker_miner_pkg=$withval],
129 [ac_cv_tracker_miner_pkg=$ac_cv_tracker_miner_pkg_default])
131 PKG_CHECK_MODULES([TRACKER_MINER], [$ac_cv_tracker_miner_pkg >= 0.12], [ac_cv_have_tracker_miner=yes], [ac_cv_have_tracker_miner=no])
133 if test x"$ac_cv_have_tracker_miner" = x"yes" ; then
134 AC_DEFINE(HAVE_TRACKER_MINER, 1, [Define if Tracker miner library is available])
135 AC_SUBST(TRACKER_MINER_CFLAGS)
136 AC_SUBST(TRACKER_MINER_LIBS)
139 dnl Test for Tracker 0.6 on Solaris and derived platforms, and FreeBSD
140 if test x"$this_os" = x"solaris" -o x"$this_os" = x"freebsd" ; then
141 PKG_CHECK_MODULES([TRACKER], [tracker >= 0.6], [ac_cv_have_tracker_rdf=yes], [ac_cv_have_tracker_rdf=no])
142 if test x"$ac_cv_have_tracker_rdf" = x"yes" ; then
143 AC_DEFINE(HAVE_TRACKER, 1, [Define if Tracker is available])
144 AC_DEFINE(HAVE_TRACKER_RDF, 1, [Define if Tracker 0.6 with support for RDF queries is available])
147 AC_DEFINE([DBUS_DAEMON_PATH], ["/usr/lib/dbus-daemon"], [Path to dbus-daemon])
148 AC_DEFINE([TRACKERD_PATH], ["/bin/trackerd"], [Path to trackerd])
151 AC_DEFINE([DBUS_DAEMON_PATH], ["/usr/local/bin/dbus-daemon"], [Path to dbus-daemon])
152 AC_DEFINE([TRACKERD_PATH], ["/usr/local/libexec/trackerd"], [Path to trackerd])
158 if test x"$ac_cv_have_tracker_sparql" = x"yes" -o x"$ac_cv_have_tracker_rdf" = x"yes" ; then
159 ac_cv_have_tracker=yes
161 AC_SUBST(TRACKER_CFLAGS)
162 AC_SUBST(TRACKER_LIBS)
163 AM_CONDITIONAL(HAVE_TRACKER_SPARQL, [test x"$ac_cv_have_tracker_sparql" = x"yes"])
164 AM_CONDITIONAL(HAVE_TRACKER_RDF, [test x"$ac_cv_have_tracker_rdf" = x"yes"])
167 dnl Whether to disable bundled libevent
168 AC_DEFUN([AC_NETATALK_LIBEVENT], [
169 AC_MSG_CHECKING([whether to use bundled libevent])
172 [AS_HELP_STRING([--with-libevent],[whether to use the bundled libevent (default: yes)])],
173 use_bundled_libevent=$withval,
174 use_bundled_libevent=yes
178 [AS_HELP_STRING([--with-libevent-header],[path to libevent header files])],
179 [use_bundled_libevent=no; LIBEVENT_CFLAGS=-I$withval]
183 [AS_HELP_STRING([--with-libevent-lib],[path to libevent library])],
184 [use_bundled_libevent=no; LIBEVENT_LDFLAGS=-L$withval]
186 if test x"$LIBEVENT_CFLAGS" = x"-Iyes" -o x"$LIBEVENT_LDFLAGS" = x"-Lyes" ; then
187 AC_MSG_ERROR([--with-libevent requires a path])
189 AC_MSG_RESULT([$use_bundled_libevent])
190 if test x"$use_bundled_libevent" = x"yes" ; then
191 AC_CONFIG_SUBDIRS([libevent])
193 AC_SUBST(LIBEVENT_CFLAGS)
194 AC_SUBST(LIBEVENT_LDFLAGS)
195 AM_CONDITIONAL(USE_BUILTIN_LIBEVENT, test x"$use_bundled_libevent" = x"yes")
198 dnl Filesystem Hierarchy Standard (FHS) compatibility
199 AC_DEFUN([AC_NETATALK_FHS], [
200 AC_MSG_CHECKING([whether to use Filesystem Hierarchy Standard (FHS) compatibility])
202 [ --enable-fhs use Filesystem Hierarchy Standard (FHS) compatibility],[
203 if test "$enableval" = "yes"; then
209 mandir="/usr/share/man"
210 uams_path="${libdir}/netatalk"
211 PKGCONFDIR="${sysconfdir}"
212 SERVERTEXT="${localstatedir}/netatalk/msg"
214 AC_DEFINE(FHS_COMPATIBILITY, 1, [Define if you want compatibily with the FHS])
216 atalk_cv_fhs_compat=yes
219 atalk_cv_fhs_compat=no
223 atalk_cv_fhs_compat=no
226 dnl netatalk lockfile path
227 AC_DEFUN([AC_NETATALK_LOCKFILE], [
228 AC_MSG_CHECKING([netatalk lockfile path])
231 [AS_HELP_STRING([--with-lockfile=PATH],[Path of netatalk lockfile])],
232 ac_cv_netatalk_lock=$withval,
233 ac_cv_netatalk_lock=""
235 if test -z "$ac_cv_netatalk_lock" ; then
236 ac_cv_netatalk_lock=/var/spool/locks/netatalk
237 if test x"$atalk_cv_fhs_compat" = x"yes" ; then
238 ac_cv_netatalk_lock=/var/run/netatalk.pid
242 ac_cv_netatalk_lock=/var/spool/lock/netatalk
245 ac_cv_netatalk_lock=/var/run/netatalk.pid
248 ac_cv_netatalk_lock=/var/lock/netatalk
253 AC_DEFINE_UNQUOTED(PATH_NETATALK_LOCK, ["$ac_cv_netatalk_lock"], [netatalk lockfile path])
254 AC_SUBST(PATH_NETATALK_LOCK, ["$ac_cv_netatalk_lock"])
255 AC_MSG_RESULT([$ac_cv_netatalk_lock])
258 dnl 64bit platform check
259 AC_DEFUN([AC_NETATALK_64BIT_LIBS], [
260 AC_MSG_CHECKING([whether to check for 64bit libraries])
261 # Test if the compiler is in 64bit mode
262 echo 'int i;' > conftest.$ac_ext
263 atalk_cv_cc_64bit_output=no
264 if AC_TRY_EVAL(ac_compile); then
265 case `/usr/bin/file conftest.$ac_objext` in
267 atalk_cv_cc_64bit_output=yes
273 case $host_cpu:$atalk_cv_cc_64bit_output in
274 powerpc64:yes | s390x:yes | sparc*:yes | x86_64:yes | i386:yes)
278 atalk_libname="lib/64"
286 atalk_libname="lib64"
297 dnl Check for optional admin group support
298 AC_DEFUN([AC_NETATALK_ADMIN_GROUP], [
299 netatalk_cv_admin_group=yes
300 AC_MSG_CHECKING([for administrative group support])
301 AC_ARG_ENABLE(admin-group,
302 [ --disable-admin-group disable admin group],[
303 if test x"$enableval" = x"no"; then
304 AC_DEFINE(ADMIN_GRP, 0, [Define if the admin group should be enabled])
305 netatalk_cv_admin_group=no
308 AC_DEFINE(ADMIN_GRP, 1, [Define if the admin group should be enabled])
311 AC_DEFINE(ADMIN_GRP, 1, [Define if the admin group should be enabled])
316 dnl Check for optional cracklib support
317 AC_DEFUN([AC_NETATALK_CRACKLIB], [
318 netatalk_cv_with_cracklib=no
319 AC_ARG_WITH(cracklib,
320 [ --with-cracklib[[=DICT]] enable/set location of cracklib dictionary [[no]]],[
321 if test "x$withval" != "xno" ; then
323 AC_CHECK_LIB(crack, main, [
324 AC_DEFINE(USE_CRACKLIB, 1, [Define if cracklib should be used])
326 if test "$cracklib" = "yes"; then
327 cracklib="/usr/$atalk_libname/cracklib_dict"
329 AC_DEFINE_UNQUOTED(_PATH_CRACKLIB, "$cracklib",
330 [path to cracklib dictionary])
331 AC_MSG_RESULT([setting cracklib dictionary to $cracklib])
332 netatalk_cv_with_cracklib=yes
334 AC_MSG_ERROR([cracklib not found!])
340 AC_MSG_CHECKING([for cracklib support])
341 AC_MSG_RESULT([$netatalk_cv_with_cracklib])
344 dnl Check whether to enable debug code
345 AC_DEFUN([AC_NETATALK_DEBUG], [
346 AC_MSG_CHECKING([whether to enable verbose debug code])
348 [ --enable-debug enable verbose debug code],[
349 if test "$enableval" != "no"; then
350 if test "$enableval" = "yes"; then
351 AC_DEFINE(DEBUG, 1, [Define if verbose debugging information should be included])
353 AC_DEFINE_UNQUOTED(DEBUG, $enableval, [Define if verbose debugging information should be included])
358 AC_DEFINE(NDEBUG, 1, [Disable assertions])
362 AC_DEFINE(NDEBUG, 1, [Disable assertions])
367 dnl Check whethe to disable tickle SIGALARM stuff, which eases debugging
368 AC_DEFUN([AC_NETATALK_DEBUGGING], [
369 AC_MSG_CHECKING([whether to enable debugging with debuggers])
370 AC_ARG_ENABLE(debugging,
371 [ --enable-debugging disable SIGALRM timers and DSI tickles (eg for debugging with gdb/dbx/...)],[
372 if test "$enableval" != "no"; then
373 if test "$enableval" = "yes"; then
374 AC_DEFINE(DEBUGGING, 1, [Define if you want to disable SIGALRM timers and DSI tickles])
376 AC_DEFINE_UNQUOTED(DEBUGGING, $enableval, [Define if you want to disable SIGALRM timers and DSI tickles])
389 dnl Check for optional shadow password support
390 AC_DEFUN([AC_NETATALK_SHADOW], [
391 netatalk_cv_use_shadowpw=no
393 [ --with-shadow enable shadow password support [[auto]]],
394 [netatalk_cv_use_shadowpw="$withval"],
395 [netatalk_cv_use_shadowpw=auto]
398 if test "x$netatalk_cv_use_shadowpw" != "xno"; then
399 AC_CHECK_HEADER([shadow.h])
400 if test x"$ac_cv_header_shadow_h" = x"yes"; then
401 netatalk_cv_use_shadowpw=yes
402 AC_DEFINE(SHADOWPW, 1, [Define if shadow passwords should be used])
404 if test "x$shadowpw" = "xyes"; then
405 AC_MSG_ERROR([shadow support not available])
407 netatalk_cv_use_shadowpw=no
412 AC_MSG_CHECKING([whether shadow support should be enabled])
413 if test "x$netatalk_cv_use_shadowpw" = "xyes"; then
420 dnl Check for optional valid-shell-check support
421 AC_DEFUN([AC_NETATALK_SHELL_CHECK], [
422 netatalk_cv_use_shellcheck=yes
423 AC_MSG_CHECKING([whether checking for a valid shell should be enabled])
424 AC_ARG_ENABLE(shell-check,
425 [ --disable-shell-check disable checking for a valid shell],[
426 if test "$enableval" = "no"; then
427 AC_DEFINE(DISABLE_SHELLCHECK, 1, [Define if shell check should be disabled])
429 netatalk_cv_use_shellcheck=no
439 dnl Check for optional initscript install
440 AC_DEFUN([AC_NETATALK_INIT_STYLE], [
441 AC_ARG_WITH(init-style,
442 [ --with-init-style use OS specific init config [[redhat-sysv|redhat-systemd|suse-sysv|suse-systemd|gentoo|netbsd|debian|solaris|systemd]]],
443 init_style="$withval", init_style=none
445 case "$init_style" in
447 AC_MSG_ERROR([--with-init-style=redhat is obsoleted. Use redhat-sysv or redhat-systemd.])
450 AC_MSG_RESULT([enabling redhat-style sysv initscript support])
451 ac_cv_init_dir="/etc/rc.d/init.d"
454 AC_MSG_RESULT([enabling redhat-style systemd support])
455 ac_cv_init_dir="/lib/systemd/system"
458 AC_MSG_ERROR([--with-init-style=suse is obsoleted. Use suse-sysv or suse-systemd.])
461 AC_MSG_RESULT([enabling suse-style sysv initscript support])
462 ac_cv_init_dir="/etc/init.d"
465 AC_MSG_RESULT([enabling suse-style systemd support (>=openSUSE12.1)])
466 ac_cv_init_dir="/lib/systemd/system"
469 AC_MSG_RESULT([enabling gentoo-style initscript support])
470 ac_cv_init_dir="/etc/init.d"
473 AC_MSG_RESULT([enabling netbsd-style initscript support])
474 ac_cv_init_dir="/etc/rc.d"
477 AC_MSG_RESULT([enabling debian-style initscript support])
478 ac_cv_init_dir="/etc/init.d"
481 AC_MSG_RESULT([enabling solaris-style SMF support])
482 ac_cv_init_dir="/lib/svc/manifest/network/"
485 AC_MSG_RESULT([enabling general systemd support])
486 ac_cv_init_dir="/lib/systemd/system"
489 AC_MSG_RESULT([disabling init-style support])
490 ac_cv_init_dir="none"
493 AC_MSG_ERROR([illegal init-style])
496 AM_CONDITIONAL(USE_NETBSD, test x$init_style = xnetbsd)
497 AM_CONDITIONAL(USE_REDHAT_SYSV, test x$init_style = xredhat-sysv)
498 AM_CONDITIONAL(USE_SUSE_SYSV, test x$init_style = xsuse-sysv)
499 AM_CONDITIONAL(USE_SOLARIS, test x$init_style = xsolaris)
500 AM_CONDITIONAL(USE_GENTOO, test x$init_style = xgentoo)
501 AM_CONDITIONAL(USE_DEBIAN, test x$init_style = xdebian)
502 AM_CONDITIONAL(USE_SYSTEMD, test x$init_style = xsystemd || test x$init_style = xredhat-systemd || test x$init_style = xsuse-systemd)
503 AM_CONDITIONAL(USE_UNDEF, test x$init_style = xnone)
505 AC_ARG_WITH(init-dir,
506 [ --with-init-dir=PATH path to OS specific init directory],
507 ac_cv_init_dir="$withval", ac_cv_init_dir="$ac_cv_init_dir"
509 INIT_DIR="$ac_cv_init_dir"
510 AC_SUBST(INIT_DIR, ["$ac_cv_init_dir"])
513 dnl OS specific configuration
514 AC_DEFUN([AC_NETATALK_OS_SPECIFIC], [
516 *aix*) this_os=aix ;;
517 *freebsd*) this_os=freebsd ;;
518 *hpux11*) this_os=hpux11 ;;
519 *irix*) this_os=irix ;;
520 *linux*) this_os=linux ;;
521 *osx*) this_os=macosx ;;
522 *darwin*) this_os=macosx ;;
523 *netbsd*) this_os=netbsd ;;
524 *openbsd*) this_os=openbsd ;;
525 *osf*) this_os=tru64 ;;
526 *solaris*) this_os=solaris ;;
530 i386|i486|i586|i686|k7) this_cpu=x86 ;;
531 alpha) this_cpu=alpha ;;
532 mips) this_cpu=mips ;;
533 powerpc|ppc) this_cpu=ppc ;;
536 dnl --------------------- GNU source
538 linux) AC_DEFINE(_GNU_SOURCE, 1, [Whether to use GNU libc extensions])
540 kfreebsd-gnu) AC_DEFINE(_GNU_SOURCE, 1, [Whether to use GNU libc extensions])
544 dnl --------------------- operating system specific flags (port from sys/*)
546 dnl ----- FreeBSD specific -----
547 if test x"$this_os" = "xfreebsd"; then
548 AC_MSG_RESULT([ * FreeBSD specific configuration])
549 AC_DEFINE(BSD4_4, 1, [BSD compatiblity macro])
550 AC_DEFINE(FREEBSD, 1, [Define if OS is FreeBSD])
551 AC_DEFINE(OPEN_NOFOLLOW_ERRNO, EMLINK, errno returned by open with O_NOFOLLOW)
554 dnl ----- GNU/kFreeBSD specific -----
555 if test x"$this_os" = "xkfreebsd-gnu"; then
556 AC_MSG_RESULT([ * GNU/kFreeBSD specific configuration])
557 AC_DEFINE(BSD4_4, 1, [BSD compatiblity macro])
558 AC_DEFINE(FREEBSD, 1, [Define if OS is FreeBSD])
559 AC_DEFINE(OPEN_NOFOLLOW_ERRNO, EMLINK, errno returned by open with O_NOFOLLOW)
562 dnl ----- Linux specific -----
563 if test x"$this_os" = "xlinux"; then
564 AC_MSG_RESULT([ * Linux specific configuration])
565 AC_DEFINE(LINUX, 1, [OS is Linux])
566 dnl ----- check if we need the quotactl wrapper
567 AC_CHECK_HEADERS(linux/dqblk_xfs.h,,
568 [AC_CHECK_HEADERS(linux/xqm.h linux/xfs_fs.h)
569 AC_CHECK_HEADERS(xfs/libxfs.h xfs/xqm.h xfs/xfs_fs.h)]
573 dnl ----- as far as I can tell, dbtob always does the wrong thing
574 dnl ----- on every single version of linux I've ever played with.
575 dnl ----- see etc/afpd/quota.c
576 AC_DEFINE(HAVE_BROKEN_DBTOB, 1, [Define if dbtob is broken])
581 dnl ----- NetBSD specific -----
582 if test x"$this_os" = "xnetbsd"; then
583 AC_MSG_RESULT([ * NetBSD specific configuration])
584 AC_DEFINE(BSD4_4, 1, [BSD compatiblity macro])
585 AC_DEFINE(NETBSD, 1, [Define if OS is NetBSD])
586 AC_DEFINE(OPEN_NOFOLLOW_ERRNO, EFTYPE, errno returned by open with O_NOFOLLOW)
588 CFLAGS="-I\$(top_srcdir)/sys/netbsd $CFLAGS"
591 dnl ----- NetBSD does not have crypt.h, uses unistd.h -----
592 AC_DEFINE(UAM_DHX, 1, [Define if the DHX UAM modules should be compiled])
595 dnl ----- OpenBSD specific -----
596 if test x"$this_os" = "xopenbsd"; then
597 AC_MSG_RESULT([ * OpenBSD specific configuration])
598 AC_DEFINE(BSD4_4, 1, [BSD compatiblity macro])
599 dnl ----- OpenBSD does not have crypt.h, uses unistd.h -----
600 AC_DEFINE(UAM_DHX, 1, [Define if the DHX UAM modules should be compiled])
603 dnl ----- Solaris specific -----
604 if test x"$this_os" = "xsolaris"; then
605 AC_MSG_RESULT([ * Solaris specific configuration])
606 AC_DEFINE(__svr4__, 1, [Solaris compatibility macro])
607 AC_DEFINE(_ISOC9X_SOURCE, 1, [Compatibility macro])
608 AC_DEFINE(NO_STRUCT_TM_GMTOFF, 1, [Define if the gmtoff member of struct tm is not available])
609 AC_DEFINE(SOLARIS, 1, [Solaris compatibility macro])
610 AC_DEFINE(_XOPEN_SOURCE, 600, [Solaris compilation environment])
611 AC_DEFINE(__EXTENSIONS__, 1, [Solaris compilation environment])
612 CFLAGS="-I\$(top_srcdir)/sys/generic $CFLAGS"
617 AC_MSG_CHECKING([if we can build Solaris kernel module])
618 if test -x /usr/ccs/bin/ld && test x"$netatalk_cv_ddp_enabled" = x"yes" ; then
621 AC_MSG_RESULT([$solaris_module])
623 COMPILE_64BIT_KMODULE=no
626 COMPILE_KERNEL_GCC=no
628 if test "$solaris_module" = "yes"; then
629 dnl Solaris kernel module stuff
630 AC_MSG_CHECKING([if we have to build a 64bit kernel module])
632 # check for isainfo, if not found it has to be a 32 bit kernel (<=2.6)
633 if test -x /usr/bin/isainfo; then
634 # check for 64 bit platform
635 if isainfo -kv | grep '^64-bit'; then
636 COMPILE_64BIT_KMODULE=yes
640 AC_MSG_RESULT([$COMPILE_64BIT_KMODULE])
642 if test "${GCC}" = yes; then
643 COMPILE_KERNEL_GCC=yes
644 if test "$COMPILE_64BIT_KMODULE" = yes; then
646 AC_MSG_CHECKING([if we can build a 64bit kernel module])
648 case `$CC --version 2>/dev/null` in
650 COMPILE_64BIT_KMODULE=no
651 COMPILE_KERNEL_GCC=no
656 #KLDFLAGS="-melf64_sparc"
660 AC_MSG_RESULT([$COMPILE_64BIT_KMODULE])
666 KCFLAGS="$KCFLAGS -D_KERNEL -Wall -Wstrict-prototypes"
668 if test "$COMPILE_64BIT_KMODULE" = yes; then
669 # use Sun CC (for a 64-bit kernel, uncomment " -xarch=v9 -xregs=no%appl ")
670 KCFLAGS="-xarch=v9 -xregs=no%appl"
676 KCFLAGS="-D_KERNEL $KCFLAGS -mno-app-regs -munaligned-doubles -fpcc-struct-return"
679 AC_CACHE_CHECK([for timeout_id_t],netatalk_cv_HAVE_TIMEOUT_ID_T,[
680 AC_LINK_IFELSE([AC_LANG_PROGRAM([[\
681 #include <sys/stream.h>
682 #include <sys/ddi.h>]], [[\
684 ]])],[netatalk_cv_HAVE_TIMEOUT_ID_T=yes],[netatalk_cv_HAVE_TIMEOUT_ID_T=no])])
686 AC_DEFINE(HAVE_TIMEOUT_ID_T, test x"$netatalk_cv_HAVE_TIMEOUT_ID" = x"yes", [define for timeout_id_t])
689 AC_SUBST(COMPILE_KERNEL_GCC)
690 AC_SUBST(COMPILE_64BIT_KMODULE)
695 dnl Whether to run ldconfig after installing libraries
696 AC_PATH_PROG(NETA_LDCONFIG, ldconfig, , [$PATH$PATH_SEPARATOR/sbin$PATH_SEPARATOR/bin$PATH_SEPARATOR/usr/sbin$PATH_SEPARATOR/usr/bin])
697 echo NETA_LDCONFIG = $NETA_LDCONFIG
698 AM_CONDITIONAL(RUN_LDCONFIG, test x"$this_os" = x"linux" -a x"$NETA_LDCONFIG" != x"")
701 dnl Check for building PGP UAM module
702 AC_DEFUN([AC_NETATALK_PGP_UAM], [
703 AC_MSG_CHECKING([whether the PGP UAM should be build])
704 AC_ARG_ENABLE(pgp-uam,
705 [ --enable-pgp-uam enable build of PGP UAM module],[
706 if test "$enableval" = "yes"; then
707 if test "x$neta_cv_have_openssl" = "xyes"; then
708 AC_DEFINE(UAM_PGP, 1, [Define if the PGP UAM module should be compiled])
721 dnl Check for building Kerberos V UAM module
722 AC_DEFUN([AC_NETATALK_KRB5_UAM], [
723 netatalk_cv_build_krb5_uam=no
724 AC_ARG_ENABLE(krbV-uam,
725 [ --enable-krbV-uam enable build of Kerberos V UAM module],
727 if test x"$enableval" = x"yes"; then
728 NETATALK_GSSAPI_CHECK([
729 netatalk_cv_build_krb5_uam=yes
731 AC_MSG_ERROR([need GSSAPI to build Kerberos V UAM])
738 AC_MSG_CHECKING([whether Kerberos V UAM should be build])
739 if test x"$netatalk_cv_build_krb5_uam" = x"yes"; then
744 AM_CONDITIONAL(USE_GSSAPI, test x"$netatalk_cv_build_krb5_uam" = x"yes")
747 dnl Check if we can directly use Kerberos 5 API, used for reading keytabs
748 dnl and automatically construction DirectoryService names from that, instead
749 dnl of requiring special configuration in afp.conf
750 AC_DEFUN([AC_NETATALK_KERBEROS], [
751 AC_MSG_CHECKING([for Kerberos 5 (necessary for GetSrvrInfo:DirectoryNames support)])
752 AC_ARG_WITH([kerberos],
753 [AS_HELP_STRING([--with-kerberos], [Kerberos 5 support (default=auto)])],
755 [with_kerberos=auto])
756 AC_MSG_RESULT($with_kerberos)
758 if test x"$with_kerberos" != x"no"; then
759 have_krb5_header="no"
760 AC_CHECK_HEADERS([krb5/krb5.h krb5.h], [have_krb5_header="yes"; break])
761 if test x"$have_krb5_header" = x"no" && test x"$with_kerberos" != x"auto"; then
762 AC_MSG_FAILURE([--with-kerberos was given, but no headers found])
765 AC_PATH_PROG([KRB5_CONFIG], [krb5-config])
766 AC_MSG_CHECKING([for krb5-config])
767 if test -x "$KRB5_CONFIG"; then
768 AC_MSG_RESULT([$KRB5_CONFIG])
769 KRB5_CFLAGS="`$KRB5_CONFIG --cflags krb5`"
770 KRB5_LIBS="`$KRB5_CONFIG --libs krb5`"
771 AC_SUBST(KRB5_CFLAGS)
775 AC_MSG_RESULT([not found])
776 if test x"$with_kerberos" != x"auto"; then
777 AC_MSG_FAILURE([--with-kerberos was given, but krb5-config could not be found])
782 if test x"$with_kerberos" = x"yes"; then
783 AC_DEFINE([HAVE_KERBEROS], [1], [Define if Kerberos 5 is available])
786 dnl Check for krb5_free_unparsed_name and krb5_free_error_message
787 save_CFLAGS="$CFLAGS"
789 CFLAGS="$KRB5_CFLAGS"
791 AC_CHECK_FUNCS([krb5_free_unparsed_name krb5_free_error_message krb5_free_keytab_entry_contents krb5_kt_free_entry])
792 CFLAGS="$save_CFLAGS"
796 dnl Check for overwrite the config files or not
797 AC_DEFUN([AC_NETATALK_OVERWRITE_CONFIG], [
798 AC_MSG_CHECKING([whether configuration files should be overwritten])
799 AC_ARG_ENABLE(overwrite,
800 [ --enable-overwrite overwrite configuration files during installation],
801 [OVERWRITE_CONFIG="${enable_overwrite}"],
802 [OVERWRITE_CONFIG="no"]
804 AC_MSG_RESULT([$OVERWRITE_CONFIG])
805 AC_SUBST(OVERWRITE_CONFIG)
808 dnl Check for LDAP support, for client-side ACL visibility
809 AC_DEFUN([AC_NETATALK_LDAP], [
810 AC_MSG_CHECKING(for LDAP (necessary for client-side ACL visibility))
812 [AS_HELP_STRING([--with-ldap],
813 [LDAP support (default=auto)])],
814 netatalk_cv_ldap=$withval,
815 netatalk_cv_ldap=auto
817 AC_MSG_RESULT($netatalk_cv_ldap)
819 save_CFLAGS="$CFLAGS"
820 save_LDFLAGS="$LDFLAGS"
829 if test x"$netatalk_cv_ldap" != x"no" ; then
830 if test x"$netatalk_cv_ldap" != x"yes" -a x"$netatalk_cv_ldap" != x"auto"; then
831 CFLAGS="-I$netatalk_cv_ldap/include"
832 LDFLAGS="-L$netatalk_cv_ldap/lib"
834 AC_CHECK_HEADER([ldap.h], netatalk_cv_ldap=yes,
835 [ if test x"$netatalk_cv_ldap" = x"yes" ; then
836 AC_MSG_ERROR([Missing LDAP headers])
840 AC_CHECK_LIB(ldap, ldap_init, netatalk_cv_ldap=yes,
841 [ if test x"$netatalk_cv_ldap" = x"yes" ; then
842 AC_MSG_ERROR([Missing LDAP library])
848 if test x"$netatalk_cv_ldap" = x"yes"; then
849 LDAP_CFLAGS="$CFLAGS"
850 LDAP_LDFLAGS="$LDFLAGS"
852 AC_DEFINE(HAVE_LDAP,1,[Whether LDAP is available])
855 AC_SUBST(LDAP_CFLAGS)
856 AC_SUBST(LDAP_LDFLAGS)
858 CFLAGS="$save_CFLAGS"
859 LDFLAGS="$save_LDFLAGS"
863 dnl Check for ACL support
864 AC_DEFUN([AC_NETATALK_ACL], [
865 AC_MSG_CHECKING(whether to support ACLs)
867 [AS_HELP_STRING([--with-acls],
868 [Include ACL support (default=auto)])],
871 with_acl_support="$withval"
874 with_acl_support=auto
877 [with_acl_support=auto])
878 AC_MSG_RESULT($with_acl_support)
880 if test x"$with_acl_support" = x"no"; then
881 AC_MSG_RESULT(Disabling ACL support)
882 AC_DEFINE(HAVE_NO_ACLS,1,[Whether no ACLs support should be built in])
887 if test x"$with_acl_support" = x"yes" ; then
888 AC_MSG_NOTICE(checking whether ACL support is available:)
891 AC_MSG_NOTICE(Using UnixWare ACLs)
892 AC_DEFINE(HAVE_UNIXWARE_ACLS,1,[Whether UnixWare ACLs are available])
895 AC_MSG_NOTICE(Using solaris ACLs)
896 AC_DEFINE(HAVE_SOLARIS_ACLS,1,[Whether solaris ACLs are available])
897 ACL_LIBS="$ACL_LIBS -lsec"
900 AC_MSG_NOTICE(Using HPUX ACLs)
901 AC_DEFINE(HAVE_HPUX_ACLS,1,[Whether HPUX ACLs are available])
904 AC_MSG_NOTICE(Using IRIX ACLs)
905 AC_DEFINE(HAVE_IRIX_ACLS,1,[Whether IRIX ACLs are available])
908 AC_MSG_NOTICE(Using AIX ACLs)
909 AC_DEFINE(HAVE_AIX_ACLS,1,[Whether AIX ACLs are available])
912 AC_MSG_NOTICE(Using Tru64 ACLs)
913 AC_DEFINE(HAVE_TRU64_ACLS,1,[Whether Tru64 ACLs are available])
914 ACL_LIBS="$ACL_LIBS -lpacl"
917 AC_MSG_NOTICE(ACLs on Darwin currently not supported)
918 AC_DEFINE(HAVE_NO_ACLS,1,[Whether no ACLs support is available])
921 AC_CHECK_LIB(acl,acl_get_file,[ACL_LIBS="$ACL_LIBS -lacl"])
924 AC_CHECK_LIB(attr,getxattr,[ACL_LIBS="$ACL_LIBS -lattr"])
927 AC_CACHE_CHECK([for POSIX ACL support],netatalk_cv_HAVE_POSIX_ACLS,[
929 LIBS="$LIBS $ACL_LIBS"
930 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
931 #include <sys/types.h>
936 acl_entry_t *entry_p;
937 return acl_get_entry(acl, entry_id, entry_p);
938 ]])],[netatalk_cv_HAVE_POSIX_ACLS=yes],[netatalk_cv_HAVE_POSIX_ACLS=no
939 with_acl_support=no])
942 if test x"$netatalk_cv_HAVE_POSIX_ACLS" = x"yes"; then
943 AC_MSG_NOTICE(Using POSIX ACLs)
944 AC_DEFINE(HAVE_POSIX_ACLS,1,[Whether POSIX ACLs are available])
945 AC_CACHE_CHECK([for acl_get_perm_np],netatalk_cv_HAVE_ACL_GET_PERM_NP,[
947 LIBS="$LIBS $ACL_LIBS"
948 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
949 #include <sys/types.h>
952 acl_permset_t permset_d;
954 return acl_get_perm_np(permset_d, perm);
955 ]])],[netatalk_cv_HAVE_ACL_GET_PERM_NP=yes],[netatalk_cv_HAVE_ACL_GET_PERM_NP=no])
958 if test x"$netatalk_cv_HAVE_ACL_GET_PERM_NP" = x"yes"; then
959 AC_DEFINE(HAVE_ACL_GET_PERM_NP,1,[Whether acl_get_perm_np() is available])
963 AC_CACHE_CHECK([for acl_from_mode], netatalk_cv_HAVE_ACL_FROM_MODE,[
965 LIBS="$LIBS $ACL_LIBS"
966 AC_CHECK_FUNCS(acl_from_mode,
967 [netatalk_cv_HAVE_ACL_FROM_MODE=yes],
968 [netatalk_cv_HAVE_ACL_FROM_MODE=no])
971 if test x"netatalk_cv_HAVE_ACL_FROM_MODE" = x"yes"; then
972 AC_DEFINE(HAVE_ACL_FROM_MODE,1,[Whether acl_from_mode() is available])
976 AC_MSG_NOTICE(ACL support is not avaliable)
977 AC_DEFINE(HAVE_NO_ACLS,1,[Whether no ACLs support is available])
983 if test x"$with_acl_support" = x"yes" ; then
984 AC_CHECK_HEADERS([acl/libacl.h])
985 AC_DEFINE(HAVE_ACLS,1,[Whether ACLs support is available])
990 dnl Check for Extended Attributes support
991 AC_DEFUN([AC_NETATALK_EXTENDED_ATTRIBUTES], [
993 neta_cv_eas_sys_found=no
994 neta_cv_eas_sys_not_found=no
996 AC_CHECK_HEADERS(sys/attributes.h attr/xattr.h sys/xattr.h sys/extattr.h sys/uio.h sys/ea.h)
1001 AC_SEARCH_LIBS(getproplist, [proplist])
1002 AC_CHECK_FUNCS([getproplist fgetproplist setproplist fsetproplist],
1003 [neta_cv_eas_sys_found=yes],
1004 [neta_cv_eas_sys_not_found=yes])
1005 AC_CHECK_FUNCS([delproplist fdelproplist add_proplist_entry get_proplist_entry],,
1006 [neta_cv_eas_sys_not_found=yes])
1007 AC_CHECK_FUNCS([sizeof_proplist_entry],,
1008 [neta_cv_eas_sys_not_found=yes])
1012 AC_CHECK_FUNCS([attropen],
1013 [neta_cv_eas_sys_found=yes; AC_DEFINE(HAVE_EAFD, 1, [extattr API has full fledged fds for EAs])],
1014 [neta_cv_eas_sys_not_found=yes])
1018 AC_CHECK_FUNCS([extattr_delete_fd extattr_delete_file extattr_delete_link],
1019 [neta_cv_eas_sys_found=yes],
1020 [neta_cv_eas_sys_not_found=yes])
1021 AC_CHECK_FUNCS([extattr_get_fd extattr_get_file extattr_get_link],,
1022 [neta_cv_eas_sys_not_found=yes])
1023 AC_CHECK_FUNCS([extattr_list_fd extattr_list_file extattr_list_link],,
1024 [neta_cv_eas_sys_not_found=yes])
1025 AC_CHECK_FUNCS([extattr_set_fd extattr_set_file extattr_set_link],,
1026 [neta_cv_eas_sys_not_found=yes])
1029 *freebsd4* | *dragonfly* )
1030 AC_DEFINE(BROKEN_EXTATTR, 1, [Does extattr API work])
1034 AC_SEARCH_LIBS(getxattr, [attr])
1036 if test "x$neta_cv_eas_sys_found" != "xyes" ; then
1037 AC_CHECK_FUNCS([getxattr lgetxattr fgetxattr listxattr llistxattr],
1038 [neta_cv_eas_sys_found=yes],
1039 [neta_cv_eas_sys_not_found=yes])
1040 AC_CHECK_FUNCS([flistxattr removexattr lremovexattr fremovexattr],,
1041 [neta_cv_eas_sys_not_found=yes])
1042 AC_CHECK_FUNCS([setxattr lsetxattr fsetxattr],,
1043 [neta_cv_eas_sys_not_found=yes])
1046 if test "x$neta_cv_eas_sys_found" != "xyes" ; then
1047 AC_CHECK_FUNCS([getea fgetea lgetea listea flistea llistea],
1048 [neta_cv_eas_sys_found=yes],
1049 [neta_cv_eas_sys_not_found=yes])
1050 AC_CHECK_FUNCS([removeea fremoveea lremoveea setea fsetea lsetea],,
1051 [neta_cv_eas_sys_not_found=yes])
1054 if test "x$neta_cv_eas_sys_found" != "xyes" ; then
1055 AC_CHECK_FUNCS([attr_get attr_list attr_set attr_remove],,
1056 [neta_cv_eas_sys_not_found=yes])
1057 AC_CHECK_FUNCS([attr_getf attr_listf attr_setf attr_removef],,
1058 [neta_cv_eas_sys_not_found=yes])
1063 # Do xattr functions take additional options like on Darwin?
1064 if test x"$ac_cv_func_getxattr" = x"yes" ; then
1065 AC_CACHE_CHECK([whether xattr interface takes additional options], smb_attr_cv_xattr_add_opt, [
1067 LIBS="$LIBS $ACL_LIBS"
1068 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1069 #include <sys/types.h>
1070 #if HAVE_ATTR_XATTR_H
1071 #include <attr/xattr.h>
1072 #elif HAVE_SYS_XATTR_H
1073 #include <sys/xattr.h>
1076 getxattr(0, 0, 0, 0, 0, 0);
1077 ]])],[smb_attr_cv_xattr_add_opt=yes],[smb_attr_cv_xattr_add_opt=no;LIBS=$old_LIBS])
1079 if test x"$smb_attr_cv_xattr_add_opt" = x"yes"; then
1080 AC_DEFINE(XATTR_ADD_OPT, 1, [xattr functions have additional options])
1084 if test "x$neta_cv_eas_sys_found" = "xyes" ; then
1085 if test "x$neta_cv_eas_sys_not_found" != "xyes" ; then
1086 neta_cv_eas="$neta_cv_eas | sys"
1089 AC_DEFINE_UNQUOTED(EA_MODULES,["$neta_cv_eas"],[Available Extended Attributes modules])
1092 dnl Check for libsmbsharemodes from Samba for Samba/Netatalk access/deny/share modes interop
1093 dnl Defines "neta_cv_have_smbshmd" to "yes" or "no"
1094 dnl AC_SUBST's "SMB_SHAREMODES_CFLAGS" and "SMB_SHAREMODES_LDFLAGS"
1095 dnl AM_CONDITIONAL's "USE_SMB_SHAREMODES"
1096 AC_DEFUN([AC_NETATALK_SMB_SHAREMODES], [
1097 neta_cv_have_smbshmd=no
1098 AC_ARG_WITH(smbsharemodes-lib,
1099 [ --with-smbsharemodes-lib=PATH PATH to libsmbsharemodes lib from Samba],
1100 [SMB_SHAREMODES_LDFLAGS="-L$withval -lsmbsharemodes"]
1102 AC_ARG_WITH(smbsharemodes-include,
1103 [ --with-smbsharemodes-include=PATH PATH to libsmbsharemodes header from Samba],
1104 [SMB_SHAREMODES_CFLAGS="-I$withval"]
1106 AC_ARG_WITH(smbsharemodes,
1107 [AS_HELP_STRING([--with-smbsharemodes],[Samba interop (default is yes)])],
1108 [use_smbsharemodes=$withval],
1109 [use_smbsharemodes=yes]
1112 if test x"$use_smbsharemodes" = x"yes" ; then
1113 AC_MSG_CHECKING([whether to enable Samba/Netatalk access/deny/share-modes interop])
1115 saved_CFLAGS="$CFLAGS"
1116 saved_LDFLAGS="$LDFLAGS"
1117 CFLAGS="$SMB_SHAREMODES_CFLAGS $CFLAGS"
1118 LDFLAGS="$SMB_SHAREMODES_LDFLAGS $LDFLAGS"
1121 [#include <unistd.h>
1123 #include <sys/time.h>
1126 /* From messages.h */
1130 #include "smb_share_modes.h"
1131 int main(void) { (void)smb_share_mode_db_open(""); return 0;}],
1132 [neta_cv_have_smbshmd=yes]
1135 AC_MSG_RESULT($neta_cv_have_smbshmd)
1136 AC_SUBST(SMB_SHAREMODES_CFLAGS, [$SMB_SHAREMODES_CFLAGS])
1137 AC_SUBST(SMB_SHAREMODES_LDFLAGS, [$SMB_SHAREMODES_LDFLAGS])
1138 CFLAGS="$saved_CFLAGS"
1139 LDFLAGS="$saved_LDFLAGS"
1142 AM_CONDITIONAL(USE_SMB_SHAREMODES, test x"$neta_cv_have_smbshmd" = x"yes")
1145 dnl ------ Check for sendfile() --------
1146 AC_DEFUN([AC_NETATALK_SENDFILE], [
1147 netatalk_cv_search_sendfile=yes
1148 AC_ARG_ENABLE(sendfile,
1149 [ --disable-sendfile disable sendfile syscall],
1150 [if test x"$enableval" = x"no"; then
1151 netatalk_cv_search_sendfile=no
1155 if test x"$netatalk_cv_search_sendfile" = x"yes"; then
1158 AC_DEFINE(SENDFILE_FLAVOR_LINUX,1,[Whether linux sendfile() API is available])
1159 AC_CHECK_FUNC([sendfile], [netatalk_cv_HAVE_SENDFILE=yes])
1163 AC_DEFINE(SENDFILE_FLAVOR_SOLARIS, 1, [Solaris sendfile()])
1164 AC_SEARCH_LIBS(sendfile, sendfile)
1165 AC_CHECK_FUNC([sendfile], [netatalk_cv_HAVE_SENDFILE=yes])
1166 AC_CHECK_FUNCS([sendfilev])
1170 AC_DEFINE(SENDFILE_FLAVOR_BSD, 1, [Define if the sendfile() function uses BSD semantics])
1171 AC_CHECK_FUNC([sendfile], [netatalk_cv_HAVE_SENDFILE=yes])
1179 if test x"$netatalk_cv_HAVE_SENDFILE" = x"yes"; then
1180 AC_DEFINE(WITH_SENDFILE,1,[Whether sendfile() should be used])
1185 dnl --------------------- Check if realpath() takes NULL
1186 AC_DEFUN([AC_NETATALK_REALPATH], [
1187 AC_CACHE_CHECK([if the realpath function allows a NULL argument],
1188 neta_cv_REALPATH_TAKES_NULL, [
1189 AC_RUN_IFELSE([AC_LANG_SOURCE([[
1194 void exit_on_core(int ignored) {
1200 signal(SIGSEGV, exit_on_core);
1201 newpath = realpath("/tmp", NULL);
1202 exit((newpath != NULL) ? 0 : 1);
1203 }]])],[neta_cv_REALPATH_TAKES_NULL=yes],[neta_cv_REALPATH_TAKES_NULL=no],[neta_cv_REALPATH_TAKES_NULL=cross
1208 if test x"$neta_cv_REALPATH_TAKES_NULL" = x"yes"; then
1209 AC_DEFINE(REALPATH_TAKES_NULL,1,[Whether the realpath function allows NULL])