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