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