]> git.ipfire.org Git - people/ms/suricata.git/blame - configure.ac
file_data/http: inspect cleanup
[people/ms/suricata.git] / configure.ac
CommitLineData
e60bfc78 1 AC_INIT(suricata, 4.1.0-dev)
d258a11f 2 m4_ifndef([AM_SILENT_RULES], [m4_define([AM_SILENT_RULES],[])])AM_SILENT_RULES([yes])
83014adc 3 AC_CONFIG_HEADERS([config.h])
7dbc97b0 4 AC_CONFIG_SRCDIR([src/suricata.c])
0cef0b88 5 AC_CONFIG_MACRO_DIR(m4)
7dbc97b0 6 AM_INIT_AUTOMAKE
a3510f20
WM
7
8 AC_LANG_C
ff6a2a01 9 AC_PROG_CC_C99
769022f4 10 AC_PROG_LIBTOOL
119115d3 11 PKG_PROG_PKG_CONFIG
a3510f20 12
ba81c4d2
VJ
13 dnl Taken from https://llvm.org/svn/llvm-project/llvm/trunk/autoconf/configure.ac
14 dnl check if we compile using clang or gcc. On some systems the gcc binary is
15 dnl is actually clang, so do a compile test.
16 AC_MSG_CHECKING([whether GCC or Clang is our compiler])
17 AC_LANG_PUSH([C])
18 compiler=unknown
19 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#if ! __clang__
20 #error
21 #endif
22 ]])],
23 compiler=clang,
24 [AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#if ! __GNUC__
25 #error
26 #endif
27 ]])],
28 compiler=gcc, [])])
29 AC_LANG_POP([C])
30 AC_MSG_RESULT([${compiler}])
31
32 case "$compiler" in
33 clang)
9858ae41 34 CLANG_CFLAGS="-Wextra -Werror-implicit-function-declaration -Wno-error=unused-command-line-argument"
ba81c4d2
VJ
35 AC_MSG_CHECKING([clang __sync_bool_compare_and_swap support])
36 AC_TRY_COMPILE([#include <stdio.h>],
467f28e9
VJ
37 [ unsigned int i = 0; (void)__sync_bool_compare_and_swap(&i, 1, 1);],
38 [
39 AC_DEFINE([__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1], [1], [Fake GCC atomic support])
40 AC_DEFINE([__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2], [1], [Fake GCC atomic support])
41 AC_DEFINE([__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4], [1], [Fake GCC atomic support])
42 AC_DEFINE([__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8], [1], [Fake GCC atomic support])
43 AC_MSG_RESULT([yes]) ],
44 [AC_MSG_RESULT([no])])
ba81c4d2
VJ
45 AC_SUBST(CLANG_CFLAGS)
46 ;;
47 gcc)
48 dnl get gcc version
49 AC_MSG_CHECKING([gcc version])
50 gccver=$($CC -dumpversion)
51 gccvermajor=$(echo $gccver | cut -d . -f1)
52 gccverminor=$(echo $gccver | cut -d . -f2)
53 gccvernum=$(expr $gccvermajor "*" 100 + $gccverminor)
54 AC_MSG_RESULT($gccver)
55
56 if test "$gccvernum" -ge "400"; then
1f94239d 57 dnl gcc 4.0 or later
ba81c4d2 58 GCC_CFLAGS="-Wextra -Werror-implicit-function-declaration"
ba81c4d2
VJ
59 else
60 GCC_CFLAGS="-W"
61 fi
62 AC_SUBST(GCC_CFLAGS)
63 ;;
64 *)
65 AC_MSG_WARN([unsupported/untested compiler, this may or may not work])
66 ;;
67 esac
0ffa1c24 68
89cee0ad 69 # Checks for programs.
fa5939ca
BR
70 AC_PROG_AWK
71 AC_PROG_CC
72 AC_PROG_CPP
73 AC_PROG_INSTALL
74 AC_PROG_LN_S
75 AC_PROG_MAKE_SET
91e1256b 76 AC_PROG_GREP
fa5939ca 77
9f1d779a
WM
78 AC_PATH_PROG(HAVE_PKG_CONFIG, pkg-config, "no")
79 if test "$HAVE_PKG_CONFIG" = "no"; then
89cee0ad
VJ
80 echo
81 echo " ERROR! pkg-config not found, go get it "
82 echo " http://pkg-config.freedesktop.org/wiki/ "
83 echo " or install from your distribution "
84 echo
85 exit 1
9f1d779a
WM
86 fi
87
dc1bd5b6
AH
88 AC_ARG_ENABLE(python,
89 AS_HELP_STRING([--enable-python], [Enable python]),,[enable_python=yes])
6bddc4d3 90 AC_PATH_PROGS(HAVE_PYTHON, python python2 python2.7, "no")
dc1bd5b6
AH
91 if test "x$enable_python" = "xno" ; then
92 echo
93 echo " Warning! python disabled, you will not be "
baf528e7 94 echo " able to install suricatasc unix socket client "
dc1bd5b6
AH
95 echo
96 enable_python="no"
97 fi
6bddc4d3 98 if test "$HAVE_PYTHON" = "no"; then
cd305c3a
EL
99 echo
100 echo " Warning! python not found, you will not be "
baf528e7 101 echo " able to install suricatasc unix socket client "
cd305c3a
EL
102 echo
103 enable_python="no"
cd305c3a 104 fi
dc1bd5b6 105 AM_CONDITIONAL([HAVE_PYTHON], [test "x$enable_python" = "xyes"])
cd305c3a 106
daa9dcb7
EL
107 AC_PATH_PROG(HAVE_WGET, wget, "no")
108 if test "$HAVE_WGET" = "no"; then
109 AC_PATH_PROG(HAVE_CURL, curl, "no")
110 if test "$HAVE_CURL" = "no"; then
111 echo
112 echo " Warning curl or wget not found, you won't be able to"
113 echo " download latest ruleset with 'make install-rules'"
114 fi
115 fi
116 AM_CONDITIONAL([HAVE_FETCH_COMMAND], [test "x$HAVE_WGET" != "xno" || test "x$HAVE_CURL" != "xno"])
117 AM_CONDITIONAL([HAVE_WGET_COMMAND], [test "x$HAVE_WGET" != "xno"])
7c841e1d 118
89cee0ad 119 # Checks for libraries.
7c841e1d 120
89cee0ad 121 # Checks for header files.
4086938f 122 AC_CHECK_HEADERS([stddef.h])
472e061c
VJ
123 AC_CHECK_HEADERS([arpa/inet.h assert.h ctype.h errno.h fcntl.h inttypes.h])
124 AC_CHECK_HEADERS([getopt.h])
125 AC_CHECK_HEADERS([limits.h netdb.h netinet/in.h poll.h sched.h signal.h])
2c01985e 126 AC_CHECK_HEADERS([stdarg.h stdint.h stdio.h stdlib.h stdbool.h string.h strings.h sys/ioctl.h])
472e061c 127 AC_CHECK_HEADERS([syslog.h sys/prctl.h sys/socket.h sys/stat.h sys/syscall.h])
b63c2eda 128 AC_CHECK_HEADERS([sys/time.h time.h unistd.h])
472e061c 129 AC_CHECK_HEADERS([sys/ioctl.h linux/if_ether.h linux/if_packet.h linux/filter.h])
fcc87595 130 AC_CHECK_HEADERS([linux/ethtool.h linux/sockios.h])
2a237bdf 131 AC_CHECK_HEADERS([glob.h])
bbb93e48 132 AC_CHECK_HEADERS([dirent.h fnmatch.h])
c02739e5 133 AC_CHECK_HEADERS([sys/resource.h sys/types.h sys/un.h])
9b94679f 134 AC_CHECK_HEADERS([sys/random.h])
dbdac737 135 AC_CHECK_HEADERS([utime.h])
472e061c
VJ
136
137 AC_CHECK_HEADERS([sys/socket.h net/if.h sys/mman.h linux/if_arp.h], [], [],
5656e344 138 [[#ifdef HAVE_SYS_SOCKET_H
472e061c
VJ
139 #include <sys/types.h>
140 #include <sys/socket.h>
141 #endif
5656e344
EL
142 ]])
143
d1b6be99 144 AC_CHECK_HEADERS([windows.h winsock2.h ws2tcpip.h w32api/wtypes.h], [], [],
06f9b0ad
VJ
145 [[
146 #ifndef _X86_
147 #define _X86_
148 #endif
b63c2eda 149 ]])
d1b6be99 150 AC_CHECK_HEADERS([w32api/winbase.h wincrypt.h], [], [],
06f9b0ad
VJ
151 [[
152 #ifndef _X86_
153 #define _X86_
154 #endif
155 #include <windows.h>
b63c2eda 156 ]])
fa5939ca 157
89cee0ad 158 # Checks for typedefs, structures, and compiler characteristics.
fa5939ca
BR
159 AC_C_INLINE
160 AC_TYPE_PID_T
161 AC_TYPE_SIZE_T
162 AC_TYPE_INT32_T
163 AC_TYPE_UINT16_T
164 AC_TYPE_UINT32_T
165 AC_TYPE_UINT64_T
166 AC_TYPE_UINT8_T
167 AC_HEADER_STDBOOL
168
89cee0ad 169 # Checks for library functions.
fa5939ca
BR
170 AC_FUNC_MALLOC
171 AC_FUNC_REALLOC
dd70b3fd 172 AC_CHECK_FUNCS([gettimeofday memset strcasecmp strchr strdup strerror strncasecmp strtol strtoul memchr memrchr clock_gettime])
46cb00ec 173 AC_CHECK_FUNCS([strptime])
ba81c4d2 174
9b94679f
VJ
175 AC_CHECK_DECL([getrandom],
176 AC_DEFINE([HAVE_GETRANDOM], [1], [Use getrandom]),
177 [], [
178 #include <sys/random.h>
179 ])
180
dbdac737
JI
181 AC_CHECK_FUNCS([utime])
182
ba81c4d2
VJ
183 OCFLAGS=$CFLAGS
184 CFLAGS=""
8e946b92 185 AC_CHECK_FUNCS([strlcpy strlcat])
ba81c4d2 186 CFLAGS=$OCFLAGS
fa5939ca 187
89cee0ad 188 # Add large file support
3b3f5816
WM
189 AC_SYS_LARGEFILE
190
89cee0ad 191 #check for os
769022f4
PR
192 AC_MSG_CHECKING([host os])
193
7396237c
VJ
194 # lua pkg-config name differs per OS
195 LUA_PC_NAME="lua5.1"
196 LUA_LIB_NAME="lua5.1"
197
769022f4 198 # If no host os was detected, try with uname
25804f5a 199 if test -z "$host" ; then
769022f4
PR
200 host="`uname`"
201 fi
a49bce63 202 echo -n "installation for $host OS... "
769022f4 203
48566358
VJ
204 RUST_SURICATA_LIBNAME="libsuricata.a"
205
15c98c60
AH
206 e_magic_file=""
207 e_magic_file_comment="#"
d1e839ea 208 PCAP_LIB_NAME="pcap"
769022f4 209 case "$host" in
829238e4 210 *-*-*freebsd*)
7396237c
VJ
211 LUA_PC_NAME="lua-5.1"
212 LUA_LIB_NAME="lua-5.1"
829238e4
VJ
213 CFLAGS="${CFLAGS} -DOS_FREEBSD"
214 CPPFLAGS="${CPPFLAGS} -I/usr/local/include -I/usr/local/include/libnet11"
215 LDFLAGS="${LDFLAGS} -L/usr/local/lib -L/usr/local/lib/libnet11"
48566358 216 RUST_LDADD="-lrt -lm"
829238e4 217 ;;
829238e4 218 *-*-openbsd*)
7396237c 219 LUA_PC_NAME="lua51"
ddf9b417 220 CFLAGS="${CFLAGS} -D__OpenBSD__"
829238e4
VJ
221 CPPFLAGS="${CPPFLAGS} -I/usr/local/include -I/usr/local/include/libnet-1.1"
222 LDFLAGS="${LDFLAGS} -L/usr/local/lib -I/usr/local/lib/libnet-1.1"
829238e4
VJ
223 ;;
224 *darwin*|*Darwin*)
1177d489
VJ
225 LUA_PC_NAME="lua-5.1"
226 LUA_LIB_NAME="lua-5.1"
829238e4
VJ
227 CFLAGS="${CFLAGS} -DOS_DARWIN"
228 CPPFLAGS="${CPPFLAGS} -I/opt/local/include"
229 LDFLAGS="${LDFLAGS} -L/opt/local/lib"
230 ;;
231 *-*-linux*)
56d93f42 232 RUST_LDADD="-ldl -lrt -lm"
829238e4
VJ
233 ;;
234 *-*-mingw32*)
235 CFLAGS="${CFLAGS} -DOS_WIN32"
236 LDFLAGS="${LDFLAGS} -lws2_32"
237 WINDOWS_PATH="yes"
d1e839ea 238 PCAP_LIB_NAME="wpcap"
d8ddd3b5 239 AC_DEFINE([HAVE_NON_POSIX_MKDIR], [1], [mkdir is not POSIX compliant: single arg])
48566358
VJ
240 RUST_SURICATA_LIBNAME="suricata.lib"
241 RUST_LDADD="-luserenv -lshell32 -ladvapi32 -lgcc_eh"
829238e4
VJ
242 ;;
243 *-*-cygwin)
43c5b949
VJ
244 LUA_PC_NAME="lua"
245 LUA_LIB_NAME="lua"
829238e4 246 WINDOWS_PATH="yes"
d1e839ea 247 PCAP_LIB_NAME="wpcap"
829238e4 248 ;;
7847c4f8
VJ
249 *-*-solaris*)
250 AC_MSG_WARN([support for Solaris/Illumos/SunOS is experimental])
251 LDFLAGS="${LDFLAGS} -lsocket -lnsl"
252 ;;
829238e4
VJ
253 *)
254 AC_MSG_WARN([unsupported OS this may or may not work])
255 ;;
769022f4
PR
256 esac
257 AC_MSG_RESULT(ok)
258
faad6bd3
VJ
259 # enable modifications for AFL fuzzing
260 AC_ARG_ENABLE(afl,
261 AS_HELP_STRING([--enable-afl], Enable AFL fuzzing logic[])], [enable_afl="$enableval"],[enable_afl=no])
262
263 AS_IF([test "x$enable_afl" = "xyes"], [
264 AC_DEFINE([AFLFUZZ_NO_RANDOM], [1], [Disable all use of random functions])
265 AC_DEFINE([AFLFUZZ_DISABLE_MGTTHREADS], [1], [Disable all management threads])
266 AC_DEFINE([AFLFUZZ_PCAP_RUNMODE], [1], [Enable special AFL 'single' runmode])
267 AC_DEFINE([AFLFUZZ_CONF_TEST], [1], [Enable special --afl-parse-rules commandline option])
268 AC_DEFINE([AFLFUZZ_APPLAYER], [1], [Enable --afl-$proto-request commandline option])
269 AC_DEFINE([AFLFUZZ_MIME], [1], [Enable --afl-mime commandline option])
270 AC_DEFINE([AFLFUZZ_DECODER], [1], [Enable --afl-decoder-$proto commandline option])
271 AC_DEFINE([AFLFUZZ_DER], [1], [Enable --afl-der commandline option])
1c8775b3 272 AC_DEFINE([AFLFUZZ_RULES], [1], [Enable --afl-rules commandline option])
faad6bd3
VJ
273
274 # test for AFL PERSISTANT_MODE support
275 CFLAGS_ORIG=$CFLAGS
276 CFLAGS="-Werror"
277 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[while (__AFL_LOOP(1000))]])],
278 [AC_DEFINE([AFLFUZZ_PERSISTANT_MODE], [1], [Enable AFL PERSISTANT_MODE])],
279 [])
280 CFLAGS=$CFLAGS_ORIG
281 ])
282
6fa8922c
VJ
283 # disable TLS on user request
284 AC_ARG_ENABLE(threading-tls,
2a17e3e8 285 AS_HELP_STRING([--disable-threading-tls], [Disable TLS (thread local storage)]), [enable_tls="$enableval"],[enable_tls=yes])
6fa8922c
VJ
286 AS_IF([test "x$enable_tls" = "xyes"], [
287 # check if our target supports thread local storage
288 AC_MSG_CHECKING(for thread local storage __thread support)
289 AC_TRY_COMPILE([#include <stdlib.h>],
290 [ static __thread int i; i = 1; i++; ],
291 [AC_DEFINE([TLS], [1], [Thread local storage])
292 AC_MSG_RESULT([yes]) ],
293 [AC_MSG_RESULT([no])])
294 ])
900918a5 295
89cee0ad
VJ
296 #Enable support for gcc compile time security options. There is no great way to do detection of valid cflags that I have found
297 #AX_CFLAGS_GCC_OPTION don't seem to do a better job than the code below and are a pain because of extra m4 files etc.
298 #These flags seem to be supported on CentOS 5+, Ubuntu 8.04+, and FedoreCore 11+
299 #Options are taken from https://wiki.ubuntu.com/CompilerFlags
c49785fb 300 AC_ARG_ENABLE(gccprotect,
e07e9e16 301 AS_HELP_STRING([--enable-gccprotect], [Detect and use gcc hardening options]),,[enable_gccprotect=no])
c49785fb 302
e07e9e16 303 AS_IF([test "x$enable_gccprotect" = "xyes"], [
98b9009b
WM
304 #buffer overflow protection
305 AC_MSG_CHECKING(for -fstack-protector)
306 TMPCFLAGS="${CFLAGS}"
307 CFLAGS="${CFLAGS} -fstack-protector"
ba81c4d2
VJ
308 AC_TRY_LINK(,,SECCFLAGS="-fstack-protector"
309 AC_MSG_RESULT(yes),
310 AC_MSG_RESULT(no))
98b9009b
WM
311 CFLAGS="${TMPCFLAGS}"
312
313 #compile-time best-practices errors for certain libc functions, provides checks of buffer lengths and memory regions
314 AC_MSG_CHECKING(for -D_FORTIFY_SOURCE=2)
315 TMPCFLAGS="${CFLAGS}"
316 CFLAGS="${CFLAGS} -D_FORTIFY_SOURCE=2"
317 AC_TRY_COMPILE(,,SECCFLAGS="${SECCFLAGS} -D_FORTIFY_SOURCE=2"
ba81c4d2
VJ
318 AC_MSG_RESULT(yes),
319 AC_MSG_RESULT(no))
98b9009b
WM
320 CFLAGS="${TMPCFLAGS}"
321
322 #compile-time warnings about misuse of format strings
323 AC_MSG_CHECKING(for -Wformat -Wformat-security)
324 TMPCFLAGS="${CFLAGS}"
325 CFLAGS="${CFLAGS} -Wformat -Wformat-security"
326 AC_TRY_COMPILE(,,SECCFLAGS="${SECCFLAGS} -Wformat -Wformat-security"
ba81c4d2
VJ
327 AC_MSG_RESULT(yes),
328 AC_MSG_RESULT(no))
98b9009b
WM
329 CFLAGS="${TMPCFLAGS}"
330
331 #provides a read-only relocation table area in the final ELF
332 AC_MSG_CHECKING(for -z relro)
333 TMPLDFLAGS="${LDFLAGS}"
334 LDFLAGS="${LDFLAGS} -z relro"
335 AC_TRY_LINK(,,SECLDFLAGS="${SECLDFLAGS} -z relro"
ba81c4d2
VJ
336 AC_MSG_RESULT(yes),
337 AC_MSG_RESULT(no))
98b9009b
WM
338 LDFLAGS="${TMPLDFLAGS}"
339
340 #forces all relocations to be resolved at run-time
341 AC_MSG_CHECKING(for -z now)
342 TMPLDFLAGS="${LDFLAGS}"
343 LDFLAGS="${LDFLAGS} -z now"
344 AC_TRY_LINK(,,SECLDFLAGS="${SECLDFLAGS} -z now"
ba81c4d2
VJ
345 AC_MSG_RESULT(yes),
346 AC_MSG_RESULT(no))
98b9009b
WM
347 LDFLAGS="${TMPLDFLAGS}"
348
ba81c4d2
VJ
349 AC_SUBST(SECCFLAGS)
350 AC_SUBST(SECLDFLAGS)
e07e9e16 351 ])
5bde1217 352
89cee0ad 353 #enable profile generation
5bde1217 354 AC_ARG_ENABLE(gccprofile,
e07e9e16
WM
355 AS_HELP_STRING([--enable-gccprofile], [Enable gcc profile info i.e -pg flag is set]),,[enable_gccprofile=no])
356 AS_IF([test "x$enable_gccprofile" = "xyes"], [
357 CFLAGS="${CFLAGS} -pg"
358 ])
5bde1217 359
89cee0ad 360 #enable gcc march=native gcc 4.2 or later
22f3e3d8 361 AC_ARG_ENABLE(gccmarch_native,
9f0bf35c 362 AS_HELP_STRING([--enable-gccmarch-native], [Enable gcc march=native gcc 4.2 and later only]),,[enable_gccmarch_native=yes])
e07e9e16 363 AS_IF([test "x$enable_gccmarch_native" = "xyes"], [
ffba26d0
VJ
364 case "$host" in
365 *powerpc*)
366 ;;
367 *)
37b05b23
EL
368 OFLAGS="$CFLAGS"
369 CFLAGS="$CFLAGS -march=native"
370 AC_MSG_CHECKING([checking if $CC supports -march=native])
371 AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([[#include <stdlib.h>]])],
372 [
373 AC_MSG_RESULT([yes])
ba81c4d2
VJ
374 OPTIMIZATION_CFLAGS="-march=native"
375 AC_SUBST(OPTIMIZATION_CFLAGS)
37b05b23
EL
376 ],
377 [
378 AC_MSG_RESULT([no])
379 CFLAGS="$OFLAGS"
380 enable_gccmarch_native=no
381 ]
382 )
ffba26d0
VJ
383 ;;
384 esac
e07e9e16 385 ])
22f3e3d8 386
89cee0ad
VJ
387# options
388
389 # enable the running of unit tests
390 AC_ARG_ENABLE(unittests,
391 AS_HELP_STRING([--enable-unittests], [Enable compilation of the unit tests]),,[enable_unittests=no])
392 AS_IF([test "x$enable_unittests" = "xyes"], [
ba81c4d2 393 AC_DEFINE([UNITTESTS],[1],[Enable built-in unittests])
89cee0ad 394 ])
89cee0ad
VJ
395 AM_CONDITIONAL([BUILD_UNITTESTS], [test "x$enable_unittests" = "xyes"])
396
91e1256b
EL
397 # enable the building of ebpf files
398 AC_ARG_ENABLE(ebpf-build,
399 AS_HELP_STRING([--enable-ebpf-build], [Enable compilation of ebpf files]),,[enable_ebpf_build=no])
400 AM_CONDITIONAL([BUILD_EBPF], [test "x$enable_ebpf_build" = "xyes"])
401
402 if test "x$enable_ebpf_build" = "xyes"; then
403 if echo $CC | grep clang; then
027c903f
EL
404 if test "x$CC" = "xclang"; then
405 AC_MSG_CHECKING([llc binary])
406 AC_PATH_PROG(HAVE_LLC, llc, "yes", "no")
407 if test "$HAVE_LLC" = "yes"; then
408 LLC="llc"
409 AC_SUBST(LLC)
410 else
411 AC_MSG_CHECKING([llc binary for clang version])
412 llc_version_line=$($CC --version|$GREP version)
413 llc_version=$(echo $llc_version_line| cut -d '(' -f 1 | $GREP -E -o '@<:@0-9@:>@\.@<:@0-9@:>@')
414 AC_MSG_RESULT($llc_version)
415 LLC="llc-$llc_version"
416 AC_SUBST(LLC)
417 fi
418 else
419 AC_MSG_CHECKING([llc binary for clang version])
420 llc_version_line=$($CC --version|$GREP version)
421 llc_version=$(echo $llc_version_line| cut -d '(' -f 1 | $GREP -E -o '@<:@0-9@:>@\.@<:@0-9@:>@')
422 AC_MSG_RESULT($llc_version)
423 LLC="llc-$llc_version"
424 AC_SUBST(LLC)
425 fi
91e1256b
EL
426 else
427 echo "clang needed to build ebpf files"
428 exit 1
429 fi
430 fi
431
89cee0ad
VJ
432 # enable workaround for old barnyard2 for unified alert output
433 AC_ARG_ENABLE(old-barnyard2,
434 AS_HELP_STRING([--enable-old-barnyard2], [Use workaround for old barnyard2 in unified2 output]),,[enable_old_barnyard2=no])
435 AS_IF([test "x$enable_old_barnyard2" = "xyes"], [
ba81c4d2 436 AC_DEFINE([HAVE_OLD_BARNYARD2],[1],[Use workaround for old barnyard2 in unified2 output])
89cee0ad
VJ
437 ])
438
439 # enable debug output
440 AC_ARG_ENABLE(debug,
441 AS_HELP_STRING([--enable-debug], [Enable debug output]),,[enable_debug=no])
442 AS_IF([test "x$enable_debug" = "xyes"], [
ba81c4d2 443 AC_DEFINE([DEBUG],[1],[Enable debug output])
89cee0ad 444 ])
ba81c4d2 445 AM_CONDITIONAL([DEBUG], [test "x$enable_debug" = "xyes"])
89cee0ad
VJ
446
447 # enable debug validation functions & macro's output
448 AC_ARG_ENABLE(debug-validation,
449 AS_HELP_STRING([--enable-debug-validation], [Enable (debug) validation code output]),,[enable_debug_validation=no])
450 AS_IF([test "x$enable_debug_validation" = "xyes"], [
a18af732
AH
451 if test "$enable_unittests" = "yes"; then
452 AC_MSG_ERROR([debug_validation can't be enabled with enabled unittests!])
453 else
454 AC_DEFINE([DEBUG_VALIDATION],[1],[Enable (debug) validation code output])
455 fi
89cee0ad
VJ
456 ])
457
458 # profiling support
459 AC_ARG_ENABLE(profiling,
460 AS_HELP_STRING([--enable-profiling], [Enable performance profiling]),,[enable_profiling=no])
461 AS_IF([test "x$enable_profiling" = "xyes"], [
ba81c4d2
VJ
462 case "$host" in
463 *-*-openbsd*)
464 AC_MSG_ERROR([profiling is not supported on OpenBSD])
465 ;;
466 *)
467 AC_DEFINE([PROFILING],[1],[Enable performance profiling])
468 ;;
469 esac
89cee0ad
VJ
470 ])
471
d908e707
VJ
472 # profiling support, locking
473 AC_ARG_ENABLE(profiling-locks,
474 AS_HELP_STRING([--enable-profiling-locks], [Enable performance profiling for locks]),,[enable_profiling_locks=no])
475 AS_IF([test "x$enable_profiling_locks" = "xyes"], [
ba81c4d2
VJ
476 AC_DEFINE([PROFILING],[1],[Enable performance profiling])
477 AC_DEFINE([PROFILE_LOCKING],[1],[Enable performance profiling for locks])
d908e707
VJ
478 ])
479
89cee0ad
VJ
480 # enable support for IPFW
481 AC_ARG_ENABLE(ipfw,
482 AS_HELP_STRING([--enable-ipfw], [Enable FreeBSD IPFW support for inline IDP]),,[enable_ipfw=no])
483 AS_IF([test "x$enable_ipfw" = "xyes"], [
ba81c4d2 484 AC_DEFINE([IPFW],[1],[Enable FreeBSD IPFW support for inline IDP])
89cee0ad
VJ
485 ])
486
7fb860ac 487 AC_ARG_ENABLE(coccinelle,
20dd5939 488 AS_HELP_STRING([--disable-coccinelle], [Disable coccinelle QA steps during make check]),[enable_coccinelle="$enableval"],[enable_coccinelle=yes])
7fb860ac
VJ
489 AS_IF([test "x$enable_coccinelle" = "xyes"], [
490 AC_PATH_PROG(HAVE_COCCINELLE_CONFIG, spatch, "no")
491 if test "$HAVE_COCCINELLE_CONFIG" = "no"; then
e4b39a41 492 enable_coccinelle=no
7fb860ac
VJ
493 fi
494 ])
495 AM_CONDITIONAL([HAVE_COCCINELLE], [test "x$enable_coccinelle" != "xno"])
496
f4872a2f
VJ
497 # disable detection
498 AC_ARG_ENABLE(detection,
20dd5939 499 AS_HELP_STRING([--disable-detection], [Disable Detection Modules]), [enable_detection="$enableval"],[enable_detection=yes])
f4872a2f 500 AS_IF([test "x$enable_detection" = "xno"], [
65d8ae93 501 AC_DEFINE([HAVE_DETECT_DISABLED], [1], [Detection is disabled])
f4872a2f
VJ
502 ])
503
ba81c4d2 504 # Tilera PCIE logging
497575d3
KS
505 AM_CONDITIONAL([BUILD_PCIE_LOGGING], [test ! -z "$TILERA_ROOT"])
506
89cee0ad
VJ
507# libraries
508
b60065ca
GL
509 # zlib
510 AC_ARG_WITH(zlib_includes,
511 [ --with-zlib-includes=DIR zlib include directory],
512 [with_zlib_includes="$withval"],[with_zlib_includes=no])
513 AC_ARG_WITH(zlib_libraries,
514 [ --with-zlib-libraries=DIR zlib library directory],
515 [with_zlib_libraries="$withval"],[with_zlib_libraries="no"])
516
517 if test "$with_zlib_includes" != "no"; then
518 CPPFLAGS="${CPPFLAGS} -I${with_zlib_includes}"
519 fi
520
521 AC_CHECK_HEADER(zlib.h, ZLIB="yes",ZLIB="no")
522 if test "$ZLIB" = "yes"; then
523 if test "$with_zlib_libraries" != "no"; then
524 LDFLAGS="${LDFLAGS} -L${with_zlib_libraries}"
525 fi
526
527 # To prevent duping the lib link we reset LIBS after this check. Setting action-if-found to NULL doesn't seem to work
528 # see: http://blog.flameeyes.eu/2008/04/29/i-consider-ac_check_lib-harmful
529 ZLIB=""
530 TMPLIBS="${LIBS}"
531 AC_CHECK_LIB(z,inflate,,ZLIB="no")
532
533 if test "$ZLIB" = "no"; then
534 echo
535 echo " ERROR! zlib library not found, go get it"
536 echo
537 exit 1
538 fi
539 LIBS="${TMPLIBS} -lz"
540 fi
541
542 # liblzma
543 enable_liblzma=no
544
545 AC_ARG_WITH(liblzma_includes,
546 [ --with-liblzma-includes=DIR liblzma include directory],
547 [with_liblzma_includes="$withval"],[with_liblzma_includes=no])
548 AC_ARG_WITH(liblzma_libraries,
549 [ --with-liblzma-libraries=DIR liblzma library directory],
550 [with_liblzma_libraries="$withval"],[with_liblzma_libraries="no"])
551
552 if test "$with_liblzma_includes" != "no"; then
553 CPPFLAGS="${CPPFLAGS} -I${with_liblzma_includes}"
554 fi
555
556 AC_CHECK_HEADER(lzma.h,LIBLZMA="yes",LIBLZMA="no")
557 if test "$LIBLZMA" = "yes"; then
558 if test "$with_liblzma_libraries" != "no"; then
559 LDFLAGS="${LDFLAGS} -L${with_liblzma_libraries}"
560 fi
561
562 # To prevent duping the lib link we reset LIBS after this check. Setting action-if-found to NULL doesn't seem to work
563 # see: http://blog.flameeyes.eu/2008/04/29/i-consider-ac_check_lib-harmful
564 LIBLZMA=""
565 TMPLIBS="${LIBS}"
566 AC_CHECK_LIB(lzma,lzma_code,,LIBLZMA="no")
567
568 if test "$LIBLZMA" = "no"; then
569 echo
570 echo " Warning! liblzma library not found, you will not be"
571 echo " able to decompress flash file compressed with lzma."
572 echo
573 enable_liblzma=no
574 else
575 enable_liblzma=yes
576 AC_DEFINE([HAVE_LIBLZMA],[1],[liblzma available])
577 LIBS="${TMPLIBS} -llzma"
578 fi
579 fi
580
3db717db
KS
581 AC_MSG_CHECKING([for Mpipe])
582 AC_COMPILE_IFELSE(
583 [AC_LANG_PROGRAM([[#include <gxio/mpipe.h>]])],
584 [
585 AC_MSG_RESULT([yes])
586 AC_DEFINE([HAVE_MPIPE],[1],[mPIPE support is available])
497575d3 587 LDFLAGS="$LDFLAGS -lgxpci -lgxio -ltmc"
3db717db
KS
588 ],
589 [AC_MSG_RESULT([no])])
590
89cee0ad 591 #libpcre
a3510f20
WM
592 AC_ARG_WITH(libpcre_includes,
593 [ --with-libpcre-includes=DIR libpcre include directory],
594 [with_libpcre_includes="$withval"],[with_libpcre_includes=no])
595 AC_ARG_WITH(libpcre_libraries,
596 [ --with-libpcre-libraries=DIR libpcre library directory],
597 [with_libpcre_libraries="$withval"],[with_libpcre_libraries="no"])
598
599 if test "$with_libpcre_includes" != "no"; then
89f83c2e 600 CPPFLAGS="${CPPFLAGS} -I${with_libpcre_includes}"
a3510f20 601 fi
a3510f20 602 AC_CHECK_HEADER(pcre.h,,[AC_ERROR(pcre.h not found ...)])
6899b3da 603
a3510f20 604 if test "$with_libpcre_libraries" != "no"; then
ba81c4d2 605 LDFLAGS="${LDFLAGS} -L${with_libpcre_libraries}"
a3510f20 606 fi
a3510f20 607 PCRE=""
9858ae41 608 AC_CHECK_LIB(pcre, pcre_get_substring,, PCRE="no")
89f83c2e
VJ
609 if test "$PCRE" = "no"; then
610 echo
611 echo " ERROR! pcre library not found, go get it"
612 echo " from www.pcre.org."
613 echo
614 exit 1
615 fi
6899b3da 616
8c0e5750
AH
617 # libpcre 8.35 (especially on debian) has a known issue that results in segfaults
618 # see https://redmine.openinfosecfoundation.org/issues/1693
c8399e8c
AH
619 if test "$with_libpcre_libraries" = "no"; then
620 PKG_CHECK_MODULES(LIBPCREVERSION, [libpcre = 8.35],[libpcre_buggy_found="yes"],[libprce_buggy_found="no"])
621 if test "$libpcre_buggy_found" = "yes"; then
622 echo
623 echo " Warning! vulnerable libpcre version 8.35 found"
624 echo " This version has a known issue that could result in segfaults"
625 echo " please upgrade to a newer version of pcre which you can get from"
626 echo " www.pcre.org. For more information, see issue #1693"
627 echo
628 echo " Continuing for now with JIT disabled..."
629 echo
630 fi
8c0e5750
AH
631 fi
632
89f83c2e
VJ
633 # To prevent duping the lib link we reset LIBS after this check. Setting action-if-found to NULL doesn't seem to work
634 # see: http://blog.flameeyes.eu/2008/04/29/i-consider-ac_check_lib-harmful
635 PCRE=""
636 TMPLIBS="${LIBS}"
637 AC_CHECK_LIB(pcre, pcre_dfa_exec,, PCRE="no")
a3510f20 638 if test "$PCRE" = "no"; then
89f83c2e
VJ
639 echo
640 echo " ERROR! pcre library was found but version was < 6.0"
641 echo " please upgrade to a newer version of pcre which you can get from"
642 echo " www.pcre.org."
643 echo
644 exit 1
a3510f20 645 fi
89f83c2e 646 LIBS="${TMPLIBS}"
6899b3da 647
89f83c2e
VJ
648 AC_TRY_COMPILE([ #include <pcre.h> ],
649 [ int eo = 0; eo |= PCRE_EXTRA_MATCH_LIMIT_RECURSION; ],
650 [ pcre_match_limit_recursion_available=yes ], [:]
651 )
652 if test "$pcre_match_limit_recursion_available" != "yes"; then
89f83c2e
VJ
653 echo
654 echo " Warning! pcre extra opt PCRE_EXTRA_MATCH_LIMIT_RECURSION not found"
655 echo " This could lead to potential DoS please upgrade to pcre >= 6.5"
89f83c2e 656 echo " from www.pcre.org."
ba81c4d2 657 echo " Continuing for now...."
89f83c2e 658 echo
ba81c4d2 659 AC_DEFINE([NO_PCRE_MATCH_RLIMIT],[1],[Pcre PCRE_EXTRA_MATCH_LIMIT_RECURSION not available])
89f83c2e 660 fi
5bde1217 661
0bfba835
VJ
662 TMPCFLAGS="${CFLAGS}"
663 CFLAGS="-O0 -g -Werror -Wall"
664 AC_TRY_COMPILE([ #include <pcre.h> ],
665 [ pcre_extra *extra = NULL; pcre_free_study(extra); ],
666 [ AC_DEFINE([HAVE_PCRE_FREE_STUDY], [1], [Pcre pcre_free_study supported])], [:]
667 )
668 CFLAGS="${TMPCFLAGS}"
669
3d396e8b 670 #enable support for PCRE-jit available since pcre-8.20
3d558bf0
EL
671 AC_MSG_CHECKING(for PCRE JIT support)
672 AC_TRY_COMPILE([ #include <pcre.h> ],
673 [
674 int jit = 0;
675 pcre_config(PCRE_CONFIG_JIT, &jit);
676 ],
677 [ pcre_jit_available=yes ], [ pcre_jit_available=no ]
678 )
679
bc480fa8
VJ
680 case $host in
681 *powerpc64*)
cee5c9fa
VJ
682 PKG_CHECK_MODULES(LIBPCREVERSION, [libpcre = 8.39],[libpcre_ppc64_buggy_found1="yes"],[libprce_ppc64_buggy_found1="no"])
683 PKG_CHECK_MODULES(LIBPCREVERSION, [libpcre = 8.40],[libpcre_ppc64_buggy_found2="yes"],[libprce_ppc64_buggy_found2="no"])
684
685 if test "$libprce_ppc64_buggy_found1" = "yes" || test "$libprce_ppc64_buggy_found2"; then
686 # on powerpc64, both gcc and clang lead to SIGILL in
687 # unittests when jit is enabled.
688 pcre_jit_available="no, pcre 8.39/8.40 jit disabled for powerpc64"
689 fi
bc480fa8
VJ
690 ;;
691 *)
692 # bug 1693, libpcre 8.35 is broken and debian jessie is still using that
693 if test "$libpcre_buggy_found" = "yes"; then
694 pcre_jit_available="no, libpcre 8.35 blacklisted"
695 fi
696 ;;
697 esac
e51707be 698
3d558bf0
EL
699 if test "x$pcre_jit_available" = "xyes"; then
700 AC_MSG_RESULT(yes)
701 AC_DEFINE([PCRE_HAVE_JIT], [1], [Pcre with JIT compiler support enabled])
702
703 AC_MSG_CHECKING(for PCRE JIT support usability)
704 AC_TRY_COMPILE([ #include <pcre.h> ],
705 [
706 const char* regexstr = "(a|b|c|d)";
707 pcre *re;
708 const char *error;
709 pcre_extra *extra;
710 int err_offset;
711 re = pcre_compile(regexstr,0, &error, &err_offset,NULL);
712 extra = pcre_study(re, PCRE_STUDY_JIT_COMPILE, &error);
713 if (extra == NULL)
714 exit(EXIT_FAILURE);
715 int jit = 0;
716 int ret = pcre_fullinfo(re, extra, PCRE_INFO_JIT, &jit);
717 if (ret != 0 || jit != 1)
718 exit(EXIT_FAILURE);
719 exit(EXIT_SUCCESS);
720 ],
721 [ pcre_jit_works=yes ], [:]
722 )
723 if test "x$pcre_jit_works" != "xyes"; then
724 AC_MSG_RESULT(no)
725 echo
726 echo " PCRE JIT support detection worked but testing it failed"
727 echo " something odd is going on, please file a bug report."
728 echo
729 exit 1
730 else
731 AC_MSG_RESULT(yes)
732 fi
5ea1b1d1 733 else
89f83c2e 734 AC_MSG_RESULT(no)
3d558bf0 735 fi
3d396e8b 736
13b87f5a
JV
737 # libhs
738 enable_hyperscan="no"
739
740 # Try pkg-config first:
741 PKG_CHECK_MODULES([libhs], libhs,, [with_pkgconfig_libhs=no])
742 if test "$with_pkgconfig_libhs" != "no"; then
743 CPPFLAGS="${CPPFLAGS} ${libhs_CFLAGS}"
744 LIBS="${LIBS} ${libhs_LIBS}"
745 fi
746
747 AC_ARG_WITH(libhs_includes,
748 [ --with-libhs-includes=DIR libhs include directory],
749 [with_libhs_includes="$withval"],[with_libhs_includes=no])
750 AC_ARG_WITH(libhs_libraries,
751 [ --with-libhs-libraries=DIR libhs library directory],
752 [with_libhs_libraries="$withval"],[with_libhs_libraries="no"])
753
754 if test "$with_libhs_includes" != "no"; then
755 CPPFLAGS="${CPPFLAGS} -I${with_libhs_includes}"
756 fi
757 AC_CHECK_HEADER(hs.h,HYPERSCAN="yes",HYPERSCAN="no")
758 if test "$HYPERSCAN" = "yes"; then
759 if test "$with_libhs_libraries" != "no"; then
760 LDFLAGS="${LDFLAGS} -L${with_libhs_libraries}"
761 fi
762
763 AC_CHECK_LIB(hs,hs_compile,,HYPERSCAN="no")
e6044aaf 764 AC_CHECK_FUNCS(hs_valid_platform)
13b87f5a
JV
765 enable_hyperscan="yes"
766 if test "$HYPERSCAN" = "no"; then
767 echo
768 echo " Hyperscan headers are present, but link test failed."
769 echo " Check that you have a shared library and C++ linkage available."
770 echo
771 enable_hyperscan="no"
772 fi
773 fi
774 AS_IF([test "x$enable_hyperscan" = "xyes"], [AC_DEFINE([BUILD_HYPERSCAN], [1], [Intel Hyperscan support enabled])])
775
89cee0ad 776 # libyaml
c91a4baa
JI
777 AC_ARG_WITH(libyaml_includes,
778 [ --with-libyaml-includes=DIR libyaml include directory],
779 [with_libyaml_includes="$withval"],[with_libyaml_includes=no])
780 AC_ARG_WITH(libyaml_libraries,
781 [ --with-libyaml-libraries=DIR libyaml library directory],
782 [with_libyaml_libraries="$withval"],[with_libyaml_libraries="no"])
783
784 if test "$with_libyaml_includes" != "no"; then
89f83c2e 785 CPPFLAGS="${CPPFLAGS} -I${with_libyaml_includes}"
c91a4baa
JI
786 fi
787
788 AC_CHECK_HEADER(yaml.h,,LIBYAML="no")
789
790 if test "$with_libyaml_libraries" != "no"; then
ba81c4d2 791 LDFLAGS="${LDFLAGS} -L${with_libyaml_libraries}"
c91a4baa
JI
792 fi
793
794 LIBYAML=""
795 AC_CHECK_LIB(yaml,yaml_parser_initialize,,LIBYAML="no")
796
797 if test "$LIBYAML" = "no"; then
89cee0ad
VJ
798 echo
799 echo " ERROR! libyaml library not found, go get it"
800 echo " from http://pyyaml.org/wiki/LibYAML "
801 echo " or your distribution:"
802 echo
803 echo " Ubuntu: apt-get install libyaml-dev"
804 echo " Fedora: yum install libyaml-devel"
805 echo
806 exit 1
c91a4baa
JI
807 fi
808
89cee0ad 809 # libpthread
a3510f20
WM
810 AC_ARG_WITH(libpthread_includes,
811 [ --with-libpthread-includes=DIR libpthread include directory],
812 [with_libpthread_includes="$withval"],[with_libpthread_includes=no])
813 AC_ARG_WITH(libpthread_libraries,
814 [ --with-libpthread-libraries=DIR libpthread library directory],
815 [with_libpthread_libraries="$withval"],[with_libpthread_libraries="no"])
816
817 if test "$with_libpthread_includes" != "no"; then
89f83c2e 818 CPPFLAGS="${CPPFLAGS} -I${with_libpthread_includes}"
a3510f20 819 fi
6899b3da 820
fa5939ca 821 dnl AC_CHECK_HEADER(pthread.h,,[AC_ERROR(pthread.h not found ...)])
6899b3da 822
a3510f20 823 if test "$with_libpthread_libraries" != "no"; then
89f83c2e 824 LDFLAGS="${LDFLAGS} -L${with_libpthread_libraries}"
a3510f20 825 fi
6899b3da 826
a3510f20
WM
827 PTHREAD=""
828 AC_CHECK_LIB(pthread, pthread_create,, PTHREAD="no")
6899b3da 829
a3510f20 830 if test "$PTHREAD" = "no"; then
89f83c2e
VJ
831 echo
832 echo " ERROR! libpthread library not found, glibc problem?"
833 echo
834 exit 1
a3510f20
WM
835 fi
836
20a8b9db
EL
837 # libjansson
838 enable_jansson="no"
839 AC_ARG_WITH(libjansson_includes,
840 [ --with-libjansson-includes=DIR libjansson include directory],
841 [with_libjansson_includes="$withval"],[with_libjansson_includes=no])
842 AC_ARG_WITH(libjansson_libraries,
843 [ --with-libjansson-libraries=DIR libjansson library directory],
844 [with_libjansson_libraries="$withval"],[with_libjansson_libraries="no"])
845
846 if test "$with_libjansson_includes" != "no"; then
847 CPPFLAGS="${CPPFLAGS} -I${with_libjansson_includes}"
848 fi
849
850 enable_jansson="no"
851 enable_unixsocket="no"
7d706563
EL
852
853 AC_ARG_ENABLE(unix-socket,
854 AS_HELP_STRING([--enable-unix-socket], [Enable unix socket [default=test]]),[enable_unixsocket="$enableval"],[enable_unixsocket=test])
855
20a8b9db
EL
856 AC_CHECK_HEADER(jansson.h,JANSSON="yes",JANSSON="no")
857 if test "$JANSSON" = "yes"; then
858 if test "$with_libjansson_libraries" != "no"; then
859 LDFLAGS="${LDFLAGS} -L${with_libjansson_libraries}"
860 fi
861
0470c0f6 862 AC_CHECK_LIB(jansson, json_dump_callback,, JANSSON="no")
20a8b9db
EL
863 enable_jansson="yes"
864 if test "$JANSSON" = "no"; then
865 echo
0470c0f6 866 echo " Jansson >= 2.2 is required for features like unix socket"
42227e87 867 echo " Go get it from your distribution or from:"
7d706563 868 echo " http://www.digip.org/jansson/"
20a8b9db 869 echo
ba81c4d2 870 if test "x$enable_unixsocket" = "xyes"; then
7d706563
EL
871 exit 1
872 fi
20a8b9db
EL
873 enable_unixsocket="no"
874 enable_jansson="no"
875 else
876 case $host in
877 *-*-mingw32*)
1261d30d 878 enable_unixsocket="no"
ba81c4d2 879 ;;
20a8b9db 880 *-*-cygwin)
1261d30d 881 enable_unixsocket="no"
ba81c4d2 882 ;;
20a8b9db 883 *)
ba81c4d2
VJ
884 if test "x$enable_unixsocket" = "xtest"; then
885 enable_unixsocket="yes"
886 fi
887 ;;
20a8b9db
EL
888 esac
889 fi
7d706563
EL
890 else
891 if test "x$enable_unixsocket" = "xyes"; then
892 echo
893 echo " Jansson >= 2.2 is required for features like unix socket"
42227e87 894 echo " Go get it from your distribution or from:"
7d706563
EL
895 echo " http://www.digip.org/jansson/"
896 echo
897 exit 1
898 fi
899 enable_unixsocket="no"
20a8b9db
EL
900 fi
901
902 AS_IF([test "x$enable_unixsocket" = "xyes"], [AC_DEFINE([BUILD_UNIX_SOCKET], [1], [Unix socket support enabled])])
f55dbca5 903 e_enable_evelog=$enable_jansson
20a8b9db 904
5f4b745f
EL
905 AC_ARG_ENABLE(nflog,
906 AS_HELP_STRING([--enable-nflog],[Enable libnetfilter_log support]),
907 [ enable_nflog="yes"],
908 [ enable_nflog="no"])
909 AC_ARG_ENABLE(nfqueue,
910 AS_HELP_STRING([--enable-nfqueue], [Enable NFQUEUE support for inline IDP]),[enable_nfqueue=yes],[enable_nfqueue=no])
15766ce2
AH
911 if test "$enable_nfqueue" != "no"; then
912 PKG_CHECK_MODULES([libnetfilter_queue], [libnetfilter_queue], [enable_nfqueue=yes], [enable_nfqueue=no])
913 CPPFLAGS="${CPPFLAGS} ${libnetfilter_queue_CFLAGS}"
914 fi
0ffa1c24 915
5f4b745f
EL
916 if test "x$enable_nflog" = "xyes" || test "x$enable_nfqueue" = "xyes"; then
917 # libnfnetlink
918 case $host in
919 *-*-mingw32*)
920 ;;
921 *)
922 AC_ARG_WITH(libnfnetlink_includes,
923 [ --with-libnfnetlink-includes=DIR libnfnetlink include directory],
924 [with_libnfnetlink_includes="$withval"],[with_libnfnetlink_includes=no])
925 AC_ARG_WITH(libnfnetlink_libraries,
926 [ --with-libnfnetlink-libraries=DIR libnfnetlink library directory],
927 [with_libnfnetlink_libraries="$withval"],[with_libnfnetlink_libraries="no"])
928
929 if test "$with_libnfnetlink_includes" != "no"; then
930 CPPFLAGS="${CPPFLAGS} -I${with_libnfnetlink_includes}"
931 fi
0ffa1c24 932
5f4b745f
EL
933 if test "$with_libnfnetlink_libraries" != "no"; then
934 LDFLAGS="${LDFLAGS} -L${with_libnfnetlink_libraries}"
935 fi
0ffa1c24 936
5f4b745f
EL
937 NFNL=""
938 AC_CHECK_LIB(nfnetlink, nfnl_fd,, NFNL="no")
939
940 if test "$NFNL" = "no"; then
941 echo
942 echo " ERROR! nfnetlink library not found, go get it"
943 echo " from www.netfilter.org."
944 echo " we automatically append libnetfilter_queue/ when searching"
945 echo " for headers etc. when the --with-libnfnetlink-includes directive"
946 echo " is used"
947 echo
948 fi
949 ;;
950 esac
951 fi
0ffa1c24 952
ba81c4d2 953 # enable support for NFQUEUE
3ff5dc36 954 if test "x$enable_nfqueue" = "xyes"; then
ba81c4d2 955 AC_DEFINE_UNQUOTED([NFQ],[1],[Enable Linux Netfilter NFQUEUE support for inline IDP])
4851568a 956
3ff5dc36
VJ
957 #libnetfilter_queue
958 AC_ARG_WITH(libnetfilter_queue_includes,
a3510f20
WM
959 [ --with-libnetfilter_queue-includes=DIR libnetfilter_queue include directory],
960 [with_libnetfilter_queue_includes="$withval"],[with_libnetfilter_queue_includes=no])
3ff5dc36 961 AC_ARG_WITH(libnetfilter_queue_libraries,
a3510f20
WM
962 [ --with-libnetfilter_queue-libraries=DIR libnetfilter_queue library directory],
963 [with_libnetfilter_queue_libraries="$withval"],[with_libnetfilter_queue_libraries="no"])
964
3ff5dc36
VJ
965 if test "$with_libnetfilter_queue_includes" != "no"; then
966 CPPFLAGS="${CPPFLAGS} -I${with_libnetfilter_queue_includes}"
967 fi
366671a8 968
3ff5dc36 969 AC_CHECK_HEADER(libnetfilter_queue/libnetfilter_queue.h,,[AC_ERROR(libnetfilter_queue/libnetfilter_queue.h not found ...)])
366671a8 970
3ff5dc36
VJ
971 if test "$with_libnetfilter_queue_libraries" != "no"; then
972 LDFLAGS="${LDFLAGS} -L${with_libnetfilter_queue_libraries}"
89cee0ad 973 fi
3ff5dc36
VJ
974
975 NFQ=""
89cee0ad
VJ
976 AC_CHECK_LIB(netfilter_queue, nfq_open,, NFQ="no",)
977 AC_CHECK_LIB([netfilter_queue], [nfq_set_queue_maxlen],AC_DEFINE_UNQUOTED([HAVE_NFQ_MAXLEN],[1],[Found queue max length support in netfilter_queue]) ,,[-lnfnetlink])
978 AC_CHECK_LIB([netfilter_queue], [nfq_set_verdict2],AC_DEFINE_UNQUOTED([HAVE_NFQ_SET_VERDICT2],[1],[Found nfq_set_verdict2 function in netfilter_queue]) ,,[-lnfnetlink])
2c572759 979 AC_CHECK_LIB([netfilter_queue], [nfq_set_queue_flags],AC_DEFINE_UNQUOTED([HAVE_NFQ_SET_QUEUE_FLAGS],[1],[Found nfq_set_queue_flags function in netfilter_queue]) ,,[-lnfnetlink])
8da02115 980 AC_CHECK_LIB([netfilter_queue], [nfq_set_verdict_batch],AC_DEFINE_UNQUOTED([HAVE_NFQ_SET_VERDICT_BATCH],[1],[Found nfq_set_verdict_batch function in netfilter_queue]) ,,[-lnfnetlink])
89cee0ad
VJ
981
982 # check if the argument to nfq_get_payload is signed or unsigned
983 AC_MSG_CHECKING([for signed nfq_get_payload payload argument])
984 STORECFLAGS="${CFLAGS}"
adbf85c4
EL
985 if test `basename $CC` = "clang"; then
986 CFLAGS="${CFLAGS} -Werror=incompatible-pointer-types"
987 else
58bf4ea4 988 CFLAGS="${CFLAGS} -Werror"
adbf85c4 989 fi
89cee0ad 990 AC_COMPILE_IFELSE(
c9f9e3f9
VJ
991 [AC_LANG_PROGRAM(
992 [
3ff5dc36
VJ
993 #include <stdio.h>
994 #include <libnetfilter_queue/libnetfilter_queue.h>
c9f9e3f9
VJ
995 ],
996 [
3ff5dc36
VJ
997 char *pktdata;
998 nfq_get_payload(NULL, &pktdata);
c9f9e3f9
VJ
999 ])],
1000 [libnetfilter_queue_nfq_get_payload_signed="yes"],
1001 [libnetfilter_queue_nfq_get_payload_signed="no"])
89cee0ad
VJ
1002 AC_MSG_RESULT($libnetfilter_queue_nfq_get_payload_signed)
1003 if test "x$libnetfilter_queue_nfq_get_payload_signed" = "xyes"; then
adbf85c4 1004 AC_DEFINE([NFQ_GET_PAYLOAD_SIGNED], [1], [For signed version of nfq_get_payload])
89cee0ad
VJ
1005 fi
1006 CFLAGS="${STORECFLAGS}"
0ffa1c24 1007
3ff5dc36
VJ
1008 if test "$NFQ" = "no"; then
1009 echo
1010 echo " ERROR! libnetfilter_queue library not found, go get it"
1011 echo " from www.netfilter.org."
1012 echo " we automatically append libnetfilter_queue/ when searching"
1013 echo " for headers etc. when the --with-libnfq-includes directive"
1014 echo " is used"
1015 echo
1016 exit 1
1017 fi
a3510f20 1018 fi
2b7b78f1 1019
4851568a 1020 # libnetfilter_log
4851568a
GL
1021 AC_ARG_WITH(libnetfilter_log_includes,
1022 [ --with-libnetfilter_log-includes=DIR libnetfilter_log include directory],
1023 [with_libnetfilter_log_includes="$withval"],[with_libnetfilter_log_includes="no"])
1024 AC_ARG_WITH(libnetfilter_log_libraries,
1025 [ --with-libnetfilter_log-libraries=DIR libnetfilter_log library directory],
1026 [with_libnetfilter_log_libraries="$withval"],[with_libnetfilter_log_libraries="no"])
1027
1028 if test "$enable_nflog" = "yes"; then
1029 if test "$with_libnetfilter_log_includes" != "no"; then
1030 CPPFLAGS="${CPPFLAGS} -I${with_libnetfilter_log_includes}"
1031 fi
1032
1033 AC_CHECK_HEADER(libnetfilter_log/libnetfilter_log.h,,[AC_ERROR(libnetfilter_log.h not found ...)])
1034
1035 if test "$with_libnetfilter_log_libraries" != "no"; then
1036 LDFLAGS="${LDFLAGS} -L${with_libnetfilter_log_libraries}"
1037 fi
1038
1039 NFLOG=""
1040 AC_CHECK_LIB(netfilter_log, nflog_open,, NFLOG="no")
1041
1042 if test "$NFLOG" = "no"; then
1043 echo
1044 echo " ERROR! libnetfilter_log library not found, go get it"
1045 echo " from http://www.netfilter.org."
1046 echo
1047 exit 1
1048 else
1049 AC_DEFINE([HAVE_NFLOG],[1],[nflog available])
1050 enable_nflog="yes"
1051 fi
1052 fi
1053
89cee0ad 1054 # prelude
eb33dc16 1055 AC_ARG_ENABLE(prelude,
e07e9e16 1056 AS_HELP_STRING([--enable-prelude], [Enable Prelude support for alerts]),,[enable_prelude=no])
f0c785cc
KS
1057 # Prelude doesn't work with -Werror
1058 STORECFLAGS="${CFLAGS}"
1059 CFLAGS="${CFLAGS} -Wno-error=unused-result"
1060
4e84ffe2 1061 AS_IF([test "x$enable_prelude" = "xyes"], [
eb33dc16
PC
1062 AM_PATH_LIBPRELUDE(0.9.9, , AC_MSG_ERROR(Cannot find libprelude: Is libprelude-config in the path?), no)
1063 if test "x${LIBPRELUDE_CFLAGS}" != "x"; then
1064 CPPFLAGS="${CPPFLAGS} ${LIBPRELUDE_CFLAGS}"
1065 fi
1066
1067 if test "x${LIBPRELUDE_LDFLAGS}" != "x"; then
1068 LDFLAGS="${LDFLAGS} ${LIBPRELUDE_LDFLAGS}"
1069 fi
1070
1071 if test "x${LIBPRELUDE_LIBS}" != "x"; then
1072 LDFLAGS="${LDFLAGS} ${LIBPRELUDE_LIBS}"
1073 fi
8623b8f9 1074 AC_DEFINE([PRELUDE], [1], [Libprelude support enabled])
4e84ffe2 1075 ])
f0c785cc
KS
1076 CFLAGS="${STORECFLAGS}"
1077
eb33dc16 1078
89cee0ad 1079 # libnet
a3510f20
WM
1080 AC_ARG_WITH(libnet_includes,
1081 [ --with-libnet-includes=DIR libnet include directory],
1082 [with_libnet_includes="$withval"],[with_libnet_includes="no"])
1083
1084 AC_ARG_WITH(libnet_libraries,
1085 [ --with-libnet-libraries=DIR libnet library directory],
1086 [with_libnet_libraries="$withval"],[with_libnet_libraries="no"])
1087
1088 if test "x$with_libnet_includes" != "xno"; then
3678dda1
WM
1089 CPPFLAGS="${CPPFLAGS} -I${with_libnet_includes}"
1090 libnet_dir="${with_libnet_includes}"
f7111f38 1091 else
829238e4 1092 libnet_dir="/usr/include /usr/local/include /usr/local/include/libnet11 /opt/local/include /usr/local/include/libnet-1.1"
a3510f20 1093 fi
0ffa1c24 1094
a3510f20 1095 if test "x$with_libnet_libraries" != "xno"; then
3678dda1 1096 LDFLAGS="${LDFLAGS} -L${with_libnet_libraries}"
a3510f20
WM
1097 fi
1098
3678dda1 1099 LIBNET_DETECT_FAIL="no"
a3510f20 1100 LIBNET_INC_DIR=""
3678dda1 1101
a3510f20
WM
1102 for i in $libnet_dir; do
1103 if test -r "$i/libnet.h"; then
3678dda1 1104 LIBNET_INC_DIR="$i"
a3510f20
WM
1105 fi
1106 done
1107
439b62fe 1108 enable_libnet="no"
3678dda1 1109 AC_MSG_CHECKING(for libnet.h version 1.1.x)
a3510f20 1110 if test "$LIBNET_INC_DIR" != ""; then
365015c2
AG
1111 LIBNET_VER=`grep LIBNET_VERSION $LIBNET_INC_DIR/libnet.h | grep '1.[[12]]' | sed 's/[[^"]]*"\([[^"]]*\).*/\1/'`
1112
1113 if test -z "$LIBNET_VER" ; then
3678dda1 1114 AC_MSG_RESULT(no)
3678dda1
WM
1115 else
1116 AC_MSG_RESULT(yes)
1117 fi
6e8c75ff 1118
3678dda1
WM
1119 #CentOS, Fedora, Ubuntu-LTS, Ubuntu all set defines to the same values. libnet-config seems
1120 #to have been depreciated but all distro's seem to include it as part of the package.
1121 if test "$LIBNET_DETECT_FAIL" = "no"; then
1122 LLIBNET=""
1123 AC_CHECK_LIB(net, libnet_write,, LLIBNET="no")
1124 if test "$LLIBNET" != "no"; then
ba81c4d2
VJ
1125 AC_DEFINE([HAVE_LIBNET11],[1],(libnet 1.1 available))
1126 AC_DEFINE([_DEFAULT_SOURCE],[1],(default source))
1127 AC_DEFINE([_BSD_SOURCE],[1],(bsd source))
1128 AC_DEFINE([__BSD_SOURCE],[1],(bsd source))
1129 AC_DEFINE([__FAVOR_BSD],[1],(favor bsd))
1130 AC_DEFINE([HAVE_NET_ETHERNET_H],[1],(ethernet.h))
439b62fe 1131 enable_libnet="yes"
3678dda1
WM
1132 fi
1133
1134 # see if we have the patched libnet 1.1
2e8678a5 1135 # https://www.inliniac.net/blog/2007/10/16/libnet-11-ipv6-fixes-and-additions.html
3678dda1
WM
1136 #
1137 # To prevent duping the lib link we reset LIBS after this check. Setting action-if-found to NULL doesn't seem to work
1138 # see: http://blog.flameeyes.eu/2008/04/29/i-consider-ac_check_lib-harmful
439b62fe 1139 if test "$enable_libnet" = "yes"; then
3678dda1
WM
1140 LLIBNET=""
1141 TMPLIBS="${LIBS}"
1142 AC_CHECK_LIB(net, libnet_build_icmpv6_unreach,, LLIBNET="no")
1143 if test "$LLIBNET" != "no"; then
ba81c4d2 1144 AC_DEFINE([HAVE_LIBNET_ICMPV6_UNREACH],[1],(libnet_build_icmpv6_unreach available))
3678dda1
WM
1145 fi
1146 LIBS="${TMPLIBS}"
1147 fi
365015c2
AG
1148
1149 # See if we have libnet 1.1.6 or newer - these versions handle capabilities correctly
1150 # Some patched 1.1.4 versions are also good, but it's not guaranteed for all distros.
1151 #
1152 # Details: https://bugzilla.redhat.com/show_bug.cgi?id=589770
1153 AS_VERSION_COMPARE([LIBNET_VER], [1.1.6],
1154 [],
1155 [AC_DEFINE([HAVE_LIBNET_CAPABILITIES],[1], (libnet_have_capabilities_patch))],
1156 [AC_DEFINE([HAVE_LIBNET_CAPABILITIES],[1], (libnet_have_capabilities_patch))])
66346e46
VJ
1157
1158
1159 # check if the argument to libnet_init is char* or const char*
1160 AC_MSG_CHECKING([libnet_init dev type])
1161 STORECFLAGS="${CFLAGS}"
1162 if test `basename $CC` = "clang"; then
1163 CFLAGS="${CFLAGS} -Werror=incompatible-pointer-types"
1164 else
1165 CFLAGS="${CFLAGS} -Werror"
1166 fi
1167 AC_COMPILE_IFELSE(
1168 [AC_LANG_PROGRAM(
1169 [
1170 #include <stdio.h>
1171 #include <libnet.h>
1172 ],
1173 [[
1174 const char dev[32] = "";
1175 char ebuf[LIBNET_ERRBUF_SIZE];
1176 (void)libnet_init(LIBNET_LINK, dev, ebuf);
1177 ]])],
1178 [libnet_init_const="yes"],
1179 [libnet_init_const="no"])
1180 AC_MSG_RESULT($libnet_init_const)
1181 if test "x$libnet_init_const" = "xyes"; then
1182 AC_DEFINE([HAVE_LIBNET_INIT_CONST], [1], [libnet_init takes const argument])
1183 fi
1184 CFLAGS="${STORECFLAGS}"
3678dda1 1185 fi
a3510f20 1186 else
439b62fe 1187 AC_MSG_RESULT(no)
a3510f20 1188 fi
0d15d4f6
MK
1189
1190 # libpcap
1191 AC_ARG_WITH(libpcap_includes,
1192 [ --with-libpcap-includes=DIR libpcap include directory],
1193 [with_libpcap_includes="$withval"],[with_libpcap_includes=no])
1194 AC_ARG_WITH(libpcap_libraries,
1195 [ --with-libpcap-libraries=DIR libpcap library directory],
1196 [with_libpcap_libraries="$withval"],[with_libpcap_libraries="no"])
1197
1198 if test "$with_libpcap_includes" != "no"; then
1199 CPPFLAGS="${CPPFLAGS} -I${with_libpcap_includes}"
1200 fi
1201
1202 AC_CHECK_HEADER(pcap.h,,[AC_ERROR(pcap.h not found ...)])
1203
1204 if test "$with_libpcap_libraries" != "no"; then
1205 LDFLAGS="${LDFLAGS} -L${with_libpcap_libraries}"
1206 fi
1207 AC_CHECK_HEADERS([pcap.h pcap/pcap.h pcap/bpf.h])
1208
1209 LIBPCAP=""
d1e839ea 1210 AC_CHECK_LIB(${PCAP_LIB_NAME}, pcap_open_live,, LIBPCAP="no")
0d15d4f6
MK
1211 if test "$LIBPCAP" = "no"; then
1212 echo
1213 echo " ERROR! libpcap library not found, go get it"
1214 echo " from http://www.tcpdump.org or your distribution:"
1215 echo
1216 echo " Ubuntu: apt-get install libpcap-dev"
1217 echo " Fedora: yum install libpcap-devel"
1218 echo
1219 exit 1
1220 fi
1221
1222 # pcap_activate and pcap_create only exists in libpcap >= 1.0
1223 LIBPCAPVTEST=""
1224 #To prevent duping the lib link we reset LIBS after this check. Setting action-if-found to NULL doesn't seem to work
1225 #see: http://blog.flameeyes.eu/2008/04/29/i-consider-ac_check_lib-harmful
1226 TMPLIBS="${LIBS}"
d1e839ea 1227 AC_CHECK_LIB(${PCAP_LIB_NAME}, pcap_activate,, LPCAPVTEST="no")
cda6e029
VJ
1228 if test "$LPCAPVTEST" = "no"; then
1229 echo
1230 echo " ERROR! libpcap library too old, need at least 1+, "
1231 echo " go get it from http://www.tcpdump.org or your distribution:"
1232 echo
1233 echo " Ubuntu: apt-get install libpcap-dev"
1234 echo " Fedora: yum install libpcap-devel"
1235 echo
1236 exit 1
1237 fi
1238 AC_PATH_PROG(HAVE_PCAP_CONFIG, pcap-config, "no")
1239 if test "$HAVE_PCAP_CONFIG" = "no" -o "$cross_compiling" = "yes"; then
1240 AC_MSG_RESULT(no pcap-config is use)
0d15d4f6 1241 else
cda6e029
VJ
1242 PCAP_CFLAGS="$(pcap-config --defines) $(pcap-config --cflags)"
1243 AC_SUBST(PCAP_CFLAGS)
0d15d4f6
MK
1244 fi
1245 LIBS="${TMPLIBS}"
1246
1247 #Appears as if pcap_set_buffer_size is linux only?
1248 LIBPCAPSBUFF=""
1249 #To prevent duping the lib link we reset LIBS after this check. Setting action-if-found to NULL doesn't seem to work
1250 #see: http://blog.flameeyes.eu/2008/04/29/i-consider-ac_check_lib-harmful
1251 TMPLIBS="${LIBS}"
d1e839ea 1252 AC_CHECK_LIB(${PCAP_LIB_NAME}, pcap_set_buffer_size,, LPCAPSBUFF="no")
0d15d4f6 1253 if test "$LPCAPSBUFF" != "no"; then
ba81c4d2 1254 AC_DEFINE([HAVE_PCAP_SET_BUFF],[1],(libpcap has pcap_set_buffer_size function))
0d15d4f6
MK
1255 fi
1256 LIBS="${TMPLIBS}"
1257
1258 # libpfring
89cee0ad
VJ
1259 # libpfring (currently only supported for libpcap enabled pfring)
1260 # Error on the side of caution. If libpfring enabled pcap is being used and we don't link against -lpfring compilation will fail.
04b0f177 1261 AC_ARG_ENABLE(pfring,
e07e9e16
WM
1262 AS_HELP_STRING([--enable-pfring], [Enable Native PF_RING support]),,[enable_pfring=no])
1263 AS_IF([test "x$enable_pfring" = "xyes"], [
ba81c4d2 1264 AC_DEFINE([HAVE_PFRING],[1],(PF_RING support enabled))
ddf995da 1265
89cee0ad 1266 #We have to set CFLAGS for AC_TRY_COMPILE as it doesn't pay attention to CPPFLAGS
6408feba
W
1267 AC_ARG_WITH(libpfring_includes,
1268 [ --with-libpfring-includes=DIR libpfring include directory],
1269 [with_libpfring_includes="$withval"],[with_libpfring_includes=no])
1270 AC_ARG_WITH(libpfring_libraries,
1271 [ --with-libpfring-libraries=DIR libpfring library directory],
1272 [with_libpfring_libraries="$withval"],[with_libpfring_libraries="no"])
1273
1274 if test "$with_libpfring_includes" != "no"; then
89f83c2e 1275 CPPFLAGS="${CPPFLAGS} -I${with_libpfring_includes}"
6408feba 1276 fi
073d0421 1277
6408feba 1278 if test "$with_libpfring_libraries" != "no"; then
89f83c2e 1279 LDFLAGS="${LDFLAGS} -L${with_libpfring_libraries}"
6408feba 1280 fi
073d0421 1281
6408feba 1282 LIBPFRING=""
43ffd779 1283 AC_CHECK_LIB(pfring, pfring_open,, LIBPFRING="no", [-lpcap])
dde78e49
GL
1284 if test "$LIBPFRING" != "no"; then
1285 STORECFLAGS="${CFLAGS}"
1286 CFLAGS="${CFLAGS} -Werror"
1287 AC_COMPILE_IFELSE(
1288 [AC_LANG_PROGRAM(
1289 [
1290 #include <pfring.h>
1291 ],
1292 [
1293 pfring_recv_chunk(NULL, NULL, 0, 0);
1294 ])],
1295 [pfring_recv_chunk="yes"],
1296 [pfring_recv_chunk="no"])
1297 CFLAGS="${STORECFLAGS}"
1298 if test "x$pfring_recv_chunk" != "xyes"; then
a75911e0
EL
1299 if test "x$enable_pfring" = "xyes"; then
1300 echo
dde78e49
GL
1301 echo " ERROR! --enable-pfring was passed but the library version is < 6, go get it"
1302 echo " from http://www.ntop.org/products/pf_ring/"
a75911e0
EL
1303 echo
1304 exit 1
1305 fi
6408feba 1306 fi
b6baafb3
AC
1307 AC_COMPILE_IFELSE(
1308 [AC_LANG_SOURCE([[
1309 #include <pfring.h>
1310 #ifndef PF_RING_FLOW_OFFLOAD
1311 # error PF_RING_FLOW_OFFLOAD not defined
1312 #endif
1313 ]])],
1314 [
1315 AC_DEFINE([HAVE_PF_RING_FLOW_OFFLOAD], [1], [PF_RING bypass support enabled])
1316 ],
1317 [
1318 echo
1319 echo " Warning! Pfring hw bypass not supported by this library version < 7,"
1320 echo " please upgrade to a newer version to use this feature."
1321 echo
1322 echo " Continuing for now with hw bypass support disabled..."
1323 echo
1324 ])
6408feba 1325 else
dde78e49
GL
1326 if test "x$enable_pfring" = "xyes"; then
1327 echo
1328 echo " ERROR! --enable-pfring was passed but the library was not found, go get it"
1329 echo " from http://www.ntop.org/products/pf_ring/"
1330 echo
1331 exit 1
1332 fi
dbf5d79e 1333 fi
6408feba 1334 ])
ddf995da 1335
89cee0ad 1336 # AF_PACKET support
e80b30c0 1337 AC_ARG_ENABLE(af-packet,
b2ebd4a1
EL
1338 AS_HELP_STRING([--enable-af-packet], [Enable AF_PACKET support [default=yes]]),
1339 ,[enable_af_packet=yes])
e80b30c0 1340 AS_IF([test "x$enable_af_packet" = "xyes"], [
ac2d13d6 1341 AC_CHECK_DECL([TPACKET_V2],
e80b30c0 1342 AC_DEFINE([HAVE_AF_PACKET],[1],[AF_PACKET support is available]),
ac2d13d6
EL
1343 [enable_af_packet="no"],
1344 [[#include <sys/socket.h>
1345 #include <linux/if_packet.h>]])
851fcef9
EL
1346 AC_CHECK_DECL([PACKET_FANOUT_QM],
1347 AC_DEFINE([HAVE_PACKET_FANOUT],[1],[Recent packet fanout support is available]),
e80b30c0
EL
1348 [],
1349 [[#include <linux/if_packet.h>]])
c2d0d938
EL
1350 AC_CHECK_DECL([TPACKET_V3],
1351 AC_DEFINE([HAVE_TPACKET_V3],[1],[AF_PACKET tpcket_v3 support is available]),
1352 [],
1353 [[#include <sys/socket.h>
1354 #include <linux/if_packet.h>]])
a40f08a2
EL
1355 AC_CHECK_DECL([SOF_TIMESTAMPING_RAW_HARDWARE],
1356 AC_DEFINE([HAVE_HW_TIMESTAMPING],[1],[Hardware timestamping support is available]),
1357 [],
91e1256b 1358 [[#include <linux/net_tstamp.h>]]),
e80b30c0
EL
1359 ])
1360
10104066 1361 # Netmap support
1362 AC_ARG_ENABLE(netmap,
1363 AS_HELP_STRING([--enable-netmap], [Enable Netmap support]),,[enable_netmap=no])
1364 AC_ARG_WITH(netmap_includes,
1365 [ --with-netmap-includes=DIR netmap include directory],
1366 [with_netmap_includes="$withval"],[with_netmap_includes=no])
1367
1368 AS_IF([test "x$enable_netmap" = "xyes"], [
ba81c4d2 1369 AC_DEFINE([HAVE_NETMAP],[1],(NETMAP support enabled))
10104066 1370
1371 if test "$with_netmap_includes" != "no"; then
1372 CPPFLAGS="${CPPFLAGS} -I${with_netmap_includes}"
1373 fi
1374
1375 AC_CHECK_HEADER(net/netmap_user.h,,[AC_ERROR(net/netmap_user.h not found ...)],)
1376 ])
c45d8985 1377
cbcbc0f6
JI
1378 # suricata-update
1379 AC_CHECK_FILE([$srcdir/suricata-update/setup.py], [
1380 SURICATA_UPDATE_DIR="suricata-update"
1381 AC_SUBST(SURICATA_UPDATE_DIR)
1382 AC_OUTPUT(suricata-update/Makefile)
1383 ])
1384
89cee0ad 1385 # libhtp
e07e9e16
WM
1386 AC_ARG_ENABLE(non-bundled-htp,
1387 AS_HELP_STRING([--enable-non-bundled-htp], [Enable the use of an already installed version of htp]),,[enable_non_bundled_htp=no])
1388 AS_IF([test "x$enable_non_bundled_htp" = "xyes"], [
f8b8b6f7
EL
1389 PKG_CHECK_MODULES([libhtp], htp,, [with_pkgconfig_htp=no])
1390 if test "$with_pkgconfig_htp" != "no"; then
1391 CPPFLAGS="${CPPFLAGS} ${libhtp_CFLAGS}"
1392 LIBS="${LIBS} ${libhtp_LIBS}"
1393 fi
1394
e07e9e16
WM
1395 AC_ARG_WITH(libhtp_includes,
1396 [ --with-libhtp-includes=DIR libhtp include directory],
1397 [with_libhtp_includes="$withval"],[with_libhtp_includes=no])
1398 AC_ARG_WITH(libhtp_libraries,
1399 [ --with-libhtp-libraries=DIR libhtp library directory],
1400 [with_libhtp_libraries="$withval"],[with_libhtp_libraries="no"])
1401
1402 if test "$with_libhtp_includes" != "no"; then
0c37f76f 1403 CPPFLAGS="-I${with_libhtp_includes} ${CPPFLAGS}"
e07e9e16 1404 fi
07f7ba55 1405
e07e9e16 1406 if test "$with_libhtp_libraries" != "no"; then
89cee0ad 1407 LDFLAGS="${LDFLAGS} -L${with_libhtp_libraries}"
e07e9e16 1408 fi
ed856de9 1409
e07e9e16 1410 AC_CHECK_HEADER(htp/htp.h,,[AC_ERROR(htp/htp.h not found ...)])
ed856de9 1411
e07e9e16
WM
1412 LIBHTP=""
1413 AC_CHECK_LIB(htp, htp_conn_create,, LIBHTP="no")
1414 if test "$LIBHTP" = "no"; then
89cee0ad
VJ
1415 echo
1416 echo " ERROR! libhtp library not found"
1417 echo
1418 exit 1
e07e9e16 1419 fi
37b10c13 1420 PKG_CHECK_MODULES(LIBHTPMINVERSION, [htp >= 0.5.20],[libhtp_minver_found="yes"],[libhtp_minver_found="no"])
e07e9e16 1421 if test "$libhtp_minver_found" = "no"; then
f85a2dc8
AS
1422 PKG_CHECK_MODULES(LIBHTPDEVVERSION, [htp = 0.5.X],[libhtp_devver_found="yes"],[libhtp_devver_found="no"])
1423 if test "$libhtp_devver_found" = "no"; then
1424 echo
37b10c13 1425 echo " ERROR! libhtp was found but it is neither >= 0.5.20, nor the dev 0.5.X"
f85a2dc8
AS
1426 echo
1427 exit 1
1428 fi
d472d606
EL
1429 fi
1430
a3e2b355 1431 AC_CHECK_LIB([htp], [htp_config_register_request_uri_normalize],AC_DEFINE_UNQUOTED([HAVE_HTP_URI_NORMALIZE_HOOK],[1],[Found htp_config_register_request_uri_normalize function in libhtp]) ,,[-lhtp])
80fb33c6
VJ
1432 # check for htp_tx_get_response_headers_raw
1433 AC_CHECK_LIB([htp], [htp_tx_get_response_headers_raw],AC_DEFINE_UNQUOTED([HAVE_HTP_TX_GET_RESPONSE_HEADERS_RAW],[1],[Found htp_tx_get_response_headers_raw in libhtp]) ,,[-lhtp])
cc51eec5 1434 AC_CHECK_LIB([htp], [htp_decode_query_inplace],AC_DEFINE_UNQUOTED([HAVE_HTP_DECODE_QUERY_INPLACE],[1],[Found htp_decode_query_inplace function in libhtp]) ,,[-lhtp])
5ec885e4 1435 AC_CHECK_LIB([htp], [htp_config_set_response_decompression_layer_limit],AC_DEFINE_UNQUOTED([HAVE_HTP_CONFIG_SET_RESPONSE_DECOMPRESSION_LAYER_LIMIT],[1],[Found htp_config_set_response_decompression_layer_limit function in libhtp]) ,,[-lhtp])
6d225378 1436 AC_EGREP_HEADER(htp_config_set_path_decode_u_encoding, htp/htp.h, AC_DEFINE_UNQUOTED([HAVE_HTP_SET_PATH_DECODE_U_ENCODING],[1],[Found usable htp_config_set_path_decode_u_encoding function in libhtp]) )
80fb33c6 1437 ])
4acd5a04 1438
aafc65c7
VJ
1439 if test "x$enable_non_bundled_htp" = "xno"; then
1440 # test if we have a bundled htp
1441 if test -d "$srcdir/libhtp"; then
1442 AC_CONFIG_SUBDIRS([libhtp])
1443 HTP_DIR="libhtp"
1444 AC_SUBST(HTP_DIR)
1445 HTP_LDADD="../libhtp/htp/libhtp.la"
1446 AC_SUBST(HTP_LDADD)
1447 # make sure libhtp is added to the includes
667e4e68 1448 CPPFLAGS="-I\${srcdir}/../libhtp/ ${CPPFLAGS}"
aafc65c7 1449
8060ef41 1450 AC_CHECK_HEADER(iconv.h,,[AC_ERROR(iconv.h not found ...)])
c0993495 1451 AC_CHECK_LIB(iconv, libiconv_close)
aafc65c7
VJ
1452 AC_DEFINE_UNQUOTED([HAVE_HTP_URI_NORMALIZE_HOOK],[1],[Assuming htp_config_register_request_uri_normalize function in bundled libhtp])
1453 AC_DEFINE_UNQUOTED([HAVE_HTP_TX_GET_RESPONSE_HEADERS_RAW],[1],[Assuming htp_tx_get_response_headers_raw function in bundled libhtp])
1454 AC_DEFINE_UNQUOTED([HAVE_HTP_DECODE_QUERY_INPLACE],[1],[Assuming htp_decode_query_inplace function in bundled libhtp])
5ec885e4
VJ
1455 # enable when libhtp has been updated
1456 AC_DEFINE_UNQUOTED([HAVE_HTP_CONFIG_SET_RESPONSE_DECOMPRESSION_LAYER_LIMIT],[1],[Assuming htp_config_set_response_decompression_layer_limit function in bundled libhtp])
aafc65c7
VJ
1457 else
1458 echo
1bbbcf51 1459 echo " ERROR: Libhtp is not bundled. Get libhtp by doing:"
5ec885e4 1460 echo " git clone https://github.com/OISF/libhtp"
1bbbcf51
KS
1461 echo " Then re-run Suricata's autogen.sh and configure script."
1462 echo " Or, if libhtp is installed in a different location,"
1463 echo " pass --enable-non-bundled-htp to Suricata's configure script."
aafc65c7
VJ
1464 echo " Add --with-libhtp-includes=<dir> and --with-libhtp-libraries=<dir> if"
1465 echo " libhtp is not installed in the include and library paths."
1466 echo
1467 exit 1
1468 fi
1469 fi
36917c7d 1470
08328f9d 1471
89cee0ad 1472 # Check for libcap-ng
829238e4
VJ
1473 case $host in
1474 *-*-linux*)
070ed778
VJ
1475 AC_ARG_WITH(libcap_ng_includes,
1476 [ --with-libcap_ng-includes=DIR libcap_ng include directory],
f01027e9 1477 [with_libcap_ng_includes="$withval"],[with_libcap_ng_includes=no])
070ed778
VJ
1478 AC_ARG_WITH(libcap_ng_libraries,
1479 [ --with-libcap_ng-libraries=DIR libcap_ng library directory],
1480 [with_libcap_ng_libraries="$withval"],[with_libcap_ng_libraries="no"])
1481
1482 if test "$with_libcap_ng_includes" != "no"; then
89cee0ad 1483 CPPFLAGS="${CPPFLAGS} -I${with_libcap_ng_includes}"
070ed778
VJ
1484 fi
1485
1486 if test "$with_libcap_ng_libraries" != "no"; then
89cee0ad 1487 LDFLAGS="${LDFLAGS} -L${with_libcap_ng_libraries}"
070ed778
VJ
1488 fi
1489
1490 AC_CHECK_HEADER(cap-ng.h,,LIBCAP_NG="no")
1491 if test "$LIBCAP_NG" != "no"; then
1492 LIBCAP_NG=""
1493 AC_CHECK_LIB(cap-ng,capng_clear,,LIBCAP_NG="no")
1494 fi
1495
1496 if test "$LIBCAP_NG" != "no"; then
ba81c4d2 1497 AC_DEFINE([HAVE_LIBCAP_NG],[1],[Libpcap-ng support])
070ed778
VJ
1498 fi
1499
1500 if test "$LIBCAP_NG" = "no"; then
89cee0ad
VJ
1501 echo
1502 echo " WARNING! libcap-ng library not found, go get it"
1503 echo " from http://people.redhat.com/sgrubb/libcap-ng/"
1504 echo " or your distribution:"
1505 echo
1506 echo " Ubuntu: apt-get install libcap-ng-dev"
1507 echo " Fedora: yum install libcap-ng-devel"
1508 echo
1509 echo " Suricata will be built without support for dropping privs."
1510 echo
070ed778 1511 fi
829238e4
VJ
1512 ;;
1513 esac
835630ef 1514
91e1256b
EL
1515
1516 AC_ARG_ENABLE(ebpf,
1517 AS_HELP_STRING([--enable-ebpf],[Enable eBPF support]),
1518 [ enable_ebpf="yes"],
1519 [ enable_ebpf="no"])
1520
1521 if test "$enable_ebpf" = "yes"; then
1522 AC_CHECK_LIB(elf,elf_begin,,LIBELF="no")
1523 if test "$LIBELF" = "no"; then
1524 echo
1525 echo " libelf library and development headers not found but"
1526 echo " but needed to use eBPF code"
1527 echo
1528 exit 1
1529 fi;
1530
1531 AC_CHECK_LIB(bpf,bpf_object__open,,LIBBPF="no")
1532 if test "$LIBBPF" = "no"; then
1533 echo
1534 echo " libbpf library and development headers not found but"
1535 echo " but needed to use eBPF code. It can be found in the"
1536 echo " Linux kernel tree under tools/lib/bpf"
1537 echo
1538 exit 1
1539 fi;
1540 AC_CHECK_DECL([PACKET_FANOUT_EBPF],
1541 AC_DEFINE([HAVE_PACKET_EBPF],[1],[Recent ebpf fanout support is available]),
1542 [],
1543 [[#include <linux/if_packet.h>]])
8c880879
EL
1544 AC_CHECK_LIB(bpf, bpf_set_link_xdp_fd,have_xdp="yes",have_xdp="no")
1545 if test "$have_xdp" = "yes"; then
1546 AC_DEFINE([HAVE_PACKET_XDP],[1],[XDP support is available])
1547 fi
91e1256b
EL
1548 fi;
1549
89cee0ad 1550 # Check for DAG support.
835630ef 1551 AC_ARG_ENABLE(dag,
6913109b 1552 AS_HELP_STRING([--enable-dag],[Enable DAG capture]),
835630ef
JM
1553 [ enable_dag=yes ],
1554 [ enable_dag=no])
1555 AC_ARG_WITH(dag_includes,
1556 [ --with-dag-includes=DIR dagapi include directory],
1557 [with_dag_includes="$withval"],[with_dag_includes="no"])
1558 AC_ARG_WITH(dag_libraries,
1559 [ --with-dag-libraries=DIR dagapi library directory],
1560 [with_dag_libraries="$withval"],[with_dag_libraries="no"])
1561
1562 if test "$enable_dag" = "yes"; then
1563
c9cc137d 1564 if test "$with_dag_includes" != "no"; then
835630ef
JM
1565 CPPFLAGS="${CPPFLAGS} -I${with_dag_includes}"
1566 fi
1567
1568 if test "$with_dag_libraries" != "no"; then
573f31b2 1569 LDFLAGS="${LDFLAGS} -L${with_dag_libraries}"
835630ef
JM
1570 fi
1571
1572 AC_CHECK_HEADER(dagapi.h,DAG="yes",DAG="no")
1573 if test "$DAG" != "no"; then
1574 DAG=""
ba81c4d2 1575 AC_CHECK_LIB(dag,dag_open,,DAG="no",)
835630ef
JM
1576 fi
1577
1578 if test "$DAG" = "no"; then
1579 echo
1580 echo " ERROR! libdag library not found"
1581 echo
1582 exit 1
1583 fi
ba81c4d2
VJ
1584
1585 AC_DEFINE([HAVE_DAG],[1],(Endace DAG card support enabled))
835630ef
JM
1586 fi
1587
89cee0ad 1588 # libnspr
8f926fb7
RB
1589 AC_ARG_ENABLE(nspr,
1590 AS_HELP_STRING([--disable-nspr],[Disable libnspr support]))
69b3df96
VJ
1591 AC_ARG_WITH(libnspr_includes,
1592 [ --with-libnspr-includes=DIR libnspr include directory],
1593 [with_libnspr_includes="$withval"],[with_libnspr_includes=no])
1594 AC_ARG_WITH(libnspr_libraries,
1595 [ --with-libnspr-libraries=DIR libnspr library directory],
1596 [with_libnspr_libraries="$withval"],[with_libnspr_libraries="no"])
1597
8f926fb7
RB
1598 if test "$enable_nspr" != "no"; then
1599 # Try pkg-config first:
1600 PKG_CHECK_MODULES([libnspr], nspr,, [with_pkgconfig_nspr=no])
1601 if test "$with_pkgconfig_nspr" != "no"; then
1602 CPPFLAGS="${CPPFLAGS} ${libnspr_CFLAGS}"
1603 LIBS="${LIBS} ${libnspr_LIBS}"
1604 fi
1605
1606 if test "$with_libnspr_includes" != "no"; then
1607 CPPFLAGS="${CPPFLAGS} -I${with_libnspr_includes}"
1608 fi
1609
1610 AC_CHECK_HEADER(nspr.h,NSPR="yes",NSPR="no")
1611 if test "$NSPR" = "yes"; then
1612 if test "$with_libnspr_libraries" != "no"; then
1613 LDFLAGS="${LDFLAGS} -L${with_libnspr_libraries}"
1614 fi
1615
1616 AC_CHECK_LIB(nspr4, PR_GetCurrentThread,, NSPR="no")
1617
1618 if test "$NSPR" = "no"; then
1619 echo
1620 echo " ERROR! libnspr library not found, go get it"
1621 echo " from Mozilla or your distribution:"
1622 echo
1623 echo " Ubuntu: apt-get install libnspr4-dev"
1624 echo " Fedora: yum install nspr-devel"
1625 echo
1626 exit 1
1627 fi
1628 enable_nspr="yes"
1629 fi
69b3df96 1630 fi
337f7861 1631
89cee0ad 1632 # libnss
8f926fb7
RB
1633 AC_ARG_ENABLE(nss,
1634 AS_HELP_STRING([--disable-nss],[Disable libnss support]))
69b3df96
VJ
1635 AC_ARG_WITH(libnss_includes,
1636 [ --with-libnss-includes=DIR libnss include directory],
1637 [with_libnss_includes="$withval"],[with_libnss_includes=no])
1638 AC_ARG_WITH(libnss_libraries,
1639 [ --with-libnss-libraries=DIR libnss library directory],
1640 [with_libnss_libraries="$withval"],[with_libnss_libraries="no"])
1641
8f926fb7
RB
1642 if test "$enable_nss" != "no"; then
1643 # Try pkg-config first:
1644 PKG_CHECK_MODULES([libnss], nss,, [with_pkgconfig_nss=no])
1645 if test "$with_pkgconfig_nss" != "no"; then
1646 CPPFLAGS="${CPPFLAGS} ${libnss_CFLAGS}"
1647 LIBS="${LIBS} ${libnss_LIBS}"
1648 fi
1649
1650 if test "$with_libnss_includes" != "no"; then
1651 CPPFLAGS="${CPPFLAGS} -I${with_libnss_includes}"
1652 fi
1653
1654 AC_CHECK_HEADER(sechash.h,NSS="yes",NSS="no")
1655 if test "$NSS" = "yes"; then
1656 if test "$with_libnss_libraries" != "no"; then
1657 LDFLAGS="${LDFLAGS} -L${with_libnss_libraries}"
1658 fi
1659
1660 AC_CHECK_LIB(nss3, HASH_Begin,, NSS="no")
1661
1662 if test "$NSS" = "no"; then
1663 echo
1664 echo " ERROR! libnss library not found, go get it"
1665 echo " from Mozilla or your distribution:"
1666 echo
1667 echo " Ubuntu: apt-get install libnss3-dev"
1668 echo " Fedora: yum install nss-devel"
1669 echo
1670 exit 1
1671 fi
1672
1673 AC_DEFINE([HAVE_NSS],[1],[libnss available for md5])
1674 enable_nss="yes"
1675 fi
69b3df96
VJ
1676 fi
1677
89cee0ad 1678 # libmagic
810e43f3
VJ
1679 enable_magic="no"
1680 AC_ARG_ENABLE(libmagic,
1681 AS_HELP_STRING([--enable-libmagic], [Enable libmagic support [default=yes]]),
1682 ,[enable_magic=yes])
1683 if test "$enable_magic" = "yes"; then
1684 AC_ARG_WITH(libmagic_includes,
1685 [ --with-libmagic-includes=DIR libmagic include directory],
1686 [with_libmagic_includes="$withval"],[with_libmagic_includes=no])
1687 AC_ARG_WITH(libmagic_libraries,
1688 [ --with-libmagic-libraries=DIR libmagic library directory],
1689 [with_libmagic_libraries="$withval"],[with_libmagic_libraries="no"])
1690
1691 if test "$with_libmagic_includes" != "no"; then
1692 CPPFLAGS="${CPPFLAGS} -I${with_libmagic_includes}"
1693 fi
f4a6f4b2 1694
810e43f3
VJ
1695 AC_CHECK_HEADER(magic.h,,MAGIC="no")
1696 if test "$MAGIC" != "no"; then
1697 MAGIC=""
1698 AC_CHECK_LIB(magic, magic_open,, MAGIC="no")
1699 fi
f4a6f4b2 1700
810e43f3
VJ
1701 if test "x$MAGIC" != "xno"; then
1702 if test "$with_libmagic_libraries" != "no"; then
1703 LDFLAGS="${LDFLAGS} -L${with_libmagic_libraries}"
1704 fi
1705 AC_DEFINE([HAVE_MAGIC],[1],(Libmagic for file handling))
1706 else
1707 echo
1708 echo " WARNING! magic library not found, go get it"
1709 echo " from http://www.darwinsys.com/file/ or your distribution:"
1710 echo
1711 echo " Ubuntu: apt-get install libmagic-dev"
1712 echo " Fedora: yum install file-devel"
1713 echo
1714 enable_magic="no"
1715 fi
f4a6f4b2
VJ
1716 fi
1717
37e3de84
MK
1718 # Napatech - Using the 3GD API
1719 AC_ARG_ENABLE(napatech,
6913109b 1720 AS_HELP_STRING([--enable-napatech],[Enabled Napatech Devices]),
37e3de84
MK
1721 [ enable_napatech=yes ],
1722 [ enable_napatech=no])
1723 AC_ARG_WITH(napatech_includes,
1724 [ --with-napatech-includes=DIR napatech include directory],
1725 [with_napatech_includes="$withval"],[with_napatech_includes="/opt/napatech3/include"])
1726 AC_ARG_WITH(napatech_libraries,
1727 [ --with-napatech-libraries=DIR napatech library directory],
1728 [with_napatech_libraries="$withval"],[with_napatech_libraries="/opt/napatech3/lib"])
1729
1730 if test "$enable_napatech" = "yes"; then
1731 CPPFLAGS="${CPPFLAGS} -I${with_napatech_includes}"
1732 LDFLAGS="${LDFLAGS} -L${with_napatech_libraries} -lntapi"
1733 AC_CHECK_HEADER(nt.h,NAPATECH="yes",NAPATECH="no")
1734 if test "$NAPATECH" != "no"; then
1735 NAPATECH=""
1736 AC_CHECK_LIB(ntapi, NT_Init,NAPATECH="yes",NAPATECH="no")
844e4dba
MK
1737 fi
1738
37e3de84 1739 if test "$NAPATECH" = "no"; then
844e4dba
MK
1740 echo
1741 echo " ERROR! libntapi library not found"
1742 echo
1743 exit 1
1744 fi
ba81c4d2
VJ
1745
1746 AC_DEFINE([HAVE_NAPATECH],[1],(Napatech capture card support))
844e4dba
MK
1747 fi
1748
e366c62c
VJ
1749 # liblua
1750 AC_ARG_ENABLE(lua,
1751 AS_HELP_STRING([--enable-lua],[Enable Lua support]),
1752 [ enable_lua="yes"],
1753 [ enable_lua="no"])
ba81c4d2
VJ
1754 AC_ARG_ENABLE(luajit,
1755 AS_HELP_STRING([--enable-luajit],[Enable Luajit support]),
1756 [ enable_luajit="yes"],
1757 [ enable_luajit="no"])
1758 if test "$enable_lua" = "yes"; then
1759 if test "$enable_luajit" = "yes"; then
1760 echo "ERROR: can't enable liblua and luajit at the same time."
1761 echo "For LuaJIT, just use --enable-luajit. For liblua (no jit)"
1762 echo "support, use just --enable-lua."
1763 echo "Both options will enable the Lua scripting capabilities"
1764 echo "in Suricata".
1765 echo
1766 exit 1
1767 fi
1768 fi
1769
e366c62c
VJ
1770 AC_ARG_WITH(liblua_includes,
1771 [ --with-liblua-includes=DIR liblua include directory],
1772 [with_liblua_includes="$withval"],[with_liblua_includes="no"])
1773 AC_ARG_WITH(liblua_libraries,
1774 [ --with-liblua-libraries=DIR liblua library directory],
1775 [with_liblua_libraries="$withval"],[with_liblua_libraries="no"])
1776
1777 if test "$enable_lua" = "yes"; then
1778 if test "$with_liblua_includes" != "no"; then
1779 CPPFLAGS="${CPPFLAGS} -I${with_liblua_includes}"
1780 else
da1fe759
VJ
1781 # lua lua51 lua5.1 lua-5.1
1782 PKG_CHECK_MODULES([LUA], [lua], [LUA="yes"], [
1783 PKG_CHECK_MODULES([LUA], [lua5.1], [LUA="yes"], [
1784 PKG_CHECK_MODULES([LUA], [lua-5.1], [LUA="yes"], [
1785 PKG_CHECK_MODULES([LUA], [lua51], [LUA="yes"], [
1786 LUA="no"
1787 ])
1788 ])
1789 ])
1790 ])
e366c62c
VJ
1791 CPPFLAGS="${CPPFLAGS} ${LUA_CFLAGS}"
1792 fi
1793
1794 AC_CHECK_HEADER(lualib.h,LUA="yes",LUA="no")
1795 if test "$LUA" = "yes"; then
1796 if test "$with_liblua_libraries" != "no"; then
1797 LDFLAGS="${LDFLAGS} -L${with_liblua_libraries}"
da1fe759
VJ
1798 AC_CHECK_LIB(${LUA_LIB_NAME}, luaL_openlibs,, LUA="no")
1799 if test "$LUA" = "no"; then
1800 echo
1801 echo " ERROR! liblua library not found, go get it"
1802 echo " from http://lua.org/index.html or your distribution:"
1803 echo
5db32204 1804 echo " Ubuntu: apt-get install liblua5.1-dev"
da1fe759
VJ
1805 echo " CentOS/Fedora: yum install lua-devel"
1806 echo
1807 echo " If you installed software in a non-standard prefix"
1808 echo " consider adjusting the PKG_CONFIG_PATH environment variable"
1809 echo " or use --with-liblua-libraries configure option."
1810 echo
1811 exit 1
1812 fi
e366c62c 1813 else
da1fe759
VJ
1814 # lua lua51 lua5.1 lua-5.1
1815 PKG_CHECK_MODULES([LUA], [lua], [LUA="yes"], [
1816 PKG_CHECK_MODULES([LUA], [lua5.1], [LUA="yes"], [
1817 PKG_CHECK_MODULES([LUA], [lua-5.1], [LUA="yes"], [
1818 PKG_CHECK_MODULES([LUA], [lua51], [LUA="yes"], [
1819 LUA="no"
1820 ])
1821 ])
1822 ])
1823 ])
e366c62c
VJ
1824 LDFLAGS="${LDFLAGS} ${LUA_LIBS}"
1825 fi
1826
6228f5f6
VJ
1827 if test "$LUA" = "no"; then
1828 AC_CHECK_LIB(lua, luaL_openlibs,, LUA="no")
1829 fi
1830
1831 if test "$LUA" = "yes"; then
1832 AC_DEFINE([HAVE_LUA],[1],[liblua available])
1833 enable_lua="yes"
1834 fi
e366c62c
VJ
1835 else
1836 echo
1837 echo " ERROR! liblua headers not found, go get them"
1838 echo " from http://lua.org/index.html or your distribution:"
1839 echo
5db32204 1840 echo " Ubuntu: apt-get install liblua5.1-dev"
da1fe759 1841 echo " CentOS/Fedora: yum install lua-devel"
e366c62c
VJ
1842 echo
1843 echo " If you installed software in a non-standard prefix"
1844 echo " consider adjusting the PKG_CONFIG_PATH environment variable"
1845 echo " or use --with-liblua-includes and --with-liblua-libraries"
1846 echo " configure option."
1847 echo
1848 exit 1
1849 fi
1850 fi
1851
5b2fbfb1 1852 # libluajit
5b2fbfb1
VJ
1853 AC_ARG_WITH(libluajit_includes,
1854 [ --with-libluajit-includes=DIR libluajit include directory],
c9cc137d 1855 [with_libluajit_includes="$withval"],[with_libluajit_includes="no"])
5b2fbfb1
VJ
1856 AC_ARG_WITH(libluajit_libraries,
1857 [ --with-libluajit-libraries=DIR libluajit library directory],
1858 [with_libluajit_libraries="$withval"],[with_libluajit_libraries="no"])
1859
c9cc137d
VJ
1860 if test "$enable_luajit" = "yes"; then
1861 if test "$with_libluajit_includes" != "no"; then
1862 CPPFLAGS="${CPPFLAGS} -I${with_libluajit_includes}"
819debdc 1863 else
344ea3fa 1864 PKG_CHECK_MODULES([LUAJIT], [luajit], , LUAJIT="no")
819debdc 1865 CPPFLAGS="${CPPFLAGS} ${LUAJIT_CFLAGS}"
5b2fbfb1
VJ
1866 fi
1867
c9cc137d
VJ
1868 AC_CHECK_HEADER(lualib.h,LUAJIT="yes",LUAJIT="no")
1869 if test "$LUAJIT" = "yes"; then
1870 if test "$with_libluajit_libraries" != "no"; then
1871 LDFLAGS="${LDFLAGS} -L${with_libluajit_libraries}"
819debdc
EL
1872 else
1873 PKG_CHECK_MODULES([LUAJIT], [luajit])
1874 LDFLAGS="${LDFLAGS} ${LUAJIT_LIBS}"
c9cc137d 1875 fi
5b2fbfb1 1876
c9cc137d 1877 AC_CHECK_LIB(luajit-5.1, luaL_openlibs,, LUAJIT="no")
5b2fbfb1 1878
c9cc137d
VJ
1879 if test "$LUAJIT" = "no"; then
1880 echo
1881 echo " ERROR! libluajit library not found, go get it"
1882 echo " from http://luajit.org/index.html or your distribution:"
1883 echo
1884 echo " Ubuntu: apt-get install libluajit-5.1-dev"
1885 echo
344ea3fa
EL
1886 echo " If you installed software in a non-standard prefix"
1887 echo " consider adjusting the PKG_CONFIG_PATH environment variable"
1888 echo " or use --with-libluajit-libraries configure option."
1889 echo
c9cc137d
VJ
1890 exit 1
1891 fi
1892
e366c62c 1893 AC_DEFINE([HAVE_LUA],[1],[lua support available])
c9cc137d 1894 AC_DEFINE([HAVE_LUAJIT],[1],[libluajit available])
ba81c4d2 1895 enable_lua="yes, through luajit"
c9cc137d 1896 enable_luajit="yes"
e125869d
EL
1897 else
1898 echo
1899 echo " ERROR! libluajit headers not found, go get them"
1900 echo " from http://luajit.org/index.html or your distribution:"
1901 echo
1902 echo " Ubuntu: apt-get install libluajit-5.1-dev"
1903 echo
344ea3fa
EL
1904 echo " If you installed software in a non-standard prefix"
1905 echo " consider adjusting the PKG_CONFIG_PATH environment variable"
1906 echo " or use --with-libluajit-includes and --with-libluajit-libraries"
1907 echo " configure option."
1908 echo
e125869d 1909 exit 1
c9cc137d 1910 fi
5b2fbfb1
VJ
1911 fi
1912
9d687025
JI
1913 AM_CONDITIONAL([HAVE_LUA], [test "x$enable_lua" != "xno"])
1914
d771e081
IS
1915 # libgeoip
1916 AC_ARG_ENABLE(geoip,
6913109b 1917 AS_HELP_STRING([--enable-geoip],[Enable GeoIP support]),
d771e081
IS
1918 [ enable_geoip="yes"],
1919 [ enable_geoip="no"])
1920 AC_ARG_WITH(libgeoip_includes,
1921 [ --with-libgeoip-includes=DIR libgeoip include directory],
1922 [with_libgeoip_includes="$withval"],[with_libgeoip_includes="no"])
1923 AC_ARG_WITH(libgeoip_libraries,
1924 [ --with-libgeoip-libraries=DIR libgeoip library directory],
1925 [with_libgeoip_libraries="$withval"],[with_libgeoip_libraries="no"])
1926
1927 if test "$enable_geoip" = "yes"; then
1928 if test "$with_libgeoip_includes" != "no"; then
1929 CPPFLAGS="${CPPFLAGS} -I${with_libgeoip_includes}"
1930 fi
1931
1932 AC_CHECK_HEADER(GeoIP.h,GEOIP="yes",GEOIP="no")
1933 if test "$GEOIP" = "yes"; then
1934 if test "$with_libgeoip_libraries" != "no"; then
ba81c4d2 1935 LDFLAGS="${LDFLAGS} -L${with_libgeoip_libraries}"
d771e081
IS
1936 fi
1937 AC_CHECK_LIB(GeoIP, GeoIP_country_code_by_ipnum,, GEOIP="no")
1938 fi
1939 if test "$GEOIP" = "no"; then
1940 echo
1941 echo " ERROR! libgeoip library not found, go get it"
1942 echo " from http://www.maxmind.com/en/geolite or your distribution:"
1943 echo
1944 echo " Ubuntu: apt-get install libgeoip-dev"
8f190249 1945 echo " Fedora: yum install GeoIP-devel"
d771e081
IS
1946 echo
1947 exit 1
1948 fi
ba81c4d2
VJ
1949
1950 AC_DEFINE([HAVE_GEOIP],[1],[libgeoip available])
1951 enable_geoip="yes"
d771e081
IS
1952 fi
1953
437fe406
AG
1954 # Position Independent Executable
1955 AC_ARG_ENABLE(pie,
1956 AS_HELP_STRING([--enable-pie],[Enable compiling as a position independent executable]),
1957 [ enable_pie="yes"],
1958 [ enable_pie="no"])
1959 if test "$enable_pie" = "yes"; then
1960 CPPFLAGS="${CPPFLAGS} -fPIC"
1961 LDFLAGS="${LDFLAGS} -pie"
1962 fi
1963
a64e5e77 1964#libevent includes and libraries
1965 AC_ARG_WITH(libevent_includes,
1966 [ --with-libevent-includes=DIR libevent include directory],
1967 [with_libevent_includes="$withval"],[with_libevent_includes="no"])
1968 AC_ARG_WITH(libevent_libraries,
1969 [ --with-libevent-libraries=DIR libevent library directory],
1970 [with_libevent_libraries="$withval"],[with_libevent_libraries="no"])
1971
eef5678e
EL
1972# libhiredis
1973 AC_ARG_ENABLE(hiredis,
1974 AS_HELP_STRING([--enable-hiredis],[Enable Redis support]),
1975 [ enable_hiredis="yes"],
1976 [ enable_hiredis="no"])
1977 AC_ARG_WITH(libhiredis_includes,
1978 [ --with-libhiredis-includes=DIR libhiredis include directory],
1979 [with_libhiredis_includes="$withval"],[with_libhiredis_includes="no"])
1980 AC_ARG_WITH(libhiredis_libraries,
1981 [ --with-libhiredis-libraries=DIR libhiredis library directory],
1982 [with_libhiredis_libraries="$withval"],[with_libhiredis_libraries="no"])
1983
a64e5e77 1984 enable_hiredis_async="no"
eef5678e
EL
1985 if test "$enable_hiredis" = "yes"; then
1986 if test "$with_libhiredis_includes" != "no"; then
1987 CPPFLAGS="${CPPFLAGS} -I${with_libhiredis_includes}"
1988 fi
1989
1990 AC_CHECK_HEADER("hiredis/hiredis.h",HIREDIS="yes",HIREDIS="no")
1991 if test "$HIREDIS" = "yes"; then
1992 if test "$with_libhiredis_libraries" != "no"; then
1993 LDFLAGS="${LDFLAGS} -L${with_libhiredis_libraries}"
1994 fi
1995 AC_CHECK_LIB(hiredis, redisConnect,, HIREDIS="no")
1996 fi
1997 if test "$HIREDIS" = "no"; then
1998 echo
1999 echo " ERROR! libhiredis library not found, go get it"
2000 echo " from https://github.com/redis/hiredis or your distribution:"
2001 echo
2002 echo " Ubuntu: apt-get install libhiredis-dev"
80bd59ae
VJ
2003 echo " Fedora: dnf install hiredis-devel"
2004 echo " RHEL/CentOS: yum install hiredis-devel"
eef5678e
EL
2005 echo
2006 exit 1
2007 fi
2008 if test "$HIREDIS" = "yes"; then
2009 AC_DEFINE([HAVE_LIBHIREDIS],[1],[libhiredis available])
2010 enable_hiredis="yes"
a64e5e77 2011 #
2012 # Check if async adapters and libevent is installed
2013 #
2014 AC_CHECK_HEADER("hiredis/adapters/libevent.h",HIREDIS_LIBEVENT_ADAPTER="yes",HIREDIS_LIBEVENT_ADAPTER="no")
2015 if test "$HIREDIS_LIBEVENT_ADAPTER" = "yes"; then
2016 #Look for libevent headers
2017 if test "$with_libevent_includes" != "no"; then
2018 CPPFLAGS="${CPPFLAGS} -I${with_libevent_includes}"
2019 fi
2020 AC_CHECK_HEADER("event.h",LIBEVENT="yes",LIBEVENT="no")
2021 if test "$LIBEVENT" = "yes"; then
2022 if test "$with_libevent_libraries" != "no"; then
2023 LDFLAGS="${LDFLAGS} -L${with_libevent_libraries}"
2024 fi
2025 AC_CHECK_LIB(event, event_base_free,, HAVE_LIBEVENT="no")
2026 AC_CHECK_LIB(event_pthreads, evthread_use_pthreads,, HAVE_LIBEVENT_PTHREADS="no")
2027 fi
7ea80b5c 2028 if [ test "$HAVE_LIBEVENT" = "no" ] && [ -o test "$HAVE_LIBEVENT_PTHREADS" = "no"]; then
a64e5e77 2029 if test "$HAVE_LIBEVENT" = "no"; then
2030 echo
2031 echo " Async mode for redis output will not be available."
2032 echo " To enable it install libevent"
2033 echo
2034 echo " Ubuntu: apt-get install libevent-dev"
0f41172c 2035 echo " Fedora: dnf install libevent-devel"
2036 echo " RHEL/CentOS: yum install libevent-devel"
a64e5e77 2037 echo
2038 fi
2039 if test "$HAVE_LIBEVENT_PTHREADS" = "no"; then
2040 echo
2041 echo " Async mode for redis output will not be available."
2042 echo " To enable it install libevent with pthreads support"
2043 echo
2044 echo " Ubuntu: apt-get install libevent-pthreads-2.0-5"
2045 echo
2046 fi
2047 else
2048 AC_DEFINE([HAVE_LIBEVENT],[1],[libevent available])
2049 enable_hiredis_async="yes"
2050 fi
2051 fi
eef5678e
EL
2052 fi
2053 fi
2054
724ad9e8
VJ
2055# get cache line size
2056 AC_PATH_PROG(HAVE_GETCONF_CMD, getconf, "no")
2057 if test "$HAVE_GETCONF_CMD" != "no"; then
2058 CLS=$(getconf LEVEL1_DCACHE_LINESIZE)
fdc3b5ba 2059 if [test "$CLS" != "" && test "$CLS" != "0"]; then
0ddd57cb 2060 AC_DEFINE_UNQUOTED([CLS],[${CLS}],[L1 cache line size])
71c22ddf 2061 else
ba81c4d2 2062 AC_DEFINE([CLS],[64],[L1 cache line size])
0ddd57cb 2063 fi
71c22ddf 2064 else
ba81c4d2 2065 AC_DEFINE([CLS],[64],[L1 cache line size])
724ad9e8 2066 fi
d771e081 2067
6eedd006
JI
2068# sphinx for documentation
2069 AC_PATH_PROG(HAVE_SPHINXBUILD, sphinx-build, "no")
2070 if test "$HAVE_SPHINXBUILD" = "no"; then
2071 enable_sphinxbuild=no
7fa390de
JI
2072 if test -e "$srcdir/doc/userguide/suricata.1"; then
2073 have_suricata_man=yes
2074 fi
6eedd006
JI
2075 fi
2076 AM_CONDITIONAL([HAVE_SPHINXBUILD], [test "x$enable_sphinxbuild" != "xno"])
7fa390de 2077 AM_CONDITIONAL([HAVE_SURICATA_MAN], [test "x$have_suricata_man" = "xyes"])
6eedd006 2078
0792f809
JI
2079# pdflatex for the pdf version of the user manual
2080 AC_PATH_PROG(HAVE_PDFLATEX, pdflatex, "no")
2081 if test "$HAVE_PDFLATEX" = "no"; then
2082 enable_pdflatex=no
2083 fi
2084 AM_CONDITIONAL([HAVE_PDFLATEX], [test "x$enable_pdflatex" != "xno"])
2085
8f81792d 2086# Cargo/Rust.
d00b914d 2087 AC_ARG_ENABLE([rust], AS_HELP_STRING([--enable-rust], [Enable Experimental Rust support]))
4fe9292e 2088
9dab3ec7
VJ
2089 rust_config_enabled="no" # used in suricata.yaml.in to enable/disable app-layers
2090 rust_config_comment="#" # used in suricata.yaml.in to enable/disable eve loggers
8f81792d
JI
2091 rust_vendor_comment="# "
2092 have_rust_vendor="no"
2093
2094 if test "x$enable_rust" != "xyes"; then
2095 enable_rust="no"
2096 else
fd025ba3
JI
2097 # Rust require jansson (json support).
2098 if test "x$enable_jansson" = "xno"; then
2099 echo ""
2100 echo " ERROR! Rust support requires jansson."
2101 echo ""
2102 exit 1
2103 fi
2104
8f81792d
JI
2105 AC_PATH_PROG(HAVE_CARGO, cargo, "no")
2106 AC_PATH_PROG(HAVE_RUSTC, rustc, "no")
2107
2108 # Deal with the case where Rust was requested but rustc or cargo
2109 # cannot be found.
2110 if test "x$HAVE_CARGO" = "xno"; then
2111 echo ""
2112 echo " ERROR! Rust support requested but cargo not found."
2113 echo ""
2114 exit 1
2115 fi
2116 if test "x$HAVE_RUST" = "xno"; then
2117 echo ""
2118 echo " ERROR! Rust support requested but rustc not found."
2119 echo ""
2120 exit 1
2121 fi
2122
2123 if test "x$HAVE_CARGO" != "xno"; then
2124 if test "x$HAVE_RUSTC" != "xno"; then
2125 enable_rust="yes"
2126 AC_DEFINE([HAVE_RUST],[1],[Enable Rust language])
2127 if test "x$enable_debug" = "xyes"; then
48566358 2128 RUST_SURICATA_LIB="../rust/target/debug/${RUST_SURICATA_LIBNAME}"
8f81792d 2129 else
48566358 2130 RUST_SURICATA_LIB="../rust/target/release/${RUST_SURICATA_LIBNAME}"
8f81792d
JI
2131 fi
2132 RUST_LDADD="${RUST_SURICATA_LIB} ${RUST_LDADD}"
61d9f4bb 2133 CFLAGS="${CFLAGS} -I\${srcdir}/../rust/gen/c-headers"
8f81792d
JI
2134 AC_SUBST(RUST_SURICATA_LIB)
2135 AC_SUBST(RUST_LDADD)
9dab3ec7
VJ
2136 AC_SUBST([CARGO], [$HAVE_CARGO])
2137 if test "x$CARGO_HOME" = "x"; then
2138 AC_SUBST([CARGO_HOME], [~/.cargo])
2139 else
2140 AC_SUBST([CARGO_HOME], [$CARGO_HOME])
2141 fi
8f81792d
JI
2142 AC_CHECK_FILES([$srcdir/rust/vendor], [have_rust_vendor="yes"])
2143 if test "x$have_rust_vendor" = "xyes"; then
9dab3ec7 2144 rust_vendor_comment=""
8f81792d 2145 fi
9dab3ec7
VJ
2146
2147 rust_config_enabled="yes"
2148 rust_config_comment=""
8f81792d
JI
2149 fi
2150 fi
2151 fi
2152
2153 AM_CONDITIONAL([HAVE_RUST], [test "x$enable_rust" = "xyes"])
2154 AC_SUBST(rust_vendor_comment)
9dab3ec7
VJ
2155 AC_SUBST(rust_config_enabled)
2156 AC_SUBST(rust_config_comment)
8f81792d
JI
2157 AM_CONDITIONAL([HAVE_RUST_VENDOR], [test "x$have_rust_vendor" = "xyes"])
2158
2159 if test "x$enable_rust" = "xyes"; then
2160 AC_PATH_PROG(HAVE_CARGO_VENDOR, cargo-vendor, "no")
2161 if test "x$HAVE_CARGO_VENDOR" = "xno"; then
2162 echo " Warning: cargo-vendor not found, but it is only required"
2163 echo " for building the distribution"
2164 echo " To install: cargo install cargo-vendor"
2165 fi
2166 fi
2167 AM_CONDITIONAL([HAVE_CARGO_VENDOR], [test "x$HAVE_CARGO_VENDOR" != "xno"])
2168
6a4cefb7
JI
2169 AC_ARG_ENABLE(rust_strict,
2170 AS_HELP_STRING([--enable-rust-strict], [Rust warnings as errors]),,[enable_rust_strict=no])
2171 AS_IF([test "x$enable_rust_strict" = "xyes"], [
2172 RUST_FEATURES="strict"
2173 ])
2174 AC_SUBST(RUST_FEATURES)
2175
6c251b85
VJ
2176 AC_ARG_ENABLE(rust_debug,
2177 AS_HELP_STRING([--enable-rust-debug], [Rust not in --release mode]),,[enable_rust_debug=no])
2178 AM_CONDITIONAL([RUST_DEBUG], [test "x$enable_rust_debug" = "xyes"])
2179 AC_SUBST(RUST_DEBUG)
2180
e3bde3e9
VJ
2181# get revision
2182 if test -f ./revision; then
2183 REVISION=`cat ./revision`
ba81c4d2 2184 AC_DEFINE_UNQUOTED([REVISION],[${REVISION}],[Git revision])
e3bde3e9 2185 else
042d0c6e
VJ
2186 AC_PATH_PROG(HAVE_GIT_CMD, git, "no")
2187 if test "$HAVE_GIT_CMD" != "no"; then
5886ef82
VJ
2188 if [ test -d .git ]; then
2189 REVISION=`git rev-parse --short HEAD`
ba81c4d2 2190 AC_DEFINE_UNQUOTED([REVISION],[${REVISION}],[Git revision])
5886ef82 2191 fi
e3bde3e9
VJ
2192 fi
2193 fi
2194
0ffa1c24
WM
2195AC_SUBST(CFLAGS)
2196AC_SUBST(LDFLAGS)
2197AC_SUBST(CPPFLAGS)
2198
25804f5a
EL
2199define([EXPAND_VARIABLE],
2200[$2=[$]$1
2201if test $prefix = 'NONE'; then
2202 prefix="/usr/local"
2203fi
2204while true; do
2205 case "[$]$2" in
2206 *\[$]* ) eval "$2=[$]$2" ;;
2207 *) break ;;
2208 esac
2209done
2210eval "$2=[$]$2$3"
2211])dnl EXPAND_VARIABLE
2212
2213# suricata log dir
2214if test "$WINDOWS_PATH" = "yes"; then
6b751621
VJ
2215 case $host in
2216 x86_64-w64-mingw32)
2217 e_winbase="C:\\\\Program Files\\\\Suricata"
2218 ;;
2219 *)
2220 systemtype="`systeminfo | grep \"based PC\"`"
2221 case "$systemtype" in
2222 *x64*)
2223 e_winbase="C:\\\\Program Files (x86)\\\\Suricata"
2224 ;;
2225 *)
2226 e_winbase="C:\\\\Program Files\\\\Suricata"
2227 ;;
2228 esac
2229 esac
d8356c5e 2230
6b751621
VJ
2231 e_sysconfdir="${e_winbase}\\\\"
2232 e_sysconfrulesdir="$e_winbase\\\\rules\\\\"
2233 e_magic_file="$e_winbase\\\\magic.mgc"
2234 e_logdir="$e_winbase\\\\log"
2235 e_logfilesdir="$e_logdir\\\\files"
2236 e_logcertsdir="$e_logdir\\\\certs"
25804f5a 2237else
6b751621
VJ
2238 EXPAND_VARIABLE(localstatedir, e_logdir, "/log/suricata/")
2239 EXPAND_VARIABLE(localstatedir, e_rundir, "/run/")
2240 EXPAND_VARIABLE(localstatedir, e_logfilesdir, "/log/suricata/files")
2241 EXPAND_VARIABLE(localstatedir, e_logcertsdir, "/log/suricata/certs")
2242 EXPAND_VARIABLE(sysconfdir, e_sysconfdir, "/suricata/")
2243 EXPAND_VARIABLE(sysconfdir, e_sysconfrulesdir, "/suricata/rules")
2244 EXPAND_VARIABLE(localstatedir, e_localstatedir, "/run/suricata")
25804f5a
EL
2245fi
2246AC_SUBST(e_logdir)
1c3546fe 2247AC_SUBST(e_rundir)
d8356c5e 2248AC_SUBST(e_logfilesdir)
55625d73 2249AC_SUBST(e_logcertsdir)
25804f5a 2250AC_SUBST(e_sysconfdir)
d8356c5e 2251AC_SUBST(e_sysconfrulesdir)
20a8b9db 2252AC_SUBST(e_localstatedir)
d8356c5e 2253AC_DEFINE_UNQUOTED([CONFIG_DIR],["$e_sysconfdir"],[Our CONFIG_DIR])
25804f5a 2254AC_SUBST(e_magic_file)
15c98c60 2255AC_SUBST(e_magic_file_comment)
f55dbca5 2256AC_SUBST(e_enable_evelog)
25804f5a 2257
ba81c4d2
VJ
2258EXPAND_VARIABLE(prefix, CONFIGURE_PREFIX)
2259EXPAND_VARIABLE(sysconfdir, CONFIGURE_SYSCONDIR)
2260EXPAND_VARIABLE(localstatedir, CONFIGURE_LOCALSTATEDIR)
2261AC_SUBST(CONFIGURE_PREFIX)
2262AC_SUBST(CONFIGURE_SYSCONDIR)
2263AC_SUBST(CONFIGURE_LOCALSTATEDIR)
8f81792d 2264AC_SUBST(PACKAGE_VERSION)
ba81c4d2 2265
a7d90162 2266AC_OUTPUT(Makefile src/Makefile rust/Makefile rust/Cargo.toml rust/.cargo/config qa/Makefile qa/coccinelle/Makefile rules/Makefile doc/Makefile doc/userguide/Makefile contrib/Makefile contrib/file_processor/Makefile contrib/file_processor/Action/Makefile contrib/file_processor/Processor/Makefile contrib/tile_pcie_logd/Makefile suricata.yaml etc/Makefile etc/suricata.logrotate etc/suricata.service python/Makefile python/bin/suricatasc ebpf/Makefile)
a098e39b 2267
668113af 2268SURICATA_BUILD_CONF="Suricata Configuration:
73a1b972 2269 AF_PACKET support: ${enable_af_packet}
91e1256b 2270 eBPF support: ${enable_ebpf}
8c880879 2271 XDP support: ${have_xdp}
73a1b972 2272 PF_RING support: ${enable_pfring}
ef463457 2273 NFQueue support: ${enable_nfqueue}
4851568a 2274 NFLOG support: ${enable_nflog}
ef463457 2275 IPFW support: ${enable_ipfw}
10104066 2276 Netmap support: ${enable_netmap}
73a1b972 2277 DAG enabled: ${enable_dag}
37e3de84 2278 Napatech enabled: ${enable_napatech}
ba81c4d2 2279
20a8b9db 2280 Unix socket enabled: ${enable_unixsocket}
f4872a2f 2281 Detection enabled: ${enable_detection}
73a1b972 2282
810e43f3 2283 Libmagic support: ${enable_magic}
89cee0ad
VJ
2284 libnss support: ${enable_nss}
2285 libnspr support: ${enable_nspr}
20a8b9db 2286 libjansson support: ${enable_jansson}
b60065ca 2287 liblzma support: ${enable_liblzma}
eef5678e 2288 hiredis support: ${enable_hiredis}
a64e5e77 2289 hiredis async with libevent: ${enable_hiredis_async}
ef463457 2290 Prelude support: ${enable_prelude}
73a1b972 2291 PCRE jit: ${pcre_jit_available}
e366c62c 2292 LUA support: ${enable_lua}
5b2fbfb1 2293 libluajit: ${enable_luajit}
d771e081 2294 libgeoip: ${enable_geoip}
73a1b972
VJ
2295 Non-bundled htp: ${enable_non_bundled_htp}
2296 Old barnyard2 support: ${enable_old_barnyard2}
13b87f5a 2297 Hyperscan support: ${enable_hyperscan}
439b62fe 2298 Libnet support: ${enable_libnet}
73a1b972 2299
d00b914d 2300 Rust support (experimental): ${enable_rust}
6a4cefb7 2301 Rust strict mode: ${enable_rust_strict}
6c251b85 2302 Rust debug mode: ${enable_rust_debug}
8f81792d 2303
cd305c3a
EL
2304 Suricatasc install: ${enable_python}
2305
ef463457 2306 Profiling enabled: ${enable_profiling}
d908e707 2307 Profiling locks enabled: ${enable_profiling_locks}
439b62fe
VJ
2308
2309Development settings:
7fb860ac 2310 Coccinelle / spatch: ${enable_coccinelle}
439b62fe
VJ
2311 Unit tests enabled: ${enable_unittests}
2312 Debug output enabled: ${enable_debug}
2313 Debug validation enabled: ${enable_debug_validation}
ef463457
EL
2314
2315Generic build parameters:
ba81c4d2
VJ
2316 Installation prefix: ${prefix}
2317 Configuration directory: ${e_sysconfdir}
2318 Log directory: ${e_logdir}
2319
2320 --prefix ${CONFIGURE_PREFIX}
2321 --sysconfdir ${CONFIGURE_SYSCONDIR}
2322 --localstatedir ${CONFIGURE_LOCALSTATEDIR}
73a1b972 2323
ef463457 2324 Host: ${host}
ba81c4d2 2325 Compiler: ${CC} (exec name) / ${compiler} (real)
ef463457
EL
2326 GCC Protect enabled: ${enable_gccprotect}
2327 GCC march native enabled: ${enable_gccmarch_native}
ba81c4d2 2328 GCC Profile enabled: ${enable_gccprofile}
437fe406 2329 Position Independent Executable enabled: ${enable_pie}
ba81c4d2
VJ
2330 CFLAGS ${CFLAGS}
2331 PCAP_CFLAGS ${PCAP_CFLAGS}
2332 SECCFLAGS ${SECCFLAGS}"
668113af
EL
2333
2334echo
2335echo "$SURICATA_BUILD_CONF"
4749420f
VJ
2336echo "printf(" >src/build-info.h
2337echo "$SURICATA_BUILD_CONF" | sed -e 's/^/"/' | sed -e 's/$/\\n"/' >>src/build-info.h
2338echo ");" >>src/build-info.h
25804f5a 2339
668113af 2340echo "
25804f5a 2341To build and install run 'make' and 'make install'.
73a1b972 2342
697e9e66
VJ
2343You can run 'make install-conf' if you want to install initial configuration
2344files to ${e_sysconfdir}. Running 'make install-full' will install configuration
2345and rules and provide you a ready-to-run suricata."
73a1b972
VJ
2346echo
2347echo "To install Suricata into /usr/bin/suricata, have the config in
2348/etc/suricata and use /var/log/suricata as log dir, use:
697e9e66
VJ
2349./configure --prefix=/usr/ --sysconfdir=/etc/ --localstatedir=/var/"
2350echo