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