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