]> arthur.barton.de Git - netatalk.git/blob - configure.in
Properly add -lpam to LDFLAGS (thanks, Sebastian).
[netatalk.git] / configure.in
1 dnl $Id: configure.in,v 1.113 2001-10-10 20:19:18 jmarcus Exp $
2 dnl configure.in for netatalk
3
4 AC_INIT(bin/adv1tov2/adv1tov2.c)
5
6 NETATALK_VERSION=`cat 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 Reset locations to proper places
14 AC_PREFIX_DEFAULT(/usr/local)
15
16 dnl Checks for programs.
17 AC_PROG_AWK
18 AC_PROG_CC
19 AC_PROG_INSTALL
20 AC_PROG_LN_S
21 AC_PROG_MAKE_SET
22 AC_LIBTOOL_DLOPEN
23 AM_PROG_LIBTOOL
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 dnl Checks for libraries.
31 dnl Replace `main' with a function in -labs:
32 AC_CHECK_LIB(abs, main)
33 dnl Replace `main' with a function in -laudit:
34 AC_CHECK_LIB(audit, main)
35 dnl Replace `main' with a function in -lauth:
36 AC_CHECK_LIB(auth, main)
37 dnl Replace `main' with a function in -lcmd:
38 AC_CHECK_LIB(cmd, main)
39 dnl Replace `main' with a function in -lcom_err:
40 AC_CHECK_LIB(com_err, main)
41 dnl Replace `main' with a function in -lcrypt:
42 AC_CHECK_LIB(crypt, main)
43 dnl Replace `main' with a function in -ld:
44 AC_CHECK_LIB(d, main)
45 dnl Replace `main' with a function in -ldl:
46 AC_CHECK_LIB(dl, main)
47 dnl Replace `main' with a function in -lkauth:
48 AC_CHECK_LIB(kauth, main)
49 dnl Replace `main' with a function in -lkrb:
50 AC_CHECK_LIB(krb, main)
51 dnl Replace `main' with a function in -llwp:
52 AC_CHECK_LIB(lwp, main)
53 dnl Replace `main' with a function in -ln:
54 AC_CHECK_LIB(n, main)
55 dnl Replace `main' with a function in -lnsl:
56 AC_CHECK_LIB(nsl, main)
57 dnl Replace `main' with a function in -lprot:
58 AC_CHECK_LIB(prot, main)
59 dnl Replace `main' with a function in -lresolv:
60 AC_CHECK_LIB(resolv, main)
61 dnl Replace `main' with a function in -lrpcsvc:
62 AC_CHECK_LIB(rpcsvc, main)
63 dnl Replace `main' with a function in -lrx:
64 AC_CHECK_LIB(rx, main)
65 dnl Replace `main' with a function in -lrxkad:
66 AC_CHECK_LIB(rxkad, main)
67 dnl Replace `main' with a function in -lsocket:
68 AC_CHECK_LIB(socket, main)
69 dnl Replace `main' with a function in -lsys:
70 AC_CHECK_LIB(sys, main)
71 dnl Replace `main' with a function in -lubik:
72 AC_CHECK_LIB(ubik, main)
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 dnl Checks for header files.
83 AC_HEADER_DIRENT
84 AC_HEADER_STDC
85 AC_HEADER_SYS_WAIT
86 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 security/pam_appl.h)
87 AC_CHECK_HEADER(sys/cdefs.h,,
88         AC_MSG_RESULT([enabling generic cdefs.h from tree])
89         CFLAGS="-I\$(top_srcdir)/sys/generic $CFLAGS"
90 )
91
92 # Allow user to specify flags
93 AC_ARG_WITH(cflags,
94         [  --with-cflags           specify additional flags to pass to compiler],
95         [
96                 if test "x$withval" != "xno" ; then
97                         CFLAGS="$CFLAGS $withval"
98                 fi
99         ]       
100 )
101 AC_ARG_WITH(libs,
102         [  --with-libs             specify additional libraries to link with],
103         [
104                 if test "x$withval" != "xno" ; then
105                         LIBS="$LIBS $withval"
106                 fi
107         ]
108 )
109
110 dnl Checks for typedefs, structures, and compiler characteristics.
111 AC_C_CONST
112 AC_TYPE_UID_T
113 AC_C_INLINE
114 AC_TYPE_MODE_T
115 AC_TYPE_OFF_T
116 AC_TYPE_PID_T
117 AC_TYPE_SIZE_T
118 AC_STRUCT_ST_RDEV
119 AC_HEADER_TIME
120 AC_STRUCT_TM
121
122 dnl Checks for library functions.
123 AC_TYPE_GETGROUPS
124 AC_PROG_GCC_TRADITIONAL
125 AC_FUNC_MEMCMP
126 AC_HEADER_MAJOR
127 AC_FUNC_MMAP
128 AC_TYPE_SIGNAL
129 AC_FUNC_UTIME_NULL
130 AC_FUNC_WAIT3
131 AC_CHECK_FUNCS(flock getcwd gethostname gettimeofday getusershell mkdir rmdir select socket strdup strstr strtoul setpgrp strchr memcpy)
132 AC_FUNC_SETPGRP
133
134 dnl --------------------------------------------------------------------------
135 dnl specific configuration comes in here:
136 dnl --------------------------------------------------------------------------
137
138 AC_DEFINE(ADMIN_GRP, 1)
139
140 AC_ARG_WITH(admin-group,
141         [  --disable-admin-group   disable admin group],
142         if test "$enableval" = "no"; then
143                 AC_DEFINE(ADMIN_GRP, 0)
144                 AC_MSG_RESULT([disabling administrative group support])
145         fi
146  )
147
148 AC_ARG_ENABLE(afs,
149         [  --enable-afs            enable AFS support],
150         if test "$enableval" = "yes"; then
151                 AC_DEFINE(AFS, 1)
152                 AC_MSG_RESULT([enabling AFS support])
153         fi
154 )
155
156 AC_ARG_WITH(config-dir,
157         [  --with-config-dir=DIR   obsolete - use --pkgconfdir],
158                 sysconfdir="$withval",
159                 if test "x$prefix" = "xNONE"; then
160                         sysconfdir="$ac_default_prefix/etc"
161                 else
162                         sysconfdir="${prefix}/etc"
163                 fi
164 )
165
166 AC_ARG_WITH(pkgconfdir,
167         [  --with-pkgconfdir=DIR   package specific configuration in DIR
168                           [default=SYSCONF/netatalk]],
169                 PKGCONFDIR="$withval",
170                 PKGCONFDIR="${sysconfdir}/netatalk"
171 )
172
173 AC_ARG_WITH(cracklib,
174         [  --with-cracklib=dict    enable/set location of cracklib dictionary],
175         if test "x$withval" != "xno" ; then
176                 cracklib="$withval"
177                 AC_CHECK_LIB(crack, main,
178                         AC_DEFINE(USE_CRACKLIB) 
179                         LIBS="$LIBS -lcrack"
180                         AC_MSG_RESULT([enabling cracklib support])
181                         if test "$cracklib" = "yes"; then
182                                 cracklib="/usr/lib/cracklib_dict"
183                         fi
184                         AC_DEFINE_UNQUOTED(_PATH_CRACKLIB, "$cracklib",
185                                 [path to cracklib dictionary])
186                         AC_MSG_RESULT([setting cracklib dictionary to $cracklib]),
187                         AC_MSG_ERROR([cracklib not found!])
188                 )
189         fi
190 )
191
192 AC_ARG_ENABLE(ddp,
193         [  --disable-ddp           disable DDP],
194         if test "$enableval" = "no"; then 
195                 AC_DEFINE(NO_DDP, 1)
196                 AC_MSG_RESULT([disabling DDP])
197         fi
198 )
199
200 AC_ARG_ENABLE(debug,
201         [  --enable-debug          enable debug code],
202         if test "$enableval" != "no"; then
203                 if test "$enableval" = "yes"; then
204                         AC_DEFINE(DEBUG, 1)
205                 else
206                         AC_DEFINE_UNQUOTED(DEBUG, $enableval)
207                 fi 
208                 AC_MSG_RESULT([enabling debugging code])
209         else
210                 AC_DEFINE(DEBUG, 0)
211         fi
212 )
213
214
215 dnl ----------- A NOTE ABOUT DROPKLUDGE
216 dnl The trouble with this fix is that if you know what the file is called, it
217 dnl can be read from the Unix side.  That's okay for most academic institutions
218 dnl since the students don't have telnet access to the Mac servers.  There is
219 dnl currently no one working on further development/fixes of DROPKLUDGE.
220 dnl -----------
221
222 AC_ARG_ENABLE(dropkludge,
223         [  --enable-dropkludge     enable the experimental dropbox fix (INSECURE!) ],
224         if test "$enableval" = "yes"; then 
225                 AC_DEFINE(DROPKLUDGE, 1)
226                 AC_MSG_RESULT([enabling experimental dropbox support])
227         fi
228 )
229
230 AC_ARG_ENABLE(force-uidgid,
231         [  --enable-force-uidgid   allow forcing of uid/gid per volume (BROKEN) ],
232         if test "$enableval" = "yes"; then
233                 AC_DEFINE(FORCE_UIDGID, 1)
234                 AC_MSG_RESULT([enabling forcing of uid/gid per volume])
235         fi
236 )
237
238 dnl Don't use DB3 unless it's needed
239 db3_required=no
240
241 dnl Check for CNID DB support
242 AC_ARG_ENABLE(cnid-db,
243         [  --enable-cnid-db   use persistent cnid database per volume (EXPERIMENTAL) ],
244         if test "x$enableval" = "xyes"; then
245                 dnl Now we need DB3
246                 db3_required="yes"
247
248                 dnl Note that we don't AC_DEFINE(CNID_DB, 1) here...
249                 dnl we have to check for the library first.
250                 dnl AC_MSG_RESULT([db3 check enabled])
251         fi
252 )
253
254 dnl Check for Berkeley DB3 library
255 AC_ARG_WITH(db3,
256         [  --with-db3=PATH         specify path to Berkeley DB3 installation],
257         if test "x$withval" != "xno"; then
258                 trydb3dir="$withval"
259         fi
260 )
261
262 db3_found=no
263 for db3dir in "" $trydb3dir /usr /usr /usr/local ; do
264         if test -f "$db3dir/include/db3/db.h" ; then
265                 LDFLAGS="$LDFLAGS -L$db3dir/lib"
266                 CFLAGS="$CFLAGS -I$db3dir/include/db3"
267
268                 dnl If we require DB3, die if we don't have it
269                 if test "x$db3_required" != "xno"; then
270                         AC_CHECK_LIB(db, main,
271                                 dnl AC_MSG_RESULT([enabling db3 support])
272                                 db3_found=yes
273                                 dnl -- also enable CNID DB when this is found
274                                 AC_DEFINE(CNID_DB, 1)
275                                 AC_MSG_RESULT([using persistent cnid database per volume])
276                                 LIBS="$LIBS -ldb",
277                                 dnl Not Found
278                                 AC_MSG_ERROR([Berkeley DB3 library not found!])
279                         )
280                 fi
281                 break
282         fi
283 done
284
285 dnl Die if the library is required, but not found
286 if test "x$db3_required" != "xno"; then
287         if test "x$db3_found" = "xno"; then
288                 dnl Not Found
289                 AC_MSG_ERROR([Berkeley DB3 library not found!])
290         fi
291 fi
292
293 AC_ARG_WITH(did,
294         [  --with-did=[scheme]     set DID scheme (last,mtab)],
295         if test "x$withval" != "xno" ; then
296                 if test "$withval" = "last"; then
297                         AC_DEFINE(USE_LASTDID, 1)
298                         AC_MSG_RESULT([enabling build without DID dev/inode mapping kludge])
299                 fi
300                 if test "$withval" = "mtab"; then
301                         AC_DEFINE(DID_MTAB, 1)
302                         AC_MSG_RESULT([enabling mtab-based DID creation support])
303                 fi
304         fi
305 )
306
307 msg_dir=""
308 AC_ARG_WITH(message-dir,
309         [  --with-msg-dir=path     path to message files [default=$ac_prefix_default/etc/msg]],
310                 msg_dir="$withval"
311                 if test x"$msg_dir" = "x"; then
312                         msg_dir="${PKGCONFDIR}/msg"
313                 fi
314                 AC_DEFINE_UNQUOTED(SERVERTEXT, "$msg_dir",
315                         [path to message dir [default=$ac_prefix_default/etc/msg]])
316                 SERVERTEXT="$msg_dir"
317                 AC_SUBST(SERVERTEXT)
318 )
319
320 AC_ARG_ENABLE(srvloc,
321         [  --enable-srvloc         Turn on Server Location Protocol support (EXPERIMENTAL)],
322         srvloc=$enableval,
323         srvloc=no
324 )
325
326 dnl Conditional for optional server location protocol support (used by OS X)
327 AM_CONDITIONAL(USE_SRVLOC, test "x$srvloc" != "xno")
328 if test "x$srvloc" != "xno"; then
329     for slpdir in "" $srvloc /usr /usr/local ; do
330                 if test -f "$slpdir/include/slp.h" ; then
331                         LDFLAGS="$LDFLAGS -L$slpdir/lib -lslp"
332                         CFLAGS="$CFLAGS -I$slpdir/include"
333                 AC_CHECK_LIB(slp,SLPOpen)
334                 AC_CHECK_FUNCS(SLPReg SLPDereg SLPClose)
335                 AC_DEFINE(USE_SRVLOC, 1)
336                         break
337                 fi
338         done
339 fi
340
341 # Check for PAM libs
342 AC_MSG_CHECKING([whether PAM support should be enabled])
343 AC_ARG_WITH(pam,
344     [  --with-pam              Enable PAM support],
345     [PAM_MSG="$withval"],
346     [PAM_MSG="yes"]
347 )
348 AC_MSG_RESULT($PAM_MSG)
349 use_pam_so=yes
350 compile_pam=yes
351
352 if test "x$PAM_MSG" = "xyes"; then
353         if test "x$ac_cv_header_security_pam_appl_h" = "xyes" ; then
354         
355                 AC_CHECK_LIB(pam, pam_set_item, 
356                                 [use_pam_so=yes; compile_pam=yes; AC_DEFINE(USE_PAM)],
357                         [use_pam_so=no; compile_pam=no]
358                 )
359         fi
360 else
361         use_pam_so=no
362         compile_pam=no
363 fi
364
365 AC_MSG_CHECKING([whether shadow support should be enabled])
366 AC_ARG_WITH(shadow,
367         [  --with-shadow           enable shadow password support],
368         [shadowpw="$withval"],
369         [shadowpw=no]
370 )
371 if test "x$shadowpw" = "xyes"; then
372         AC_DEFINE(SHADOWPW)
373 fi
374 AC_MSG_RESULT([$shadowpw])
375
376 AC_ARG_ENABLE(shell-check,
377         [  --disable-shell-check   disable checking for a valid shell],
378         if test "$enableval" = "no"; then 
379                 AC_DEFINE(DISABLE_SHELLCHECK, 1)
380                 AC_MSG_RESULT([disabling valid shell check])
381         fi
382 )
383
384 AC_MSG_CHECKING([whether flock locks should be enabled])
385 AC_ARG_WITH(flock-locks,
386         [  --with-flock-locks      enable flock locks support],
387         [flock_locks="$withval"],
388         [flock_locks="no"]
389 )
390 if test "x$flock_locks" = "xyes"; then
391         AC_DEFINE(USE_FLOCK_LOCKS)
392 fi
393 AC_MSG_RESULT([$flock_locks])
394
395 AC_ARG_WITH(tcp-wrappers,
396         [  --with-tcp-wrappers     enable TCP wrappers support],
397         AC_CHECK_LIB(wrap, tcpd_warn,
398                 AC_DEFINE(TCPWRAP)
399                 AFPD_LIBS="$AFPD_LIBS -lwrap"
400                 AC_MSG_RESULT([enabling TCP wrappers support])
401         )
402 )
403
404 AC_ARG_ENABLE(redhat,
405         [  --enable-redhat         use redhat-style sysv configuration ],
406         if test "$enableval" = "yes"; then
407                 sysv_style=redhat
408         fi
409         AC_MSG_RESULT([enabling redhat-style sysv support])
410 )
411
412 AC_ARG_ENABLE(suse,
413         [  --enable-suse           use suse-style sysv configuration ],
414         if test "$enableval" = "yes"; then
415                 sysv_style=suse
416         fi
417         AC_MSG_RESULT([enabling suse-style sysv support])
418 )
419
420 AC_ARG_ENABLE(cobalt,
421         [  --enable-cobalt         use cobalt-style sysv configuration ],
422         if test "$enableval" = "yes"; then
423                 sysv_style=cobalt
424         fi
425         AC_MSG_RESULT([enabling cobalt-style sysv support])
426 )
427
428 dnl ----- timelord compilation (disabled by default)
429 AC_MSG_CHECKING([whether timelord should be compiled])
430 compile_timelord=no
431 AC_ARG_ENABLE(timelord,
432         [  --enable-timelord       enable compilation of timelord server],
433         [compile_timelord="$enableval"],
434         [compile_timelord="no"]
435 )
436 AC_MSG_RESULT([$compile_timelord])
437
438 AC_ARG_WITH(uams-path,
439         [  --with-uams-path=path   path to UAMs [default=PKGCONF/uams]],
440         uams_path="$withval",
441         uams_path="${PKGCONFDIR}/uams"
442 )
443
444 dnl --------------------------------------------------------------------------
445 dnl FHS stuff has to be done last because it overrides other defaults
446 dnl --------------------------------------------------------------------------
447
448 AC_ARG_ENABLE(fhs,
449         [  --enable-fhs            use Filesystem Hierarchy Standard (FHS) compatibility],
450         if test "$enableval" = "yes"; then
451                 uams_path="/usr/lib/netatalk"
452                 sysconfdir="/etc"
453                 PKGCONFDIR=${sysconfdir}/netatalk
454                 use_pam_so=yes
455                 dnl FIXME: NEED TO HAVE --mandir=/usr/share/man AT SOME POINT...
456                 AC_DEFINE(FHS_COMPATIBILITY)
457         fi
458         AC_MSG_RESULT([enabling Filesystem Hierarchy Standard (FHS) compatibility])
459 )
460
461 dnl --------------------------------------------------------------------------
462 dnl post-FHS substitutions, etc
463 dnl --------------------------------------------------------------------------
464
465 dnl ***** UAMS_PATH
466 AC_DEFINE_UNQUOTED(UAMS_PATH, "${uams_path}",
467         [path to UAMs [default=PKGCONF/uams]])
468 UAMS_PATH="${uams_path}"
469 AC_SUBST(UAMS_PATH)
470
471 dnl --------------------------------------------------------------------------
472 dnl drop in includes for top level directory structures here...
473 dnl --------------------------------------------------------------------------
474 LDFLAGS="$LDFLAGS -L\$(top_srcdir)/libatalk/"
475 CFLAGS="$CFLAGS -I\$(top_srcdir)/include -I\$(top_srcdir)/sys"
476
477 dnl --------------------------------------------------------------------------
478 dnl specific configuration comes in here:
479 dnl --------------------------------------------------------------------------
480
481 dnl ac_cv_target_os is now host_os, ac_cv_target_cpu is now host_cpu
482
483 dnl --------------------- determine operating system from "target"
484 case "$host_os" in
485         *aix*)                          this_os=aix ;;
486         *freebsd*)                      this_os=freebsd ;;
487         *hpux11*)                       this_os=hpux11 ;;
488         *irix*)                         this_os=irix ;;
489         *linux*)                        this_os=linux ;;
490         *osx*)                          this_os=macosx ;;
491         *netbsd*)                       this_os=netbsd ;;
492         *openbsd*)                      this_os=openbsd ;;
493         *osf*)                          this_os=tru64 ;;
494         *solaris*)                      this_os=solaris ;;
495 esac
496
497 case "$host_cpu" in
498         i386|i486|i586|i686|k7)         this_cpu=x86 ;;
499         alpha)                                          this_cpu=alpha ;;
500         mips)                                           this_cpu=mips ;;
501         powerpc|ppc)                            this_cpu=ppc ;;
502 esac
503
504 dnl --------------------- operating system specific flags (port from sys/*)
505
506 dnl ----- AIX specific -----
507 if test x"$this_os" = "xaix"; then
508         AC_MSG_RESULT([ * AIX specific configuration])
509         AC_DEFINE(NO_STRUCT_TM_GMTOFF)
510
511         dnl This is probably a lie; AIX 4.3 supports a 64-bit long
512         dnl compilation environment.  It's enough to get things defined
513         dnl right in endian.h provided that long long is supported, though.
514         AC_DEFINE(HAVE_32BIT_LONGS)
515 fi
516
517 dnl ----- FreeBSD specific -----
518 if test x"$this_os" = "xfreebsd"; then 
519         AC_MSG_RESULT([ * FreeBSD specific configuration])
520         AC_DEFINE(BSD4_4)
521         AC_DEFINE(SENDFILE_FLAVOR_BSD)
522
523         dnl ----- Set -shared flag
524         LDSHAREDFLAGS="-shared"
525         AC_DEFINE(NO_CRYPT_H, 1)
526 fi
527
528 dnl ----- HP-UX 11 specific -----
529 if test x"$this_os" = "xhpux11"; then
530         AC_MSG_RESULT([ * HP-UX 11 specific configuration])
531
532         AC_DEFINE(_ISOC9X_SOURCE)
533         AC_DEFINE(NO_STRUCT_TM_GMTOFF)
534 fi
535
536 dnl ----- IRIX specific -----
537 if test x"$this_os" = "xirix"; then
538         AC_MSG_RESULT([ * IRIX specific configuration])
539
540         AC_DEFINE(NO_STRUCT_TM_GMTOFF)
541 fi
542
543 dnl ----- Linux specific -----
544 if test x"$this_os" = "xlinux"; then 
545         AC_MSG_RESULT([ * Linux specific configuration])
546
547         dnl ----- Set -shared flag
548         LDSHAREDFLAGS="-shared"
549
550         dnl ----- check if we need the quotactl wrapper
551         AC_CHECK_HEADERS(sys/quota.h linux/quota.h)
552         AC_CHECK_FUNC(quotactl,,
553                 AC_DEFINE(NEED_QUOTACTL_WRAPPER)
554                 AC_MSG_RESULT([enabling quotactl wrapper])
555         )
556
557         dnl ----- as far as I can tell, dbtob always does the wrong thing
558         dnl ----- on every single version of linux I've ever played with.
559         dnl ----- see etc/afpd/quota.c
560         AC_DEFINE(HAVE_BROKEN_DBTOB)
561
562         dnl --- added by Yoshinobu Ishizaki (2001.03.13) ---
563         dnl ----- check if version is newer than 2.2.x
564         changequote(<<,>>)
565         majorvers="`uname -r | sed 's/\([0-9]\)..*/\1/'`"
566         minorvers="`uname -r | sed 's/[0-9]\.\([0-9]\)\..*/\1/'`"
567         if [ $majorvers -ge 2 ]; then
568                 if [ $minorvers -ge 2 ]; then
569                         changequote([,])
570                         AC_MSG_RESULT([ * found Linux 2.2.x or higher])
571                         AC_DEFINE(SENDFILE_FLAVOR_LINUX)
572                 else
573                         AC_MSG_RESULT([ * found Linux 2.0.x ]) 
574                 fi
575         fi
576
577         dnl ----- Linux/alpha specific -----
578         if test x"$this_cpu" = "xalpha"; then 
579                 AC_MSG_RESULT([enabling gcc memcpy bug workaround])
580                 AC_DEFINE(HAVE_GCC_MEMCPY_BUG)
581         fi
582         need_dash_r=no
583 fi
584
585 dnl ----- Mac OSX specific -----
586 if test x"$this_os" = "xmacosx"; then 
587         AC_MSG_RESULT([ * Mac OSX specific configuration])
588         AC_DEFINE(BSD4_4)
589         AC_DEFINE(HAVE_BROKEN_CPP)
590         AC_DEFINE(HAVE_2ARG_DBTOB)
591         dnl AC_DEFINE(NO_DLFCN_H)
592         AC_DEFINE(MACOSX_SERVER)
593
594         dnl ----- Set -shared flag
595         LDSHAREDFLAGS="-shared"
596 fi
597
598 dnl ----- NetBSD specific -----
599 if test x"$this_os" = "xnetbsd"; then 
600         AC_MSG_RESULT([ * NetBSD specific configuration])
601         AC_DEFINE(BSD4_4)
602         AC_DEFINE(DLSYM_PREPEND_UNDERSCORE)
603         CFLAGS="-I\$(top_srcdir)/sys/netbsd -I/usr/include/kerberosIV $CFLAGS"
604         need_dash_r=yes 
605
606         dnl ----- Set -shared flag
607         LDSHAREDFLAGS="-shared"
608
609         dnl ----- NetBSD does not have crypt.h, uses unistd.h -----
610         AC_DEFINE(UAM_DHX, 1)
611         AC_DEFINE(UAM_RNDNUM, 1)
612         compile_dhx=yes
613         compile_ssl=yes
614         AC_DEFINE(NO_CRYPT_H, 1)
615 fi
616
617 dnl ----- OpenBSD specific -----
618 if test x"$this_os" = "xopenbsd"; then 
619         AC_MSG_RESULT([ * OpenBSD specific configuration])
620         AC_DEFINE(BSD4_4)
621         AC_DEFINE(DLSYM_PREPEND_UNDERSCORE)
622
623         dnl ----- Set -shared flag
624         LDSHAREDFLAGS="-Bforcearchive -shared"
625
626         dnl ----- OpenBSD does not have crypt.h, uses unistd.h -----
627         AC_DEFINE(UAM_DHX, 1)
628         AC_DEFINE(UAM_RNDNUM, 1)
629         compile_dhx=yes
630         compile_ssl=yes
631         AC_DEFINE(NO_CRYPT_H, 1)
632 fi
633
634 dnl ----- Solaris specific -----
635 if test x"$this_os" = "xsolaris"; then 
636         AC_MSG_RESULT([ * Solaris specific configuration])
637         AC_DEFINE(__svr4__)
638         AC_DEFINE(_ISOC9X_SOURCE)
639         AC_DEFINE(NO_STRUCT_TM_GMTOFF)
640         AC_DEFINE(SOLARIS)
641         CFLAGS="-I\$(top_srcdir)/sys/generic $CFLAGS"
642         need_dash_r=yes
643
644         dnl ----- Set -shared flag
645         LDSHAREDFLAGS="-G"
646
647         AC_MSG_RESULT([enabling Solaris kernel module build])
648         solaris_module=yes
649 fi
650
651 dnl ----- Tru64 specific -----
652 if test x"$this_os" = "xtru64"; then 
653         AC_MSG_RESULT([ * Tru64 specific configuration])
654         AC_DEFINE(NO_DDP)
655         AC_DEFINE(HAVE_64BIT_LONGS)
656         dnl AC_DEFINE(USE_MOUNT_H)
657         AC_DEFINE(USE_OLD_RQUOTA)
658         dnl AC_DEFINE(USE_UFS_QUOTA_H)
659         AC_DEFINE(TRU64)
660         AC_CHECK_LIB(security,set_auth_parameters)
661         CFLAGS="-I\$(top_srcdir)/sys/tru64 $CFLAGS"
662         LDSHAREDFLAGS="-shared -expect_unresolved \*"
663         need_dash_r=no
664         sysv_style=tru64
665
666         dnl ----- Set -shared flag
667         LDSHAREDFLAGS="-shared"
668 fi
669
670 dnl -- look for openssl
671 tryssl=yes
672 AC_ARG_WITH(ssl-dir,
673         [  --with-ssl-dir=PATH     specify path to openssl installation (must contain
674                           lib and include dirs) ],
675         [
676                 if test "x$withval" != "xno"; then
677                         tryssldir=$withval
678                 else
679                         tryssl=no
680                 fi
681         ]
682 )
683
684 if test "$tryssl" = "yes"; then
685         for ssldir in "" $tryssldir /usr /usr/local/openssl /usr/lib/openssl/ /usr/local/ssl /usr/lib/ssl /usr/local /usr/pkg /opt /opt/openssl /usr/local/ssl ; do
686                 if test -f "$ssldir/include/openssl/cast.h" ; then
687                         LDFLAGS="$LDFLAGS -L$ssldir/lib -L$ssldir"
688                         CFLAGS="$CFLAGS -I$ssldir/include -I$ssldir/include/openssl"
689                         if test "$need_dash_r" = "yes"; then
690                                 LIBS="$LIBS -R$ssldir/lib -R$ssldir"
691                         fi
692
693                         dnl Check for the crypto library:
694                         AC_CHECK_LIB(crypto, main)
695                         dnl LIBS="$LIBS -lcrypto"
696                         dnl Check for "DES" library (for SSLeay, not openssl):
697                         AC_CHECK_LIB(des, main)
698
699                         AC_DEFINE(OPENSSL_DHX,  1)
700                         AC_DEFINE(UAM_DHX,      1)
701                         AC_DEFINE(UAM_RNDNUM,   1)
702                         compile_dhx=yes
703                         compile_ssl=yes
704                         AC_MSG_RESULT([Found ssl and enabling RANDNUM and DHX support "$ssldir"])
705                         break
706                 fi
707         done
708 fi
709
710 dnl --------------------- check for building PGP UAM module
711
712 AC_ARG_ENABLE(pgp-uam,
713         [  --enable-pgp-uam        enable build of PGP UAM module],
714         if test "$enableval" = "yes"; then 
715                 if test "$compile_ssl" = "yes"; then 
716                         AC_DEFINE(UAM_PGP, 1)
717                         compile_pgp=yes
718                         AC_MSG_RESULT([enabling build with PGP UAM module])
719                 fi
720         fi
721 )
722
723 dnl --------------------- check for building Kerberos v4 UAM module
724
725 AC_ARG_ENABLE(krb4-uam,
726         [  --enable-krb4-uam      enable build of Kerberos v4 UAM module],
727         if test "$enableval" = "yes"; then
728                 AC_DEFINE(UAM_KRB4, 1)
729                 compile_kerberos=yes
730                 AC_MSG_RESULT([enabling build with Kerberos v4 UAM module])
731         fi
732 )
733 dnl --------------------- overwrite the config files . . . or not.
734
735 AC_MSG_CHECKING([whether configuration files should be overwritten])
736 AC_ARG_ENABLE(overwrite,
737         [  --enable-overwrite      Overwrite configuration files
738                                    default=PKGCONFDIR],
739         [OVERWRITE_CONFIG="${enable_overwrite}"],
740         [OVERWRITE_CONFIG="no"]
741 )
742 AC_MSG_RESULT([$OVERWRITE_CONFIG])
743
744 dnl --------------------- last minute substitutions
745
746 AC_SUBST(LIBS)
747 AC_SUBST(AFPD_LIBS)
748 AC_SUBST(PAPD_LIBS)
749 AC_SUBST(CFLAGS)
750 AC_SUBST(LDSHAREDFLAGS)
751 AC_SUBST(PKGCONFDIR)
752 AC_SUBST(OVERWRITE_CONFIG)
753
754 AM_CONDITIONAL(SOLARIS_MODULE, test x$solaris_module = xyes)
755 AM_CONDITIONAL(COMPILE_TIMELORD, test x$compile_timelord = xyes)
756 AM_CONDITIONAL(USE_DHX, test x$compile_dhx = xyes)
757 AM_CONDITIONAL(USE_KERBEROS, test x$compile_kerberos = xyes)
758 AM_CONDITIONAL(USE_PAM_SO, test x$use_pam_so = xyes)
759 AM_CONDITIONAL(USE_PAM, test x$compile_pam = xyes)
760 AM_CONDITIONAL(BUILD_PAM, test x$compile_pam = xyes)
761 AM_CONDITIONAL(USE_PGP, test x$compile_pgp = xyes)
762 AM_CONDITIONAL(USE_COBALT, test x$sysv_style = xcobalt)
763 AM_CONDITIONAL(USE_REDHAT, test x$sysv_style = xredhat)
764 AM_CONDITIONAL(USE_SUSE, test x$sysv_style = xsuse)
765 AM_CONDITIONAL(USE_SHADOWPW, test x$shadowpw = xyes)
766 AM_CONDITIONAL(USE_TRU64, test x$sysv_style = xtru64)
767
768 dnl --------------------- generate files
769
770 AC_OUTPUT([Makefile
771         bin/Makefile
772         bin/adv1tov2/Makefile
773         bin/aecho/Makefile
774         bin/afile/Makefile
775         bin/afppasswd/Makefile
776         bin/getzones/Makefile
777         bin/megatron/Makefile
778         bin/nbp/Makefile
779         bin/pap/Makefile
780         bin/psorder/Makefile
781         config/Makefile
782         contrib/Makefile
783         contrib/macusers/Makefile
784         contrib/nu/Makefile
785         contrib/printing/Makefile
786         contrib/shell_utils/Makefile
787         contrib/timelord/Makefile
788         distrib/Makefile
789         distrib/config/Makefile
790         distrib/config/netatalk-config
791         distrib/initscripts/Makefile
792         distrib/m4/Makefile
793         doc/Makefile
794         etc/Makefile
795         etc/afpd/Makefile
796         etc/afpd/nls/Makefile
797         etc/atalkd/Makefile
798         etc/uams/Makefile
799         etc/uams/uams_krb4/Makefile
800         etc/papd/Makefile
801         etc/psf/Makefile
802         include/Makefile
803         include/atalk/Makefile
804         libatalk/Makefile
805         libatalk/adouble/Makefile
806         libatalk/asp/Makefile
807         libatalk/atp/Makefile
808         libatalk/cnid/Makefile
809         libatalk/compat/Makefile
810         libatalk/dsi/Makefile
811         libatalk/nbp/Makefile
812         libatalk/netddp/Makefile
813         libatalk/util/Makefile
814         man/Makefile
815         man/man1/Makefile
816         man/man3/Makefile
817         man/man4/Makefile
818         man/man5/Makefile
819         man/man8/Makefile
820         sys/Makefile
821         sys/generic/Makefile
822         sys/generic/sys/Makefile
823         sys/netatalk/Makefile
824         sys/netbsd/Makefile
825         sys/netbsd/netatalk/Makefile
826         sys/solaris/Makefile
827         sys/sunos/Makefile
828         sys/ultrix/Makefile
829         ],
830         [chmod a+x distrib/config/netatalk-config contrib/shell_utils/apple_*]
831 )
832