]> git.ipfire.org Git - people/ms/suricata.git/blob - configure.ac
configure.ac: remove AC_CHECK_FILE
[people/ms/suricata.git] / configure.ac
1 AC_INIT([suricata],[5.0.1-dev])
2 m4_ifndef([AM_SILENT_RULES], [m4_define([AM_SILENT_RULES],[])])AM_SILENT_RULES([yes])
3 AC_CONFIG_HEADERS([config.h])
4 AC_CONFIG_SRCDIR([src/suricata.c])
5 AC_CONFIG_MACRO_DIR(m4)
6 AM_INIT_AUTOMAKE([tar-ustar])
7
8 AC_LANG([C])
9 AC_PROG_CC_C99
10 LT_INIT
11 PKG_PROG_PKG_CONFIG
12
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 AC_ARG_WITH([clang],
33 [ --with-clang=PROGRAM path to Clang for compiling eBPF code. Use if the main C compiler is not Clang.],
34 [CLANG="$withval"],
35 [AS_IF([test "$compiler" = clang],
36 [CLANG="$CC"],
37 [AC_PATH_PROG([CLANG],[clang])])])
38
39 AC_SUBST([CLANG])
40
41 case "$compiler" in
42 clang)
43 CLANG_CFLAGS="-Wextra -Werror-implicit-function-declaration -Wno-error=unused-command-line-argument"
44 AC_MSG_CHECKING([clang __sync_bool_compare_and_swap support])
45 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>]],
46 [[ unsigned int i = 0; (void)__sync_bool_compare_and_swap(&i, 1, 1);]])],
47 [
48 AC_DEFINE([__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1], [1], [Fake GCC atomic support])
49 AC_DEFINE([__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2], [1], [Fake GCC atomic support])
50 AC_DEFINE([__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4], [1], [Fake GCC atomic support])
51 AC_DEFINE([__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8], [1], [Fake GCC atomic support])
52 AC_MSG_RESULT([yes])],
53 [AC_MSG_RESULT([no])])
54 AC_SUBST(CLANG_CFLAGS)
55 ;;
56 gcc)
57 dnl get gcc version
58 AC_MSG_CHECKING([gcc version])
59 gccver=$($CC -dumpversion)
60 gccvermajor=$(echo $gccver | cut -d . -f1)
61 gccverminor=$(echo $gccver | cut -d . -f2)
62 gccvernum=$(expr $gccvermajor "*" 100 + $gccverminor)
63 AC_MSG_RESULT($gccver)
64
65 if test "$gccvernum" -ge "400"; then
66 dnl gcc 4.0 or later
67 GCC_CFLAGS="-Wextra -Werror-implicit-function-declaration"
68 else
69 GCC_CFLAGS="-W"
70 fi
71 AC_SUBST(GCC_CFLAGS)
72 ;;
73 *)
74 AC_MSG_WARN([unsupported/untested compiler, this may or may not work])
75 ;;
76 esac
77
78 # Checks for programs.
79 AC_PROG_AWK
80 AC_PROG_CC
81 AC_PROG_CPP
82 AC_PROG_INSTALL
83 AC_PROG_LN_S
84 AC_PROG_MAKE_SET
85 AC_PROG_GREP
86
87 AC_PATH_PROG(HAVE_CYGPATH, cygpath, "no")
88 AM_CONDITIONAL([HAVE_CYGPATH], [test "x$enable_cygpath" = "xyes"])
89
90 AC_PATH_PROG(HAVE_PKG_CONFIG, pkg-config, "no")
91 if test "$HAVE_PKG_CONFIG" = "no"; then
92 echo
93 echo " ERROR! pkg-config not found, go get it "
94 echo " http://pkg-config.freedesktop.org/wiki/ "
95 echo " or install from your distribution "
96 echo
97 exit 1
98 fi
99
100 python_path="not set"
101
102 AC_ARG_ENABLE(python,
103 AS_HELP_STRING([--enable-python], [Enable python]),
104 [enable_python=$enableval],[enable_python=yes])
105 if test "x$enable_python" != "xyes"; then
106 enable_python="no"
107 else
108 AC_PATH_PROGS(HAVE_PYTHON, python3 python2.7 python2 python, "no")
109 if test "$HAVE_PYTHON" = "no"; then
110 echo
111 echo " Warning! Python not found."
112 echo
113 echo " Python is required for additional tools like"
114 echo " suricatasc, suricatactl and suricata-update."
115 echo " It is also required when building from git."
116 echo
117 enable_python="no"
118 else
119 python_path="$HAVE_PYTHON"
120 fi
121 fi
122 AM_CONDITIONAL([HAVE_PYTHON], [test "x$enable_python" = "xyes"])
123
124 # Get the Python major version. This is only for information
125 # messages displayed during configure.
126 if test "x$HAVE_PYTHON" != "xno"; then
127 pymv="$($HAVE_PYTHON -c 'import sys; print(sys.version_info[[0]]);')"
128 fi
129
130 # Check for python-distutils (setup).
131 have_python_distutils="no"
132 if test "x$enable_python" = "xyes"; then
133 AC_MSG_CHECKING([for python-distutils])
134 if $HAVE_PYTHON -c "import distutils; from distutils.core import setup" 2>/dev/null; then
135 AC_MSG_RESULT([yes])
136 have_python_distutils="yes"
137 else
138 AC_MSG_RESULT([no])
139 fi
140 fi
141 AM_CONDITIONAL([HAVE_PYTHON_DISTUTILS],
142 [test "x$have_python_distutils" = "xyes"])
143 if test "$have_python_distutils" = "no"; then
144 echo ""
145 echo " Warning: Python distutils not found. Python tools will"
146 echo " not be installed."
147 echo ""
148 echo " Install the distutils module for Python ${pymv} to enable"
149 echo " the Python tools."
150 echo ""
151 fi
152
153 # Check for python-yaml.
154 have_python_yaml="no"
155 if test "x$enable_python" = "xyes"; then
156 AC_MSG_CHECKING([for python-yaml])
157 if $HAVE_PYTHON -c "import yaml" 2>/dev/null; then
158 have_python_yaml="yes"
159 AC_MSG_RESULT([yes])
160 else
161 AC_MSG_RESULT([no])
162 fi
163 fi
164 AM_CONDITIONAL([HAVE_PYTHON_YAML], [test "x$have_python_yaml" = "xyes"])
165
166 AC_PATH_PROG(HAVE_WGET, wget, "no")
167 if test "$HAVE_WGET" = "no"; then
168 AC_PATH_PROG(HAVE_CURL, curl, "no")
169 if test "$HAVE_CURL" = "no"; then
170 echo
171 echo " Warning curl or wget not found, you won't be able to"
172 echo " download latest ruleset with 'make install-rules'"
173 fi
174 fi
175 AM_CONDITIONAL([HAVE_FETCH_COMMAND], [test "x$HAVE_WGET" != "xno" || test "x$HAVE_CURL" != "xno"])
176 AM_CONDITIONAL([HAVE_WGET_COMMAND], [test "x$HAVE_WGET" != "xno"])
177
178 # Checks for libraries.
179
180 # Checks for header files.
181 AC_CHECK_HEADERS([stddef.h])
182 AC_CHECK_HEADERS([arpa/inet.h assert.h ctype.h errno.h fcntl.h inttypes.h])
183 AC_CHECK_HEADERS([getopt.h])
184 AC_CHECK_HEADERS([limits.h netdb.h netinet/in.h poll.h sched.h signal.h])
185 AC_CHECK_HEADERS([stdarg.h stdint.h stdio.h stdlib.h stdbool.h string.h strings.h sys/ioctl.h])
186 AC_CHECK_HEADERS([syslog.h sys/prctl.h sys/socket.h sys/stat.h sys/syscall.h])
187 AC_CHECK_HEADERS([sys/time.h time.h unistd.h])
188 AC_CHECK_HEADERS([sys/ioctl.h linux/if_ether.h linux/if_packet.h linux/filter.h])
189 AC_CHECK_HEADERS([linux/ethtool.h linux/sockios.h])
190 AC_CHECK_HEADERS([glob.h])
191 AC_CHECK_HEADERS([dirent.h fnmatch.h])
192 AC_CHECK_HEADERS([sys/resource.h sys/types.h sys/un.h])
193 AC_CHECK_HEADERS([sys/random.h])
194 AC_CHECK_HEADERS([utime.h])
195 AC_CHECK_HEADERS([libgen.h])
196
197 AC_CHECK_HEADERS([sys/socket.h net/if.h sys/mman.h linux/if_arp.h], [], [],
198 [[#ifdef HAVE_SYS_SOCKET_H
199 #include <sys/types.h>
200 #include <sys/socket.h>
201 #endif
202 ]])
203
204 AC_CHECK_HEADERS([windows.h winsock2.h ws2tcpip.h w32api/wtypes.h], [], [],
205 [[
206 #ifndef _X86_
207 #define _X86_
208 #endif
209 ]])
210 AC_CHECK_HEADERS([w32api/winbase.h wincrypt.h], [], [],
211 [[
212 #ifndef _X86_
213 #define _X86_
214 #endif
215 #include <windows.h>
216 ]])
217
218 # Checks for typedefs, structures, and compiler characteristics.
219 AC_C_INLINE
220 AC_TYPE_PID_T
221 AC_TYPE_SIZE_T
222 AC_TYPE_INT32_T
223 AC_TYPE_UINT16_T
224 AC_TYPE_UINT32_T
225 AC_TYPE_UINT64_T
226 AC_TYPE_UINT8_T
227 AC_HEADER_STDBOOL
228
229 # Checks for library functions.
230 AC_FUNC_MALLOC
231 AC_FUNC_REALLOC
232 AC_CHECK_FUNCS([gettimeofday memset strcasecmp strchr strrchr strdup strndup strerror strncasecmp strtol strtoul memchr memrchr clock_gettime])
233 AC_CHECK_FUNCS([strptime])
234
235 AC_CHECK_DECL([getrandom],
236 AC_DEFINE([HAVE_GETRANDOM], [1], [Use getrandom]),
237 [], [
238 #include <sys/random.h>
239 ])
240
241 AC_CHECK_FUNCS([utime])
242
243 OCFLAGS=$CFLAGS
244 CFLAGS=""
245 AC_CHECK_FUNCS([strlcpy strlcat])
246 CFLAGS=$OCFLAGS
247
248 # Add large file support
249 AC_SYS_LARGEFILE
250
251 #check for os
252 AC_MSG_CHECKING([host os])
253
254 # Default lua libname if not detected otherwise.
255 LUA_LIB_NAME="lua5.1"
256
257 # If no host os was detected, try with uname
258 if test -z "$host" ; then
259 host="`uname`"
260 fi
261 echo -n "installation for $host OS... "
262
263 RUST_SURICATA_LIBNAME="libsuricata.a"
264
265 e_magic_file=""
266 e_magic_file_comment="#"
267 PCAP_LIB_NAME="pcap"
268 case "$host" in
269 *-*-*freebsd*)
270 LUA_LIB_NAME="lua-5.1"
271 CFLAGS="${CFLAGS} -DOS_FREEBSD"
272 CPPFLAGS="${CPPFLAGS} -I/usr/local/include -I/usr/local/include/libnet11"
273 LDFLAGS="${LDFLAGS} -L/usr/local/lib -L/usr/local/lib/libnet11"
274 RUST_LDADD="-lrt -lm"
275 ;;
276 *-*-openbsd*)
277 CFLAGS="${CFLAGS} -D__OpenBSD__"
278 CPPFLAGS="${CPPFLAGS} -I/usr/local/include -I/usr/local/include/libnet-1.1"
279 LDFLAGS="${LDFLAGS} -L/usr/local/lib -I/usr/local/lib/libnet-1.1"
280 RUST_LDADD="-lm -lc++ -lc++abi"
281 ;;
282 *darwin*|*Darwin*)
283 LUA_LIB_NAME="lua-5.1"
284 CFLAGS="${CFLAGS} -DOS_DARWIN"
285 CPPFLAGS="${CPPFLAGS} -I/opt/local/include"
286 LDFLAGS="${LDFLAGS} -L/opt/local/lib"
287 ;;
288 *-*-linux*)
289 RUST_LDADD="-ldl -lrt -lm"
290 ;;
291 *-*-mingw32*|*-*-msys)
292 CFLAGS="${CFLAGS} -DOS_WIN32"
293 LDFLAGS="${LDFLAGS} -lws2_32 -liphlpapi -lwbemuuid -lOle32 -lOleAut32 -lUuid"
294 WINDOWS_PATH="yes"
295 PCAP_LIB_NAME="wpcap"
296 AC_DEFINE([HAVE_NON_POSIX_MKDIR], [1], [mkdir is not POSIX compliant: single arg])
297 RUST_SURICATA_LIBNAME="suricata.lib"
298 RUST_LDADD="-luserenv -lshell32 -ladvapi32 -lgcc_eh"
299 ;;
300 *-*-cygwin)
301 LUA_LIB_NAME="lua"
302 WINDOWS_PATH="yes"
303 PCAP_LIB_NAME="wpcap"
304 ;;
305 *-*-solaris*)
306 AC_MSG_WARN([support for Solaris/Illumos/SunOS is experimental])
307 LDFLAGS="${LDFLAGS} -lsocket -lnsl"
308 ;;
309 *)
310 AC_MSG_WARN([unsupported OS this may or may not work])
311 ;;
312 esac
313 AC_MSG_RESULT(ok)
314
315 # enable modifications for AFL fuzzing
316 AC_ARG_ENABLE(afl,
317 AS_HELP_STRING([--enable-afl], Enable AFL fuzzing logic[])], [enable_afl="$enableval"],[enable_afl=no])
318
319 AS_IF([test "x$enable_afl" = "xyes"], [
320 AC_DEFINE([AFLFUZZ_NO_RANDOM], [1], [Disable all use of random functions])
321 AC_DEFINE([AFLFUZZ_DISABLE_MGTTHREADS], [1], [Disable all management threads])
322 AC_DEFINE([AFLFUZZ_PCAP_RUNMODE], [1], [Enable special AFL 'single' runmode])
323 AC_DEFINE([AFLFUZZ_CONF_TEST], [1], [Enable special --afl-parse-rules commandline option])
324 AC_DEFINE([AFLFUZZ_APPLAYER], [1], [Enable --afl-$proto-request commandline option])
325 AC_DEFINE([AFLFUZZ_MIME], [1], [Enable --afl-mime commandline option])
326 AC_DEFINE([AFLFUZZ_DECODER], [1], [Enable --afl-decoder-$proto commandline option])
327 AC_DEFINE([AFLFUZZ_DER], [1], [Enable --afl-der commandline option])
328 AC_DEFINE([AFLFUZZ_RULES], [1], [Enable --afl-rules commandline option])
329
330 # test for AFL PERSISTANT_MODE support
331 CFLAGS_ORIG=$CFLAGS
332 CFLAGS="-Werror"
333 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[while (__AFL_LOOP(1000))]])],
334 [AC_DEFINE([AFLFUZZ_PERSISTANT_MODE], [1], [Enable AFL PERSISTANT_MODE])],
335 [])
336 CFLAGS=$CFLAGS_ORIG
337 ])
338
339 # disable TLS on user request
340 AC_ARG_ENABLE(threading-tls,
341 AS_HELP_STRING([--disable-threading-tls], [Disable TLS (thread local storage)]), [enable_tls="$enableval"],[enable_tls=yes])
342 AS_IF([test "x$enable_tls" = "xyes"], [
343 # check if our target supports thread local storage
344 AC_MSG_CHECKING(for thread local storage __thread support)
345 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h>]],
346 [[ static __thread int i; i = 1; i++; ]])],
347 [AC_DEFINE([TLS], [1], [Thread local storage])
348 AC_MSG_RESULT([yes])],
349 [AC_MSG_RESULT([no])])
350 ])
351
352 #Enable support for gcc compile time security options. There is no great way to do detection of valid cflags that I have found
353 #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.
354 #These flags seem to be supported on CentOS 5+, Ubuntu 8.04+, and FedoreCore 11+
355 #Options are taken from https://wiki.ubuntu.com/CompilerFlags
356 AC_ARG_ENABLE(gccprotect,
357 AS_HELP_STRING([--enable-gccprotect], [Detect and use gcc hardening options]),[enable_gccprotect=$enableval],[enable_gccprotect=no])
358
359 AS_IF([test "x$enable_gccprotect" = "xyes"], [
360 #buffer overflow protection
361 AC_MSG_CHECKING(for -fstack-protector)
362 TMPCFLAGS="${CFLAGS}"
363 CFLAGS="${CFLAGS} -fstack-protector"
364 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[SECCFLAGS="-fstack-protector"
365 AC_MSG_RESULT(yes)],
366 [AC_MSG_RESULT(no)])
367 CFLAGS="${TMPCFLAGS}"
368
369 #compile-time best-practices errors for certain libc functions, provides checks of buffer lengths and memory regions
370 AC_MSG_CHECKING(for -D_FORTIFY_SOURCE=2)
371 TMPCFLAGS="${CFLAGS}"
372 CFLAGS="${CFLAGS} -D_FORTIFY_SOURCE=2"
373 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[SECCFLAGS="${SECCFLAGS} -D_FORTIFY_SOURCE=2"
374 AC_MSG_RESULT(yes)],
375 [AC_MSG_RESULT(no)])
376 CFLAGS="${TMPCFLAGS}"
377
378 #compile-time warnings about misuse of format strings
379 AC_MSG_CHECKING(for -Wformat -Wformat-security)
380 TMPCFLAGS="${CFLAGS}"
381 CFLAGS="${CFLAGS} -Wformat -Wformat-security"
382 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[SECCFLAGS="${SECCFLAGS} -Wformat -Wformat-security"
383 AC_MSG_RESULT(yes)],
384 [AC_MSG_RESULT(no)])
385 CFLAGS="${TMPCFLAGS}"
386
387 #provides a read-only relocation table area in the final ELF
388 AC_MSG_CHECKING(for -z relro)
389 TMPLDFLAGS="${LDFLAGS}"
390 LDFLAGS="${LDFLAGS} -z relro"
391 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[SECLDFLAGS="${SECLDFLAGS} -z relro"
392 AC_MSG_RESULT(yes)],
393 [AC_MSG_RESULT(no)])
394 LDFLAGS="${TMPLDFLAGS}"
395
396 #forces all relocations to be resolved at run-time
397 AC_MSG_CHECKING(for -z now)
398 TMPLDFLAGS="${LDFLAGS}"
399 LDFLAGS="${LDFLAGS} -z now"
400 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[SECLDFLAGS="${SECLDFLAGS} -z now"
401 AC_MSG_RESULT(yes)],
402 [AC_MSG_RESULT(no)])
403 LDFLAGS="${TMPLDFLAGS}"
404
405 AC_SUBST(SECCFLAGS)
406 AC_SUBST(SECLDFLAGS)
407 ])
408
409 #enable profile generation
410 AC_ARG_ENABLE(gccprofile,
411 AS_HELP_STRING([--enable-gccprofile], [Enable gcc profile info i.e -pg flag is set]),[enable_gccprofile=$enableval],[enable_gccprofile=no])
412 AS_IF([test "x$enable_gccprofile" = "xyes"], [
413 CFLAGS="${CFLAGS} -pg"
414 ])
415
416 #enable gcc march=native gcc 4.2 or later
417 AC_ARG_ENABLE(gccmarch_native,
418 AS_HELP_STRING([--enable-gccmarch-native], [Enable gcc march=native gcc 4.2 and later only]),[enable_gccmarch_native=$enableval],[enable_gccmarch_native=yes])
419 AS_IF([test "x$enable_gccmarch_native" = "xyes"], [
420 case "$host" in
421 *powerpc*)
422 ;;
423 *)
424 OFLAGS="$CFLAGS"
425 CFLAGS="$CFLAGS -march=native"
426 AC_MSG_CHECKING([checking if $CC supports -march=native])
427 AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([[#include <stdlib.h>]])],
428 [
429 AC_MSG_RESULT([yes])
430 OPTIMIZATION_CFLAGS="-march=native"
431 AC_SUBST(OPTIMIZATION_CFLAGS)
432 ],
433 [
434 AC_MSG_RESULT([no])
435 CFLAGS="$OFLAGS"
436 enable_gccmarch_native=no
437 ]
438 )
439 ;;
440 esac
441 ])
442
443 # options
444
445 # enable the running of unit tests
446 AC_ARG_ENABLE(unittests,
447 AS_HELP_STRING([--enable-unittests], [Enable compilation of the unit tests]),[enable_unittests=$enableval],[enable_unittests=no])
448 AS_IF([test "x$enable_unittests" = "xyes"], [
449 AC_DEFINE([UNITTESTS],[1],[Enable built-in unittests])
450 ])
451 AM_CONDITIONAL([BUILD_UNITTESTS], [test "x$enable_unittests" = "xyes"])
452
453 # enable the building of ebpf files
454 AC_ARG_ENABLE(ebpf-build,
455 AS_HELP_STRING([--enable-ebpf-build], [Enable compilation of ebpf files]),[enable_ebpf_build=$enableval],[enable_ebpf_build=no])
456 AM_CONDITIONAL([BUILD_EBPF], [test "x$enable_ebpf_build" = "xyes"])
457
458 AS_IF([test "x$enable_ebpf_build" = "xyes"],
459 [
460 AS_IF([test "$CLANG" != no],
461 [
462 llc_candidates=$($CLANG --version | \
463 awk '/^clang version/ {
464 split($3, v, ".");
465 printf("llc-%s.%s llc-%s llc", v[[1]], v[[2]], v[[1]])
466 }')
467 AC_CHECK_PROGS([LLC], [$llc_candidates], "no")
468 if test "$LLC" = "no"; then
469 AC_MSG_ERROR([unable to find any of $llc_candidates needed to build ebpf files])
470 fi
471 AC_SUBST(LLC)
472 ],
473 [AC_MSG_ERROR([clang needed to build ebpf files])])
474 ])
475
476 # enable workaround for old barnyard2 for unified alert output
477 AC_ARG_ENABLE(old-barnyard2,
478 AS_HELP_STRING([--enable-old-barnyard2], [Use workaround for old barnyard2 in unified2 output]),[enable_old_barnyard2=$enableval],[enable_old_barnyard2=no])
479 AS_IF([test "x$enable_old_barnyard2" = "xyes"], [
480 AC_DEFINE([HAVE_OLD_BARNYARD2],[1],[Use workaround for old barnyard2 in unified2 output])
481 ])
482
483 # enable debug output
484 AC_ARG_ENABLE(debug,
485 AS_HELP_STRING([--enable-debug], [Enable debug output]),[enable_debug=$enableval],[enable_debug=no])
486 AS_IF([test "x$enable_debug" = "xyes"], [
487 AC_DEFINE([DEBUG],[1],[Enable debug output])
488 ])
489 AM_CONDITIONAL([DEBUG], [test "x$enable_debug" = "xyes"])
490
491 # enable debug validation functions & macro's output
492 AC_ARG_ENABLE(debug-validation,
493 AS_HELP_STRING([--enable-debug-validation], [Enable (debug) validation code output]),[enable_debug_validation=$enableval],[enable_debug_validation=no])
494 AS_IF([test "x$enable_debug_validation" = "xyes"], [
495 if test "$enable_unittests" = "yes"; then
496 AC_MSG_ERROR([debug_validation can't be enabled with enabled unittests!])
497 else
498 AC_DEFINE([DEBUG_VALIDATION],[1],[Enable (debug) validation code output])
499 fi
500 ])
501
502 # profiling support
503 AC_ARG_ENABLE(profiling,
504 AS_HELP_STRING([--enable-profiling], [Enable performance profiling]),[enable_profiling=$enableval],[enable_profiling=no])
505 AS_IF([test "x$enable_profiling" = "xyes"], [
506 case "$host" in
507 *-*-openbsd*)
508 AC_MSG_ERROR([profiling is not supported on OpenBSD])
509 ;;
510 *)
511 AC_DEFINE([PROFILING],[1],[Enable performance profiling])
512 ;;
513 esac
514 ])
515
516 # profiling support, locking
517 AC_ARG_ENABLE(profiling-locks,
518 AS_HELP_STRING([--enable-profiling-locks], [Enable performance profiling for locks]),[enable_profiling_locks=$enableval],[enable_profiling_locks=no])
519 AS_IF([test "x$enable_profiling_locks" = "xyes"], [
520 AC_DEFINE([PROFILING],[1],[Enable performance profiling])
521 AC_DEFINE([PROFILE_LOCKING],[1],[Enable performance profiling for locks])
522 ])
523
524 # enable support for IPFW
525 AC_ARG_ENABLE(ipfw,
526 AS_HELP_STRING([--enable-ipfw], [Enable FreeBSD IPFW support for inline IDP]),[enable_ipfw=$enableval],[enable_ipfw=no])
527 AS_IF([test "x$enable_ipfw" = "xyes"], [
528 AC_DEFINE([IPFW],[1],[Enable FreeBSD IPFW support for inline IDP])
529 ])
530
531 AC_ARG_ENABLE(coccinelle,
532 AS_HELP_STRING([--disable-coccinelle], [Disable coccinelle QA steps during make check]),[enable_coccinelle="$enableval"],[enable_coccinelle=yes])
533 AS_IF([test "x$enable_coccinelle" = "xyes"], [
534 AC_PATH_PROG(HAVE_COCCINELLE_CONFIG, spatch, "no")
535 if test "$HAVE_COCCINELLE_CONFIG" = "no"; then
536 enable_coccinelle=no
537 fi
538 ])
539 AM_CONDITIONAL([HAVE_COCCINELLE], [test "x$enable_coccinelle" != "xno"])
540
541 # disable detection
542 AC_ARG_ENABLE(detection,
543 AS_HELP_STRING([--disable-detection], [Disable Detection Modules]), [enable_detection="$enableval"],[enable_detection=yes])
544 AS_IF([test "x$enable_detection" = "xno"], [
545 AC_DEFINE([HAVE_DETECT_DISABLED], [1], [Detection is disabled])
546 ])
547
548 # libraries
549
550 # zlib
551 AC_ARG_WITH(zlib_includes,
552 [ --with-zlib-includes=DIR zlib include directory],
553 [with_zlib_includes="$withval"],[with_zlib_includes=no])
554 AC_ARG_WITH(zlib_libraries,
555 [ --with-zlib-libraries=DIR zlib library directory],
556 [with_zlib_libraries="$withval"],[with_zlib_libraries="no"])
557
558 if test "$with_zlib_includes" != "no"; then
559 CPPFLAGS="${CPPFLAGS} -I${with_zlib_includes}"
560 fi
561
562 AC_CHECK_HEADER(zlib.h, ZLIB="yes",ZLIB="no")
563 if test "$ZLIB" = "yes"; then
564 if test "$with_zlib_libraries" != "no"; then
565 LDFLAGS="${LDFLAGS} -L${with_zlib_libraries}"
566 fi
567
568 # To prevent duping the lib link we reset LIBS after this check. Setting action-if-found to NULL doesn't seem to work
569 # see: http://blog.flameeyes.eu/2008/04/29/i-consider-ac_check_lib-harmful
570 ZLIB=""
571 TMPLIBS="${LIBS}"
572 AC_CHECK_LIB(z,inflate,,ZLIB="no")
573
574 if test "$ZLIB" = "no"; then
575 echo
576 echo " ERROR! zlib library not found, go get it"
577 echo " Debian/Ubuntu: apt install zlib1g-dev"
578 echo " Fedora: dnf install zlib-devel"
579 echo " CentOS/RHEL: yum install zlib-devel"
580 echo
581 exit 1
582 fi
583 LIBS="${TMPLIBS} -lz"
584 fi
585
586 #libpcre
587 AC_ARG_WITH(libpcre_includes,
588 [ --with-libpcre-includes=DIR libpcre include directory],
589 [with_libpcre_includes="$withval"],[with_libpcre_includes="no"])
590 AC_ARG_WITH(libpcre_libraries,
591 [ --with-libpcre-libraries=DIR libpcre library directory],
592 [with_libpcre_libraries="$withval"],[with_libpcre_libraries="no"])
593
594 if test "$with_libpcre_includes" != "no"; then
595 CPPFLAGS="${CPPFLAGS} -I${with_libpcre_includes}"
596 fi
597 AC_CHECK_HEADER(pcre.h,,[AC_MSG_ERROR(pcre.h not found ...)])
598
599 if test "$with_libpcre_libraries" != "no"; then
600 LDFLAGS="${LDFLAGS} -L${with_libpcre_libraries}"
601 fi
602 PCRE=""
603 AC_CHECK_LIB(pcre, pcre_get_substring,,PCRE="no")
604 if test "$PCRE" = "no"; then
605 echo
606 echo " ERROR! pcre library not found, go get it"
607 echo " from www.pcre.org. Or from packages:"
608 echo " Debian/Ubuntu: apt install libpcre3-dev"
609 echo " Fedora: dnf install pcre-devel"
610 echo " CentOS/RHEL: yum install pcre-devel"
611 echo
612 exit 1
613 fi
614
615 # libpcre 8.35 (especially on debian) has a known issue that results in segfaults
616 # see https://redmine.openinfosecfoundation.org/issues/1693
617 if test "$with_libpcre_libraries" = "no"; then
618 PKG_CHECK_MODULES(LIBPCREVERSION, [libpcre = 8.35],[libpcre_buggy_found="yes"],[libprce_buggy_found="no"])
619 if test "$libpcre_buggy_found" = "yes"; then
620 echo
621 echo " Warning! vulnerable libpcre version 8.35 found"
622 echo " This version has a known issue that could result in segfaults"
623 echo " please upgrade to a newer version of pcre which you can get from"
624 echo " www.pcre.org. For more information, see issue #1693"
625 echo
626 echo " Continuing for now with JIT disabled..."
627 echo
628 fi
629 fi
630
631 # To prevent duping the lib link we reset LIBS after this check. Setting action-if-found to NULL doesn't seem to work
632 # see: http://blog.flameeyes.eu/2008/04/29/i-consider-ac_check_lib-harmful
633 PCRE=""
634 TMPLIBS="${LIBS}"
635 AC_CHECK_LIB(pcre, pcre_dfa_exec,, PCRE="no")
636 if test "$PCRE" = "no"; then
637 echo
638 echo " ERROR! pcre library was found but version was < 6.0"
639 echo " please upgrade to a newer version of pcre which you can get from"
640 echo " www.pcre.org."
641 echo
642 exit 1
643 fi
644 LIBS="${TMPLIBS}"
645
646 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <pcre.h> ]],
647 [[ int eo = 0; eo |= PCRE_EXTRA_MATCH_LIMIT_RECURSION; ]])],
648 [ pcre_match_limit_recursion_available=yes ],[:]
649 )
650 if test "$pcre_match_limit_recursion_available" != "yes"; then
651 echo
652 echo " Warning! pcre extra opt PCRE_EXTRA_MATCH_LIMIT_RECURSION not found"
653 echo " This could lead to potential DoS please upgrade to pcre >= 6.5"
654 echo " from www.pcre.org."
655 echo " Continuing for now...."
656 echo
657 AC_DEFINE([NO_PCRE_MATCH_RLIMIT],[1],[Pcre PCRE_EXTRA_MATCH_LIMIT_RECURSION not available])
658 fi
659
660 TMPCFLAGS="${CFLAGS}"
661 CFLAGS="-O0 -g -Werror -Wall"
662 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <pcre.h> ]],
663 [[ pcre_extra *extra = NULL; pcre_free_study(extra); ]])],
664 [ AC_DEFINE([HAVE_PCRE_FREE_STUDY], [1], [Pcre pcre_free_study supported])],[:]
665 )
666 CFLAGS="${TMPCFLAGS}"
667
668 #enable support for PCRE-jit available since pcre-8.20
669 AC_MSG_CHECKING(for PCRE JIT support)
670 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <pcre.h> ]],
671 [[
672 int jit = 0;
673 pcre_config(PCRE_CONFIG_JIT, &jit);
674 ]])],[ pcre_jit_available=yes ],[ pcre_jit_available=no ]
675 )
676
677 case $host in
678 *powerpc64*)
679 PKG_CHECK_MODULES(LIBPCREVERSION, [libpcre = 8.39],[libpcre_ppc64_buggy_found1="yes"],[libprce_ppc64_buggy_found1="no"])
680 PKG_CHECK_MODULES(LIBPCREVERSION, [libpcre = 8.40],[libpcre_ppc64_buggy_found2="yes"],[libprce_ppc64_buggy_found2="no"])
681
682 if test "$libprce_ppc64_buggy_found1" = "yes" || test "$libprce_ppc64_buggy_found2"; then
683 # on powerpc64, both gcc and clang lead to SIGILL in
684 # unittests when jit is enabled.
685 pcre_jit_available="no, pcre 8.39/8.40 jit disabled for powerpc64"
686 fi
687 ;;
688 *)
689 # bug 1693, libpcre 8.35 is broken and debian jessie is still using that
690 if test "$libpcre_buggy_found" = "yes"; then
691 pcre_jit_available="no, libpcre 8.35 blacklisted"
692 fi
693 ;;
694 esac
695
696 if test "x$pcre_jit_available" = "xyes"; then
697 AC_MSG_RESULT(yes)
698 AC_DEFINE([PCRE_HAVE_JIT], [1], [Pcre with JIT compiler support enabled])
699
700 AC_MSG_CHECKING(for PCRE JIT support usability)
701 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <pcre.h> ]],
702 [[
703 const char* regexstr = "(a|b|c|d)";
704 pcre *re;
705 const char *error;
706 pcre_extra *extra;
707 int err_offset;
708 re = pcre_compile(regexstr,0, &error, &err_offset,NULL);
709 extra = pcre_study(re, PCRE_STUDY_JIT_COMPILE, &error);
710 if (extra == NULL)
711 exit(EXIT_FAILURE);
712 int jit = 0;
713 int ret = pcre_fullinfo(re, extra, PCRE_INFO_JIT, &jit);
714 if (ret != 0 || jit != 1)
715 exit(EXIT_FAILURE);
716 exit(EXIT_SUCCESS);
717 ]])],[ pcre_jit_works=yes ],[:]
718 )
719 if test "x$pcre_jit_works" != "xyes"; then
720 AC_MSG_RESULT(no)
721 echo
722 echo " PCRE JIT support detection worked but testing it failed"
723 echo " something odd is going on, please file a bug report."
724 echo
725 exit 1
726 else
727 AC_MSG_RESULT(yes)
728 fi
729 else
730 AC_MSG_RESULT(no)
731 fi
732
733 # libhs
734 enable_hyperscan="no"
735
736 # Try pkg-config first:
737 PKG_CHECK_MODULES([libhs], libhs,, [with_pkgconfig_libhs=no])
738 if test "$with_pkgconfig_libhs" != "no"; then
739 CPPFLAGS="${CPPFLAGS} ${libhs_CFLAGS}"
740 LIBS="${LIBS} ${libhs_LIBS}"
741 fi
742
743 AC_ARG_WITH(libhs_includes,
744 [ --with-libhs-includes=DIR libhs include directory],
745 [with_libhs_includes="$withval"],[with_libhs_includes=no])
746 AC_ARG_WITH(libhs_libraries,
747 [ --with-libhs-libraries=DIR libhs library directory],
748 [with_libhs_libraries="$withval"],[with_libhs_libraries="no"])
749
750 if test "$with_libhs_includes" != "no"; then
751 CPPFLAGS="${CPPFLAGS} -I${with_libhs_includes}"
752 fi
753 AC_CHECK_HEADER(hs.h,HYPERSCAN="yes",HYPERSCAN="no")
754 if test "$HYPERSCAN" = "yes"; then
755 if test "$with_libhs_libraries" != "no"; then
756 LDFLAGS="${LDFLAGS} -L${with_libhs_libraries}"
757 fi
758
759 AC_CHECK_LIB(hs,hs_compile,,HYPERSCAN="no")
760 AC_CHECK_FUNCS(hs_valid_platform)
761 enable_hyperscan="yes"
762 if test "$HYPERSCAN" = "no"; then
763 echo
764 echo " Hyperscan headers are present, but link test failed."
765 echo " Check that you have a shared library and C++ linkage available."
766 echo
767 enable_hyperscan="no"
768 fi
769 fi
770 AS_IF([test "x$enable_hyperscan" = "xyes"], [AC_DEFINE([BUILD_HYPERSCAN], [1], [Intel Hyperscan support enabled])])
771
772 # libyaml
773 AC_ARG_WITH(libyaml_includes,
774 [ --with-libyaml-includes=DIR libyaml include directory],
775 [with_libyaml_includes="$withval"],[with_libyaml_includes=no])
776 AC_ARG_WITH(libyaml_libraries,
777 [ --with-libyaml-libraries=DIR libyaml library directory],
778 [with_libyaml_libraries="$withval"],[with_libyaml_libraries="no"])
779
780 if test "$with_libyaml_includes" != "no"; then
781 CPPFLAGS="${CPPFLAGS} -I${with_libyaml_includes}"
782 fi
783
784 AC_CHECK_HEADER(yaml.h,,LIBYAML="no")
785
786 if test "$with_libyaml_libraries" != "no"; then
787 LDFLAGS="${LDFLAGS} -L${with_libyaml_libraries}"
788 fi
789
790 LIBYAML=""
791 AC_CHECK_LIB(yaml,yaml_parser_initialize,,LIBYAML="no")
792
793 if test "$LIBYAML" = "no"; then
794 echo
795 echo " ERROR! libyaml library not found, go get it"
796 echo " from http://pyyaml.org/wiki/LibYAML "
797 echo " or your distribution:"
798 echo
799 echo " Ubuntu: apt-get install libyaml-dev"
800 echo " Fedora: dnf install libyaml-devel"
801 echo " CentOS/RHEL: yum install libyaml-devel"
802 echo
803 exit 1
804 fi
805
806 # libpthread
807 AC_ARG_WITH(libpthread_includes,
808 [ --with-libpthread-includes=DIR libpthread include directory],
809 [with_libpthread_includes="$withval"],[with_libpthread_includes=no])
810 AC_ARG_WITH(libpthread_libraries,
811 [ --with-libpthread-libraries=DIR libpthread library directory],
812 [with_libpthread_libraries="$withval"],[with_libpthread_libraries="no"])
813
814 if test "$with_libpthread_includes" != "no"; then
815 CPPFLAGS="${CPPFLAGS} -I${with_libpthread_includes}"
816 fi
817
818 dnl AC_CHECK_HEADER(pthread.h,,[AC_MSG_ERROR(pthread.h not found ...)])
819
820 if test "$with_libpthread_libraries" != "no"; then
821 LDFLAGS="${LDFLAGS} -L${with_libpthread_libraries}"
822 fi
823
824 PTHREAD=""
825 AC_CHECK_LIB(pthread, pthread_create,, PTHREAD="no")
826
827 if test "$PTHREAD" = "no"; then
828 echo
829 echo " ERROR! libpthread library not found, glibc problem?"
830 echo
831 exit 1
832 fi
833
834 AC_CHECK_FUNCS([pthread_spin_unlock])
835
836 # libjansson
837 AC_ARG_WITH(libjansson_includes,
838 [ --with-libjansson-includes=DIR libjansson include directory],
839 [with_libjansson_includes="$withval"],[with_libjansson_includes=no])
840 AC_ARG_WITH(libjansson_libraries,
841 [ --with-libjansson-libraries=DIR libjansson library directory],
842 [with_libjansson_libraries="$withval"],[with_libjansson_libraries="no"])
843
844 if test "$with_libjansson_includes" != "no"; then
845 CPPFLAGS="${CPPFLAGS} -I${with_libjansson_includes}"
846 fi
847
848 if test "$with_libjansson_libraries" != "no"; then
849 LDFLAGS="${LDFLAGS} -L${with_libjansson_libraries}"
850 fi
851
852 AC_CHECK_HEADER(jansson.h,JANSSON="yes",JANSSON="no")
853 AC_CHECK_LIB(jansson, json_dump_callback,, JANSSON="no")
854
855 if test "$JANSSON" = "no"; then
856 echo ""
857 echo " ERROR: Jansson is now required."
858 echo ""
859 echo " Go get it from your distribution or from:"
860 echo " http://www.digip.org/jansson/"
861 echo ""
862 echo " Ubuntu/Debian: apt install libjansson-dev"
863 echo " CentOS: yum install jansson-devel"
864 echo " Fedora: dnf install jansson-devel"
865 echo ""
866 exit 1
867 fi
868
869 enable_jansson="yes"
870 enable_unixsocket="no"
871
872 AC_ARG_ENABLE(unix-socket,
873 AS_HELP_STRING([--enable-unix-socket], [Enable unix socket [default=test]]),[enable_unixsocket="$enableval"],[enable_unixsocket=test])
874
875 if test "$JANSSON" = "yes"; then
876 enable_jansson="yes"
877 if test "$JANSSON" = "no"; then
878 echo
879 echo " Jansson >= 2.2 is required for features like unix socket"
880 echo " Go get it from your distribution or from:"
881 echo " http://www.digip.org/jansson/"
882 echo " Ubuntu: apt-get install libjansson-dev"
883 echo " Fedora: dnf install jansson-devel"
884 echo " CentOS/RHEL: yum install jansson-devel"
885 echo
886 if test "x$enable_unixsocket" = "xyes"; then
887 exit 1
888 fi
889 enable_unixsocket="no"
890 enable_jansson="no"
891 else
892 case $host in
893 *-*-mingw32*|*-*-msys*|*-*-cygwin)
894 enable_unixsocket="no"
895 ;;
896 *)
897 if test "x$enable_unixsocket" = "xtest"; then
898 enable_unixsocket="yes"
899 fi
900 ;;
901 esac
902 fi
903 else
904 if test "x$enable_unixsocket" = "xyes"; then
905 echo
906 echo " Jansson >= 2.2 is required for features like unix socket"
907 echo " Go get it from your distribution or from:"
908 echo " http://www.digip.org/jansson/"
909 echo " Ubuntu: apt-get install libjansson-dev"
910 echo " Fedora: dnf install jansson-devel"
911 echo " CentOS/RHEL: yum install jansson-devel"
912 echo
913 exit 1
914 fi
915 enable_unixsocket="no"
916 fi
917
918 AS_IF([test "x$enable_unixsocket" = "xyes"], [AC_DEFINE([BUILD_UNIX_SOCKET], [1], [Unix socket support enabled])])
919 e_enable_evelog=$enable_jansson
920
921 AC_ARG_ENABLE(nflog,
922 AS_HELP_STRING([--enable-nflog],[Enable libnetfilter_log support]),
923 [ enable_nflog="$enableval"],
924 [ enable_nflog="no"])
925 AC_ARG_ENABLE(nfqueue,
926 AS_HELP_STRING([--enable-nfqueue], [Enable NFQUEUE support for inline IDP]),[enable_nfqueue=$enableval],[enable_nfqueue=no])
927 if test "$enable_nfqueue" != "no"; then
928 PKG_CHECK_MODULES([libnetfilter_queue], [libnetfilter_queue], [enable_nfqueue=yes], [enable_nfqueue=no])
929 CPPFLAGS="${CPPFLAGS} ${libnetfilter_queue_CFLAGS}"
930 fi
931
932 if test "x$enable_nflog" = "xyes" || test "x$enable_nfqueue" = "xyes"; then
933 # libnfnetlink
934 case $host in
935 *-*-mingw32*)
936 ;;
937 *)
938 AC_ARG_WITH(libnfnetlink_includes,
939 [ --with-libnfnetlink-includes=DIR libnfnetlink include directory],
940 [with_libnfnetlink_includes="$withval"],[with_libnfnetlink_includes=no])
941 AC_ARG_WITH(libnfnetlink_libraries,
942 [ --with-libnfnetlink-libraries=DIR libnfnetlink library directory],
943 [with_libnfnetlink_libraries="$withval"],[with_libnfnetlink_libraries="no"])
944
945 if test "$with_libnfnetlink_includes" != "no"; then
946 CPPFLAGS="${CPPFLAGS} -I${with_libnfnetlink_includes}"
947 fi
948
949 if test "$with_libnfnetlink_libraries" != "no"; then
950 LDFLAGS="${LDFLAGS} -L${with_libnfnetlink_libraries}"
951 fi
952
953 NFNL=""
954 AC_CHECK_LIB(nfnetlink, nfnl_fd,, NFNL="no")
955
956 if test "$NFNL" = "no"; then
957 echo
958 echo " nfnetlink library not found, go get it"
959 echo " from www.netfilter.org."
960 echo " we automatically append libnetfilter_queue/ when searching"
961 echo " for headers etc. when the --with-libnfnetlink-includes directive"
962 echo " is used"
963 echo " Ubuntu: apt-get install libnetfilter-queue-dev"
964 echo " Fedora: dnf install libnetfilter_queue-devel"
965 echo " CentOS/RHEL: yum install libnetfilter_queue-devel"
966 echo
967 fi
968 ;;
969 esac
970 fi
971
972 # enable support for NFQUEUE
973 if test "x$enable_nfqueue" = "xyes"; then
974 AC_DEFINE_UNQUOTED([NFQ],[1],[Enable Linux Netfilter NFQUEUE support for inline IDP])
975
976 #libnetfilter_queue
977 AC_ARG_WITH(libnetfilter_queue_includes,
978 [ --with-libnetfilter_queue-includes=DIR libnetfilter_queue include directory],
979 [with_libnetfilter_queue_includes="$withval"],[with_libnetfilter_queue_includes=no])
980 AC_ARG_WITH(libnetfilter_queue_libraries,
981 [ --with-libnetfilter_queue-libraries=DIR libnetfilter_queue library directory],
982 [with_libnetfilter_queue_libraries="$withval"],[with_libnetfilter_queue_libraries="no"])
983
984 if test "$with_libnetfilter_queue_includes" != "no"; then
985 CPPFLAGS="${CPPFLAGS} -I${with_libnetfilter_queue_includes}"
986 fi
987
988 AC_CHECK_HEADER(libnetfilter_queue/libnetfilter_queue.h,,[AC_MSG_ERROR(libnetfilter_queue/libnetfilter_queue.h not found ...)])
989
990 if test "$with_libnetfilter_queue_libraries" != "no"; then
991 LDFLAGS="${LDFLAGS} -L${with_libnetfilter_queue_libraries}"
992 fi
993
994 NFQ=""
995 AC_CHECK_LIB(netfilter_queue, nfq_open,, NFQ="no",)
996 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])
997 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])
998 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])
999 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])
1000
1001 # check if the argument to nfq_get_payload is signed or unsigned
1002 AC_MSG_CHECKING([for signed nfq_get_payload payload argument])
1003 STORECFLAGS="${CFLAGS}"
1004 if test `basename $CC` = "clang"; then
1005 CFLAGS="${CFLAGS} -Werror=incompatible-pointer-types"
1006 else
1007 CFLAGS="${CFLAGS} -Werror"
1008 fi
1009 AC_COMPILE_IFELSE(
1010 [AC_LANG_PROGRAM(
1011 [
1012 #include <stdio.h>
1013 #include <libnetfilter_queue/libnetfilter_queue.h>
1014 ],
1015 [
1016 char *pktdata;
1017 nfq_get_payload(NULL, &pktdata);
1018 ])],
1019 [libnetfilter_queue_nfq_get_payload_signed="yes"],
1020 [libnetfilter_queue_nfq_get_payload_signed="no"])
1021 AC_MSG_RESULT($libnetfilter_queue_nfq_get_payload_signed)
1022 if test "x$libnetfilter_queue_nfq_get_payload_signed" = "xyes"; then
1023 AC_DEFINE([NFQ_GET_PAYLOAD_SIGNED], [1], [For signed version of nfq_get_payload])
1024 fi
1025 CFLAGS="${STORECFLAGS}"
1026
1027 if test "$NFQ" = "no"; then
1028 echo
1029 echo " ERROR! libnetfilter_queue library not found, go get it"
1030 echo " from www.netfilter.org."
1031 echo " we automatically append libnetfilter_queue/ when searching"
1032 echo " for headers etc. when the --with-libnfq-includes directive"
1033 echo " is used"
1034 echo " Ubuntu: apt-get install libnetfilter-queue-dev"
1035 echo " Fedora: dnf install libnetfilter_queue-devel"
1036 echo " CentOS/RHEL: yum install libnetfilter_queue-devel"
1037 echo
1038 exit 1
1039 fi
1040 fi
1041
1042 # libnetfilter_log
1043 AC_ARG_WITH(libnetfilter_log_includes,
1044 [ --with-libnetfilter_log-includes=DIR libnetfilter_log include directory],
1045 [with_libnetfilter_log_includes="$withval"],[with_libnetfilter_log_includes="no"])
1046 AC_ARG_WITH(libnetfilter_log_libraries,
1047 [ --with-libnetfilter_log-libraries=DIR libnetfilter_log library directory],
1048 [with_libnetfilter_log_libraries="$withval"],[with_libnetfilter_log_libraries="no"])
1049
1050 if test "$enable_nflog" = "yes"; then
1051 if test "$with_libnetfilter_log_includes" != "no"; then
1052 CPPFLAGS="${CPPFLAGS} -I${with_libnetfilter_log_includes}"
1053 fi
1054
1055 AC_CHECK_HEADER(libnetfilter_log/libnetfilter_log.h,,[AC_MSG_ERROR(libnetfilter_log.h not found ...)])
1056
1057 if test "$with_libnetfilter_log_libraries" != "no"; then
1058 LDFLAGS="${LDFLAGS} -L${with_libnetfilter_log_libraries}"
1059 fi
1060
1061 NFLOG=""
1062 AC_CHECK_LIB(netfilter_log, nflog_open,, NFLOG="no")
1063
1064 if test "$NFLOG" = "no"; then
1065 echo
1066 echo " ERROR! libnetfilter_log library not found, go get it"
1067 echo " from http://www.netfilter.org."
1068 echo
1069 exit 1
1070 else
1071 AC_DEFINE([HAVE_NFLOG],[1],[nflog available])
1072 enable_nflog="yes"
1073 fi
1074 fi
1075
1076 # WinDivert support
1077 AC_ARG_ENABLE(windivert,
1078 AS_HELP_STRING([--enable-windivert],[Enable WinDivert support [default=no]]),[enable_windivert=$enableval],
1079 [enable_windivert="no"])
1080
1081 # WinDivert can only be enabled on Windows builds
1082 AC_CHECK_DECL([OS_WIN32],,[enable_windivert="no"])
1083
1084 if test "x$enable_windivert" = "xyes"; then
1085 # WinDivert requires Vista at a minimum. If the user has selected their own NTDDI_VERSION
1086 # then don't override it.
1087 AC_CHECK_DECL([NTDDI_VERSION],,
1088 [CFLAGS="${CFLAGS} -DNTDDI_VERSION=NTDDI_VISTA -D_WIN32_WINNT=_WIN32_WINNT_VISTA"])
1089
1090 AC_DEFINE_UNQUOTED([WINDIVERT],[1],[Enable Windows WinDivert support for inline IDP])
1091
1092 AC_ARG_WITH(windivert_include,
1093 [ --with-windivert-include=DIR WinDivert include path],
1094 [with_windivert_include="$withval"],[with_windivert_include="no"])
1095 AC_ARG_WITH(windivert_libraries,
1096 [ --with-windivert-libraries=DIR WinDivert library path],
1097 [with_windivert_libraries="$withval"],[with_windivert_libraries="no"])
1098
1099 if test "$with_windivert_include" != "no"; then
1100 CPPFLAGS="${CPPFLAGS} -I${with_windivert_include}"
1101 fi
1102
1103 if test "$with_windivert_libraries" != "no"; then
1104 LDFLAGS="${LDFLAGS} -L${with_windivert_libraries}"
1105 fi
1106
1107 AC_CHECK_HEADER(windivert.h,,WINDIVERT_INC="no")
1108 AC_CHECK_LIB(WinDivert, WinDivertOpen,, WINDIVERT_LIB="no")
1109
1110 if test "$WINDIVERT_LIB" = "no" || test "$WINDIVERT_INC" = "no"; then
1111 echo
1112 echo " ERROR! WinDivert not found, go get it from"
1113 echo " https://www.reqrypt.org/windivert.html"
1114 echo
1115 exit 1
1116 fi
1117 fi
1118 # /WinDivert
1119
1120 # prelude
1121 AC_ARG_ENABLE(prelude,
1122 AS_HELP_STRING([--enable-prelude], [Enable Prelude support for alerts]),[enable_prelude=$enableval],[enable_prelude=no])
1123 # Prelude doesn't work with -Werror
1124 STORECFLAGS="${CFLAGS}"
1125 CFLAGS="${CFLAGS} -Wno-error=unused-result"
1126
1127 AS_IF([test "x$enable_prelude" = "xyes"], [
1128 AM_PATH_LIBPRELUDE(0.9.9, , AC_MSG_ERROR(Cannot find libprelude: Is libprelude-config in the path?), no)
1129 if test "x${LIBPRELUDE_CFLAGS}" != "x"; then
1130 CPPFLAGS="${CPPFLAGS} ${LIBPRELUDE_CFLAGS}"
1131 fi
1132
1133 if test "x${LIBPRELUDE_LDFLAGS}" != "x"; then
1134 LDFLAGS="${LDFLAGS} ${LIBPRELUDE_LDFLAGS}"
1135 fi
1136
1137 if test "x${LIBPRELUDE_LIBS}" != "x"; then
1138 LDFLAGS="${LDFLAGS} ${LIBPRELUDE_LIBS}"
1139 fi
1140 AC_DEFINE([PRELUDE], [1], [Libprelude support enabled])
1141 ])
1142 CFLAGS="${STORECFLAGS}"
1143
1144
1145 # libnet
1146 AC_ARG_WITH(libnet_includes,
1147 [ --with-libnet-includes=DIR libnet include directory],
1148 [with_libnet_includes="$withval"],[with_libnet_includes="no"])
1149
1150 AC_ARG_WITH(libnet_libraries,
1151 [ --with-libnet-libraries=DIR libnet library directory],
1152 [with_libnet_libraries="$withval"],[with_libnet_libraries="no"])
1153
1154 if test "x$with_libnet_includes" != "xno"; then
1155 CPPFLAGS="${CPPFLAGS} -I${with_libnet_includes}"
1156 libnet_dir="${with_libnet_includes}"
1157 else
1158 libnet_dir="/usr/include /usr/local/include /usr/local/include/libnet11 /opt/local/include /usr/local/include/libnet-1.1"
1159 fi
1160
1161 if test "x$with_libnet_libraries" != "xno"; then
1162 LDFLAGS="${LDFLAGS} -L${with_libnet_libraries}"
1163 fi
1164
1165 LIBNET_DETECT_FAIL="no"
1166 LIBNET_INC_DIR=""
1167
1168 for i in $libnet_dir; do
1169 if test -r "$i/libnet.h"; then
1170 LIBNET_INC_DIR="$i"
1171 fi
1172 done
1173
1174 enable_libnet="no"
1175 AC_MSG_CHECKING(for libnet.h version 1.1.x)
1176 if test "$LIBNET_INC_DIR" != ""; then
1177 LIBNET_VER=`grep LIBNET_VERSION $LIBNET_INC_DIR/libnet.h | grep '1.[[12]]' | sed 's/[[^"]]*"\([[^"]]*\).*/\1/'`
1178
1179 if test -z "$LIBNET_VER" ; then
1180 AC_MSG_RESULT(no)
1181 else
1182 AC_MSG_RESULT(yes)
1183 fi
1184
1185 #CentOS, Fedora, Ubuntu-LTS, Ubuntu all set defines to the same values. libnet-config seems
1186 #to have been depreciated but all distro's seem to include it as part of the package.
1187 if test "$LIBNET_DETECT_FAIL" = "no"; then
1188 LLIBNET=""
1189 AC_CHECK_LIB(net, libnet_write,, LLIBNET="no")
1190 if test "$LLIBNET" != "no"; then
1191 AC_DEFINE([HAVE_LIBNET11],[1],(libnet 1.1 available))
1192 AC_DEFINE([_DEFAULT_SOURCE],[1],(default source))
1193 AC_DEFINE([_BSD_SOURCE],[1],(bsd source))
1194 AC_DEFINE([__BSD_SOURCE],[1],(bsd source))
1195 AC_DEFINE([__FAVOR_BSD],[1],(favor bsd))
1196 AC_DEFINE([HAVE_NET_ETHERNET_H],[1],(ethernet.h))
1197 enable_libnet="yes"
1198 fi
1199
1200 # see if we have the patched libnet 1.1
1201 # https://www.inliniac.net/blog/2007/10/16/libnet-11-ipv6-fixes-and-additions.html
1202 #
1203 # To prevent duping the lib link we reset LIBS after this check. Setting action-if-found to NULL doesn't seem to work
1204 # see: http://blog.flameeyes.eu/2008/04/29/i-consider-ac_check_lib-harmful
1205 if test "$enable_libnet" = "yes"; then
1206 LLIBNET=""
1207 TMPLIBS="${LIBS}"
1208 AC_CHECK_LIB(net, libnet_build_icmpv6_unreach,, LLIBNET="no")
1209 if test "$LLIBNET" != "no"; then
1210 AC_DEFINE([HAVE_LIBNET_ICMPV6_UNREACH],[1],(libnet_build_icmpv6_unreach available))
1211 fi
1212 LIBS="${TMPLIBS}"
1213 fi
1214
1215 # See if we have libnet 1.1.6 or newer - these versions handle capabilities correctly
1216 # Some patched 1.1.4 versions are also good, but it's not guaranteed for all distros.
1217 #
1218 # Details: https://bugzilla.redhat.com/show_bug.cgi?id=589770
1219 AS_VERSION_COMPARE([LIBNET_VER], [1.1.6],
1220 [],
1221 [AC_DEFINE([HAVE_LIBNET_CAPABILITIES],[1], (libnet_have_capabilities_patch))],
1222 [AC_DEFINE([HAVE_LIBNET_CAPABILITIES],[1], (libnet_have_capabilities_patch))])
1223
1224
1225 # check if the argument to libnet_init is char* or const char*
1226 AC_MSG_CHECKING([libnet_init dev type])
1227 STORECFLAGS="${CFLAGS}"
1228 if test `basename $CC` = "clang"; then
1229 CFLAGS="${CFLAGS} -Werror=incompatible-pointer-types"
1230 else
1231 CFLAGS="${CFLAGS} -Werror"
1232 fi
1233 AC_COMPILE_IFELSE(
1234 [AC_LANG_PROGRAM(
1235 [
1236 #include <stdio.h>
1237 #include <libnet.h>
1238 ],
1239 [[
1240 const char dev[32] = "";
1241 char ebuf[LIBNET_ERRBUF_SIZE];
1242 (void)libnet_init(LIBNET_LINK, dev, ebuf);
1243 ]])],
1244 [libnet_init_const="yes"],
1245 [libnet_init_const="no"])
1246 AC_MSG_RESULT($libnet_init_const)
1247 if test "x$libnet_init_const" = "xyes"; then
1248 AC_DEFINE([HAVE_LIBNET_INIT_CONST], [1], [libnet_init takes const argument])
1249 fi
1250 CFLAGS="${STORECFLAGS}"
1251 fi
1252 else
1253 AC_MSG_RESULT(no)
1254 fi
1255
1256 # libpcap
1257 AC_ARG_WITH(libpcap_includes,
1258 [ --with-libpcap-includes=DIR libpcap include directory],
1259 [with_libpcap_includes="$withval"],[with_libpcap_includes=no])
1260 AC_ARG_WITH(libpcap_libraries,
1261 [ --with-libpcap-libraries=DIR libpcap library directory],
1262 [with_libpcap_libraries="$withval"],[with_libpcap_libraries="no"])
1263
1264 if test "$with_libpcap_includes" != "no"; then
1265 CPPFLAGS="${CPPFLAGS} -I${with_libpcap_includes}"
1266 fi
1267
1268 AC_CHECK_HEADER(pcap.h,,[AC_MSG_ERROR(pcap.h not found ...)])
1269
1270 if test "$with_libpcap_libraries" != "no"; then
1271 LDFLAGS="${LDFLAGS} -L${with_libpcap_libraries}"
1272 fi
1273 AC_CHECK_HEADERS([pcap.h pcap/pcap.h pcap/bpf.h])
1274
1275 LIBPCAP=""
1276 PKG_CHECK_MODULES([PCAP],libpcap,[CPPFLAGS="${CPPFLAGS} ${PCAP_CFLAGS}" LIBS="${LIBS} ${PCAP_LIBS}"],[:])
1277 AC_CHECK_LIB(${PCAP_LIB_NAME}, pcap_open_live,, LIBPCAP="no")
1278 if test "$LIBPCAP" = "no"; then
1279 echo
1280 echo " ERROR! libpcap library not found, go get it"
1281 echo " from http://www.tcpdump.org or your distribution:"
1282 echo
1283 echo " Ubuntu: apt-get install libpcap-dev"
1284 echo " Fedora: dnf install libpcap-devel"
1285 echo " CentOS/RHEL: yum install libpcap-devel"
1286 echo
1287 exit 1
1288 fi
1289
1290 # pcap_activate and pcap_create only exists in libpcap >= 1.0
1291 LIBPCAPVTEST=""
1292 #To prevent duping the lib link we reset LIBS after this check. Setting action-if-found to NULL doesn't seem to work
1293 #see: http://blog.flameeyes.eu/2008/04/29/i-consider-ac_check_lib-harmful
1294 TMPLIBS="${LIBS}"
1295 AC_CHECK_LIB(${PCAP_LIB_NAME}, pcap_activate,, LPCAPVTEST="no")
1296 if test "$LPCAPVTEST" = "no"; then
1297 echo
1298 echo " ERROR! libpcap library too old, need at least 1+, "
1299 echo " go get it from http://www.tcpdump.org or your distribution:"
1300 echo
1301 echo " Ubuntu: apt-get install libpcap-dev"
1302 echo " Fedora: dnf install libpcap-devel"
1303 echo " CentOS/RHEL: yum install libpcap-devel"
1304 echo
1305 exit 1
1306 fi
1307 AC_PATH_PROG(HAVE_PCAP_CONFIG, pcap-config, "no")
1308 if test "$HAVE_PCAP_CONFIG" = "no" -o "$cross_compiling" = "yes"; then
1309 AC_MSG_RESULT(no pcap-config is use)
1310 else
1311 PCAP_CFLAGS="$(pcap-config --defines) $(pcap-config --cflags)"
1312 AC_SUBST(PCAP_CFLAGS)
1313 fi
1314 LIBS="${TMPLIBS}"
1315
1316 #Appears as if pcap_set_buffer_size is linux only?
1317 LIBPCAPSBUFF=""
1318 #To prevent duping the lib link we reset LIBS after this check. Setting action-if-found to NULL doesn't seem to work
1319 #see: http://blog.flameeyes.eu/2008/04/29/i-consider-ac_check_lib-harmful
1320 TMPLIBS="${LIBS}"
1321 AC_CHECK_LIB(${PCAP_LIB_NAME}, pcap_set_buffer_size,, LPCAPSBUFF="no")
1322 if test "$LPCAPSBUFF" != "no"; then
1323 AC_DEFINE([HAVE_PCAP_SET_BUFF],[1],(libpcap has pcap_set_buffer_size function))
1324 fi
1325 LIBS="${TMPLIBS}"
1326
1327 # libpfring
1328 # libpfring (currently only supported for libpcap enabled pfring)
1329 # Error on the side of caution. If libpfring enabled pcap is being used and we don't link against -lpfring compilation will fail.
1330 AC_ARG_ENABLE(pfring,
1331 AS_HELP_STRING([--enable-pfring], [Enable Native PF_RING support]),[enable_pfring=$enableval],[enable_pfring=no])
1332 AS_IF([test "x$enable_pfring" = "xyes"], [
1333 AC_DEFINE([HAVE_PFRING],[1],(PF_RING support enabled))
1334
1335 #We have to set CFLAGS for AC_COMPILE_IFELSE as it doesn't pay attention to CPPFLAGS
1336 AC_ARG_WITH(libpfring_includes,
1337 [ --with-libpfring-includes=DIR libpfring include directory],
1338 [with_libpfring_includes="$withval"],[with_libpfring_includes=no])
1339 AC_ARG_WITH(libpfring_libraries,
1340 [ --with-libpfring-libraries=DIR libpfring library directory],
1341 [with_libpfring_libraries="$withval"],[with_libpfring_libraries="no"])
1342
1343 if test "$with_libpfring_includes" != "no"; then
1344 CPPFLAGS="${CPPFLAGS} -I${with_libpfring_includes}"
1345 fi
1346
1347 if test "$with_libpfring_libraries" != "no"; then
1348 LDFLAGS="${LDFLAGS} -L${with_libpfring_libraries}"
1349 fi
1350
1351 LIBPFRING=""
1352 AC_CHECK_LIB(pfring, pfring_open,, LIBPFRING="no", [-lpcap])
1353 if test "$LIBPFRING" != "no"; then
1354 STORECFLAGS="${CFLAGS}"
1355 CFLAGS="${CFLAGS} -Werror"
1356 AC_COMPILE_IFELSE(
1357 [AC_LANG_PROGRAM(
1358 [
1359 #include <pfring.h>
1360 ],
1361 [
1362 pfring_recv_chunk(NULL, NULL, 0, 0);
1363 ])],
1364 [pfring_recv_chunk="yes"],
1365 [pfring_recv_chunk="no"])
1366 CFLAGS="${STORECFLAGS}"
1367 if test "x$pfring_recv_chunk" != "xyes"; then
1368 if test "x$enable_pfring" = "xyes"; then
1369 echo
1370 echo " ERROR! --enable-pfring was passed but the library version is < 6, go get it"
1371 echo " from http://www.ntop.org/products/pf_ring/"
1372 echo
1373 exit 1
1374 fi
1375 fi
1376 AC_COMPILE_IFELSE(
1377 [AC_LANG_SOURCE([[
1378 #include <pfring.h>
1379 #ifndef PF_RING_FLOW_OFFLOAD
1380 # error PF_RING_FLOW_OFFLOAD not defined
1381 #endif
1382 ]])],
1383 [
1384 AC_DEFINE([HAVE_PF_RING_FLOW_OFFLOAD], [1], [PF_RING bypass support enabled])
1385 ],
1386 [
1387 echo
1388 echo " Warning! Pfring hw bypass not supported by this library version < 7,"
1389 echo " please upgrade to a newer version to use this feature."
1390 echo
1391 echo " Continuing for now with hw bypass support disabled..."
1392 echo
1393 ])
1394 else
1395 if test "x$enable_pfring" = "xyes"; then
1396 echo
1397 echo " ERROR! --enable-pfring was passed but the library was not found, go get it"
1398 echo " from http://www.ntop.org/products/pf_ring/"
1399 echo
1400 exit 1
1401 fi
1402 fi
1403 ])
1404
1405 # AF_PACKET support
1406 AC_ARG_ENABLE(af-packet,
1407 AS_HELP_STRING([--enable-af-packet], [Enable AF_PACKET support [default=yes]]),
1408 [enable_af_packet=$enableval],[enable_af_packet=yes])
1409 AS_IF([test "x$enable_af_packet" = "xyes"], [
1410 AC_CHECK_DECL([TPACKET_V2],
1411 AC_DEFINE([HAVE_AF_PACKET],[1],[AF_PACKET support is available]),
1412 [enable_af_packet="no"],
1413 [[#include <sys/socket.h>
1414 #include <linux/if_packet.h>]])
1415 AC_CHECK_DECL([PACKET_FANOUT_QM],
1416 AC_DEFINE([HAVE_PACKET_FANOUT],[1],[Recent packet fanout support is available]),
1417 [],
1418 [[#include <linux/if_packet.h>]])
1419 AC_CHECK_DECL([TPACKET_V3],
1420 AC_DEFINE([HAVE_TPACKET_V3],[1],[AF_PACKET tpcket_v3 support is available]),
1421 [],
1422 [[#include <sys/socket.h>
1423 #include <linux/if_packet.h>]])
1424 AC_CHECK_DECL([SOF_TIMESTAMPING_RAW_HARDWARE],
1425 AC_DEFINE([HAVE_HW_TIMESTAMPING],[1],[Hardware timestamping support is available]),
1426 [],
1427 [[#include <linux/net_tstamp.h>]])
1428 ])
1429
1430 # Netmap support
1431 AC_ARG_ENABLE(netmap,
1432 AS_HELP_STRING([--enable-netmap], [Enable Netmap support]),[enable_netmap=$enableval],[enable_netmap=no])
1433 AC_ARG_WITH(netmap_includes,
1434 [ --with-netmap-includes=DIR netmap include directory],
1435 [with_netmap_includes="$withval"],[with_netmap_includes=no])
1436
1437 AS_IF([test "x$enable_netmap" = "xyes"], [
1438 AC_DEFINE([HAVE_NETMAP],[1],(NETMAP support enabled))
1439
1440 if test "$with_netmap_includes" != "no"; then
1441 CPPFLAGS="${CPPFLAGS} -I${with_netmap_includes}"
1442 fi
1443
1444 AC_CHECK_HEADER(net/netmap_user.h,,[AC_MSG_ERROR(net/netmap_user.h not found ...)],)
1445
1446 have_recent_netmap="no"
1447 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
1448 #include <net/netmap_user.h>
1449 ],[
1450 #ifndef NETMAP_API
1451 #error "outdated netmap, need one with NETMAP_API"
1452 #endif
1453 #if NETMAP_API < 11
1454 #error "outdated netmap, need at least api version 11"
1455 #endif
1456 ])], [have_recent_netmap="yes"])
1457 if test "x$have_recent_netmap" != "xyes"; then
1458 echo "ERROR: outdated netmap"
1459 exit 1
1460 fi
1461 have_netmap_version="unknown"
1462 have_v11_netmap="no"
1463 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
1464 #include <net/netmap_user.h>
1465 ],[
1466 #if NETMAP_API != 11
1467 #error "not 11"
1468 #endif
1469 ])], [have_v11_netmap="yes"])
1470 if test "x$have_v11_netmap" = "xyes"; then
1471 have_netmap_version="v11"
1472 fi
1473 have_v12_netmap="no"
1474 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
1475 #include <net/netmap_user.h>
1476 ],[
1477 #if NETMAP_API != 12
1478 #error "not 12"
1479 #endif
1480 ])], [have_v12_netmap="yes"])
1481 if test "x$have_v12_netmap" = "xyes"; then
1482 have_netmap_version="v12"
1483 fi
1484 have_v13_netmap="no"
1485 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
1486 #include <net/netmap_user.h>
1487 ],[
1488 #if NETMAP_API != 13
1489 #error "not 13"
1490 #endif
1491 ])], [have_v13_netmap="yes"])
1492 if test "x$have_v13_netmap" = "xyes"; then
1493 have_netmap_version="v13"
1494 fi
1495 have_gtv13_netmap="no"
1496 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
1497 #include <net/netmap_user.h>
1498 ],[
1499 #if NETMAP_API <= 13
1500 #error "not gt 13"
1501 #endif
1502 ])], [have_gtv13_netmap="yes"])
1503 if test "x$have_gtv13_netmap" = "xyes"; then
1504 have_netmap_version="> v13"
1505 fi
1506 ])
1507
1508 # Suricata-Update.
1509 AC_ARG_ENABLE([suricata-update], AS_HELP_STRING([--disable-suricata-update],
1510 [Disable suricata-update]), [enable_suricata_update=$enableval],
1511 [enable_suricata_update="yes"])
1512
1513 # Assume suircata-update will not be installed.
1514 have_suricata_update="no"
1515 ruledirprefix="$sysconfdir"
1516
1517 if test "$enable_suricata_update" = "yes"; then
1518 if test -f "$srcdir/suricata-update/setup.py"; then
1519 have_suricata_update="yes"
1520 fi
1521 fi
1522
1523 if test "$have_suricata_update" = "yes"; then
1524 if test "$have_python_yaml" != "yes"; then
1525 echo ""
1526 echo " Warning: suricata-update will not be installed as the"
1527 echo " Python yaml module is not installed.."
1528 echo ""
1529 echo " Install the yaml module for Python ${pymv} to enable"
1530 echo " suricata-update."
1531 echo
1532 else
1533 SURICATA_UPDATE_DIR="suricata-update"
1534 AC_SUBST(SURICATA_UPDATE_DIR)
1535 AC_CONFIG_FILES(suricata-update/Makefile)
1536 AC_OUTPUT
1537 ruledirprefix="$localstatedir/lib"
1538 fi
1539 fi
1540
1541 # Test to see if suricatactl (and suricatasc) can be installed.
1542 if test "x$enable_python" != "xyes"; then
1543 install_suricatactl="requires python"
1544 elif test "x$have_python_distutils" != "xyes"; then
1545 install_suricatactl="no, requires distutils"
1546 else
1547 install_suricatactl="yes"
1548 fi
1549
1550 # Test to see if suricata-update can be installed.
1551 if test "x$have_suricata_update" != "xyes"; then
1552 install_suricata_update="not bundled"
1553 elif test "x$enable_python" != "xyes"; then
1554 install_suricata_update="no, requires python"
1555 elif test "x$have_python_distutils" != "xyes"; then
1556 install_suricata_update="no, requires distutils"
1557 elif test "x$have_python_yaml" != "xyes"; then
1558 install_suricata_update="no, requires pyyaml"
1559 else
1560 install_suricata_update="yes"
1561 fi
1562
1563 AM_CONDITIONAL([INSTALL_SURICATA_UPDATE],
1564 [test "x$install_suricata_update" = "xyes"])
1565
1566 # libhtp
1567 AC_ARG_ENABLE(non-bundled-htp,
1568 AS_HELP_STRING([--enable-non-bundled-htp], [Enable the use of an already installed version of htp]),[enable_non_bundled_htp=$enableval],[enable_non_bundled_htp=no])
1569 AS_IF([test "x$enable_non_bundled_htp" = "xyes"], [
1570 PKG_CHECK_MODULES([libhtp], htp,, [with_pkgconfig_htp=no])
1571 if test "$with_pkgconfig_htp" != "no"; then
1572 CPPFLAGS="${CPPFLAGS} ${libhtp_CFLAGS}"
1573 LIBS="${LIBS} ${libhtp_LIBS}"
1574 fi
1575
1576 AC_ARG_WITH(libhtp_includes,
1577 [ --with-libhtp-includes=DIR libhtp include directory],
1578 [with_libhtp_includes="$withval"],[with_libhtp_includes=no])
1579 AC_ARG_WITH(libhtp_libraries,
1580 [ --with-libhtp-libraries=DIR libhtp library directory],
1581 [with_libhtp_libraries="$withval"],[with_libhtp_libraries="no"])
1582
1583 if test "$with_libhtp_includes" != "no"; then
1584 CPPFLAGS="-I${with_libhtp_includes} ${CPPFLAGS}"
1585 fi
1586
1587 if test "$with_libhtp_libraries" != "no"; then
1588 LDFLAGS="${LDFLAGS} -L${with_libhtp_libraries}"
1589 fi
1590
1591 AC_CHECK_HEADER(htp/htp.h,,[AC_MSG_ERROR(htp/htp.h not found ...)])
1592
1593 LIBHTP=""
1594 AC_CHECK_LIB(htp, htp_conn_create,, LIBHTP="no")
1595 if test "$LIBHTP" = "no"; then
1596 echo
1597 echo " ERROR! libhtp library not found"
1598 echo
1599 exit 1
1600 fi
1601 PKG_CHECK_MODULES(LIBHTPMINVERSION, [htp >= 0.5.31],[libhtp_minver_found="yes"],[libhtp_minver_found="no"])
1602 if test "$libhtp_minver_found" = "no"; then
1603 PKG_CHECK_MODULES(LIBHTPDEVVERSION, [htp = 0.5.X],[libhtp_devver_found="yes"],[libhtp_devver_found="no"])
1604 if test "$libhtp_devver_found" = "no"; then
1605 echo
1606 echo " ERROR! libhtp was found but it is neither >= 0.5.31, nor the dev 0.5.X"
1607 echo
1608 exit 1
1609 fi
1610 fi
1611
1612 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])
1613 # check for htp_tx_get_response_headers_raw
1614 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])
1615 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])
1616 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])
1617 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]) )
1618 AC_CHECK_LIB([htp], [htp_config_set_lzma_memlimit],AC_DEFINE_UNQUOTED([HAVE_HTP_CONFIG_SET_LZMA_MEMLIMIT],[1],[Found htp_config_set_lzma_memlimit function in libhtp]) ,,[-lhtp])
1619 AC_CHECK_LIB([htp], [htp_config_set_compression_bomb_limit],AC_DEFINE_UNQUOTED([HAVE_HTP_CONFIG_SET_COMPRESSION_BOMB_LIMIT],[1],[Found htp_config_set_compression_bomb_limit function in libhtp]) ,,[-lhtp])
1620 ])
1621
1622 if test "x$enable_non_bundled_htp" = "xno"; then
1623 # test if we have a bundled htp
1624 if test -d "$srcdir/libhtp"; then
1625 AC_CONFIG_SUBDIRS([libhtp])
1626 HTP_DIR="libhtp"
1627 AC_SUBST(HTP_DIR)
1628 HTP_LDADD="../libhtp/htp/libhtp.la"
1629 AC_SUBST(HTP_LDADD)
1630 # make sure libhtp is added to the includes
1631 CPPFLAGS="-I\${srcdir}/../libhtp/ ${CPPFLAGS}"
1632
1633 AC_CHECK_HEADER(iconv.h,,[AC_MSG_ERROR(iconv.h not found ...)])
1634 AC_CHECK_LIB(iconv, libiconv_close)
1635 AC_DEFINE_UNQUOTED([HAVE_HTP_URI_NORMALIZE_HOOK],[1],[Assuming htp_config_register_request_uri_normalize function in bundled libhtp])
1636 AC_DEFINE_UNQUOTED([HAVE_HTP_TX_GET_RESPONSE_HEADERS_RAW],[1],[Assuming htp_tx_get_response_headers_raw function in bundled libhtp])
1637 AC_DEFINE_UNQUOTED([HAVE_HTP_DECODE_QUERY_INPLACE],[1],[Assuming htp_decode_query_inplace function in bundled libhtp])
1638 # enable when libhtp has been updated
1639 AC_DEFINE_UNQUOTED([HAVE_HTP_CONFIG_SET_RESPONSE_DECOMPRESSION_LAYER_LIMIT],[1],[Assuming htp_config_set_response_decompression_layer_limit function in bundled libhtp])
1640 AC_DEFINE_UNQUOTED([HAVE_HTP_CONFIG_SET_LZMA_MEMLIMIT],[1],[Assuming htp_config_set_lzma_memlimit function in bundled libhtp])
1641 AC_DEFINE_UNQUOTED([HAVE_HTP_CONFIG_SET_COMPRESSION_BOMB_LIMIT],[1],[Assuming htp_config_set_compression_bomb_limit function in bundled libhtp])
1642 else
1643 echo
1644 echo " ERROR: Libhtp is not bundled. Get libhtp by doing:"
1645 echo " git clone https://github.com/OISF/libhtp"
1646 echo " Then re-run Suricata's autogen.sh and configure script."
1647 echo " Or, if libhtp is installed in a different location,"
1648 echo " pass --enable-non-bundled-htp to Suricata's configure script."
1649 echo " Add --with-libhtp-includes=<dir> and --with-libhtp-libraries=<dir> if"
1650 echo " libhtp is not installed in the include and library paths."
1651 echo
1652 exit 1
1653 fi
1654 fi
1655
1656
1657 # Check for libcap-ng
1658 case $host in
1659 *-*-linux*)
1660 AC_ARG_WITH(libcap_ng_includes,
1661 [ --with-libcap_ng-includes=DIR libcap_ng include directory],
1662 [with_libcap_ng_includes="$withval"],[with_libcap_ng_includes=no])
1663 AC_ARG_WITH(libcap_ng_libraries,
1664 [ --with-libcap_ng-libraries=DIR libcap_ng library directory],
1665 [with_libcap_ng_libraries="$withval"],[with_libcap_ng_libraries="no"])
1666
1667 if test "$with_libcap_ng_includes" != "no"; then
1668 CPPFLAGS="${CPPFLAGS} -I${with_libcap_ng_includes}"
1669 fi
1670
1671 if test "$with_libcap_ng_libraries" != "no"; then
1672 LDFLAGS="${LDFLAGS} -L${with_libcap_ng_libraries}"
1673 fi
1674
1675 AC_CHECK_HEADER(cap-ng.h,,LIBCAP_NG="no")
1676 if test "$LIBCAP_NG" != "no"; then
1677 LIBCAP_NG=""
1678 AC_CHECK_LIB(cap-ng,capng_clear,,LIBCAP_NG="no")
1679 fi
1680
1681 if test "$LIBCAP_NG" != "no"; then
1682 AC_DEFINE([HAVE_LIBCAP_NG],[1],[Libpcap-ng support])
1683 fi
1684
1685 if test "$LIBCAP_NG" = "no"; then
1686 echo
1687 echo " WARNING! libcap-ng library not found, go get it"
1688 echo " from http://people.redhat.com/sgrubb/libcap-ng/"
1689 echo " or your distribution:"
1690 echo
1691 echo " Ubuntu: apt-get install libcap-ng-dev"
1692 echo " Fedora: dnf install libcap-ng-devel"
1693 echo " CentOS/RHEL: yum install libcap-ng-devel"
1694 echo
1695 echo " Suricata will be built without support for dropping privs."
1696 echo
1697 fi
1698 ;;
1699 esac
1700
1701
1702 AC_ARG_ENABLE(ebpf,
1703 AS_HELP_STRING([--enable-ebpf],[Enable eBPF support]),
1704 [ enable_ebpf="$enableval"],
1705 [ enable_ebpf="no"])
1706
1707 have_xdp="no"
1708 if test "$enable_ebpf" = "yes"; then
1709 AC_CHECK_LIB(elf,elf_begin,,LIBELF="no")
1710 if test "$LIBELF" = "no"; then
1711 echo
1712 echo " libelf library and development headers not found but"
1713 echo " but needed to use eBPF code"
1714 echo
1715 exit 1
1716 fi;
1717
1718 AC_CHECK_LIB(bpf,bpf_object__open,,LIBBPF="no")
1719 if test "$LIBBPF" = "no"; then
1720 echo
1721 echo " libbpf library and development headers not found but"
1722 echo " needed to use eBPF code. It can be found at"
1723 echo " https://github.com/libbpf/libbpf"
1724 echo
1725 exit 1
1726 fi;
1727 AC_CHECK_DECL([PACKET_FANOUT_EBPF],
1728 AC_DEFINE([HAVE_PACKET_EBPF],[1],[Recent ebpf fanout support is available]),
1729 [],
1730 [[#include <linux/if_packet.h>]])
1731 AC_CHECK_LIB(bpf, bpf_set_link_xdp_fd,have_xdp="yes")
1732 if test "$have_xdp" = "yes"; then
1733 AC_DEFINE([HAVE_PACKET_XDP],[1],[XDP support is available])
1734 fi
1735 fi;
1736
1737 # Check for DAG support.
1738 AC_ARG_ENABLE(dag,
1739 AS_HELP_STRING([--enable-dag],[Enable DAG capture]),
1740 [ enable_dag=$enableval ],
1741 [ enable_dag=no])
1742 AC_ARG_WITH(dag_includes,
1743 [ --with-dag-includes=DIR dagapi include directory],
1744 [with_dag_includes="$withval"],[with_dag_includes="no"])
1745 AC_ARG_WITH(dag_libraries,
1746 [ --with-dag-libraries=DIR dagapi library directory],
1747 [with_dag_libraries="$withval"],[with_dag_libraries="no"])
1748
1749 if test "$enable_dag" = "yes"; then
1750
1751 if test "$with_dag_includes" != "no"; then
1752 CPPFLAGS="${CPPFLAGS} -I${with_dag_includes}"
1753 fi
1754
1755 if test "$with_dag_libraries" != "no"; then
1756 LDFLAGS="${LDFLAGS} -L${with_dag_libraries}"
1757 fi
1758
1759 AC_CHECK_HEADER(dagapi.h,DAG="yes",DAG="no")
1760 if test "$DAG" != "no"; then
1761 DAG=""
1762 AC_CHECK_LIB(dag,dag_open,,DAG="no",)
1763 fi
1764
1765 if test "$DAG" = "no"; then
1766 echo
1767 echo " ERROR! libdag library not found"
1768 echo
1769 exit 1
1770 fi
1771
1772 AC_DEFINE([HAVE_DAG],[1],(Endace DAG card support enabled))
1773 fi
1774
1775 # libnspr (enabled by default)
1776 AC_ARG_ENABLE(nspr,
1777 AS_HELP_STRING([--disable-nspr],[Disable libnspr support]),
1778 [enable_nspr=$enableval],[enable_nspr="yes"])
1779
1780 AC_ARG_WITH(libnspr_includes,
1781 [ --with-libnspr-includes=DIR libnspr include directory],
1782 [with_libnspr_includes="$withval"],[with_libnspr_includes="no"])
1783
1784 AC_ARG_WITH(libnspr_libraries,
1785 [ --with-libnspr-libraries=DIR libnspr library directory],
1786 [with_libnspr_libraries="$withval"],[with_libnspr_libraries="no"])
1787
1788 if test "$enable_nspr" != "no"; then
1789 # Try pkg-config first:
1790 PKG_CHECK_MODULES([libnspr],nspr,,[with_pkgconfig_nspr="no"])
1791
1792 if test "$with_pkgconfig_nspr" != "no"; then
1793 CPPFLAGS="${CPPFLAGS} ${libnspr_CFLAGS}"
1794 LIBS="${LIBS} ${libnspr_LIBS}"
1795 fi
1796
1797 if test "$with_libnspr_includes" != "no"; then
1798 CPPFLAGS="${CPPFLAGS} -I${with_libnspr_includes}"
1799 fi
1800 TMPLIBS="${LIBS}"
1801 AC_CHECK_HEADER(nspr.h,
1802 AC_CHECK_LIB(nspr4,PR_GetCurrentThread,[AC_DEFINE([HAVE_NSPR],[1],[libnspr available])
1803 NSPR="yes"
1804 if test "$NSPR" = "yes"; then
1805 if test "$with_libnspr_libraries" != "no"; then
1806 LDFLAGS="${LDFLAGS} -L${with_libnspr_libraries}"
1807 LIBS="${TMPLIBS}"
1808 else
1809 LIBS="${TMPLIBS}"
1810 fi
1811 fi]),NSPR="no")
1812
1813 if test "$NSPR" = "no"; then
1814 echo
1815 echo " libnspr library not found, go get it"
1816 echo " from Mozilla or your distribution:"
1817 echo
1818 echo " Ubuntu: apt-get install libnspr4-dev"
1819 echo " Fedora: dnf install nspr-devel"
1820 echo " CentOS/RHEL: yum install nspr-devel"
1821 echo
1822 fi
1823 fi
1824
1825 # libnss (enabled by default)
1826
1827 AC_ARG_ENABLE(nss,
1828 AS_HELP_STRING([--disable-nss],[Disable libnss support]),
1829 [enable_nss=$enableval],[enable_nss="yes"])
1830
1831 AC_ARG_WITH(libnss_includes,
1832 [ --with-libnss-includes=DIR libnss include directory],
1833 [with_libnss_includes="$withval"],[with_libnss_includes="no"])
1834
1835 AC_ARG_WITH(libnss_libraries,
1836 [ --with-libnss-libraries=DIR libnss library directory],
1837 [with_libnss_libraries="$withval"],[with_libnss_libraries="no"])
1838
1839 if test "$enable_nss" != "no"; then
1840 # Try pkg-config first:
1841 PKG_CHECK_MODULES([libnss],nss,,[with_pkgconfig_nss="no"])
1842
1843 if test "$with_pkgconfig_nss" != "no"; then
1844 CPPFLAGS="${CPPFLAGS} ${libnss_CFLAGS}"
1845 LIBS="${LIBS} ${libnss_LIBS}"
1846 fi
1847
1848 if test "$with_libnss_includes" != "no"; then
1849 CPPFLAGS="${CPPFLAGS} -I${with_libnss_includes}"
1850 fi
1851 TMPLIBS="${LIBS}"
1852
1853 AC_CHECK_HEADER(sechash.h,
1854 AC_CHECK_LIB(nss3,HASH_Begin,[AC_DEFINE([HAVE_NSS],[1],[libnss available])
1855 NSS="yes"
1856 if test "$NSS" = "yes"; then
1857 if test "$with_libnss_libraries" != "no"; then
1858 LDFLAGS="${LDFLAGS} -L${with_libnss_libraries}"
1859 LIBS="${TMPLIBS}"
1860 else
1861 LIBS="${TMPLIBS}"
1862 fi
1863 fi]),NSS="no")
1864
1865 if test "$NSS" = "no"; then
1866 echo
1867 echo " libnss library not found, go get it"
1868 echo " from Mozilla or your distribution:"
1869 echo
1870 echo " Ubuntu: apt-get install libnss3-dev"
1871 echo " Fedora: dnf install nss-devel"
1872 echo " CentOS/RHEL: yum install nss-devel"
1873 echo
1874 fi
1875 fi
1876
1877 # libmagic
1878 enable_magic="no"
1879 AC_ARG_ENABLE(libmagic,
1880 AS_HELP_STRING([--enable-libmagic], [Enable libmagic support [default=yes]]),
1881 [enable_magic=$enableval],[enable_magic=yes])
1882 if test "$enable_magic" = "yes"; then
1883 AC_ARG_WITH(libmagic_includes,
1884 [ --with-libmagic-includes=DIR libmagic include directory],
1885 [with_libmagic_includes="$withval"],[with_libmagic_includes=no])
1886 AC_ARG_WITH(libmagic_libraries,
1887 [ --with-libmagic-libraries=DIR libmagic library directory],
1888 [with_libmagic_libraries="$withval"],[with_libmagic_libraries="no"])
1889
1890 if test "$with_libmagic_includes" != "no"; then
1891 CPPFLAGS="${CPPFLAGS} -I${with_libmagic_includes}"
1892 fi
1893
1894 AC_CHECK_HEADER(magic.h,,MAGIC="no")
1895 if test "$MAGIC" != "no"; then
1896 MAGIC=""
1897 AC_CHECK_LIB(magic, magic_open,, MAGIC="no")
1898 fi
1899
1900 if test "x$MAGIC" != "xno"; then
1901 if test "$with_libmagic_libraries" != "no"; then
1902 LDFLAGS="${LDFLAGS} -L${with_libmagic_libraries}"
1903 fi
1904 AC_DEFINE([HAVE_MAGIC],[1],(Libmagic for file handling))
1905 else
1906 echo
1907 echo " WARNING! magic library not found, go get it"
1908 echo " from http://www.darwinsys.com/file/ or your distribution:"
1909 echo
1910 echo " Ubuntu: apt-get install libmagic-dev"
1911 echo " Fedora: dnf install file-devel"
1912 echo " CentOS/RHEL: yum install file-devel"
1913 echo
1914 enable_magic="no"
1915 fi
1916 fi
1917
1918 # Napatech - Using the 3GD API
1919 AC_ARG_ENABLE(napatech,
1920 AS_HELP_STRING([--enable-napatech],[Enabled Napatech Devices]),
1921 [ enable_napatech=$enableval ],
1922 [ enable_napatech=no])
1923 AC_ARG_WITH(napatech_includes,
1924 [ --with-napatech-includes=DIR napatech include directory],
1925 [with_napatech_includes="$withval"],[with_napatech_includes="/opt/napatech3/include"])
1926 AC_ARG_WITH(napatech_libraries,
1927 [ --with-napatech-libraries=DIR napatech library directory],
1928 [with_napatech_libraries="$withval"],[with_napatech_libraries="/opt/napatech3/lib"])
1929
1930 if test "$enable_napatech" = "yes"; then
1931 CPPFLAGS="${CPPFLAGS} -I${with_napatech_includes}"
1932 LDFLAGS="${LDFLAGS} -L${with_napatech_libraries} -lntapi"
1933 AC_CHECK_HEADER(nt.h,NAPATECH="yes",NAPATECH="no")
1934 if test "$NAPATECH" != "no"; then
1935 NAPATECH=""
1936 AC_CHECK_LIB(ntapi, NT_Init,NAPATECH="yes",NAPATECH="no")
1937 fi
1938
1939 if test "$NAPATECH" = "no"; then
1940 echo
1941 echo " ERROR! libntapi library not found"
1942 echo
1943 exit 1
1944 else
1945 AC_CHECK_LIB(numa, numa_available,, LIBNUMA="no")
1946 if test "$LIBNUMA" = "no"; then
1947 echo
1948 echo " WARNING: libnuma is required to use Napatech auto-config"
1949 echo " libnuma is not found. Go get it"
1950 echo " from http://github.com/numactl/numactl or your distribution:"
1951 echo " Ubuntu: apt-get install libnuma-dev"
1952 echo " Fedora: dnf install numactl-devel"
1953 echo " CentOS/RHEL: yum install numactl-devel"
1954 echo
1955 exit 1
1956 fi
1957 fi
1958
1959 AC_DEFINE([HAVE_NAPATECH],[1],(Napatech capture card support))
1960 fi
1961
1962 # liblua
1963 AC_ARG_ENABLE(lua,
1964 AS_HELP_STRING([--enable-lua],[Enable Lua support]),
1965 [ enable_lua="$enableval"],
1966 [ enable_lua="no"])
1967 AC_ARG_ENABLE(luajit,
1968 AS_HELP_STRING([--enable-luajit],[Enable Luajit support]),
1969 [ enable_luajit="$enableval"],
1970 [ enable_luajit="no"])
1971 if test "$enable_lua" = "yes"; then
1972 if test "$enable_luajit" = "yes"; then
1973 echo "ERROR: can't enable liblua and luajit at the same time."
1974 echo "For LuaJIT, just use --enable-luajit. For liblua (no jit)"
1975 echo "support, use just --enable-lua."
1976 echo "Both options will enable the Lua scripting capabilities"
1977 echo "in Suricata".
1978 echo
1979 exit 1
1980 fi
1981 fi
1982
1983 AC_ARG_WITH(liblua_includes,
1984 [ --with-liblua-includes=DIR liblua include directory],
1985 [with_liblua_includes="$withval"],[with_liblua_includes="no"])
1986 AC_ARG_WITH(liblua_libraries,
1987 [ --with-liblua-libraries=DIR liblua library directory],
1988 [with_liblua_libraries="$withval"],[with_liblua_libraries="no"])
1989
1990 if test "$enable_lua" = "yes"; then
1991 if test "$with_liblua_includes" != "no"; then
1992 CPPFLAGS="${CPPFLAGS} -I${with_liblua_includes}"
1993 else
1994 # lua lua51 lua5.1 lua-5.1
1995 PKG_CHECK_MODULES([LUA], [lua], [LUA="yes"], [
1996 PKG_CHECK_MODULES([LUA], [lua5.1], [LUA="yes"], [
1997 PKG_CHECK_MODULES([LUA], [lua-5.1], [LUA="yes"], [
1998 PKG_CHECK_MODULES([LUA], [lua51], [LUA="yes"], [
1999 LUA="no"
2000 ])
2001 ])
2002 ])
2003 ])
2004 CPPFLAGS="${CPPFLAGS} ${LUA_CFLAGS}"
2005 fi
2006
2007 AC_CHECK_HEADER(lualib.h,LUA="yes",LUA="no")
2008 if test "$LUA" = "yes"; then
2009 if test "$with_liblua_libraries" != "no"; then
2010 LDFLAGS="${LDFLAGS} -L${with_liblua_libraries}"
2011 AC_CHECK_LIB(${LUA_LIB_NAME}, luaL_openlibs,, LUA="no")
2012 if test "$LUA" = "no"; then
2013 echo
2014 echo " ERROR! liblua library not found, go get it"
2015 echo " from http://lua.org/index.html or your distribution:"
2016 echo
2017 echo " Ubuntu: apt-get install liblua5.1-dev"
2018 echo " Fedora: dnf install lua-devel"
2019 echo " CentOS/RHEL: yum install lua-devel"
2020 echo
2021 echo " If you installed software in a non-standard prefix"
2022 echo " consider adjusting the PKG_CONFIG_PATH environment variable"
2023 echo " or use --with-liblua-libraries configure option."
2024 echo
2025 exit 1
2026 fi
2027 else
2028 # lua lua51 lua5.1 lua-5.1
2029 PKG_CHECK_MODULES([LUA], [lua], [LUA="yes"], [
2030 PKG_CHECK_MODULES([LUA], [lua5.1], [LUA="yes"], [
2031 PKG_CHECK_MODULES([LUA], [lua-5.1], [LUA="yes"], [
2032 PKG_CHECK_MODULES([LUA], [lua51], [LUA="yes"], [
2033 LUA="no"
2034 ])
2035 ])
2036 ])
2037 ])
2038 LDFLAGS="${LDFLAGS} ${LUA_LIBS}"
2039 fi
2040
2041 if test "$LUA" = "no"; then
2042 AC_CHECK_LIB(lua, luaL_openlibs,, LUA="no")
2043 fi
2044
2045 if test "$LUA" = "yes"; then
2046 AC_DEFINE([HAVE_LUA],[1],[liblua available])
2047 enable_lua="yes"
2048 fi
2049 else
2050 echo
2051 echo " ERROR! liblua headers not found, go get them"
2052 echo " from http://lua.org/index.html or your distribution:"
2053 echo
2054 echo " Ubuntu: apt-get install liblua5.1-dev"
2055 echo " Fedora: dnf install lua-devel"
2056 echo " CentOS/RHEL: yum install lua-devel"
2057 echo
2058 echo " If you installed software in a non-standard prefix"
2059 echo " consider adjusting the PKG_CONFIG_PATH environment variable"
2060 echo " or use --with-liblua-includes and --with-liblua-libraries"
2061 echo " configure option."
2062 echo
2063 exit 1
2064 fi
2065 fi
2066
2067 # libluajit
2068 AC_ARG_WITH(libluajit_includes,
2069 [ --with-libluajit-includes=DIR libluajit include directory],
2070 [with_libluajit_includes="$withval"],[with_libluajit_includes="no"])
2071 AC_ARG_WITH(libluajit_libraries,
2072 [ --with-libluajit-libraries=DIR libluajit library directory],
2073 [with_libluajit_libraries="$withval"],[with_libluajit_libraries="no"])
2074
2075 if test "$enable_luajit" = "yes"; then
2076 if test "$with_libluajit_includes" != "no"; then
2077 CPPFLAGS="${CPPFLAGS} -I${with_libluajit_includes}"
2078 else
2079 PKG_CHECK_MODULES([LUAJIT], [luajit], , LUAJIT="no")
2080 CPPFLAGS="${CPPFLAGS} ${LUAJIT_CFLAGS}"
2081 fi
2082
2083 AC_CHECK_HEADER(lualib.h,LUAJIT="yes",LUAJIT="no")
2084 if test "$LUAJIT" = "yes"; then
2085 if test "$with_libluajit_libraries" != "no"; then
2086 LDFLAGS="${LDFLAGS} -L${with_libluajit_libraries}"
2087 else
2088 PKG_CHECK_MODULES([LUAJIT], [luajit])
2089 LDFLAGS="${LDFLAGS} ${LUAJIT_LIBS}"
2090 fi
2091
2092 AC_CHECK_LIB(luajit-5.1, luaL_openlibs,, LUAJIT="no")
2093
2094 if test "$LUAJIT" = "no"; then
2095 echo
2096 echo " ERROR! libluajit library not found, go get it"
2097 echo " from http://luajit.org/index.html or your distribution:"
2098 echo
2099 echo " Ubuntu: apt-get install libluajit-5.1-dev"
2100 echo
2101 echo " If you installed software in a non-standard prefix"
2102 echo " consider adjusting the PKG_CONFIG_PATH environment variable"
2103 echo " or use --with-libluajit-libraries configure option."
2104 echo
2105 exit 1
2106 fi
2107
2108 AC_DEFINE([HAVE_LUA],[1],[lua support available])
2109 AC_DEFINE([HAVE_LUAJIT],[1],[libluajit available])
2110 enable_lua="yes, through luajit"
2111 enable_luajit="yes"
2112 else
2113 echo
2114 echo " ERROR! libluajit headers not found, go get them"
2115 echo " from http://luajit.org/index.html or your distribution:"
2116 echo
2117 echo " Ubuntu: apt-get install libluajit-5.1-dev"
2118 echo
2119 echo " If you installed software in a non-standard prefix"
2120 echo " consider adjusting the PKG_CONFIG_PATH environment variable"
2121 echo " or use --with-libluajit-includes and --with-libluajit-libraries"
2122 echo " configure option."
2123 echo
2124 exit 1
2125 fi
2126 fi
2127
2128 AM_CONDITIONAL([HAVE_LUA], [test "x$enable_lua" != "xno"])
2129
2130 # If Lua is enabled, test the integer size.
2131 if test "x$enable_lua" = "xyes"; then
2132 TMPLIBS="$LIBS"
2133 LIBS=""
2134
2135 AC_MSG_CHECKING([size of lua integer])
2136 AC_RUN_IFELSE([AC_LANG_PROGRAM([[#include <lua.h>]],
2137 [[
2138 if (sizeof(lua_Integer) == 8) {
2139 return 1;
2140 }
2141 return 0;
2142 ]])],
2143 [
2144 AC_MSG_RESULT([4])
2145 ],
2146 [
2147 AC_MSG_RESULT([8])
2148 AC_SUBST([LUA_INT8], ["lua_int8"])
2149 ])
2150 LIBS="$TMPLIBS"
2151 fi
2152
2153 # libmaxminddb
2154 AC_ARG_ENABLE(geoip,
2155 AS_HELP_STRING([--enable-geoip],[Enable GeoIP2 support]),
2156 [ enable_geoip="$enableval"],
2157 [ enable_geoip="no"])
2158 AC_ARG_WITH(libmaxminddb_includes,
2159 [ --with-libmaxminddb-includes=DIR libmaxminddb include directory],
2160 [with_libmaxminddb_includes="$withval"],[with_libmaxminddb_includes="no"])
2161 AC_ARG_WITH(libmaxminddb_libraries,
2162 [ --with-libmaxminddb-libraries=DIR libmaxminddb library directory],
2163 [with_libmaxminddb_libraries="$withval"],[with_libmaxminddb_libraries="no"])
2164
2165 if test "$enable_geoip" = "yes"; then
2166 if test "$with_libmaxminddb_includes" != "no"; then
2167 CPPFLAGS="${CPPFLAGS} -I${with_libmaxminddb_includes}"
2168 fi
2169
2170 AC_CHECK_HEADER(maxminddb.h,GEOIP="yes",GEOIP="no")
2171 if test "$GEOIP" = "yes"; then
2172 if test "$with_libmaxminddb_libraries" != "no"; then
2173 LDFLAGS="${LDFLAGS} -L${with_libmaxminddb_libraries}"
2174 fi
2175 AC_CHECK_LIB(maxminddb, MMDB_open,, GEOIP="no")
2176 fi
2177 if test "$GEOIP" = "no"; then
2178 echo
2179 echo " ERROR! libmaxminddb GeoIP2 library not found, go get it"
2180 echo " from https://github.com/maxmind/libmaxminddb or your distribution:"
2181 echo
2182 echo " Ubuntu: apt-get install libmaxminddb-dev"
2183 echo " Fedora: dnf install libmaxminddb-devel"
2184 echo " CentOS/RHEL: yum install libmaxminddb-devel"
2185 echo
2186 exit 1
2187 fi
2188
2189 AC_DEFINE([HAVE_GEOIP],[1],[libmaxminddb available])
2190 enable_geoip="yes"
2191 fi
2192
2193 # Position Independent Executable
2194 AC_ARG_ENABLE(pie,
2195 AS_HELP_STRING([--enable-pie],[Enable compiling as a position independent executable]),
2196 [ enable_pie="$enableval"],
2197 [ enable_pie="no"])
2198 if test "$enable_pie" = "yes"; then
2199 CPPFLAGS="${CPPFLAGS} -fPIC"
2200 LDFLAGS="${LDFLAGS} -pie"
2201 fi
2202
2203 #libevent includes and libraries
2204 AC_ARG_WITH(libevent_includes,
2205 [ --with-libevent-includes=DIR libevent include directory],
2206 [with_libevent_includes="$withval"],[with_libevent_includes="no"])
2207 AC_ARG_WITH(libevent_libraries,
2208 [ --with-libevent-libraries=DIR libevent library directory],
2209 [with_libevent_libraries="$withval"],[with_libevent_libraries="no"])
2210
2211 # libhiredis
2212 AC_ARG_ENABLE(hiredis,
2213 AS_HELP_STRING([--enable-hiredis],[Enable Redis support]),
2214 [ enable_hiredis="$enableval"],
2215 [ enable_hiredis="no"])
2216 AC_ARG_WITH(libhiredis_includes,
2217 [ --with-libhiredis-includes=DIR libhiredis include directory],
2218 [with_libhiredis_includes="$withval"],[with_libhiredis_includes="no"])
2219 AC_ARG_WITH(libhiredis_libraries,
2220 [ --with-libhiredis-libraries=DIR libhiredis library directory],
2221 [with_libhiredis_libraries="$withval"],[with_libhiredis_libraries="no"])
2222
2223 enable_hiredis_async="no"
2224 if test "$enable_hiredis" = "yes"; then
2225 if test "$with_libhiredis_includes" != "no"; then
2226 CPPFLAGS="${CPPFLAGS} -I${with_libhiredis_includes}"
2227 fi
2228
2229 AC_CHECK_HEADER("hiredis/hiredis.h",HIREDIS="yes",HIREDIS="no")
2230 if test "$HIREDIS" = "yes"; then
2231 if test "$with_libhiredis_libraries" != "no"; then
2232 LDFLAGS="${LDFLAGS} -L${with_libhiredis_libraries}"
2233 fi
2234 AC_CHECK_LIB(hiredis, redisConnect,, HIREDIS="no")
2235 fi
2236 if test "$HIREDIS" = "no"; then
2237 echo
2238 echo " ERROR! libhiredis library not found, go get it"
2239 echo " from https://github.com/redis/hiredis or your distribution:"
2240 echo
2241 echo " Ubuntu: apt-get install libhiredis-dev"
2242 echo " Fedora: dnf install hiredis-devel"
2243 echo " CentOS/RHEL: yum install hiredis-devel"
2244 echo
2245 exit 1
2246 fi
2247 if test "$HIREDIS" = "yes"; then
2248 AC_DEFINE([HAVE_LIBHIREDIS],[1],[libhiredis available])
2249 enable_hiredis="yes"
2250 #
2251 # Check if async adapters and libevent is installed
2252 #
2253 AC_CHECK_HEADER("hiredis/adapters/libevent.h",HIREDIS_LIBEVENT_ADAPTER="yes",HIREDIS_LIBEVENT_ADAPTER="no")
2254 if test "$HIREDIS_LIBEVENT_ADAPTER" = "yes"; then
2255 #Look for libevent headers
2256 if test "$with_libevent_includes" != "no"; then
2257 CPPFLAGS="${CPPFLAGS} -I${with_libevent_includes}"
2258 fi
2259 AC_CHECK_HEADER("event.h",LIBEVENT="yes",LIBEVENT="no")
2260 if test "$LIBEVENT" = "yes"; then
2261 if test "$with_libevent_libraries" != "no"; then
2262 LDFLAGS="${LDFLAGS} -L${with_libevent_libraries}"
2263 fi
2264 AC_CHECK_LIB(event, event_base_free,, HAVE_LIBEVENT="no")
2265 AC_CHECK_LIB(event_pthreads, evthread_use_pthreads,, HAVE_LIBEVENT_PTHREADS="no")
2266 fi
2267 if [ test "$HAVE_LIBEVENT" = "no" ] && [ -o test "$HAVE_LIBEVENT_PTHREADS" = "no"]; then
2268 if test "$HAVE_LIBEVENT" = "no"; then
2269 echo
2270 echo " Async mode for redis output will not be available."
2271 echo " To enable it install libevent"
2272 echo
2273 echo " Ubuntu: apt-get install libevent-dev"
2274 echo " Fedora: dnf install libevent-devel"
2275 echo " CentOS/RHEL: yum install libevent-devel"
2276 echo
2277 fi
2278 if test "$HAVE_LIBEVENT_PTHREADS" = "no"; then
2279 echo
2280 echo " Async mode for redis output will not be available."
2281 echo " To enable it install libevent with pthreads support"
2282 echo
2283 echo " Ubuntu: apt-get install libevent-pthreads-2.0-5"
2284 echo
2285 fi
2286 else
2287 AC_DEFINE([HAVE_LIBEVENT],[1],[libevent available])
2288 enable_hiredis_async="yes"
2289 fi
2290 fi
2291 fi
2292 fi
2293
2294 # Check for lz4
2295 enable_liblz4="yes"
2296 AC_CHECK_LIB(lz4, LZ4F_createCompressionContext, , enable_liblz4="no")
2297
2298 if test "$enable_liblz4" = "no"; then
2299 echo
2300 echo " Compressed pcap logging is not available without liblz4."
2301 echo " If you want to enable compression, you need to install it."
2302 echo
2303 echo " Ubuntu: apt-get install liblz4-dev"
2304 echo " Fedora: dnf install lz4-devel"
2305 echo " CentOS/RHEL: yum install epel-release"
2306 echo " yum install lz4-devel"
2307 echo
2308 fi
2309
2310 # get cache line size
2311 AC_PATH_PROG(HAVE_GETCONF_CMD, getconf, "no")
2312 if test "$HAVE_GETCONF_CMD" != "no"; then
2313 CLS=$(getconf LEVEL1_DCACHE_LINESIZE)
2314 if [test "$CLS" != "" && test "$CLS" != "0"]; then
2315 AC_DEFINE_UNQUOTED([CLS],[${CLS}],[L1 cache line size])
2316 else
2317 AC_DEFINE([CLS],[64],[L1 cache line size])
2318 fi
2319 else
2320 AC_DEFINE([CLS],[64],[L1 cache line size])
2321 fi
2322
2323 # sphinx for documentation
2324 AC_PATH_PROG(HAVE_SPHINXBUILD, sphinx-build, "no")
2325 if test "$HAVE_SPHINXBUILD" = "no"; then
2326 enable_sphinxbuild=no
2327 if test -e "$srcdir/doc/userguide/suricata.1"; then
2328 have_suricata_man=yes
2329 fi
2330 fi
2331 AM_CONDITIONAL([HAVE_SPHINXBUILD], [test "x$enable_sphinxbuild" != "xno"])
2332 AM_CONDITIONAL([HAVE_SURICATA_MAN], [test "x$have_suricata_man" = "xyes"])
2333
2334 # pdflatex for the pdf version of the user manual
2335 AC_PATH_PROG(HAVE_PDFLATEX, pdflatex, "no")
2336 if test "$HAVE_PDFLATEX" = "no"; then
2337 enable_pdflatex=no
2338 fi
2339 AM_CONDITIONAL([HAVE_PDFLATEX], [test "x$enable_pdflatex" != "xno"])
2340
2341 # Cargo/Rust
2342 AM_CONDITIONAL([RUST_CROSS_COMPILE], [test "x$cross_compiling" = "xyes"])
2343 AC_PATH_PROG(RUSTC, rustc, "no")
2344 if test "$RUSTC" = "no"; then
2345 echo ""
2346 echo " ERROR: Suricata now requires Rust to build."
2347 echo ""
2348 echo " Ubuntu/Debian: apt install rustc cargo"
2349 echo " Fedora: dnf install rustc cargo"
2350 echo " CentOS: yum install rustc cargo (requires EPEL)"
2351 echo ""
2352 echo " Rustup works as well: https://rustup.rs/"
2353 echo ""
2354 exit 1
2355 fi
2356
2357 AC_PATH_PROG(CARGO, cargo, "no")
2358 if test "CARGO" = "no"; then
2359 AC_MSG_ERROR([cargo required])
2360 fi
2361
2362 AC_DEFINE([HAVE_RUST],[1],[Enable Rust language])
2363 AM_CONDITIONAL([HAVE_RUST],true)
2364 AC_SUBST([CARGO], [$CARGO])
2365
2366 enable_rust="yes"
2367 rust_compiler_version=$($RUSTC --version)
2368 rustc_version=$(echo "$rust_compiler_version" | sed 's/^.*[[^0-9]]\([[0-9]]*\.[[0-9]]*\.[[0-9]]*\).*$/\1/')
2369 rust_cargo_version=$($CARGO --version)
2370
2371 MIN_RUSTC_VERSION="1.33.0"
2372 AC_MSG_CHECKING(for Rust version $MIN_RUSTC_VERSION or newer)
2373 AS_VERSION_COMPARE([$rustc_version], [$MIN_RUSTC_VERSION],
2374 [
2375 echo ""
2376 echo "ERROR: Rust $MIN_RUSTC_VERSION or newer required."
2377 echo ""
2378 echo "Rust version ${rustc_version} was found."
2379 echo ""
2380 exit 1
2381 ],
2382 [],
2383 [])
2384 AC_MSG_RESULT(yes)
2385
2386 rust_vendor_comment="# "
2387 have_rust_vendor="no"
2388
2389 # We may require Python if the Rust header stubs are not already
2390 # generated.
2391 if test "x$enable_python" != "xyes" && test ! -f rust/gen/c-headers/rust-core-gen.h; then
2392 echo ""
2393 echo " ERROR! Rust support requires Python."
2394 echo
2395 echo " Ubuntu: apt install python"
2396 echo
2397 exit 1
2398 fi
2399
2400 if test "x$cross_compiling" = "xyes"; then
2401 RUST_SURICATA_LIB_XC_DIR="${host_alias}/"
2402 else
2403 RUST_SURICATA_LIB_XC_DIR=
2404 fi
2405
2406 if test "x$enable_debug" = "xyes"; then
2407 RUST_SURICATA_LIB="../rust/target/${RUST_SURICATA_LIB_XC_DIR}debug/${RUST_SURICATA_LIBNAME}"
2408 else
2409 RUST_SURICATA_LIB="../rust/target/${RUST_SURICATA_LIB_XC_DIR}release/${RUST_SURICATA_LIBNAME}"
2410 fi
2411
2412 RUST_LDADD="${RUST_SURICATA_LIB} ${RUST_LDADD}"
2413 CFLAGS="${CFLAGS} -I\${srcdir}/../rust/gen/c-headers"
2414 AC_SUBST(RUST_SURICATA_LIB)
2415 AC_SUBST(RUST_LDADD)
2416 if test "x$CARGO_HOME" = "x"; then
2417 AC_SUBST([CARGO_HOME], [~/.cargo])
2418 else
2419 AC_SUBST([CARGO_HOME], [$CARGO_HOME])
2420 fi
2421
2422 # Check for rustup. RUSTUP_HOME needs to be set if rustup is in
2423 # use, and a user uses sudo (depending on configuration), or su to
2424 # perform the install
2425 rustup_home_path="no"
2426 if test "x$RUSTUP_HOME" != "x"; then
2427 rustup_home_path="$RUSTUP_HOME"
2428 else
2429 AC_PATH_PROG(have_rustup, rustup, "no")
2430 if test "x$have_rustup" != "xno"; then
2431 rustup_home_path=$($have_rustup show home 2>/dev/null || echo "no")
2432 fi
2433 fi
2434 rustup_home=""
2435 if test "x$rustup_home_path" != "xno"; then
2436 rustup_home="RUSTUP_HOME=\$(RUSTUP_HOME_PATH)"
2437 fi
2438 AC_SUBST([RUSTUP_HOME_PATH], [$rustup_home_path])
2439 AC_SUBST([rustup_home])
2440
2441 if test -f "$srcdir/rust/vendor"; then
2442 have_rust_vendor="yes"
2443 fi
2444
2445 if test "x$have_rust_vendor" = "xyes"; then
2446 rust_vendor_comment=""
2447 fi
2448
2449 AC_SUBST(rust_vendor_comment)
2450 AM_CONDITIONAL([HAVE_RUST_VENDOR], [test "x$have_rust_vendor" = "xyes"])
2451
2452 if test "x$enable_rust" = "xyes" || test "x$enable_rust" = "xyes (default)"; then
2453 AC_PATH_PROG(HAVE_CARGO_VENDOR, cargo-vendor, "no")
2454 if test "x$HAVE_CARGO_VENDOR" = "xno"; then
2455 echo " Warning: cargo-vendor not found, but it is only required"
2456 echo " for building the distribution"
2457 echo " To install: cargo install cargo-vendor"
2458 fi
2459 fi
2460 AM_CONDITIONAL([HAVE_CARGO_VENDOR], [test "x$HAVE_CARGO_VENDOR" != "xno"])
2461
2462 AC_ARG_ENABLE(rust_strict,
2463 AS_HELP_STRING([--enable-rust-strict], [Rust warnings as errors]),[enable_rust_strict=$enableval],[enable_rust_strict=no])
2464 AS_IF([test "x$enable_rust_strict" = "xyes"], [
2465 RUST_FEATURES="strict"
2466 ])
2467 AC_SUBST(RUST_FEATURES)
2468
2469 # get revision
2470 if test -f ./revision; then
2471 REVISION=`cat ./revision`
2472 AC_DEFINE_UNQUOTED([REVISION],[${REVISION}],[Git revision])
2473 else
2474 AC_PATH_PROG(HAVE_GIT_CMD, git, "no")
2475 if test "$HAVE_GIT_CMD" != "no"; then
2476 if [ test -d .git ]; then
2477 REVISION=`git rev-parse --short HEAD`
2478 DATE=`git log -1 --date=short --pretty=format:%cd`
2479 REVISION="$REVISION $DATE"
2480 AC_DEFINE_UNQUOTED([REVISION],[${REVISION}],[Git revision])
2481 fi
2482 fi
2483 fi
2484
2485 if test "${enable_ebpf}" = "yes" || test "${enable_unittests}" = "yes"; then
2486 AC_DEFINE([CAPTURE_OFFLOAD_MANAGER], [1],[Building flow bypass manager code])
2487 fi
2488 if test "${enable_ebpf}" = "yes" || test "${enable_nfqueue}" = "yes" || test "${enable_pfring}" = "yes" || test "${enable_unittests}" = "yes"; then
2489 AC_DEFINE([CAPTURE_OFFLOAD], [1],[Building flow capture bypass code])
2490 fi
2491
2492 AC_SUBST(CFLAGS)
2493 AC_SUBST(LDFLAGS)
2494 AC_SUBST(CPPFLAGS)
2495
2496 define([EXPAND_VARIABLE],
2497 [$2=[$]$1
2498 if test $prefix = 'NONE'; then
2499 prefix="/usr/local"
2500 fi
2501 while true; do
2502 case "[$]$2" in
2503 *\[$]* ) eval "$2=[$]$2" ;;
2504 *) break ;;
2505 esac
2506 done
2507 eval "$2=[$]$2$3"
2508 ])dnl EXPAND_VARIABLE
2509
2510 # suricata log dir
2511 if test "$WINDOWS_PATH" = "yes"; then
2512 case $host in
2513 x86_64-w64-mingw32)
2514 e_winbase="C:\\\\Program Files\\\\Suricata"
2515 ;;
2516 *)
2517 systemtype="`systeminfo | grep \"based PC\"`"
2518 case "$systemtype" in
2519 *x64*)
2520 e_winbase="C:\\\\Program Files (x86)\\\\Suricata"
2521 ;;
2522 *)
2523 e_winbase="C:\\\\Program Files\\\\Suricata"
2524 ;;
2525 esac
2526 esac
2527
2528 e_sysconfdir="${e_winbase}\\\\"
2529 e_defaultruledir="$e_winbase\\\\rules\\\\"
2530 e_magic_file="$e_winbase\\\\magic.mgc"
2531 e_logdir="$e_winbase\\\\log"
2532 e_logfilesdir="$e_logdir\\\\files"
2533 e_logcertsdir="$e_logdir\\\\certs"
2534 e_datarulesdir="$e_winbase\\\\rules\\\\"
2535 if test "$HAVE_CYGPATH" != "no"; then
2536 # turn srcdir into abs path and convert to the
2537 # mixed output (/c/Users/dev into c:/Users/dev)
2538 e_rustdir="$(cygpath -a -t mixed ${srcdir})/rust"
2539 else
2540 e_abs_srcdir=$(cd $srcdir && pwd)
2541 e_rustdir="$e_abs_srcdir/rust"
2542 fi
2543 else
2544 EXPAND_VARIABLE(localstatedir, e_logdir, "/log/suricata/")
2545 EXPAND_VARIABLE(localstatedir, e_rundir, "/run/")
2546 EXPAND_VARIABLE(localstatedir, e_logfilesdir, "/log/suricata/files")
2547 EXPAND_VARIABLE(localstatedir, e_logcertsdir, "/log/suricata/certs")
2548 EXPAND_VARIABLE(sysconfdir, e_sysconfdir, "/suricata/")
2549 EXPAND_VARIABLE(localstatedir, e_localstatedir, "/run/suricata")
2550 EXPAND_VARIABLE(datadir, e_datarulesdir, "/suricata/rules")
2551 EXPAND_VARIABLE(localstatedir, e_datadir, "/lib/suricata/data")
2552 EXPAND_VARIABLE(ruledirprefix, e_defaultruledir, "/suricata/rules")
2553
2554 e_abs_srcdir=$(cd $srcdir && pwd)
2555 EXPAND_VARIABLE(e_abs_srcdir, e_rustdir, "/rust")
2556 fi
2557 AC_SUBST(e_logdir)
2558 AC_SUBST(e_rundir)
2559 AC_SUBST(e_logfilesdir)
2560 AC_SUBST(e_logcertsdir)
2561 AC_SUBST(e_sysconfdir)
2562 AC_DEFINE_UNQUOTED([CONFIG_DIR],["$e_sysconfdir"],[Our CONFIG_DIR])
2563 AC_SUBST(e_localstatedir)
2564 AC_DEFINE_UNQUOTED([DATA_DIR],["$e_datadir"],[Our DATA_DIR])
2565 AC_SUBST(e_magic_file)
2566 AC_SUBST(e_magic_file_comment)
2567 AC_SUBST(e_enable_evelog)
2568 AC_SUBST(e_datarulesdir)
2569 AC_SUBST(e_defaultruledir)
2570 AC_SUBST(e_rustdir)
2571
2572 EXPAND_VARIABLE(prefix, CONFIGURE_PREFIX)
2573 EXPAND_VARIABLE(sysconfdir, CONFIGURE_SYSCONDIR)
2574 EXPAND_VARIABLE(localstatedir, CONFIGURE_LOCALSTATEDIR)
2575 EXPAND_VARIABLE(datadir, CONFIGURE_DATAROOTDIR)
2576 AC_SUBST(CONFIGURE_PREFIX)
2577 AC_SUBST(CONFIGURE_SYSCONDIR)
2578 AC_SUBST(CONFIGURE_LOCALSTATEDIR)
2579 AC_SUBST(CONFIGURE_DATAROOTDIR)
2580 AC_SUBST(PACKAGE_VERSION)
2581
2582 AC_CONFIG_FILES(Makefile src/Makefile rust/Makefile rust/Cargo.toml rust/.cargo/config)
2583 AC_CONFIG_FILES(qa/Makefile qa/coccinelle/Makefile)
2584 AC_CONFIG_FILES(rules/Makefile doc/Makefile doc/userguide/Makefile)
2585 AC_CONFIG_FILES(contrib/Makefile contrib/file_processor/Makefile contrib/file_processor/Action/Makefile contrib/file_processor/Processor/Makefile)
2586 AC_CONFIG_FILES(suricata.yaml etc/Makefile etc/suricata.logrotate etc/suricata.service)
2587 AC_CONFIG_FILES(python/Makefile python/suricata/config/defaults.py)
2588 AC_CONFIG_FILES(ebpf/Makefile)
2589 AC_OUTPUT
2590
2591 SURICATA_BUILD_CONF="Suricata Configuration:
2592 AF_PACKET support: ${enable_af_packet}
2593 eBPF support: ${enable_ebpf}
2594 XDP support: ${have_xdp}
2595 PF_RING support: ${enable_pfring}
2596 NFQueue support: ${enable_nfqueue}
2597 NFLOG support: ${enable_nflog}
2598 IPFW support: ${enable_ipfw}
2599 Netmap support: ${enable_netmap} ${have_netmap_version}
2600 DAG enabled: ${enable_dag}
2601 Napatech enabled: ${enable_napatech}
2602 WinDivert enabled: ${enable_windivert}
2603
2604 Unix socket enabled: ${enable_unixsocket}
2605 Detection enabled: ${enable_detection}
2606
2607 Libmagic support: ${enable_magic}
2608 libnss support: ${enable_nss}
2609 libnspr support: ${enable_nspr}
2610 libjansson support: ${enable_jansson}
2611 hiredis support: ${enable_hiredis}
2612 hiredis async with libevent: ${enable_hiredis_async}
2613 Prelude support: ${enable_prelude}
2614 PCRE jit: ${pcre_jit_available}
2615 LUA support: ${enable_lua}
2616 libluajit: ${enable_luajit}
2617 GeoIP2 support: ${enable_geoip}
2618 Non-bundled htp: ${enable_non_bundled_htp}
2619 Old barnyard2 support: ${enable_old_barnyard2}
2620 Hyperscan support: ${enable_hyperscan}
2621 Libnet support: ${enable_libnet}
2622 liblz4 support: ${enable_liblz4}
2623
2624 Rust support: ${enable_rust}
2625 Rust strict mode: ${enable_rust_strict}
2626 Rust compiler path: ${RUSTC}
2627 Rust compiler version: ${rust_compiler_version}
2628 Cargo path: ${CARGO}
2629 Cargo version: ${rust_cargo_version}
2630
2631 Python support: ${enable_python}
2632 Python path: ${python_path}
2633 Python distutils ${have_python_distutils}
2634 Python yaml ${have_python_yaml}
2635 Install suricatactl: ${install_suricatactl}
2636 Install suricatasc: ${install_suricatactl}
2637 Install suricata-update: ${install_suricata_update}
2638
2639 Profiling enabled: ${enable_profiling}
2640 Profiling locks enabled: ${enable_profiling_locks}
2641
2642 Development settings:
2643 Coccinelle / spatch: ${enable_coccinelle}
2644 Unit tests enabled: ${enable_unittests}
2645 Debug output enabled: ${enable_debug}
2646 Debug validation enabled: ${enable_debug_validation}
2647
2648 Generic build parameters:
2649 Installation prefix: ${prefix}
2650 Configuration directory: ${e_sysconfdir}
2651 Log directory: ${e_logdir}
2652
2653 --prefix ${CONFIGURE_PREFIX}
2654 --sysconfdir ${CONFIGURE_SYSCONDIR}
2655 --localstatedir ${CONFIGURE_LOCALSTATEDIR}
2656 --datarootdir ${CONFIGURE_DATAROOTDIR}
2657
2658 Host: ${host}
2659 Compiler: ${CC} (exec name) / ${compiler} (real)
2660 GCC Protect enabled: ${enable_gccprotect}
2661 GCC march native enabled: ${enable_gccmarch_native}
2662 GCC Profile enabled: ${enable_gccprofile}
2663 Position Independent Executable enabled: ${enable_pie}
2664 CFLAGS ${CFLAGS}
2665 PCAP_CFLAGS ${PCAP_CFLAGS}
2666 SECCFLAGS ${SECCFLAGS}"
2667
2668 echo
2669 echo "$SURICATA_BUILD_CONF"
2670 echo "printf(" >src/build-info.h
2671 echo "$SURICATA_BUILD_CONF" | sed -e 's/^/"/' | sed -e 's/$/\\n"/' >>src/build-info.h
2672 echo ");" >>src/build-info.h
2673
2674 echo "
2675 To build and install run 'make' and 'make install'.
2676
2677 You can run 'make install-conf' if you want to install initial configuration
2678 files to ${e_sysconfdir}. Running 'make install-full' will install configuration
2679 and rules and provide you a ready-to-run suricata."
2680 echo
2681 echo "To install Suricata into /usr/bin/suricata, have the config in
2682 /etc/suricata and use /var/log/suricata as log dir, use:
2683 ./configure --prefix=/usr/ --sysconfdir=/etc/ --localstatedir=/var/"
2684 echo