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