configure.in 10.3 KB
Newer Older
1
dnl $Id: configure.in,v 1.81 2002/04/11 20:16:55 byers Exp $
2
dnl Configuration for LysKOM
Per Cederqvist's avatar
Per Cederqvist committed
3
dnl Copyright (C) 1993-2002  Lysator Academic Computer Association.
Per Cederqvist's avatar
Per Cederqvist committed
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
dnl
dnl This program is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU General Public License as published by
dnl the Free Software Foundation; either version 2, or (at your option)
dnl any later version.
dnl
dnl This program is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
dnl GNU General Public License for more details.
dnl
dnl You should have received a copy of the GNU General Public License
dnl along with this program; if not, write to the Free Software
dnl Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
dnl
dnl Please mail bug reports to bug-lyskom@lysator.liu.se. 
dnl
21 22
AC_REVISION($Revision: 1.81 $)
AC_PREREQ(2.53)
Per Cederqvist's avatar
Per Cederqvist committed
23
AC_INIT([lyskom-server], [2.0.6])
24
AC_CONFIG_SRCDIR([src/server/lyskomd.h])
David Byers's avatar
David Byers committed
25
AM_CONFIG_HEADER(config.h)
26
AC_CONFIG_AUX_DIR(scripts)
Per Cederqvist's avatar
Per Cederqvist committed
27
AM_INIT_AUTOMAKE([lyskom-server], [2.0.6])
28

29
AC_ARG_WITH([debug-calls],
30 31
        AC_HELP_STRING([--with-debug-calls], 
	               [compile debug protocol requests]),
32 33 34 35
        [use_debug_calls=$withval],
        [use_debug_calls=no])

AC_ARG_WITH([efence],
36
        AC_HELP_STRING([--with-efence], [link with ElectricFence]),
37 38 39
        [use_efence=$withval],
        [use_efence=no])

David Byers's avatar
David Byers committed
40
AC_ARG_WITH([insure++],
41
        AC_HELP_STRING([--with-insure++], [compile with ParaSoft Insure++]),
David Byers's avatar
David Byers committed
42 43 44
        [use_insure=$withval],
        [use_insure=no])

45
AC_ARG_WITH([checker],
46
        AC_HELP_STRING([--with-checker], [compile with Gnu Checker]),
47 48 49
        [use_checker=$withval],
        [use_checker=no])

50
AC_ARG_WITH([purify],
51
	AC_HELP_STRING([--with-purify], [link with Purify]),
52 53
	[use_purify=$withval],
	[use_purify=no])
54 55

AC_ARG_WITH([gcov],
56
        AC_HELP_STRING([--with-gcov], [instrument for gcov (requires gcc)]),
57 58 59
        [use_gcov=$withval],
        [use_gcov=no])

60
AC_ARG_WITH([traced-allocations],
61 62
        AC_HELP_STRING([--with-traced-allocations], 
	               [trace allocations (see src/server/ram-smalloc.c)]),
63 64 65
        [use_traced_allocations=$withval],
        [use_traced_allocations=no])

66
AC_ARG_WITH([optimization],
67
        AC_HELP_STRING([--with-optimization], [select level of optimization]),
68 69 70
        [opt_level=$withval],
        [opt_level=""])

Per Cederqvist's avatar
Per Cederqvist committed
71
AC_ARG_WITH([language],
72 73
	AC_HELP_STRING([--with-language=sv],
		       [select Swedish database (default English)]),
Per Cederqvist's avatar
Per Cederqvist committed
74 75 76 77 78 79 80 81 82 83
	[language=$withval],
	[language=en])

AC_SUBST(LANGUAGE_SUFFIX)
[case "$language" in
	en) LANGUAGE_SUFFIX=-en;;
	sv) LANGUAGE_SUFFIX=;;]
	*)  AC_MSG_ERROR(bad value $language for --with-language)[;;
esac]

84
AC_PREFIX_DEFAULT(/usr/lyskom)
Per Cederqvist's avatar
Per Cederqvist committed
85
AC_PROG_CC
86 87 88
AC_AIX
AC_ISC_POSIX
AC_MINIX
89 90
AM_C_PROTOTYPES

91
[if test -n "$GCC"; then]
92 93
	dnl "-Wshadow" could be useful, but it gives too many false
	dnl warnings.
94 95
	dnl "-Wtraditional" isn't really useful: we don't support
	dnl pre-c89-compilers.
96
	[CFLAGS="$CFLAGS -Wall -W"]
