]> arthur.barton.de Git - netatalk.git/blob - configure.in
removed Debian build specific flags from fhs section (Sebastian Rittau)
[netatalk.git] / configure.in
1 dnl configure.in for netatalk
2
3 AC_INIT(bin/adv1tov2/adv1tov2.c)
4
5 NETATALK_VERSION=`cat VERSION`
6 AC_SUBST(NETATALK_VERSION)
7
8 AC_CANONICAL_SYSTEM
9 AM_INIT_AUTOMAKE(netatalk, ${NETATALK_VERSION})
10 AM_CONFIG_HEADER(config.h)
11 AM_PROG_LIBTOOL
12
13 dnl Reset locations to proper places
14 AC_PREFIX_DEFAULT(/usr)
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_PROG_LIBTOOL
23
24 dnl *********************************************************************
25 dnl FIXME! FIXME! These should be selectable properly, and should produce
26 dnl the proper flags and defines...
27 dnl *********************************************************************
28
29 dnl Checks for libraries.
30 dnl Replace `main' with a function in -labs:
31 AC_CHECK_LIB(abs, main)
32 dnl Replace `main' with a function in -laudit:
33 AC_CHECK_LIB(audit, main)
34 dnl Replace `main' with a function in -lauth:
35 AC_CHECK_LIB(auth, main)
36 dnl Replace `main' with a function in -lcmd:
37 AC_CHECK_LIB(cmd, main)
38 dnl Replace `main' with a function in -lcom_err:
39 AC_CHECK_LIB(com_err, main)
40 dnl Replace `main' with a function in -lcrypt:
41 AC_CHECK_LIB(crypt, main)
42 dnl Replace `main' with a function in -ld:
43 AC_CHECK_LIB(d, main)
44 dnl Replace `main' with a function in -ldb:
45 AC_CHECK_LIB(db, main)
46 dnl Replace `main' with a function in -ldl:
47 AC_CHECK_LIB(dl, main)
48 dnl Replace `main' with a function in -lkauth:
49 AC_CHECK_LIB(kauth, main)
50 dnl Replace `main' with a function in -lkrb:
51 AC_CHECK_LIB(krb, main)
52 dnl Replace `main' with a function in -llwp:
53 AC_CHECK_LIB(lwp, main)
54 dnl Replace `main' with a function in -ln:
55 AC_CHECK_LIB(n, main)
56 dnl Replace `main' with a function in -lnsl:
57 AC_CHECK_LIB(nsl, main)
58 dnl Replace `main' with a function in -lprot:
59 AC_CHECK_LIB(prot, main)
60 dnl Replace `main' with a function in -lresolv:
61 AC_CHECK_LIB(resolv, main)
62 dnl Replace `main' with a function in -lrpcsvc:
63 AC_CHECK_LIB(rpcsvc, main)
64 dnl Replace `main' with a function in -lrx:
65 AC_CHECK_LIB(rx, main)
66 dnl Replace `main' with a function in -lrxkad:
67 AC_CHECK_LIB(rxkad, main)
68 dnl Replace `main' with a function in -lsocket:
69 AC_CHECK_LIB(socket, main)
70 dnl Replace `main' with a function in -lsys:
71 AC_CHECK_LIB(sys, main)
72 dnl Replace `main' with a function in -lubik:
73 AC_CHECK_LIB(ubik, main)
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 dnl Checks for header files.
84 AC_HEADER_DIRENT
85 AC_HEADER_STDC
86 AC_HEADER_SYS_WAIT
87 AC_CHECK_HEADERS(fcntl.h limits.h stdint.h strings.h sys/file.h sys/ioctl.h sys/time.h syslog.h unistd.h termios.h netdb.h)
88 AC_CHECK_HEADER(sys/cdefs.h,,
89         AC_MSG_RESULT([enabling generic cdefs.h from tree])
90         CFLAGS="-I\$(top_srcdir)/sys/generic $CFLAGS"
91 )
92
93 # Allow user to specify flags
94 AC_ARG_WITH(cflags,
95         [  --with-cflags           specify additional flags to pass to compiler],
96         [
97                 if test "x$withval" != "xno" ; then
98                         CFLAGS="$CFLAGS $withval"
99                 fi
100         ]       
101 )
102 AC_ARG_WITH(libs,
103         [  --with-libs             specify additional libraries to link with],
104         [
105                 if test "x$withval" != "xno" ; then
106                         LIBS="$LIBS $withval"
107                 fi
108         ]
109 )
110
111 dnl Checks for typedefs, structures, and compiler characteristics.
112 AC_C_CONST
113 AC_TYPE_UID_T
114 AC_C_INLINE
115 AC_TYPE_MODE_T
116 AC_TYPE_OFF_T
117 AC_TYPE_PID_T
118 AC_TYPE_SIZE_T
119 AC_STRUCT_ST_RDEV
120 AC_HEADER_TIME
121 AC_STRUCT_TM
122
123 dnl Checks for library functions.
124 AC_TYPE_GETGROUPS
125 AC_PROG_GCC_TRADITIONAL
126 AC_FUNC_MEMCMP
127 AC_HEADER_MAJOR
128 AC_FUNC_MMAP
129 AC_TYPE_SIGNAL
130 AC_FUNC_UTIME_NULL
131 AC_FUNC_WAIT3
132 AC_CHECK_FUNCS(getcwd gethostname gettimeofday getusershell mkdir rmdir select socket strdup strstr strtoul setpgrp)
133 AC_FUNC_SETPGRP
134
135 dnl --------------------------------------------------------------------------
136 dnl specific configuration comes in here:
137 dnl --------------------------------------------------------------------------
138
139 AC_DEFINE(ADMIN_GRP, 1)
140
141 AC_ARG_WITH(admin-group,
142         [  --disable-admin-group  disable admin group],
143         if test "$enableval" = "no"; then
144                         AC_DEFINE(ADMIN_GRP, 0)
145                         AC_MSG_RESULT([disabling administrative group support])
146         fi
147  )
148
149 AC_ARG_WITH(auth-printing-dir,
150         [  --with-auth-printing-dir=path
151               path to authenticated printing directory],
152                 cap_dir="$withval"
153                 AC_DEFINE_UNQUOTED(CAPDIR, "$cap_dir")
154                 AC_DEFINE(USE_CAP)
155                 AC_MSG_RESULT([enabling authenticated printing support]),
156 )
157
158 AC_ARG_WITH(config-dir,
159         [  --with-config-dir=path  path to config files [default=/etc/atalk]],
160                 config_dir="$withval",
161                 config_dir="/etc/atalk"
162 )
163
164 AC_ARG_WITH(cracklib,
165         [  --with-cracklib=dict    enable/set location of cracklib dictionary],
166         cracklib="$withval"
167         AC_CHECK_LIB(crack, main,
168                 AC_DEFINE(USE_CRACKLIB) 
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 )
180
181 AC_ARG_ENABLE(ddp,
182         [  --disable-ddp           disable DDP],
183         if test "$enableval" = "no"; then 
184                 AC_DEFINE(NO_DDP, 1)
185                 AC_MSG_RESULT([disabling DDP])
186         fi
187 )
188
189 AC_ARG_ENABLE(debug,
190         [  --enable-debug          enable debug code],
191         if test "$enableval" != "no"; then
192                 if test "$enableval" = "yes"; then
193                         AC_DEFINE(DEBUG, 1)
194                 else
195                         AC_DEFINE_UNQUOTED(DEBUG, $enableval)
196                 fi 
197                 AC_MSG_RESULT([enabling debugging code])
198         else
199                 AC_DEFINE(DEBUG, 0)
200         fi
201 )
202
203
204 dnl ----------- A NOTE ABOUT DROPKLUDGE
205 dnl The trouble with this fix is that if you know what the file is called, it
206 dnl can be read from the Unix side.  That's okay for most academic institutions
207 dnl since the students don't have telnet access to the Mac servers.  There is
208 dnl currently no one working on further development/fixes of DROPKLUDGE.
209 dnl -----------
210
211 AC_ARG_ENABLE(dropkludge,
212         [  --enable-dropkludge     enable the experimental dropbox fix (INSECURE!) ],
213         if test "$enableval" = "yes"; then 
214                 AC_DEFINE(DROPKLUDGE, 1)
215                 AC_MSG_RESULT([enabling experimental dropbox support])
216         fi
217 )
218
219 AC_ARG_ENABLE(force-uidgid,
220         [  --enable-force-uidgid   allow forcing of uid/gid per volume (BROKEN) ],
221         if test "$enableval" = "yes"; then 
222                 AC_DEFINE(FORCE_UIDGID, 1)
223                 AC_MSG_RESULT([enabling forcing of uid/gid per volume])
224         fi
225 )
226
227 AC_ARG_ENABLE(lastdid,
228         [  --enable-lastdid        enable build without DID dev/inode mapping kludge],
229         if test "$enableval" = "yes"; then 
230                 AC_DEFINE(USE_LASTDID, 1)
231                 AC_MSG_RESULT([enabling build without DID dev/inode mapping kludge])
232         fi
233 )
234
235 msg_dir=""
236 AC_ARG_WITH(message-dir,
237         [  --with-msg-dir=path     path to message files [default=/etc/atalk/msg]],
238                 msg_dir="$withval"
239                 if test x"$msg_dir" = "x"; then
240                         msg_dir="$CONFIG_DIR/msg"
241                 fi
242                 AC_DEFINE_UNQUOTED(SERVERTEXT, "$msg_dir",
243                         [path to message dir [default=$CONFIG_DIR/msg]])
244                 SERVERTEXT="$msg_dir"
245                 AC_SUBST(SERVERTEXT)
246 )
247
248 AC_CHECK_LIB(pam, pam_start,
249         AC_DEFINE(USE_PAM, 1)
250         LIBS="$LIBS -lpam"
251         compile_pam=yes
252 )
253 AM_CONDITIONAL(BUILD_PAM, test x$compile_pam = xyes)
254
255 AC_ARG_WITH(pam,
256         [  --with-pam              enable password authentication modules support],
257         if test "x$compile_pam" = "xyes"; then
258                 use_pam_so=yes
259                 AC_MSG_RESULT([enabling pam modules support])
260         else
261                 AC_MSG_RESULT([pam libraries not found. Disabling pam modules support])
262         fi
263 )
264
265 AC_ARG_WITH(shadow,
266         [  --with-shadow           enable shadow password support],
267         AC_MSG_RESULT([enabling shadow password support])
268         AC_DEFINE(SHADOWPW)
269 )
270
271 AC_ARG_WITH(flock-locks,
272         [  --with-flock-locks      enable flock locks support],
273         AC_MSG_RESULT([enabling flock locks])
274         AC_DEFINE(USE_FLOCK_LOCKS)
275 )
276
277 AC_ARG_WITH(tcp-wrappers,
278         [  --with-tcp-wrappers     enable TCP wrappers support],
279         AC_CHECK_LIB(wrap, main,
280                 AC_DEFINE(TCPWRAP)
281                 LIBS="$LIBS -lwrap"
282                 AC_MSG_RESULT([enabling TCP wrappers support])
283         )
284 )
285
286 AC_ARG_ENABLE(redhat,
287         [  --enable-redhat         use redhat-style sysv configuration ],
288     if test "$enableval" = "yes"; then
289                 sysv_style=redhat
290         fi
291         AC_MSG_RESULT([enabling redhat-style sysv support])
292 )
293
294 AC_ARG_ENABLE(suse,
295         [  --enable-suse       use suse-style sysv configuration ],
296     if test "$enableval" = "yes"; then
297                 sysv_style=suse
298         fi
299         AC_MSG_RESULT([enabling suse-style sysv support])
300 )
301
302 AC_ARG_ENABLE(cobalt,
303         [  --enable-cobalt         use cobalt-style sysv configuration ],
304     if test "$enableval" = "yes"; then
305                 sysv_style=cobalt
306         fi
307         AC_MSG_RESULT([enabling cobalt-style sysv support])
308 )
309
310 AC_ARG_WITH(uams-path,
311         [  --with-uams-path=path   path to UAMs [default=/etc/atalk/uams]],
312         uams_path="$withval",
313         uams_path="$config_dir/uams"
314 )
315
316 dnl --------------------------------------------------------------------------
317 dnl FHS stuff has to be done last because it overrides other defaults
318 dnl --------------------------------------------------------------------------
319
320 AC_ARG_ENABLE(fhs,
321         [  --enable-fhs            use Filesystem Hierarchy Standard (FHS) compatibility],
322     if test "$enableval" = "yes"; then
323                 uams_path="/usr/lib/netatalk"
324                 config_dir="/etc/netatalk"
325                 use_pam_so=yes
326                 dnl FIXME: NEED TO HAVE --mandir=/usr/share/man AT SOME POINT...
327                 AC_DEFINE(FHS_COMPATIBILITY)
328         fi
329         AC_MSG_RESULT([enabling Filesystem Hierarchy Standard (FHS) compatibility])
330 )
331
332 dnl --------------------------------------------------------------------------
333 dnl post-FHS substitutions, etc
334 dnl --------------------------------------------------------------------------
335
336 dnl ***** CONFIG_DIR
337 AC_DEFINE_UNQUOTED(CONFIG_DIR, "$config_dir",
338         [path to config dir [default=/etc/atalk]])
339 CONFIG_DIR="$config_dir"
340 AC_SUBST(CONFIG_DIR)
341 AC_MSG_RESULT([setting configuration files location to $CONFIG_DIR])
342
343 dnl ***** UAMS_PATH
344 AC_DEFINE_UNQUOTED(UAMS_PATH, "$uams_path",
345         [path to UAMs [default=/etc/atalk/uams]])
346 UAMS_PATH="$uams_path"
347 AC_SUBST(UAMS_PATH)
348
349 dnl --------------------------------------------------------------------------
350 dnl drop in includes for top level directory structures here...
351 dnl --------------------------------------------------------------------------
352 LDFLAGS="$LDFLAGS -L\$(top_srcdir)/libatalk/"
353 CFLAGS="$CFLAGS -I\$(top_srcdir)/include -I\$(top_srcdir)/sys"
354
355 dnl --------------------------------------------------------------------------
356 dnl specific configuration comes in here:
357 dnl --------------------------------------------------------------------------
358
359 dnl ac_cv_target_os is now host_os, ac_cv_target_cpu is now host_cpu
360
361 dnl --------------------- determine operating system from "target"
362 case "$host_os" in
363         *freebsd*)                      this_os=freebsd ;;
364         *linux*)                        this_os=linux ;;
365         *osx*)                          this_os=macosx ;;
366         *netbsd*)                       this_os=netbsd ;;
367         *openbsd*)                      this_os=openbsd ;;
368         *osf*)                          this_os=tru64 ;;
369         *solaris*)                      this_os=solaris ;;
370 esac
371
372 case "$host_cpu" in
373         i386|i486|i586|i686|k7)         this_cpu=x86 ;;
374         alpha)                                          this_cpu=alpha ;;
375         mips)                                           this_cpu=mips ;;
376         powerpc|ppc)                            this_cpu=ppc ;;
377 esac
378
379 dnl --------------------- operating system specific flags (port from sys/*)
380
381 dnl ----- FreeBSD specific -----
382 if test x"$this_os" = "xfreebsd"; then 
383         AC_MSG_RESULT([ * FreeBSD specific configuration])
384         AC_DEFINE(BSD4_4)
385         AC_DEFINE(SENDFILE_FLAVOR_BSD)
386 fi
387
388 dnl ----- Linux specific -----
389 if test x"$this_os" = "xlinux"; then 
390         AC_MSG_RESULT([ * Linux specific configuration])
391         AC_DEFINE(SENDFILE_FLAVOR_LINUX)
392
393         dnl ----- check if we need the quotactl wrapper
394         AC_CHECK_HEADER(sys/quota.h,,
395                 AC_MSG_RESULT([enabling quotactl wrapper])
396                 AC_DEFINE(NEED_QUOTACTL_WRAPPER)
397         )
398
399         dnl ----- Linux/alpha specific -----
400         if test x"$this_cpu" = "xalpha"; then 
401                 AC_MSG_RESULT([enabling gcc memcpy bug workaround])
402                 AC_DEFINE(HAVE_GCC_MEMCPY_BUG)
403         fi
404         need_dash_r=no
405 fi
406
407 dnl ----- Mac OSX specific -----
408 if test x"$this_os" = "xmacosx"; then 
409         AC_MSG_RESULT([ * Mac OSX specific configuration])
410         AC_DEFINE(BSD4_4)
411         AC_DEFINE(HAVE_BROKEN_CPP)
412         AC_DEFINE(HAVE_2ARG_DBTOB)
413         AC_DEFINE(NO_DLFCN_H)
414         AC_DEFINE(MACOSX_SERVER)
415 fi
416
417 dnl ----- NetBSD specific -----
418 if test x"$this_os" = "xnetbsd"; then 
419         AC_MSG_RESULT([ * NetBSD specific configuration])
420         AC_DEFINE(BSD4_4)
421         AC_DEFINE(DLSYM_PREPEND_UNDERSCORE)
422         CFLAGS="-I\$(top_srcdir)/sys/netbsd -I/usr/include/kerberosIV $CFLAGS"
423         need_dash_r=yes 
424 fi
425
426 dnl ----- OpenBSD specific -----
427 if test x"$this_os" = "xopenbsd"; then 
428         AC_MSG_RESULT([ * OpenBSD specific configuration])
429         AC_DEFINE(BSD4_4)
430 fi
431
432 dnl ----- Solaris specific -----
433 if test x"$this_os" = "xsolaris"; then 
434         AC_MSG_RESULT([ * Solaris specific configuration])
435         AC_DEFINE(__svr4__)
436         AC_DEFINE(_ISOC9X_SOURCE)
437         AC_DEFINE(NO_STRUCT_TM_GMTOFF)
438         AC_DEFINE(SOLARIS)
439         CFLAGS="-I\$(top_srcdir)/sys/generic $CFLAGS"
440         need_dash_r=yes
441         AC_MSG_RESULT([enabling Solaris kernel module build])
442         solaris_module=yes
443 fi
444
445 dnl ----- Tru64 specific -----
446 if test x"$this_os" = "xtru64"; then 
447         AC_MSG_RESULT([ * Tru64 specific configuration])
448         AC_DEFINE(NO_DDP)
449         AC_DEFINE(HAVE_64BIT_LONGS)
450         AC_DEFINE(USE_MOUNT_H)
451         AC_DEFINE(USE_OLD_RQUOTA)
452         AC_DEFINE(USE_UFS_QUOTA_H)
453         AC_DEFINE(TRU64)
454         CFLAGS="-I\$(top_srcdir)/sys/tru64 $CFLAGS"
455         LDSHAREDFLAGS="-expect_unresolved \*"
456         need_dash_r=no
457         sysv_style=tru64
458 fi
459
460 dnl -- look for openssl  
461 AC_ARG_WITH(ssl-dir,
462         [  --with-ssl-dir=PATH     specify path to openssl installation (must contain
463                           lib and include dirs) ],
464         [
465                 if test "x$withval" != "$xno"; then
466                         tryssldir=$withval
467                 fi
468         ]
469 )
470
471 for ssldir in "" $tryssldir /usr /usr/local/openssl /usr/lib/openssl/ /usr/local/ssl /usr/lib/ssl /usr/local /usr/pkg /opt /opt/openssl ; do
472         if test -f "$ssldir/include/openssl/cast.h" ; then
473                 LDFLAGS="$LDFLAGS -L$ssldir/lib -L$ssldir"
474                 CFLAGS="$CFLAGS -I$ssldir/include -I$ssldir/include/openssl"
475                 if test "$need_dash_r" = "yes"; then
476                         LIBS="$LIBS -R$ssldir/lib -R$ssldir"
477                 fi
478
479                 dnl Check for the crypto library:
480                 AC_CHECK_LIB(crypto, main)
481                 dnl LIBS="$LIBS -lcrypto"
482                 dnl Check for "DES" library (for SSLeay, not openssl):
483                 AC_CHECK_LIB(des, main)
484
485                 AC_DEFINE(OPENSSL_DHX,  1)
486                 AC_DEFINE(UAM_DHX,      1)
487 dnl             AC_DEFINE(UAM_PGP,      1)
488                 AC_DEFINE(UAM_RNDNUM,   1)
489                 use_pgp=no
490                 compile_dhx=yes
491                 AC_MSG_RESULT([Found ssl and enabling RANDNUM and DHX support "$ssldir"])
492                 break
493         fi
494 done
495
496 dnl --------------------- last minute substitutions
497
498 AC_SUBST(LIBS)
499 AC_SUBST(CFLAGS)
500 AC_SUBST(LDSHAREDFLAGS)
501 AM_CONDITIONAL(SOLARIS_MODULE, test x$solaris_module = xyes)
502 AM_CONDITIONAL(USE_DHX, test x$compile_dhx = xyes)
503 AM_CONDITIONAL(USE_PAM_SO, test x$use_pam_so = xyes)
504 AM_CONDITIONAL(USE_PAM, test x$compile_pam = xyes)
505 AM_CONDITIONAL(USE_PGP, test x$compile_pgp = xyes)
506 AM_CONDITIONAL(USE_COBALT, test x$sysv_style = xcobalt)
507 AM_CONDITIONAL(USE_REDHAT, test x$sysv_style = xredhat)
508 AM_CONDITIONAL(USE_SUSE, test x$sysv_style = xsuse)
509 AM_CONDITIONAL(USE_TRU64, test x$sysv_style = xtru64)
510
511 dnl --------------------- generate files
512
513 AC_OUTPUT([Makefile
514         bin/Makefile
515         bin/adv1tov2/Makefile
516         bin/aecho/Makefile
517         bin/afile/Makefile
518         bin/afppasswd/Makefile
519         bin/getzones/Makefile
520         bin/megatron/Makefile
521         bin/nbp/Makefile
522         bin/pap/Makefile
523         bin/psorder/Makefile
524         config/Makefile
525         contrib/Makefile
526         contrib/nu/Makefile
527         contrib/printing/Makefile
528         contrib/shell_utils/Makefile
529         contrib/timelord/Makefile
530         distrib/Makefile
531         distrib/config/Makefile
532         distrib/config/netatalk-config
533         distrib/initscripts/Makefile
534         distrib/m4/Makefile
535         etc/Makefile
536         etc/afpd/Makefile
537         etc/afpd/nls/Makefile
538         etc/atalkd/Makefile
539         etc/uams/Makefile
540         etc/papd/Makefile
541         etc/psf/Makefile
542         include/Makefile
543         include/atalk/Makefile
544         libatalk/Makefile
545         libatalk/adouble/Makefile
546         libatalk/asp/Makefile
547         libatalk/atp/Makefile
548         libatalk/compat/Makefile
549         libatalk/dsi/Makefile
550         libatalk/nbp/Makefile
551         libatalk/netddp/Makefile
552         libatalk/util/Makefile
553         man/Makefile
554         man/man1/Makefile
555         man/man3/Makefile
556         man/man4/Makefile
557         man/man5/Makefile
558         man/man8/Makefile
559         sys/Makefile
560         sys/netatalk/Makefile
561         ],
562         [chmod a+x distrib/config/netatalk-config contrib/shell_utils/apple_*]
563 )
564