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