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