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