This repository has been archived by the owner on Apr 21, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
472 lines (441 loc) · 12.6 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
AC_INIT([moloch], [2.3.0-GIT])
AM_INIT_AUTOMAKE([-Wall -Werror foreign])
AC_PROG_CC
AC_PROG_CXX
AC_CHECK_TOOL([GIT],[git],[:])
AC_CONFIG_HEADERS([capture/molochconfig.h])
AC_PREFIX_DEFAULT(["/data/moloch"])
AC_CHECK_HEADERS([sys/inotify.h])
AC_CONFIG_FILES([
Makefile
capture/Makefile
capture/plugins/Makefile
capture/plugins/daq/Makefile
capture/plugins/pfring/Makefile
capture/plugins/snf/Makefile
capture/plugins/lua/Makefile
capture/parsers/Makefile
db/Makefile
tests/plugins/Makefile
viewer/Makefile
viewer/version.js
parliament/Makefile
release/Makefile
wiseService/Makefile
])
AC_CHECK_LIB(pcre, main,,AC_MSG_ERROR(please install PCRE library))
AC_CHECK_LIB(uuid, main,,AC_MSG_ERROR(please install uuid library))
AC_CHECK_LIB(rt, main,,)
AC_CHECK_LIB(net, main,,)
AC_CHECK_LIB(dl, main,DL_LIB=-ldl,)
AC_SUBST(DL_LIB)
AC_CHECK_LIB(resolv, main,RESOLV_LIB=-lresolv,)
AC_SUBST(RESOLV_LIB)
dnl OS Stuff
AC_CANONICAL_HOST
case $host_os in
darwin*)
SHARED_FLAGS="--shared -undefined suppress -flat_namespace"
UNDEFINED_FLAGS="-u _g_checksum_update -u _g_hmac_update -ljansson"
;;
*)
SHARED_FLAGS="--shared"
UNDEFINED_FLAGS="-u g_checksum_update -u g_hmac_update -u g_uri_unescape_segment"
esac
AC_SUBST(SHARED_FLAGS)
AC_SUBST(UNDEFINED_FLAGS)
dnl Checks for pfring
AC_MSG_CHECKING(for pfring)
AC_ARG_WITH(pfring,
[ --with-pfring=DIR use pfring build directory],
[ case "$withval" in
no)
AC_MSG_RESULT(no)
;;
*)
if test "x$withval" = xyes; then
withval=/usr/local
fi
AC_MSG_RESULT($withval)
if test -f $withval/userland/libpcap/pcap.h -a -f $withval/userland/libpcap/libpcap.a; then
owd=`pwd`
if cd $withval; then
withval=`pwd`;
cd $owd;
fi
PCAP_CFLAGS="-I$withval/userland/libpcap"
PCAP_LIBS="$withval/userland/libpcap/libpcap.a $withval/userland/lib/libpfring.a -lnuma"
elif test -f $withval/userland/libpcap/include/pcap.h -a -f $withval/userland/libpcap/lib/libpcap.a; then
owd=`pwd`
if cd $withval; then
withval=`pwd`;
cd $owd;
fi
PCAP_CFLAGS="-I$withval/userland/libpcap/include"
PCAP_LIBS="$withval/userland/libpcap/lib/libpcap.a $withval/userland/lib/libpfring.a -lnuma"
elif test -f $withval/pfring/include/pcap.h -a -f $withval/pfring/lib/libpcap.a; then
owd=`pwd`
if cd $withval; then
withval=`pwd`;
cd $owd;
fi
PCAP_CFLAGS="-I$withval/pfring/include"
PCAP_LIBS="$withval/pfring/lib/libpcap.a $withval/pfring/lib/libpfring.a -lnuma"
else
AC_ERROR(pcap.h or libpcap.a not found in $withval)
fi
;;
esac ], [
AC_MSG_RESULT(no) ])
dnl Checks for libpcap
AC_MSG_CHECKING(for libpcap)
AC_ARG_WITH(libpcap,
[ --with-libpcap=DIR use libpcap build directory],
[ case "$withval" in
yes|no)
AC_MSG_RESULT(no)
;;
*)
AC_MSG_RESULT($withval)
if test -f $withval/pcap.h -a -f $withval/libpcap.a; then
owd=`pwd`
if cd $withval; then
withval=`pwd`;
cd $owd;
fi
PCAP_CFLAGS="-I$withval"
PCAP_LIBS="$withval/libpcap.a "
if test -x $withval/pcap-config; then
PCAP_LIBS+=`$withval/pcap-config --static --additional-libs`;
fi
elif test -f $withval/include/pcap.h -a -f $withval/lib/libpcap.a; then
owd=`pwd`
if cd $withval; then
withval=`pwd`;
cd $owd;
fi
PCAP_CFLAGS="-I$withval/include"
PCAP_LIBS="$withval/lib/libpcap.a "
if test -x $withval/pcap-config; then
PCAP_LIBS+=`$withval/pcap-config --static --additional-libs`;
fi
else
AC_ERROR(pcap.h or libpcap.a not found in $withval)
fi
;;
esac ], [
if test "x$PCAP_LIBS" != "x"; then
BLAHBLAH=1
elif test -f ${prefix}/include/pcap.h; then
PCAP_CFLAGS="-I${prefix}/include"
PCAP_LIBS="-L${exec_prefix}/lib -lpcap"
elif test -f /usr/include/pcap/pcap.h; then
PCAP_CFLAGS="-I/usr/include/pcap"
PCAP_LIBS="-lpcap"
else
TMP=$LIBS
LIBS="-lpcap $LIBS"
AC_TRY_LINK([#include <pcap.h>], pcap_open_offline("",""), LIBPCAP_FOUND=1,LIBPCAP_FOUND=0)
LIBS=$TMP
if test $LIBPCAP_FOUND = 1 ; then
PCAP_LIBS="-lpcap"
else
AC_ERROR(libpcap not found)
fi
fi
AC_MSG_RESULT(yes) ])
# Do we have libnl?
# Modfied version of whats in libpcap configure.ac. Thank you libpcap!
#
AC_ARG_WITH(libnl,
AC_HELP_STRING([--without-libnl],[disable libnl support @<:@default=yes, on Linux, if present@:>@]),
with_libnl=$withval,,)
if test x$with_libnl != xno ; then
have_any_nl="no"
#
# Try libnl 3.x first.
#
AC_CHECK_LIB(nl-3, nl_socket_alloc,
[
#
# Yes, we have libnl 3.x.
#
PCAP_LIBS="$PCAP_LIBS -lnl-genl-3 -lnl-3"
have_any_nl="yes"
])
if test x$have_any_nl = xno ; then
#
# Try libnl 2.x
#
AC_CHECK_LIB(nl, nl_socket_alloc,
[
#
# Yes, we have libnl 2.x.
#
PCAP_LIBS="$PCAP_LIBS -lnl-genl -lnl"
have_any_nl="yes"
])
fi
if test x$have_any_nl = xno ; then
#
# No, we don't; do we have libnl 1.x?
#
AC_CHECK_LIB(nl, nl_handle_alloc,
[
#
# Yes.
#
PCAP_LIBS="$PCAP_LIBS -lnl"
have_any_nl="yes"
])
fi
if test x$have_any_nl = xno ; then
#
# No, we don't have libnl at all.
#
if test x$with_libnl = xyes ; then
AC_MSG_ERROR([libnl support requested but libnl not found])
fi
fi
fi
AC_SUBST(PCAP_CFLAGS)
AC_SUBST(PCAP_LIBS)
dnl Checks for yara
AC_MSG_CHECKING(for yara)
AC_ARG_WITH(yara,
[ --with-yara=DIR use yara build directory],
[ case "$withval" in
yes|no)
AC_MSG_RESULT(no)
;;
*)
AC_MSG_RESULT($withval)
if test -f $withval/libyara/yara.h -a -f $withval/libyara/.libs/libyara.a; then
owd=`pwd`
if cd $withval; then
withval=`pwd`;
cd $owd;
fi
YARA_CFLAGS="-I$withval/libyara"
YARA_LIBS="$withval/libyara/.libs/libyara.a"
elif test -f $withval/libyara/include/yara.h -a -f $withval/libyara/.libs/libyara.a; then
owd=`pwd`
if cd $withval; then
withval=`pwd`;
cd $owd;
fi
YARA_CFLAGS="-I$withval/libyara/include"
YARA_LIBS="$withval/libyara/.libs/libyara.a"
elif test -f $withval/include/yara.h -a -f $withval/lib/libyara.a; then
owd=`pwd`
if cd $withval; then
withval=`pwd`;
cd $owd;
fi
YARA_CFLAGS="-I$withval/include"
YARA_LIBS="$withval/lib/libyara.a"
else
AC_ERROR(yara.h or yara.a not found in $withval)
fi
;;
esac ], [
if test -f ${prefix}/include/libyara/yara.h; then
YARA_CFLAGS="-I${prefix}/include/libyara"
YARA_LIBS="-L${exec_prefix}/lib -lyara"
elif test -f /usr/include/libyara/yara.h; then
YARA_CFLAGS=""
YARA_LIBS="-lyara"
else
TMP=$LIBS
LIBS="-lyara $LIBS"
AC_TRY_LINK([#include <yara.h>], yr_init(), LIBYARA_FOUND=1,LIBYARA_FOUND=0)
LIBS=$TMP
if test $LIBYARA_FOUND = 1 ; then
YARA_LIBS="-lyara"
else
AC_ERROR(yara not found)
fi
fi
AC_MSG_RESULT(yes) ])
AC_SUBST(YARA_CFLAGS)
AC_SUBST(YARA_LIBS)
dnl Checks for maxminddb
AC_MSG_CHECKING(for maxminddb)
AC_ARG_WITH(maxminddb,
[ --with-maxminddb=DIR use maxminddb build directory],
[ case "$withval" in
yes|no)
AC_MSG_RESULT(no)
;;
*)
AC_MSG_RESULT($withval)
if test -f $withval/include/maxminddb.h -a -f $withval/src/.libs/libmaxminddb.a; then
owd=`pwd`
if cd $withval; then
withval=`pwd`;
cd $owd;
fi
MAXMINDDB_CFLAGS="-I$withval/include"
MAXMINDDB_LIBS="$withval/src/.libs/libmaxminddb.a"
elif test -f $withval/include/maxminddb.h -a -f $withval/lib/libmaxminddb.a; then
owd=`pwd`
if cd $withval; then
withval=`pwd`;
cd $owd;
fi
MAXMINDDB_CFLAGS="-I$withval/include"
MAXMINDDB_LIBS="$withval/lib/libmaxminddb.a"
else
AC_ERROR(maxminddb.h or libmaxminddb.a not found in $withval)
fi
;;
esac ], [
if test -f ${prefix}/include/maxminddb.h; then
MAXMINDDB_CFLAGS="-I${prefix}/include"
MAXMINDDB_LIBS="-L${exec_prefix}/lib -lmaxminddb"
elif test -f /usr/include/maxminddb.h; then
MAXMINDDB_CFLAGS=""
MAXMINDDB_LIBS="-lmaxminddb"
else
TMP=$LIBS
LIBS="-lmaxminddb $LIBS"
AC_TRY_LINK([#include <maxminddb.h>], MMDB_open(NULL, MMDB_MODE_MMAP, NULL), LIBMAXMINDDB_FOUND=1,LIBMAXMINDDB_FOUND=0)
LIBS=$TMP
if test $LIBMAXMINDDB_FOUND = 1 ; then
MAXMINDDB_LIBS="-lmaxminddb"
else
AC_ERROR(maxminddb not found)
fi
fi
AC_MSG_RESULT(yes) ])
AC_SUBST(MAXMINDDB_CFLAGS)
AC_SUBST(MAXMINDDB_LIBS)
dnl Checks for glib2, these are wrong
AC_MSG_CHECKING(for glib2)
AC_ARG_WITH(glib2,
[ --with-glib2=DIR use glib2 build directory],
[ case "$withval" in
yes|no)
AC_MSG_RESULT(no)
;;
*)
AC_MSG_RESULT($withval)
if test -f $withval/glib/glib.h -a -f $withval/glib/.libs/libglib-2.0.a; then
owd=`pwd`
if cd $withval; then
withval=`pwd`;
cd $owd;
fi
GLIB2_CFLAGS="-I$withval/glib -I$withval -I$withval/gmodule -I$withval/gobject"
GLIB2_LIBS="$withval/glib/.libs/libglib-2.0.a $withval/gio/.libs/libgio-2.0.a $withval/gobject/.libs/libgobject-2.0.a $withval/gthread/.libs/libgthread-2.0.a $withval/gmodule/.libs/libgmodule-2.0.a $withval/glib/.libs/libglib-2.0.a"
else
AC_ERROR(glib.h or libglib-2.0.a not found in $withval)
fi
;;
esac ], [
GLIB2_CFLAGS=`pkg-config gio-2.0 gobject-2.0 gthread-2.0 glib-2.0 gmodule-2.0 --cflags`
GLIB2_LIBS=`pkg-config gio-2.0 gobject-2.0 gthread-2.0 glib-2.0 gmodule-2.0 --libs`
AC_MSG_RESULT(yes) ])
AC_SUBST(GLIB2_CFLAGS)
AC_SUBST(GLIB2_LIBS)
dnl Checks for curl
AC_MSG_CHECKING(for curl)
AC_ARG_WITH(curl,
[ --with-curl=DIR use curl build directory],
[ case "$withval" in
yes)
AC_CHECK_LIB(curl, main,,AC_MSG_ERROR(please install curl library))
;;
no)
AC_MSG_RESULT(no)
;;
*)
AC_MSG_RESULT($withval)
if test -f $withval/include/curl/curl.h -a -f $withval/lib/.libs/libcurl.a; then
owd=`pwd`
if cd $withval; then
withval=`pwd`;
cd $owd;
fi
CURL_CFLAGS="-I$withval/include"
CURL_LIBS="$withval/lib/.libs/libcurl.a"
elif test -f $withval/include/curl/curl.h -a -f $withval/lib/libcurl.a; then
owd=`pwd`
if cd $withval; then
withval=`pwd`;
cd $owd;
fi
CURL_CFLAGS="-I$withval/include"
CURL_LIBS="$withval/lib/libcurl.a"
else
AC_ERROR(curl.h or libcurl.a not found in $withval)
fi
;;
esac ], [
CURL_CFLAGS=`pkg-config libcurl --cflags`
CURL_LIBS=`pkg-config libcurl --libs`
AC_MSG_RESULT(yes) ])
AC_SUBST(CURL_CFLAGS)
AC_SUBST(CURL_LIBS)
dnl Checks for lua
AC_MSG_CHECKING(for lua)
AC_ARG_WITH(lua,
[ --with-lua=DIR use lua build directory],
[ case "$withval" in
yes)
AC_CHECK_LIB(lua, main,,AC_MSG_ERROR(please install lua library))
;;
no)
AC_MSG_RESULT(no)
;;
*)
AC_MSG_RESULT($withval)
if test -f $withval/src/lauxlib.h -a -f $withval/src/lua.h; then
owd=`pwd`
if cd $withval; then
withval=`pwd`;
cd $owd;
fi
LUA_CFLAGS="-I$withval/src"
LUA_LIBS="$withval/src/liblua.a"
else
AC_ERROR(lua.h or liblua.a not found in $withval)
fi
;;
esac ], [
LUA_CFLAGS=
LUA_LIBS=-llua
AC_MSG_RESULT(yes) ])
AC_SUBST(LUA_CFLAGS)
AC_SUBST(LUA_LIBS)
dnl Checks for libfile/magic
AC_MSG_CHECKING(for magic)
AC_ARG_WITH(magic,
[ --with-magic=DIR use magic build directory],
[ case "$withval" in
yes)
AC_CHECK_LIB(magic, main,MAGIC_LIBS=-lmagic,AC_MSG_ERROR(please install magic library))
;;
no)
AC_MSG_RESULT(no)
;;
*)
AC_MSG_RESULT($withval)
if test -f $withval/src/magic.h -a -f $withval/src/.libs/libmagic.a; then
owd=`pwd`
if cd $withval; then
withval=`pwd`;
cd $owd;
fi
MAGIC_CFLAGS="-I$withval/src"
MAGIC_LIBS="$withval/src/.libs/libmagic.a"
else
AC_ERROR(magic.h or libmagic.a not found in $withval)
fi
;;
esac ], [
AC_CHECK_LIB(magic, main,MAGIC_LIBS=-lmagic,AC_MSG_ERROR(please install magic library))
AC_MSG_RESULT(yes) ])
AC_SUBST(MAGIC_CFLAGS)
AC_SUBST(MAGIC_LIBS)
AC_OUTPUT