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