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