configure.in 8.02 KB
Newer Older
1
dnl $Id: configure.in,v 1.40 1996/08/25 19:48:16 ceder Exp $
2
dnl Configuration for LysKOM
Per Cederqvist's avatar
Per Cederqvist committed
3
dnl Copyright (C) 1993, 1994, 1995, 1996  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
AC_REVISION($Revision: 1.40 $)
Per Cederqvist's avatar
Per Cederqvist committed
22
AC_INIT(src/server/lyskomd.h)
Per Cederqvist's avatar
Per Cederqvist committed
23
24
25
26
AC_ARG_WITH([gnu-malloc],
	[  --with-gnu-malloc       use GNU malloc],
	[use_gnu_malloc=$withval],
	[use_gnu_malloc=no])
27
28
29
30
AC_ARG_WITH([purify],
	[  --with-purify           link with Purify],
	[use_purify=$withval],
	[use_purify=no])
31
AC_PREFIX_DEFAULT(/usr/lyskom)
Per Cederqvist's avatar
Per Cederqvist committed
32
AC_PROG_CC
Per Cederqvist's avatar
Per Cederqvist committed
33
AC_SUBST(CFLAGS)
Per Cederqvist's avatar
Per Cederqvist committed
34
AC_SUBST(CPPFLAGS)
Per Cederqvist's avatar
Per Cederqvist committed
35
AC_SUBST(LDFLAGS)
Per Cederqvist's avatar
Per Cederqvist committed
36
AC_SUBST(DEPENDFLAG)
37
AC_SUBST(INCLUDE_CURRENT)
38
39
AC_SUBST(EXTRAARFLAGS)
EXTRAARFLAGS=
40
INCLUDE_CURRENT=-I.
41
42
43
AC_AIX
AC_ISC_POSIX
AC_MINIX
Per Cederqvist's avatar
Per Cederqvist committed
44
[if test -n "$GCC"; then
45
	CFLAGS="$CFLAGS -Wall"
46
47
	] AC_DEFINE(_GNU_SOURCE)
	KOM_COMPILER_CC_ACCEPTS([-pipe]) [
Per Cederqvist's avatar
Per Cederqvist committed
48
49
50
51
	DEPENDFLAG=-MM
else
	case "$CC" in
		*vcc) DEPENDFLAG=-Em
52
			INCLUDE_CURRENT='-I`pwd`';;
53
54
55
56
57
58
59
60
61
		*) if $CC -flags > conftestccflags 2>/dev/null \
			&& grep '^-xM1.*depend' conftestccflags >/dev/null 2>&1
		   then
			# SparcWorks
			DEPENDFLAG=-xM1
		   else
			# Traditional
			DEPENDFLAG=-M
		   fi;;
Per Cederqvist's avatar
Per Cederqvist committed
62
	esac
