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