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