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