]> arthur.barton.de Git - netatalk.git/blob - configure.in
half of FORCE_UIDGID commits for afpd (STILL HORRENDOUSLY BROKEN, PROBABLY)
[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 AC_DEFINE_UNQUOTED(CONFIG_DIR, "$config_dir",
164         [path to config dir [default=/etc/atalk]])
165 CONFIG_DIR="$config_dir"
166 AC_SUBST(CONFIG_DIR)
167 AC_MSG_RESULT([setting configuration files location to $CONFIG_DIR])
168
169 AC_ARG_WITH(cracklib,
170         [  --with-cracklib=dict    enable/set location of cracklib dictionary],
171         cracklib="$withval"
172         AC_CHECK_LIB(crack, main,
173                 AC_DEFINE(USE_CRACKLIB) 
174                 LIBS="$LIBS -lcrack"
175                 AC_MSG_RESULT([enabling cracklib support])
176                 if test "$cracklib" = "yes"; then
177                         cracklib="/usr/lib/cracklib_dict"
178                 fi
179                 AC_DEFINE_UNQUOTED(_PATH_CRACKLIB, "$cracklib",
180                         [path to cracklib dictionary])
181                 AC_MSG_RESULT([setting cracklib dictionary to $cracklib]),
182                 AC_MSG_ERROR([cracklib not found!])
183         )
184 )
185
186 AC_ARG_ENABLE(ddp,
187         [  --disable-ddp           disable DDP],
188         if test "$enableval" = "no"; then 
189                 AC_DEFINE(NO_DDP, 1)
190                 AC_MSG_RESULT([disabling DDP])
191         fi
192 )
193
194 AC_ARG_ENABLE(debug,
195         [  --enable-debug          enable debug code],
196         if test "$enableval" != "no"; then
197                 if test "$enableval" = "yes"; then
198                         AC_DEFINE(DEBUG, 1)
199                 else
200                         AC_DEFINE_UNQUOTED(DEBUG, $enableval)
201                 fi 
202                 AC_MSG_RESULT([enabling debugging code])
203         else
204                 AC_DEFINE(DEBUG, 0)
205         fi
206 )
207
208
209 dnl ----------- A NOTE ABOUT DROPKLUDGE
210 dnl The trouble with this fix is that if you know what the file is called, it
211 dnl can be read from the Unix side.  That's okay for most academic institutions
212 dnl since the students don't have telnet access to the Mac servers.  There is
213 dnl currently no one working on further development/fixes of DROPKLUDGE.
214 dnl -----------
215
216 AC_ARG_ENABLE(dropkludge,
217         [  --enable-dropkludge     enable the experimental dropbox fix (INSECURE!) ],
218         if test "$enableval" = "yes"; then 
219                 AC_DEFINE(DROPKLUDGE, 1)
220                 AC_MSG_RESULT([enabling experimental dropbox support])
221         fi
222 )
223
224 AC_ARG_ENABLE(force-uidgid,
225         [  --enable-force-uidgid   allow forcing of uid/gid per volume (INSECURE?) ],
226         if test "$enableval" = "yes"; then 
227                 AC_DEFINE(FORCE_UIDGID, 1)
228                 AC_MSG_RESULT([enabling forcing of uid/gid per volume])
229         fi
230 )
231
232 AC_ARG_ENABLE(lastdid,
233         [  --enable-lastdid        enable build without DID dev/inode mapping kludge],
234         if test "$enableval" = "yes"; then 
235                 AC_DEFINE(USE_LASTDID, 1)
236                 AC_MSG_RESULT([enabling build without DID dev/inode mapping kludge])
237         fi
238 )
239
240 msg_dir=""
241 AC_ARG_WITH(message-dir,
242         [  --with-msg-dir=path     path to message files [default=/etc/atalk/msg]],
243                 msg_dir="$withval"
244                 if test x"$msg_dir" = "x"; then
245                         msg_dir="$CONFIG_DIR/msg"
246                 fi
247                 AC_DEFINE_UNQUOTED(SERVERTEXT, "$msg_dir",
248                         [path to message dir [default=$CONFIG_DIR/msg]])
249                 SERVERTEXT="$msg_dir"
250                 AC_SUBST(SERVERTEXT)
251 )
252
253 AC_CHECK_LIB(pam, pam_start,
254         AC_DEFINE(USE_PAM, 1)
255         LIBS="$LIBS -lpam"
256         compile_pam=yes
257 )
258 AM_CONDITIONAL(BUILD_PAM, test x$compile_pam = xyes)
259
260 AC_ARG_WITH(pam,
261         [  --with-pam              enable password authentication modules support],
262         if test "x$compile_pam" = "xyes"; then
263                 use_pam_so=yes
264                 AC_MSG_RESULT([enabling pam modules support])
265         else
266                 AC_MSG_RESULT([pam libraries not found. Disabling pam modules support])
267         fi
268 )
269
270 AC_ARG_WITH(shadow,
271         [  --with-shadow           enable shadow password support],
272         AC_MSG_RESULT([enabling shadow password support])
273         AC_DEFINE(SHADOWPW)
274 )
275
276 AC_ARG_WITH(flock-locks,
277         [  --with-flock-locks      enable flock locks support],
278         AC_MSG_RESULT([enabling flock locks])
279         AC_DEFINE(USE_FLOCK_LOCKS)
280 )
281
282 AC_ARG_WITH(tcp-wrappers,
283         [  --with-tcp-wrappers     enable TCP wrappers support],
284         AC_CHECK_LIB(wrap, main,
285                 AC_DEFINE(TCPWRAP)
286                 LIBS="$LIBS -lwrap"
287                 AC_MSG_RESULT([enabling TCP wrappers support])
288         )
289 )
290
291 AC_ARG_ENABLE(redhat,
292         [  --enable-redhat     use redhat-style sysv configuration ],
293     if test "$enableval" = "yes"; then
294                 sysv_style=redhat
295         fi
296         AC_MSG_RESULT([enabling redhat-style sysv support])
297 )
298
299 AC_ARG_ENABLE(cobalt,
300         [  --enable-cobalt     use cobalt-style sysv configuration ],
301     if test "$enableval" = "yes"; then
302                 sysv_style=cobalt
303         fi
304         AC_MSG_RESULT([enabling cobalt-style sysv support])
305 )
306
307 AC_ARG_WITH(uams-path,
308         [  --with-uams-path=path   path to UAMs [default=/etc/atalk/uams]],
309         uams_path="$withval",
310         uams_path="$config_dir/uams"
311 )
312 AC_DEFINE_UNQUOTED(UAMS_PATH, "$uams_path",
313         [path to UAMs [default=/etc/atalk/uams]])
314 UAMS_PATH="$uams_path"
315 AC_SUBST(UAMS_PATH)
316
317 dnl --------------------------------------------------------------------------
318 dnl drop in includes for top level directory structures here...
319 dnl --------------------------------------------------------------------------
320 LDFLAGS="$LDFLAGS -L\$(top_srcdir)/libatalk/"
321 CFLAGS="$CFLAGS -I\$(top_srcdir)/include -I\$(top_srcdir)/sys"
322
323 dnl --------------------------------------------------------------------------
324 dnl specific configuration comes in here:
325 dnl --------------------------------------------------------------------------
326
327 dnl ac_cv_target_os is now host_os, ac_cv_target_cpu is now host_cpu
328
329 dnl --------------------- determine operating system from "target"
330 case "$host_os" in
331         *freebsd*)                      this_os=freebsd ;;
332         *linux*)                        this_os=linux ;;
333         *osx*)                          this_os=macosx ;;
334         *netbsd*)                       this_os=netbsd ;;
335         *openbsd*)                      this_os=openbsd ;;
336         *osf*)                          this_os=tru64 ;;
337         *solaris*)                      this_os=solaris ;;
338 esac
339
340 case "$host_cpu" in
341         i386|i486|i586|i686|k7)         this_cpu=x86 ;;
342         alpha)                                          this_cpu=alpha ;;
343         mips)                                           this_cpu=mips ;;
344         powerpc|ppc)                            this_cpu=ppc ;;
345 esac
346
347 dnl --------------------- operating system specific flags (port from sys/*)
348
349 dnl ----- FreeBSD specific -----
350 if test x"$this_os" = "xfreebsd"; then 
351         AC_MSG_RESULT([ * FreeBSD specific configuration])
352         AC_DEFINE(BSD4_4)
353         AC_DEFINE(SENDFILE_FLAVOR_BSD)
354 fi
355
356 dnl ----- Linux specific -----
357 if test x"$this_os" = "xlinux"; then 
358         AC_MSG_RESULT([ * Linux specific configuration])
359         AC_DEFINE(SENDFILE_FLAVOR_LINUX)
360
361         dnl ----- check if we need the quotactl wrapper
362         AC_CHECK_HEADER(sys/quota.h,,
363                 AC_MSG_RESULT([enabling quotactl wrapper])
364                 AC_DEFINE(NEED_QUOTACTL_WRAPPER)
365         )
366
367         dnl ----- Linux/alpha specific -----
368         if test x"$this_cpu" = "xalpha"; then 
369                 AC_MSG_RESULT([enabling gcc memcpy bug workaround])
370                 AC_DEFINE(HAVE_GCC_MEMCPY_BUG)
371         fi
372         need_dash_r=no
373 fi
374
375 dnl ----- Mac OSX specific -----
376 if test x"$this_os" = "xmacosx"; then 
377         AC_MSG_RESULT([ * Mac OSX specific configuration])
378         AC_DEFINE(BSD4_4)
379         AC_DEFINE(HAVE_BROKEN_CPP)
380         AC_DEFINE(HAVE_2ARG_DBTOB)
381         AC_DEFINE(NO_DLFCN_H)
382         AC_DEFINE(MACOSX_SERVER)
383 fi
384
385 dnl ----- NetBSD specific -----
386 if test x"$this_os" = "xnetbsd"; then 
387         AC_MSG_RESULT([ * NetBSD specific configuration])
388         AC_DEFINE(BSD4_4)
389         AC_DEFINE(DLSYM_PREPEND_UNDERSCORE)
390         CFLAGS="-I\$(top_srcdir)/sys/netbsd -I/usr/include/kerberosIV $CFLAGS"
391         need_dash_r=yes 
392 fi
393
394 dnl ----- OpenBSD specific -----
395 if test x"$this_os" = "xopenbsd"; then 
396         AC_MSG_RESULT([ * OpenBSD specific configuration])
397         AC_DEFINE(BSD4_4)
398 fi
399
400 dnl ----- Solaris specific -----
401 if test x"$this_os" = "xsolaris"; then 
402         AC_MSG_RESULT([ * Solaris specific configuration])
403         AC_DEFINE(__svr4__)
404         AC_DEFINE(_ISOC9X_SOURCE)
405         AC_DEFINE(NO_STRUCT_TM_GMTOFF)
406         AC_DEFINE(SOLARIS)
407         CFLAGS="-I\$(top_srcdir)/sys/generic $CFLAGS"
408         need_dash_r=yes
409 fi
410
411 dnl ----- Tru64 specific -----
412 if test x"$this_os" = "xtru64"; then 
413         AC_MSG_RESULT([ * Tru64 specific configuration])
414         AC_DEFINE(NO_DDP)
415         AC_DEFINE(HAVE_64BIT_LONGS)
416         AC_DEFINE(USE_MOUNT_H)
417         AC_DEFINE(USE_OLD_RQUOTA)
418         AC_DEFINE(USE_UFS_QUOTA_H)
419         AC_DEFINE(TRU64)
420         CFLAGS="-I\$(top_srcdir)/sys/tru64 $CFLAGS"
421         LDSHAREDFLAGS="-expect_unresolved \*"
422         need_dash_r=no
423         sysv_style=tru64
424 fi
425
426 dnl -- look for openssl  
427 AC_ARG_WITH(ssl-dir,
428         [  --with-ssl-dir=PATH     specify path to openssl installation (must contain
429                           lib and include dirs) ],
430         [
431                 if test "x$withval" != "$xno"; then
432                         tryssldir=$withval
433                 fi
434         ]
435 )
436
437 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
438         if test -f "$ssldir/include/openssl/cast.h" ; then
439                 LDFLAGS="$LDFLAGS -L$ssldir/lib -L$ssldir"
440                 CFLAGS="$CFLAGS -I$ssldir/include -I$ssldir/include/openssl"
441                 if test "$need_dash_r" = "yes"; then
442                         LIBS="$LIBS -R$ssldir/lib -R$ssldir"
443                 fi
444
445                 dnl Check for the crypto library:
446                 AC_CHECK_LIB(crypto, main)
447                 dnl LIBS="$LIBS -lcrypto"
448                 dnl Check for "DES" library (for SSLeay, not openssl):
449                 AC_CHECK_LIB(des, main)
450
451                 AC_DEFINE(OPENSSL_DHX,  1)
452                 AC_DEFINE(UAM_DHX,      1)
453 dnl             AC_DEFINE(UAM_PGP,      1)
454                 AC_DEFINE(UAM_RNDNUM,   1)
455                 use_pgp=no
456                 compile_dhx=yes
457                 AC_MSG_RESULT([Found ssl and enabling RANDNUM and DHX support "$ssldir"])
458                 break
459         fi
460 done
461
462 dnl --------------------- last minute substitutions
463
464 AC_SUBST(LIBS)
465 AC_SUBST(CFLAGS)
466 AC_SUBST(LDSHAREDFLAGS)
467 AM_CONDITIONAL(USE_DHX, test x$compile_dhx = xyes)
468 AM_CONDITIONAL(USE_PAM_SO, test x$use_pam_so = xyes)
469 AM_CONDITIONAL(USE_PAM, test x$compile_pam = xyes)
470 AM_CONDITIONAL(USE_PGP, test x$compile_pgp = xyes)
471 AM_CONDITIONAL(USE_COBALT, test x$sysv_style = xcobalt)
472 AM_CONDITIONAL(USE_REDHAT, test x$sysv_style = xredhat)
473 AM_CONDITIONAL(USE_TRU64, test x$sysv_style = xtru64)
474
475 dnl --------------------- generate files
476
477 AC_OUTPUT([Makefile
478         bin/Makefile
479         bin/adv1tov2/Makefile
480         bin/aecho/Makefile
481         bin/afile/Makefile
482         bin/afppasswd/Makefile
483         bin/getzones/Makefile
484         bin/megatron/Makefile
485         bin/nbp/Makefile
486         bin/pap/Makefile
487         bin/psorder/Makefile
488         config/Makefile
489         contrib/Makefile
490         contrib/nu/Makefile
491         contrib/printing/Makefile
492         contrib/shell_utils/Makefile
493         contrib/timelord/Makefile
494         distrib/Makefile
495         distrib/config/Makefile
496         distrib/config/netatalk-config
497         distrib/initscripts/Makefile
498         distrib/m4/Makefile
499         etc/Makefile
500         etc/afpd/Makefile
501         etc/afpd/nls/Makefile
502         etc/atalkd/Makefile
503         etc/uams/Makefile
504         etc/papd/Makefile
505         etc/psf/Makefile
506         include/Makefile
507         include/atalk/Makefile
508         libatalk/Makefile
509         libatalk/adouble/Makefile
510         libatalk/asp/Makefile
511         libatalk/atp/Makefile
512         libatalk/compat/Makefile
513         libatalk/dsi/Makefile
514         libatalk/nbp/Makefile
515         libatalk/netddp/Makefile
516         libatalk/util/Makefile
517         man/Makefile
518         man/man1/Makefile
519         man/man3/Makefile
520         man/man4/Makefile
521         man/man5/Makefile
522         man/man8/Makefile
523         sys/Makefile
524         sys/netatalk/Makefile
525         ],
526         [chmod a+x distrib/config/netatalk-config contrib/shell_utils/apple_*]
527 )
528