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