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