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