97
	dnl AC_DEFINE(_GNU_SOURCE)
98
	CMOD_CHECK_CC_OPT([-Wbad-function-cast], [bad_function_cast])
99 100 101
	dnl
	dnl This gives too many false warnings, but it may be proper
	dnl to use this once in a while.
102
	dnl CMOD_CHECK_CC_OPT([-Wcast-qual], [cast_qual])
103
	dnl
104 105 106 107 108
	CMOD_CHECK_CC_OPT([-Wcast-align], [cast_align])
	CMOD_CHECK_CC_OPT([-Wwrite-strings], [write_strings])
	CMOD_CHECK_CC_OPT([-Wstrict-prototypes], [strict_prototypes])
	CMOD_CHECK_CC_OPT([-Wmissing-prototypes], [missing_prototypes])
	CMOD_CHECK_CC_OPT([-Wmissing-declarations], [missing_declarations])
109 110 111 112
	dnl
	dnl This gives too many false warnings, especially in dbck,
	dnl but it may be proper to use it once in a while.  dbck
	dnl should be fixed so that we get rid of the warnings there.
113
	dnl CMOD_CHECK_CC_OPT([-Wnested-externs], [nested_externs])
114
	dnl
115
	CMOD_CHECK_CC_OPT([-pipe], [pipe]) [
116
fi]
117 118 119 120 121
AC_SUBST(PURIFY)
[if test "$use_purify" = "yes"
then
	PURIFY=purify
fi]
122

123
AC_SUBST(EFENCE)
124 125 126
[if test "$use_efence" = "yes"
then]
        AC_CHECK_LIB(efence,malloc)
127
        EFENCE=1
128 129
[fi]

130 131 132 133 134 135
AC_SUBST(TRACED_ALLOCATIONS)
[if test "$use_traced_allocations" = "yes"
then]
	AC_DEFINE(TRACED_ALLOCATIONS)
[fi]

136 137 138 139
AC_SUBST(DEBUG_CALLS)
[if test "$use_debug_calls" = "yes"
then]
        AC_DEFINE(DEBUG_CALLS)
140
        AC_CHECK_FUNCS(mallinfo)
141 142
[fi]

143
[if test "$use_gcov" = "yes" -a -n "$GCC"; then]
144 145
        CMOD_CHECK_CC_OPT([-ftest-coverage], [test_coverage])
        CMOD_CHECK_CC_OPT([-fprofile-arcs], [profile_arcs])
David Byers's avatar
David Byers committed
146
        AC_DEFINE(AVOID_ABORTS)
147 148 149 150 151 152 153 154 155
[fi]

[if test -n "$opt_level" -a "$opt_level" != "yes" ; then
    CFLAGS=`echo "$CFLAGS" | sed "s/-O[0-9]*//"`
    if test "$opt_level" != "no" ; then
        CFLAGS="$CFLAGS -O$opt_level"
    fi
fi]

156 157
# Do this test early since it may define _POSIX_SOURCE, which may
# affect future tests.
158
# FIXME (bug 210): is this needed, now that we use AM_C_PROTOTYPES?
159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186
AC_MSG_CHECKING([if <signal.h> defines struct sigaction])
AC_CACHE_VAL([kom_cv_header_posix_source_needed],
	[# This default may be overridden below.
	kom_cv_header_posix_source_needed=no])
