]> arthur.barton.de Git - netatalk.git/blob - configure.in
configure change for linux 2.6 from Thomas Kaiser
[netatalk.git] / configure.in
1 dnl $Id: configure.in,v 1.179.2.3.2.14 2003-12-12 19:29:55 didg Exp $
2 dnl configure.in for netatalk
3
4 AC_INIT(etc/afpd/main.c)
5
6 NETATALK_VERSION=`cat $srcdir/VERSION`
7 AC_SUBST(NETATALK_VERSION)
8
9 AC_CANONICAL_SYSTEM
10 AM_INIT_AUTOMAKE(netatalk, ${NETATALK_VERSION})
11 AM_CONFIG_HEADER(config.h)
12
13 dnl Checks for programs.
14 AC_PROG_AWK
15 AC_PROG_CC
16 AC_PROG_INSTALL
17 AC_PROG_LN_S
18 AC_PROG_MAKE_SET
19 AC_LIBTOOL_DLOPEN
20 AM_PROG_LIBTOOL
21 AC_PROG_PERL
22 AC_PROG_GREP
23 AC_PROG_PS
24
25 dnl *********************************************************************
26 dnl FIXME! FIXME! These should be selectable properly, and should produce
27 dnl the proper flags and defines...
28 dnl *********************************************************************
29
30 ############################################
31 # we need dlopen/dlclose/dlsym/dlerror for PAM, the password database plugins and the plugin loading code
32 #AC_SEARCH_LIBS(dlopen, [dl])
33 # dlopen/dlclose/dlsym/dlerror will be checked again later and defines will be set then
34
35 dnl Checks for libraries.
36 dnl Replace `main' with a function in -labs:
37 dnl AC_CHECK_LIB(abs, main)
38 dnl Replace `main' with a function in -laudit:
39 dnl AC_CHECK_LIB(audit, main)
40 dnl Replace `main' with a function in -lauth:
41 dnl AC_CHECK_LIB(auth, main)
42 dnl Replace `main' with a function in -lcmd:
43 dnl AC_CHECK_LIB(cmd, main)
44 dnl Replace `main' with a function in -lcrypt:
45 dnl AC_CHECK_LIB(crypt, main)
46 dnl Replace `main' with a function in -ld:
47 dnl AC_CHECK_LIB(d, main)
48 dnl Replace `main' with a function in -ldl:
49 AC_CHECK_LIB(dl, dlopen)
50 dnl Replace `main' with a function in -lkauth:
51 dnl AC_CHECK_LIB(kauth, main)
52 dnl Replace `main' with a function in -lkrb:
53 dnl AC_CHECK_LIB(krb, main)
54 dnl Replace `main' with a function in -llwp:
55 dnl AC_CHECK_LIB(lwp, main)
56 dnl Replace `main' with a function in -ln:
57 dnl AC_CHECK_LIB(n, main)
58 dnl Replace `main' with a function in -lnsl:
59 AC_CHECK_LIB(nsl, main)
60 dnl Replace `main' with a function in -lprot:
61 dnl AC_CHECK_LIB(prot, main)
62 dnl Replace `main' with a function in -lrx:
63 dnl AC_CHECK_LIB(rx, main)
64 dnl Replace `main' with a function in -lrxkad:
65 dnl AC_CHECK_LIB(rxkad, main)
66 dnl Replace `main' with a function in -lsocket:
67 AC_CHECK_LIB(socket, socket)
68 dnl Replace `main' with a function in -lsys:
69 dnl AC_CHECK_LIB(sys, main)
70 dnl Replace `main' with a function in -lubik:
71 dnl AC_CHECK_LIB(ubik, main)
72
73
74 #
75 # Check presence of some functions
76 #
77 # Check for XPG4 access() function
78 # Be sure to test before adding AFS libs in LIBS path as AFS lib
79 # has such a function that works only on AFS filesystems.
80 AC_CHECK_FUNCS(access)
81
82 AC_CHECK_FUNCS(pread pwrite)
83
84 dnl Checks for header files.
85 AC_HEADER_DIRENT
86 AC_HEADER_STDC
87 AC_HEADER_SYS_WAIT
88 AC_CHECK_HEADERS(fcntl.h limits.h stdint.h strings.h time.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 sys/mount.h statfs.h sys/types.h dlfcn.h errno.h sys/errno.h sys/uio.h)
89 AC_CHECK_HEADER(sys/cdefs.h,,
90         AC_MSG_RESULT([enabling generic cdefs.h from tree])
91         CFLAGS="-I\$(top_srcdir)/sys/generic $CFLAGS"
92 )
93 AC_CHECK_HEADERS(langinfo.h locale.h)
94
95 dnl Checks for typedefs, structures, and compiler characteristics.
96 AC_C_CONST
97 AC_TYPE_UID_T
98 AC_C_INLINE
99 AC_TYPE_MODE_T
100 AC_TYPE_OFF_T
101 AC_TYPE_PID_T
102 AC_TYPE_SIZE_T
103 AC_STRUCT_ST_RDEV
104 AC_HEADER_TIME
105 AC_STRUCT_TM
106
107 dnl Checks for library functions.
108 AC_TYPE_GETGROUPS
109 AC_PROG_GCC_TRADITIONAL
110 AC_FUNC_MEMCMP
111 AC_HEADER_MAJOR
112 AC_FUNC_MMAP
113 AC_TYPE_SIGNAL
114 AC_FUNC_UTIME_NULL
115 AC_FUNC_WAIT3
116 AC_CHECK_FUNCS(getcwd gethostname gettimeofday getusershell mkdir rmdir select socket strdup strcasestr strstr strtoul setpgrp strchr memcpy)
117 AC_FUNC_SETPGRP
118 AC_CHECK_FUNCS(backtrace_symbols)
119 AC_CHECK_FUNCS(setlocale nl_langinfo)
120 AC_CHECK_FUNCS(dlopen dlclose dlsym dlerror waitpid getcwd strdup strndup strnlen strtoul strerror chown fchown chmod fchmod chroot link mknod mknod64)
121 AC_CACHE_SAVE
122
123
124 dnl Checks for (v)snprintf
125 NETATALK_SNPRINTF_CHECK
126
127 dnl --------------------------------------------------------------------------
128 dnl specific configuration comes in here:
129 dnl --------------------------------------------------------------------------
130
131 AC_DEFINE(ADMIN_GRP, 1, [Define if the admin group should be enabled])
132
133 netatalk_cv_admin_group=yes
134 AC_MSG_CHECKING([for administrative group support])
135 AC_ARG_WITH(admin-group,
136         [  --disable-admin-group   disable admin group],[
137         if test "$enableval" = "no"; then
138                 AC_DEFINE(ADMIN_GRP, 0, [Define if the admin group should be enabled])
139                 AC_MSG_RESULT([yes])
140         else
141                 AC_MSG_RESULT([no])
142                 netatalk_cv_admin_group=no
143         fi],[
144                 AC_MSG_RESULT([yes])
145         ]
146 )
147
148 NETATALK_AFS_CHECK
149
150 NETATALK_CONFIG_DIRS
151
152 AC_MSG_CHECKING([for logfile path])
153 AC_ARG_WITH(logfile,
154         [  --with-logfile=PATH     path for file used by logger [/var/log/netatalk.log]
155                           use --without-logfile to disable logger],[
156         if test x"$withval" = x"no"; then
157                 AC_DEFINE(DISABLE_LOGGER, 1, [Define if the logger should not be used])
158                 AC_MSG_RESULT([syslog])
159         elif test "$withval" != "yes"; then
160                 AC_DEFINE_UNQUOTED(LOGFILEPATH, "$withval", [Path to the log file])
161                 AC_MSG_RESULT([$withval])
162         else
163                 AC_DEFINE_UNQUOTED(LOGFILEPATH, "/var/log/netatalk.log", [Path to the log file])
164                 AC_MSG_RESULT([/var/log/netatalk.log]) 
165         fi],[
166                 AC_DEFINE_UNQUOTED(LOGFILEPATH, "/var/log/netatalk.log", [Path to the log file])
167                 AC_MSG_RESULT([/var/log/netatalk.log])
168         ]
169 )
170
171
172 netatalk_cv_with_cracklib=no
173 AC_MSG_CHECKING([for cracklib support])
174 AC_ARG_WITH(cracklib,
175         [  --with-cracklib=DICT    enable/set location of cracklib dictionary],[
176         if test "x$withval" != "xno" ; then
177                 cracklib="$withval"
178                 AC_CHECK_LIB(crack, main, [
179                         AC_DEFINE(USE_CRACKLIB, 1, [Define if cracklib should be used])
180                         LIBS="$LIBS -lcrack"
181                         AC_MSG_RESULT([yes])
182                         if test "$cracklib" = "yes"; then
183                                 cracklib="/usr/lib/cracklib_dict"
184                         fi
185                         AC_DEFINE_UNQUOTED(_PATH_CRACKLIB, "$cracklib",
186                                 [path to cracklib dictionary])
187                         AC_MSG_RESULT([setting cracklib dictionary to $cracklib])
188                         netatalk_cv_with_cracklib=yes
189                         ],[
190                         AC_MSG_ERROR([cracklib not found!])
191                         ]
192                 )
193         else
194                 AC_MSG_RESULT([no])
195         fi
196         ],[
197                 AC_MSG_RESULT([no])
198         ]
199 )
200
201 netatalk_cv_ddp_enabled=yes
202 AC_MSG_CHECKING([whether to enable DDP])
203 AC_ARG_ENABLE(ddp,
204         [  --disable-ddp           disable DDP],[
205         if test "$enableval" = "no"; then 
206                 AC_DEFINE(NO_DDP, 1, [Define if DDP should be disabled])
207                 AC_MSG_RESULT([no])
208                 netatalk_cv_ddp_enabled=no
209         else
210                 AC_MSG_RESULT([yes])
211         fi
212         ],[
213                 AC_MSG_RESULT([yes])
214         ]
215 )
216
217 AC_MSG_CHECKING([whether to enable debug code])
218 AC_ARG_ENABLE(debug1,
219         [  --enable-debug1         enable debug code],[
220         if test "$enableval" != "no"; then
221                 if test "$enableval" = "yes"; then
222                         AC_DEFINE(DEBUG1, 1, [Define if debugging information should be included])
223                 else
224                         AC_DEFINE_UNQUOTED(DEBUG1, $enableval, [Define if debugging information should be included])
225                 fi 
226                 AC_MSG_RESULT([yes])
227         else
228                 AC_MSG_RESULT([no])
229         fi
230         ],[
231                 AC_MSG_RESULT([no])
232         ]
233 )
234
235 AC_MSG_CHECKING([whether to enable verbose debug code])
236 AC_ARG_ENABLE(debug,
237         [  --enable-debug          enable verbose debug code],[
238         if test "$enableval" != "no"; then
239                 if test "$enableval" = "yes"; then
240                         AC_DEFINE(DEBUG, 1, [Define if verbose debugging information should be included])
241                 else
242                         AC_DEFINE_UNQUOTED(DEBUG, $enableval, [Define if verbose debugging information should be included])
243                 fi 
244                 AC_MSG_RESULT([yes])
245         else
246                 AC_MSG_RESULT([no])
247         fi
248         ],[
249                 AC_MSG_RESULT([no])
250         ]
251 )
252
253 afp3=no
254 afp3set=no
255 AC_MSG_CHECKING([whether AFP 3.x calls should be enabled])
256 AC_ARG_ENABLE(afp3,
257         [  --disable-afp3          disable AFP 3.x calls],
258         [
259             if test x"$enableval" != x"no"; then
260                 afp3set=yes
261                 afp3=yes
262                 AC_MSG_RESULT([yes])
263             else
264                 AC_MSG_RESULT([no])
265             fi
266         ],[
267             AC_MSG_RESULT([yes])
268             afp3=yes
269         ]
270 )
271
272 if test x"$afp3" = x"yes"; then
273         AC_SYS_LARGEFILE([
274                 AC_DEFINE(AFP3x, 1, [Define to enable AFP 3.x support])
275         ],[
276                 if test x"$afp3set" == x"yes"; then
277                         AC_MSG_ERROR([AFP 3.x support requires Large File Support.])
278                 else
279                         AC_MSG_WARN([AFP 3.x support requires Large File Support. AFP3.x support disabled])
280                         afp3=no
281                 fi
282         ])
283 fi
284
285 AM_ICONV
286
287 dnl ----------- A NOTE ABOUT DROPKLUDGE
288 dnl The trouble with this fix is that if you know what the file is called, it
289 dnl can be read from the Unix side.  That's okay for most academic institutions
290 dnl since the students don't have telnet access to the Mac servers.  There is
291 dnl currently no one working on further development/fixes of DROPKLUDGE.
292 dnl -----------
293
294 netatalk_cv_dropkludge=no
295 AC_MSG_CHECKING([whether to enable experimental dropbox support])
296 AC_ARG_ENABLE(dropkludge,
297         [  --enable-dropkludge     enable the experimental dropbox fix (INSECURE!) ],[
298         if test "$enableval" = "yes"; then 
299                 AC_DEFINE(DROPKLUDGE, 1, [Define if you want to use the experimental dropkludge support])
300                 AC_MSG_RESULT([yes])
301                 netatalk_cv_dropkludge=yes
302         else
303                 AC_MSG_RESULT([no])
304         fi
305         ],[
306                 AC_MSG_RESULT([no])
307         ]
308 )
309
310 netatalk_cv_force_uidgid=no
311 AC_MSG_CHECKING([whether to enable forcing of uid/gid per volume])
312 AC_ARG_ENABLE(force-uidgid,
313         [  --enable-force-uidgid   allow forcing of uid/gid per volume (BROKEN) ],[
314         if test "$enableval" = "yes"; then
315                 AC_DEFINE(FORCE_UIDGID, 1, [Define if you want forcing of uid/gid per volume])
316                 AC_MSG_RESULT([enabling forcing of uid/gid per volume])
317                 AC_MSG_RESULT([yes])
318                 netatalk_cv_force_uidgid=yes
319         else
320                 AC_MSG_RESULT([no])
321         fi
322         ],[
323                 AC_MSG_RESULT([no])
324         ]
325 )
326
327 dnl Check for CNID database backends
328 bdb_required=no
329 AC_NETATALK_CNID([bdb_required=yes],[bdb_required=no])
330
331 dnl Check for Berkeley DB library
332 if test "x$bdb_required" = "xyes"; then
333         AC_PATH_BDB(, [
334                 AC_MSG_RESULT([])
335                 AC_MSG_RESULT([Make sure you have the Berkeley DB libraries AND headers installed.])
336                 AC_MSG_RESULT([You can download the latest version from http://www.sleepcat.com.])
337                 AC_MSG_RESULT([If you have installed BDB in a non standard location use the])
338                 AC_MSG_RESULT([--with-bdb=/path/to/bdb configure option.])
339                 AC_MSG_ERROR([Berkeley DB library required but not found!])
340         ])
341 fi
342
343 dnl Check for quota support
344 AC_CHECK_QUOTA
345
346 dnl Check for optional server location protocol support (used by MacOS X)
347 NETATALK_SRVLOC
348
349 dnl Check for PAM libs
350 netatalk_cv_use_pam=no
351 AC_PATH_PAM([
352         use_pam_so=yes
353         compile_pam=yes
354         netatalk_cv_use_pam=yes
355         AC_DEFINE(USE_PAM, 1, [Define to enable PAM support])
356 ])
357
358 netatalk_cv_use_shadowpw=no
359 AC_ARG_WITH(shadow,
360         [  --with-shadow           enable shadow password support [[auto]]],
361         [netatalk_cv_use_shadowpw="$withval"],
362         [netatalk_cv_use_shadowpw=auto]
363 )
364
365 if test "x$netatalk_cv_use_shadowpw" != "xno"; then
366     AC_CHECK_HEADER([shadow.h])
367     if test x"$ac_cv_header_shadow_h" = x"yes"; then
368         netatalk_cv_use_shadowpw=yes
369         AC_DEFINE(SHADOWPW, 1, [Define if shadow passwords should be used])
370     else 
371       if test "x$shadowpw" = "xyes"; then
372         AC_MSG_ERROR([shadow support not available])
373       else
374         netatalk_cv_use_shadowpw=no
375       fi
376     fi 
377 fi
378
379 AC_MSG_CHECKING([whether shadow support should be enabled])
380 if test "x$netatalk_cv_use_shadowpw" == "xyes"; then
381         AC_MSG_RESULT([yes])
382 else
383         AC_MSG_RESULT([no])
384 fi
385         
386         
387         
388 netatalk_cv_use_shellcheck=yes
389 AC_MSG_CHECKING([whether checking for a valid shell should be enabled])
390 AC_ARG_ENABLE(shell-check,
391         [  --disable-shell-check   disable checking for a valid shell],[
392         if test "$enableval" = "no"; then 
393                 AC_DEFINE(DISABLE_SHELLCHECK, 1, [Define if shell check should be disabled])
394                 AC_MSG_RESULT([no])
395                 netatalk_cv_use_shellcheck=no
396         else
397                 AC_MSG_RESULT([yes])
398         fi
399         ],[
400                 AC_MSG_RESULT([yes])
401         ]
402 )
403
404 NETATALK_TCP_WRAPPERS
405
406 AC_MSG_CHECKING([whether system (fcntl) locking should be disabled])
407 AC_ARG_ENABLE(locking,
408         [  --disable-locking       disable system locking],[
409                 if test "$enableval" = "no"; then
410                         AC_DEFINE(DISABLE_LOCKING, 1, [Define if system (fcntl) locking should be disabled])
411                         AC_MSG_RESULT([yes])
412                 else
413                         AC_MSG_RESULT([no])
414                 fi
415                 
416         ],[
417                 AC_MSG_RESULT([no])
418         ]
419
420 )
421
422
423 AC_ARG_ENABLE(redhat,
424         [  --enable-redhat         use redhat-style sysv configuration ],[
425         if test "$enableval" = "yes"; then
426                 sysv_style=redhat
427         fi
428         AC_MSG_RESULT([enabling redhat-style sysv support])
429         ]
430 )
431
432 AC_ARG_ENABLE(suse,
433         [  --enable-suse           use suse-style sysv configuration ],[
434         if test "$enableval" = "yes"; then
435                 sysv_style=suse
436         fi
437         AC_MSG_RESULT([enabling suse-style sysv support])
438         ]
439 )
440
441 AC_ARG_ENABLE(cobalt,
442         [  --enable-cobalt         use cobalt-style sysv configuration ],
443         if test "$enableval" = "yes"; then
444                 sysv_style=cobalt
445         fi
446         AC_MSG_RESULT([enabling cobalt-style sysv support])
447 )
448
449 AC_ARG_ENABLE(netbsd,
450         [  --enable-netbsd         use NetBSD-style rc.d configuration ],
451         if test "x$enableval" = "xyes"; then
452                 sysv_style=netbsd
453         fi
454         AC_MSG_RESULT([enabling NetBSD-style rc.d support])
455 )
456
457 dnl ----- timelord compilation (disabled by default)
458 AC_MSG_CHECKING([whether timelord should be compiled])
459 compile_timelord=no
460 AC_ARG_ENABLE(timelord,
461         [  --enable-timelord       enable compilation of timelord server],
462         [compile_timelord="$enableval"],
463         [compile_timelord="no"]
464 )
465 AC_MSG_RESULT([$compile_timelord])
466
467 dnl ----- a2boot compilation (disabled by default)
468 AC_MSG_CHECKING([whether a2boot should be compiled])
469 compile_a2boot=no
470 AC_ARG_ENABLE(a2boot,
471         [  --enable-a2boot         enable compilation of Apple2 boot server],
472         [compile_a2boot="$enableval"],
473         [compile_a2boot="no"]
474 )
475 AC_MSG_RESULT([$compile_a2boot])
476
477 AC_ARG_WITH(uams-path,
478         [  --with-uams-path=PATH   path to UAMs [[PKGCONF/uams]]],[
479                 uams_path="$withval"
480         ],[
481                 uams_path="${PKGCONFDIR}/uams"
482         ]
483 )
484
485 dnl --------------------------------------------------------------------------
486 dnl FHS stuff has to be done last because it overrides other defaults
487 dnl --------------------------------------------------------------------------
488
489 AC_MSG_CHECKING([whether to use Filesystem Hierarchy Standard (FHS) compatibility])
490 AC_ARG_ENABLE(fhs,
491         [  --enable-fhs            use Filesystem Hierarchy Standard (FHS) compatibility],[
492         if test "$enableval" = "yes"; then
493                 uams_path="${libdir}/netatalk"
494                 sysconfdir="/etc"
495                 PKGCONFDIR=${sysconfdir}/netatalk
496                 SERVERTEXT="${PKGCONFDIR}/msg"
497                 use_pam_so=yes
498                 mandir="/usr/share/man"
499                 AC_DEFINE(FHS_COMPATIBILITY, 1, [Define if you want compatibily with the FHS])
500                 AC_MSG_RESULT([yes])
501         else
502                 AC_MSG_RESULT([no])
503         fi
504         ],[
505                 AC_MSG_RESULT([no])
506         ]
507 )
508
509 dnl --------------------------------------------------------------------------
510 dnl post-FHS substitutions, etc
511 dnl --------------------------------------------------------------------------
512
513 dnl ***** UAMS_PATH
514 AC_DEFINE_UNQUOTED(UAMS_PATH, "${uams_path}",
515         [path to UAMs [default=PKGCONF/uams]])
516 UAMS_PATH="${uams_path}"
517 AC_SUBST(UAMS_PATH)
518
519 dnl --------------------------------------------------------------------------
520 dnl drop in includes for top level directory structures here...
521 dnl --------------------------------------------------------------------------
522
523 dnl Note: $(top_srcdir)/include should be added before all other includes
524 dnl       so that includes from that directory a preferred to includes from
525 dnl       /usr/include or similar places.
526 LIBS="$LIBS -L\$(top_srcdir)/libatalk"
527 CFLAGS="-I\$(top_srcdir)/include $CFLAGS -I\$(top_srcdir)/sys"
528
529 dnl --------------------------------------------------------------------------
530 dnl specific configuration comes in here:
531 dnl --------------------------------------------------------------------------
532
533 dnl ac_cv_target_os is now host_os, ac_cv_target_cpu is now host_cpu
534
535 dnl --------------------- determine operating system from "target"
536 case "$host_os" in
537         *aix*)                          this_os=aix ;;
538         *freebsd*)                      this_os=freebsd ;;
539         *hpux11*)                       this_os=hpux11 ;;
540         *irix*)                         this_os=irix ;;
541         *linux*)                        this_os=linux ;;
542         *osx*)                          this_os=macosx ;;
543         *darwin*)                       this_os=macosx ;;
544         *netbsd*)                       this_os=netbsd ;;
545         *openbsd*)                      this_os=openbsd ;;
546         *osf*)                          this_os=tru64 ;;
547         *solaris*)                      this_os=solaris ;;
548 esac
549
550 case "$host_cpu" in
551         i386|i486|i586|i686|k7)         this_cpu=x86 ;;
552         alpha)                                          this_cpu=alpha ;;
553         mips)                                           this_cpu=mips ;;
554         powerpc|ppc)                            this_cpu=ppc ;;
555 esac
556
557 dnl --------------------- operating system specific flags (port from sys/*)
558
559 dnl ----- AIX specific -----
560 if test x"$this_os" = "xaix"; then
561         AC_MSG_RESULT([ * AIX specific configuration])
562         AC_DEFINE(NO_STRUCT_TM_GMTOFF, 1, [Define if the gmtoff member of struct tm is not available])
563
564         dnl This is probably a lie; AIX 4.3 supports a 64-bit long
565         dnl compilation environment.  It's enough to get things defined
566         dnl right in endian.h provided that long long is supported, though.
567         AC_DEFINE(HAVE_32BIT_LONGS, 1, [Define if the data type long has 32 bit])
568 fi
569
570 dnl ----- FreeBSD specific -----
571 if test x"$this_os" = "xfreebsd"; then 
572         AC_MSG_RESULT([ * FreeBSD specific configuration])
573         AC_DEFINE(BSD4_4, 1, [BSD compatiblity macro])
574         AC_DEFINE(SENDFILE_FLAVOR_BSD, 1, [Define if the sendfile() function uses BSD semantics])
575
576 dnl     AC_DEFINE(NO_CRYPT_H, 1, [Define if crypt.h does not exist])
577 fi
578
579 dnl ----- HP-UX 11 specific -----
580 if test x"$this_os" = "xhpux11"; then
581         AC_MSG_RESULT([ * HP-UX 11 specific configuration])
582
583         AC_DEFINE(_ISOC9X_SOURCE, 1, [Compatibility macro])
584         AC_DEFINE(NO_STRUCT_TM_GMTOFF, 1, [Define if the gmtoff member of struct tm is not available])
585 fi
586
587 dnl ----- IRIX specific -----
588 if test x"$this_os" = "xirix"; then
589         AC_MSG_RESULT([ * IRIX specific configuration])
590
591         AC_DEFINE(NO_STRUCT_TM_GMTOFF, 1, [Define if the gmtoff member of struct tm is not available])
592 fi
593
594 dnl ----- Linux specific -----
595 if test x"$this_os" = "xlinux"; then 
596         AC_MSG_RESULT([ * Linux specific configuration])
597         
598         dnl ----- kernel 2.6 changed struct at_addr to atalk_addr
599         AC_MSG_CHECKING([for struct atalk_addr])
600         AC_COMPILE_IFELSE([
601 #include <sys/socket.h>
602 #include <asm/types.h>
603 #include <linux/atalk.h>
604
605 int main() {
606         struct atalk_addr foo;
607
608         return 0;
609 }
610         ], [
611                 ac_have_atalk_addr=yes
612                 AC_MSG_RESULT([yes])
613         ], [
614                 AC_MSG_RESULT([no])
615         ])
616
617 if test "x$ac_have_atalk_addr" = "xyes"; then
618         AC_DEFINE(HAVE_ATALK_ADDR, 1, [set if struct at_addr is called atalk_addr])
619 fi
620
621         dnl ----- check if we need the quotactl wrapper
622 #       AC_CHECK_HEADERS(sys/quota.h linux/quota.h)
623 #       AC_CHECK_FUNC(quotactl,,
624 #               AC_DEFINE(NEED_QUOTACTL_WRAPPER, 1, [Define if the quotactl wrapper is needed])
625 #               AC_MSG_RESULT([enabling quotactl wrapper])
626 #       )
627
628         # For quotas on Linux XFS filesystems
629         AC_CHECK_HEADERS(linux/xqm.h linux/xfs_fs.h)
630         AC_CHECK_HEADERS(xfs/libxfs.h xfs/xqm.h xfs/xfs_fs.h)
631         # For linux > 2.5.56
632         AC_CHECK_HEADERS(linux/dqblk_xfs.h)
633
634
635         dnl ----- as far as I can tell, dbtob always does the wrong thing
636         dnl ----- on every single version of linux I've ever played with.
637         dnl ----- see etc/afpd/quota.c
638         AC_DEFINE(HAVE_BROKEN_DBTOB, 1, [Define if dbtob is broken])
639
640         netatalk_cv_linux_sendfile=no
641         AC_ARG_ENABLE(sendfile,
642             [  --enable-sendfile       use sendfile syscall default (no) ],[
643                 if test "$enableval" = "yes"; then
644                         netatalk_cv_linux_sendfile=yes
645                 fi
646                 AC_MSG_RESULT([enabling sendfile syscall])
647             ]
648         )
649
650         if test x"$netatalk_cv_linux_sendfile" = "xyes"; then 
651             AC_CACHE_CHECK([for linux sendfile support],netatalk_cv_HAVE_SENDFILE,[
652             AC_TRY_LINK([#include <sys/sendfile.h>],
653 [\
654 int tofd, fromfd;
655 off_t offset;
656 size_t total;
657 ssize_t nwritten = sendfile(tofd, fromfd, &offset, total);
658 ],
659 netatalk_cv_HAVE_SENDFILE=yes,netatalk_cv_HAVE_SENDFILE=no)])
660
661 # Try and cope with broken Linux sendfile....
662             AC_CACHE_CHECK([for broken linux sendfile support],netatalk_cv_HAVE_BROKEN_LINUX_SENDFILE,[
663             AC_TRY_LINK([\
664 #if defined(_FILE_OFFSET_BITS) && (_FILE_OFFSET_BITS == 64)
665 #undef _FILE_OFFSET_BITS
666 #endif
667 #include <sys/sendfile.h>],
668 [\
669 int tofd, fromfd;
670 off_t offset;
671 size_t total;
672 ssize_t nwritten = sendfile(tofd, fromfd, &offset, total);
673 ],
674 netatalk_cv_HAVE_BROKEN_LINUX_SENDFILE=yes,netatalk_cv_HAVE_BROKEN_LINUX_SENDFILE=no,netatalk_cv_HAVE_BROKEN_SENDFILE=cross)])
675
676             if test x"$netatalk_cv_HAVE_SENDFILE" = x"yes"; then
677                 AC_DEFINE(HAVE_SENDFILE,1,[Whether sendfile() is available])
678                 AC_DEFINE(SENDFILE_FLAVOR_LINUX,1,[Whether linux sendfile() API is available])
679                 AC_DEFINE(WITH_SENDFILE,1,[Whether sendfile() should be used])
680             elif test x"$netatalk_cv_HAVE_BROKEN_LINUX_SENDFILE" = x"yes"; then
681                 AC_DEFINE(SENDFILE_FLAVOR_LINUX,1,[Whether linux sendfile() API is available])
682                 AC_DEFINE(LINUX_BROKEN_SENDFILE_API,1,[Whether (linux) sendfile() is broken])
683                 AC_DEFINE(WITH_SENDFILE,1,[Whether sendfile should be used])
684             else
685                 netatalk_cv_linux_sendfile=no
686                 AC_MSG_RESULT(no);
687             fi
688         fi
689
690         dnl ----- Linux/alpha specific -----
691         if test x"$this_cpu" = "xalpha"; then 
692                 AC_MSG_RESULT([enabling gcc memcpy bug workaround])
693                 AC_DEFINE(HAVE_GCC_MEMCPY_BUG, 1, [Define if memcpy is buggy])
694         fi
695         need_dash_r=no
696
697
698 fi
699
700 dnl ----- Mac OSX specific -----
701 if test x"$this_os" = "xmacosx"; then 
702         AC_MSG_RESULT([ * Mac OSX specific configuration])
703         AC_DEFINE(BSD4_4, 1, [BSD compatiblity macro])
704         AC_DEFINE(HAVE_BROKEN_CPP, 1, [Define if cpp is broken])
705         AC_DEFINE(HAVE_2ARG_DBTOB, 1, [Define if dbtob takes two arguments])
706         dnl AC_DEFINE(NO_DLFCN_H)
707         AC_DEFINE(NO_DDP, 1, [Define if DDP should be disabled])
708         AC_DEFINE(NO_QUOTA_SUPPORT, 1, [Define if Quota support should be disabled])
709         AC_DEFINE(MACOSX_SERVER, 1, [Define if compiling for MacOS X Server])
710 fi
711
712 dnl ----- NetBSD specific -----
713 if test x"$this_os" = "xnetbsd"; then 
714         AC_MSG_RESULT([ * NetBSD specific configuration])
715         AC_DEFINE(BSD4_4, 1, [BSD compatiblity macro])
716         if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
717                 # NetBSD ELF machines don't have to have DLSYM_PREPEND_UNDERSCORE.
718                 # If this test is true, it's not an ELF box.
719                 # This REALLY should be a configure test.
720                 AC_DEFINE(DLSYM_PREPEND_UNDERSCORE, 1, [BSD compatibility macro])
721         fi
722         CFLAGS="-I\$(top_srcdir)/sys/netbsd -I/usr/include/kerberosIV $CFLAGS"
723         need_dash_r=yes 
724
725         dnl ----- NetBSD does not have crypt.h, uses unistd.h -----
726         AC_DEFINE(UAM_DHX, 1, [Define if the DHX UAM modules should be compiled])
727 fi
728
729 dnl ----- OpenBSD specific -----
730 if test x"$this_os" = "xopenbsd"; then 
731         AC_MSG_RESULT([ * OpenBSD specific configuration])
732         AC_DEFINE(BSD4_4, 1, [BSD compatiblity macro])
733         AC_DEFINE(DLSYM_PREPEND_UNDERSCORE, 1, [BSD compatibility macro])
734
735         dnl ----- OpenBSD does not have crypt.h, uses unistd.h -----
736         AC_DEFINE(UAM_DHX, 1, [Define if the DHX UAM modules should be compiled])
737 fi
738
739 dnl ----- Solaris specific -----
740 if test x"$this_os" = "xsolaris"; then 
741         AC_MSG_RESULT([ * Solaris specific configuration])
742         AC_DEFINE(__svr4__, 1, [Solaris compatibility macro])
743         AC_DEFINE(_ISOC9X_SOURCE, 1, [Compatibility macro])
744         AC_DEFINE(NO_STRUCT_TM_GMTOFF, 1, [Define if the gmtoff member of struct tm is not available])
745         AC_DEFINE(SOLARIS, 1, [Solaris compatibility macro])
746         CFLAGS="-I\$(top_srcdir)/sys/generic $CFLAGS"
747         need_dash_r=yes
748
749         AC_MSG_RESULT([enabling Solaris kernel module build])
750         solaris_module=yes
751 fi
752
753 dnl ----- Tru64 specific -----
754 if test x"$this_os" = "xtru64"; then 
755         AC_MSG_RESULT([ * Tru64 specific configuration])
756         AC_DEFINE(NO_DDP, 1, [Define if DDP should be disabled])
757         AC_DEFINE(HAVE_64BIT_LONGS, 1, [Define if the data type long has 64 bit])
758         dnl AC_DEFINE(USE_MOUNT_H)
759         AC_DEFINE(USE_OLD_RQUOTA, 1, [Define to use old rquota])
760         dnl AC_DEFINE(USE_UFS_QUOTA_H)
761         AC_DEFINE(TRU64, 1, [Define on Tru64 platforms])
762         AC_CHECK_LIB(security,set_auth_parameters)
763         CFLAGS="-I\$(top_srcdir)/sys/tru64 $CFLAGS"
764         need_dash_r=no
765         sysv_style=tru64
766 fi
767
768 dnl -- look for openssl
769 AC_PATH_SSL
770
771 dnl -- check for crypt
772 AC_CRYPT
773
774 dnl --------------------- check for building PGP UAM module
775
776 AC_MSG_CHECKING([whether the PGP UAM should be build])
777 AC_ARG_ENABLE(pgp-uam,
778         [  --enable-pgp-uam        enable build of PGP UAM module],[
779         if test "$enableval" = "yes"; then 
780                 if test "$compile_ssl" = "yes"; then 
781                         AC_DEFINE(UAM_PGP, 1, [Define if the PGP UAM module should be compiled])
782                         compile_pgp=yes
783                         AC_MSG_RESULT([yes])
784                 else
785                         AC_MSG_RESULT([no])
786                 fi
787         fi
788         ],[
789                 AC_MSG_RESULT([no])
790         ]
791 )
792
793 dnl --------------------- check for building Kerberos v4 UAM module
794
795 AC_MSG_CHECKING([whether the Kerberos IV UAM should be build])
796 AC_ARG_ENABLE(krb4-uam,
797         [  --enable-krb4-uam       enable build of Kerberos v4 UAM module],[
798         if test "$enableval" = "yes"; then
799                 AC_DEFINE(UAM_KRB4, 1, [Define if the Kerberos 4 UAM module should be compiled])
800                 compile_kerberos=yes
801                 AC_MSG_RESULT([yes])
802         else
803                 AC_MSG_RESULT([no])
804         fi
805         ],[
806                 AC_MSG_RESULT([no])
807         ]
808 )
809
810 dnl --------------------- check for building Kerberos V UAM module
811
812 netatalk_cv_build_krb5_uam=no
813 AC_ARG_ENABLE(krbV-uam,
814         [  --enable-krbV-uam       enable build of Kerberos V UAM module],
815         [
816                 if test x"$enableval" = x"yes"; then
817                         NETATALK_GSSAPI_CHECK([
818                                 netatalk_cv_build_krb5_uam=yes
819                         ],[
820                                 AC_MSG_ERROR([need GSSAPI to build Kerberos V UAM])
821                         ])
822                 fi
823         ]
824         
825 )
826
827 AC_MSG_CHECKING([whether Kerberos V UAM should be build])
828 if test x"$netatalk_cv_build_krb5_uam" = x"yes"; then
829         AC_MSG_RESULT([yes])
830 else
831         AC_MSG_RESULT([no])
832 fi
833 AM_CONDITIONAL(USE_GSSAPI, test x"$netatalk_cv_build_krb5_uam" = x"yes")
834
835 dnl --------------------- overwrite the config files . . . or not.
836
837 AC_MSG_CHECKING([whether configuration files should be overwritten])
838 AC_ARG_ENABLE(overwrite,
839         [  --enable-overwrite      overwrite configuration files during installation],
840         [OVERWRITE_CONFIG="${enable_overwrite}"],
841         [OVERWRITE_CONFIG="no"]
842 )
843 AC_MSG_RESULT([$OVERWRITE_CONFIG])
844
845 dnl --------------------- last minute substitutions
846
847 AC_SUBST(LIBS)
848 AC_SUBST(CFLAGS)
849 AC_SUBST(OVERWRITE_CONFIG)
850
851 AM_CONDITIONAL(SOLARIS_MODULE, test x$solaris_module = xyes)
852 AM_CONDITIONAL(COMPILE_TIMELORD, test x$compile_timelord = xyes)
853 AM_CONDITIONAL(COMPILE_A2BOOT, test x$compile_a2boot = xyes)
854 AM_CONDITIONAL(USE_DHX, test x$compile_ssl = xyes)
855 AM_CONDITIONAL(USE_KERBEROS, test x$compile_kerberos = xyes)
856 AM_CONDITIONAL(USE_PAM_SO, test x$use_pam_so = xyes)
857 AM_CONDITIONAL(USE_PAM, test x$netatalk_cv_install_pam = xyes)
858 AM_CONDITIONAL(BUILD_PAM, test x$compile_pam = xyes)
859 AM_CONDITIONAL(USE_PGP, test x$compile_pgp = xyes)
860 AM_CONDITIONAL(USE_COBALT, test x$sysv_style = xcobalt)
861 AM_CONDITIONAL(USE_NETBSD, test x$sysv_style = xnetbsd)
862 AM_CONDITIONAL(USE_REDHAT, test x$sysv_style = xredhat)
863 AM_CONDITIONAL(USE_SUSE, test x$sysv_style = xsuse)
864 AM_CONDITIONAL(USE_SHADOWPW, test x$shadowpw = xyes)
865 AM_CONDITIONAL(USE_TRU64, test x$sysv_style = xtru64)
866
867 dnl --------------------- generate files
868
869 AC_OUTPUT([Makefile
870         bin/Makefile
871         bin/adv1tov2/Makefile
872         bin/aecho/Makefile
873         bin/afile/Makefile
874         bin/afppasswd/Makefile
875         bin/cnid/Makefile
876         bin/cnid/cnid_maint
877         bin/cnid/cnid2_create
878         bin/getzones/Makefile
879         bin/megatron/Makefile
880         bin/nbp/Makefile
881         bin/pap/Makefile
882         bin/psorder/Makefile
883         config/Makefile
884         contrib/Makefile
885         contrib/macusers/Makefile
886         contrib/macusers/macusers
887         contrib/nu/Makefile
888         contrib/nu/nu
889         contrib/printing/Makefile
890         contrib/shell_utils/Makefile
891         contrib/shell_utils/afpd-mtab.pl
892         contrib/shell_utils/apple_cp
893         contrib/shell_utils/apple_mv
894         contrib/shell_utils/apple_rm
895         contrib/shell_utils/cleanappledouble.pl
896         contrib/shell_utils/netatalkshorternamelinks.pl
897         contrib/timelord/Makefile
898         contrib/a2boot/Makefile
899         distrib/Makefile
900         distrib/config/Makefile
901         distrib/config/netatalk-config
902         distrib/initscripts/Makefile
903         distrib/m4/Makefile
904         doc/Makefile
905         etc/Makefile
906         etc/afpd/Makefile
907         etc/atalkd/Makefile
908         etc/cnid_dbd/Makefile
909         etc/uams/Makefile
910         etc/uams/uams_krb4/Makefile
911         etc/papd/Makefile
912         etc/psf/Makefile
913         include/Makefile
914         include/atalk/Makefile
915         libatalk/Makefile
916         libatalk/adouble/Makefile
917         libatalk/asp/Makefile
918         libatalk/atp/Makefile
919         libatalk/cnid/Makefile
920         libatalk/cnid/db3/Makefile
921         libatalk/cnid/cdb/Makefile
922         libatalk/cnid/last/Makefile
923         libatalk/cnid/mtab/Makefile
924         libatalk/cnid/dbd/Makefile
925         libatalk/cnid/hash/Makefile
926         libatalk/cnid/tdb/Makefile
927         libatalk/compat/Makefile
928         libatalk/dsi/Makefile
929         libatalk/nbp/Makefile
930         libatalk/netddp/Makefile
931         libatalk/util/Makefile
932         libatalk/tdb/Makefile
933         libatalk/unicode/Makefile
934         libatalk/unicode/charsets/Makefile
935         macros/Makefile
936         man/Makefile
937         man/man1/Makefile
938         man/man3/Makefile
939         man/man4/Makefile
940         man/man5/Makefile
941         man/man8/Makefile
942         sys/Makefile
943         sys/generic/Makefile
944         sys/generic/sys/Makefile
945         sys/netatalk/Makefile
946         sys/netbsd/Makefile
947         sys/netbsd/netatalk/Makefile
948         sys/solaris/Makefile
949         sys/solaris/Makefile.kernel
950         sys/sunos/Makefile
951         sys/ultrix/Makefile
952         ],
953         [chmod a+x distrib/config/netatalk-config contrib/shell_utils/apple_*]
954 )
955
956 AM_NETATALK_LIBS_SUMMARY
957 AM_NETATALK_CONFIG_SUMMARY
958
959