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