1 AC_INIT([suricata],[6.0.1-dev])
2 m4_ifndef([AM_SILENT_RULES], [m4_define([AM_SILENT_RULES],[])])AM_SILENT_RULES([yes])
3 AC_CONFIG_HEADERS([src/autoconf.h])
4 AC_CONFIG_SRCDIR([src/suricata.c])
5 AC_CONFIG_MACRO_DIR(m4)
6 AM_INIT_AUTOMAKE([tar-ustar subdir-objects])
12 dnl Taken from https://llvm.org/svn/llvm-project/llvm/trunk/autoconf/configure.ac
13 dnl check if we compile using clang or gcc. On some systems the gcc binary is
14 dnl is actually clang, so do a compile test.
15 AC_MSG_CHECKING([whether GCC or Clang is our compiler])
18 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#if ! __clang__
23 [AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#if ! __GNUC__
29 AC_MSG_RESULT([${compiler}])
32 [ --with-clang=PROGRAM path to Clang for compiling eBPF code. Use if the main C compiler is not Clang.],
34 [AS_IF([test "$compiler" = clang],
36 [AC_PATH_PROG([CLANG],[clang])])])
42 CLANG_CFLAGS="-Wextra -Werror-implicit-function-declaration -Wno-error=unused-command-line-argument"
43 AC_SUBST(CLANG_CFLAGS)
47 AC_MSG_CHECKING([gcc version])
48 gccver=$($CC -dumpversion)
49 gccvermajor=$(echo $gccver | cut -d . -f1)
50 gccverminor=$(echo $gccver | cut -d . -f2)
51 gccvernum=$(expr $gccvermajor "*" 100 + $gccverminor)
52 AC_MSG_RESULT($gccver)
54 if test "$gccvernum" -ge "400"; then
56 GCC_CFLAGS="-Wextra -Werror-implicit-function-declaration"
63 AC_MSG_WARN([unsupported/untested compiler, this may or may not work])
67 # Checks for programs.
77 AC_PATH_PROG(HAVE_CYGPATH, cygpath, "no")
78 AM_CONDITIONAL([HAVE_CYGPATH], [test "x$HAVE_CYGPATH" != "xno"])
80 AC_PATH_PROG(HAVE_PKG_CONFIG, pkg-config, "no")
81 if test "$HAVE_PKG_CONFIG" = "no"; then
83 echo " ERROR! pkg-config not found, go get it "
84 echo " http://pkg-config.freedesktop.org/wiki/ "
85 echo " or install from your distribution "
93 AS_HELP_STRING([--enable-python], [Enable python]),
94 [enable_python=$enableval],[enable_python=yes])
95 if test "x$enable_python" != "xyes"; then
98 AC_PATH_PROGS(HAVE_PYTHON, python3 python2.7 python2 python, "no")
99 if test "$HAVE_PYTHON" = "no"; then
101 echo " Warning! Python not found."
103 echo " Python is required for additional tools like"
104 echo " suricatasc, suricatactl and suricata-update."
105 echo " It is also required when building from git."
109 python_path="$HAVE_PYTHON"
112 AM_CONDITIONAL([HAVE_PYTHON], [test "x$enable_python" = "xyes"])
114 # Get the Python major version. This is only for information
115 # messages displayed during configure.
116 if test "x$HAVE_PYTHON" != "xno"; then
117 pymv="$($HAVE_PYTHON -c 'import sys; print(sys.version_info[[0]]);')"
120 # Check for python-distutils (setup).
121 have_python_distutils="no"
122 if test "x$enable_python" = "xyes"; then
123 AC_MSG_CHECKING([for python-distutils])
124 if $HAVE_PYTHON -c "import distutils; from distutils.core import setup" 2>/dev/null; then
126 have_python_distutils="yes"
131 AM_CONDITIONAL([HAVE_PYTHON_DISTUTILS],
132 [test "x$have_python_distutils" = "xyes"])
133 if test "$have_python_distutils" = "no"; then
135 echo " Warning: Python distutils not found. Python tools will"
136 echo " not be installed."
138 echo " Install the distutils module for Python ${pymv} to enable"
139 echo " the Python tools."
143 # Check for python-yaml.
144 have_python_yaml="no"
145 if test "x$enable_python" = "xyes"; then
146 AC_MSG_CHECKING([for python-yaml])
147 if $HAVE_PYTHON -c "import yaml" 2>/dev/null; then
148 have_python_yaml="yes"
154 AM_CONDITIONAL([HAVE_PYTHON_YAML], [test "x$have_python_yaml" = "xyes"])
156 AC_PATH_PROG(HAVE_WGET, wget, "no")
157 if test "$HAVE_WGET" = "no"; then
158 AC_PATH_PROG(HAVE_CURL, curl, "no")
159 if test "$HAVE_CURL" = "no"; then
161 echo " Warning curl or wget not found, you won't be able to"
162 echo " download latest ruleset with 'make install-rules'"
165 AM_CONDITIONAL([HAVE_FETCH_COMMAND], [test "x$HAVE_WGET" != "xno" || test "x$HAVE_CURL" != "xno"])
166 AM_CONDITIONAL([HAVE_WGET_COMMAND], [test "x$HAVE_WGET" != "xno"])
168 # Checks for libraries.
170 # Checks for header files.
171 AC_CHECK_HEADERS([stddef.h])
172 AC_CHECK_HEADERS([arpa/inet.h assert.h ctype.h errno.h fcntl.h inttypes.h])
173 AC_CHECK_HEADERS([getopt.h])
174 AC_CHECK_HEADERS([limits.h netdb.h netinet/in.h poll.h sched.h signal.h])
175 AC_CHECK_HEADERS([stdarg.h stdint.h stdio.h stdlib.h stdbool.h string.h strings.h sys/ioctl.h])
176 AC_CHECK_HEADERS([syslog.h sys/prctl.h sys/socket.h sys/stat.h sys/syscall.h])
177 AC_CHECK_HEADERS([sys/time.h time.h unistd.h sys/param.h])
178 AC_CHECK_HEADERS([sys/ioctl.h linux/if_ether.h linux/if_packet.h linux/filter.h])
179 AC_CHECK_HEADERS([linux/ethtool.h linux/sockios.h])
180 AC_CHECK_HEADERS([glob.h locale.h grp.h pwd.h])
181 AC_CHECK_HEADERS([dirent.h fnmatch.h])
182 AC_CHECK_HEADERS([sys/resource.h sys/types.h sys/un.h])
183 AC_CHECK_HEADERS([sys/random.h])
184 AC_CHECK_HEADERS([utime.h])
185 AC_CHECK_HEADERS([libgen.h])
186 AC_CHECK_HEADERS([mach/mach.h])
187 AC_CHECK_HEADERS([stdatomic.h])
189 AC_CHECK_HEADERS([sys/socket.h net/if.h sys/mman.h linux/if_arp.h], [], [],
190 [[#ifdef HAVE_SYS_SOCKET_H
191 #include <sys/types.h>
192 #include <sys/socket.h>
196 AC_CHECK_HEADERS([windows.h winsock2.h ws2tcpip.h w32api/wtypes.h], [], [],
202 AC_CHECK_HEADERS([w32api/winbase.h wincrypt.h], [], [],
210 # Checks for typedefs, structures, and compiler characteristics.
230 AC_CHECK_TYPES([ptrdiff_t])
233 # Checks for library functions.
241 AC_CHECK_FUNCS([memmem memset memchr memrchr memmove])
242 AC_CHECK_FUNCS([strcasecmp strchr strrchr strdup strndup strncasecmp strtol strtoul strstr strpbrk strtoull strtoumax])
243 AC_CHECK_FUNCS([strerror])
244 AC_CHECK_FUNCS([gethostname inet_ntoa uname])
245 AC_CHECK_FUNCS([gettimeofday clock_gettime utime strptime tzset localtime_r])
246 AC_CHECK_FUNCS([socket setenv select putenv dup2 endgrent endpwent atexit munmap])
248 AC_CHECK_FUNCS([fwrite_unlocked])
250 AC_CHECK_DECL([getrandom],
251 AC_DEFINE([HAVE_GETRANDOM], [1], [Use getrandom]),
253 #include <sys/random.h>
258 AC_CHECK_FUNCS([strlcpy strlcat])
261 # Add large file support
265 AC_MSG_CHECKING([host os])
267 # Default lua libname if not detected otherwise.
268 LUA_LIB_NAME="lua5.1"
270 # If no host os was detected, try with uname
271 if test -z "$host" ; then
274 echo -n "installation for $host OS... "
276 RUST_SURICATA_LIBNAME="libsuricata.a"
279 e_magic_file_comment="#"
283 LUA_LIB_NAME="lua-5.1"
284 CFLAGS="${CFLAGS} -DOS_FREEBSD"
285 CPPFLAGS="${CPPFLAGS} -I/usr/local/include -I/usr/local/include/libnet11"
286 LDFLAGS="${LDFLAGS} -L/usr/local/lib -L/usr/local/lib/libnet11"
287 RUST_LDADD="-lrt -lm"
290 CFLAGS="${CFLAGS} -D__OpenBSD__"
291 CPPFLAGS="${CPPFLAGS} -I/usr/local/include -I/usr/local/include/libnet-1.1"
292 LDFLAGS="${LDFLAGS} -L/usr/local/lib -I/usr/local/lib/libnet-1.1"
293 RUST_LDADD="-lm -lc++ -lc++abi"
296 LUA_LIB_NAME="lua-5.1"
297 CFLAGS="${CFLAGS} -DOS_DARWIN"
298 CPPFLAGS="${CPPFLAGS} -I/opt/local/include"
299 LDFLAGS="${LDFLAGS} -L/opt/local/lib"
302 RUST_LDADD="-ldl -lrt -lm"
304 *-*-mingw32*|*-*-msys)
305 CFLAGS="${CFLAGS} -DOS_WIN32"
306 LDFLAGS="${LDFLAGS} -lws2_32 -liphlpapi -lwbemuuid -lOle32 -lOleAut32 -lUuid"
308 PCAP_LIB_NAME="wpcap"
309 AC_DEFINE([HAVE_NON_POSIX_MKDIR], [1], [mkdir is not POSIX compliant: single arg])
310 RUST_SURICATA_LIBNAME="suricata.lib"
311 RUST_LDADD="-luserenv -lshell32 -ladvapi32 -lgcc_eh"
316 PCAP_LIB_NAME="wpcap"
319 AC_MSG_WARN([support for Solaris/Illumos/SunOS is experimental])
320 LDFLAGS="${LDFLAGS} -lsocket -lnsl"
323 AC_MSG_WARN([unsupported OS this may or may not work])
328 # check if our target supports c11
329 AC_MSG_CHECKING(for c11 support)
332 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h>]],
333 [[ static _Thread_local int i; i = 1; i++; ]])],
335 [AC_DEFINE([TLS_C11], [1], [C11 Thread local storage])
336 CFLAGS="$OCFLAGS -std=c11"],
341 if [ test "x$have_c11" = "xno" ]; then
342 CFLAGS="$CFLAGS -std=gnu99"
345 # check if our target supports thread local storage
346 AC_MSG_CHECKING(for thread local storage gnu __thread support)
347 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h>]],
348 [[ static __thread int i; i = 1; i++; ]])],
349 [AC_DEFINE([TLS_GNU], [1], [Thread local storage])
350 AC_MSG_RESULT([yes])],
353 if [ test "x$have_c11_tls" = "xno" ] && [ test "x$have_gnu_tls" = "xno" ]; then
354 AC_MSG_ERROR("no thread local support available.")
358 #Enable support for gcc compile time security options. There is no great way to do detection of valid cflags that I have found
359 #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.
360 #These flags seem to be supported on CentOS 5+, Ubuntu 8.04+, and FedoreCore 11+
361 #Options are taken from https://wiki.ubuntu.com/CompilerFlags
362 AC_ARG_ENABLE(gccprotect,
363 AS_HELP_STRING([--enable-gccprotect], [Detect and use gcc hardening options]),[enable_gccprotect=$enableval],[enable_gccprotect=no])
365 AS_IF([test "x$enable_gccprotect" = "xyes"], [
366 #buffer overflow protection
367 AC_MSG_CHECKING(for -fstack-protector)
368 TMPCFLAGS="${CFLAGS}"
369 CFLAGS="${CFLAGS} -fstack-protector"
370 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[SECCFLAGS="-fstack-protector"
373 CFLAGS="${TMPCFLAGS}"
375 #compile-time best-practices errors for certain libc functions, provides checks of buffer lengths and memory regions
376 AC_MSG_CHECKING(for -D_FORTIFY_SOURCE=2)
377 TMPCFLAGS="${CFLAGS}"
378 CFLAGS="${CFLAGS} -D_FORTIFY_SOURCE=2"
379 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[SECCFLAGS="${SECCFLAGS} -D_FORTIFY_SOURCE=2"
382 CFLAGS="${TMPCFLAGS}"
384 #compile-time warnings about misuse of format strings
385 AC_MSG_CHECKING(for -Wformat -Wformat-security)
386 TMPCFLAGS="${CFLAGS}"
387 CFLAGS="${CFLAGS} -Wformat -Wformat-security"
388 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[SECCFLAGS="${SECCFLAGS} -Wformat -Wformat-security"
391 CFLAGS="${TMPCFLAGS}"
393 #provides a read-only relocation table area in the final ELF
394 AC_MSG_CHECKING(for -z relro)
395 TMPLDFLAGS="${LDFLAGS}"
396 LDFLAGS="${LDFLAGS} -z relro"
397 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[SECLDFLAGS="${SECLDFLAGS} -z relro"
400 LDFLAGS="${TMPLDFLAGS}"
402 #forces all relocations to be resolved at run-time
403 AC_MSG_CHECKING(for -z now)
404 TMPLDFLAGS="${LDFLAGS}"
405 LDFLAGS="${LDFLAGS} -z now"
406 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[SECLDFLAGS="${SECLDFLAGS} -z now"
409 LDFLAGS="${TMPLDFLAGS}"
415 #check for plugin support
416 AC_CHECK_HEADERS([dlfcn.h])
417 AC_MSG_CHECKING([for plugin support])
418 TMPLDFLAGS="${LDFLAGS}"
419 LDFLAGS="${LDFLAGS} -rdynamic"
420 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <dlfcn.h>]], [[]])],
430 if test "x$has_rdynamic" = "xyes"; then
432 AC_DEFINE([HAVE_PLUGINS], [1], [Plugin support])
435 LDFLAGS="${TMPLDFLAGS}"
438 #enable profile generation
439 AC_ARG_ENABLE(gccprofile,
440 AS_HELP_STRING([--enable-gccprofile], [Enable gcc profile info i.e -pg flag is set]),[enable_gccprofile=$enableval],[enable_gccprofile=no])
441 AS_IF([test "x$enable_gccprofile" = "xyes"], [
442 CFLAGS="${CFLAGS} -pg"
445 #enable gcc march=native gcc 4.2 or later
446 AC_ARG_ENABLE(gccmarch_native,
447 AS_HELP_STRING([--enable-gccmarch-native], [Enable gcc march=native gcc 4.2 and later only]),[enable_gccmarch_native=$enableval],[enable_gccmarch_native=yes])
448 AS_IF([test "x$enable_gccmarch_native" = "xyes"], [
454 CFLAGS="$CFLAGS -march=native"
455 AC_MSG_CHECKING([checking if $CC supports -march=native])
456 AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([[#include <stdlib.h>]])],
459 OPTIMIZATION_CFLAGS="-march=native"
460 AC_SUBST(OPTIMIZATION_CFLAGS)
465 enable_gccmarch_native=no
475 # enable the running of unit tests
476 AC_ARG_ENABLE(unittests,
477 AS_HELP_STRING([--enable-unittests], [Enable compilation of the unit tests]),[enable_unittests=$enableval],[enable_unittests=no])
478 AS_IF([test "x$enable_unittests" = "xyes"], [
479 AC_DEFINE([UNITTESTS],[1],[Enable built-in unittests])
481 AM_CONDITIONAL([BUILD_UNITTESTS], [test "x$enable_unittests" = "xyes"])
483 # enable the building of ebpf files
484 AC_ARG_ENABLE(ebpf-build,
485 AS_HELP_STRING([--enable-ebpf-build], [Enable compilation of ebpf files]),[enable_ebpf_build=$enableval],[enable_ebpf_build=no])
486 AM_CONDITIONAL([BUILD_EBPF], [test "x$enable_ebpf_build" = "xyes"])
488 AS_IF([test "x$enable_ebpf_build" = "xyes"],
490 AS_IF([test "$CLANG" != no],
492 llc_candidates=$($CLANG --version | \
493 awk '/^clang version/ {
495 printf("llc-%s.%s llc-%s llc", v[[1]], v[[2]], v[[1]])
497 AC_CHECK_PROGS([LLC], [$llc_candidates], "no")
498 if test "$LLC" = "no"; then
499 AC_MSG_ERROR([unable to find any of $llc_candidates needed to build ebpf files])
503 [AC_MSG_ERROR([clang needed to build ebpf files])])
506 # enable debug output
508 AS_HELP_STRING([--enable-debug], [Enable debug output]),[enable_debug=$enableval],[enable_debug=no])
509 AS_IF([test "x$enable_debug" = "xyes"], [
510 AC_DEFINE([DEBUG],[1],[Enable debug output])
512 AM_CONDITIONAL([DEBUG], [test "x$enable_debug" = "xyes"])
514 # enable debug validation functions & macro's output
515 AC_ARG_ENABLE(debug-validation,
516 AS_HELP_STRING([--enable-debug-validation], [Enable (debug) validation code output]),[enable_debug_validation=$enableval],[enable_debug_validation=no])
517 AS_IF([test "x$enable_debug_validation" = "xyes"], [
518 if test "$enable_unittests" = "yes"; then
519 AC_MSG_ERROR([debug_validation can't be enabled with enabled unittests!])
521 AC_DEFINE([DEBUG_VALIDATION],[1],[Enable (debug) validation code output])
524 AM_CONDITIONAL([DEBUG_VALIDATION], [test "x$enable_debug_validation" = "xyes"])
527 AC_ARG_ENABLE(profiling,
528 AS_HELP_STRING([--enable-profiling], [Enable performance profiling]),[enable_profiling=$enableval],[enable_profiling=no])
529 AS_IF([test "x$enable_profiling" = "xyes"], [
532 AC_MSG_ERROR([profiling is not supported on OpenBSD])
535 AC_DEFINE([PROFILING],[1],[Enable performance profiling])
540 # profiling support, locking
541 AC_ARG_ENABLE(profiling-locks,
542 AS_HELP_STRING([--enable-profiling-locks], [Enable performance profiling for locks]),[enable_profiling_locks=$enableval],[enable_profiling_locks=no])
543 AS_IF([test "x$enable_profiling_locks" = "xyes"], [
544 AC_DEFINE([PROFILING],[1],[Enable performance profiling])
545 AC_DEFINE([PROFILE_LOCKING],[1],[Enable performance profiling for locks])
548 # enable support for IPFW
550 AS_HELP_STRING([--enable-ipfw], [Enable FreeBSD IPFW support for inline IDP]),[enable_ipfw=$enableval],[enable_ipfw=no])
551 AS_IF([test "x$enable_ipfw" = "xyes"], [
552 AC_DEFINE([IPFW],[1],[Enable FreeBSD IPFW support for inline IDP])
555 AC_ARG_ENABLE(coccinelle,
556 AS_HELP_STRING([--disable-coccinelle], [Disable coccinelle QA steps during make check]),[enable_coccinelle="$enableval"],[enable_coccinelle=yes])
557 AS_IF([test "x$enable_coccinelle" = "xyes"], [
558 AC_PATH_PROG(HAVE_COCCINELLE_CONFIG, spatch, "no")
559 if test "$HAVE_COCCINELLE_CONFIG" = "no"; then
563 AM_CONDITIONAL([HAVE_COCCINELLE], [test "x$enable_coccinelle" != "xno"])
566 AC_ARG_ENABLE(detection,
567 AS_HELP_STRING([--disable-detection], [Disable Detection Modules]), [enable_detection="$enableval"],[enable_detection=yes])
568 AS_IF([test "x$enable_detection" = "xno"], [
569 AC_DEFINE([HAVE_DETECT_DISABLED], [1], [Detection is disabled])
575 AC_ARG_WITH(zlib_includes,
576 [ --with-zlib-includes=DIR zlib include directory],
577 [with_zlib_includes="$withval"],[with_zlib_includes=no])
578 AC_ARG_WITH(zlib_libraries,
579 [ --with-zlib-libraries=DIR zlib library directory],
580 [with_zlib_libraries="$withval"],[with_zlib_libraries="no"])
582 if test "$with_zlib_includes" != "no"; then
583 CPPFLAGS="${CPPFLAGS} -I${with_zlib_includes}"
586 AC_CHECK_HEADER(zlib.h, ZLIB="yes",ZLIB="no")
587 if test "$ZLIB" = "yes"; then
588 if test "$with_zlib_libraries" != "no"; then
589 LDFLAGS="${LDFLAGS} -L${with_zlib_libraries}"
592 # To prevent duping the lib link we reset LIBS after this check. Setting action-if-found to NULL doesn't seem to work
593 # see: http://blog.flameeyes.eu/2008/04/29/i-consider-ac_check_lib-harmful
596 AC_CHECK_LIB(z,inflate,,ZLIB="no")
598 if test "$ZLIB" = "no"; then
600 echo " ERROR! zlib library not found, go get it"
601 echo " Debian/Ubuntu: apt install zlib1g-dev"
602 echo " Fedora: dnf install zlib-devel"
603 echo " CentOS/RHEL: yum install zlib-devel"
607 LIBS="${TMPLIBS} -lz"
611 AC_ARG_WITH(libpcre_includes,
612 [ --with-libpcre-includes=DIR libpcre include directory],
613 [with_libpcre_includes="$withval"],[with_libpcre_includes="no"])
614 AC_ARG_WITH(libpcre_libraries,
615 [ --with-libpcre-libraries=DIR libpcre library directory],
616 [with_libpcre_libraries="$withval"],[with_libpcre_libraries="no"])
618 if test "$with_libpcre_includes" != "no"; then
619 CPPFLAGS="${CPPFLAGS} -I${with_libpcre_includes}"
621 AC_CHECK_HEADER(pcre.h,,[AC_MSG_ERROR(pcre.h not found ...)])
623 if test "$with_libpcre_libraries" != "no"; then
624 LDFLAGS="${LDFLAGS} -L${with_libpcre_libraries}"
627 AC_CHECK_LIB(pcre, pcre_get_substring,,PCRE="no")
628 if test "$PCRE" = "no"; then
630 echo " ERROR! pcre library not found, go get it"
631 echo " from www.pcre.org. Or from packages:"
632 echo " Debian/Ubuntu: apt install libpcre3-dev"
633 echo " Fedora: dnf install pcre-devel"
634 echo " CentOS/RHEL: yum install pcre-devel"
639 # libpcre 8.35 (especially on debian) has a known issue that results in segfaults
640 # see https://redmine.openinfosecfoundation.org/issues/1693
641 if test "$with_libpcre_libraries" = "no"; then
642 PKG_CHECK_MODULES(LIBPCREVERSION, [libpcre = 8.35],[libpcre_buggy_found="yes"],[libprce_buggy_found="no"])
643 if test "$libpcre_buggy_found" = "yes"; then
645 echo " Warning! vulnerable libpcre version 8.35 found"
646 echo " This version has a known issue that could result in segfaults"
647 echo " please upgrade to a newer version of pcre which you can get from"
648 echo " www.pcre.org. For more information, see issue #1693"
650 echo " Continuing for now with JIT disabled..."
655 # To prevent duping the lib link we reset LIBS after this check. Setting action-if-found to NULL doesn't seem to work
656 # see: http://blog.flameeyes.eu/2008/04/29/i-consider-ac_check_lib-harmful
659 AC_CHECK_LIB(pcre, pcre_dfa_exec,, PCRE="no")
660 if test "$PCRE" = "no"; then
662 echo " ERROR! pcre library was found but version was < 6.0"
663 echo " please upgrade to a newer version of pcre which you can get from"
664 echo " www.pcre.org."
670 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <pcre.h> ]],
671 [[ int eo = 0; eo |= PCRE_EXTRA_MATCH_LIMIT_RECURSION; ]])],
672 [ pcre_match_limit_recursion_available=yes ],[:]
674 if test "$pcre_match_limit_recursion_available" != "yes"; then
676 echo " Warning! pcre extra opt PCRE_EXTRA_MATCH_LIMIT_RECURSION not found"
677 echo " This could lead to potential DoS please upgrade to pcre >= 6.5"
678 echo " from www.pcre.org."
679 echo " Continuing for now...."
681 AC_DEFINE([NO_PCRE_MATCH_RLIMIT],[1],[Pcre PCRE_EXTRA_MATCH_LIMIT_RECURSION not available])
684 TMPCFLAGS="${CFLAGS}"
685 CFLAGS="-O0 -g -Werror -Wall"
686 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <pcre.h> ]],
687 [[ pcre_extra *extra = NULL; pcre_free_study(extra); ]])],
688 [ AC_DEFINE([HAVE_PCRE_FREE_STUDY], [1], [Pcre pcre_free_study supported])],[:]
690 CFLAGS="${TMPCFLAGS}"
692 #enable support for PCRE-jit available since pcre-8.20
693 AC_MSG_CHECKING(for PCRE JIT support)
694 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <pcre.h> ]],
697 pcre_config(PCRE_CONFIG_JIT, &jit);
698 ]])],[ pcre_jit_available=yes ],[ pcre_jit_available=no ]
703 PKG_CHECK_MODULES(LIBPCREVERSION, [libpcre = 8.39],[libpcre_ppc64_buggy_found1="yes"],[libprce_ppc64_buggy_found1="no"])
704 PKG_CHECK_MODULES(LIBPCREVERSION, [libpcre = 8.40],[libpcre_ppc64_buggy_found2="yes"],[libprce_ppc64_buggy_found2="no"])
706 if test "$libprce_ppc64_buggy_found1" = "yes" || test "$libprce_ppc64_buggy_found2"; then
707 # on powerpc64, both gcc and clang lead to SIGILL in
708 # unittests when jit is enabled.
709 pcre_jit_available="no, pcre 8.39/8.40 jit disabled for powerpc64"
711 # hack: use libatomic
712 LIBS="${LIBS} -latomic"
715 # bug 1693, libpcre 8.35 is broken and debian jessie is still using that
716 if test "$libpcre_buggy_found" = "yes"; then
717 pcre_jit_available="no, libpcre 8.35 blacklisted"
722 if test "x$pcre_jit_available" = "xyes"; then
724 AC_DEFINE([PCRE_HAVE_JIT], [1], [Pcre with JIT compiler support enabled])
726 AC_MSG_CHECKING(for PCRE JIT support usability)
727 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <pcre.h> ]],
731 pcre *re = pcre_compile("(a|b|c|d)",0, &error, &err_offset,NULL);
732 pcre_extra *extra = pcre_study(re, PCRE_STUDY_JIT_COMPILE, &error);
736 int ret = pcre_fullinfo(re, extra, PCRE_INFO_JIT, &jit);
737 if (ret != 0 || jit != 1)
740 ]])],[ pcre_jit_works=yes ],[:]
742 if test "x$pcre_jit_works" != "xyes"; then
745 echo " PCRE JIT support detection worked but testing it failed"
746 echo " something odd is going on, please file a bug report."
756 if test "x$pcre_jit_works" = "xyes"; then
758 AC_MSG_CHECKING(for PCRE JIT exec availability)
768 pcre *re = pcre_compile("(a|b|c|d)", 0, &error, &err_offset,NULL);
769 pcre_extra *study = pcre_study(re, PCRE_STUDY_JIT_COMPILE, &error);
772 pcre_jit_stack *stack = pcre_jit_stack_alloc(32*1024,40*1024);
775 int ret = pcre_jit_exec(re, study, "apple", 5, 0, 0, NULL, 0, stack);
776 exit(ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
778 [pcre_jit_exec_available="yes" ],
779 [pcre_jit_exec_available="no" ])
780 if test "x$pcre_jit_exec_available" != "xyes"; then
784 AC_DEFINE([PCRE_HAVE_JIT_EXEC], [1], [PCRE with JIT compiler support enabled supporting pcre_jit_exec])
791 enable_hyperscan="no"
793 # Try pkg-config first:
794 PKG_CHECK_MODULES([libhs], libhs,, [with_pkgconfig_libhs=no])
795 if test "$with_pkgconfig_libhs" != "no"; then
796 CPPFLAGS="${CPPFLAGS} ${libhs_CFLAGS}"
797 LIBS="${LIBS} ${libhs_LIBS}"
800 AC_ARG_WITH(libhs_includes,
801 [ --with-libhs-includes=DIR libhs include directory],
802 [with_libhs_includes="$withval"],[with_libhs_includes=no])
803 AC_ARG_WITH(libhs_libraries,
804 [ --with-libhs-libraries=DIR libhs library directory],
805 [with_libhs_libraries="$withval"],[with_libhs_libraries="no"])
807 if test "$with_libhs_includes" != "no"; then
808 CPPFLAGS="${CPPFLAGS} -I${with_libhs_includes}"
810 AC_CHECK_HEADER(hs.h,HYPERSCAN="yes",HYPERSCAN="no")
811 if test "$HYPERSCAN" = "yes"; then
812 if test "$with_libhs_libraries" != "no"; then
813 LDFLAGS="${LDFLAGS} -L${with_libhs_libraries}"
816 AC_CHECK_LIB(hs,hs_compile,,HYPERSCAN="no")
817 AC_CHECK_FUNCS(hs_valid_platform)
818 enable_hyperscan="yes"
819 if test "$HYPERSCAN" = "no"; then
821 echo " Hyperscan headers are present, but link test failed."
822 echo " Check that you have a shared library and C++ linkage available."
824 enable_hyperscan="no"
827 AS_IF([test "x$enable_hyperscan" = "xyes"], [AC_DEFINE([BUILD_HYPERSCAN], [1], [Intel Hyperscan support enabled])])
830 AC_ARG_WITH(libyaml_includes,
831 [ --with-libyaml-includes=DIR libyaml include directory],
832 [with_libyaml_includes="$withval"],[with_libyaml_includes=no])
833 AC_ARG_WITH(libyaml_libraries,
834 [ --with-libyaml-libraries=DIR libyaml library directory],
835 [with_libyaml_libraries="$withval"],[with_libyaml_libraries="no"])
837 if test "$with_libyaml_includes" != "no"; then
838 CPPFLAGS="${CPPFLAGS} -I${with_libyaml_includes}"
841 AC_CHECK_HEADER(yaml.h,,LIBYAML="no")
843 if test "$with_libyaml_libraries" != "no"; then
844 LDFLAGS="${LDFLAGS} -L${with_libyaml_libraries}"
848 AC_CHECK_LIB(yaml,yaml_parser_initialize,,LIBYAML="no")
850 if test "$LIBYAML" = "no"; then
852 echo " ERROR! libyaml library not found, go get it"
853 echo " from http://pyyaml.org/wiki/LibYAML "
854 echo " or your distribution:"
856 echo " Ubuntu: apt-get install libyaml-dev"
857 echo " Fedora: dnf install libyaml-devel"
858 echo " CentOS/RHEL: yum install libyaml-devel"
864 AC_ARG_WITH(libpthread_includes,
865 [ --with-libpthread-includes=DIR libpthread include directory],
866 [with_libpthread_includes="$withval"],[with_libpthread_includes=no])
867 AC_ARG_WITH(libpthread_libraries,
868 [ --with-libpthread-libraries=DIR libpthread library directory],
869 [with_libpthread_libraries="$withval"],[with_libpthread_libraries="no"])
871 if test "$with_libpthread_includes" != "no"; then
872 CPPFLAGS="${CPPFLAGS} -I${with_libpthread_includes}"
875 dnl AC_CHECK_HEADER(pthread.h,,[AC_MSG_ERROR(pthread.h not found ...)])
877 if test "$with_libpthread_libraries" != "no"; then
878 LDFLAGS="${LDFLAGS} -L${with_libpthread_libraries}"
882 AC_CHECK_LIB(pthread, pthread_create,, PTHREAD="no")
884 if test "$PTHREAD" = "no"; then
886 echo " ERROR! libpthread library not found, glibc problem?"
891 AC_CHECK_FUNCS([pthread_spin_unlock])
894 AC_ARG_WITH(libjansson_includes,
895 [ --with-libjansson-includes=DIR libjansson include directory],
896 [with_libjansson_includes="$withval"],[with_libjansson_includes=no])
897 AC_ARG_WITH(libjansson_libraries,
898 [ --with-libjansson-libraries=DIR libjansson library directory],
899 [with_libjansson_libraries="$withval"],[with_libjansson_libraries="no"])
901 if test "$with_libjansson_includes" != "no"; then
902 CPPFLAGS="${CPPFLAGS} -I${with_libjansson_includes}"
905 if test "$with_libjansson_libraries" != "no"; then
906 LDFLAGS="${LDFLAGS} -L${with_libjansson_libraries}"
909 AC_CHECK_HEADER(jansson.h,JANSSON="yes",JANSSON="no")
910 AC_CHECK_LIB(jansson, json_dump_callback,, JANSSON="no")
912 if test "$JANSSON" = "no"; then
914 echo " ERROR: Jansson is now required."
916 echo " Go get it from your distribution or from:"
917 echo " http://www.digip.org/jansson/"
919 echo " Ubuntu/Debian: apt install libjansson-dev"
920 echo " CentOS: yum install jansson-devel"
921 echo " Fedora: dnf install jansson-devel"
927 enable_unixsocket="no"
929 AC_ARG_ENABLE(unix-socket,
930 AS_HELP_STRING([--enable-unix-socket], [Enable unix socket [default=test]]),[enable_unixsocket="$enableval"],[enable_unixsocket=test])
932 if test "$JANSSON" = "yes"; then
934 if test "$JANSSON" = "no"; then
936 echo " Jansson >= 2.2 is required for features like unix socket"
937 echo " Go get it from your distribution or from:"
938 echo " http://www.digip.org/jansson/"
939 echo " Ubuntu: apt-get install libjansson-dev"
940 echo " Fedora: dnf install jansson-devel"
941 echo " CentOS/RHEL: yum install jansson-devel"
943 if test "x$enable_unixsocket" = "xyes"; then
946 enable_unixsocket="no"
950 *-*-mingw32*|*-*-msys*|*-*-cygwin)
951 enable_unixsocket="no"
954 if test "x$enable_unixsocket" = "xtest"; then
955 enable_unixsocket="yes"
961 if test "x$enable_unixsocket" = "xyes"; then
963 echo " Jansson >= 2.2 is required for features like unix socket"
964 echo " Go get it from your distribution or from:"
965 echo " http://www.digip.org/jansson/"
966 echo " Ubuntu: apt-get install libjansson-dev"
967 echo " Fedora: dnf install jansson-devel"
968 echo " CentOS/RHEL: yum install jansson-devel"
972 enable_unixsocket="no"
975 AS_IF([test "x$enable_unixsocket" = "xyes"], [AC_DEFINE([BUILD_UNIX_SOCKET], [1], [Unix socket support enabled])])
976 e_enable_evelog=$enable_jansson
979 AS_HELP_STRING([--enable-nflog],[Enable libnetfilter_log support]),
980 [ enable_nflog="$enableval"],
981 [ enable_nflog="no"])
982 AC_ARG_ENABLE(nfqueue,
983 AS_HELP_STRING([--enable-nfqueue], [Enable NFQUEUE support for inline IDP]),[enable_nfqueue=$enableval],[enable_nfqueue=no])
984 if test "$enable_nfqueue" != "no"; then
985 PKG_CHECK_MODULES([libnetfilter_queue], [libnetfilter_queue], [enable_nfqueue=yes], [enable_nfqueue=no])
986 CPPFLAGS="${CPPFLAGS} ${libnetfilter_queue_CFLAGS}"
989 if test "x$enable_nflog" = "xyes" || test "x$enable_nfqueue" = "xyes"; then
995 AC_ARG_WITH(libnfnetlink_includes,
996 [ --with-libnfnetlink-includes=DIR libnfnetlink include directory],
997 [with_libnfnetlink_includes="$withval"],[with_libnfnetlink_includes=no])
998 AC_ARG_WITH(libnfnetlink_libraries,
999 [ --with-libnfnetlink-libraries=DIR libnfnetlink library directory],
1000 [with_libnfnetlink_libraries="$withval"],[with_libnfnetlink_libraries="no"])
1002 if test "$with_libnfnetlink_includes" != "no"; then
1003 CPPFLAGS="${CPPFLAGS} -I${with_libnfnetlink_includes}"
1006 if test "$with_libnfnetlink_libraries" != "no"; then
1007 LDFLAGS="${LDFLAGS} -L${with_libnfnetlink_libraries}"
1011 AC_CHECK_LIB(nfnetlink, nfnl_fd,, NFNL="no")
1013 if test "$NFNL" = "no"; then
1015 echo " nfnetlink library not found, go get it"
1016 echo " from www.netfilter.org."
1017 echo " we automatically append libnetfilter_queue/ when searching"
1018 echo " for headers etc. when the --with-libnfnetlink-includes directive"
1020 echo " Ubuntu: apt-get install libnetfilter-queue-dev"
1021 echo " Fedora: dnf install libnetfilter_queue-devel"
1022 echo " CentOS/RHEL: yum install libnetfilter_queue-devel"
1029 # enable support for NFQUEUE
1030 if test "x$enable_nfqueue" = "xyes"; then
1031 AC_DEFINE_UNQUOTED([NFQ],[1],[Enable Linux Netfilter NFQUEUE support for inline IDP])
1034 AC_ARG_WITH(libnetfilter_queue_includes,
1035 [ --with-libnetfilter_queue-includes=DIR libnetfilter_queue include directory],
1036 [with_libnetfilter_queue_includes="$withval"],[with_libnetfilter_queue_includes=no])
1037 AC_ARG_WITH(libnetfilter_queue_libraries,
1038 [ --with-libnetfilter_queue-libraries=DIR libnetfilter_queue library directory],
1039 [with_libnetfilter_queue_libraries="$withval"],[with_libnetfilter_queue_libraries="no"])
1041 if test "$with_libnetfilter_queue_includes" != "no"; then
1042 CPPFLAGS="${CPPFLAGS} -I${with_libnetfilter_queue_includes}"
1045 AC_CHECK_HEADER(libnetfilter_queue/libnetfilter_queue.h,,
1046 [AC_MSG_ERROR(libnetfilter_queue/libnetfilter_queue.h not found ...)],
1049 #include <sys/types.h>
1053 if test "$with_libnetfilter_queue_libraries" != "no"; then
1054 LDFLAGS="${LDFLAGS} -L${with_libnetfilter_queue_libraries}"
1058 AC_CHECK_LIB(netfilter_queue, nfq_open,, NFQ="no",)
1059 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])
1060 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])
1061 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])
1062 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])
1064 # check if the argument to nfq_get_payload is signed or unsigned
1065 AC_MSG_CHECKING([for signed nfq_get_payload payload argument])
1066 STORECFLAGS="${CFLAGS}"
1067 if test `basename $CC` = "clang"; then
1068 CFLAGS="${CFLAGS} -Werror=incompatible-pointer-types"
1070 CFLAGS="${CFLAGS} -Werror"
1076 #include <sys/types.h>
1079 #include <libnetfilter_queue/libnetfilter_queue.h>
1083 nfq_get_payload(NULL, &pktdata);
1085 [libnetfilter_queue_nfq_get_payload_signed="yes"],
1086 [libnetfilter_queue_nfq_get_payload_signed="no"])
1087 AC_MSG_RESULT($libnetfilter_queue_nfq_get_payload_signed)
1088 if test "x$libnetfilter_queue_nfq_get_payload_signed" = "xyes"; then
1089 AC_DEFINE([NFQ_GET_PAYLOAD_SIGNED], [1], [For signed version of nfq_get_payload])
1091 CFLAGS="${STORECFLAGS}"
1093 if test "$NFQ" = "no"; then
1095 echo " ERROR! libnetfilter_queue library not found, go get it"
1096 echo " from www.netfilter.org."
1097 echo " we automatically append libnetfilter_queue/ when searching"
1098 echo " for headers etc. when the --with-libnfq-includes directive"
1100 echo " Ubuntu: apt-get install libnetfilter-queue-dev"
1101 echo " Fedora: dnf install libnetfilter_queue-devel"
1102 echo " CentOS/RHEL: yum install libnetfilter_queue-devel"
1109 AC_ARG_WITH(libnetfilter_log_includes,
1110 [ --with-libnetfilter_log-includes=DIR libnetfilter_log include directory],
1111 [with_libnetfilter_log_includes="$withval"],[with_libnetfilter_log_includes="no"])
1112 AC_ARG_WITH(libnetfilter_log_libraries,
1113 [ --with-libnetfilter_log-libraries=DIR libnetfilter_log library directory],
1114 [with_libnetfilter_log_libraries="$withval"],[with_libnetfilter_log_libraries="no"])
1116 if test "$enable_nflog" = "yes"; then
1117 if test "$with_libnetfilter_log_includes" != "no"; then
1118 CPPFLAGS="${CPPFLAGS} -I${with_libnetfilter_log_includes}"
1121 AC_CHECK_HEADER(libnetfilter_log/libnetfilter_log.h,,[AC_MSG_ERROR(libnetfilter_log.h not found ...)])
1123 if test "$with_libnetfilter_log_libraries" != "no"; then
1124 LDFLAGS="${LDFLAGS} -L${with_libnetfilter_log_libraries}"
1128 AC_CHECK_LIB(netfilter_log, nflog_open,, NFLOG="no")
1130 if test "$NFLOG" = "no"; then
1132 echo " ERROR! libnetfilter_log library not found, go get it"
1133 echo " from http://www.netfilter.org."
1137 AC_DEFINE([HAVE_NFLOG],[1],[nflog available])
1143 AC_ARG_ENABLE(windivert,
1144 AS_HELP_STRING([--enable-windivert],[Enable WinDivert support [default=no]]),[enable_windivert=$enableval],
1145 [enable_windivert="no"])
1147 # WinDivert can only be enabled on Windows builds
1148 AC_CHECK_DECL([OS_WIN32],,[enable_windivert="no"])
1150 if test "x$enable_windivert" = "xyes"; then
1151 # WinDivert requires Vista at a minimum. If the user has selected their own NTDDI_VERSION
1152 # then don't override it.
1153 AC_CHECK_DECL([NTDDI_VERSION],,
1154 [CFLAGS="${CFLAGS} -DNTDDI_VERSION=NTDDI_VISTA -D_WIN32_WINNT=_WIN32_WINNT_VISTA"])
1156 AC_DEFINE_UNQUOTED([WINDIVERT],[1],[Enable Windows WinDivert support for inline IDP])
1158 AC_ARG_WITH(windivert_include,
1159 [ --with-windivert-include=DIR WinDivert include path],
1160 [with_windivert_include="$withval"],[with_windivert_include="no"])
1161 AC_ARG_WITH(windivert_libraries,
1162 [ --with-windivert-libraries=DIR WinDivert library path],
1163 [with_windivert_libraries="$withval"],[with_windivert_libraries="no"])
1165 if test "$with_windivert_include" != "no"; then
1166 CPPFLAGS="${CPPFLAGS} -I${with_windivert_include}"
1169 if test "$with_windivert_libraries" != "no"; then
1170 LDFLAGS="${LDFLAGS} -L${with_windivert_libraries}"
1173 AC_CHECK_HEADER(windivert.h,,WINDIVERT_INC="no")
1174 AC_CHECK_LIB(WinDivert, WinDivertOpen,, WINDIVERT_LIB="no")
1176 if test "$WINDIVERT_LIB" = "no" || test "$WINDIVERT_INC" = "no"; then
1178 echo " ERROR! WinDivert not found, go get it from"
1179 echo " https://www.reqrypt.org/windivert.html"
1187 AC_ARG_ENABLE(prelude,
1188 AS_HELP_STRING([--enable-prelude], [Enable Prelude support for alerts]),[enable_prelude=$enableval],[enable_prelude=no])
1189 # Prelude doesn't work with -Werror
1190 STORECFLAGS="${CFLAGS}"
1191 CFLAGS="${CFLAGS} -Wno-error=unused-result"
1193 AS_IF([test "x$enable_prelude" = "xyes"], [
1194 AM_PATH_LIBPRELUDE(0.9.9, , AC_MSG_ERROR(Cannot find libprelude: Is libprelude-config in the path?), no)
1195 if test "x${LIBPRELUDE_CFLAGS}" != "x"; then
1196 CPPFLAGS="${CPPFLAGS} ${LIBPRELUDE_CFLAGS}"
1199 if test "x${LIBPRELUDE_LDFLAGS}" != "x"; then
1200 LDFLAGS="${LDFLAGS} ${LIBPRELUDE_LDFLAGS}"
1203 if test "x${LIBPRELUDE_LIBS}" != "x"; then
1204 LDFLAGS="${LDFLAGS} ${LIBPRELUDE_LIBS}"
1206 AC_DEFINE([PRELUDE], [1], [Libprelude support enabled])
1208 CFLAGS="${STORECFLAGS}"
1212 AC_ARG_WITH(libnet_includes,
1213 [ --with-libnet-includes=DIR libnet include directory],
1214 [with_libnet_includes="$withval"],[with_libnet_includes="no"])
1216 AC_ARG_WITH(libnet_libraries,
1217 [ --with-libnet-libraries=DIR libnet library directory],
1218 [with_libnet_libraries="$withval"],[with_libnet_libraries="no"])
1220 if test "x$with_libnet_includes" != "xno"; then
1221 CPPFLAGS="${CPPFLAGS} -I${with_libnet_includes}"
1222 libnet_dir="${with_libnet_includes}"
1224 libnet_dir="/usr/include /usr/local/include /usr/local/include/libnet11 /opt/local/include /usr/local/include/libnet-1.1"
1227 if test "x$with_libnet_libraries" != "xno"; then
1228 LDFLAGS="${LDFLAGS} -L${with_libnet_libraries}"
1231 LIBNET_DETECT_FAIL="no"
1234 for i in $libnet_dir; do
1235 if test -r "$i/libnet.h"; then
1241 AC_MSG_CHECKING(for libnet.h version 1.1.x)
1242 if test "$LIBNET_INC_DIR" != ""; then
1243 LIBNET_VER=`grep LIBNET_VERSION $LIBNET_INC_DIR/libnet.h | grep '1.[[12]]' | sed 's/[[^"]]*"\([[^"]]*\).*/\1/'`
1245 if test -z "$LIBNET_VER" ; then
1251 #CentOS, Fedora, Ubuntu-LTS, Ubuntu all set defines to the same values. libnet-config seems
1252 #to have been depreciated but all distro's seem to include it as part of the package.
1253 if test "$LIBNET_DETECT_FAIL" = "no"; then
1255 AC_CHECK_LIB(net, libnet_write,, LLIBNET="no")
1256 if test "$LLIBNET" != "no"; then
1257 AC_DEFINE([HAVE_LIBNET11],[1],(libnet 1.1 available))
1258 AC_DEFINE([_DEFAULT_SOURCE],[1],(default source))
1259 AC_DEFINE([_BSD_SOURCE],[1],(bsd source))
1260 AC_DEFINE([__BSD_SOURCE],[1],(bsd source))
1261 AC_DEFINE([__FAVOR_BSD],[1],(favor bsd))
1262 AC_DEFINE([HAVE_NET_ETHERNET_H],[1],(ethernet.h))
1266 # see if we have the patched libnet 1.1
1267 # https://www.inliniac.net/blog/2007/10/16/libnet-11-ipv6-fixes-and-additions.html
1269 # To prevent duping the lib link we reset LIBS after this check. Setting action-if-found to NULL doesn't seem to work
1270 # see: http://blog.flameeyes.eu/2008/04/29/i-consider-ac_check_lib-harmful
1271 if test "$enable_libnet" = "yes"; then
1274 AC_CHECK_LIB(net, libnet_build_icmpv6_unreach,, LLIBNET="no")
1275 if test "$LLIBNET" != "no"; then
1276 AC_DEFINE([HAVE_LIBNET_ICMPV6_UNREACH],[1],(libnet_build_icmpv6_unreach available))
1281 # See if we have libnet 1.1.6 or newer - these versions handle capabilities correctly
1282 # Some patched 1.1.4 versions are also good, but it's not guaranteed for all distros.
1284 # Details: https://bugzilla.redhat.com/show_bug.cgi?id=589770
1285 AS_VERSION_COMPARE([LIBNET_VER], [1.1.6],
1287 [AC_DEFINE([HAVE_LIBNET_CAPABILITIES],[1], (libnet_have_capabilities_patch))],
1288 [AC_DEFINE([HAVE_LIBNET_CAPABILITIES],[1], (libnet_have_capabilities_patch))])
1291 # check if the argument to libnet_init is char* or const char*
1292 AC_MSG_CHECKING([libnet_init dev type])
1293 STORECFLAGS="${CFLAGS}"
1294 if test `basename $CC` = "clang"; then
1295 CFLAGS="${CFLAGS} -Werror=incompatible-pointer-types"
1297 CFLAGS="${CFLAGS} -Werror"
1306 const char dev[32] = "";
1307 char ebuf[LIBNET_ERRBUF_SIZE];
1308 (void)libnet_init(LIBNET_LINK, dev, ebuf);
1310 [libnet_init_const="yes"],
1311 [libnet_init_const="no"])
1312 AC_MSG_RESULT($libnet_init_const)
1313 if test "x$libnet_init_const" = "xyes"; then
1314 AC_DEFINE([HAVE_LIBNET_INIT_CONST], [1], [libnet_init takes const argument])
1316 CFLAGS="${STORECFLAGS}"
1323 AC_ARG_WITH(libpcap_includes,
1324 [ --with-libpcap-includes=DIR libpcap include directory],
1325 [with_libpcap_includes="$withval"],[with_libpcap_includes=no])
1326 AC_ARG_WITH(libpcap_libraries,
1327 [ --with-libpcap-libraries=DIR libpcap library directory],
1328 [with_libpcap_libraries="$withval"],[with_libpcap_libraries="no"])
1330 if test "$with_libpcap_includes" != "no"; then
1331 CPPFLAGS="${CPPFLAGS} -I${with_libpcap_includes}"
1334 AC_CHECK_HEADERS([pcap.h],[],[AC_MSG_ERROR(pcap.h not found ...)],
1336 #ifdef HAVE_WINSOCK2_H
1337 #include <winsock2.h>
1339 #define _DEFAULT_SOURCE 1
1342 if test "$with_libpcap_libraries" != "no"; then
1343 LDFLAGS="${LDFLAGS} -L${with_libpcap_libraries}"
1345 AC_CHECK_HEADERS([pcap.h pcap/pcap.h pcap/bpf.h],[],[],
1347 #ifdef HAVE_WINSOCK2_H
1348 #include <winsock2.h>
1350 #define _DEFAULT_SOURCE 1
1354 PKG_CHECK_MODULES([PCAP],libpcap,[CPPFLAGS="${CPPFLAGS} ${PCAP_CFLAGS}" LIBS="${LIBS} ${PCAP_LIBS}"],[:])
1355 AC_CHECK_LIB(${PCAP_LIB_NAME}, pcap_open_live,, LIBPCAP="no")
1356 if test "$LIBPCAP" = "no"; then
1358 echo " ERROR! libpcap library not found, go get it"
1359 echo " from http://www.tcpdump.org or your distribution:"
1361 echo " Ubuntu: apt-get install libpcap-dev"
1362 echo " Fedora: dnf install libpcap-devel"
1363 echo " CentOS/RHEL: yum install libpcap-devel"
1368 # pcap_activate and pcap_create only exists in libpcap >= 1.0
1370 #To prevent duping the lib link we reset LIBS after this check. Setting action-if-found to NULL doesn't seem to work
1371 #see: http://blog.flameeyes.eu/2008/04/29/i-consider-ac_check_lib-harmful
1373 AC_CHECK_LIB(${PCAP_LIB_NAME}, pcap_activate,, LPCAPVTEST="no")
1374 if test "$LPCAPVTEST" = "no"; then
1376 echo " ERROR! libpcap library too old, need at least 1+, "
1377 echo " go get it from http://www.tcpdump.org or your distribution:"
1379 echo " Ubuntu: apt-get install libpcap-dev"
1380 echo " Fedora: dnf install libpcap-devel"
1381 echo " CentOS/RHEL: yum install libpcap-devel"
1385 AC_PATH_PROG(HAVE_PCAP_CONFIG, pcap-config, "no")
1386 if test "$HAVE_PCAP_CONFIG" = "no" -o "$cross_compiling" = "yes"; then
1387 AC_MSG_RESULT(no pcap-config is use)
1389 PCAP_CFLAGS="$(pcap-config --defines) $(pcap-config --cflags)"
1390 AC_SUBST(PCAP_CFLAGS)
1394 #Appears as if pcap_set_buffer_size is linux only?
1396 #To prevent duping the lib link we reset LIBS after this check. Setting action-if-found to NULL doesn't seem to work
1397 #see: http://blog.flameeyes.eu/2008/04/29/i-consider-ac_check_lib-harmful
1399 AC_CHECK_LIB(${PCAP_LIB_NAME}, pcap_set_buffer_size,, LPCAPSBUFF="no")
1400 if test "$LPCAPSBUFF" != "no"; then
1401 AC_DEFINE([HAVE_PCAP_SET_BUFF],[1],(libpcap has pcap_set_buffer_size function))
1406 # libpfring (currently only supported for libpcap enabled pfring)
1407 # Error on the side of caution. If libpfring enabled pcap is being used and we don't link against -lpfring compilation will fail.
1408 AC_ARG_ENABLE(pfring,
1409 AS_HELP_STRING([--enable-pfring], [Enable Native PF_RING support]),[enable_pfring=$enableval],[enable_pfring=no])
1410 AS_IF([test "x$enable_pfring" = "xyes"], [
1411 AC_DEFINE([HAVE_PFRING],[1],(PF_RING support enabled))
1413 #We have to set CFLAGS for AC_COMPILE_IFELSE as it doesn't pay attention to CPPFLAGS
1414 AC_ARG_WITH(libpfring_includes,
1415 [ --with-libpfring-includes=DIR libpfring include directory],
1416 [with_libpfring_includes="$withval"],[with_libpfring_includes=no])
1417 AC_ARG_WITH(libpfring_libraries,
1418 [ --with-libpfring-libraries=DIR libpfring library directory],
1419 [with_libpfring_libraries="$withval"],[with_libpfring_libraries="no"])
1421 if test "$with_libpfring_includes" != "no"; then
1422 CPPFLAGS="${CPPFLAGS} -I${with_libpfring_includes}"
1425 if test "$with_libpfring_libraries" != "no"; then
1426 LDFLAGS="${LDFLAGS} -L${with_libpfring_libraries}"
1430 AC_CHECK_LIB(pfring, pfring_open,, LIBPFRING="no", [-lpcap])
1431 if test "$LIBPFRING" != "no"; then
1432 STORECFLAGS="${CFLAGS}"
1433 CFLAGS="${CFLAGS} -Werror"
1440 pfring_recv_chunk(NULL, NULL, 0, 0);
1442 [pfring_recv_chunk="yes"],
1443 [pfring_recv_chunk="no"])
1444 CFLAGS="${STORECFLAGS}"
1445 if test "x$pfring_recv_chunk" != "xyes"; then
1446 if test "x$enable_pfring" = "xyes"; then
1448 echo " ERROR! --enable-pfring was passed but the library version is < 6, go get it"
1449 echo " from http://www.ntop.org/products/pf_ring/"
1457 #ifndef PF_RING_FLOW_OFFLOAD
1458 # error PF_RING_FLOW_OFFLOAD not defined
1462 AC_DEFINE([HAVE_PF_RING_FLOW_OFFLOAD], [1], [PF_RING bypass support enabled])
1466 echo " Warning! Pfring hw bypass not supported by this library version < 7,"
1467 echo " please upgrade to a newer version to use this feature."
1469 echo " Continuing for now with hw bypass support disabled..."
1473 if test "x$enable_pfring" = "xyes"; then
1475 echo " ERROR! --enable-pfring was passed but the library was not found, go get it"
1476 echo " from http://www.ntop.org/products/pf_ring/"
1484 AC_ARG_ENABLE(af-packet,
1485 AS_HELP_STRING([--enable-af-packet], [Enable AF_PACKET support [default=yes]]),
1486 [enable_af_packet=$enableval],[enable_af_packet=yes])
1487 AS_IF([test "x$enable_af_packet" = "xyes"], [
1488 AC_CHECK_DECL([TPACKET_V2],
1489 AC_DEFINE([HAVE_AF_PACKET],[1],[AF_PACKET support is available]),
1490 [enable_af_packet="no"],
1491 [[#include <sys/socket.h>
1492 #include <linux/if_packet.h>]])
1493 AC_CHECK_DECL([PACKET_FANOUT_QM],
1494 AC_DEFINE([HAVE_PACKET_FANOUT],[1],[Recent packet fanout support is available]),
1496 [[#include <linux/if_packet.h>]])
1497 AC_CHECK_DECL([TPACKET_V3],
1498 AC_DEFINE([HAVE_TPACKET_V3],[1],[AF_PACKET tpcket_v3 support is available]),
1500 [[#include <sys/socket.h>
1501 #include <linux/if_packet.h>]])
1502 AC_CHECK_DECL([SOF_TIMESTAMPING_RAW_HARDWARE],
1503 AC_DEFINE([HAVE_HW_TIMESTAMPING],[1],[Hardware timestamping support is available]),
1505 [[#include <linux/net_tstamp.h>]])
1509 AC_ARG_ENABLE(netmap,
1510 AS_HELP_STRING([--enable-netmap], [Enable Netmap support]),[enable_netmap=$enableval],[enable_netmap=no])
1511 AC_ARG_WITH(netmap_includes,
1512 [ --with-netmap-includes=DIR netmap include directory],
1513 [with_netmap_includes="$withval"],[with_netmap_includes=no])
1515 AS_IF([test "x$enable_netmap" = "xyes"], [
1516 AC_DEFINE([HAVE_NETMAP],[1],(NETMAP support enabled))
1518 if test "$with_netmap_includes" != "no"; then
1519 CPPFLAGS="${CPPFLAGS} -I${with_netmap_includes}"
1522 AC_CHECK_HEADER(net/netmap_user.h,,[AC_MSG_ERROR(net/netmap_user.h not found ...)],)
1524 have_recent_netmap="no"
1525 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
1526 #include <net/netmap_user.h>
1529 #error "outdated netmap, need one with NETMAP_API"
1532 #error "outdated netmap, need at least api version 11"
1534 ])], [have_recent_netmap="yes"])
1535 if test "x$have_recent_netmap" != "xyes"; then
1536 echo "ERROR: outdated netmap"
1539 have_netmap_version="unknown"
1540 have_v11_netmap="no"
1541 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
1542 #include <net/netmap_user.h>
1544 #if NETMAP_API != 11
1547 ])], [have_v11_netmap="yes"])
1548 if test "x$have_v11_netmap" = "xyes"; then
1549 have_netmap_version="v11"
1551 have_v12_netmap="no"
1552 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
1553 #include <net/netmap_user.h>
1555 #if NETMAP_API != 12
1558 ])], [have_v12_netmap="yes"])
1559 if test "x$have_v12_netmap" = "xyes"; then
1560 have_netmap_version="v12"
1562 have_v13_netmap="no"
1563 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
1564 #include <net/netmap_user.h>
1566 #if NETMAP_API != 13
1569 ])], [have_v13_netmap="yes"])
1570 if test "x$have_v13_netmap" = "xyes"; then
1571 have_netmap_version="v13"
1573 have_gtv13_netmap="no"
1574 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
1575 #include <net/netmap_user.h>
1577 #if NETMAP_API <= 13
1580 ])], [have_gtv13_netmap="yes"])
1581 if test "x$have_gtv13_netmap" = "xyes"; then
1582 have_netmap_version="> v13"
1587 AC_ARG_ENABLE([suricata-update], AS_HELP_STRING([--disable-suricata-update],
1588 [Disable suricata-update]), [enable_suricata_update=$enableval],
1589 [enable_suricata_update="yes"])
1591 # Assume suircata-update will not be installed.
1592 have_suricata_update="no"
1593 ruledirprefix="$sysconfdir"
1595 if test "$enable_suricata_update" = "yes"; then
1596 if test -f "$srcdir/suricata-update/setup.py"; then
1597 have_suricata_update="yes"
1601 if test "$have_suricata_update" = "yes"; then
1602 if test "$have_python_yaml" != "yes"; then
1604 echo " Warning: suricata-update will not be installed as the"
1605 echo " Python yaml module is not installed.."
1607 echo " Install the yaml module for Python ${pymv} to enable"
1608 echo " suricata-update."
1611 SURICATA_UPDATE_DIR="suricata-update"
1612 AC_SUBST(SURICATA_UPDATE_DIR)
1613 AC_CONFIG_FILES(suricata-update/Makefile)
1615 ruledirprefix="$localstatedir/lib"
1619 # Test to see if suricatactl (and suricatasc) can be installed.
1620 if test "x$enable_python" != "xyes"; then
1621 install_suricatactl="requires python"
1622 elif test "x$have_python_distutils" != "xyes"; then
1623 install_suricatactl="no, requires distutils"
1625 install_suricatactl="yes"
1628 # Test to see if suricata-update can be installed.
1629 if test "x$have_suricata_update" != "xyes"; then
1630 install_suricata_update="not bundled"
1631 elif test "x$enable_python" != "xyes"; then
1632 install_suricata_update="no, requires python"
1633 elif test "x$have_python_distutils" != "xyes"; then
1634 install_suricata_update="no, requires distutils"
1635 elif test "x$have_python_yaml" != "xyes"; then
1636 install_suricata_update="no, requires pyyaml"
1638 install_suricata_update="yes"
1641 AM_CONDITIONAL([INSTALL_SURICATA_UPDATE],
1642 [test "x$install_suricata_update" = "xyes"])
1645 AC_ARG_ENABLE(non-bundled-htp,
1646 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])
1647 AS_IF([test "x$enable_non_bundled_htp" = "xyes"], [
1648 PKG_CHECK_MODULES([libhtp], htp,, [with_pkgconfig_htp=no])
1649 if test "$with_pkgconfig_htp" != "no"; then
1650 CPPFLAGS="${CPPFLAGS} ${libhtp_CFLAGS}"
1651 LIBS="${LIBS} ${libhtp_LIBS}"
1654 AC_ARG_WITH(libhtp_includes,
1655 [ --with-libhtp-includes=DIR libhtp include directory],
1656 [with_libhtp_includes="$withval"],[with_libhtp_includes=no])
1657 AC_ARG_WITH(libhtp_libraries,
1658 [ --with-libhtp-libraries=DIR libhtp library directory],
1659 [with_libhtp_libraries="$withval"],[with_libhtp_libraries="no"])
1661 if test "$with_libhtp_includes" != "no"; then
1662 CPPFLAGS="-I${with_libhtp_includes} ${CPPFLAGS}"
1665 if test "$with_libhtp_libraries" != "no"; then
1666 LDFLAGS="${LDFLAGS} -L${with_libhtp_libraries}"
1669 AC_CHECK_HEADER(htp/htp.h,,[AC_MSG_ERROR(htp/htp.h not found ...)])
1672 AC_CHECK_LIB(htp, htp_conn_create,, LIBHTP="no")
1673 if test "$LIBHTP" = "no"; then
1675 echo " ERROR! libhtp library not found"
1679 PKG_CHECK_MODULES(LIBHTPMINVERSION, [htp >= 0.5.35],[libhtp_minver_found="yes"],[libhtp_minver_found="no"])
1680 if test "$libhtp_minver_found" = "no"; then
1681 PKG_CHECK_MODULES(LIBHTPDEVVERSION, [htp = 0.5.X],[libhtp_devver_found="yes"],[libhtp_devver_found="no"])
1682 if test "$libhtp_devver_found" = "no"; then
1684 echo " ERROR! libhtp was found but it is neither >= 0.5.35, nor the dev 0.5.X"
1690 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])
1691 # check for htp_tx_get_response_headers_raw
1692 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])
1693 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])
1694 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])
1695 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]) )
1696 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])
1697 AC_CHECK_LIB([htp], [htp_config_set_lzma_layers],AC_DEFINE_UNQUOTED([HAVE_HTP_CONFIG_SET_LZMA_LAYERS],[1],[Found htp_config_set_lzma_layers function in libhtp]) ,,[-lhtp])
1698 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])
1701 if test "x$enable_non_bundled_htp" = "xno"; then
1702 # test if we have a bundled htp
1703 if test -d "$srcdir/libhtp"; then
1704 AC_CONFIG_SUBDIRS([libhtp])
1707 HTP_LDADD="../libhtp/htp/libhtp.la"
1709 # make sure libhtp is added to the includes
1710 CPPFLAGS="-I\${srcdir}/../libhtp/ ${CPPFLAGS}"
1712 AC_CHECK_HEADER(iconv.h,,[AC_MSG_ERROR(iconv.h not found ...)])
1713 AC_CHECK_LIB(iconv, libiconv_close)
1714 AC_DEFINE_UNQUOTED([HAVE_HTP_URI_NORMALIZE_HOOK],[1],[Assuming htp_config_register_request_uri_normalize function in bundled libhtp])
1715 AC_DEFINE_UNQUOTED([HAVE_HTP_TX_GET_RESPONSE_HEADERS_RAW],[1],[Assuming htp_tx_get_response_headers_raw function in bundled libhtp])
1716 AC_DEFINE_UNQUOTED([HAVE_HTP_DECODE_QUERY_INPLACE],[1],[Assuming htp_decode_query_inplace function in bundled libhtp])
1717 # enable when libhtp has been updated
1718 AC_DEFINE_UNQUOTED([HAVE_HTP_CONFIG_SET_RESPONSE_DECOMPRESSION_LAYER_LIMIT],[1],[Assuming htp_config_set_response_decompression_layer_limit function in bundled libhtp])
1719 AC_DEFINE_UNQUOTED([HAVE_HTP_CONFIG_SET_LZMA_MEMLIMIT],[1],[Assuming htp_config_set_lzma_memlimit function in bundled libhtp])
1720 AC_DEFINE_UNQUOTED([HAVE_HTP_CONFIG_SET_LZMA_LAYERS],[1],[Assuming htp_config_set_lzma_layers function in bundled libhtp])
1721 AC_DEFINE_UNQUOTED([HAVE_HTP_CONFIG_SET_COMPRESSION_BOMB_LIMIT],[1],[Assuming htp_config_set_compression_bomb_limit function in bundled libhtp])
1724 echo " ERROR: Libhtp is not bundled. Get libhtp by doing:"
1725 echo " git clone https://github.com/OISF/libhtp"
1726 echo " Then re-run Suricata's autogen.sh and configure script."
1727 echo " Or, if libhtp is installed in a different location,"
1728 echo " pass --enable-non-bundled-htp to Suricata's configure script."
1729 echo " Add --with-libhtp-includes=<dir> and --with-libhtp-libraries=<dir> if"
1730 echo " libhtp is not installed in the include and library paths."
1737 # Check for libcap-ng
1740 AC_ARG_WITH(libcap_ng_includes,
1741 [ --with-libcap_ng-includes=DIR libcap_ng include directory],
1742 [with_libcap_ng_includes="$withval"],[with_libcap_ng_includes=no])
1743 AC_ARG_WITH(libcap_ng_libraries,
1744 [ --with-libcap_ng-libraries=DIR libcap_ng library directory],
1745 [with_libcap_ng_libraries="$withval"],[with_libcap_ng_libraries="no"])
1747 if test "$with_libcap_ng_includes" != "no"; then
1748 CPPFLAGS="${CPPFLAGS} -I${with_libcap_ng_includes}"
1751 if test "$with_libcap_ng_libraries" != "no"; then
1752 LDFLAGS="${LDFLAGS} -L${with_libcap_ng_libraries}"
1755 AC_CHECK_HEADER(cap-ng.h,,LIBCAP_NG="no")
1756 if test "$LIBCAP_NG" != "no"; then
1758 AC_CHECK_LIB(cap-ng,capng_clear,,LIBCAP_NG="no")
1761 if test "$LIBCAP_NG" != "no"; then
1762 AC_DEFINE([HAVE_LIBCAP_NG],[1],[Libpcap-ng support])
1765 if test "$LIBCAP_NG" = "no"; then
1767 echo " WARNING! libcap-ng library not found, go get it"
1768 echo " from http://people.redhat.com/sgrubb/libcap-ng/"
1769 echo " or your distribution:"
1771 echo " Ubuntu: apt-get install libcap-ng-dev"
1772 echo " Fedora: dnf install libcap-ng-devel"
1773 echo " CentOS/RHEL: yum install libcap-ng-devel"
1775 echo " Suricata will be built without support for dropping privs."
1783 AS_HELP_STRING([--enable-ebpf],[Enable eBPF support]),
1784 [ enable_ebpf="$enableval"],
1785 [ enable_ebpf="no"])
1788 if test "$enable_ebpf" = "yes"; then
1789 AC_CHECK_LIB(elf,elf_begin,,LIBELF="no")
1790 if test "$LIBELF" = "no"; then
1792 echo " libelf library and development headers not found but"
1793 echo " but needed to use eBPF code"
1798 AC_CHECK_LIB(bpf,bpf_object__open,,LIBBPF="no")
1799 if test "$LIBBPF" = "no"; then
1801 echo " libbpf library and development headers not found but"
1802 echo " needed to use eBPF code. It can be found at"
1803 echo " https://github.com/libbpf/libbpf"
1807 AC_CHECK_DECL([PACKET_FANOUT_EBPF],
1808 AC_DEFINE([HAVE_PACKET_EBPF],[1],[Recent ebpf fanout support is available]),
1810 [[#include <linux/if_packet.h>]])
1811 AC_CHECK_LIB(bpf, bpf_set_link_xdp_fd,have_xdp="yes")
1812 if test "$have_xdp" = "yes"; then
1813 AC_DEFINE([HAVE_PACKET_XDP],[1],[XDP support is available])
1817 # Check for DAG support.
1819 AS_HELP_STRING([--enable-dag],[Enable DAG capture]),
1820 [ enable_dag=$enableval ],
1822 AC_ARG_WITH(dag_includes,
1823 [ --with-dag-includes=DIR dagapi include directory],
1824 [with_dag_includes="$withval"],[with_dag_includes="no"])
1825 AC_ARG_WITH(dag_libraries,
1826 [ --with-dag-libraries=DIR dagapi library directory],
1827 [with_dag_libraries="$withval"],[with_dag_libraries="no"])
1829 if test "$enable_dag" = "yes"; then
1831 if test "$with_dag_includes" != "no"; then
1832 CPPFLAGS="${CPPFLAGS} -I${with_dag_includes}"
1835 if test "$with_dag_libraries" != "no"; then
1836 LDFLAGS="${LDFLAGS} -L${with_dag_libraries}"
1839 AC_CHECK_HEADER(dagapi.h,DAG="yes",DAG="no")
1840 if test "$DAG" != "no"; then
1842 AC_CHECK_LIB(dag,dag_open,,DAG="no",)
1845 if test "$DAG" = "no"; then
1847 echo " ERROR! libdag library not found"
1852 AC_DEFINE([HAVE_DAG],[1],(Endace DAG card support enabled))
1855 # libnspr (enabled by default)
1857 AS_HELP_STRING([--disable-nspr],[Disable libnspr support]),
1858 [enable_nspr=$enableval],[enable_nspr="yes"])
1860 AC_ARG_WITH(libnspr_includes,
1861 [ --with-libnspr-includes=DIR libnspr include directory],
1862 [with_libnspr_includes="$withval"],[with_libnspr_includes="no"])
1864 AC_ARG_WITH(libnspr_libraries,
1865 [ --with-libnspr-libraries=DIR libnspr library directory],
1866 [with_libnspr_libraries="$withval"],[with_libnspr_libraries="no"])
1868 if test "$enable_nspr" != "no"; then
1869 # Try pkg-config first:
1870 PKG_CHECK_MODULES([libnspr],nspr,,[with_pkgconfig_nspr="no"])
1872 if test "$with_pkgconfig_nspr" != "no"; then
1873 CPPFLAGS="${CPPFLAGS} ${libnspr_CFLAGS}"
1874 LIBS="${LIBS} ${libnspr_LIBS}"
1877 if test "$with_libnspr_includes" != "no"; then
1878 CPPFLAGS="${CPPFLAGS} -I${with_libnspr_includes}"
1881 AC_CHECK_HEADER(nspr.h,
1882 AC_CHECK_LIB(nspr4,PR_GetCurrentThread,[AC_DEFINE([HAVE_NSPR],[1],[libnspr available])
1884 if test "$NSPR" = "yes"; then
1885 if test "$with_libnspr_libraries" != "no"; then
1886 LDFLAGS="${LDFLAGS} -L${with_libnspr_libraries}"
1893 if test "$NSPR" = "no"; then
1895 echo " libnspr library not found, go get it"
1896 echo " from Mozilla or your distribution:"
1898 echo " Ubuntu: apt-get install libnspr4-dev"
1899 echo " Fedora: dnf install nspr-devel"
1900 echo " CentOS/RHEL: yum install nspr-devel"
1906 # libnss (enabled by default)
1909 AS_HELP_STRING([--disable-nss],[Disable libnss support]),
1910 [enable_nss=$enableval],[enable_nss="yes"])
1912 AC_ARG_WITH(libnss_includes,
1913 [ --with-libnss-includes=DIR libnss include directory],
1914 [with_libnss_includes="$withval"],[with_libnss_includes="no"])
1916 AC_ARG_WITH(libnss_libraries,
1917 [ --with-libnss-libraries=DIR libnss library directory],
1918 [with_libnss_libraries="$withval"],[with_libnss_libraries="no"])
1920 if test "$enable_nss" != "no"; then
1921 # Try pkg-config first:
1922 PKG_CHECK_MODULES([libnss],nss,,[with_pkgconfig_nss="no"])
1924 if test "$with_pkgconfig_nss" != "no"; then
1925 CPPFLAGS="${CPPFLAGS} ${libnss_CFLAGS}"
1926 LIBS="${LIBS} ${libnss_LIBS}"
1929 if test "$with_libnss_includes" != "no"; then
1930 CPPFLAGS="${CPPFLAGS} -I${with_libnss_includes}"
1934 AC_CHECK_HEADER(sechash.h,
1935 AC_CHECK_LIB(nss3,HASH_Begin,[AC_DEFINE([HAVE_NSS],[1],[libnss available])
1937 if test "$NSS" = "yes"; then
1938 if test "$with_libnss_libraries" != "no"; then
1939 LDFLAGS="${LDFLAGS} -L${with_libnss_libraries}"
1946 if test "$NSS" = "no"; then
1948 echo " libnss library not found, go get it"
1949 echo " from Mozilla or your distribution:"
1951 echo " Ubuntu: apt-get install libnss3-dev"
1952 echo " Fedora: dnf install nss-devel"
1953 echo " CentOS/RHEL: yum install nss-devel"
1961 AC_ARG_ENABLE(libmagic,
1962 AS_HELP_STRING([--enable-libmagic], [Enable libmagic support [default=yes]]),
1963 [enable_magic=$enableval],[enable_magic=yes])
1964 if test "$enable_magic" = "yes"; then
1965 AC_ARG_WITH(libmagic_includes,
1966 [ --with-libmagic-includes=DIR libmagic include directory],
1967 [with_libmagic_includes="$withval"],[with_libmagic_includes=no])
1968 AC_ARG_WITH(libmagic_libraries,
1969 [ --with-libmagic-libraries=DIR libmagic library directory],
1970 [with_libmagic_libraries="$withval"],[with_libmagic_libraries="no"])
1972 if test "$with_libmagic_includes" != "no"; then
1973 CPPFLAGS="${CPPFLAGS} -I${with_libmagic_includes}"
1976 AC_CHECK_HEADER(magic.h,,MAGIC="no")
1977 if test "$MAGIC" != "no"; then
1979 AC_CHECK_LIB(magic, magic_open,, MAGIC="no")
1982 if test "x$MAGIC" != "xno"; then
1983 if test "$with_libmagic_libraries" != "no"; then
1984 LDFLAGS="${LDFLAGS} -L${with_libmagic_libraries}"
1986 AC_DEFINE([HAVE_MAGIC],[1],(Libmagic for file handling))
1989 echo " WARNING! magic library not found, go get it"
1990 echo " from http://www.darwinsys.com/file/ or your distribution:"
1992 echo " Ubuntu: apt-get install libmagic-dev"
1993 echo " Fedora: dnf install file-devel"
1994 echo " CentOS/RHEL: yum install file-devel"
2000 # Napatech - Using the 3GD API
2001 AC_ARG_ENABLE(napatech,
2002 AS_HELP_STRING([--enable-napatech],[Enabled Napatech Devices]),
2003 [ enable_napatech=$enableval ],
2004 [ enable_napatech=no])
2005 AC_ARG_ENABLE(napatech_bypass,
2006 AS_HELP_STRING([--disable-napatech-bypass],[Disable Bypass feature on Napatech cards]),
2007 [ napatech_bypass=$enableval ],
2008 [ napatech_bypass=yes])
2009 AC_ARG_WITH(napatech_includes,
2010 [ --with-napatech-includes=DIR napatech include directory],
2011 [with_napatech_includes="$withval"],[with_napatech_includes="/opt/napatech3/include"])
2012 AC_ARG_WITH(napatech_libraries,
2013 [ --with-napatech-libraries=DIR napatech library directory],
2014 [with_napatech_libraries="$withval"],[with_napatech_libraries="/opt/napatech3/lib"])
2016 if test "$enable_napatech" = "yes"; then
2017 CPPFLAGS="${CPPFLAGS} -I${with_napatech_includes}"
2018 LDFLAGS="${LDFLAGS} -L${with_napatech_libraries} -lntapi"
2019 AC_CHECK_HEADER(nt.h,NAPATECH="yes",NAPATECH="no")
2020 if test "$NAPATECH" != "no"; then
2022 AC_CHECK_LIB(ntapi, NT_Init,NAPATECH="yes",NAPATECH="no")
2025 if test "$NAPATECH" = "no"; then
2027 echo " ERROR! libntapi library not found"
2031 AC_CHECK_LIB(numa, numa_available,, LIBNUMA="no")
2032 if test "$LIBNUMA" = "no"; then
2034 echo " WARNING: libnuma is required to use Napatech auto-config"
2035 echo " libnuma is not found. Go get it"
2036 echo " from http://github.com/numactl/numactl or your distribution:"
2037 echo " Ubuntu: apt-get install libnuma-dev"
2038 echo " Fedora: dnf install numactl-devel"
2039 echo " CentOS/RHEL: yum install numactl-devel"
2045 AC_DEFINE([HAVE_NAPATECH],[1],(Napatech capture card support))
2046 if test "$napatech_bypass" = "yes"; then
2047 AC_CHECK_LIB(ntapi, NT_FlowOpenAttrInit,NTFLOW="yes",NTFLOW="no")
2048 if test "$NTFLOW" = "yes"; then
2049 echo " Napatech Flow Processing is Enabled (--disable-napatech-bypass if not needed)"
2050 AC_DEFINE([NAPATECH_ENABLE_BYPASS],[1],(Napatech flowdirector support))
2052 echo "Napatech Flow Processing is not available"
2055 echo "Napatech Flow Processing is Disabled."
2061 AS_HELP_STRING([--enable-lua],[Enable Lua support]),
2062 [ enable_lua="$enableval"],
2064 AC_ARG_ENABLE(luajit,
2065 AS_HELP_STRING([--enable-luajit],[Enable Luajit support]),
2066 [ enable_luajit="$enableval"],
2067 [ enable_luajit="no"])
2068 if test "$enable_lua" = "yes"; then
2069 if test "$enable_luajit" = "yes"; then
2070 echo "ERROR: can't enable liblua and luajit at the same time."
2071 echo "For LuaJIT, just use --enable-luajit. For liblua (no jit)"
2072 echo "support, use just --enable-lua."
2073 echo "Both options will enable the Lua scripting capabilities"
2080 AC_ARG_WITH(liblua_includes,
2081 [ --with-liblua-includes=DIR liblua include directory],
2082 [with_liblua_includes="$withval"],[with_liblua_includes="no"])
2083 AC_ARG_WITH(liblua_libraries,
2084 [ --with-liblua-libraries=DIR liblua library directory],
2085 [with_liblua_libraries="$withval"],[with_liblua_libraries="no"])
2087 if test "$enable_lua" = "yes"; then
2088 if test "$with_liblua_includes" != "no"; then
2089 CPPFLAGS="${CPPFLAGS} -I${with_liblua_includes}"
2091 # lua lua51 lua5.1 lua-5.1
2092 PKG_CHECK_MODULES([LUA], [lua], [LUA="yes"], [
2093 PKG_CHECK_MODULES([LUA], [lua5.1], [LUA="yes"], [
2094 PKG_CHECK_MODULES([LUA], [lua-5.1], [LUA="yes"], [
2095 PKG_CHECK_MODULES([LUA], [lua51], [LUA="yes"], [
2101 CPPFLAGS="${CPPFLAGS} ${LUA_CFLAGS}"
2104 AC_CHECK_HEADER(lualib.h,LUA="yes",LUA="no")
2105 if test "$LUA" = "yes"; then
2106 if test "$with_liblua_libraries" != "no"; then
2107 LDFLAGS="${LDFLAGS} -L${with_liblua_libraries}"
2108 AC_CHECK_LIB(${LUA_LIB_NAME}, luaL_openlibs,, LUA="no")
2109 if test "$LUA" = "no"; then
2111 echo " ERROR! liblua library not found, go get it"
2112 echo " from http://lua.org/index.html or your distribution:"
2114 echo " Ubuntu: apt-get install liblua5.1-dev"
2115 echo " Fedora: dnf install lua-devel"
2116 echo " CentOS/RHEL: yum install lua-devel"
2118 echo " If you installed software in a non-standard prefix"
2119 echo " consider adjusting the PKG_CONFIG_PATH environment variable"
2120 echo " or use --with-liblua-libraries configure option."
2125 # lua lua51 lua5.1 lua-5.1
2126 PKG_CHECK_MODULES([LUA], [lua], [LUA="yes"], [
2127 PKG_CHECK_MODULES([LUA], [lua5.1], [LUA="yes"], [
2128 PKG_CHECK_MODULES([LUA], [lua-5.1], [LUA="yes"], [
2129 PKG_CHECK_MODULES([LUA], [lua51], [LUA="yes"], [
2135 LDFLAGS="${LDFLAGS} ${LUA_LIBS}"
2138 if test "$LUA" = "no"; then
2139 AC_CHECK_LIB(lua, luaL_openlibs,, LUA="no")
2142 if test "$LUA" = "yes"; then
2143 AC_DEFINE([HAVE_LUA],[1],[liblua available])
2148 echo " ERROR! liblua headers not found, go get them"
2149 echo " from http://lua.org/index.html or your distribution:"
2151 echo " Ubuntu: apt-get install liblua5.1-dev"
2152 echo " Fedora: dnf install lua-devel"
2153 echo " CentOS/RHEL: yum install lua-devel"
2155 echo " If you installed software in a non-standard prefix"
2156 echo " consider adjusting the PKG_CONFIG_PATH environment variable"
2157 echo " or use --with-liblua-includes and --with-liblua-libraries"
2158 echo " configure option."
2165 AC_ARG_WITH(libluajit_includes,
2166 [ --with-libluajit-includes=DIR libluajit include directory],
2167 [with_libluajit_includes="$withval"],[with_libluajit_includes="no"])
2168 AC_ARG_WITH(libluajit_libraries,
2169 [ --with-libluajit-libraries=DIR libluajit library directory],
2170 [with_libluajit_libraries="$withval"],[with_libluajit_libraries="no"])
2172 if test "$enable_luajit" = "yes"; then
2173 if test "$with_libluajit_includes" != "no"; then
2174 CPPFLAGS="${CPPFLAGS} -I${with_libluajit_includes}"
2176 PKG_CHECK_MODULES([LUAJIT], [luajit], , LUAJIT="no")
2177 CPPFLAGS="${CPPFLAGS} ${LUAJIT_CFLAGS}"
2180 AC_CHECK_HEADER(lualib.h,LUAJIT="yes",LUAJIT="no")
2181 if test "$LUAJIT" = "yes"; then
2182 if test "$with_libluajit_libraries" != "no"; then
2183 LDFLAGS="${LDFLAGS} -L${with_libluajit_libraries}"
2185 PKG_CHECK_MODULES([LUAJIT], [luajit])
2186 LDFLAGS="${LDFLAGS} ${LUAJIT_LIBS}"
2189 AC_CHECK_LIB(luajit-5.1, luaL_openlibs,, LUAJIT="no")
2191 if test "$LUAJIT" = "no"; then
2193 echo " ERROR! libluajit library not found, go get it"
2194 echo " from http://luajit.org/index.html or your distribution:"
2196 echo " Ubuntu: apt-get install libluajit-5.1-dev"
2198 echo " If you installed software in a non-standard prefix"
2199 echo " consider adjusting the PKG_CONFIG_PATH environment variable"
2200 echo " or use --with-libluajit-libraries configure option."
2205 AC_DEFINE([HAVE_LUA],[1],[lua support available])
2206 AC_DEFINE([HAVE_LUAJIT],[1],[libluajit available])
2207 enable_lua="yes, through luajit"
2211 echo " ERROR! libluajit headers not found, go get them"
2212 echo " from http://luajit.org/index.html or your distribution:"
2214 echo " Ubuntu: apt-get install libluajit-5.1-dev"
2216 echo " If you installed software in a non-standard prefix"
2217 echo " consider adjusting the PKG_CONFIG_PATH environment variable"
2218 echo " or use --with-libluajit-includes and --with-libluajit-libraries"
2219 echo " configure option."
2225 AM_CONDITIONAL([HAVE_LUA], [test "x$enable_lua" != "xno"])
2227 # If Lua is enabled, test the integer size.
2228 if test "x$enable_lua" = "xyes" -a "$cross_compiling" != "yes"; then
2232 AC_MSG_CHECKING([size of lua integer])
2233 AC_RUN_IFELSE([AC_LANG_PROGRAM([[#include <lua.h>]],
2235 if (sizeof(lua_Integer) == 8) {
2245 AC_SUBST([LUA_INT8], ["lua_int8"])
2251 AC_ARG_ENABLE(geoip,
2252 AS_HELP_STRING([--enable-geoip],[Enable GeoIP2 support]),
2253 [ enable_geoip="$enableval"],
2254 [ enable_geoip="no"])
2255 AC_ARG_WITH(libmaxminddb_includes,
2256 [ --with-libmaxminddb-includes=DIR libmaxminddb include directory],
2257 [with_libmaxminddb_includes="$withval"],[with_libmaxminddb_includes="no"])
2258 AC_ARG_WITH(libmaxminddb_libraries,
2259 [ --with-libmaxminddb-libraries=DIR libmaxminddb library directory],
2260 [with_libmaxminddb_libraries="$withval"],[with_libmaxminddb_libraries="no"])
2262 if test "$enable_geoip" = "yes"; then
2263 if test "$with_libmaxminddb_includes" != "no"; then
2264 CPPFLAGS="${CPPFLAGS} -I${with_libmaxminddb_includes}"
2267 AC_CHECK_HEADER(maxminddb.h,GEOIP="yes",GEOIP="no")
2268 if test "$GEOIP" = "yes"; then
2269 if test "$with_libmaxminddb_libraries" != "no"; then
2270 LDFLAGS="${LDFLAGS} -L${with_libmaxminddb_libraries}"
2272 AC_CHECK_LIB(maxminddb, MMDB_open,, GEOIP="no")
2274 if test "$GEOIP" = "no"; then
2276 echo " ERROR! libmaxminddb GeoIP2 library not found, go get it"
2277 echo " from https://github.com/maxmind/libmaxminddb or your distribution:"
2279 echo " Ubuntu: apt-get install libmaxminddb-dev"
2280 echo " Fedora: dnf install libmaxminddb-devel"
2281 echo " CentOS/RHEL: yum install libmaxminddb-devel"
2286 AC_DEFINE([HAVE_GEOIP],[1],[libmaxminddb available])
2290 # Position Independent Executable
2292 AS_HELP_STRING([--enable-pie],[Enable compiling as a position independent executable]),
2293 [ enable_pie="$enableval"],
2295 if test "$enable_pie" = "yes"; then
2296 CPPFLAGS="${CPPFLAGS} -fPIC"
2297 LDFLAGS="${LDFLAGS} -pie"
2300 #libevent includes and libraries
2301 AC_ARG_WITH(libevent_includes,
2302 [ --with-libevent-includes=DIR libevent include directory],
2303 [with_libevent_includes="$withval"],[with_libevent_includes="no"])
2304 AC_ARG_WITH(libevent_libraries,
2305 [ --with-libevent-libraries=DIR libevent library directory],
2306 [with_libevent_libraries="$withval"],[with_libevent_libraries="no"])
2309 AC_ARG_ENABLE(hiredis,
2310 AS_HELP_STRING([--enable-hiredis],[Enable Redis support]),
2311 [ enable_hiredis="$enableval"],
2312 [ enable_hiredis="no"])
2313 AC_ARG_WITH(libhiredis_includes,
2314 [ --with-libhiredis-includes=DIR libhiredis include directory],
2315 [with_libhiredis_includes="$withval"],[with_libhiredis_includes="no"])
2316 AC_ARG_WITH(libhiredis_libraries,
2317 [ --with-libhiredis-libraries=DIR libhiredis library directory],
2318 [with_libhiredis_libraries="$withval"],[with_libhiredis_libraries="no"])
2320 enable_hiredis_async="no"
2321 if test "$enable_hiredis" = "yes"; then
2322 if test "$with_libhiredis_includes" != "no"; then
2323 CPPFLAGS="${CPPFLAGS} -I${with_libhiredis_includes}"
2326 AC_CHECK_HEADER("hiredis/hiredis.h",HIREDIS="yes",HIREDIS="no")
2327 if test "$HIREDIS" = "yes"; then
2328 if test "$with_libhiredis_libraries" != "no"; then
2329 LDFLAGS="${LDFLAGS} -L${with_libhiredis_libraries}"
2331 AC_CHECK_LIB(hiredis, redisConnect,, HIREDIS="no")
2333 if test "$HIREDIS" = "no"; then
2335 echo " ERROR! libhiredis library not found, go get it"
2336 echo " from https://github.com/redis/hiredis or your distribution:"
2338 echo " Ubuntu: apt-get install libhiredis-dev"
2339 echo " Fedora: dnf install hiredis-devel"
2340 echo " CentOS/RHEL: yum install hiredis-devel"
2344 if test "$HIREDIS" = "yes"; then
2345 AC_DEFINE([HAVE_LIBHIREDIS],[1],[libhiredis available])
2346 enable_hiredis="yes"
2348 # Check if async adapters and libevent is installed
2350 AC_CHECK_HEADER("hiredis/adapters/libevent.h",HIREDIS_LIBEVENT_ADAPTER="yes",HIREDIS_LIBEVENT_ADAPTER="no")
2351 if test "$HIREDIS_LIBEVENT_ADAPTER" = "yes"; then
2352 #Look for libevent headers
2353 if test "$with_libevent_includes" != "no"; then
2354 CPPFLAGS="${CPPFLAGS} -I${with_libevent_includes}"
2356 AC_CHECK_HEADER("event.h",LIBEVENT="yes",LIBEVENT="no")
2357 if test "$LIBEVENT" = "yes"; then
2358 if test "$with_libevent_libraries" != "no"; then
2359 LDFLAGS="${LDFLAGS} -L${with_libevent_libraries}"
2361 AC_CHECK_LIB(event, event_base_free,, HAVE_LIBEVENT="no")
2362 AC_CHECK_LIB(event_pthreads, evthread_use_pthreads,, HAVE_LIBEVENT_PTHREADS="no")
2364 if [ test "$HAVE_LIBEVENT" = "no" ] && [ -o test "$HAVE_LIBEVENT_PTHREADS" = "no"]; then
2365 if test "$HAVE_LIBEVENT" = "no"; then
2367 echo " Async mode for redis output will not be available."
2368 echo " To enable it install libevent"
2370 echo " Ubuntu: apt-get install libevent-dev"
2371 echo " Fedora: dnf install libevent-devel"
2372 echo " CentOS/RHEL: yum install libevent-devel"
2375 if test "$HAVE_LIBEVENT_PTHREADS" = "no"; then
2377 echo " Async mode for redis output will not be available."
2378 echo " To enable it install libevent with pthreads support"
2380 echo " Ubuntu: apt-get install libevent-pthreads-2.0-5"
2384 AC_DEFINE([HAVE_LIBEVENT],[1],[libevent available])
2385 enable_hiredis_async="yes"
2393 AC_CHECK_LIB(lz4, LZ4F_createCompressionContext, , enable_liblz4="no")
2395 if test "$enable_liblz4" = "no"; then
2397 echo " Compressed pcap logging is not available without liblz4."
2398 echo " If you want to enable compression, you need to install it."
2400 echo " Ubuntu: apt-get install liblz4-dev"
2401 echo " Fedora: dnf install lz4-devel"
2402 echo " CentOS/RHEL: yum install epel-release"
2403 echo " yum install lz4-devel"
2407 # get cache line size
2408 AC_PATH_PROG(HAVE_GETCONF_CMD, getconf, "no")
2409 if test "$HAVE_GETCONF_CMD" != "no"; then
2410 CLS=$(getconf LEVEL1_DCACHE_LINESIZE)
2411 if [test "$CLS" != "" && test "$CLS" != "0"]; then
2412 AC_DEFINE_UNQUOTED([CLS],[${CLS}],[L1 cache line size])
2414 AC_DEFINE([CLS],[64],[L1 cache line size])
2417 AC_DEFINE([CLS],[64],[L1 cache line size])
2420 # sphinx for documentation
2421 AC_PATH_PROG(HAVE_SPHINXBUILD, sphinx-build, "no")
2422 if test "$HAVE_SPHINXBUILD" = "no"; then
2423 enable_sphinxbuild=no
2424 if test -e "$srcdir/doc/userguide/suricata.1"; then
2425 have_suricata_man=yes
2428 AM_CONDITIONAL([HAVE_SPHINXBUILD], [test "x$enable_sphinxbuild" != "xno"])
2429 AM_CONDITIONAL([HAVE_SURICATA_MAN], [test "x$have_suricata_man" = "xyes"])
2431 # pdflatex for the pdf version of the user manual
2432 AC_PATH_PROG(HAVE_PDFLATEX, pdflatex, "no")
2433 if test "$HAVE_PDFLATEX" = "no"; then
2436 AM_CONDITIONAL([HAVE_PDFLATEX], [test "x$enable_pdflatex" != "xno"])
2439 AM_CONDITIONAL([RUST_CROSS_COMPILE], [test "x$cross_compiling" = "xyes"])
2440 AC_PATH_PROG(RUSTC, rustc, "no")
2441 if test "$RUSTC" = "no"; then
2443 echo " ERROR: Suricata now requires Rust to build."
2445 echo " Ubuntu/Debian: apt install rustc cargo"
2446 echo " Fedora: dnf install rustc cargo"
2447 echo " CentOS: yum install rustc cargo (requires EPEL)"
2449 echo " Rustup works as well: https://rustup.rs/"
2454 AC_PATH_PROG(CARGO, cargo, "no")
2455 if test "CARGO" = "no"; then
2456 AC_MSG_ERROR([cargo required])
2459 AC_DEFINE([HAVE_RUST],[1],[Enable Rust language])
2460 AM_CONDITIONAL([HAVE_RUST],true)
2461 AC_SUBST([CARGO], [$CARGO])
2464 rust_compiler_version=$($RUSTC --version)
2465 rustc_version=$(echo "$rust_compiler_version" | sed 's/^.*[[^0-9]]\([[0-9]]*\.[[0-9]]*\.[[0-9]]*\).*$/\1/')
2466 cargo_version_output=$($CARGO --version)
2467 cargo_version=$(echo "$cargo_version_output" | sed 's/^.*[[^0-9]]\([[0-9]]*\.[[0-9]]*\.[[0-9]]*\).*$/\1/')
2469 MIN_RUSTC_VERSION="1.34.2"
2470 AC_MSG_CHECKING(for Rust version $MIN_RUSTC_VERSION or newer)
2471 AS_VERSION_COMPARE([$rustc_version], [$MIN_RUSTC_VERSION],
2474 echo "ERROR: Rust $MIN_RUSTC_VERSION or newer required."
2476 echo "Rust version ${rustc_version} was found."
2485 AS_VERSION_COMPARE([$rustc_version], [1.38.0],
2487 [RUST_FEATURES="$RUST_FEATURES function-macro"],
2488 [RUST_FEATURES="$RUST_FEATURES function-macro"])
2490 rust_vendor_comment="# "
2491 have_rust_vendor="no"
2493 if test "x$cross_compiling" = "xyes"; then
2494 RUST_SURICATA_LIB_XC_DIR="${host_alias}/"
2496 if test "x$CARGO_BUILD_TARGET" = "x"; then
2497 RUST_SURICATA_LIB_XC_DIR=
2499 RUST_SURICATA_LIB_XC_DIR="${CARGO_BUILD_TARGET}/"
2503 if test "x$enable_debug" = "xyes"; then
2504 RUST_SURICATA_LIB="../rust/target/${RUST_SURICATA_LIB_XC_DIR}debug/${RUST_SURICATA_LIBNAME}"
2506 RUST_SURICATA_LIB="../rust/target/${RUST_SURICATA_LIB_XC_DIR}release/${RUST_SURICATA_LIBNAME}"
2509 RUST_LDADD="${RUST_SURICATA_LIB} ${RUST_LDADD}"
2510 CFLAGS="${CFLAGS} -I\${srcdir}/../rust/gen -I\${srcdir}/../rust/dist"
2511 AC_SUBST(RUST_SURICATA_LIB)
2512 AC_SUBST(RUST_LDADD)
2513 if test "x$CARGO_HOME" = "x"; then
2514 if test "x$HAVE_CYGPATH" != "xno"; then
2515 CYGPATH_CARGO_HOME=$(cygpath -a -t mixed ~/.cargo)
2516 AC_SUBST([CARGO_HOME], [$CYGPATH_CARGO_HOME])
2518 AC_SUBST([CARGO_HOME], [~/.cargo])
2521 AC_SUBST([CARGO_HOME], [$CARGO_HOME])
2524 # Check for rustup. RUSTUP_HOME needs to be set if rustup is in
2525 # use, and a user uses sudo (depending on configuration), or su to
2526 # perform the install
2527 rustup_home_path="no"
2528 if test "x$RUSTUP_HOME" != "x"; then
2529 rustup_home_path="$RUSTUP_HOME"
2531 AC_PATH_PROG(have_rustup, rustup, "no")
2532 if test "x$have_rustup" != "xno"; then
2533 rustup_home_path=$($have_rustup show home 2>/dev/null || echo "no")
2537 if test "x$rustup_home_path" != "xno"; then
2538 rustup_home="RUSTUP_HOME=\$(RUSTUP_HOME_PATH)"
2540 AC_SUBST([RUSTUP_HOME_PATH], [$rustup_home_path])
2541 AC_SUBST([rustup_home])
2543 if test -e "$srcdir/rust/vendor"; then
2544 have_rust_vendor="yes"
2547 if test "x$have_rust_vendor" = "xyes"; then
2548 rust_vendor_comment=""
2551 AC_SUBST(rust_vendor_comment)
2552 AM_CONDITIONAL([HAVE_RUST_VENDOR], [test "x$have_rust_vendor" = "xyes"])
2554 # With Rust/Cargo 1.37 and greater, cargo-vendor is built-in.
2555 AC_MSG_CHECKING(for cargo vendor support)
2556 AS_VERSION_COMPARE([$cargo_version], [1.37.0],
2557 [have_cargo_vendor="no"],
2558 [have_cargo_vendor="yes"],
2559 [have_cargo_vendor="yes"])
2560 AC_MSG_RESULT($have_cargo_vendor)
2562 # If Rust is older than 1.37, check for cargo-vendor as an
2563 # external sub-command.
2564 if test "x$have_cargo_vendor" != "xyes"; then
2565 AC_CHECK_PROG(have_cargo_vendor_bin, cargo-vendor, yes, no)
2566 have_cargo_vendor=$have_cargo_vendor_bin
2569 have_rust_headers="no"
2570 AC_MSG_CHECKING(for $srcdir/rust/dist/rust-bindings.h)
2571 if test -f "$srcdir/rust/dist/rust-bindings.h"; then
2573 have_rust_headers="yes"
2576 AC_MSG_CHECKING(for $srcdir/rust/gen/rust-bindings.h)
2577 if test -f "$srcdir/rust/gen/rust-bindings.h"; then
2579 have_rust_headers="yes"
2585 AC_PATH_PROG(CBINDGEN, cbindgen, "no")
2586 if test "x$CBINDGEN" != "xno"; then
2587 cbindgen_version=$(cbindgen --version | cut -d' ' -f2-)
2588 min_cbindgen_version="0.10.0"
2589 AS_VERSION_COMPARE([$cbindgen_version], [$min_cbindgen_version],
2591 [cbindgen_ok="yes"],
2592 [cbindgen_ok="yes"])
2593 if test "x$cbindgen_ok" != "xyes"; then
2594 echo " Warning: cbindgen must be at least version $min_cbindgen_version,"
2595 echo " found $cbindgen_version."
2596 echo " To update: cargo install --force cbindgen"
2599 have_rust_headers="no"
2603 AC_SUBST([CBINDGEN], [$CBINDGEN])
2605 # Require cbindgen if generated headers are not bundled.
2606 if test "x$have_rust_headers" != "xyes"; then
2607 if test "x$CBINDGEN" = "xno"; then
2608 echo " Warning: cbindgen too old or not found, it is required to "
2609 echo " generate header files."
2610 echo " To install: cargo install --force cbindgen"
2611 AC_MSG_ERROR([cbindgen required])
2615 AM_CONDITIONAL([HAVE_RUST_HEADERS], [test "x$have_rust_headers" = "xyes"])
2616 AM_CONDITIONAL([HAVE_CBINDGEN], [test "x$CBINDGEN" != "xno"])
2617 AM_CONDITIONAL([HAVE_CARGO_VENDOR], [test "x$have_cargo_vendor" != "xno"])
2619 AC_ARG_ENABLE(rust_strict,
2620 AS_HELP_STRING([--enable-rust-strict], [Rust warnings as errors]),[enable_rust_strict=$enableval],[enable_rust_strict=no])
2621 AS_IF([test "x$enable_rust_strict" = "xyes"], [
2622 RUST_FEATURES="strict"
2624 AC_SUBST(RUST_FEATURES)
2626 AC_ARG_ENABLE(fuzztargets,
2627 AS_HELP_STRING([--enable-fuzztargets], [Enable fuzz targets]),[enable_fuzztargets=$enableval],[enable_fuzztargets=no])
2628 AM_CONDITIONAL([BUILD_FUZZTARGETS], [test "x$enable_fuzztargets" = "xyes"])
2629 AM_CONDITIONAL([RUST_BUILD_STD], [test "x$enable_fuzztargets" = "xyes" && echo "$rust_compiler_version" | grep -q nightly && echo "$RUSTFLAGS" | grep -v -q coverage])
2631 AS_IF([test "x$enable_fuzztargets" = "xyes"], [
2632 AS_IF([test "x$CARGO_BUILD_TARGET" = "x" && echo "$rust_compiler_version" | grep -q nightly], [
2633 CARGO_BUILD_TARGET=x86_64-unknown-linux-gnu
2634 AC_SUBST(CARGO_BUILD_TARGET)
2636 AC_DEFINE([FUZZ], [1], [Fuzz targets are enabled])
2637 AC_DEFINE([AFLFUZZ_NO_RANDOM], [1], [Disable all use of random functions])
2640 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[while (__AFL_LOOP(1000))]])],
2641 [AC_DEFINE([AFLFUZZ_PERSISTANT_MODE], [1], [Enable AFL PERSISTANT_MODE])],
2645 tmp_saved_flags=$[]_AC_LANG_PREFIX[]FLAGS
2646 AS_IF([test "x$LIB_FUZZING_ENGINE" = "x"], [
2647 LIB_FUZZING_ENGINE=-fsanitize=fuzzer
2648 AC_SUBST(LIB_FUZZING_ENGINE)
2650 _AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $LIB_FUZZING_ENGINE"
2651 AC_MSG_CHECKING([whether $CXX accepts $LIB_FUZZING_ENGINE])
2652 AC_LINK_IFELSE([AC_LANG_SOURCE([[
2653 #include <sys/types.h>
2654 extern "C" int LLVMFuzzerTestOneInput(const unsigned char *Data, size_t Size);
2655 extern "C" int LLVMFuzzerTestOneInput(const unsigned char *Data, size_t Size) {
2661 [ AC_MSG_RESULT(yes)
2662 has_sanitizefuzzer=yes],
2663 [ AC_MSG_RESULT(no) ]
2665 _AC_LANG_PREFIX[]FLAGS=$tmp_saved_flags
2669 AM_CONDITIONAL([HAS_FUZZLDFLAGS], [test "x$has_sanitizefuzzer" = "xyes"])
2672 if test -f ./revision; then
2673 REVISION=`cat ./revision`
2674 AC_DEFINE_UNQUOTED([REVISION],[${REVISION}],[Git revision])
2676 AC_PATH_PROG(HAVE_GIT_CMD, git, "no")
2677 if test "$HAVE_GIT_CMD" != "no"; then
2678 if [ test -d .git ]; then
2679 REVISION=`git rev-parse --short HEAD`
2680 DATE=`git log -1 --date=short --pretty=format:%cd`
2681 REVISION="$REVISION $DATE"
2682 AC_DEFINE_UNQUOTED([REVISION],[${REVISION}],[Git revision])
2687 if test "${enable_ebpf}" = "yes" || test "${enable_unittests}" = "yes"; then
2688 AC_DEFINE([CAPTURE_OFFLOAD_MANAGER], [1],[Building flow bypass manager code])
2690 if test "${enable_ebpf}" = "yes" || test "${enable_nfqueue}" = "yes" || test "${enable_pfring}" = "yes" || test "${enable_napatech}" = "yes" || test "${enable_unittests}" = "yes"; then
2691 AC_DEFINE([CAPTURE_OFFLOAD], [1],[Building flow capture bypass code])
2698 define([EXPAND_VARIABLE],
2700 if test $prefix = 'NONE'; then
2705 *\[$]* ) eval "$2=[$]$2" ;;
2710 ])dnl EXPAND_VARIABLE
2713 if test "$WINDOWS_PATH" = "yes"; then
2716 e_winbase="C:\\\\Program Files\\\\Suricata"
2719 systemtype="`systeminfo | grep \"based PC\"`"
2720 case "$systemtype" in
2722 e_winbase="C:\\\\Program Files (x86)\\\\Suricata"
2725 e_winbase="C:\\\\Program Files\\\\Suricata"
2730 e_sysconfdir="${e_winbase}\\\\"
2731 e_defaultruledir="$e_winbase\\\\rules\\\\"
2732 e_magic_file="$e_winbase\\\\magic.mgc"
2733 e_logdir="$e_winbase\\\\log"
2734 e_logfilesdir="$e_logdir\\\\files"
2735 e_logcertsdir="$e_logdir\\\\certs"
2736 e_datarulesdir="$e_winbase\\\\rules\\\\"
2737 if test "x$HAVE_CYGPATH" != "xno"; then
2738 # turn srcdir into abs path and convert to the
2739 # mixed output (/c/Users/dev into c:/Users/dev)
2740 e_rustdir="$(cygpath -a -t mixed ${srcdir})/rust"
2742 e_abs_srcdir=$(cd $srcdir && pwd)
2743 e_rustdir="$e_abs_srcdir/rust"
2746 EXPAND_VARIABLE(localstatedir, e_logdir, "/log/suricata/")
2747 EXPAND_VARIABLE(localstatedir, e_rundir, "/run/")
2748 EXPAND_VARIABLE(localstatedir, e_logfilesdir, "/log/suricata/files")
2749 EXPAND_VARIABLE(localstatedir, e_logcertsdir, "/log/suricata/certs")
2750 EXPAND_VARIABLE(sysconfdir, e_sysconfdir, "/suricata/")
2751 EXPAND_VARIABLE(localstatedir, e_localstatedir, "/run/suricata")
2752 EXPAND_VARIABLE(datadir, e_datarulesdir, "/suricata/rules")
2753 EXPAND_VARIABLE(localstatedir, e_datadir, "/lib/suricata/data")
2754 EXPAND_VARIABLE(ruledirprefix, e_defaultruledir, "/suricata/rules")
2756 e_abs_srcdir=$(cd $srcdir && pwd)
2757 EXPAND_VARIABLE(e_abs_srcdir, e_rustdir, "/rust")
2761 AC_SUBST(e_logfilesdir)
2762 AC_SUBST(e_logcertsdir)
2763 AC_SUBST(e_sysconfdir)
2764 AC_DEFINE_UNQUOTED([CONFIG_DIR],["$e_sysconfdir"],[Our CONFIG_DIR])
2765 AC_SUBST(e_localstatedir)
2766 AC_DEFINE_UNQUOTED([DATA_DIR],["$e_datadir"],[Our DATA_DIR])
2767 AC_SUBST(e_magic_file)
2768 AC_SUBST(e_magic_file_comment)
2769 AC_SUBST(e_enable_evelog)
2770 AC_SUBST(e_datarulesdir)
2771 AC_SUBST(e_defaultruledir)
2774 EXPAND_VARIABLE(prefix, CONFIGURE_PREFIX)
2775 EXPAND_VARIABLE(sysconfdir, CONFIGURE_SYSCONDIR)
2776 EXPAND_VARIABLE(localstatedir, CONFIGURE_LOCALSTATEDIR)
2777 EXPAND_VARIABLE(datadir, CONFIGURE_DATAROOTDIR)
2778 AC_SUBST(CONFIGURE_PREFIX)
2779 AC_SUBST(CONFIGURE_SYSCONDIR)
2780 AC_SUBST(CONFIGURE_LOCALSTATEDIR)
2781 AC_SUBST(CONFIGURE_DATAROOTDIR)
2782 AC_SUBST(PACKAGE_VERSION)
2783 AC_SUBST(RUST_FEATURES)
2785 AC_CONFIG_FILES(Makefile src/Makefile rust/Makefile rust/Cargo.toml rust/.cargo/config)
2786 AC_CONFIG_FILES(qa/Makefile qa/coccinelle/Makefile)
2787 AC_CONFIG_FILES(rules/Makefile doc/Makefile doc/userguide/Makefile doc/devguide/Makefile)
2788 AC_CONFIG_FILES(contrib/Makefile contrib/file_processor/Makefile contrib/file_processor/Action/Makefile contrib/file_processor/Processor/Makefile)
2789 AC_CONFIG_FILES(suricata.yaml etc/Makefile etc/suricata.logrotate etc/suricata.service)
2790 AC_CONFIG_FILES(python/Makefile python/suricata/config/defaults.py)
2791 AC_CONFIG_FILES(ebpf/Makefile)
2794 SURICATA_BUILD_CONF="Suricata Configuration:
2795 AF_PACKET support: ${enable_af_packet}
2796 eBPF support: ${enable_ebpf}
2797 XDP support: ${have_xdp}
2798 PF_RING support: ${enable_pfring}
2799 NFQueue support: ${enable_nfqueue}
2800 NFLOG support: ${enable_nflog}
2801 IPFW support: ${enable_ipfw}
2802 Netmap support: ${enable_netmap} ${have_netmap_version}
2803 DAG enabled: ${enable_dag}
2804 Napatech enabled: ${enable_napatech}
2805 WinDivert enabled: ${enable_windivert}
2807 Unix socket enabled: ${enable_unixsocket}
2808 Detection enabled: ${enable_detection}
2810 Libmagic support: ${enable_magic}
2811 libnss support: ${enable_nss}
2812 libnspr support: ${enable_nspr}
2813 libjansson support: ${enable_jansson}
2814 hiredis support: ${enable_hiredis}
2815 hiredis async with libevent: ${enable_hiredis_async}
2816 Prelude support: ${enable_prelude}
2817 PCRE jit: ${pcre_jit_available}
2818 LUA support: ${enable_lua}
2819 libluajit: ${enable_luajit}
2820 GeoIP2 support: ${enable_geoip}
2821 Non-bundled htp: ${enable_non_bundled_htp}
2822 Hyperscan support: ${enable_hyperscan}
2823 Libnet support: ${enable_libnet}
2824 liblz4 support: ${enable_liblz4}
2826 Rust support: ${enable_rust}
2827 Rust strict mode: ${enable_rust_strict}
2828 Rust compiler path: ${RUSTC}
2829 Rust compiler version: ${rust_compiler_version}
2830 Cargo path: ${CARGO}
2831 Cargo version: ${cargo_version_output}
2832 Cargo vendor: ${have_cargo_vendor}
2834 Python support: ${enable_python}
2835 Python path: ${python_path}
2836 Python distutils ${have_python_distutils}
2837 Python yaml ${have_python_yaml}
2838 Install suricatactl: ${install_suricatactl}
2839 Install suricatasc: ${install_suricatactl}
2840 Install suricata-update: ${install_suricata_update}
2842 Profiling enabled: ${enable_profiling}
2843 Profiling locks enabled: ${enable_profiling_locks}
2845 Plugin support (experimental): ${plugin_support}
2847 Development settings:
2848 Coccinelle / spatch: ${enable_coccinelle}
2849 Unit tests enabled: ${enable_unittests}
2850 Debug output enabled: ${enable_debug}
2851 Debug validation enabled: ${enable_debug_validation}
2853 Generic build parameters:
2854 Installation prefix: ${prefix}
2855 Configuration directory: ${e_sysconfdir}
2856 Log directory: ${e_logdir}
2858 --prefix ${CONFIGURE_PREFIX}
2859 --sysconfdir ${CONFIGURE_SYSCONDIR}
2860 --localstatedir ${CONFIGURE_LOCALSTATEDIR}
2861 --datarootdir ${CONFIGURE_DATAROOTDIR}
2864 Compiler: ${CC} (exec name) / ${compiler} (real)
2865 GCC Protect enabled: ${enable_gccprotect}
2866 GCC march native enabled: ${enable_gccmarch_native}
2867 GCC Profile enabled: ${enable_gccprofile}
2868 Position Independent Executable enabled: ${enable_pie}
2870 PCAP_CFLAGS ${PCAP_CFLAGS}
2871 SECCFLAGS ${SECCFLAGS}"
2874 echo "$SURICATA_BUILD_CONF"
2875 echo "printf(" >src/build-info.h
2876 echo "$SURICATA_BUILD_CONF" | sed -e 's/^/"/' | sed -e 's/$/\\n"/' >>src/build-info.h
2877 echo ");" >>src/build-info.h
2880 To build and install run 'make' and 'make install'.
2882 You can run 'make install-conf' if you want to install initial configuration
2883 files to ${e_sysconfdir}. Running 'make install-full' will install configuration
2884 and rules and provide you a ready-to-run suricata."
2886 echo "To install Suricata into /usr/bin/suricata, have the config in
2887 /etc/suricata and use /var/log/suricata as log dir, use:
2888 ./configure --prefix=/usr/ --sysconfdir=/etc/ --localstatedir=/var/"