forked from arkime/arkime
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
590 lines (554 loc) · 16.2 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
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
AC_INIT([arkime], [5.0.0-rc1])
AM_INIT_AUTOMAKE([-Wall -Werror foreign])
AC_PROG_CC
AC_PROG_CXX
AC_CHECK_TOOL([GIT],[git],[:])
AC_CONFIG_HEADERS([capture/arkimeconfig.h])
AC_PREFIX_DEFAULT(["/opt/arkime"])
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/plugins/kafka/Makefile
capture/parsers/Makefile
db/Makefile
tests/plugins/Makefile
viewer/Makefile
common/version.js
parliament/Makefile
release/Makefile
wiseService/Makefile
cont3xt/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 -u nghttp2_hd_inflate_hd2"
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/libyara/include/yara.h -a -f $withval/.libs/libyara.a; then
owd=`pwd`
if cd $withval; then
withval=`pwd`;
cd $owd;
fi
YARA_CFLAGS="-I$withval/libyara/include"
YARA_LIBS="$withval/.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_initialize(), 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"
elif test -f $withval/glib/glib.h -a -f $withval/_build/glib/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 -I$withval/_build/glib -I$withval/_build"
GLIB2_LIBS="$withval/_build/glib/libglib-2.0.a $withval/_build/gio/libgio-2.0.a $withval/_build/gobject/libgobject-2.0.a $withval/_build/gthread/libgthread-2.0.a $withval/_build/gmodule/libgmodule-2.0.a $withval/_build/glib/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)
dnl Checks for nghttp2
AC_MSG_CHECKING(for nghttp2)
AC_ARG_WITH(nghttp2,
[ --with-nghttp2=DIR use nghttp2 build directory],
[ case "$withval" in
yes)
AC_CHECK_LIB(nghttp2,main,NGHTTP2_LIBS=-lnghttp2,AC_MSG_ERROR(please install nghttp2 library))
;;
no)
AC_MSG_RESULT(no)
;;
*)
AC_MSG_RESULT($withval)
if test -f $withval/lib/includes/nghttp2/nghttp2.h -a -f $withval/lib/.libs/libnghttp2.a; then
owd=`pwd`
if cd $withval; then
withval=`pwd`;
cd $owd;
fi
NGHTTP2_CFLAGS="-I$withval/lib/includes"
NGHTTP2_LIBS="$withval/lib/.libs/libnghttp2.a"
else
AC_ERROR(nghttp2.h or libnghttp2.a not found in $withval)
fi
;;
esac ], [
AC_CHECK_LIB(nghttp2, main,NGHTTP2_LIBS=-lnghttp2,AC_MSG_ERROR(please install nghttp2 library))
AC_MSG_RESULT(yes) ])
AC_SUBST(NGHTTP2_CFLAGS)
AC_SUBST(NGHTTP2_LIBS)
dnl Checks for zstd
AC_MSG_CHECKING(for zstd)
AC_ARG_WITH(zstd,
[ --with-zstd=DIR use zstd build directory],
[ case "$withval" in
yes)
AC_CHECK_LIB(zstd, main, AC_DEFINE([HAVE_ZSTD], [1], [Define if libzstd is available]) ZSTD_LIBS=-lzstd, AC_MSG_ERROR(please install zstd library))
;;
no)
AC_MSG_RESULT(no)
;;
*)
AC_MSG_RESULT($withval)
if test -f $withval/lib/zstd.h -a -f $withval/lib/libzstd.a; then
owd=`pwd`
if cd $withval; then
withval=`pwd`;
cd $owd;
fi
ZSTD_CFLAGS="-I$withval/lib"
ZSTD_LIBS="$withval/lib/libzstd.a"
AC_DEFINE([HAVE_ZSTD], [1], [Define if libzstd is available])
else
AC_ERROR(zstd.h or libzstd.a not found in $withval)
fi
;;
esac ], [
AC_DEFINE([HAVE_ZSTD], [1], [Define if libzstd is available])
ZSTD_CFLAGS=`pkg-config libzstd --cflags`
ZSTD_LIBS=`pkg-config libzstd --libs`
AC_MSG_RESULT(yes) ])
AC_SUBST(ZSTD_CFLAGS)
AC_SUBST(ZSTD_LIBS)
dnl Checks for kafka
AC_MSG_CHECKING(for kafka)
AC_ARG_WITH(kafka,
[ --with-kafka=DIR use kafka (librdkafka) build directory],
[ case "$withval" in
no)
AC_MSG_RESULT(no)
;;
*)
if test "x$withval" = xyes; then
withval=/usr/local/include/librdkafka/
fi
AC_MSG_RESULT($withval)
if test -f $withval/src/rdkafka.h -a -f $withval/src/librdkafka.a; then
KAFKA_CFLAGS="-I$withval/src"
KAFKA_LIBS=$withval/src/librdkafka.a
elif test -f $withval/rdkafka.h; then
KAFKA_CFLAGS="-I$withval"
KAFKA_LIBS="-lrdkafka"
else
AC_ERROR(rdkafka.h or librdkafka.a not found in $withval)
fi
;;
esac ], [
KAFKA_CFLAGS=
KAFKA_LIBS=
AC_MSG_RESULT(no) ])
AC_SUBST(KAFKA_CFLAGS)
AC_SUBST(KAFKA_LIBS)
AS_IF([test "$prefix" == "NONE"],
[AC_DEFINE_UNQUOTED(CONFIG_PREFIX,"$ac_default_prefix", [config prefix directory])],
[AC_DEFINE_UNQUOTED(CONFIG_PREFIX,"$prefix", [config prefix directory])])
AC_OUTPUT