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