]> arthur.barton.de Git - netatalk.git/blob - configure.in
added options for redhat and cobalt sysv scripts to install properly
[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 dnl Checks for header files.
76 AC_HEADER_DIRENT
77 AC_HEADER_STDC
78 AC_HEADER_SYS_WAIT
79 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)
80 AC_CHECK_HEADER(sys/cdefs.h,,
81         AC_MSG_RESULT([enabling generic cdefs.h from tree])
82         CFLAGS="-I\$(top_srcdir)/sys/generic $CFLAGS"
83 )
84
85 # Allow user to specify flags
86 AC_ARG_WITH(cflags,
87         [  --with-cflags           specify additional flags to pass to compiler],
88         [
89                 if test "x$withval" != "xno" ; then
90                         CFLAGS="$CFLAGS $withval"
91                 fi
92         ]       
93 )
94 AC_ARG_WITH(libs,
95         [  --with-libs             specify additional libraries to link with],
96         [
97                 if test "x$withval" != "xno" ; then
98                         LIBS="$LIBS $withval"
99                 fi
100         ]
101 )
102
103 dnl Checks for typedefs, structures, and compiler characteristics.
104 AC_C_CONST
105 AC_TYPE_UID_T
106 AC_C_INLINE
107 AC_TYPE_MODE_T
108 AC_TYPE_OFF_T
109 AC_TYPE_PID_T
110 AC_TYPE_SIZE_T
111 AC_STRUCT_ST_RDEV
112 AC_HEADER_TIME
113 AC_STRUCT_TM
114
115 dnl Checks for library functions.
116 AC_TYPE_GETGROUPS
117 AC_PROG_GCC_TRADITIONAL
118 AC_FUNC_MEMCMP
119 AC_HEADER_MAJOR
120 AC_FUNC_MMAP
121 AC_TYPE_SIGNAL
122 AC_FUNC_UTIME_NULL
123 AC_FUNC_WAIT3
124 AC_CHECK_FUNCS(getcwd gethostname gettimeofday getusershell mkdir rmdir select socket strdup strstr strtoul setpgrp)
125 AC_FUNC_SETPGRP
126
127 dnl --------------------------------------------------------------------------
128 dnl specific configuration comes in here:
129 dnl --------------------------------------------------------------------------
130
131 AC_DEFINE(ADMIN_GRP, 1)
132
133 AC_ARG_WITH(admin-group,
134         [  --disable-admin-group  disable admin group],
135         if test "$enableval" = "no"; then
136                 AC_DEFINE(ADMIN_GRP, 0)
137                 AC_MSG_RESULT([disabling administrative group support])
138         fi
139  )
140
141 AC_ARG_WITH(auth-printing-dir,
142         [  --with-auth-printing-dir=path
143               path to authenticated printing directory],
144                 cap_dir="$withval"
145                 AC_DEFINE_UNQUOTED(CAPDIR, "$cap_dir")
146                 AC_DEFINE(USE_CAP)
147                 AC_MSG_RESULT([enabling authenticated printing support]),
148 )
149
150 AC_ARG_WITH(config-dir,
151         [  --with-config-dir=path  path to config files [default=/etc/atalk]],
152                 config_dir="$withval",
153                 config_dir="/etc/atalk"
154 )
155 AC_DEFINE_UNQUOTED(CONFIG_DIR, "$config_dir",
156         [path to config dir [default=/etc/atalk]])
157 CONFIG_DIR="$config_dir"
158 AC_SUBST(CONFIG_DIR)
159 AC_MSG_RESULT([setting configuration files location to $CONFIG_DIR])
160
161 AC_ARG_WITH(cracklib,
162         [  --with-cracklib=dict    enable/set location of cracklib dictionary],
163         cracklib="$withval"
164         AC_CHECK_LIB(crack, main,
165                 AC_DEFINE(USE_CRACKLIB) 
166                 LIBS="$LIBS -lcrack"
167                 AC_MSG_RESULT([enabling cracklib support])
168                 if test "$cracklib" = "yes"; then
169                         cracklib="/usr/lib/cracklib_dict"
170                 fi
171                 AC_DEFINE_UNQUOTED(_PATH_CRACKLIB, "$cracklib",
172                         [path to cracklib dictionary])
173                 AC_MSG_RESULT([setting cracklib dictionary to $cracklib]),
174                 AC_MSG_ERROR([cracklib not found!])
175         )
176 )
177
178 AC_ARG_ENABLE(ddp,
179         [  --disable-ddp           disable DDP],
180         if test "$enableval" = "no"; then 
181                 AC_DEFINE(NO_DDP, 1)
182                 AC_MSG_RESULT([disabling DDP])
183         fi
184 )
185
186 AC_ARG_ENABLE(force2GB,
187         [  --enable-force2GB           enable force 2GB max reported volume size],
188         if test "x$enableval" = "xyes"; then 
189                 AC_DEFINE(FORCE_2GB, 1)
190                 AC_MSG_RESULT([enable force 2GB])
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         AC_DEFINE(DROPKLUDGE, 1)
219         AC_MSG_RESULT([enabling experimental dropbox support])
220 )
221
222 AC_ARG_ENABLE(lastdid,
223         [  --enable-lastdid        enable build without DID dev/inode mapping kludge],
224         if test "$enableval" = "yes"; then 
225                 AC_DEFINE(USE_LASTDID, 1)
226                 AC_MSG_RESULT([enabling build without DID dev/inode mapping kludge])
227         fi
228 )
229
230 msg_dir=""
231 AC_ARG_WITH(message-dir,
232         [  --with-msg-dir=path     path to message files [default=/etc/atalk/msg]],
233                 msg_dir="$withval"
234                 if test x"$msg_dir" = "x"; then
235                         msg_dir="$CONFIG_DIR/msg"
236                 fi
237                 AC_DEFINE_UNQUOTED(SERVERTEXT, "$msg_dir",
238                         [path to message dir [default=$CONFIG_DIR/msg]])
239                 SERVERTEXT="$msg_dir"
240                 AC_SUBST(SERVERTEXT)
241 )
242
243 AC_ARG_WITH(pam,
244         [  --with-pam              enable password authentication modules support],
245         AC_CHECK_LIB(pam, pam_start,
246                 AC_DEFINE(USE_PAM, 1)
247                 LIBS="$LIBS -lpam"
248                 compile_pam=yes
249                 AC_MSG_RESULT([enabling pam modules support])
250         )
251 )
252
253 AC_ARG_WITH(shadow,
254         [  --with-shadow           enable shadow password support],
255         AC_MSG_RESULT([enabling shadow password support])
256         AC_DEFINE(SHADOWPW)
257 )
258
259 AC_ARG_WITH(flock-locks,
260         [  --with-flock-locks      enable flock locks support],
261         AC_MSG_RESULT([enabling flock locks])
262         AC_DEFINE(USE_FLOCK_LOCKS)
263 )
264
265 AC_ARG_WITH(tcp-wrappers,
266         [  --with-tcp-wrappers     enable TCP wrappers support],
267         AC_CHECK_LIB(wrap, main,
268                 AC_DEFINE(TCPWRAP)
269                 LIBS="$LIBS -lwrap"
270                 AC_MSG_RESULT([enabling TCP wrappers support])
271         )
272 )
273
274 AC_ARG_ENABLE(redhat,
275         [  --enable-redhat     use redhat-style sysv configuration ],
276     if test "$enableval" = "yes"; then
277                 sysv_style=redhat
278         fi
279         AC_MSG_RESULT([enabling redhat-style sysv support])
280 )
281
282 AC_ARG_ENABLE(cobalt,
283         [  --enable-cobalt     use cobalt-style sysv configuration ],
284     if test "$enableval" = "yes"; then
285                 sysv_style=cobalt
286         fi
287         AC_MSG_RESULT([enabling cobalt-style sysv support])
288 )
289
290 AC_ARG_WITH(uams-path,
291         [  --with-uams-path=path   path to UAMs [default=/etc/atalk/uams]],
292         uams_path="$withval",
293         uams_path="/etc/atalk/uams"
294 )
295 AC_DEFINE_UNQUOTED(UAMS_PATH, "$uams_path",
296         [path to UAMs [default=/etc/atalk/uams]])
297 UAMS_PATH="$uams_path"
298 AC_SUBST(UAMS_PATH)
299
300 dnl --------------------------------------------------------------------------
301 dnl drop in includes for top level directory structures here...
302 dnl --------------------------------------------------------------------------
303 LIBS="$LIBS -L\$(top_srcdir)/libatalk/"
304 CFLAGS="$CFLAGS -I\$(top_srcdir)/include -I\$(top_srcdir)/sys"
305
306 dnl --------------------------------------------------------------------------
307 dnl specific configuration comes in here:
308 dnl --------------------------------------------------------------------------
309
310 dnl ac_cv_target_os is now host_os, ac_cv_target_cpu is now host_cpu
311
312 dnl --------------------- determine operating system from "target"
313 case "$host_os" in
314         *freebsd*)                      this_os=freebsd ;;
315         *linux*)                        this_os=linux ;;
316         *osx*)                          this_os=macosx ;;
317         *netbsd*)                       this_os=netbsd ;;
318         *openbsd*)                      this_os=openbsd ;;
319         *solaris*)                      this_os=solaris ;;
320 esac
321
322 case "$host_cpu" in
323         i386|i486|i586|i686|k7)         this_cpu=x86 ;;
324         alpha)                          this_cpu=alpha ;;
325         mips)                           this_cpu=mips ;;
326         powerpc|ppc)                    this_cpu=ppc ;;
327 esac
328
329 dnl --------------------- operating system specific flags (port from sys/*)
330
331 dnl ----- FreeBSD specific -----
332 if test x"$this_os" = "xfreebsd"; then 
333         AC_MSG_RESULT([ * FreeBSD specific configuration])
334         AC_DEFINE(BSD4_4)
335         AC_DEFINE(SENDFILE_FLAVOR_BSD)
336 fi
337
338 dnl ----- Linux specific -----
339 if test x"$this_os" = "xlinux"; then 
340         AC_MSG_RESULT([ * Linux specific configuration])
341         AC_DEFINE(SENDFILE_FLAVOR_LINUX)
342
343         dnl ----- check if we need the quotactl wrapper
344         AC_CHECK_HEADER(sys/quota.h,,
345                 AC_MSG_RESULT([enabling quotactl wrapper])
346                 AC_DEFINE(NEED_QUOTACTL_WRAPPER)
347         )
348
349         dnl ----- Linux/alpha specific -----
350         if test x"$this_cpu" = "xalpha"; then 
351                 AC_MSG_RESULT([enabling gcc memcpy bug workaround])
352                 AC_DEFINE(HAVE_GCC_MEMCPY_BUG)
353         fi
354         need_dash_r=no
355 fi
356
357 dnl ----- Mac OSX specific -----
358 if test x"$this_os" = "xmacosx"; then 
359         AC_MSG_RESULT([ * Mac OSX specific configuration])
360         AC_DEFINE(BSD4_4)
361         AC_DEFINE(HAVE_BROKEN_CPP)
362         AC_DEFINE(HAVE_2ARG_DBTOB)
363         AC_DEFINE(NO_DLFCN_H)
364         AC_DEFINE(MACOSX_SERVER)
365 fi
366
367 dnl ----- NetBSD specific -----
368 if test x"$this_os" = "xnetbsd"; then 
369         AC_MSG_RESULT([ * NetBSD specific configuration])
370         AC_DEFINE(BSD4_4)
371         AC_DEFINE(DLSYM_PREPEND_UNDERSCORE)
372         CFLAGS="-I\$(top_srcdir)/sys/netbsd -I/usr/include/kerberosIV $CFLAGS"
373         need_dash_r=yes 
374 fi
375
376 dnl ----- OpenBSD specific -----
377 if test x"$this_os" = "xopenbsd"; then 
378         AC_MSG_RESULT([ * OpenBSD specific configuration])
379         AC_DEFINE(BSD4_4)
380 fi
381
382 dnl ----- Solaris specific -----
383 if test x"$this_os" = "xsolaris"; then 
384         AC_MSG_RESULT([ * Solaris specific configuration])
385         AC_DEFINE(__svr4__)
386         AC_DEFINE(_ISOC9X_SOURCE)
387         AC_DEFINE(NO_STRUCT_TM_GMTOFF)
388         AC_DEFINE(SOLARIS)
389         CFLAGS="-I\$(top_srcdir)/sys/generic $CFLAGS"
390         need_dash_r=yes
391 fi
392
393 dnl -- look for openssl  
394 AC_ARG_WITH(ssl-dir,
395         [  --with-ssl-dir=PATH     specify path to openssl installation (must contain
396                           lib and include dirs) ],
397         [
398                 if test "x$withval" != "$xno"; then
399                         tryssldir=$withval
400                 fi
401         ]
402 )
403
404 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
405         if test -f "$ssldir/include/openssl/cast.h" ; then
406                 LIBS="$LIBS -L$ssldir/lib -L$ssldir"
407                 CFLAGS="$CFLAGS -I$ssldir/include -I$ssldir/include/openssl"
408                 if test "$need_dash_r" = "yes"; then
409                         LIBS="$LIBS -R$ssldir/lib -R$ssldir"
410                 fi
411
412                 dnl Check for the crypto library:
413                 AC_CHECK_LIB(crypto, main)
414                 LIBS="$LIBS -lcrypto"
415                 dnl Check for "DES" library (for SSLeay, not openssl):
416                 AC_CHECK_LIB(des, main)
417
418                 AC_DEFINE(OPENSSL_DHX,  1)
419                 AC_DEFINE(UAM_DHX,              1)
420                 AC_DEFINE(UAM_PGP,              1)
421                 AC_DEFINE(UAM_RNDNUM,   1)
422                 compile_dhx=yes
423                 AC_MSG_RESULT([Found ssl and enabling RANDNUM and DHX support "$ssldir"])
424                 break
425         fi
426 done
427
428 dnl --------------------- last minute substitutions
429
430 AC_SUBST(LIBS)
431 AC_SUBST(CFLAGS)
432 AM_CONDITIONAL(USE_DHX, test x$compile_dhx = xyes)
433 AM_CONDITIONAL(USE_PAM, test x$compile_pam = xyes)
434 AM_CONDITIONAL(USE_COBALT, test x$sysv_style = xcobalt)
435 AM_CONDITIONAL(USE_REDHAT, test x$sysv_style = xredhat)
436
437 dnl --------------------- generate files
438
439 AC_OUTPUT([Makefile
440         bin/Makefile
441         bin/adv1tov2/Makefile
442         bin/aecho/Makefile
443         bin/afile/Makefile
444         bin/afppasswd/Makefile
445         bin/getzones/Makefile
446         bin/megatron/Makefile
447         bin/nbp/Makefile
448         bin/pap/Makefile
449         bin/psorder/Makefile
450         config/Makefile
451         contrib/Makefile
452         contrib/nu/Makefile
453         contrib/printing/Makefile
454         contrib/shell_utils/Makefile
455         contrib/timelord/Makefile
456         distrib/Makefile
457         distrib/config/Makefile
458         distrib/config/netatalk-config
459         distrib/initscripts/Makefile
460         distrib/m4/Makefile
461         etc/Makefile
462         etc/afpd/Makefile
463         etc/afpd/nls/Makefile
464         etc/atalkd/Makefile
465         etc/uams/Makefile
466         etc/papd/Makefile
467         etc/psf/Makefile
468         include/Makefile
469         include/atalk/Makefile
470         libatalk/Makefile
471         libatalk/adouble/Makefile
472         libatalk/asp/Makefile
473         libatalk/atp/Makefile
474         libatalk/compat/Makefile
475         libatalk/dsi/Makefile
476         libatalk/nbp/Makefile
477         libatalk/netddp/Makefile
478         libatalk/util/Makefile
479         man/Makefile
480         man/man1/Makefile
481         man/man3/Makefile
482         man/man4/Makefile
483         man/man5/Makefile
484         man/man8/Makefile
485         sys/Makefile
486         sys/netatalk/Makefile
487         ],
488         [chmod a+x distrib/config/netatalk-config contrib/shell_utils/apple_*]
489 )
490