-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathconfigure.ac
431 lines (328 loc) · 13.7 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
AC_INIT(prelude-manager, 5.2.0)
AC_PREREQ(2.59)
AC_CANONICAL_TARGET([])
AM_INIT_AUTOMAKE([-Wall tar-pax 1.9])
AC_CONFIG_MACRO_DIR([m4])
AM_CONFIG_HEADER(config.h)
AM_DISABLE_STATIC
AM_MAINTAINER_MODE
dnl **********************************************************
dnl * Check required program.
dnl **********************************************************
AC_PROG_CPP
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_MAKE_SET
dnl **********************************************************
dnl * Setup GnuLib, libtool and libltdl.
dnl **********************************************************
dnl Provide replacement for system missing this GnuLib required macro.
m4_ifndef([AS_VAR_COPY], [m4_define([AS_VAR_COPY],
[AS_LITERAL_IF([$1[]$2], [$1=$$2], [eval $1=\$$2])])])
gl_EARLY
m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
AC_LIBTOOL_DLOPEN
AM_DISABLE_STATIC
AC_PROG_LIBTOOL
dnl **************************************************
dnl * Check for missing function replacement *
dnl **************************************************
gl_SOURCE_BASE(libmissing)
gl_M4_BASE(libmissing/m4)
gl_INIT
dnl **************************************************
dnl * Check for libprelude *
dnl **************************************************
AM_PATH_LIBPRELUDE(5.2.0, ,
AC_MSG_ERROR(Cannot find libprelude: Is libprelude-config in the path?), no)
dnl ***
dnl *** Can we use -Werror -Wmissing-braces for some checks ? ***
buggy_pthread_cppflags=""
AX_CHECK_COMPILE_FLAG(-Werror -Wno-missing-braces, buggy_pthread_cppflags="-Wno-missing-braces")
old_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $buggy_pthread_cppflags"
AC_MSG_CHECKING(for buggy pthread mutex initializers)
AC_TRY_COMPILE(
[
#include <pthread.h>
],
[
static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
],
compile_ok="yes", compile_ok="no")
CFLAGS="$old_CFLAGS"
if test x$compile_ok = xyes; then
AC_MSG_RESULT(no)
else
AC_MSG_RESULT(yes)
buggy_pthread_initializers="yes"
fi
dnl **************************************************
dnl * Check for GnuTLS. *
dnl **************************************************
GNUTLS_MIN_VERSION=1.0.17
PKG_CHECK_MODULES([LIBGNUTLS], [gnutls >= $GNUTLS_MIN_VERSION], [],
[AM_PATH_LIBGNUTLS($GNUTLS_MIN_VERSION, [], [AC_MSG_ERROR($LIBGNUTLS_PKG_ERRORS)])])
old_LIBS=$LIBS
old_CPPFLAGS=$CPPFLAGS
LIBS="$LIBGNUTLS_LIBS"
CPPFLAGS="$LIBGNUTLS_CFLAGS"
AC_CHECK_LIB(gnutls, gnutls_priority_init, gnutls_string_priority=yes, gnutls_string_priority=no)
if test x$gnutls_string_priority = xyes; then
AC_CHECK_LIB(gnutls, gnutls_priority_set, AC_DEFINE_UNQUOTED(HAVE_GNUTLS_STRING_PRIORITY, , Define whether GnuTLS provide priority parsing),)
fi
AC_CHECK_HEADER(gnutls/gnutls.h, ,
AC_MSG_ERROR("libgnutls development headers are required to build libprelude"))
CPPFLAGS=$old_CPPFLAGS
LIBS=$old_LIBS
dnl **************************************************
dnl * Check for GeoIP through libmaxminddb *
dnl **************************************************
LIBMAXMINDDB_MIN_VERSION=1.0.0
AC_ARG_ENABLE(libmaxminddb, AC_HELP_STRING(--enable-libmaxminddb, Define whether LibMaxMindDB is required), libmaxminddb_required="yes", enable_libmaxminddb="yes")
if test x$enable_libmaxminddb = xyes; then
PKG_CHECK_MODULES([LIBMAXMINDDB], [libmaxminddb >= $LIBMAXMINDDB_MIN_VERSION],
[AC_CHECK_HEADER(maxminddb.h, enable_libmaxminddb=yes, enable_libmaxminddb=no)],
[enable_libmaxminddb=no])
if test x$enable_libmaxminddb = xno && test x$libmaxminddb_required = xyes; then
AC_MSG_ERROR([Could not find libmaxminddb library])
fi
fi
AM_CONDITIONAL(HAVE_LIBMAXMINDDB, test x$enable_libmaxminddb = xyes)
if test x$enable_libmaxminddb = xyes; then
AC_DEFINE_UNQUOTED(HAVE_LIBMAXMINDDB, , Define whether libmaxminddb is available)
fi
dnl **************************************************
dnl * Check for libpreludedb *
dnl **************************************************
AM_PATH_LIBPRELUDEDB(5.2.0, enable_libpreludedb=yes, enable_libpreludedb=no, no)
AM_CONDITIONAL(HAVE_LIBPRELUDEDB, test x$enable_libpreludedb = xyes)
if test x$enable_libpreludedb = xyes; then
AC_DEFINE_UNQUOTED(HAVE_LIBPRELUDEDB, , Define whether libpreludedb is available)
fi
dnl ********************************************************
dnl * Check for the Libxml2 *
dnl ********************************************************
AM_PATH_XML2(, enable_xmlmod=yes, enable_xmlmod=no)
AM_CONDITIONAL(HAVE_XML2, test x$enable_xmlmod = xyes)
dnl *****************************************************
dnl * Check for net-snmp *
dnl *****************************************************
AC_ARG_ENABLE(snmp, AC_HELP_STRING(--enable-snmp, Define whether SNMP report is available), , enable_snmp="yes")
if test x$enable_snmp = xyes; then
AM_PATH_NET_SNMP(, enable_snmp=yes, enable_snmp=no)
else
enable_snmp=no
fi
AM_CONDITIONAL(HAVE_NET_SNMP, test x$enable_snmp = xyes)
if test x$enable_snmp = xyes; then
AC_DEFINE_UNQUOTED(HAVE_NET_SNMP, , Define whether net-snmp is available)
fi
dnl **************************************************
dnl * TCP WRAPPER CHECK *
dnl **************************************************
AC_ARG_WITH(libwrap, AC_HELP_STRING(--with-libwrap@<:@=PFX@:>@,
Compile in libwrap (tcp_wrappers) support @<:@default=auto@:>@.),
[libwrap_required=true; with_libwrap="$withval"], with_libwrap="yes")
if test x$with_libwrap != xno; then
LIBWRAP_INCLUDE="tcpd.h"
if test x$with_libwrap != xyes; then
if test -d $with_libwrap; then
LIBWRAP_PATH="$with_libwrap"
LIBWRAP_INCLUDE="$with_libwrap/include/tcpd.h"
else
with_libwrap=no
fi
fi
if test x$with_libwrap != xno; then
AC_CHECK_HEADER($LIBWRAP_INCLUDE, with_libwrap=yes, with_libwrap=no)
fi
if test x$with_libwrap = xyes; then
AC_CHECK_LIB(wrap, request_init, LIBWRAP_LIBS="-L$LIBWRAP_PATH/lib -lwrap")
AC_CHECK_LIB(nsl, yp_get_default_domain, LIBNSL_LIBS="-lnsl")
AC_MSG_CHECKING(whether -lwrap require -lnsl)
old_LIBS=$LIBS
LIBS=$LIBWRAP_LIBS
AC_TRY_LINK([extern int hosts_access; int allow_severity, deny_severity;],
[return hosts_access;], with_libwrap=yes, with_libwrap=no)
require_nsl="no"
if test x$with_libwrap = xno; then
LIBS="$LIBNSL_LIBS $LIBS"
AC_TRY_LINK([extern int hosts_access; int allow_severity, deny_severity;],
[return hosts_access;], [with_libwrap=yes require_nsl="yes"], with_libwrap=no)
fi
AC_MSG_RESULT($require_nsl)
fi
LIBWRAP_LIBS=$LIBS
LIBS=$old_LIBS
if test x$libwrap_required = xtrue && test x$with_libwrap = xno; then
AC_MSG_ERROR([Could not find libwrap library])
fi
fi
if test x$with_libwrap = xyes; then
AC_DEFINE_UNQUOTED(HAVE_TCP_WRAPPERS, [], Define if tcp wrapper support is enabled)
fi
dnl ********************************************************
dnl * Check for libev *
dnl ********************************************************
dnl Determine whether to use the embedded libev or the system libev
AC_ARG_WITH([libev],
AC_HELP_STRING([--with-libev],
[Define if we use the libev available on the system or the embedded libev]), , with_libev="embedded")
if test "x$with_libev" = "xyes"; then
dnl Use the libev available on the system
PKG_CHECK_MODULES([LIBEV], [libev])
AC_CHECK_HEADER([ev.h], ,
AC_MSG_ERROR([libev development headers are required to build prelude-manager]))
with_libev="system"
elif test "x$with_libev" = "xembedded"; then
dnl Configure and use embedded libev
AC_DEFINE_UNQUOTED(EV_USE_INOTIFY, 0, Disable unused libev inotify backend)
AC_DEFINE_UNQUOTED(EV_PERIODIC_ENABLE, 0, Disable unused libev periodic timers)
AC_DEFINE_UNQUOTED(EV_STAT_ENABLE, 0, Disable unused libev stat watchers)
AC_DEFINE_UNQUOTED(EV_IDLE_ENABLE, 0, Disable unused libev idle watchers)
AC_DEFINE_UNQUOTED(EV_FORK_ENABLE, 0, Disable unused libev fork watchers)
AC_DEFINE_UNQUOTED(EV_EMBED_ENABLE, 0, Disable unused libev embed watchers)
m4_include([libev/libev.m4])
LIBEV_CFLAGS="-I\$(top_srcdir)/libev"
LIBEV_LIBS="\$(top_builddir)/libev/libev.la"
AC_SUBST([LIBEV_CFLAGS])
AC_SUBST([LIBEV_LIBS])
else
AC_MSG_ERROR([libev development headers are required to build prelude-manager])
fi
dnl **************************************************
dnl * Check for Ipv6. *
dnl **************************************************
AC_CHECK_TYPES([struct sockaddr_in6], have_ipv6_type=yes,, [
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
])
AC_CHECK_DECL(AF_INET6, have_ipv6_def=yes,, [
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
])
if test x$have_ipv6_type = xyes && test x$have_ipv6_def = xyes; then
AC_DEFINE_UNQUOTED(HAVE_IPV6, , Define whether Ipv6 is available on this system)
fi
dnl **************************************************
dnl * Typedefs, structures, compiler characteristics.*
dnl **************************************************
AC_C_CONST
AC_TYPE_UID_T
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_HEADER_TIME
AC_TYPE_SIGNAL
AC_C_INLINE
AC_C_BIGENDIAN
AC_SYS_LARGEFILE
dnl **************************************************
dnl * Setup custom compiler flags *
dnl **************************************************
AC_MSG_CHECKING(for platform-specific compiler flags)
case "$host_os" in
darwin*)
# It may be called "cc", but it's really a GCC derivative
# with a problematic special precompiler and precompiled
# headers; turn off the special precompiler, as some
# apparently-legal code won't compile with its precompiled
# headers.
AC_MSG_RESULT(Darwin: adding -no-cpp-precomp)
AX_CHECK_COMPILE_FLAG(-no-cpp-precomp, GLOBAL_CFLAGS="$GLOBAL_CFLAGS -no-cpp-precomp")
;;
*)
AC_MSG_RESULT(none needed)
;;
esac
AX_CHECK_LINK_FLAG(-z relro, LDFLAGS="$LDFLAGS -z relro")
AX_CHECK_LINK_FLAG(-z now, LDFLAGS="$LDFLAGS -z now")
for i in -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations \
-Wbad-function-cast -Wcast-qual -Wcast-align -Wnested-externs -Wunused \
-Wformat -Wformat-security; do
AX_CHECK_COMPILE_FLAG($i, GLOBAL_CFLAGS="$GLOBAL_CFLAGS $i")
done
if test x$buggy_pthread_initializers = xyes; then
AX_CHECK_COMPILE_FLAG(-Wno-missing-braces, GLOBAL_CFLAGS="$GLOBAL_CFLAGS -Wno-missing-braces")
fi
dnl **************************************************
dnl * Setup build variable *
dnl **************************************************
AS_AC_EXPAND(LIBDIR, $libdir)
AS_AC_EXPAND(DATADIR, $datadir)
AS_AC_EXPAND(DOCDIR, $docdir)
AS_AC_EXPAND(SYSCONFDIR, $sysconfdir)
AS_AC_EXPAND(LOCALSTATEDIR, $localstatedir)
configdir=$SYSCONFDIR/prelude-manager
prelude_manager_conf=$configdir/prelude-manager.conf
plugindir=$LIBDIR/prelude-manager
report_plugin_dir=$plugindir/reports
decode_plugin_dir=$plugindir/decodes
filter_plugin_dir=$plugindir/filters
db_plugin_dir=$plugindir/db
manager_failover_dir=$LOCALSTATEDIR/spool/prelude-manager/failover
manager_scheduler_dir=$LOCALSTATEDIR/spool/prelude-manager/scheduler
manager_run_dir=$LOCALSTATEDIR/run/prelude-manager
AC_DEFINE_UNQUOTED(REPORT_PLUGIN_DIR, "$report_plugin_dir", Prelude-Manager report plugin directory)
AC_DEFINE_UNQUOTED(DECODE_PLUGIN_DIR, "$decode_plugin_dir", Prelude-Manager decode plugin directory)
AC_DEFINE_UNQUOTED(FILTER_PLUGIN_DIR, "$filter_plugin_dir", Prelude-Manager filter plugin directory)
AC_DEFINE_UNQUOTED(MANAGER_SCHEDULER_DIR, "$manager_scheduler_dir", Prelude-Manager scheduler directory)
AC_DEFINE_UNQUOTED(MANAGER_FAILOVER_DIR, "$manager_failover_dir", Prelude-Manager failover directory)
AC_DEFINE_UNQUOTED(MANAGER_RUN_DIR, "$manager_run_dir", Prelude-Manager run directory)
AC_DEFINE_UNQUOTED(PRELUDE_MANAGER_CONFDIR, "$configdir", Define the Prelude Manager configuration directory)
AC_DEFINE_UNQUOTED(PRELUDE_MANAGER_CONF, "$prelude_manager_conf", Define the Prelude Manager configuration file path)
MANAGER_DATA_DIR=$DATADIR/prelude-manager
AC_SUBST(MANAGER_DATA_DIR)
AC_SUBST(configdir)
AC_SUBST(localstatedir)
AC_SUBST(manager_run_dir)
AC_SUBST(manager_scheduler_dir)
AC_SUBST(manager_failover_dir)
AC_SUBST(LIBWRAP_LIBS)
AC_SUBST(CFLAGS)
AC_SUBST(CPPFLAGS)
AC_SUBST(LDFLAGS)
AC_SUBST(GLOBAL_CFLAGS)
AC_SUBST(PRELUDE_MANAGER_CFLAGS)
AC_CONFIG_FILES([
Makefile
docs/Makefile
docs/manpages/Makefile
libmissing/Makefile
libmissing/tests/Makefile
m4/Makefile
prelude-manager.conf
src/Makefile
src/include/Makefile
plugins/Makefile
plugins/decodes/Makefile
plugins/decodes/normalize/Makefile
plugins/filters/Makefile
plugins/filters/idmef-criteria/Makefile
plugins/filters/thresholding/Makefile
plugins/reports/Makefile
plugins/reports/db/Makefile
plugins/reports/debug/Makefile
plugins/reports/relaying/Makefile
plugins/reports/script/Makefile
plugins/reports/smtp/Makefile
plugins/reports/snmp/Makefile
plugins/reports/textmod/Makefile
plugins/reports/xmlmod/Makefile
])
if test "x$with_libev" = "xembedded"; then
AC_CONFIG_FILES([
libev/Makefile
])
fi
AC_OUTPUT
echo
echo "*** Dumping configuration ***"
echo " - TCP wrapper support : $with_libwrap";
echo " - XML plugin support : $enable_xmlmod";
echo " - GeoIP support : $enable_libmaxminddb";
echo " - Database plugin support: $enable_libpreludedb";
echo " - SNMP plugin support : $enable_snmp";
echo " - Used libev : $with_libev";