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