]> arthur.barton.de Git - netatalk.git/blob - configure.ac
Spelling fix in log message: continous -> continuous
[netatalk.git] / configure.ac
1 dnl configure.in for netatalk
2
3 AC_INIT(etc/afpd/main.c)
4
5 NETATALK_VERSION=`cat $srcdir/VERSION`
6 AC_SUBST(NETATALK_VERSION)
7
8 AC_CANONICAL_SYSTEM
9 AM_INIT_AUTOMAKE(netatalk, ${NETATALK_VERSION})
10 AM_CONFIG_HEADER(config.h)
11 AM_MAINTAINER_MODE([enable])
12
13 dnl Checks for programs.
14 AC_PROG_AWK
15 AC_PROG_CC
16 AC_PROG_CC_C99
17 AC_PROG_INSTALL
18 AC_PROG_LN_S
19 AC_PROG_MAKE_SET
20 AC_LIBTOOL_DLOPEN
21 AC_PROG_LIBTOOL
22 AC_PROG_PERL
23 AC_PROG_GREP
24 AC_PROG_PS
25
26 AM_PROG_CC_C_O
27
28 dnl Checks for header files.
29 AC_HEADER_DIRENT
30 AC_HEADER_STDC
31 AC_HEADER_SYS_WAIT
32 AC_CHECK_HEADERS(fcntl.h limits.h stdint.h strings.h time.h sys/param.h sys/fcntl.h sys/file.h sys/ioctl.h sys/time.h sys/mnttab.h sys/statvfs.h sys/stat.h sys/vfs.h mntent.h syslog.h unistd.h termios.h sys/termios.h netdb.h sgtty.h ufs/quota.h mount.h statfs.h sys/types.h dlfcn.h errno.h sys/errno.h sys/uio.h langinfo.h locale.h sys/filio.h)
33 AC_CHECK_HEADER(sys/cdefs.h,,
34         AC_MSG_RESULT([enabling generic cdefs.h from tree])
35         CFLAGS="-I\$(top_srcdir)/sys/generic $CFLAGS"
36 )
37 AC_CHECK_HEADERS([sys/mount.h], , , 
38 [#ifdef HAVE_SYS_PARAM_H
39 #include <sys/param.h>
40 #endif
41 ])
42
43 dnl Checks for typedefs, structures, and compiler characteristics.
44 AC_C_CONST
45 AC_TYPE_UID_T
46 AC_C_INLINE
47 AC_TYPE_MODE_T
48 AC_TYPE_OFF_T
49 AC_TYPE_PID_T
50 AC_TYPE_SIZE_T
51 AC_STRUCT_ST_RDEV
52 AC_HEADER_TIME
53 AC_STRUCT_TM
54
55 dnl --------------------------------------------------------------------------
56 dnl check if dlsym needs to add an underscore, uses libtool macros 
57 dnl --------------------------------------------------------------------------
58 AC_LTDL_DLLIB
59 AC_CHECK_FUNCS(dlopen dlsym dlclose)
60 AC_LTDL_DLSYM_USCORE
61 if test x"$libltdl_cv_need_uscore" = xyes; then
62     AC_DEFINE(DLSYM_PREPEND_UNDERSCORE, 1, [BSD compatibility macro])
63 fi
64
65 dnl Checks for library functions.
66 AC_TYPE_GETGROUPS
67 AC_PROG_GCC_TRADITIONAL
68 AC_FUNC_MEMCMP
69 AC_HEADER_MAJOR
70 AC_FUNC_MMAP
71 AC_TYPE_SIGNAL
72 AC_FUNC_UTIME_NULL
73 AC_FUNC_WAIT3
74 AC_CHECK_FUNCS(getcwd gethostname gettimeofday getusershell mkdir rmdir select socket strdup strcasestr strstr strtoul strchr memcpy)
75 AC_CHECK_FUNCS(backtrace_symbols setlocale nl_langinfo strlcpy strlcat setlinebuf dirfd pselect access pread pwrite)
76 AC_CHECK_FUNCS(waitpid getcwd strdup strndup strnlen strtoul strerror chown fchown chmod fchmod chroot link mknod mknod64)
77 ac_neta_haveatfuncs=yes
78 AC_CHECK_FUNCS(openat renameat fstatat unlinkat, , ac_neta_haveatfuncs=no)
79 if test x"$ac_neta_haveatfuncs" = x"yes" ; then
80    AC_DEFINE([_ATFILE_SOURCE], 1, AT file source)
81    AC_DEFINE([HAVE_ATFUNCS], 1, whether at funcs are available)
82 fi
83
84 AC_CHECK_MEMBERS(struct tm.tm_gmtoff,,, [#include <time.h>])
85
86 AC_CHECK_FUNC(gethostbyname,,[AC_CHECK_LIB(nsl,gethostbyname)])
87 AC_CHECK_FUNC(connect,,[AC_CHECK_LIB(socket,connect)])
88 dnl search for necessary libs for libpthread stuff
89 AC_SEARCH_LIBS(pthread_sigmask, pthread,, 
90                [AC_MSG_ERROR([cannot find pthread_sigmask in libc or libpthread])])
91 if test x"$ac_cv_search_pthread_sigmask" != x"none required" ; then
92    PTHREAD_LIBS=$ac_cv_search_pthread_sigmask
93 fi
94 AC_SUBST(PTHREAD_LIBS)
95 AC_CACHE_SAVE
96
97 dnl Checks for (v)snprintf
98 NETATALK_SNPRINTF_CHECK
99
100 dnl --------------------------------------------------------------------------
101 dnl 64bit platform check
102 dnl --------------------------------------------------------------------------
103
104 AC_MSG_CHECKING([whether to check for 64bit libraries])
105 # Test if the compiler is in 64bit mode
106 echo 'int i;' > conftest.$ac_ext
107 atalk_cv_cc_64bit_output=no
108 if AC_TRY_EVAL(ac_compile); then
109     case `/usr/bin/file conftest.$ac_objext` in
110     *"ELF 64"*)
111       atalk_cv_cc_64bit_output=yes
112       ;;
113     esac
114 fi
115 rm -rf conftest*
116
117 case $host_cpu:$atalk_cv_cc_64bit_output in
118 powerpc64:yes | s390x:yes | sparc*:yes | x86_64:yes | i386:yes)
119     case $target_os in
120     solaris2*)
121         AC_MSG_RESULT([yes])
122         atalk_libname="lib/64"
123         ;;
124     *bsd* | dragonfly*)
125         AC_MSG_RESULT([no])
126         atalk_libname="lib"
127         ;;
128     *)
129         AC_MSG_RESULT([yes])
130         atalk_libname="lib64"
131         ;;
132     esac
133     ;;
134 *:*)
135     AC_MSG_RESULT([no])
136     atalk_libname="lib"
137     ;;
138 esac
139
140 dnl --------------------------------------------------------------------------
141 dnl specific configuration comes in here:
142 dnl --------------------------------------------------------------------------
143
144
145 netatalk_cv_admin_group=yes
146 AC_MSG_CHECKING([for administrative group support])
147 AC_ARG_ENABLE(admin-group,
148         [  --disable-admin-group   disable admin group],[
149         if test x"$enableval" = x"no"; then
150                 AC_DEFINE(ADMIN_GRP, 0, [Define if the admin group should be enabled])
151                 netatalk_cv_admin_group=no
152                 AC_MSG_RESULT([no])
153         else
154                 AC_DEFINE(ADMIN_GRP, 1, [Define if the admin group should be enabled])
155                 AC_MSG_RESULT([yes])
156         fi],[
157                 AC_DEFINE(ADMIN_GRP, 1, [Define if the admin group should be enabled])
158                 AC_MSG_RESULT([yes])
159         ]
160 )
161
162 NETATALK_AFS_CHECK
163
164 NETATALK_CONFIG_DIRS
165
166 netatalk_cv_with_cracklib=no
167 AC_ARG_WITH(cracklib,
168         [  --with-cracklib=DICT    enable/set location of cracklib dictionary],[
169         if test "x$withval" != "xno" ; then
170                 cracklib="$withval"
171                 AC_CHECK_LIB(crack, main, [
172                         AC_DEFINE(USE_CRACKLIB, 1, [Define if cracklib should be used])
173                         LIBS="$LIBS -lcrack"
174                         if test "$cracklib" = "yes"; then
175                                 cracklib="/usr/$atalk_libname/cracklib_dict"
176                         fi
177                         AC_DEFINE_UNQUOTED(_PATH_CRACKLIB, "$cracklib",
178                                 [path to cracklib dictionary])
179                         AC_MSG_RESULT([setting cracklib dictionary to $cracklib])
180                         netatalk_cv_with_cracklib=yes
181                         ],[
182                         AC_MSG_ERROR([cracklib not found!])
183                         ]
184                 )
185         fi
186         ]
187 )
188 AC_MSG_CHECKING([for cracklib support])
189 AC_MSG_RESULT([$netatalk_cv_with_cracklib])
190
191 netatalk_cv_ddp_enabled=no
192 AC_MSG_CHECKING([whether to enable DDP])
193 AC_ARG_ENABLE(ddp,
194         [  --enable-ddp            enable DDP (AppleTalk)],[
195         if test "$enableval" = "yes"; then 
196                 AC_MSG_RESULT([yes])
197                 netatalk_cv_ddp_enabled=yes
198         else
199                 AC_MSG_RESULT([yes])
200                 AC_DEFINE(NO_DDP, 1, [Define if DDP should be disabled])
201         fi
202         ],[
203                 AC_MSG_RESULT([no])
204                 AC_DEFINE(NO_DDP, 1, [Define if DDP should be disabled])
205         ]
206 )
207
208 AC_MSG_CHECKING([whether to enable debug code])
209 AC_ARG_ENABLE(debug1,
210         [  --enable-debug1         enable debug code],[
211         if test "$enableval" != "no"; then
212                 if test "$enableval" = "yes"; then
213                         AC_DEFINE(DEBUG1, 1, [Define if debugging information should be included])
214                 else
215                         AC_DEFINE_UNQUOTED(DEBUG1, $enableval, [Define if debugging information should be included])
216                 fi 
217                 AC_MSG_RESULT([yes])
218         else
219                 AC_MSG_RESULT([no])
220         fi
221         ],[
222                 AC_MSG_RESULT([no])
223         ]
224 )
225
226 AC_MSG_CHECKING([whether to enable verbose debug code])
227 AC_ARG_ENABLE(debug,
228         [  --enable-debug          enable verbose debug code],[
229         if test "$enableval" != "no"; then
230                 if test "$enableval" = "yes"; then
231                         AC_DEFINE(DEBUG, 1, [Define if verbose debugging information should be included])
232                 else
233                         AC_DEFINE_UNQUOTED(DEBUG, $enableval, [Define if verbose debugging information should be included])
234                 fi 
235                 AC_MSG_RESULT([yes])
236         else
237                 AC_MSG_RESULT([no])
238         AC_DEFINE(NDEBUG, 1, [Disable assertions])
239         fi
240         ],[
241                 AC_MSG_RESULT([no])
242         AC_DEFINE(NDEBUG, 1, [Disable assertions])
243         ]
244 )
245
246 AC_MSG_CHECKING([whether to enable debugging with debuggers])
247 AC_ARG_ENABLE(debugging,
248         [  --enable-debugging      disable SIGALRM timers and DSI tickles (eg for debugging with gdb/dbx/...)],[
249         if test "$enableval" != "no"; then
250                 if test "$enableval" = "yes"; then
251                         AC_DEFINE(DEBUGGING, 1, [Define if you want to disable SIGALRM timers and DSI tickles])
252                 else
253                         AC_DEFINE_UNQUOTED(DEBUGGING, $enableval, [Define if you want to disable SIGALRM timers and DSI tickles])
254                 fi 
255                 AC_MSG_RESULT([yes])
256         else
257                 AC_MSG_RESULT([no])
258         fi
259         ],[
260                 AC_MSG_RESULT([no])
261         ]
262 )
263
264 AC_SYS_LARGEFILE([], AC_MSG_ERROR([AFP 3.x support requires Large File Support.]))
265 AC_CHECK_ICONV
266
267 dnl ----------- A NOTE ABOUT DROPKLUDGE
268 dnl The trouble with this fix is that if you know what the file is called, it
269 dnl can be read from the Unix side.  That's okay for most academic institutions
270 dnl since the students don't have telnet access to the Mac servers.  There is
271 dnl currently no one working on further development/fixes of DROPKLUDGE.
272 dnl -----------
273
274 netatalk_cv_dropkludge=no
275 AC_MSG_CHECKING([whether to enable experimental dropbox support])
276 AC_ARG_ENABLE(dropkludge,
277         [  --enable-dropkludge     enable the experimental dropbox fix (INSECURE!) ],[
278         if test "$enableval" = "yes"; then 
279                 AC_DEFINE(DROPKLUDGE, 1, [Define if you want to use the experimental dropkludge support])
280                 AC_MSG_RESULT([yes])
281                 netatalk_cv_dropkludge=yes
282         else
283                 AC_MSG_RESULT([no])
284         fi
285         ],[
286                 AC_MSG_RESULT([no])
287         ]
288 )
289
290 netatalk_cv_force_uidgid=no
291 AC_MSG_CHECKING([whether to enable forcing of uid/gid per volume])
292 AC_ARG_ENABLE(force-uidgid,
293         [  --enable-force-uidgid   allow forcing of uid/gid per volume (BROKEN) ],[
294         if test "$enableval" = "yes"; then
295                 AC_DEFINE(FORCE_UIDGID, 1, [Define if you want forcing of uid/gid per volume])
296                 AC_MSG_RESULT([enabling forcing of uid/gid per volume])
297                 AC_MSG_RESULT([yes])
298                 netatalk_cv_force_uidgid=yes
299         else
300                 AC_MSG_RESULT([no])
301         fi
302         ],[
303                 AC_MSG_RESULT([no])
304         ]
305 )
306
307 dnl Check for CNID database backends
308 bdb_required=no
309 AC_NETATALK_CNID([bdb_required=yes],[bdb_required=no])
310
311 dnl Check for quota support
312 AC_CHECK_QUOTA
313
314 dnl Check for optional server location protocol support (used by MacOS X)
315 NETATALK_SRVLOC
316
317 dnl Check for optional Zeroconf support
318 NETATALK_ZEROCONF
319
320 dnl Check for PAM libs
321 netatalk_cv_use_pam=no
322 AC_PATH_PAM([
323         use_pam_so=yes
324         compile_pam=yes
325         netatalk_cv_use_pam=yes
326         AC_DEFINE(USE_PAM, 1, [Define to enable PAM support])
327 ])
328
329 netatalk_cv_use_shadowpw=no
330 AC_ARG_WITH(shadow,
331         [  --with-shadow           enable shadow password support [[auto]]],
332         [netatalk_cv_use_shadowpw="$withval"],
333         [netatalk_cv_use_shadowpw=auto]
334 )
335
336 if test "x$netatalk_cv_use_shadowpw" != "xno"; then
337     AC_CHECK_HEADER([shadow.h])
338     if test x"$ac_cv_header_shadow_h" = x"yes"; then
339         netatalk_cv_use_shadowpw=yes
340         AC_DEFINE(SHADOWPW, 1, [Define if shadow passwords should be used])
341     else 
342       if test "x$shadowpw" = "xyes"; then
343         AC_MSG_ERROR([shadow support not available])
344       else
345         netatalk_cv_use_shadowpw=no
346       fi
347     fi 
348 fi
349
350 AC_MSG_CHECKING([whether shadow support should be enabled])
351 if test "x$netatalk_cv_use_shadowpw" = "xyes"; then
352         AC_MSG_RESULT([yes])
353 else
354         AC_MSG_RESULT([no])
355 fi
356         
357         
358         
359 netatalk_cv_use_shellcheck=yes
360 AC_MSG_CHECKING([whether checking for a valid shell should be enabled])
361 AC_ARG_ENABLE(shell-check,
362         [  --disable-shell-check   disable checking for a valid shell],[
363         if test "$enableval" = "no"; then 
364                 AC_DEFINE(DISABLE_SHELLCHECK, 1, [Define if shell check should be disabled])
365                 AC_MSG_RESULT([no])
366                 netatalk_cv_use_shellcheck=no
367         else
368                 AC_MSG_RESULT([yes])
369         fi
370         ],[
371                 AC_MSG_RESULT([yes])
372         ]
373 )
374
375 NETATALK_TCP_WRAPPERS
376
377 AC_MSG_CHECKING([whether system (fcntl) locking should be disabled])
378 AC_ARG_ENABLE(locking,
379         [  --disable-locking       disable system locking],[
380                 if test "$enableval" = "no"; then
381                         AC_DEFINE(DISABLE_LOCKING, 1, [Define if system (fcntl) locking should be disabled])
382                         AC_MSG_RESULT([yes])
383                 else
384                         AC_MSG_RESULT([no])
385                 fi
386                 
387         ],[
388                 AC_MSG_RESULT([no])
389         ]
390
391 )
392
393 AC_ARG_ENABLE(redhat,
394         [  --enable-redhat         obsoleted ],[
395         echo "ERROR: --enable-redhat is obsoleted. Use --enable-redhat-sysv or --enable-redhat-systemd."
396         exit 1
397         ]
398 )
399
400 AC_ARG_ENABLE(redhat-sysv,
401         [  --enable-redhat-sysv    use redhat-style sysv (upstart) configuration ],[
402         if test "$enableval" = "yes"; then
403                 sysv_style=redhat-sysv
404         fi
405         AC_MSG_RESULT([enabling redhat-style sysv support])
406         ]
407 )
408
409 AC_ARG_ENABLE(redhat-systemd,
410         [  --enable-redhat-systemd use redhat-style systemd (>=Fedora15) configuration ],[
411         if test "$enableval" = "yes"; then
412                 sysv_style=redhat-systemd
413         fi
414         AC_MSG_RESULT([enabling redhat-style systemd support])
415         ]
416 )
417
418 AC_ARG_ENABLE(suse,
419         [  --enable-suse           obsoleted ],[
420         echo "ERROR: --enable-suse is obsoleted. Use --enable-suse-sysv or --enable-suse-systemd."
421         exit 1
422         ]
423 )
424
425 AC_ARG_ENABLE(suse-sysv,
426         [  --enable-suse-sysv      use suse-style sysv configuration ],[
427         if test "$enableval" = "yes"; then
428                 sysv_style=suse-sysv
429         fi
430         AC_MSG_RESULT([enabling suse-style sysv support])
431         ]
432 )
433
434 AC_ARG_ENABLE(suse-systemd,
435         [  --enable-suse-systemd   use suse-style systemd (>=openSUSE12.1) configuration ],[
436         if test "$enableval" = "yes"; then
437                 sysv_style=suse-systemd
438         fi
439         AC_MSG_RESULT([enabling suse-style systemd support])
440         ]
441 )
442
443 AC_ARG_ENABLE(gentoo,
444         [  --enable-gentoo         use gentoo-style sysv configuration ],[
445         if test "$enableval" = "yes"; then
446                 sysv_style=gentoo
447         fi
448         AC_MSG_RESULT([enabling gentoo-style sysv support])
449         ]
450 )
451
452 AC_ARG_ENABLE(netbsd,
453         [  --enable-netbsd         use NetBSD-style rc.d configuration ],
454         if test "x$enableval" = "xyes"; then
455                 sysv_style=netbsd
456         fi
457         AC_MSG_RESULT([enabling NetBSD-style rc.d support])
458 )
459
460 AC_ARG_ENABLE(debian,
461         [  --enable-debian         use debian-style sysv configuration ],[
462         if test "$enableval" = "yes"; then
463                 sysv_style=debian
464         fi
465         AC_MSG_RESULT([enabling debian-style sysv support])
466         ]
467 )
468
469 AC_ARG_ENABLE(systemd,
470         [  --enable-systemd        use general systemd configuration],[
471         if test "$enableval" = "yes"; then
472                 sysv_style=systemd
473         fi
474         AC_MSG_RESULT([enabling general systemd support])
475         ]
476 )
477
478 dnl ----- timelord compilation (disabled by default)
479 AC_MSG_CHECKING([whether timelord should be compiled])
480 compile_timelord=no
481 AC_ARG_ENABLE(timelord,
482         [  --enable-timelord       enable compilation of timelord server],
483         [compile_timelord="$enableval"],
484         [compile_timelord="no"]
485 )
486 AC_MSG_RESULT([$compile_timelord])
487
488 dnl ----- a2boot compilation (disabled by default)
489 AC_MSG_CHECKING([whether a2boot should be compiled])
490 compile_a2boot=no
491 AC_ARG_ENABLE(a2boot,
492         [  --enable-a2boot         enable compilation of Apple2 boot server],
493         [compile_a2boot="$enableval"],
494         [compile_a2boot="no"]
495 )
496 AC_MSG_RESULT([$compile_a2boot])
497
498 AC_ARG_WITH(uams-path,
499         [  --with-uams-path=PATH   path to UAMs [[PKGCONF/uams]]],[
500                 uams_path="$withval"
501         ],[
502                 uams_path="${PKGCONFDIR}/uams"
503         ]
504 )
505
506 NETATALK_AC_CUPS
507
508 dnl check if we can use attribute unused (gcc only) from ethereal
509 AC_MSG_CHECKING(to see if we can add '__attribute__((unused))' to CFLAGS)
510 if test x$GCC != x ; then
511   CFLAGS="-D_U_=\"__attribute__((unused))\" $CFLAGS"
512   AC_MSG_RESULT(yes)
513 else
514   CFLAGS="-D_U_=\"\" $CFLAGS"
515   AC_MSG_RESULT(no)
516 fi
517
518 dnl --------------------------------------------------------------------------
519 dnl FHS stuff has to be done last because it overrides other defaults
520 dnl --------------------------------------------------------------------------
521
522 AC_MSG_CHECKING([whether to use Filesystem Hierarchy Standard (FHS) compatibility])
523 AC_ARG_ENABLE(fhs,
524         [  --enable-fhs            use Filesystem Hierarchy Standard (FHS) compatibility],[
525         if test "$enableval" = "yes"; then
526                 uams_path="${libdir}/netatalk"
527                 sysconfdir="/etc"
528                 PKGCONFDIR=${sysconfdir}/netatalk
529                 SERVERTEXT="${PKGCONFDIR}/msg"
530                 use_pam_so=yes
531                 mandir="/usr/share/man"
532                 AC_DEFINE(FHS_COMPATIBILITY, 1, [Define if you want compatibily with the FHS])
533                 AC_MSG_RESULT([yes])
534         else
535                 AC_MSG_RESULT([no])
536         fi
537         ],[
538                 AC_MSG_RESULT([no])
539         ]
540 )
541
542 dnl --------------------------------------------------------------------------
543 dnl post-FHS substitutions, etc
544 dnl --------------------------------------------------------------------------
545
546 dnl ***** UAMS_PATH
547 dnl AC_DEFINE_UNQUOTED(UAMS_PATH, "${uams_path}",
548 dnl     [path to UAMs [default=PKGCONF/uams]])
549 UAMS_PATH="${uams_path}"
550 AC_SUBST(UAMS_PATH)
551
552 dnl --------------------------------------------------------------------------
553 dnl drop in includes for top level directory structures here...
554 dnl --------------------------------------------------------------------------
555
556 dnl Note: $(top_srcdir)/include should be added before all other includes
557 dnl       so that includes from that directory a preferred to includes from
558 dnl       /usr/include or similar places.
559 LIBS="$LIBS -L\$(top_srcdir)/libatalk"
560 CFLAGS="-I\$(top_srcdir)/include $CFLAGS -I\$(top_srcdir)/sys"
561
562 AC_DEFINE(OPEN_NOFOLLOW_ERRNO, ELOOP, errno returned by open with O_NOFOLLOW)
563
564 dnl --------------------------------------------------------------------------
565 dnl specific configuration comes in here:
566 dnl --------------------------------------------------------------------------
567
568 dnl ac_cv_target_os is now host_os, ac_cv_target_cpu is now host_cpu
569
570 dnl --------------------- determine operating system from "target"
571 case "$host_os" in
572         *aix*)                          this_os=aix ;;
573         *kfreebsd*-gnu)                 this_os=kfreebsd-gnu ;;
574         *freebsd*)                      this_os=freebsd ;;
575         *hpux11*)                       this_os=hpux11 ;;
576         *irix*)                         this_os=irix ;;
577         *linux*)                        this_os=linux ;;
578         *osx*)                          this_os=macosx ;;
579         *darwin*)                       this_os=macosx ;;
580         *netbsd*)                       this_os=netbsd ;;
581         *openbsd*)                      this_os=openbsd ;;
582         *osf*)                          this_os=tru64 ;;
583         *solaris*)                      this_os=solaris ;;
584 esac
585
586 case "$host_cpu" in
587         i386|i486|i586|i686|k7)         this_cpu=x86 ;;
588         alpha)                                          this_cpu=alpha ;;
589         mips)                                           this_cpu=mips ;;
590         powerpc|ppc)                            this_cpu=ppc ;;
591 esac
592
593 dnl --------------------- GNU source
594 case "$this_os" in
595         linux)  AC_DEFINE(_GNU_SOURCE, 1, [Whether to use GNU libc extensions])
596         ;;
597      kfreebsd-gnu) AC_DEFINE(_GNU_SOURCE, 1, [Whether to use GNU libc extensions])
598         ;;
599 esac
600
601 dnl --------------------- operating system specific flags (port from sys/*)
602
603 dnl ----- AIX specific -----
604 if test x"$this_os" = "xaix"; then
605         AC_MSG_RESULT([ * AIX specific configuration])
606         AC_DEFINE(NO_STRUCT_TM_GMTOFF, 1, [Define if the gmtoff member of struct tm is not available])
607
608         dnl This is probably a lie; AIX 4.3 supports a 64-bit long
609         dnl compilation environment.  It's enough to get things defined
610         dnl right in endian.h provided that long long is supported, though.
611         AC_DEFINE(HAVE_32BIT_LONGS, 1, [Define if the data type long has 32 bit])
612 fi
613
614 dnl ----- FreeBSD specific -----
615 if test x"$this_os" = "xfreebsd"; then 
616         AC_MSG_RESULT([ * FreeBSD specific configuration])
617         AC_DEFINE(BSD4_4, 1, [BSD compatiblity macro])
618         AC_DEFINE(FREEBSD, 1, [Define if OS is FreeBSD])
619     AC_DEFINE(OPEN_NOFOLLOW_ERRNO, EMLINK, errno returned by open with O_NOFOLLOW)
620 fi
621
622 dnl ----- GNU/kFreeBSD specific -----
623 if test x"$this_os" = "xkfreebsd-gnu"; then 
624         AC_MSG_RESULT([ * GNU/kFreeBSD specific configuration])
625         AC_DEFINE(BSD4_4, 1, [BSD compatiblity macro])
626         AC_DEFINE(FREEBSD, 1, [Define if OS is FreeBSD])
627     AC_DEFINE(OPEN_NOFOLLOW_ERRNO, EMLINK, errno returned by open with O_NOFOLLOW)
628 fi
629
630 dnl ----- HP-UX 11 specific -----
631 if test x"$this_os" = "xhpux11"; then
632         AC_MSG_RESULT([ * HP-UX 11 specific configuration])
633
634         AC_DEFINE(_ISOC9X_SOURCE, 1, [Compatibility macro])
635         AC_DEFINE(NO_STRUCT_TM_GMTOFF, 1, [Define if the gmtoff member of struct tm is not available])
636 fi
637
638 dnl ----- IRIX specific -----
639 if test x"$this_os" = "xirix"; then
640         AC_MSG_RESULT([ * IRIX specific configuration])
641
642         AC_DEFINE(NO_STRUCT_TM_GMTOFF, 1, [Define if the gmtoff member of struct tm is not available])
643 fi
644
645 dnl ----- Linux specific -----
646 if test x"$this_os" = "xlinux"; then 
647         AC_MSG_RESULT([ * Linux specific configuration])
648         
649         dnl ----- kernel 2.6 changed struct at_addr to atalk_addr
650         AC_MSG_CHECKING([for struct atalk_addr])
651 dnl     AC_COMPILE_IFELSE([
652         AC_TRY_COMPILE([
653 #include <sys/socket.h>
654 #include <asm/types.h>
655 #include <linux/atalk.h>
656
657         struct atalk_addr foo;
658 ],
659 [ ], [
660                 ac_have_atalk_addr=yes
661                 AC_MSG_RESULT([yes])
662         ], [
663                 AC_MSG_RESULT([no])
664         ])
665
666 if test "x$ac_have_atalk_addr" = "xyes"; then
667         AC_DEFINE(HAVE_ATALK_ADDR, 1, [set if struct at_addr is called atalk_addr])
668 fi
669
670         dnl ----- check if we need the quotactl wrapper
671 #       AC_CHECK_HEADERS(sys/quota.h linux/quota.h)
672 #       AC_CHECK_FUNC(quotactl,,
673 #               AC_DEFINE(NEED_QUOTACTL_WRAPPER, 1, [Define if the quotactl wrapper is needed])
674 #               AC_MSG_RESULT([enabling quotactl wrapper])
675 #       )
676
677         # For quotas on Linux XFS filesystems
678         
679         # For linux > 2.5.56
680         AC_CHECK_HEADERS(linux/dqblk_xfs.h,,
681                 [AC_CHECK_HEADERS(linux/xqm.h linux/xfs_fs.h)
682                 AC_CHECK_HEADERS(xfs/libxfs.h xfs/xqm.h xfs/xfs_fs.h)]
683         )
684
685
686         dnl ----- as far as I can tell, dbtob always does the wrong thing
687         dnl ----- on every single version of linux I've ever played with.
688         dnl ----- see etc/afpd/quota.c
689         AC_DEFINE(HAVE_BROKEN_DBTOB, 1, [Define if dbtob is broken])
690
691
692         dnl ----- Linux/alpha specific -----
693         if test x"$this_cpu" = "xalpha"; then 
694                 AC_MSG_RESULT([enabling gcc memcpy bug workaround])
695                 AC_DEFINE(HAVE_GCC_MEMCPY_BUG, 1, [Define if memcpy is buggy])
696         fi
697         need_dash_r=no
698
699
700 fi
701
702 dnl ----- Mac OSX specific -----
703 if test x"$this_os" = "xmacosx"; then 
704         AC_MSG_RESULT([ * Mac OSX specific configuration])
705         AC_DEFINE(BSD4_4, 1, [BSD compatiblity macro])
706         AC_DEFINE(HAVE_2ARG_DBTOB, 1, [Define if dbtob takes two arguments])
707         dnl AC_DEFINE(NO_DLFCN_H)
708         AC_DEFINE(NO_DDP, 1, [Define if DDP should be disabled])
709         AC_DEFINE(NO_QUOTA_SUPPORT, 1, [Define if Quota support should be disabled])
710         AC_DEFINE(MACOSX_SERVER, 1, [Define if compiling for MacOS X Server])
711 fi
712
713 dnl ----- NetBSD specific -----
714 if test x"$this_os" = "xnetbsd"; then 
715         AC_MSG_RESULT([ * NetBSD specific configuration])
716         AC_DEFINE(BSD4_4, 1, [BSD compatiblity macro])
717         AC_DEFINE(NETBSD, 1, [Define if OS is NetBSD])
718     AC_DEFINE(OPEN_NOFOLLOW_ERRNO, EFTYPE, errno returned by open with O_NOFOLLOW)
719
720         CFLAGS="-I\$(top_srcdir)/sys/netbsd $CFLAGS"
721         need_dash_r=yes 
722
723         dnl ----- NetBSD does not have crypt.h, uses unistd.h -----
724         AC_DEFINE(UAM_DHX, 1, [Define if the DHX UAM modules should be compiled])
725 fi
726
727 dnl ----- OpenBSD specific -----
728 if test x"$this_os" = "xopenbsd"; then 
729         AC_MSG_RESULT([ * OpenBSD specific configuration])
730     AC_DEFINE(BSD4_4, 1, [BSD compatiblity macro])
731         dnl ----- OpenBSD does not have crypt.h, uses unistd.h -----
732         AC_DEFINE(UAM_DHX, 1, [Define if the DHX UAM modules should be compiled])
733     AC_DEFINE(NO_DDP, 1, [Define if DDP should be disabled])
734 fi
735
736 dnl ----- Solaris specific -----
737 if test x"$this_os" = "xsolaris"; then 
738         AC_MSG_RESULT([ * Solaris specific configuration])
739         AC_DEFINE(__svr4__, 1, [Solaris compatibility macro])
740         AC_DEFINE(_ISOC9X_SOURCE, 1, [Compatibility macro])
741         AC_DEFINE(NO_STRUCT_TM_GMTOFF, 1, [Define if the gmtoff member of struct tm is not available])
742         AC_DEFINE(SOLARIS, 1, [Solaris compatibility macro])
743     AC_DEFINE(_XOPEN_SOURCE, 600, [Solaris compilation environment])
744     AC_DEFINE(__EXTENSIONS__,  1, [Solaris compilation environment])
745         CFLAGS="-I\$(top_srcdir)/sys/generic $CFLAGS"
746         need_dash_r=yes
747         sysv_style=solaris
748
749         solaris_module=no
750         AC_MSG_CHECKING([if we can build Solaris kernel module])
751         if test -x /usr/ccs/bin/ld && test x"$netatalk_cv_ddp_enabled" = x"yes" ; then
752                 solaris_module=yes
753         fi
754         AC_MSG_RESULT([$solaris_module])
755
756         COMPILE_64BIT_KMODULE=no
757         KCFLAGS=""
758         KLDFLAGS=""
759         COMPILE_KERNEL_GCC=no
760
761         if test "$solaris_module" = "yes"; then
762            dnl Solaris kernel module stuff
763            AC_MSG_CHECKING([if we have to build a 64bit kernel module])
764
765            # check for isainfo, if not found it has to be a 32 bit kernel (<=2.6)       
766            if test -x /usr/bin/isainfo; then
767                 # check for 64 bit platform
768                 if isainfo -kv | grep '^64-bit'; then
769                         COMPILE_64BIT_KMODULE=yes
770                 fi
771            fi
772
773            AC_MSG_RESULT([$COMPILE_64BIT_KMODULE])
774
775            if test "${GCC}" = yes; then
776                 COMPILE_KERNEL_GCC=yes
777                 if test "$COMPILE_64BIT_KMODULE" = yes; then
778                 
779                         AC_MSG_CHECKING([if we can build a 64bit kernel module])
780                         
781                         case `$CC --version 2>/dev/null` in
782                         [[12]].* | 3.0.*)
783                                 COMPILE_64BIT_KMODULE=no
784                                 COMPILE_KERNEL_GCC=no   
785                                 solaris_module=no;;
786                         *)
787                                 # use for 64 bit
788                                 KCFLAGS="-m64"
789                                 #KLDFLAGS="-melf64_sparc"
790                                 KLDFLAGS="-64";;
791                         esac    
792                         
793                         AC_MSG_RESULT([$COMPILE_64BIT_KMODULE])
794                         
795                 else
796                         KCFLAGS=""
797                         KLDFLAGS=""
798                 fi
799                 KCFLAGS="$KCFLAGS -D_KERNEL -Wall -Wstrict-prototypes"
800            else
801                 if test "$COMPILE_64BIT_KMODULE" = yes; then
802                 # use Sun CC (for a 64-bit kernel, uncomment " -xarch=v9 -xregs=no%appl ")
803                         KCFLAGS="-xarch=v9 -xregs=no%appl"
804                         KLDFLAGS="-64"
805                 else
806                         KCFLAGS=""
807                         KLDFLAGS=""
808                 fi
809                 KCFLAGS="-D_KERNEL $KCFLAGS -mno-app-regs -munaligned-doubles -fpcc-struct-return"
810            fi
811
812            AC_CACHE_CHECK([for timeout_id_t],netatalk_cv_HAVE_TIMEOUT_ID_T,[
813            AC_TRY_LINK([\
814 #include <sys/stream.h>
815 #include <sys/ddi.h>],
816 [\
817 timeout_id_t dummy;
818 ],
819 netatalk_cv_HAVE_TIMEOUT_ID_T=yes,netatalk_cv_HAVE_TIMEOUT_ID_T=no,netatalk_cv_HAVE_TIMEOUT_ID_T=cross)])
820
821            AC_DEFINE(HAVE_TIMEOUT_ID_T, test x"$netatalk_cv_HAVE_TIMEOUT_ID" = x"yes", [define for timeout_id_t])
822         fi
823
824         AC_SUBST(COMPILE_KERNEL_GCC)
825         AC_SUBST(COMPILE_64BIT_KMODULE)
826         AC_SUBST(KCFLAGS)
827         AC_SUBST(KLDFLAGS)
828 fi
829
830 dnl ----- Tru64 specific -----
831 if test x"$this_os" = "xtru64"; then 
832         AC_MSG_RESULT([ * Tru64 specific configuration])
833         AC_DEFINE(NO_DDP, 1, [Define if DDP should be disabled])
834         AC_DEFINE(HAVE_64BIT_LONGS, 1, [Define if the data type long has 64 bit])
835         dnl AC_DEFINE(USE_MOUNT_H)
836         AC_DEFINE(USE_OLD_RQUOTA, 1, [Define to use old rquota])
837         dnl AC_DEFINE(USE_UFS_QUOTA_H)
838         AC_DEFINE(TRU64, 1, [Define on Tru64 platforms])
839         AC_DEFINE(_OSF_SOURCE, 1, [Define if the *passwd UAMs should be used])
840         AC_DEFINE(_XOPEN_SOURCE_EXTENDED, 1, [Define for Berkeley DB 4])
841         AC_CHECK_LIB(security,set_auth_parameters)
842         CFLAGS="-I\$(top_srcdir)/sys/tru64 $CFLAGS"
843         need_dash_r=no
844         sysv_style=tru64
845 fi
846
847 dnl ------ Check for sendfile() --------
848 netatalk_cv_search_sendfile=yes
849 AC_ARG_ENABLE(sendfile,
850     [  --disable-sendfile      disable sendfile syscall],
851     [if test x"$enableval" = x"no"; then
852             netatalk_cv_search_sendfile=no
853         fi]
854 )
855
856 if test x"$netatalk_cv_search_sendfile" = x"yes"; then
857    case "$host_os" in
858    *linux*)
859         AC_DEFINE(SENDFILE_FLAVOR_LINUX,1,[Whether linux sendfile() API is available])
860         AC_CHECK_FUNC([sendfile], [netatalk_cv_HAVE_SENDFILE=yes])
861         ;;
862
863     *solaris*)
864         AC_DEFINE(SENDFILE_FLAVOR_SOLARIS, 1, [Solaris sendfile()])
865         AC_SEARCH_LIBS(sendfile, sendfile)
866         AC_CHECK_FUNC([sendfile], [netatalk_cv_HAVE_SENDFILE=yes])
867         ;;
868
869     *freebsd*)
870         AC_DEFINE(SENDFILE_FLAVOR_BSD, 1, [Define if the sendfile() function uses BSD semantics])
871         AC_CHECK_FUNC([sendfile], [netatalk_cv_HAVE_SENDFILE=yes])
872         ;;
873
874     *)
875         ;;
876
877     esac
878
879     if test x"$netatalk_cv_HAVE_SENDFILE" = x"yes"; then
880         AC_DEFINE(WITH_SENDFILE,1,[Whether sendfile() should be used])
881     fi
882 fi
883
884 dnl -- check for libgcrypt, if found enables DHX UAM
885 AM_PATH_LIBGCRYPT([1:1.2.3],[neta_cv_compile_dhx2=yes
886                         neta_cv_have_libgcrypt=yes
887                         AC_MSG_NOTICE([Enabling DHX2 UAM])
888                         AC_DEFINE(HAVE_LIBGCRYPT, 1, [Define if the DHX2 modules should be built with libgcrypt])
889                         AC_DEFINE(UAM_DHX2, 1, [Define if the DHX2 UAM modules should be compiled])
890                         ])
891
892 dnl -- look for openssl, if found enables DHX UAM and Randnum UAM
893 AC_PATH_SSL
894
895 dnl Check for Berkeley DB library
896 if test "x$bdb_required" = "xyes"; then
897         AC_PATH_BDB(, [
898                 AC_MSG_RESULT([])
899                 AC_MSG_RESULT([Make sure you have the required Berkeley DB libraries AND headers installed.])
900                 AC_MSG_RESULT([You can download the latest version from http://www.sleepycat.com.])
901                 AC_MSG_RESULT([If you have installed BDB in a non standard location use the])
902                 AC_MSG_RESULT([--with-bdb=/path/to/bdb configure option and make sure])
903                 AC_MSG_RESULT([your linker is configured to check for libraries there.])
904                 AC_MSG_ERROR([Berkeley DB library required but not found!])
905         ])
906 fi
907
908 dnl -- check for crypt
909 AC_CRYPT
910
911 dnl --------------------- check for building PGP UAM module
912
913 AC_MSG_CHECKING([whether the PGP UAM should be build])
914 AC_ARG_ENABLE(pgp-uam,
915         [  --enable-pgp-uam        enable build of PGP UAM module],[
916         if test "$enableval" = "yes"; then 
917                 if test "x$neta_cv_have_openssl" = "xyes"; then 
918                         AC_DEFINE(UAM_PGP, 1, [Define if the PGP UAM module should be compiled])
919                         compile_pgp=yes
920                         AC_MSG_RESULT([yes])
921                 else
922                         AC_MSG_RESULT([no])
923                 fi
924         fi
925         ],[
926                 AC_MSG_RESULT([no])
927         ]
928 )
929
930 dnl --------------------- check for building Kerberos v4 UAM module
931
932 AC_MSG_CHECKING([whether the Kerberos IV UAM should be build])
933 AC_ARG_ENABLE(krb4-uam,
934         [  --enable-krb4-uam       enable build of Kerberos v4 UAM module],[
935         if test "$enableval" = "yes"; then
936                 AC_DEFINE(UAM_KRB4, 1, [Define if the Kerberos 4 UAM module should be compiled])
937                 compile_kerberos=yes
938                 AC_MSG_RESULT([yes])
939         else
940                 AC_MSG_RESULT([no])
941         fi
942         ],[
943                 AC_MSG_RESULT([no])
944         ]
945 )
946
947 dnl --------------------- check for building Kerberos V UAM module
948
949 netatalk_cv_build_krb5_uam=no
950 AC_ARG_ENABLE(krbV-uam,
951         [  --enable-krbV-uam       enable build of Kerberos V UAM module],
952         [
953                 if test x"$enableval" = x"yes"; then
954                         NETATALK_GSSAPI_CHECK([
955                                 netatalk_cv_build_krb5_uam=yes
956                         ],[
957                                 AC_MSG_ERROR([need GSSAPI to build Kerberos V UAM])
958                         ])
959                 fi
960         ]
961         
962 )
963
964 AC_MSG_CHECKING([whether Kerberos V UAM should be build])
965 if test x"$netatalk_cv_build_krb5_uam" = x"yes"; then
966         AC_MSG_RESULT([yes])
967 else
968         AC_MSG_RESULT([no])
969 fi
970 AM_CONDITIONAL(USE_GSSAPI, test x"$netatalk_cv_build_krb5_uam" = x"yes")
971
972 dnl --------------------- overwrite the config files . . . or not.
973
974 AC_MSG_CHECKING([whether configuration files should be overwritten])
975 AC_ARG_ENABLE(overwrite,
976         [  --enable-overwrite      overwrite configuration files during installation],
977         [OVERWRITE_CONFIG="${enable_overwrite}"],
978         [OVERWRITE_CONFIG="no"]
979 )
980 AC_MSG_RESULT([$OVERWRITE_CONFIG])
981
982 dnl --------------------- check for LDAP support, for client-side ACL visibility
983 AC_MSG_CHECKING(for LDAP (necessary for client-side ACL visibility))
984 AC_ARG_WITH(ldap,
985     [AS_HELP_STRING([--with-ldap],
986         [LDAP support (default=auto)])],
987     [ case "$withval" in
988       yes|no)
989           with_ldap="$withval"
990                   ;;
991       *)
992           with_ldap=auto
993           ;;
994       esac ])
995 AC_MSG_RESULT($with_ldap)
996
997 if test x"$with_ldap" != x"no" ; then
998         AC_CHECK_HEADER([ldap.h], with_ldap=yes,
999         [ if test x"$with_ldap" = x"yes" ; then
1000             AC_MSG_ERROR([Missing LDAP headers])
1001         fi
1002                 with_ldap=no
1003         ])
1004         AC_CHECK_LIB(ldap, ldap_init, with_ldap=yes,
1005         [ if test x"$with_ldap" = x"yes" ; then
1006             AC_MSG_ERROR([Missing LDAP library])
1007         fi
1008                 with_ldap=no
1009         ])
1010 fi
1011
1012 if test x"$with_ldap" = x"yes"; then
1013         AC_DEFINE(HAVE_LDAP,1,[Whether LDAP is available])
1014 fi
1015
1016 dnl --------------------- check for ACL support
1017 AC_MSG_CHECKING(whether to support ACLs)
1018 AC_ARG_WITH(acls,
1019     [AS_HELP_STRING([--with-acls],
1020         [Include ACL support (default=auto)])],
1021     [ case "$withval" in
1022       yes|no)
1023           with_acl_support="$withval"
1024                   ;;
1025       *)
1026           with_acl_support=auto
1027           ;;
1028       esac ],
1029     [with_acl_support=auto])
1030 AC_MSG_RESULT($with_acl_support)
1031
1032 if test x"$with_acl_support" = x"no"; then
1033         AC_MSG_RESULT(Disabling ACL support)
1034         AC_DEFINE(HAVE_NO_ACLS,1,[Whether no ACLs support should be built in])
1035 else
1036     with_acl_support=yes
1037 fi
1038
1039 if test x"$with_acl_support" = x"yes" ; then
1040         AC_MSG_NOTICE(checking whether ACL support is available:)
1041         case "$host_os" in
1042         *sysv5*)
1043                 AC_MSG_NOTICE(Using UnixWare ACLs)
1044                 AC_DEFINE(HAVE_UNIXWARE_ACLS,1,[Whether UnixWare ACLs are available])
1045                 ;;
1046         *solaris*)
1047                 AC_MSG_NOTICE(Using solaris ACLs)
1048                 AC_DEFINE(HAVE_SOLARIS_ACLS,1,[Whether solaris ACLs are available])
1049                 ACL_LIBS="$ACL_LIBS -lsec"
1050                 ;;
1051         *hpux*)
1052                 AC_MSG_NOTICE(Using HPUX ACLs)
1053                 AC_DEFINE(HAVE_HPUX_ACLS,1,[Whether HPUX ACLs are available])
1054                 ;;
1055         *irix*)
1056                 AC_MSG_NOTICE(Using IRIX ACLs)
1057                 AC_DEFINE(HAVE_IRIX_ACLS,1,[Whether IRIX ACLs are available])
1058                 ;;
1059         *aix*)
1060                 AC_MSG_NOTICE(Using AIX ACLs)
1061                 AC_DEFINE(HAVE_AIX_ACLS,1,[Whether AIX ACLs are available])
1062                 ;;
1063         *osf*)
1064                 AC_MSG_NOTICE(Using Tru64 ACLs)
1065                 AC_DEFINE(HAVE_TRU64_ACLS,1,[Whether Tru64 ACLs are available])
1066                 ACL_LIBS="$ACL_LIBS -lpacl"
1067                 ;;
1068         *darwin*)
1069                 AC_MSG_NOTICE(ACLs on Darwin currently not supported)
1070                 AC_DEFINE(HAVE_NO_ACLS,1,[Whether no ACLs support is available])
1071                 ;;
1072         *)
1073                 AC_CHECK_LIB(acl,acl_get_file,[ACL_LIBS="$ACL_LIBS -lacl"])
1074                 case "$host_os" in
1075                 *linux*)
1076                         AC_CHECK_LIB(attr,getxattr,[ACL_LIBS="$ACL_LIBS -lattr"])
1077                         ;;
1078                 esac
1079                 AC_CACHE_CHECK([for POSIX ACL support],netatalk_cv_HAVE_POSIX_ACLS,[
1080                         acl_LIBS=$LIBS
1081                         LIBS="$LIBS $ACL_LIBS"
1082                         AC_TRY_LINK([
1083                                 #include <sys/types.h>
1084                                 #include <sys/acl.h>
1085                         ],[
1086                                 acl_t acl;
1087                                 int entry_id;
1088                                 acl_entry_t *entry_p;
1089                                 return acl_get_entry(acl, entry_id, entry_p);
1090                         ],
1091                         [netatalk_cv_HAVE_POSIX_ACLS=yes],
1092                         [netatalk_cv_HAVE_POSIX_ACLS=no
1093                 with_acl_support=no])
1094                         LIBS=$acl_LIBS
1095                 ])
1096                 if test x"$netatalk_cv_HAVE_POSIX_ACLS" = x"yes"; then
1097                         AC_MSG_NOTICE(Using POSIX ACLs)
1098                         AC_DEFINE(HAVE_POSIX_ACLS,1,[Whether POSIX ACLs are available])
1099                         AC_CACHE_CHECK([for acl_get_perm_np],netatalk_cv_HAVE_ACL_GET_PERM_NP,[
1100                                 acl_LIBS=$LIBS
1101                                 LIBS="$LIBS $ACL_LIBS"
1102                                 AC_TRY_LINK([
1103                                         #include <sys/types.h>
1104                                         #include <sys/acl.h>
1105                                 ],[
1106                                         acl_permset_t permset_d;
1107                                         acl_perm_t perm;
1108                                         return acl_get_perm_np(permset_d, perm);
1109                                 ],
1110                                 [netatalk_cv_HAVE_ACL_GET_PERM_NP=yes],
1111                                 [netatalk_cv_HAVE_ACL_GET_PERM_NP=no])
1112                                 LIBS=$acl_LIBS
1113                         ])
1114                         if test x"$netatalk_cv_HAVE_ACL_GET_PERM_NP" = x"yes"; then
1115                                 AC_DEFINE(HAVE_ACL_GET_PERM_NP,1,[Whether acl_get_perm_np() is available])
1116                         fi
1117
1118                         AC_CACHE_CHECK([for acl_from_mode], netatalk_cv_HAVE_ACL_FROM_MODE,[
1119                                 acl_LIBS=$LIBS
1120                                 LIBS="$LIBS $ACL_LIBS"
1121                 AC_CHECK_FUNCS(acl_from_mode,
1122                                 [netatalk_cv_HAVE_ACL_FROM_MODE=yes],
1123                                 [netatalk_cv_HAVE_ACL_FROM_MODE=no])
1124                                 LIBS=$acl_LIBS
1125                         ])
1126                         if test x"netatalk_cv_HAVE_ACL_FROM_MODE" = x"yes"; then
1127                                 AC_DEFINE(HAVE_ACL_FROM_MODE,1,[Whether acl_from_mode() is available])
1128                         fi
1129
1130
1131                 else
1132                         AC_MSG_NOTICE(ACL support is not avaliable)
1133                         AC_DEFINE(HAVE_NO_ACLS,1,[Whether no ACLs support is available])
1134                 fi
1135                 ;;
1136     esac
1137 fi
1138
1139 if test x"$with_acl_support" = x"yes" ; then
1140    AC_CHECK_HEADERS([acl/libacl.h])
1141     AC_DEFINE(HAVE_ACLS,1,[Whether ACLs support is available])
1142     AC_SUBST(ACL_LIBS)
1143 fi
1144
1145 dnl --------------------- check for Extended Attributes support
1146 neta_cv_eas="ad"
1147 neta_cv_eas_sys_found=no
1148 neta_cv_eas_sys_not_found=no
1149
1150 AC_CHECK_HEADERS(sys/attributes.h attr/xattr.h sys/xattr.h sys/extattr.h sys/uio.h sys/ea.h)
1151
1152 case "$this_os" in
1153
1154   *osf*)
1155         AC_SEARCH_LIBS(getproplist, [proplist])
1156         AC_CHECK_FUNCS([getproplist fgetproplist setproplist fsetproplist],
1157                    [neta_cv_eas_sys_found=yes],
1158                    [neta_cv_eas_sys_not_found=yes])
1159         AC_CHECK_FUNCS([delproplist fdelproplist add_proplist_entry get_proplist_entry],,
1160                    [neta_cv_eas_sys_not_found=yes])
1161         AC_CHECK_FUNCS([sizeof_proplist_entry],,
1162                    [neta_cv_eas_sys_not_found=yes])
1163   ;;
1164
1165   *solaris*)
1166         AC_CHECK_FUNCS([attropen],
1167                    [neta_cv_eas_sys_found=yes],
1168                    [neta_cv_eas_sys_not_found=yes])
1169   ;;
1170
1171   'freebsd')
1172     AC_CHECK_FUNCS([extattr_delete_fd extattr_delete_file extattr_delete_link],
1173                    [neta_cv_eas_sys_found=yes],
1174                    [neta_cv_eas_sys_not_found=yes])
1175     AC_CHECK_FUNCS([extattr_get_fd extattr_get_file extattr_get_link],,
1176                    [neta_cv_eas_sys_not_found=yes])
1177     AC_CHECK_FUNCS([extattr_list_fd extattr_list_file extattr_list_link],,
1178                    [neta_cv_eas_sys_not_found=yes])
1179     AC_CHECK_FUNCS([extattr_set_fd extattr_set_file extattr_set_link],,
1180                    [neta_cv_eas_sys_not_found=yes])
1181   ;;
1182
1183   *freebsd4* | *dragonfly* )
1184     AC_DEFINE(BROKEN_EXTATTR, 1, [Does extattr API work])
1185   ;;
1186
1187   *)
1188         AC_SEARCH_LIBS(getxattr, [attr])
1189
1190     if test "x$neta_cv_eas_sys_found" != "xyes" ; then
1191        AC_CHECK_FUNCS([getxattr lgetxattr fgetxattr listxattr llistxattr],
1192                       [neta_cv_eas_sys_found=yes],
1193                       [neta_cv_eas_sys_not_found=yes])
1194            AC_CHECK_FUNCS([flistxattr removexattr lremovexattr fremovexattr],,
1195                       [neta_cv_eas_sys_not_found=yes])
1196            AC_CHECK_FUNCS([setxattr lsetxattr fsetxattr],,
1197                       [neta_cv_eas_sys_not_found=yes])
1198     fi
1199
1200     if test "x$neta_cv_eas_sys_found" != "xyes" ; then
1201            AC_CHECK_FUNCS([getea fgetea lgetea listea flistea llistea],
1202                       [neta_cv_eas_sys_found=yes],
1203                       [neta_cv_eas_sys_not_found=yes])
1204            AC_CHECK_FUNCS([removeea fremoveea lremoveea setea fsetea lsetea],,
1205                       [neta_cv_eas_sys_not_found=yes])
1206     fi
1207
1208     if test "x$neta_cv_eas_sys_found" != "xyes" ; then
1209            AC_CHECK_FUNCS([attr_get attr_list attr_set attr_remove],,
1210                       [neta_cv_eas_sys_not_found=yes])
1211        AC_CHECK_FUNCS([attr_getf attr_listf attr_setf attr_removef],,
1212                       [neta_cv_eas_sys_not_found=yes])
1213     fi
1214   ;;
1215 esac
1216
1217 # Do xattr functions take additional options like on Darwin?
1218 if test x"$ac_cv_func_getxattr" = x"yes" ; then
1219         AC_CACHE_CHECK([whether xattr interface takes additional options], smb_attr_cv_xattr_add_opt, [
1220                 old_LIBS=$LIBS
1221                 LIBS="$LIBS $ACL_LIBS"
1222                 AC_TRY_COMPILE([
1223                         #include <sys/types.h>
1224                         #if HAVE_ATTR_XATTR_H
1225                         #include <attr/xattr.h>
1226                         #elif HAVE_SYS_XATTR_H
1227                         #include <sys/xattr.h>
1228                         #endif
1229                 ],[
1230                         getxattr(0, 0, 0, 0, 0, 0);
1231                 ],
1232                 [smb_attr_cv_xattr_add_opt=yes],
1233                 [smb_attr_cv_xattr_add_opt=no;LIBS=$old_LIBS])
1234         ])
1235         if test x"$smb_attr_cv_xattr_add_opt" = x"yes"; then
1236                 AC_DEFINE(XATTR_ADD_OPT, 1, [xattr functions have additional options])
1237         fi
1238 fi
1239
1240 if test "x$neta_cv_eas_sys_found" = "xyes" ; then
1241    if test "x$neta_cv_eas_sys_not_found" != "xyes" ; then
1242       neta_cv_eas="$neta_cv_eas | sys"
1243    fi
1244 fi
1245 AC_DEFINE_UNQUOTED(EA_MODULES,["$neta_cv_eas"],[Available Extended Attributes modules])
1246
1247 dnl --------------------- Check if realpath() takes NULL
1248 AC_CACHE_CHECK([if the realpath function allows a NULL argument],
1249     neta_cv_REALPATH_TAKES_NULL, [
1250         AC_TRY_RUN([
1251             #include <stdio.h>
1252             #include <limits.h>
1253             #include <signal.h>
1254
1255             void exit_on_core(int ignored) {
1256                  exit(1);
1257             }
1258
1259             main() {
1260                 char *newpath;
1261                 signal(SIGSEGV, exit_on_core);
1262                 newpath = realpath("/tmp", NULL);
1263                 exit((newpath != NULL) ? 0 : 1);
1264             }],
1265             neta_cv_REALPATH_TAKES_NULL=yes,
1266             neta_cv_REALPATH_TAKES_NULL=no,
1267             neta_cv_REALPATH_TAKES_NULL=cross
1268         )
1269     ]
1270 )
1271
1272 if test x"$neta_cv_REALPATH_TAKES_NULL" = x"yes"; then
1273     AC_DEFINE(REALPATH_TAKES_NULL,1,[Whether the realpath function allows NULL])
1274 fi
1275
1276 dnl --------------------- Netatalk Webmin
1277 NETATALK_WEBMIN
1278
1279 dnl --------------------- last minute substitutions
1280
1281 AC_SUBST(LIBS)
1282 AC_SUBST(CFLAGS)
1283 AC_SUBST(OVERWRITE_CONFIG)
1284
1285 AM_CONDITIONAL(SOLARIS_MODULE, test x$solaris_module = xyes)
1286 AM_CONDITIONAL(COMPILE_TIMELORD, test x$compile_timelord = xyes)
1287 AM_CONDITIONAL(COMPILE_A2BOOT, test x$compile_a2boot = xyes)
1288 AM_CONDITIONAL(HAVE_LIBGCRYPT, test x$neta_cv_have_libgcrypt = xyes)
1289 AM_CONDITIONAL(HAVE_OPENSSL, test x$neta_cv_have_openssl = xyes)
1290 AM_CONDITIONAL(HAVE_ACLS, test x"$with_acl_support" = x"yes")
1291 AM_CONDITIONAL(HAVE_LDAP, test x"$with_ldap" = x"yes")
1292 AM_CONDITIONAL(USE_DHX, test x$neta_cv_compile_dhx = xyes)
1293 AM_CONDITIONAL(USE_DHX2, test x$neta_cv_compile_dhx2 = xyes)
1294 AM_CONDITIONAL(USE_RANDNUM, test x$neta_cv_have_openssl = xyes)
1295 AM_CONDITIONAL(USE_KERBEROS, test x$compile_kerberos = xyes)
1296 AM_CONDITIONAL(USE_PAM_SO, test x$use_pam_so = xyes)
1297 AM_CONDITIONAL(USE_PAM, test x$netatalk_cv_install_pam = xyes)
1298 AM_CONDITIONAL(BUILD_PAM, test x$compile_pam = xyes)
1299 AM_CONDITIONAL(USE_PGP, test x$compile_pgp = xyes)
1300 AM_CONDITIONAL(DEFAULT_HOOK, test x$neta_cv_have_libgcrypt != xyes && test x$neta_cv_have_openssl != xyes)
1301 AM_CONDITIONAL(USE_NETBSD, test x$sysv_style = xnetbsd)
1302 AM_CONDITIONAL(USE_REDHAT_SYSV, test x$sysv_style = xredhat-sysv)
1303 AM_CONDITIONAL(USE_SUSE_SYSV, test x$sysv_style = xsuse-sysv)
1304 AM_CONDITIONAL(USE_SHADOWPW, test x$shadowpw = xyes)
1305 AM_CONDITIONAL(USE_TRU64, test x$sysv_style = xtru64)
1306 AM_CONDITIONAL(USE_SOLARIS, test x$sysv_style = xsolaris)
1307 AM_CONDITIONAL(USE_GENTOO, test x$sysv_style = xgentoo)
1308 AM_CONDITIONAL(USE_DEBIAN, test x$sysv_style = xdebian)
1309 AM_CONDITIONAL(USE_SYSTEMD, test x$sysv_style = xsystemd || test x$sysv_style = xredhat-systemd || test x$sysv_style = xsuse-systemd)
1310 AM_CONDITIONAL(USE_UNDEF, test x$sysv_style = x)
1311 AM_CONDITIONAL(USE_BDB, test x$bdb_required = xyes)
1312 AM_CONDITIONAL(USE_APPLETALK, test x$netatalk_cv_ddp_enabled = xyes)
1313 AM_CONDITIONAL(HAVE_ATFUNCS, test x"$ac_neta_haveatfuncs" = x"yes")
1314
1315 dnl --------------------- generate files
1316
1317 AC_OUTPUT([Makefile
1318         bin/Makefile
1319         bin/ad/Makefile
1320         bin/adv1tov2/Makefile
1321         bin/aecho/Makefile
1322         bin/afppasswd/Makefile
1323         bin/cnid/Makefile
1324         bin/cnid/cnid2_create
1325         bin/getzones/Makefile
1326         bin/megatron/Makefile
1327         bin/misc/Makefile
1328         bin/nbp/Makefile
1329         bin/pap/Makefile
1330         bin/psorder/Makefile
1331         bin/uniconv/Makefile
1332         config/Makefile
1333         config/pam/Makefile
1334         contrib/Makefile
1335         contrib/macusers/Makefile
1336         contrib/macusers/macusers
1337         contrib/misc/Makefile
1338         contrib/printing/Makefile
1339         contrib/shell_utils/Makefile
1340         contrib/shell_utils/apple_dump
1341         contrib/shell_utils/asip-status.pl
1342         contrib/timelord/Makefile
1343         contrib/a2boot/Makefile
1344         distrib/Makefile
1345         distrib/config/Makefile
1346         distrib/config/netatalk-config
1347         distrib/initscripts/Makefile
1348         distrib/m4/Makefile
1349         distrib/systemd/Makefile
1350         doc/Makefile
1351         etc/Makefile
1352         etc/afpd/Makefile
1353         etc/atalkd/Makefile
1354         etc/cnid_dbd/Makefile
1355         etc/uams/Makefile
1356         etc/uams/uams_krb4/Makefile
1357         etc/papd/Makefile
1358         etc/psf/Makefile
1359         include/Makefile
1360         include/atalk/Makefile
1361         libatalk/Makefile
1362         libatalk/acl/Makefile
1363         libatalk/adouble/Makefile
1364         libatalk/asp/Makefile
1365         libatalk/atp/Makefile
1366         libatalk/bstring/Makefile
1367         libatalk/cnid/Makefile
1368         libatalk/cnid/cdb/Makefile
1369         libatalk/cnid/last/Makefile
1370         libatalk/cnid/dbd/Makefile
1371         libatalk/cnid/tdb/Makefile
1372         libatalk/compat/Makefile
1373         libatalk/dsi/Makefile
1374         libatalk/nbp/Makefile
1375         libatalk/netddp/Makefile
1376         libatalk/util/Makefile
1377         libatalk/tdb/Makefile
1378         libatalk/unicode/Makefile
1379         libatalk/unicode/charsets/Makefile
1380         libatalk/vfs/Makefile
1381         macros/Makefile
1382         man/Makefile
1383         man/man1/Makefile
1384         man/man3/Makefile
1385         man/man4/Makefile
1386         man/man5/Makefile
1387         man/man8/Makefile
1388         sys/Makefile
1389         sys/generic/Makefile
1390         sys/generic/sys/Makefile
1391         sys/netatalk/Makefile
1392         sys/netbsd/Makefile
1393         sys/netbsd/netatalk/Makefile
1394         sys/solaris/Makefile
1395         sys/sunos/Makefile
1396         sys/ultrix/Makefile
1397         test/Makefile
1398         test/afpd/Makefile
1399         ],
1400         [chmod a+x distrib/config/netatalk-config contrib/shell_utils/apple_*]
1401 )
1402
1403 AC_NETATALK_LIBS_SUMMARY
1404 AC_NETATALK_CONFIG_SUMMARY