AC_CACHE_VAL([kom_cv_struct_sigaction],
AC_TRY_COMPILE([#include <signal.h>],
[struct sigaction foosig;],
[kom_cv_struct_sigaction=yes],
[kom_cv_struct_sigaction=no])
[if test $kom_cv_struct_sigaction = no ; then]
  AC_TRY_COMPILE(
  [#define _POSIX_SOURCE
  #include <signal.h>],
  [struct sigaction barsig;],
  [kom_cv_struct_sigaction=yes
  kom_cv_header_posix_source_needed=yes],
  [kom_cv_struct_sigaction=no])
[fi])
[if test $kom_cv_header_posix_source_needed = yes ; then]
  AC_MSG_RESULT([yes, but _POSIX_SOURCE was needed])
  AC_DEFINE(_POSIX_SOURCE)
[else]
  AC_MSG_RESULT($kom_cv_struct_sigaction)
[fi]
[if test $kom_cv_struct_sigaction = yes ; then]
  AC_DEFINE(HAVE_STRUCT_SIGACTION)
[fi]

Per Cederqvist's avatar
Per Cederqvist committed
187
AC_C_CONST
Per Cederqvist's avatar
Per Cederqvist committed
188
AC_C_INLINE
189
CMOD_C_ATTRIBUTE_UNUSED
Per Cederqvist's avatar
Per Cederqvist committed
190
AC_HEADER_STDC
Per Cederqvist's avatar
Per Cederqvist committed
191
AC_TYPE_PID_T
Per Cederqvist's avatar
Per Cederqvist committed
192 193 194 195 196 197 198 199 200 201 202 203 204
dnl
dnl Check for sig_atomic_t
dnl
AC_CACHE_CHECK([if sig_atomic_t exists], kom_cv_type_sig_atomic_t,
[AC_TRY_COMPILE([#include <signal.h>],
	[sig_atomic_t t;], 
	[kom_cv_type_sig_atomic_t=yes], 
	[kom_cv_type_sig_atomic_t=no])])
[if test $kom_cv_type_sig_atomic_t = no
then]
    AC_DEFINE(sig_atomic_t, int)
[fi]
dnl
205
# FIXME (bug 209): is this needed now that we use AM_C_PROTOTYPES?
Per Cederqvist's avatar
Per Cederqvist committed
206 207 208
AC_MSG_CHECKING([if _HPUX_SOURCE needs to be defined])
AC_CACHE_VAL([kom_cv_sys_hpux_source],
[AC_TRY_LINK(
209
[#include <sys/types.h>
Per Cederqvist's avatar
Per Cederqvist committed
210 211 212 213 214
#include <sys/socket.h>],
[struct sockaddr foo;],
[kom_cv_sys_hpux_source=no], dnl IF FOUND
[dnl IF NOT FOUND
AC_TRY_LINK(
Per Cederqvist's avatar
Per Cederqvist committed
215
[#define _HPUX_SOURCE
216
#include <sys/types.h>
Per Cederqvist's avatar
Per Cederqvist committed
217 218 219 220 221 222 223 224
#include <sys/socket.h>],
[struct sockaddr foo;],
[kom_cv_sys_hpux_source=yes],
[kom_cv_sys_hpux_source=no])])])
AC_MSG_RESULT($kom_cv_sys_hpux_source)
[if test $kom_cv_sys_hpux_source = yes ; then]
  AC_DEFINE(_HPUX_SOURCE)
[fi]
225 226
dnl
dnl
227 228 229 230 231 232 233 234 235 236
AC_MSG_CHECKING([if the compiler understands __attribute__ ((format))])
AC_CACHE_VAL([kom_cv_c_attribute_format_printf],
[AC_TRY_COMPILE([extern void log (const char *f, ...) 
__attribute__ ((format (printf, 1, 2)));],,
[kom_cv_c_attribute_format_printf=yes],
[kom_cv_c_attribute_format_printf=no])])
AC_MSG_RESULT($kom_cv_c_attribute_format_printf)
[if test $kom_cv_c_attribute_format_printf = yes ; then]
  AC_DEFINE(HAVE_ATTRIBUTE_FORMAT_PRINTF)
[fi]
237 238 239 240 241 242 243 244 245 246
AC_MSG_CHECKING([if the compiler understands __attribute__ ((__noreturn__))])
AC_CACHE_VAL([kom_cv_c_attribute_noreturn],
[AC_TRY_COMPILE([extern void log (const char *f, ...) 
__attribute__ ((__noreturn__));],,
[kom_cv_c_attribute_noreturn=yes],
[kom_cv_c_attribute_noreturn=no])])
AC_MSG_RESULT($kom_cv_c_attribute_noreturn)
[if test $kom_cv_c_attribute_noreturn = yes ; then]
  AC_DEFINE(HAVE_ATTRIBUTE_NORETURN)
[fi]
Per Cederqvist's avatar
Per Cederqvist committed
247 248 249
AC_PROG_INSTALL
AC_PROG_RANLIB
AC_PROG_AWK
Per Cederqvist's avatar
Per Cederqvist committed
250
AC_PROG_LN_S
Per Cederqvist's avatar
Per Cederqvist committed
251
AC_PROG_YACC
252
AM_PROG_LEX
253 254
AC_CHECK_PROGS(BISON, bison)
AC_CHECK_PROGS(FLEX, flex)
Per Cederqvist's avatar
Per Cederqvist committed
255 256 257
AC_CHECK_PROGS(SED, sed)
AC_CHECK_HEADERS(string.h memory.h strings.h sys/param.h sys/time.h)
AC_CHECK_HEADERS(stdarg.h stdlib.h stddef.h locale.h sys/resource.h)
258
AC_CHECK_HEADERS(crypt.h unistd.h)
259
AC_CHECK_HEADERS(values.h) dnl libmisc/pom.c
Per Cederqvist's avatar
Per Cederqvist committed
260 261 262 263
AC_HEADER_TIME
AC_FUNC_ALLOCA
AC_CHECK_LIB(resolv,main) dnl Host name lookup.
AC_CHECK_LIB(authuser,auth_tcpuser3) dnl User authentication according to RFC 931.
264 265 266 267 268 269 270 271 272 273 274 275
dnl Low-level networking code on Solaris 2.
AC_CHECK_FUNC(gethostbyname)
[if test $ac_cv_func_gethostbyname = no
then]
      AC_CHECK_LIB(nsl, gethostbyname)
[fi]
dnl socket() et c on Solaris 2.
AC_CHECK_FUNC(socket)
[if test $ac_cv_func_socket = no
then]
  AC_CHECK_LIB(socket, socket)
[fi]
Per Cederqvist's avatar
Per Cederqvist committed
276
AC_CHECK_LIB(i,setlocale) dnl For setlocale() on Ultrix.
277
AC_CHECK_LIB(crypt,crypt) dnl For crypt() on Sparc NetBSD 1.1
Per Cederqvist's avatar
Per Cederqvist committed
278 279
AC_CHECK_FUNCS(difftime getdtablesize sysconf strchr getcwd vfprintf)
AC_CHECK_FUNCS(setrlimit)
280 281 282 283 284 285 286
AC_REPLACE_FUNCS(memcpy strerror remove memset memchr memcmp setsid)
dnl
dnl strdup() is not currently used, but we have a replacement function
dnl since it was used a while ago.  No need to take up time looking
dnl for it, though.  Remove strdup.c from EXTRA_DIST in
dnl src/libraries/libansi/Makefile.am if strdup is ever used again.
dnl AC_REPLACE_FUNCS(strdup)
Per Cederqvist's avatar
Per Cederqvist committed
287 288 289 290 291 292
dnl
dnl I don't know how to test for buggy inet_ntoa functions
dnl programmatically, but the supplied substitute should always work,
dnl so we define BUGGY_INET_NTOA unconditionally.
AC_DEFINE(BUGGY_INET_NTOA)
dnl
293
dnl Unencrypted passwords are no longer supported.
Per Cederqvist's avatar
Per Cederqvist committed
294 295
AC_DEFINE(ENCRYPT_PASSWORDS)
dnl
296 297
dnl Tests for GNU getopt (used in dbck)
AC_CHECK_HEADERS(alloca.h)
298 299 300 301
dnl
dnl Check for use of Gnu checker
dnl

David Byers's avatar
David Byers committed
302 303 304 305 306 307 308
[if test "$use_insure" = "yes"
then]
        AC_CHECK_PROGS(INSURE, insure)
        [ CC="insure" 
          LDFLAGS="-Zsl $LDFLAGS" ]
[fi]

309 310 311 312 313 314 315
[if test "$use_checker" = "yes"
then]
        AC_CHECK_PROGS(CHECKER, checker)
        [ CC="checker $CC"
          LIBS="-lchkr_m $LIBS" ]
[fi]

316
AC_CONFIG_SUBDIRS(src/libraries/libisc-new)
317
AC_CONFIG_FILES([Makefile
318
db-crypt/Makefile
319
db-crypt/db/Makefile
Per Cederqvist's avatar
Per Cederqvist committed
320 321 322 323 324 325 326 327 328 329 330
doc/Makefile
doc/man/Makefile
scripts/Makefile
src/Makefile
src/include/Makefile
src/include/server/Makefile
src/libraries/Makefile
src/libraries/libansi/Makefile
src/libraries/libcommon/Makefile
src/libraries/libmisc/Makefile
src/libraries/regex/Makefile
331 332
src/libraries/regex/doc/Makefile
src/libraries/regex/test/Makefile
333
src/server/Makefile
334
src/server/testsuite/Makefile
335
src/server/testsuite/config/Makefile
336
src/server/testsuite/lyskomd.0/Makefile
337 338
run-support/Makefile])
AC_CONFIG_COMMANDS([default],[[echo
Per Cederqvist's avatar
Per Cederqvist committed
339
echo "  Selected language: $language"
340 341
echo]],[[language=$language]])
AC_OUTPUT