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