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