]> arthur.barton.de Git - netatalk.git/blob - configure.in
better sys/cdefs.h fix to use sys/generic/sys/cdefs.h if not found
[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 -ldes:
47 AC_CHECK_LIB(des, main)
48 dnl Replace `main' with a function in -ldl:
49 AC_CHECK_LIB(dl, main)
50 dnl Replace `main' with a function in -lkauth:
51 AC_CHECK_LIB(kauth, main)
52 dnl Replace `main' with a function in -lkrb:
53 AC_CHECK_LIB(krb, main)
54 dnl Replace `main' with a function in -llwp:
55 AC_CHECK_LIB(lwp, main)
56 dnl Replace `main' with a function in -ln:
57 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 AC_CHECK_LIB(prot, main)
62 dnl Replace `main' with a function in -lresolv:
63 AC_CHECK_LIB(resolv, main)
64 dnl Replace `main' with a function in -lrpcsvc:
65 AC_CHECK_LIB(rpcsvc, main)
66 dnl Replace `main' with a function in -lrx:
67 AC_CHECK_LIB(rx, main)
68 dnl Replace `main' with a function in -lrxkad:
69 AC_CHECK_LIB(rxkad, main)
70 dnl Replace `main' with a function in -lsocket:
71 AC_CHECK_LIB(socket, main)
72 dnl Replace `main' with a function in -lsys:
73 AC_CHECK_LIB(sys, main)
74 dnl Replace `main' with a function in -lubik:
75 AC_CHECK_LIB(ubik, main)
76
77 dnl Checks for header files.
78 AC_HEADER_DIRENT
79 AC_HEADER_STDC
80 AC_HEADER_SYS_WAIT
81 AC_CHECK_HEADERS(fcntl.h limits.h strings.h sys/file.h sys/ioctl.h sys/time.h syslog.h unistd.h)
82 AC_CHECK_HEADER(sys/cdefs.h,,
83         AC_MSG_RESULT([enabling generic cdefs.h from tree])
84         CFLAGS="-I\$(top_srcdir)/sys/generic $CFLAGS"
85 )
86
87 # Allow user to specify flags
88 AC_ARG_WITH(cflags,
89         [  --with-cflags           specify additional flags to pass to compiler],
90         [
91                 if test "x$withval" != "xno" ; then
92                         CFLAGS="$CFLAGS $withval"
93                 fi
94         ]       
95 )
96 AC_ARG_WITH(libs,
97         [  --with-libs             specify additional libraries to link with],
98         [
99                 if test "x$withval" != "xno" ; then
100                         LIBS="$LIBS $withval"
101                 fi
102         ]
103 )
104
105 dnl Checks for typedefs, structures, and compiler characteristics.
106 AC_C_CONST
107 AC_TYPE_UID_T
108 AC_C_INLINE
109 AC_TYPE_MODE_T
110 AC_TYPE_OFF_T
111 AC_TYPE_PID_T
112 AC_TYPE_SIZE_T
113 AC_STRUCT_ST_RDEV
114 AC_HEADER_TIME
115 AC_STRUCT_TM
116
117 dnl Checks for library functions.
118 AC_TYPE_GETGROUPS
119 AC_PROG_GCC_TRADITIONAL
120 AC_FUNC_MEMCMP
121 AC_HEADER_MAJOR
122 AC_FUNC_MMAP
123 AC_TYPE_SIGNAL
124 AC_FUNC_UTIME_NULL
125 AC_FUNC_WAIT3
126 AC_CHECK_FUNCS(getcwd gethostname gettimeofday getusershell mkdir rmdir select socket strdup strstr strtoul)
127
128 dnl --------------------------------------------------------------------------
129 dnl specific configuration comes in here:
130 dnl --------------------------------------------------------------------------
131
132 AC_DEFINE(ADMIN_GRP, 1)
133
134 AC_ARG_WITH(admin-group,
135         [  --disable-admin-group  disable admin group],
136         if test "$enableval" = "no"; then
137                 AC_DEFINE(ADMIN_GRP, 0)
138                 AC_MSG_RESULT([disabling administrative group support])
139         fi
140  )
141
142 AC_ARG_WITH(auth-printing-dir,
143         [  --with-auth-printing-dir=path
144               path to authenticated printing directory],
145                 cap_dir="$withval"
146                 AC_DEFINE_UNQUOTED(CAPDIR, "$cap_dir")
147                 AC_DEFINE(USE_CAP)
148                 AC_MSG_RESULT([enabling authenticated printing support]),
149 )
150
151 AC_ARG_WITH(config-dir,
152         [  --with-config-dir=path  path to config files [default=/etc/atalk]],
153                 config_dir="$withval",
154                 config_dir="/etc/atalk"
155 )
156 AC_DEFINE_UNQUOTED(CONFIG_DIR, "$config_dir",
157         [path to config dir [default=/etc/atalk]])
158 CONFIG_DIR="$config_dir"
159 AC_SUBST(CONFIG_DIR)
160 AC_MSG_RESULT([setting configuration files location to $CONFIG_DIR])
161
162 AC_ARG_WITH(cracklib,
163         [  --with-cracklib=dict    enable/set location of cracklib dictionary],
164         cracklib="$withval"
165         AC_CHECK_LIB(crack, main,
166                 AC_DEFINE(USE_CRACKLIB) 
167                 LIBS="$LIBS -lcrack"
168                 AC_MSG_RESULT([enabling cracklib support])
169                 if test "$cracklib" = "yes"; then
170                         cracklib="/usr/lib/cracklib_dict"
171                 fi
172                 AC_DEFINE_UNQUOTED(_PATH_CRACKLIB, "$cracklib",
173                         [path to cracklib dictionary])
174                 AC_MSG_RESULT([setting cracklib dictionary to $cracklib]),
175                 AC_MSG_ERROR([cracklib not found!])
176         )
177 )
178
179 AC_ARG_ENABLE(ddp,
180         [  --disable-ddp           disable DDP],
181         if test "$enableval" = "no"; then 
182                 AC_DEFINE(NO_DDP, 1)
183                 AC_MSG_RESULT([disabling DDP])
184         fi
185 )
186
187 AC_ARG_ENABLE(debug,
188         [  --enable-debug          enable debug code],
189         if test "$enableval" != "no"; then
190                 if test "$enableval" = "yes"; then
191                         AC_DEFINE(DEBUG, 1)
192                 else
193                         AC_DEFINE_UNQUOTED(DEBUG, $enableval)
194                 fi 
195                 AC_MSG_RESULT([enabling debugging code])
196         else
197                 AC_DEFINE(DEBUG, 0)
198         fi
199 )
200
201
202 dnl ----------- A NOTE ABOUT DROPKLUDGE
203 dnl The trouble with this fix is that if you know what the file is called, it
204 dnl can be read from the Unix side.  That's okay for most academic institutions
205 dnl since the students don't have telnet access to the Mac servers.  There is
206 dnl currently no one working on further development/fixes of DROPKLUDGE.
207 dnl -----------
208
209 AC_ARG_ENABLE(dropkludge,
210         [  --enable-dropkludge     enable the experimental dropbox fix (INSECURE!) ],
211         AC_DEFINE(DROPKLUDGE, 1)
212         AC_MSG_RESULT([enabling experimental dropbox support])
213 )
214
215 AC_ARG_ENABLE(lastdid,
216         [  --enable-lastdid        enable build without DID dev/inode mapping kludge],
217         if test "$enableval" = "yes"; then 
218                 AC_DEFINE(USE_LASTDID, 1)
219                 AC_MSG_RESULT([enabling build without DID dev/inode mapping kludge])
220         fi
221 )
222
223 msg_dir=""
224 AC_ARG_WITH(message-dir,
225         [  --with-msg-dir=path     path to message files [default=/etc/atalk/msg]],
226                 msg_dir="$withval"
227                 if test x"$msg_dir" = "x"; then
228                         msg_dir="$CONFIG_DIR/msg"
229                 fi
230                 AC_DEFINE_UNQUOTED(SERVERTEXT, "$msg_dir",
231                         [path to message dir [default=$CONFIG_DIR/msg]])
232                 SERVERTEXT="$msg_dir"
233                 AC_SUBST(SERVERTEXT)
234 )
235
236 AC_ARG_WITH(pam,
237         [  --with-pam              enable password authentication modules support],
238         AC_CHECK_LIB(pam, pam_start,
239                 AC_DEFINE(USE_PAM, 1)
240                 LIBS="$LIBS -lpam"
241                 AC_MSG_RESULT([enabling pam modules support])
242         )
243 )
244
245 AC_ARG_WITH(shadow,
246         [  --with-shadow           enable shadow password support],
247         AC_MSG_RESULT([enabling shadow password support])
248         AC_DEFINE(SHADOWPW)
249 )
250
251 AC_ARG_WITH(flock-locks,
252         [  --with-flock-locks      enable flock locks support],
253         AC_MSG_RESULT([enabling flock locks])
254         AC_DEFINE(USE_FLOCK_LOCKS)
255 )
256
257 AC_ARG_WITH(tcp-wrappers,
258         [  --with-tcp-wrappers     enable TCP wrappers support],
259         AC_CHECK_LIB(wrap, main,
260                 AC_DEFINE(TCPWRAP)
261                 LIBS="$LIBS -lwrap"
262                 AC_MSG_RESULT([enabling TCP wrappers support])
263         )
264 )
265
266 AC_ARG_WITH(uams-path,
267         [  --with-uams-path=path   path to UAMs [default=/etc/atalk/uams]],
268         uams_path="$withval",
269         uams_path="/etc/atalk/uams"
270 )
271 AC_DEFINE_UNQUOTED(UAMS_PATH, "$uams_path",
272         [path to UAMs [default=/etc/atalk/uams]])
273 UAMS_PATH="$uams_path"
274 AC_SUBST(UAMS_PATH)
275
276 dnl --------------------------------------------------------------------------
277 dnl drop in includes for top level directory structures here...
278 dnl --------------------------------------------------------------------------
279 LIBS="$LIBS -L\$(top_srcdir)/libatalk/"
280 CFLAGS="$CFLAGS -I\$(top_srcdir)/include -I\$(top_srcdir)/sys"
281
282 dnl --------------------------------------------------------------------------
283 dnl specific configuration comes in here:
284 dnl --------------------------------------------------------------------------
285
286 dnl ac_cv_target_os is now host_os, ac_cv_target_cpu is now host_cpu
287
288 dnl --------------------- determine operating system from "target"
289 case "$host_os" in
290         *freebsd*)                      this_os=freebsd ;;
291         *linux*)                        this_os=linux ;;
292         *osx*)                          this_os=macosx ;;
293         *netbsd*)                       this_os=netbsd ;;
294         *openbsd*)                      this_os=openbsd ;;
295         *solaris*)                      this_os=solaris ;;
296 esac
297
298 case "$host_cpu" in
299         i386|i486|i586|i686|k7)         this_cpu=x86 ;;
300         alpha)                          this_cpu=alpha ;;
301         mips)                           this_cpu=mips ;;
302         powerpc|ppc)                    this_cpu=ppc ;;
303 esac
304
305 dnl --------------------- operating system specific flags (port from sys/*)
306
307 dnl ----- FreeBSD specific -----
308 if test x"$this_os" = "xfreebsd"; then 
309         AC_MSG_RESULT([ * FreeBSD specific configuration])
310         AC_DEFINE(BSD4_4)
311         AC_DEFINE(SENDFILE_FLAVOR_BSD)
312 fi
313
314 dnl ----- Linux specific -----
315 if test x"$this_os" = "xlinux"; then 
316         AC_MSG_RESULT([ * Linux specific configuration])
317         AC_DEFINE(SENDFILE_FLAVOR_LINUX)
318
319         dnl ----- check if we need the quotactl wrapper
320         AC_CHECK_HEADER(sys/quota.h,,
321                 AC_MSG_RESULT([enabling quotactl wrapper])
322                 AC_DEFINE(NEED_QUOTACTL_WRAPPER)
323         )
324
325         dnl ----- Linux/alpha specific -----
326         if test x"$this_cpu" = "xalpha"; then 
327                 AC_MSG_RESULT([enabling gcc memcpy bug workaround])
328                 AC_DEFINE(HAVE_GCC_MEMCPY_BUG)
329         fi
330         need_dash_r=no
331 fi
332
333 dnl ----- Mac OSX specific -----
334 if test x"$this_os" = "xmacosx"; then 
335         AC_MSG_RESULT([ * Mac OSX specific configuration])
336         AC_DEFINE(BSD4_4)
337         AC_DEFINE(HAVE_BROKEN_CPP)
338         AC_DEFINE(HAVE_2ARG_DBTOB)
339         AC_DEFINE(NO_DLFCN_H)
340         AC_DEFINE(MACOSX_SERVER)
341 fi
342
343 dnl ----- NetBSD specific -----
344 if test x"$this_os" = "xnetbsd"; then 
345         AC_MSG_RESULT([ * NetBSD specific configuration])
346         AC_DEFINE(BSD4_4)
347         AC_DEFINE(DLSYM_PREPEND_UNDERSCORE)
348         CFLAGS="-I\$(top_srcdir)/sys/netbsd -I/usr/include/kerberosIV $CFLAGS"
349         need_dash_r=yes 
350 fi
351
352 dnl ----- OpenBSD specific -----
353 if test x"$this_os" = "xopenbsd"; then 
354         AC_MSG_RESULT([ * OpenBSD specific configuration])
355         AC_DEFINE(BSD4_4)
356 fi
357
358 dnl ----- Solaris specific -----
359 if test x"$this_os" = "xsolaris"; then 
360         AC_MSG_RESULT([ * Solaris specific configuration])
361         AC_DEFINE(__svr4__)
362         AC_DEFINE(_ISOC9X_SOURCE)
363         AC_DEFINE(NO_STRUCT_TM_GMTOFF)
364         AC_DEFINE(SOLARIS)
365         need_dash_r=yes
366 fi
367
368 dnl -- look for openssl  
369 AC_ARG_WITH(ssl-dir,
370         [  --with-ssl-dir=PATH     specify path to openssl installation (must contain
371                           lib and include dirs) ],
372         [
373                 if test "x$withval" != "$xno"; then
374                         tryssldir=$withval
375                 fi
376         ]
377 )
378
379 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
380         if test -f "$ssldir/include/openssl/cast.h" ; then
381                 LIBS="$LIBS -L$ssldir/lib -L$ssldir"
382                 CFLAGS="$CFLAGS -I$ssldir/include -I$ssldir/include/openssl"
383                 if test "$need_dash_r" = "yes"; then
384                         LIBS="$LIBS -R$ssldir/lib -R$ssldir"
385                 fi
386                 dnl Replace `main' with a function in -lcrypto:
387                 AC_CHECK_LIB(crypto, main)
388
389                 LIBS="$LIBS -lcrypto"
390                 AC_DEFINE(OPENSSL_DHX,  1)
391                 AC_DEFINE(UAM_DHX,      1)
392                 AC_DEFINE(UAM_RNDNUM,   1)
393                 compile_dhx=yes
394                 AC_MSG_RESULT([Found ssl and enabling RANDNUM and DHX support "$ssldir"])
395                 break
396         fi
397 done
398
399 dnl --------------------- last minute substitutions
400
401 AC_SUBST(LIBS)
402 AC_SUBST(CFLAGS)
403 AM_CONDITIONAL(USE_DHX, test x$compile_dhx = xyes)
404
405 dnl --------------------- generate files
406
407 AC_OUTPUT([Makefile
408         bin/Makefile
409         bin/adv1tov2/Makefile
410         bin/aecho/Makefile
411         bin/afile/Makefile
412         bin/afppasswd/Makefile
413         bin/getzones/Makefile
414         bin/megatron/Makefile
415         bin/nbp/Makefile
416         bin/pap/Makefile
417         bin/psorder/Makefile
418         config/Makefile
419         contrib/Makefile
420         contrib/nu/Makefile
421         contrib/printing/Makefile
422         contrib/shell_utils/Makefile
423         contrib/timelord/Makefile
424         distrib/Makefile
425         distrib/config/Makefile
426         distrib/config/netatalk-config
427         distrib/initscripts/Makefile
428         distrib/m4/Makefile
429         etc/Makefile
430         etc/afpd/Makefile
431         etc/afpd/nls/Makefile
432         etc/atalkd/Makefile
433         etc/uams/Makefile
434         etc/papd/Makefile
435         etc/psf/Makefile
436         include/Makefile
437         include/atalk/Makefile
438         libatalk/Makefile
439         libatalk/adouble/Makefile
440         libatalk/asp/Makefile
441         libatalk/atp/Makefile
442         libatalk/compat/Makefile
443         libatalk/dsi/Makefile
444         libatalk/nbp/Makefile
445         libatalk/netddp/Makefile
446         libatalk/util/Makefile
447         man/Makefile
448         man/man1/Makefile
449         man/man3/Makefile
450         man/man4/Makefile
451         man/man5/Makefile
452         man/man8/Makefile
453         sys/Makefile
454         sys/netatalk/Makefile
455         ],
456         [chmod a+x distrib/config/netatalk-config contrib/shell_utils/apple_*]
457 )
458