forked from hypermail-project/hypermail
-
Notifications
You must be signed in to change notification settings - Fork 1
/
configure.in
406 lines (343 loc) · 11.3 KB
/
configure.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
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
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
dnl Process this file with autoconf to produce a configure script.
AC_REVISION($Revision$)dnl
AC_INIT(src/hypermail.c)
AC_CONFIG_HEADER(config.h)
AC_PREFIX_DEFAULT(/usr/local)
LDFLAGS=""
LIBS=""
EXTRA_LIBS=""
INCLUDES=""
GDBM_INCLUDE=""
GDBM_LIB=""
FNV_DEP=""
SUBDIRS="src/pcre"
dnl ===========================================================================
dnl Get host, target and build variables filled with appropriate info.
dnl ===========================================================================
AC_CANONICAL_SYSTEM
dnl ===========================================================================
dnl Check to assure the cached information is valid.
dnl ===========================================================================
AC_MSG_CHECKING(cached information)
hostcheck="$host"
AC_CACHE_VAL(ac_cv_hostcheck, [ ac_cv_hostcheck="$hostcheck" ])
if test "$ac_cv_hostcheck" != "$hostcheck"; then
AC_MSG_RESULT(changed)
AC_MSG_WARN(config.cache exists!)
AC_MSG_ERROR(you must do 'make clobber' first to compile for different host or different parameters.)
else
AC_MSG_RESULT(ok)
fi
dnl ===========================================================================
dnl Checks for programs.
dnl ===========================================================================
AC_PROG_CC
AC_PROG_CPP
AC_PROG_YACC
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_CHECK_PROG(AR, ar, ar, echo)
if test -z "$no_ranlib"; then
AC_PROG_RANLIB
else
RANLIB=":"
fi
dnl ===========================================================================
dnl Determine the host type and set compliation flags as needed
dnl ===========================================================================
INSTALL="install-sh"
case "$host" in
*-*-solaris*)
# Solaris flags
AC_DEFINE(NO_MACRO)
;;
*-*-hpux*)
# HPUX flags
if test -z "$GCC"; then
CFLAGS="$CFLAGS -Ae"
fi
;;
*-dec-osf*)
# DEC OSF flags
CFLAGS="$CFLAGS -mieee"
INSTALL="install-sh"
;;
esac
export CFLAGS CC
AC_SUBST(INSTALL)
AC_MSG_CHECKING([that the compiler works])
AC_TRY_RUN([ main(int ac, char **av) { return 0; } ],
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no)
AC_MSG_ERROR(Could not compile and run even a trivial ANSI C program - check CC.),
AC_MSG_ERROR(Could not compile and run even a trivial ANSI C program - check CC.))
dnl ===========================================================================
dnl Determine if building on a Cygwin system so that
dnl etc/passwd checks are to be disabled.
dnl ===========================================================================
case "$build" in
*-*-cygwin*)
suffix=.exe
AC_SUBST(suffix)
;;
esac
dnl ===========================================================================
dnl Accepted arguments to ./configure...
dnl ===========================================================================
AC_MSG_CHECKING([whether to enable -Wall])
AC_ARG_ENABLE(warnings,
[ --enable-warnings Enable -Wall if using gcc.],
[ if test -n "$GCC"; then
AC_MSG_RESULT(adding -Wall to CFLAGS.)
CFLAGS="$CFLAGS -Wall"
fi],AC_MSG_RESULT(no))
AC_ARG_WITH(httpddir,
[ --with-httpddir=DIR webserver's root directory [/usr/local/apache]],
httpddir=$with_httpddir, httpddir=/usr/local/apache)
AC_SUBST(httpddir)
AC_ARG_WITH(cgidir,
[ --with-cgidir=DIR where to install CGI scripts ],
cgidir=$with_cgidir, cgidir=$httpddir/cgi-bin)
AC_SUBST(cgidir)
AC_ARG_WITH(htmldir,
[ --with-htmldir=DIR where to install Hypermail HTML pages ],
htmldir=$with_htmldir, htmldir=$httpddir/htdocs/hypermail)
AC_SUBST(htmldir)
AC_ARG_WITH(language,
[ --with-language=xx two character language indicator [en] ],
language=$with_language, language=en)
AC_SUBST(language)
AC_ARG_WITH(htmlsuffix,
[ --with-htmlsuffix=xx two character language indicator [html] ],
htmlsuffix=$with_htmlsuffix, htmlsuffix=html)
AC_SUBST(htmlsuffix)
AC_ARG_ENABLE(defaultindex,
[ --enable-defaultindex=type Default index page type [thread] ],
[ defaultindex=$enableval ], [ defaultindex="thread" ])
AC_SUBST(defaultindex)
AC_ARG_WITH(domainaddr,
[ --with-domainaddr=YOURDOMAIN domain address of local domain ],
domainaddr=$with_domainaddr, domainaddr=NONE)
AC_SUBST(domainaddr)
dnl ===========================================================================
dnl Configure the subdirectories
dnl ===========================================================================
AC_CONFIG_SUBDIRS($SUBDIRS)
dnl ===========================================================================
dnl Checks headers
dnl ===========================================================================
AC_HEADER_STDC
AC_CHECK_HEADERS(alloca.h arpa/inet.h ctype.h dirent.h errno.h \
fcntl.h locale.h malloc.h netdb.h netinet/in.h pwd.h stdarg.h \
stdio.h stdlib.h string.h sys/dir.h sys/param.h sys/socket.h \
sys/stat.h sys/time.h sys/types.h time.h unistd.h)
AC_HEADER_STAT
AC_HEADER_DIRENT
AC_HEADER_TIME
dnl ===========================================================================
dnl Checks for library functions.
dnl Check for typedefs, structures, and compiler characteristics.
dnl ===========================================================================
AC_STRUCT_TM
AC_FUNC_STRFTIME
AC_CHECK_FUNCS(mkdir strdup strstr strtol memcpy memset lstat strcasecmp \
strcasestr getpwuid getopt snprintf memmove strerror)
AC_TYPE_SIZE_T
if test $ac_cv_func_snprintf != no; then
AC_DEFINE(HAVE_SNPRINTF)
fi
dnl gdbm checks
AC_DEFUN(AC_TEMP_LDFLAGS,[
old_LDFLAGS="$LDFLAGS"
LDFLAGS="$1 $LDFLAGS"
$2
LDFLAGS="$old_LDFLAGS"
])
dnl
dnl AC_HMAIL_ONCE(namespace, variable, code)
dnl
dnl execute code, if variable is not set in namespace
dnl
AC_DEFUN(AC_HMAIL_ONCE,[
changequote({,})
unique=`echo $2|sed 's/[^a-zA-Z0-9]/_/g'`
changequote([,])
cmd="echo $ac_n \"\$$1$unique$ac_c\""
if test -n "$unique" && test "`eval $cmd`" = "" ; then
eval "$1$unique=set"
$3
fi
])
dnl
dnl AC_EXPAND_PATH(path, variable)
dnl
dnl expands path to an absolute path and assigns it to variable
dnl
AC_DEFUN(AC_EXPAND_PATH,[
if test -z "$1" || echo "$1" | grep '^/' >/dev/null ; then
$2="$1"
else
changequote({,})
ep_dir="`echo $1|sed 's%/*[^/][^/]*/*$%%'`"
changequote([,])
ep_realdir="`(cd \"$ep_dir\" && pwd)`"
$2="$ep_realdir/`basename \"$1\"`"
fi
])
AC_DEFUN(AC_ADD_INCLUDE,[
if test "$1" != "/usr/include"; then
AC_EXPAND_PATH($1, ai_p)
AC_HMAIL_ONCE(INCLUDEPATH, $ai_p, [
INCLUDES="$INCLUDES -I$ai_p"
])
fi
])
dnl
dnl AC_ADD_LIBPATH(path[, shared-libadd])
dnl
dnl add a library to linkpath
dnl
AC_DEFUN(AC_ADD_LIBPATH,[
if test "$1" != "/usr/lib"; then
AC_EXPAND_PATH($1, ai_p)
AC_HMAIL_ONCE(LIBPATH, $ai_p, [
LDFLAGS="$LDFLAGS -L$ai_p"
])
fi
])
dnl
dnl AC_ADD_LIBRARY_WITH_PATH(library, path[, shared-libadd])
dnl
dnl add a library to the link line and path to linkpath/runpath.
dnl if shared-libadd is not empty and $ext_shared is yes,
dnl shared-libadd will be assigned the library information
dnl
AC_DEFUN(AC_ADD_LIBRARY_WITH_PATH,[
ifelse($3,,[
if test -n "$2"; then
AC_ADD_LIBPATH($2)
fi
EXTRA_LIBS="$EXTRA_LIBS $1" ],[
AC_ADD_LIBRARY_WITH_PATH($1,$2)
])
])
AC_ARG_WITH(gdbm,
[ --with-gdbm[=DIR] Include GDBM support],
[ given_gdbm=$withval])
if test "$given_gdbm" != "no"; then
for i in /usr/local /usr $withval; do
if test -f "$i/include/gdbm.h"; then
GDBM_INCLUDE="$i/include"
THIS_PREFIX="$i"
fi
done
unset ac_cv_lib_gdbm_gdbm_open
AC_TEMP_LDFLAGS(-L$THIS_PREFIX/lib,[
AC_CHECK_LIB(gdbm, gdbm_open, [GDBM_LIB="-lgdbm"])
])
if test "$THIS_PREFIX" != "" && test "$THIS_PREFIX" != "/usr"; then
THIS_LFLAGS="$THIS_PREFIX/lib"
fi
fi
AC_MSG_CHECKING(for GDBM support)
if test "$GDBM_LIB" = "" && test "$given_gdbm" != "no"; then
AC_CHECK_LIB(gdbm, gdbm_open,[AC_DEFINE(GDBM,1, [Whether you have GDBM]) DBM_TYPE=gdbm; GDBM_LIB=-lgdbm],
[DBM_TYPE=""])
AC_MSG_CHECKING([gdbm library])
if test "a$DBM_TYPE" = a; then
AC_MSG_RESULT(none found)
AC_MSG_WARN(No gdbm library found - will limit a few features)
else
AC_MSG_RESULT($DBM_TYPE found)
fi
else
AC_MSG_RESULT(no)
fi
if test "$GDBM_LIB" = "-lgdbm" && test "$GDBM_INCLUDE" = ""; then
AC_CHECK_HEADER(gdbm.h, [ GDBM_INCLUDE="" ], [
AC_MSG_RESULT(Try /usr/local/include/gdbm.h)
AC_CHECK_HEADER(/usr/local/include/gdbm.h, [ GDBM_INCLUDE="-I/usr/local/include" ],[
AC_MSG_RESULT(Try /opt/local/include/gdbm.h)
AC_CHECK_HEADER(/opt/local/include/gdbm.h, [ GDBM_INCLUDE="-I/opt/local/include" ],[
dnl if in /usr/pkg/include, do not add anything. See above.
AC_MSG_RESULT(Try /usr/pkg/include/gdbm.h)
AC_CHECK_HEADER(/usr/pkg/include/gdbm.h, [ GDBM_INCLUDE="" ],[
AC_MSG_RESULT([Giving up - You need to install gdbm.h somewhere])
exit
])
])
])
])
fi
if test -n "$GDBM_LIB"; then
AC_ADD_INCLUDE($GDBM_INCLUDE)
AC_DEFINE(HAVE_GDBM_H)
EXTRA_LIBS="$EXTRA_LIBS $GDBM_LIB"
fi
dnl
dnl iconv check
dnl
AC_ARG_ENABLE(i18n, [ --disable-i18n Disable I18N support], [given_iconv=$enableval])
if test "$given_iconv" = "no"; then
echo "disabled I18N support."
else
AC_CHECK_FUNCS(iconv)
AC_CHECK_HEADERS(iconv.h)
fi
dnl
dnl The FNV hash library used for the nonsequential filenames
dnl
AC_MSG_CHECKING(whether the fnv hash library exists)
AC_ARG_ENABLE(libfnv,
[ --enable-libfnv fnv hash library (used for the nonsequential file names) [no] ],
[ AC_MSG_RESULT(yes)
SUBDIRS="$SUBDIRS src/fnv"
AC_DEFINE(HAVE_LIBFNV)
AC_ADD_INCLUDE(src/fnv)
AC_ADD_LIBRARY_WITH_PATH(-lfnv,src/fnv)
FNV_DEP="fnv/libfnv.a"
],AC_MSG_RESULT(no))
AC_SUBST(FNV_DEP)
dnl ===========================================================================
dnl Checks for libraries.
dnl nsl socket lib?
dnl ===========================================================================
USENSL=no
AC_CHECK_LIB(socket,gethostbyaddr,result=yes,result=no)
if test $result = yes; then
LIBS="$LIBS -lsocket"
else
AC_CHECK_LIB(socket,gethostbyaddr,result=yes,result=no,-lnsl)
if test $result = yes; then
LIBS = "$LIBS -lsocket -lnsl"
USENSL=yes
else
AC_CHECK_LIB(socket,inet_addr,result=yes,result=no)
if test $result = yes; then
LIBS="$LIBS -lsocket"
else
AC_CHECK_LIB(socket,inet_addr,result=yes,result=no,-lnsl)
if test $result = yes; then
LIBS="$LIBS -lsocket -lnsl"
USENSL=yes
fi
fi
fi
fi
if test $USENSL != yes; then
AC_CHECK_LIB(nsl,inet_addr,result=yes,result=no)
if test $result = yes; then
LIBS="$LIBS -lnsl"
fi
fi
dnl ===========================================================================
dnl Makefile variable substitution
dnl ===========================================================================
AC_SUBST(HAVE_MEMMOVE)
AC_SUBST(HAVE_STRERROR)
AC_SUBST(LDFLAGS)
AC_SUBST(LIBS)
AC_SUBST(EXTRA_LIBS)
AC_SUBST(INCLUDES)
AC_OUTPUT(Makefile archive/Makefile docs/Makefile libcgi/Makefile src/Makefile tests/testhm src/defaults.h)