Debian Codegraph @

configure.in

raw ◀ ▶
Source reconstructed at patch state 0 of 3 — not the installed (fully patched) source.
3 Debian patches touch this file
1 dnl $Id: configure.in,v 1.111 2003/08/29 11:14:31 ceder Exp $
2 dnl Configuration for LysKOM
3 dnl Copyright (C) 1993-2003 Lysator Academic Computer Association.
4 dnl
5 dnl This program is free software; you can redistribute it and/or modify
6 dnl it under the terms of the GNU General Public License as published by
7 dnl the Free Software Foundation; either version 2, or (at your option)
8 dnl any later version.
9 dnl
10 dnl This program is distributed in the hope that it will be useful,
11 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
12 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 dnl GNU General Public License for more details.
14 dnl
15 dnl You should have received a copy of the GNU General Public License
16 dnl along with this program; if not, write to the Free Software
17 dnl Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 dnl
19 dnl Please report bugs at http://bugzilla.lysator.liu.se/.
20 dnl
21 AC_REVISION($Revision: 1.111 $)
22 AC_PREREQ(2.57)
23 AC_INIT([lyskom-server], [2.1.2])
24 AC_CONFIG_SRCDIR([src/server/lyskomd.h])
25 AC_CONFIG_HEADERS([config.h])
26 AC_CONFIG_AUX_DIR(scripts)
27 AM_INIT_AUTOMAKE
28
29 AC_ARG_WITH([debug-calls],
30 AC_HELP_STRING([--with-debug-calls],
31 [compile debug protocol requests]),
32 [use_debug_calls=$withval],
33 [use_debug_calls=no])
34
35 AC_ARG_WITH([efence],
36 AC_HELP_STRING([--with-efence], [link with ElectricFence]),
37 [use_efence=$withval],
38 [use_efence=no])
39
40 AC_ARG_WITH([insure++],
41 AC_HELP_STRING([--with-insure++], [compile with ParaSoft Insure++]),
42 [use_insure=$withval],
43 [use_insure=no])
44
45 AC_ARG_WITH([checker],
46 AC_HELP_STRING([--with-checker], [compile with Gnu Checker]),
47 [use_checker=$withval],
48 [use_checker=no])
49
50 AC_ARG_WITH([valgrind],
51 AC_HELP_STRING([--with-valgrind[=PATH]],
52 [use valgrind when running tests]),
53 [use_valgrind=$withval],
54 [use_valgrind=no])
55
56 AC_ARG_ENABLE([malloc-guards],
57 AC_HELP_STRING([--disable-malloc-guards],
58 [disable defensive guard areas (may crash lyskomd)]),
59 [use_malloc_guards=$enableval],
60 [use_malloc_guards=yes])
61
62 dnl The IPv6 support is currently only handled in ISC. The only reason
63 dnl to include this AC_ARG_ENABLE statement in this configure.in is to
64 dnl display the help text when "./configure --help" is run.
65 AC_ARG_ENABLE([ipv6],
66 AC_HELP_STRING([--enable-ipv6], [enable IPv6 support]),
67 [use_inet6=yes],
68 [use_inet6=no])
69
70 AC_ARG_WITH([gcov],
71 AC_HELP_STRING([--with-gcov], [instrument for gcov (requires gcc)]),
72 [use_gcov=$withval],
73 [use_gcov=no])
74
75 AC_ARG_WITH([traced-allocations],
76 AC_HELP_STRING([--with-traced-allocations],
77 [trace allocations (see src/server/ram-smalloc.c)]),
78 [use_traced_allocations=$withval],
79 [use_traced_allocations=no])
80
81 AC_ARG_WITH([optimization],
82 AC_HELP_STRING([--with-optimization], [select level of optimization]),
83 [opt_level=$withval],
84 [opt_level=""])
85
86 AC_ARG_WITH([language],
87 AC_HELP_STRING([--with-language=sv],
88 [select Swedish database (default English)]),
89 [language=$withval],
90 [language=en])
91
92 AC_SUBST(LANGUAGE_SUFFIX)
93 [case "$language" in
94 en) LANGUAGE_SUFFIX=-en;;
95 sv) LANGUAGE_SUFFIX=;;]
96 *) AC_MSG_ERROR(bad value $language for --with-language)[;;
97 esac]
98
99 AC_SUBST(VALGRIND)
100 [if test "$use_valgrind" = "yes"
101 then
102 VALGRIND=valgrind
103 elif test "$use_valgrind" = "no"
104 then
105 VALGRIND=
106 else
107 case "$use_valgrind" in
108 /*) VALGRIND="$use_valgrind";;
109 *) ] AC_MSG_ERROR([invalid --with-valgrind argument $use_valgrind]) [ ;;
110 esac
111 fi]
112
113 [if test "$use_malloc_guards" = "yes"
114 then]
115 AC_DEFINE([USE_MALLOC_GUARDS], 1,
116 [Insert magic number before and after malloced areas.
117 This can help detect buffer overruns.])
118 [fi]
119
120 AC_PREFIX_DEFAULT(/usr/lyskom)
121 AC_PATH_PROG([AR], [ar], [notfound], [$PATH$PATH_SEPARATOR/usr/ccs/bin])
122 AC_ARG_VAR([AR], [ar program to use])
123 [if test "$AR" = "notfound"; then]
124 AC_MSG_ERROR([cannot find ``ar''])
125 [fi]
126 AC_PATH_PROG([SENDMAIL], [sendmail], [no],
127 [$PATH$PATH_SEPARATOR/usr/lib$PATH_SEPARATOR/usr/sbin$PATH_SEPARATOR/etc])
128 [if test "$SENDMAIL" = "no"; then
129 SENDMAIL=:]
130 AC_MSG_WARN([updateLysKOM will not send mail since no sendmail was found])
131 [fi]
132 AC_PROG_CC
133 AC_AIX
134 AC_ISC_POSIX
135 AC_MINIX
136 AM_C_PROTOTYPES
137 AM_PATH_PYTHON
138 AM_CONDITIONAL(HAVE_PYTHON, test -n "$PYTHON")
139
140 [if test -n "$GCC"; then]
141 dnl "-Wshadow" could be useful, but it gives too many false
142 dnl warnings.
143 dnl "-Wtraditional" isn't really useful: we don't support
144 dnl pre-c89-compilers.
145 [CFLAGS="$CFLAGS -Wall -W"]
146 dnl AC_DEFINE(_GNU_SOURCE)
147 CMOD_CHECK_CC_OPT([-Wbad-function-cast], [bad_function_cast])
148 dnl
149 dnl This gives too many false warnings, but it may be proper
150 dnl to use this once in a while.
151 dnl CMOD_CHECK_CC_OPT([-Wcast-qual], [cast_qual])
152 dnl
153 CMOD_CHECK_CC_OPT([-Wcast-align], [cast_align])
154 CMOD_CHECK_CC_OPT([-Wwrite-strings], [write_strings])
155 CMOD_CHECK_CC_OPT([-Wstrict-prototypes], [strict_prototypes])
156 CMOD_CHECK_CC_OPT([-Wmissing-prototypes], [missing_prototypes])
157 CMOD_CHECK_CC_OPT([-Wmissing-declarations], [missing_declarations])
158 CMOD_CHECK_CC_OPT([-Wfloat-equal], [float_equal])
159 dnl
160 dnl This gives too many false warnings, especially in dbck,
161 dnl but it may be proper to use it once in a while. dbck
162 dnl should be fixed so that we get rid of the warnings there.
163 dnl CMOD_CHECK_CC_OPT([-Wnested-externs], [nested_externs])
164 dnl
165 CMOD_CHECK_CC_OPT([-pipe], [pipe]) [
166 fi]
167
168 AC_SUBST(EFENCE)
169 [if test "$use_efence" = "yes"
170 then]
171 AC_CHECK_LIB(efence,malloc)
172 EFENCE=1
173 [fi]
174
175 AC_SUBST(TRACED_ALLOCATIONS)
176 [if test "$use_traced_allocations" = "yes"
177 then]
178 AC_DEFINE([TRACED_ALLOCATIONS], 1,
179 [Should all allocations be traced? See src/server/ram-smalloc.c.])
180 [fi]
181
182 AC_SUBST(DEBUG_CALLS)
183 [if test "$use_debug_calls" = "yes"
184 then]
185 AC_DEFINE([DEBUG_CALLS], 1,
186 [Include special debug requests. Don't use this on
187 a production server. The debug requests are
188 insecure. The test suite uses these calls if they
189 are available to increase the coverage.])
190 AC_CHECK_FUNCS(mallinfo)
191 [fi]
192
193 [if test "$use_gcov" = "yes" && test -n "$GCC"; then]
194 CMOD_CHECK_CC_OPT([-ftest-coverage], [test_coverage])
195 CMOD_CHECK_CC_OPT([-fprofile-arcs], [profile_arcs])
196 AC_DEFINE([AVOID_ABORTS], 1,
197 [This should be defined if you want gcov
198 statistics. It replaces some aborts with exits so
199 coverage data is output.])
200 [fi]
201
202 [if test -n "$opt_level" -a "$opt_level" != "yes" ; then
203 CFLAGS=`echo "$CFLAGS" | sed "s/-O[0-9]*//"`
204 if test "$opt_level" != "no" ; then
205 CFLAGS="$CFLAGS -O$opt_level"
206 fi
207 fi]
208
209 # Do this test early since it may define _POSIX_SOURCE, which may
210 # affect future tests.
211 # FIXME (bug 210): is this needed, now that we use AM_C_PROTOTYPES?
212 AC_MSG_CHECKING([if <signal.h> defines struct sigaction])
213 AC_CACHE_VAL([kom_cv_header_posix_source_needed],
214 [# This default may be overridden below.
215 kom_cv_header_posix_source_needed=no])
216 AC_CACHE_VAL([kom_cv_struct_sigaction],
217 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <signal.h>]],
218 [[struct sigaction foosig;]])],
219 [kom_cv_struct_sigaction=yes],
220 [kom_cv_struct_sigaction=no])
221 [if test $kom_cv_struct_sigaction = no ; then]
222 AC_COMPILE_IFELSE(
223 [AC_LANG_PROGRAM([[#define _POSIX_SOURCE
224 #include <signal.h>]],
225 [[struct sigaction barsig;]])],
226 [kom_cv_struct_sigaction=yes
227 kom_cv_header_posix_source_needed=yes],
228 [kom_cv_struct_sigaction=no])
229 [fi])
230 [if test $kom_cv_header_posix_source_needed = yes ; then]
231 AC_MSG_RESULT([yes, but _POSIX_SOURCE was needed])
232 AC_DEFINE(_POSIX_SOURCE)
233 [else]
234 AC_MSG_RESULT($kom_cv_struct_sigaction)
235 [fi]
236 [if test $kom_cv_struct_sigaction = yes ; then]
237 AC_DEFINE([HAVE_STRUCT_SIGACTION], 1,
238 [Define if struct sigaction is available.])
239 [fi]
240
241 AC_C_CONST
242 AC_C_INLINE
243 CMOD_C_WORKING_ATTRIBUTE_UNUSED
244 AC_HEADER_STDC
245 AC_TYPE_PID_T
246 dnl
247 dnl Check for sig_atomic_t
248 dnl
249 AC_CACHE_CHECK([if sig_atomic_t exists], kom_cv_type_sig_atomic_t,
250 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <signal.h>]],
251 [[sig_atomic_t t;]])],
252 [kom_cv_type_sig_atomic_t=yes],
253 [kom_cv_type_sig_atomic_t=no])])
254 [if test $kom_cv_type_sig_atomic_t = no
255 then]
256 AC_DEFINE([sig_atomic_t], [int],
257 [Define this to a type that can be changed atomically
258 from a signal handler if your OS lacks sig_atomic_t.])
259 [fi]
260 dnl
261 # FIXME (bug 209): is this needed now that we use AM_C_PROTOTYPES?
262 AC_MSG_CHECKING([if _HPUX_SOURCE needs to be defined])
263 AC_CACHE_VAL([kom_cv_sys_hpux_source],
264 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
265 #include <sys/socket.h>]],
266 [[struct sockaddr foo;]])],
267 [kom_cv_sys_hpux_source=no],
268 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#define _HPUX_SOURCE
269 #include <sys/types.h>
270 #include <sys/socket.h>]],
271 [[struct sockaddr foo;]])],
272 [kom_cv_sys_hpux_source=yes],
273 [kom_cv_sys_hpux_source=no])])])
274 AC_MSG_RESULT($kom_cv_sys_hpux_source)
275 [if test $kom_cv_sys_hpux_source = yes ; then]
276 AC_DEFINE([_HPUX_SOURCE], 1, [Define if on HPUX])
277
278 [fi]
279 dnl
280 dnl
281 AC_MSG_CHECKING([if the compiler understands __attribute__ ((format))])
282 AC_CACHE_VAL([kom_cv_c_attribute_format_printf],
283 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[extern void log (const char *f, ...)
284 __attribute__ ((format (printf, 1, 2)));]], [[]])],
285 [kom_cv_c_attribute_format_printf=yes],
286 [kom_cv_c_attribute_format_printf=no])])
287 AC_MSG_RESULT($kom_cv_c_attribute_format_printf)
288 [if test $kom_cv_c_attribute_format_printf = yes ; then]
289 AC_DEFINE([HAVE_ATTRIBUTE_FORMAT_PRINTF], 1,
290 [Define if your compiler supports __attribute__ in printf.])
291 [fi]
292 AC_MSG_CHECKING([if the compiler understands __attribute__ ((__noreturn__))])
293 AC_CACHE_VAL([kom_cv_c_attribute_noreturn],
294 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[extern void log (const char *f, ...)
295 __attribute__ ((__noreturn__));]], [[]])],
296 [kom_cv_c_attribute_noreturn=yes],
297 [kom_cv_c_attribute_noreturn=no])])
298 AC_MSG_RESULT($kom_cv_c_attribute_noreturn)
299 [if test $kom_cv_c_attribute_noreturn = yes ; then]
300 AC_DEFINE([HAVE_ATTRIBUTE_NORETURN], 1,
301 [Define if your compiler supports __attribute__ ((noreturn)).])
302 [fi]
303 AC_PROG_INSTALL
304 AC_PROG_RANLIB
305 AC_PROG_AWK
306 AC_PROG_LN_S
307 AC_PROG_YACC
308 AM_PROG_LEX
309 AC_CHECK_PROGS(BISON, bison)
310 AC_CHECK_PROGS(FLEX, flex)
311 AC_CHECK_PROGS(SED, sed)
312 AC_CHECK_HEADERS(string.h memory.h strings.h sys/param.h sys/time.h)
313 AC_CHECK_HEADERS(stdarg.h stdlib.h stddef.h locale.h)
314 AC_CHECK_HEADERS(crypt.h unistd.h)
315 AC_CHECK_HEADERS(values.h) dnl libmisc/pom.c
316 AC_CHECK_HEADERS(stdint.h)
317 AC_HEADER_TIME
318 AC_FUNC_ALLOCA
319 dnl
320 AC_CHECK_HEADERS(sys/resource.h,,,
321 [#ifdef TIME_WITH_SYS_TIME
322 # include <sys/time.h>
323 # include <time.h>
324 #else
325 # ifdef HAVE_SYS_TIME_H
326 # include <sys/time.h>
327 # else
328 # include <time.h>
329 # endif
330 #endif])
331 dnl
332 AC_CHECK_TYPE([rlim_t],
333 AC_DEFINE([HAVE_RLIM_T], [1], [Define if rlimt_t is available.]),,[
334 #ifdef HAVE_SYS_RESOURCE_H
335 # ifdef TIME_WITH_SYS_TIME
336 # include <sys/time.h>
337 # include <time.h>
338 # else
339 # ifdef HAVE_SYS_TIME_H
340 # include <sys/time.h>
341 # else
342 # include <time.h>
343 # endif
344 # endif
345 # include <sys/resource.h>
346 #endif])
347 AC_CHECK_TYPE(intptr_t)
348 AC_CHECK_TYPE(intmax_t)
349 AC_CHECK_TYPE(size_t)
350 dnl
351 AC_CHECK_LIB(resolv,main) dnl Host name lookup.
352 AC_CHECK_LIB(authuser,auth_tcpuser3) dnl User authentication according to RFC 931.
353 dnl Low-level networking code on Solaris 2.
354 AC_CHECK_FUNC(gethostbyname)
355 [if test $ac_cv_func_gethostbyname = no
356 then]
357 AC_CHECK_LIB(nsl, gethostbyname)
358 [fi]
359 dnl socket() et c on Solaris 2.
360 AC_CHECK_FUNC(socket)
361 [if test $ac_cv_func_socket = no
362 then]
363 AC_CHECK_LIB(socket, socket)
364 [fi]
365 AC_CHECK_LIB(i,setlocale) dnl For setlocale() on Ultrix.
366 AC_CHECK_FUNC(crypt)
367 [if test $ac_cv_func_crypt = no
368 then]
369 AC_CHECK_LIB(crypt,crypt) dnl For crypt() on Sparc NetBSD 1.1
370 [fi]
371 AC_CHECK_FUNCS(difftime getdtablesize sysconf strchr getcwd vfprintf)
372 AC_CHECK_FUNCS(setrlimit)
373 AC_CHECK_FUNCS(snprintf)
374 AC_REPLACE_FUNCS(memcpy strerror remove memset memchr memcmp setsid)
375 dnl
376 dnl On AIX 4.2, setrlimit(RLIMIT_NOFILE) doesn't work. The
377 dnl RLIMIT_NOFILE limit is ignored, and getrlimit(RLIMIT_NOFILE)
378 dnl always returns 2147483647. Not very helpful.
379 [if test $ac_cv_func_setrlimit = yes
380 then]
381 AC_CACHE_CHECK([for working setrlimit(RLIMIT_NOFILE, ...)],
382 kom_cv_func_rlimit_nofile,
383 AC_RUN_IFELSE([AC_LANG_SOURCE([[
384 #include <stdio.h>
385 #ifdef HAVE_SYS_RESOURCE_H
386 # ifdef TIME_WITH_SYS_TIME
387 # include <sys/time.h>
388 # include <time.h>
389 # else
390 # ifdef HAVE_SYS_TIME_H
391 # include <sys/time.h>
392 # else
393 # include <time.h>
394 # endif
395 # endif
396 # include <sys/resource.h>
397 #else
398 # include <time.h>
399 #endif
400 #include <fcntl.h>
401
402 #if defined(HAVE_SETRLIMIT) && defined(RLIMIT_OFILE) && !defined(RLIMIT_NOFILE)
403 # define RLIMIT_NOFILE RLIMIT_OFILE
404 #endif
405
406 #if !HAVE_RLIM_T
407 typedef int rlim_t;
408 #endif
409
410 int main()
411 {
412 #if defined(HAVE_SETRLIMIT) && defined(RLIMIT_NOFILE)
413 struct rlimit rlim;
414 int i;
415 int fd;
416
417 if (getrlimit(RLIMIT_NOFILE, &rlim) < 0)
418 {
419 perror("getrlimit(RLIMIT_NOFILE) failed");
420 return 1;
421 }
422 rlim.rlim_cur = 20;
423 if (setrlimit(RLIMIT_NOFILE, &rlim) < 0)
424 {
425 perror("setrlimit(RLIMIT_NOFILE) failed");
426 return 1;
427 }
428 if (getrlimit(RLIMIT_NOFILE, &rlim) < 0)
429 {
430 perror("second getrlimit(RLIMIT_NOFILE) failed");
431 return 1;
432 }
433 if (rlim.rlim_cur != 20)
434 {
435 fprintf(stderr, "NOFILE set to %ld, not 20\n", (long)rlim.rlim_cur);
436 return 1;
437 }
438 for (i = 0; i < 25; i++)
439 if ((fd = open("/dev/null", O_WRONLY)) > 19)
440 {
441 fprintf(stderr, "NOFILE doesn't limit files; got fd %d\n", fd);
442 return 1;
443 }
444 return 0;
445 #else
446 fprintf(stderr, "setrlimit not available\n");
447 return 1;
448 #endif
449 }]])],
450 [kom_cv_func_rlimit_nofile=yes],
451 [kom_cv_func_rlimit_nofile=no],
452 [kom_cv_func_rlimit_nofile=no]))
453 [if test $kom_cv_func_rlimit_nofile = no
454 then]
455 AC_DEFINE([HAVE_BROKEN_NOFILE], [1],
456 [Define if setrlimit(RLIMIT_NOFILE) does not work.])
457 [fi
458 fi]
459 dnl
460 dnl strdup() is not currently used, but we have a replacement function
461 dnl since it was used a while ago. No need to take up time looking
462 dnl for it, though. Remove strdup.c from EXTRA_DIST in
463 dnl src/libraries/libansi/Makefile.am if strdup is ever used again.
464 dnl AC_REPLACE_FUNCS(strdup)
465 dnl
466 dnl I don't know how to test for buggy inet_ntoa functions
467 dnl programmatically, but the supplied substitute should always work,
468 dnl so we define BUGGY_INET_NTOA unconditionally.
469 AC_DEFINE([BUGGY_INET_NTOA], 1,
470 [Define if your OS has buggy inet_ntoa. If you don't know,
471 define this.])
472 dnl
473 dnl Unencrypted passwords are no longer supported.
474 AC_DEFINE([ENCRYPT_PASSWORDS], 1, [Define if you want encrypted passwords])
475 dnl
476 dnl Tests for GNU getopt (used in dbck)
477 AC_CHECK_HEADERS(alloca.h)
478 dnl
479 dnl Check for use of Gnu checker
480 dnl
481
482 [if test "$use_insure" = "yes"
483 then]
484 AC_CHECK_PROGS(INSURE, insure)
485 [ CC="insure"
486 LDFLAGS="-Zsl $LDFLAGS" ]
487 [fi]
488
489 [if test "$use_checker" = "yes"
490 then]
491 AC_CHECK_PROGS(CHECKER, checker)
492 [ CC="checker $CC"
493 LIBS="-lchkr_m $LIBS" ]
494 [fi]
495
496 AC_CONFIG_SUBDIRS(src/libraries/libisc-new)
497 AC_CONFIG_SUBDIRS(src/libraries/liboop)
498 AC_CONFIG_SUBDIRS(src/libraries/adns)
499 AC_CONFIG_FILES([Makefile
500 db-crypt/Makefile
501 db-crypt/db/Makefile
502 doc/Makefile
503 doc/man/Makefile
504 scripts/Makefile
505 src/Makefile
506 src/include/Makefile
507 src/include/server/Makefile
508 src/libraries/Makefile
509 src/libraries/libansi/Makefile
510 src/libraries/libcommon/Makefile
511 src/libraries/libeintr/Makefile
512 src/libraries/libmisc/Makefile
513 src/libraries/regex/Makefile
514 src/libraries/regex/doc/Makefile
515 src/libraries/regex/test/Makefile
516 src/server/Makefile
517 src/server/testsuite/Makefile
518 src/server/testsuite/config/Makefile
519 src/server/testsuite/lyskomd.0/Makefile
520 run-support/Makefile])
521 AC_CONFIG_COMMANDS([default],[[echo
522 echo " Selected language: $language"
523 echo]],[[language=$language]])
524 AC_OUTPUT