-
Notifications
You must be signed in to change notification settings - Fork 21
/
configure.ac
452 lines (397 loc) · 13.9 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
#
# Part of the hl://Dig package <https://solbu.github.io/hldig/>
# Copyright (c) 2017-2018 The hl://Dig Group
# For copyright details, see the file COPYING in your distribution
# or the GNU Library General Public License (LGPL) version 2 or later
# <http://www.gnu.org/copyleft/lgpl.html>
AC_PREREQ(2.57)
AC_INIT([hldig], [1.0.2], [https://github.com/solbu/hldig/issues/], ,['https://github.com/solbu/hldig/'])
AC_CONFIG_SRCDIR([hldig/hldig.cc])
AM_INIT_AUTOMAKE
HLDIG_MAJOR_VERSION=[`expr $VERSION : '\([0-9][0-9]*\)'`]
AC_SUBST(HLDIG_MAJOR_VERSION)
HLDIG_MINOR_VERSION=[`expr $VERSION : '[0-9][0-9]*\.\([0-9][0-9]*\)'`]
AC_SUBST(HLDIG_MINOR_VERSION)
HLDIG_MICRO_VERSION=[`expr $VERSION : '[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\)'`]
AC_SUBST(HLDIG_MICRO_VERSION)
AM_CONFIG_HEADER([include/config.h:include/config.in])
AC_CONFIG_LIBOBJ_DIR([hllib])
AC_PREFIX_DEFAULT([/opt/www])
AC_CONFIG_MACRO_DIRS([m4])
# Initialize maintainer mode
AM_MAINTAINER_MODE
AC_ARG_WITH(config-dir, [AC_HELP_STRING([--with-config-dir=DIR],
[where your config directory is @<:@PREFIX/etc/hldig@:>@])],
CONFIG_DIR="$withval", CONFIG_DIR='${sysconfdir}/hldig')
AC_SUBST(CONFIG_DIR)
# In the below, the strings @<:@ and @:>@ expand to [ and ]
AC_ARG_WITH(default-config-file,
[AC_HELP_STRING([--with-default-config-file=FILE],
[where the various programs will look for a configuration file
@<:@PREFIX/etc/hldig/hldig.conf@:>@])],
DEFAULT_CONFIG_FILE="$withval", DEFAULT_CONFIG_FILE='${CONFIG_DIR}/hldig.conf')
AC_SUBST(DEFAULT_CONFIG_FILE)
AC_ARG_WITH(common-dir, [AC_HELP_STRING([--with-common-dir=DIR],
[where your .html templates are stored
@<:@PREFIX/share/hldig/templates@:>@])],
COMMON_DIR="$withval", COMMON_DIR='${datadir}/hldig/templates')
AC_SUBST(COMMON_DIR)
AC_ARG_WITH(database-dir, [AC_HELP_STRING([--with-database-dir=DIR],
[where your database directory is
@<:@PREFIX/var/hldig@:>@])],
DATABASE_DIR="$withval", DATABASE_DIR='${localstatedir}/hldig')
AC_SUBST(DATABASE_DIR)
AC_ARG_WITH(cgi-bin-dir, [AC_HELP_STRING([--with-cgi-bin-dir=DIR],
[where your web server cgi-bin directory is
@<:@PREFIX/share/hldig/cgi-bin@:>@])],
CGIBIN_DIR="$withval", CGIBIN_DIR='${datadir}/hldig/cgi-bin')
AC_SUBST(CGIBIN_DIR)
AC_ARG_WITH(search-dir, [AC_HELP_STRING([--with-search-dir=DIR],
[where the sample search form should be installed
@<:@PREFIX/share/hldig/www/html/hldig@:>@])],
SEARCH_DIR="$withval", SEARCH_DIR='${datadir}/hldig/www')
AC_SUBST(SEARCH_DIR)
AC_ARG_WITH(search-form, [AC_HELP_STRING([--with-search-form=FILE],
[the name for the sample search form @<:@search.html@:>@])],
SEARCH_FORM="$withval", SEARCH_FORM='search.html')
AC_SUBST(SEARCH_FORM)
AC_ARG_WITH(image-dir, [AC_HELP_STRING([--with-image-dir=DIR],
[where the hl://Dig images are installed
@<:@PREFIX/share/hldig/www/images@:>@])],
IMAGE_DIR="$withval", IMAGE_DIR='${datadir}/hldig/www')
AC_SUBST(IMAGE_DIR)
# path needs to be absolute or relative to the web site root, not the
# filesystem. This value is used to load images on the search results page.
AC_ARG_WITH(image-url-prefix,
[AC_HELP_STRING([--with-image-url-prefix=LOCATION],
[the URL path to the installed images @<:@$/www@:>@])],
IMAGE_URL_PREFIX="$withval", IMAGE_URL_PREFIX='/www')
AC_SUBST(IMAGE_URL_PREFIX)
AC_ARG_WITH(rx, [AC_HELP_STRING([--with-rx],
[with system rx instead of regex @<:@no@:>@])],
WITH_RX="$withval", WITH_RX='no')
# If the user doesn't want tests
AC_ARG_ENABLE(tests,
[AC_HELP_STRING([--enable-tests],
[do build a version with run-time tests.])],
[hldig_cv_tests="$enable_tests"], [hldig_cv_tests="no"])
AM_CONDITIONAL(TESTS, test x$hldig_cv_tests = xyes)
# Checks for programs.
AC_PROG_CXX
AC_PROG_CC
AC_PROG_CPP
AC_AIX
AM_PROG_LEX
AC_PROG_YACC
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_PROG_LIBTOOL
AC_COMPILE_WARNINGS
NO_RTTI
NO_EXCEPTIONS
AC_PATH_PROG(AR, ar, ar)
AC_PATH_PROG(SHELL, sh, /bin/sh)
AC_PATH_PROG(SED, sed, /bin/sed)
AC_PATH_PROG(PERL, perl, /usr/bin/perl)
AC_PATH_PROG(FIND, find, /bin/find)
AC_PATH_PROG(GUNZIP, gunzip, /bin/gunzip)
AC_CHECK_PROGS(RRDTOOL, rrdtool)
AC_CHECK_PROGS(TAR, tar gtar gnutar, tar)
AC_PATH_PROG(MV, mv, /bin/mv)
AC_PATH_PROG(SENDMAIL, sendmail, /usr/lib/sendmail,
$PATH:/usr/libexec:/usr/sbin:/usr/lib:/usr/etc:etc)
AM_PROG_TIME
# Checks for libraries.
#AC_CHECK_LIB([z], [main])
AC_CHECK_LIB(socket, socket)
AC_CHECK_LIB(nsl, t_accept)
# Check for libssl
# Adapted from configure.ac @ the lighttpd project
# <https://github.com/lighttpd/lighttpd2/blob/master/configure.ac>
dnl Check for openssl
AC_MSG_NOTICE([----------------------------------------])
AC_MSG_CHECKING([for OpenSSL])
AC_ARG_WITH([openssl],
[AC_HELP_STRING([--with-openssl@<:@=DIR@:>@],
[Include openssl support (default yes)]
)],
[WITH_OPENSSL=$withval],
[WITH_OPENSSL=yes]
)
AC_MSG_RESULT([$WITH_OPENSSL])
if test "$WITH_OPENSSL" != no; then
if test "$WITH_OPENSSL" != yes; then
openssl_append_CPPFLAGS=" -I$WITH_OPENSSL/include"
openssl_append_LDFLAGS=" -L$WITH_OPENSSL/lib"
fi
fi
AC_MSG_CHECKING([custom include directory for openssl])
AC_ARG_WITH([openssl-includes],
[AC_HELP_STRING([--with-openssl-includes=DIR], [OpenSSL includes])],
[
if test "$WITH_OPENSSL" = no; then
AC_MSG_ERROR([build --with-openssl to use --with-openssl-includes])
fi
openssl_append_CPPFLAGS=" -I$withval"
AC_MSG_RESULT([$withval])
],
[AC_MSG_RESULT([no])]
)
AC_MSG_CHECKING([custom lib directory for openssl])
AC_ARG_WITH([openssl-libs],
[AC_HELP_STRING([--with-openssl-libs=DIR], [OpenSSL libraries])],
[
if test "$WITH_OPENSSL" = no; then
AC_MSG_ERROR([build --with-openssl to use --with-openssl-libs])
fi
LDFLAGS="$LDFLAGS -L$withval"
AC_MSG_RESULT([$withval])
],
[AC_MSG_RESULT([no])]
)
AM_CONDITIONAL([BUILD_WITH_OPENSSL], [test "$WITH_OPENSSL" != no])
if test "$WITH_OPENSSL" != no; then
CPPFLAGS="${CPPFLAGS}${openssl_append_CPPFLAGS}"
LDFLAGS="${LDFLAGS}${openssl_append_LDFLAGS}"
AC_CHECK_HEADERS([openssl/ssl.h], found_ssl=yes)
if test "x$found_ssl" != xyes ;then
for dir in /usr /usr/local/ssl /usr/lib/ssl /usr/ssl /usr/pkg /usr/local/opt/openssl ; do
ssldir="$dir"
if test -f "$dir/include/openssl/ssl.h"; then
found_ssl=yes;
CPPFLAGS="$CPPFLAGS -I$ssldir/include";
LDFLAGS="$LDFLAGS -L$ssldir/lib";
break;
fi
done
fi
if test "x$found_ssl" != xyes ;then
AC_MSG_ERROR([openssl headers not found. install them or build without --with-openssl])
fi
AC_CHECK_LIB([crypto], [BIO_f_base64],
[LIBS="$LIBS -lcrypto"],
[AC_MSG_ERROR([openssl crypto library not found. install it or build without --with-openssl])]
)
AC_CHECK_LIB([ssl], [SSL_new],
[LIBS="$LIBS -lssl -lcrypto"],
[AC_MSG_ERROR([openssl ssl library not found. install it or build without --with-openssl])],
[ -lcrypto "$DL_LIB" ]
)
AC_DEFINE([HAVE_SSL_H], [], [Have libssl])
AC_SUBST([SSL_LIB])
AC_SUBST([CRYPTO_LIB])
fi
CHECK_ZLIB
AC_SUBST(CXXFLAGS)
AC_SUBST(LDFLAGS)
# Checks for header files.
AC_HEADER_STDBOOL
AC_HEADER_TIME
AC_FUNC_ALLOCA
AC_HEADER_DIRENT
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS([arpa/inet.h fcntl.h float.h langinfo.h libintl.h limits.h locale.h malloc.h netdb.h netinet/in.h stddef.h stdlib.h string.h strings.h sys/file.h sys/ioctl.h sys/socket.h sys/time.h sys/timeb.h syslog.h unistd.h wchar.h wctype.h])
#AC_CHECK_HEADERS([zlib.h sys/wait.h wait.h alloca.h])
AC_CHECK_HEADERS([sys/wait.h wait.h alloca.h])
#AC_CHECK_HEADERS(ssl.h)
# Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_STAT
AC_HEADER_STDBOOL
AC_C_CONST
AC_C_INLINE
AC_TYPE_OFF_T
AC_TYPE_SIZE_T
AC_CHECK_MEMBERS([struct stat.st_blksize])
AC_HEADER_TIME
AC_STRUCT_TM
AC_CHECK_SIZEOF(unsigned long long int, 8)
AC_CHECK_SIZEOF(unsigned long int, 4)
AC_CHECK_SIZEOF(unsigned int, 4)
AC_CHECK_SIZEOF(unsigned short int, 2)
AC_CHECK_SIZEOF(unsigned char, 1)
# Checks for library functions.
AC_FUNC_CLOSEDIR_VOID
#AC_FUNC_ERROR_AT_LINE
#AC_FUNC_LSTAT
#AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK
AC_FUNC_MALLOC
AC_FUNC_MBRTOWC
AC_FUNC_MEMCMP
AC_FUNC_MMAP
AC_FUNC_REALLOC
AC_FUNC_SELECT_ARGTYPES
AC_TYPE_SIGNAL
#AC_FUNC_STAT
AC_FUNC_STRFTIME
AC_FUNC_STRPTIME
AC_FUNC_VPRINTF
AC_CHECK_FUNCS([alarm btowc bzero ftime getcwd gettimeofday localtime_r memcmp memcpy memmove memset mkstemp munmap pstat_getdynamic raise re_comp regcomp rresvport select setlocale strchr strcspn strdup strerror strrchr strstr strtol strtoul timegm])
AC_REPLACE_FUNCS(snprintf vsnprintf)
# More header checks--here use C++
AC_LANG([C++])
AC_CXX_HAVE_STD
# Initialize gettext for translations
AM_GNU_GETTEXT([external], [need-formatstring-macros])
AM_GNU_GETTEXT_VERSION([0.19.4])
AC_MSG_CHECKING(whether we need gethostname() prototype?)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <unistd.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <sys/ioctl.h>
#include <sys/uio.h>
#include <sys/file.h>
#include <fcntl.h>
#include <netdb.h>
#include <stdlib.h>
extern "C" int gethostname(char *, int);
]],[[
gethostname("sdsu.edu", (int) 8);
]])],[AC_MSG_RESULT(yes);AC_DEFINE([NEED_PROTO_GETHOSTNAME],,[Define if you need a prototype for gethostname()])],[AC_MSG_RESULT(no)])
# We're still using the C++ compiler for this test
AC_MSG_CHECKING(how to call getpeername?)
for sock_t in 'struct sockaddr' 'void'; do
for getpeername_length_t in 'size_t' 'int' 'unsigned int' 'long unsigned int' 'socklen_t'
do
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
#include <sys/socket.h>
extern "C" int getpeername(int, $sock_t *, $getpeername_length_t *);
$sock_t s; $getpeername_length_t l; ]], [[ getpeername(0, &s, &l); ]])],[ac_found=yes ; break 2],[ac_found=no])
done
done
if test "$ac_found" = no
then
AC_MSG_WARN([can't determine, using size_t])
getpeername_length_t="size_t"
else
AC_MSG_RESULT($getpeername_length_t)
fi
AC_DEFINE_UNQUOTED([GETPEERNAME_LENGTH_T],[$getpeername_length_t],[Define this to the type of the third argument of getpeername()])
AC_MSG_CHECKING(how to call select?)
for fd_set_t in 'fd_set' 'int'
do
for timeval_t in 'struct timeval' 'const struct timeval'
do
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/time.h>
#include <sys/types.h>
#include <unistd.h>
extern "C" int select(int, $fd_set_t *, $fd_set_t *, $fd_set_t *, $timeval_t *);
$fd_set_t fd; ]], [[ select(0, &fd, 0, 0, 0); ]])],[ac_found=yes ; break 2],[ac_found=no])
done
done
if test "$ac_found" = no
then
AC_MSG_WARN([can't determine argument type using int])
fd_set_t="int"
else
AC_MSG_RESULT($fd_set_t)
fi
AC_DEFINE_UNQUOTED([FD_SET_T],[$fd_set_t],[Define this to the type of the second argument of select()])
# Replacements for the library functions (i.e. regex)
# Regex is compiled by the C compiler so we need to do it before we switch
if test $WITH_RX = yes; then
AC_CHECK_HEADER(rxposix.h, AC_DEFINE(USE_RX,,[Use posix regexp]), WITH_RX='no')
fi
if test $WITH_RX = no; then
AC_MSG_CHECKING(if we should use the included regex?)
OLD_CFLAGS=$CFLAGS
CFLAGS="$CFLAGS -I${srcdir}/hllib"
AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include "${srcdir}/hllib/regex.c"
int main() {
regex_t re;
return regcomp(&re, "ht.*Dig", REG_ICASE);
}
]])],
[AC_MSG_RESULT(yes);AC_LIBOBJ([regex])],
[AC_MSG_RESULT(no);AC_DEFINE(HAVE_BROKEN_REGEX,,[Broken regexp])],
[AC_MSG_RESULT(unknown);AC_DEFINE(HAVE_BROKEN_REGEX,,[Unknown regexp])])
CFLAGS=$OLD_CFLAGS
fi
AC_SYS_LARGEFILE
# Add the -mimpure-text option on Solaris with GCC and libstc++ that is not shared
if test "$GXX" = "yes"
then
case "$host" in
*-sun-solaris* ) extra_ldflags="-mimpure-text";;
esac
fi
AC_SUBST(extra_ldflags)
# Define to the syslog level for hlsearch logging
AC_DEFINE([LOG_LEVEL],[LOG_INFO],[Define to the syslog level for hlsearch logging])
# Define to the syslog facility for hlsearch logging
AC_DEFINE([LOG_FACILITY],[LOG_LOCAL5],[Define to the syslog facility for hlsearch logging])
# Any remaining tests probably want the C compiler
AC_LANG_C
if test ! -d "./db"; then
mkdir db
fi
if test x$hldig_cv_tests = xyes
then
CHECK_USER
AC_PROG_APACHE(1.3.1)
fi
echo configuring hl://Dig version $VERSION
AC_CONFIG_SUBDIRS(db)
### HACK: copied from autoconf output, to ensure the expansion below works
test "x$prefix" = xNONE && prefix=$ac_default_prefix
# Let make expand exec_prefix.
test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
# expand variables which appear in attrs.html and the man pages
while echo $bindir | grep '\$' >/dev/null ; do
eval "bindir=$bindir"
done
while echo $COMMON_DIR | grep '\$' >/dev/null ; do
eval "COMMON_DIR=$COMMON_DIR"
done
while echo $CONFIG_DIR | grep '\$' >/dev/null ; do
eval "CONFIG_DIR=$CONFIG_DIR"
done
while echo $DEFAULT_CONFIG_FILE | grep '\$' >/dev/null ; do
eval "DEFAULT_CONFIG_FILE=$DEFAULT_CONFIG_FILE"
done
while echo $DATABASE_DIR | grep '\$' >/dev/null ; do
eval "DATABASE_DIR=$DATABASE_DIR"
done
while echo $IMAGE_URL_PREFIX | grep '\$' >/dev/null ; do
eval "IMAGE_URL_PREFIX=$IMAGE_URL_PREFIX"
done
while echo $VERSION | grep '\$' >/dev/null ; do
eval "VERSION=$VERSION"
done
AC_CONFIG_FILES([Makefile
hlcommon/Makefile
hldb/Makefile
hldig/Makefile
installdir/hldig.1
installdir/hldig-pdfparser.1
installdir/hlfuzzy.1
installdir/hlmerge.1
installdir/hlpurge.1
installdir/hlstat.1
installdir/hldigconfig.8
installdir/hldump.1
installdir/hlload.1
installdir/hlnotify.1
installdir/hlsearch.1
installdir/rundig.1
hlfuzzy/Makefile
hllib/Makefile
hlnet/Makefile
hlsearch/Makefile
hltools/Makefile
hlword/Makefile
include/Makefile
installdir/Makefile
test/Makefile
po/Makefile.in
test/test_functions])
AC_OUTPUT
echo ""
echo ""
echo "Now you must run 'make' followed by 'make install'"
echo ""