-
Notifications
You must be signed in to change notification settings - Fork 71
/
configure.ac
550 lines (472 loc) · 16.3 KB
/
configure.ac
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
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
dnl Process this file with autoconf to produce a configure script.
AC_PREREQ([2.69])
AC_REVISION($Revision: 1.2 $)dnl
AC_INIT
AC_CONFIG_SRCDIR([src/hypermail.c])
AC_CONFIG_HEADER(config.h)
AC_PREFIX_DEFAULT(/usr/local)
LDFLAGS=""
LIBS=""
EXTRA_LIBS=""
INCLUDES=""
CPPFLAGS=""
GDBM_INCLUDE=""
GDBM_LIB=""
FNV_DEP=""
TRIO_DEP=""
PCRE_DEP=""
PCRE_MIN_VERSION="8.39"
dnl ===========================================================================
dnl Get host, target and build variables filled with appropriate info.
dnl ===========================================================================
AC_CANONICAL_TARGET
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_CHECK_PROG(YACC_CHECK,$YACC,yes)
AS_IF([test x"$YACC_CHECK" != x"yes"], [AC_MSG_ERROR([Please install either bison or yacc and run configure again])])
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_RUN_IFELSE([AC_LANG_SOURCE([[ 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
dnl These are the subdirs that are compiled systematically
dnl For subdirs that can be disabled thru configure options,
dnl we configure them in a dedicated section near the test
dnl ===========================================================================
AC_DISABLE_OPTION_CHECKING
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,
AS_HELP_STRING([--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 libtrio: select whether to use the system or the bundled libtrio
dnl
dnl system libtrio
AC_ARG_ENABLE([system_libtrio],
AS_HELP_STRING([--enable-system-libtrio],
[Use the system libtrio instead of compiling the bundled one]))
if test "${enable_system_libtrio}" = yes; then
AC_MSG_NOTICE(checking for system libtrio)
AC_SEARCH_LIBS([trio_printf], [trio], [],
[AC_MSG_ERROR([unable to find trio_copy() function])
])
AC_CHECK_HEADER(trio.h, [],
[AC_MSG_ERROR([unable to find trio.h header file (dev version not installed?)])
])
else
AC_MSG_NOTICE([using bundled libtrio])
APR_ADDTO(INCLUDES, "[-Itrio]")
APR_ADDTO(LDFLAGS, "[-Ltrio]")
APR_ADDTO(CPPFLAGS, "[-DTRIO_MINIMAL]")
TRIO_DEP="trio/libtrio.a"
APR_SUBDIR_CONFIG([src/trio],
[CFLAGS=[-DTRIO_MINIMAL]],
[--with-pcre=*|\'--with-pcre=*])
AC_SUBST([TRIO_DEP])
fi
dnl
dnl PCRE: select whether to use an external, the system, or the bundled PCRE lib
dnl partially borrowed from Apache's configure.in
dnl
dnl bundled pcre lib
AC_ARG_ENABLE(bundled_pcre,
AS_HELP_STRING([--enable-bundled-pcre],
[Force the use of the bundled PCRE library instead of the system one]))
dnl external PCRE lib
AC_ARG_WITH(external_pcre,
AS_HELP_STRING([--with-external-pcre=PATH_TO_PCRE_DIR|PATH_TO_PCRE_CONFIG_SCRIPT],
[Use an external PCRE library instead of the system or the bundled one]))
AC_MSG_NOTICE(checking for PCRE regular expressions library)
dnl if user selected the bundled one, give it priority over the bundled one
if test ! -z ${enable_bundled_pcre}; then
with_external_pcre=""
fi
case $with_external_pcre in
/*) AC_MSG_NOTICE(--with-external-pcre => checking for an external libpcre)
AC_MSG_CHECKING(for pcre-config)
if test -d "$with_external_pcre" && test -x "$with_external_pcre/pcre-config"; then
PCRE_CONFIG=$with_external_pcre/pcre-config
elif test -x "$with_external_pcre"; then
PCRE_CONFIG=$with_external_pcre
else
AC_MSG_RESULT(no)
AC_MSG_ERROR(${PCRE_CONFIG} does not point to a directory or pcre-config)
fi
AC_MSG_RESULT(${PCRE_CONFIG})
AC_MSG_CHECKING(for pcre version equal or greater than ${PCRE_MIN_VERSION})
if test -f "${PCRE_CONFIG}" && test -x "${PCRE_CONFIG}"; then
PCRE_VERSION=$(${PCRE_CONFIG} --version)
AS_VERSION_COMPARE("${PCRE_VERSION}", "${PCRE_MIN_VERSION}",
[PCRE_CONFIG=false], [], [])
if test "${PCRE_CONFIG}" != false; then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
AC_MSG_ERROR(the PCRE library version must be equal or greater than ${PCRE_MIN_VERSION})
fi
else
AC_MSG_RESULT(no)
AC_MSG_ERROR(${PCRE_CONFIG} does not point to a script)
fi
;;
*) PCRE_CONFIG=false
;;
esac
dnl nope; do we have a system PCRE lib?
if test -z "${enable_bundled_pcre}" && test -z "${PCRE_CONFIG}" -o "${PCRE_CONFIG}" = "false"; then
AC_MSG_NOTICE(checking for a system libpcre)
AC_PATH_PROG([PCRE_CONFIG], [pcre-config], [])
if test ! -z "${PCRE_CONFIG}"; then
AC_MSG_CHECKING(checking pcre version equal or greater than ${PCRE_MIN_VERSION})
PCRE_VERSION=$(${PCRE_CONFIG} --version)
AS_VERSION_COMPARE("${PCRE_VERSION}", "${PCRE_MIN_VERSION}",
[PCRE_CONFIG=false], [], [])
if test "${PCRE_CONFIG}" != false; then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
else
PCRE_CONFIG=false
fi
fi
dnl found a library, do we have compilation headers?
if test "${PCRE_CONFIG}" != false; then
PCRE_PATH=$(${PCRE_CONFIG} --prefix)
AC_CHECK_HEADER(["$PCRE_PATH/include/pcre.h"], [ ],[PCRE_CONFIG=false])
fi
dnl PCRE conclusion
if test "$PCRE_CONFIG" != "false"; then
AC_MSG_NOTICE([using system PCRE regular expressions library])
APR_ADDTO(CFLAGS, [`$PCRE_CONFIG --cflags`])
APR_ADDTO(LIBS, [`$PCRE_CONFIG --libs`])
else
AC_MSG_NOTICE([using bundled PCRE regular expressions library])
APR_ADDTO(INCLUDES, [-Ipcre])
APR_ADDTO(LDFLAGS, "[-Lpcre/.libs]")
PCRE_DEP="pcre/.libs/libpcre.a"
APR_SUBDIR_CONFIG([src/pcre],
[],
[--with-pcre=*|\'--with-pcre=*])
AC_SUBST([PCRE_DEP])
fi
dnl
dnl The FNV hash library used for the nonsequential filenames
dnl
AC_MSG_CHECKING([whether to use fnv hash library for non-sequential filenames])
AC_ARG_ENABLE(libfnv,
[ AS_HELP_STRING([--enable-libfnv],
[use the fnv hash library for generating non-sequential filenames [no]])
],
[ given_libfnv=$enableval ])
if test "$given_libfnv" != "yes"; then
AC_MSG_RESULT([no])
else
AC_MSG_RESULT([yes])
AC_DEFINE([HAVE_LIBFNV])
APR_ADDTO(INCLUDES, [-Ifnv])
dnl APR_ADDTO(LDFLAGS, "[-Lfnv]")
AC_ADD_LIBRARY_WITH_PATH([-lfnv],[src/fnv])
FNV_DEP="fnv/libfnv.a"
APR_SUBDIR_CONFIG([src/fnv])
fi
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_CONFIG_FILES([Makefile archive/Makefile docs/Makefile libcgi/Makefile src/Makefile tests/testhm src/defaults.h])
AC_OUTPUT