63
fi]
Per Cederqvist's avatar
Per Cederqvist committed
64
65
AC_MSG_CHECKING([flag to get dependencies])
AC_MSG_RESULT([$DEPENDFLAG])
66
67
68
69
70
AC_SUBST(PURIFY)
[if test "$use_purify" = "yes"
then
	PURIFY=purify
fi]
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# Do this test early since it may define _POSIX_SOURCE, which may
# affect future tests.
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
101
102
AC_C_CONST
AC_HEADER_STDC
Per Cederqvist's avatar
Per Cederqvist committed
103
AC_TYPE_PID_T
Per Cederqvist's avatar
Per Cederqvist committed
104
105
106
AC_MSG_CHECKING([if _HPUX_SOURCE needs to be defined])
AC_CACHE_VAL([kom_cv_sys_hpux_source],
[AC_TRY_LINK(
107
[#include <sys/types.h>
Per Cederqvist's avatar
Per Cederqvist committed
108
109
110
111
112
#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
113
[#define _HPUX_SOURCE
114
#include <sys/types.h>
Per Cederqvist's avatar
Per Cederqvist committed
115
116
117
118
119
120
121
122
#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]
123
124
125
126
127
128
129
130
131
132
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]
133
AC_SUBST(SRCTOPDIR)
134
[SRCTOPDIR=`cd $srcdir;pwd`]
135
AC_SUBST(BUILDTOPDIR)
136
[BUILDTOPDIR=`pwd`]
Per Cederqvist's avatar
Per Cederqvist committed
137
AC_CONFIG_AUX_DIR(scripts)
Per Cederqvist's avatar
Per Cederqvist committed
138
139
140
AC_PROG_INSTALL
AC_PROG_RANLIB
AC_PROG_AWK
Per Cederqvist's avatar
Per Cederqvist committed
141
AC_PROG_LN_S
Per Cederqvist's avatar
Per Cederqvist committed
142
143
AC_PROG_YACC
AC_PROG_LEX
Per Cederqvist's avatar
Per Cederqvist committed
144
145
146
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)
147
AC_CHECK_HEADERS(crypt.h unistd.h)
148
AC_CHECK_HEADERS(sys/select.h)	dnl Needed by ISC
Per Cederqvist's avatar
Per Cederqvist committed
149
150
151
152
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.
Per Cederqvist's avatar
Per Cederqvist committed
153
AC_CHECK_LIB(nsl,gethostbyname) dnl Low-level networking code on Solaris 2.
154
AC_CHECK_LIB(socket,socket) dnl socket() et c on Solaris 2.
Per Cederqvist's avatar
Per Cederqvist committed
155
AC_CHECK_LIB(i,setlocale) dnl For setlocale() on Ultrix.
156
AC_CHECK_LIB(crypt,crypt) dnl For crypt() on Sparc NetBSD 1.1
Per Cederqvist's avatar
Per Cederqvist committed
157
158
AC_CHECK_FUNCS(difftime getdtablesize sysconf strchr getcwd vfprintf)
AC_CHECK_FUNCS(setrlimit)
159
AC_REPLACE_FUNCS(memcpy strerror remove memset memchr memcmp setsid)
Per Cederqvist's avatar
Per Cederqvist committed
160
161
162
163
164
165
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
Per Cederqvist's avatar
Per Cederqvist committed
166
167
168
169
170
171
172
173
174
175
176
177
178
179
AC_SUBST(GNUMALLOC)
GNUMALLOC=
[if [ "$use_gnu_malloc" = "yes" ]]
[then]
	AC_DEFINE(USE_GNU_MALLOC)
dnl	This is only needed on SunOS 4 machines, but it does not
dnl	do much harm on other system.  This causes GNU malloc to
dnl	unconditionally treat malloc(x) as malloc(16) if x<16.
dnl	FIXME: find a proper check for if this is really needed.
	AC_DEFINE(SUNOS_LOCALTIME_BUG)
dnl
dnl	GNU Malloc also needs these:
dnl
	AC_CHECK_FUNCS(getpagesize)
180
	AC_CHECK_FUNC(memmove,,AC_DEFINE(MEMMOVE_MISSING))
Per Cederqvist's avatar
Per Cederqvist committed
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
	AC_CHECK_HEADERS(unistd.h)
dnl
dnl	AC_USG is obsolete, but GNU malloc still uses it.
dnl
	AC_USG
dnl
dnl	AC_HEADER_STDC  -- already provided
dnl	Tell the Makefiles that we want GNU Malloc.
dnl
	GNUMALLOC=gnumalloc
[else]
dnl	Make sure that the GNU malloc header and library are not left
dnl	from a previous build attempt
	[rm -f include/malloc.h lib/libgmalloc*.a]
[fi]
dnl
Per Cederqvist's avatar
Per Cederqvist committed
197
198
199
200
201
202
203
204
dnl Unencryptet passwords are no longer supported.
AC_DEFINE(ENCRYPT_PASSWORDS)
dnl
dnl Once upon a time, the server shared some code with the tty-client.
dnl Because of that, you still have to define SERVER while compiling
dnl some of the files in this package.  Nowadays sharing is done by copying.
AC_DEFINE(SERVER)
dnl
205
206
207
dnl Tests for GNU getopt (used in dbck)
AC_CHECK_HEADERS(alloca.h)
dnl
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
dnl Tests for bad make programs
AC_MSG_CHECKING([if make defines ARFLAGS])
[echo 'foo: ; @echo BEGIN$(ARFLAGS)END' > conftestmake
case `make -f conftestmake` in
	BEGINEND)]
		AC_MSG_RESULT([no; setting EXTRAARFLAGS to rv])
		[EXTRAARFLAGS=rv;;
	BEGINrvEND)]
		AC_MSG_RESULT([yes]);;
	[BEGIN*END)]
		AC_MSG_RESULT([yes, but to a suspicious value]);;
	[*)]
		AC_MSG_RESULT([probably]);;
[esac
rm conftestmake]
dnl		
dnl
Per Cederqvist's avatar
Per Cederqvist committed
225
226
227
228
229
230
231
232
233
234
235
236
237
238
AC_OUTPUT(Makefile
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/libisc-new/Makefile
src/libraries/libisc-new/src/Makefile
src/libraries/libmisc/Makefile
src/libraries/regex/Makefile
Per Cederqvist's avatar
Per Cederqvist committed
239
src/libraries/gnumalloc/Makefile
240
src/server/testsuite/Makefile
241
src/server/Makefile
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
run-support/Makefile,
[
# make will complain unless the "dependencies" files exists.
# Worse: some make versions will abort unless they exist!  The
# following lines creates them unless they already exists.
echo touching dependencies files...
touch doc/dependencies
touch doc/man/dependencies
touch run-support/dependencies
touch scripts/dependencies
touch src/include/server/dependencies
touch src/include/dependencies
touch src/libraries/libansi/dependencies
touch src/libraries/libcommon/dependencies
touch src/libraries/libisc-new/src/dependencies
touch src/libraries/libisc-new/dependencies
touch src/libraries/libmisc/dependencies
touch src/libraries/regex/dependencies
touch src/libraries/dependencies
261
touch src/server/testsuite/dependencies
262
263
264
265
touch src/server/dependencies
touch src/dependencies
touch dependencies
])