1 AC_INIT([suricata],[7.0.0-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_rust.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 # Always compile with -fPIC on Linux for shared library support.
303 CFLAGS="${CFLAGS} -fPIC"
304 RUST_LDADD="-ldl -lrt -lm"
305 can_build_shared_library="yes"
307 *-*-mingw32*|*-*-msys)
308 CFLAGS="${CFLAGS} -DOS_WIN32"
310 PCAP_LIB_NAME="wpcap"
311 AC_DEFINE([HAVE_NON_POSIX_MKDIR], [1], [mkdir is not POSIX compliant: single arg])
312 RUST_LDADD=" -lws2_32 -liphlpapi -lwbemuuid -lOle32 -lOleAut32 -lUuid -luserenv -lshell32 -ladvapi32 -lgcc_eh"
317 PCAP_LIB_NAME="wpcap"
320 AC_MSG_WARN([support for Solaris/Illumos/SunOS is experimental])
321 LDFLAGS="${LDFLAGS} -lsocket -lnsl"
324 AC_MSG_WARN([unsupported OS this may or may not work])
329 # check if our target supports c11
330 AC_MSG_CHECKING(for c11 support)
333 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h>]],
334 [[ static _Thread_local int i; i = 1; i++; ]])],
336 [AC_DEFINE([TLS_C11], [1], [C11 Thread local storage])
337 CFLAGS="$OCFLAGS -std=c11"],
342 if [ test "x$have_c11" = "xno" ]; then
343 CFLAGS="$CFLAGS -std=gnu99"
346 # check if our target supports thread local storage
347 AC_MSG_CHECKING(for thread local storage gnu __thread support)
348 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h>]],
349 [[ static __thread int i; i = 1; i++; ]])],
350 [AC_DEFINE([TLS_GNU], [1], [Thread local storage])
351 AC_MSG_RESULT([yes])],
354 if [ test "x$have_c11_tls" = "xno" ] && [ test "x$have_gnu_tls" = "xno" ]; then
355 AC_MSG_ERROR("no thread local support available.")
359 #Enable support for gcc compile time security options. There is no great way to do detection of valid cflags that I have found
360 #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.
361 #These flags seem to be supported on CentOS 5+, Ubuntu 8.04+, and FedoreCore 11+
362 #Options are taken from https://wiki.ubuntu.com/CompilerFlags
363 AC_ARG_ENABLE(gccprotect,
364 AS_HELP_STRING([--enable-gccprotect], [Detect and use gcc hardening options]),[enable_gccprotect=$enableval],[enable_gccprotect=no])
366 AS_IF([test "x$enable_gccprotect" = "xyes"], [
367 #buffer overflow protection
368 AC_MSG_CHECKING(for -fstack-protector)
369 TMPCFLAGS="${CFLAGS}"
370 CFLAGS="${CFLAGS} -fstack-protector"
371 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[SECCFLAGS="-fstack-protector"
374 CFLAGS="${TMPCFLAGS}"
376 #compile-time best-practices errors for certain libc functions, provides checks of buffer lengths and memory regions
377 AC_MSG_CHECKING(for -D_FORTIFY_SOURCE=2)
378 TMPCFLAGS="${CFLAGS}"
379 CFLAGS="${CFLAGS} -D_FORTIFY_SOURCE=2"
380 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[SECCFLAGS="${SECCFLAGS} -D_FORTIFY_SOURCE=2"
383 CFLAGS="${TMPCFLAGS}"
385 #compile-time warnings about misuse of format strings
386 AC_MSG_CHECKING(for -Wformat -Wformat-security)
387 TMPCFLAGS="${CFLAGS}"
388 CFLAGS="${CFLAGS} -Wformat -Wformat-security"
389 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[SECCFLAGS="${SECCFLAGS} -Wformat -Wformat-security"
392 CFLAGS="${TMPCFLAGS}"
394 #provides a read-only relocation table area in the final ELF
395 AC_MSG_CHECKING(for -z relro)
396 TMPLDFLAGS="${LDFLAGS}"
397 LDFLAGS="${LDFLAGS} -z relro"
398 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[SECLDFLAGS="${SECLDFLAGS} -z relro"
401 LDFLAGS="${TMPLDFLAGS}"
403 #forces all relocations to be resolved at run-time
404 AC_MSG_CHECKING(for -z now)
405 TMPLDFLAGS="${LDFLAGS}"
406 LDFLAGS="${LDFLAGS} -z now"
407 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[SECLDFLAGS="${SECLDFLAGS} -z now"
410 LDFLAGS="${TMPLDFLAGS}"
416 #check for plugin support
417 AC_CHECK_HEADERS([dlfcn.h])
418 AC_MSG_CHECKING([for plugin support])
419 TMPLDFLAGS="${LDFLAGS}"
420 LDFLAGS="${LDFLAGS} -rdynamic"
421 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <dlfcn.h>]], [[]])],
431 if test "x$has_rdynamic" = "xyes"; then
433 AC_DEFINE([HAVE_PLUGINS], [1], [Plugin support])
436 LDFLAGS="${TMPLDFLAGS}"
439 #enable profile generation
440 AC_ARG_ENABLE(gccprofile,
441 AS_HELP_STRING([--enable-gccprofile], [Enable gcc profile info i.e -pg flag is set]),[enable_gccprofile=$enableval],[enable_gccprofile=no])
442 AS_IF([test "x$enable_gccprofile" = "xyes"], [
443 CFLAGS="${CFLAGS} -pg"
446 #enable gcc march=native gcc 4.2 or later
447 AC_ARG_ENABLE(gccmarch_native,
448 AS_HELP_STRING([--enable-gccmarch-native], [Enable gcc march=native gcc 4.2 and later only]),[enable_gccmarch_native=$enableval],[enable_gccmarch_native=yes])
449 AS_IF([test "x$enable_gccmarch_native" = "xyes"], [
455 CFLAGS="$CFLAGS -march=native"
456 AC_MSG_CHECKING([checking if $CC supports -march=native])
457 AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([[#include <stdlib.h>]])],
460 OPTIMIZATION_CFLAGS="-march=native"
461 AC_SUBST(OPTIMIZATION_CFLAGS)
466 enable_gccmarch_native=no
476 # enable the running of unit tests
477 AC_ARG_ENABLE(unittests,
478 AS_HELP_STRING([--enable-unittests], [Enable compilation of the unit tests]),[enable_unittests=$enableval],[enable_unittests=no])
479 AS_IF([test "x$enable_unittests" = "xyes"], [
480 AC_DEFINE([UNITTESTS],[1],[Enable built-in unittests])
482 AM_CONDITIONAL([BUILD_UNITTESTS], [test "x$enable_unittests" = "xyes"])
484 # enable the building of ebpf files
485 AC_ARG_ENABLE(ebpf-build,
486 AS_HELP_STRING([--enable-ebpf-build], [Enable compilation of ebpf files]),[enable_ebpf_build=$enableval],[enable_ebpf_build=no])
487 AM_CONDITIONAL([BUILD_EBPF], [test "x$enable_ebpf_build" = "xyes"])
489 AS_IF([test "x$enable_ebpf_build" = "xyes"],
491 AS_IF([test "$CLANG" != no],
493 llc_candidates=$($CLANG --version | sed -e 's/.*clang version/clang version/' | \
494 awk '/^clang version/ {
496 printf("llc-%s.%s llc-%s llc", v[[1]], v[[2]], v[[1]])
498 AC_CHECK_PROGS([LLC], [$llc_candidates], "no")
499 if test "$LLC" = "no"; then
500 AC_MSG_ERROR([unable to find any of $llc_candidates needed to build ebpf files])
504 [AC_MSG_ERROR([clang needed to build ebpf files])])
507 # enable debug output
509 AS_HELP_STRING([--enable-debug], [Enable debug output]),[enable_debug=$enableval],[enable_debug=no])
510 AS_IF([test "x$enable_debug" = "xyes"], [
511 AC_DEFINE([DEBUG],[1],[Enable debug output])
513 AM_CONDITIONAL([DEBUG], [test "x$enable_debug" = "xyes"])
515 # enable debug validation functions & macro's output
516 AC_ARG_ENABLE(debug-validation,
517 AS_HELP_STRING([--enable-debug-validation], [Enable (debug) validation code output]),[enable_debug_validation=$enableval],[enable_debug_validation=no])
518 AS_IF([test "x$enable_debug_validation" = "xyes"], [
519 if test "$enable_unittests" = "yes"; then
520 AC_MSG_ERROR([debug_validation can't be enabled with enabled unittests!])
522 AC_DEFINE([DEBUG_VALIDATION],[1],[Enable (debug) validation code output])
525 AM_CONDITIONAL([DEBUG_VALIDATION], [test "x$enable_debug_validation" = "xyes"])
528 AC_ARG_ENABLE(profiling,
529 AS_HELP_STRING([--enable-profiling], [Enable performance profiling]),[enable_profiling=$enableval],[enable_profiling=no])
530 AS_IF([test "x$enable_profiling" = "xyes"], [
533 AC_MSG_ERROR([profiling is not supported on OpenBSD])
536 AC_DEFINE([PROFILING],[1],[Enable performance profiling])
541 # profiling support, locking
542 AC_ARG_ENABLE(profiling-locks,
543 AS_HELP_STRING([--enable-profiling-locks], [Enable performance profiling for locks]),[enable_profiling_locks=$enableval],[enable_profiling_locks=no])
544 AS_IF([test "x$enable_profiling_locks" = "xyes"], [
545 AC_DEFINE([PROFILING],[1],[Enable performance profiling])
546 AC_DEFINE([PROFILE_LOCKING],[1],[Enable performance profiling for locks])
549 # enable support for IPFW
551 AS_HELP_STRING([--enable-ipfw], [Enable FreeBSD IPFW support for inline IDP]),[enable_ipfw=$enableval],[enable_ipfw=no])
552 AS_IF([test "x$enable_ipfw" = "xyes"], [
553 AC_DEFINE([IPFW],[1],[Enable FreeBSD IPFW support for inline IDP])
556 AC_ARG_ENABLE(coccinelle,
557 AS_HELP_STRING([--disable-coccinelle], [Disable coccinelle QA steps during make check]),[enable_coccinelle="$enableval"],[enable_coccinelle=yes])
558 AS_IF([test "x$enable_coccinelle" = "xyes"], [
559 AC_PATH_PROG(HAVE_COCCINELLE_CONFIG, spatch, "no")
560 if test "$HAVE_COCCINELLE_CONFIG" = "no"; then
564 AM_CONDITIONAL([HAVE_COCCINELLE], [test "x$enable_coccinelle" != "xno"])
567 AC_ARG_ENABLE(detection,
568 AS_HELP_STRING([--disable-detection], [Disable Detection Modules]), [enable_detection="$enableval"],[enable_detection=yes])
569 AS_IF([test "x$enable_detection" = "xno"], [
570 AC_DEFINE([HAVE_DETECT_DISABLED], [1], [Detection is disabled])
576 AC_ARG_WITH(zlib_includes,
577 [ --with-zlib-includes=DIR zlib include directory],
578 [with_zlib_includes="$withval"],[with_zlib_includes=no])
579 AC_ARG_WITH(zlib_libraries,
580 [ --with-zlib-libraries=DIR zlib library directory],
581 [with_zlib_libraries="$withval"],[with_zlib_libraries="no"])
583 if test "$with_zlib_includes" != "no"; then
584 CPPFLAGS="${CPPFLAGS} -I${with_zlib_includes}"
587 AC_CHECK_HEADER(zlib.h, ZLIB="yes",ZLIB="no")
588 if test "$ZLIB" = "yes"; then
589 if test "$with_zlib_libraries" != "no"; then
590 LDFLAGS="${LDFLAGS} -L${with_zlib_libraries}"
593 # To prevent duping the lib link we reset LIBS after this check. Setting action-if-found to NULL doesn't seem to work
594 # see: http://blog.flameeyes.eu/2008/04/29/i-consider-ac_check_lib-harmful
597 AC_CHECK_LIB(z,inflate,,ZLIB="no")
599 if test "$ZLIB" = "no"; then
601 echo " ERROR! zlib library not found, go get it"
602 echo " Debian/Ubuntu: apt install zlib1g-dev"
603 echo " Fedora: dnf install zlib-devel"
604 echo " CentOS/RHEL: yum install zlib-devel"
608 LIBS="${TMPLIBS} -lz"
612 AC_CHECK_LIB(pcre2-8, pcre2_compile_8,,PCRE2="no")
613 if test "$PCRE2" = "no"; then
615 echo " ERROR! pcre2 library not found, go get it"
616 echo " from www.pcre.org. Or from packages:"
617 echo " Debian/Ubuntu: apt install libpcre2-dev"
618 echo " Fedora: dnf install pcre2-devel"
619 echo " CentOS/RHEL: yum install pcre2-devel"
624 AC_DEFINE([PCRE2_CODE_UNIT_WIDTH], [8], [Pcre code unit width is 8 bits])
625 AC_MSG_CHECKING(for PCRE2 JIT support)
626 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <pcre2.h> ]],
629 pcre2_config(PCRE2_CONFIG_JIT, &jit);
630 ]])],[ pcre2_jit_available=yes ],[ pcre2_jit_available=no ]
632 if test "x$pcre2_jit_available" = "xyes"; then
634 AC_DEFINE([PCRE2_HAVE_JIT], [1], [Pcre2 with JIT compiler support enabled])
640 enable_hyperscan="no"
642 # Try pkg-config first:
643 PKG_CHECK_MODULES([libhs], libhs,, [with_pkgconfig_libhs=no])
644 if test "$with_pkgconfig_libhs" != "no"; then
645 CPPFLAGS="${CPPFLAGS} ${libhs_CFLAGS}"
646 LIBS="${LIBS} ${libhs_LIBS}"
649 AC_ARG_WITH(libhs_includes,
650 [ --with-libhs-includes=DIR libhs include directory],
651 [with_libhs_includes="$withval"],[with_libhs_includes=no])
652 AC_ARG_WITH(libhs_libraries,
653 [ --with-libhs-libraries=DIR libhs library directory],
654 [with_libhs_libraries="$withval"],[with_libhs_libraries="no"])
656 if test "$with_libhs_includes" != "no"; then
657 CPPFLAGS="${CPPFLAGS} -I${with_libhs_includes}"
659 AC_CHECK_HEADER(hs.h,HYPERSCAN="yes",HYPERSCAN="no")
660 if test "$HYPERSCAN" = "yes"; then
661 if test "$with_libhs_libraries" != "no"; then
662 LDFLAGS="${LDFLAGS} -L${with_libhs_libraries}"
665 AC_CHECK_LIB(hs,hs_compile,,HYPERSCAN="no")
666 AC_CHECK_FUNCS(hs_valid_platform)
667 enable_hyperscan="yes"
668 if test "$HYPERSCAN" = "no"; then
670 echo " Hyperscan headers are present, but link test failed."
671 echo " Check that you have a shared library and C++ linkage available."
673 enable_hyperscan="no"
676 AS_IF([test "x$enable_hyperscan" = "xyes"], [AC_DEFINE([BUILD_HYPERSCAN], [1], [Intel Hyperscan support enabled])])
679 AC_ARG_WITH(libyaml_includes,
680 [ --with-libyaml-includes=DIR libyaml include directory],
681 [with_libyaml_includes="$withval"],[with_libyaml_includes=no])
682 AC_ARG_WITH(libyaml_libraries,
683 [ --with-libyaml-libraries=DIR libyaml library directory],
684 [with_libyaml_libraries="$withval"],[with_libyaml_libraries="no"])
686 if test "$with_libyaml_includes" != "no"; then
687 CPPFLAGS="${CPPFLAGS} -I${with_libyaml_includes}"
690 AC_CHECK_HEADER(yaml.h,,LIBYAML="no")
692 if test "$with_libyaml_libraries" != "no"; then
693 LDFLAGS="${LDFLAGS} -L${with_libyaml_libraries}"
697 AC_CHECK_LIB(yaml,yaml_parser_initialize,,LIBYAML="no")
699 if test "$LIBYAML" = "no"; then
701 echo " ERROR! libyaml library not found, go get it"
702 echo " from http://pyyaml.org/wiki/LibYAML "
703 echo " or your distribution:"
705 echo " Ubuntu: apt-get install libyaml-dev"
706 echo " Fedora: dnf install libyaml-devel"
707 echo " CentOS/RHEL: yum install libyaml-devel"
713 AC_ARG_WITH(libpthread_includes,
714 [ --with-libpthread-includes=DIR libpthread include directory],
715 [with_libpthread_includes="$withval"],[with_libpthread_includes=no])
716 AC_ARG_WITH(libpthread_libraries,
717 [ --with-libpthread-libraries=DIR libpthread library directory],
718 [with_libpthread_libraries="$withval"],[with_libpthread_libraries="no"])
720 if test "$with_libpthread_includes" != "no"; then
721 CPPFLAGS="${CPPFLAGS} -I${with_libpthread_includes}"
724 dnl AC_CHECK_HEADER(pthread.h,,[AC_MSG_ERROR(pthread.h not found ...)])
726 if test "$with_libpthread_libraries" != "no"; then
727 LDFLAGS="${LDFLAGS} -L${with_libpthread_libraries}"
731 AC_CHECK_LIB(pthread, pthread_create,, PTHREAD="no")
733 if test "$PTHREAD" = "no"; then
735 echo " ERROR! libpthread library not found, glibc problem?"
740 AC_CHECK_FUNCS([pthread_spin_unlock])
743 AC_ARG_WITH(libjansson_includes,
744 [ --with-libjansson-includes=DIR libjansson include directory],
745 [with_libjansson_includes="$withval"],[with_libjansson_includes=no])
746 AC_ARG_WITH(libjansson_libraries,
747 [ --with-libjansson-libraries=DIR libjansson library directory],
748 [with_libjansson_libraries="$withval"],[with_libjansson_libraries="no"])
750 if test "$with_libjansson_includes" != "no"; then
751 CPPFLAGS="${CPPFLAGS} -I${with_libjansson_includes}"
754 if test "$with_libjansson_libraries" != "no"; then
755 LDFLAGS="${LDFLAGS} -L${with_libjansson_libraries}"
758 AC_CHECK_HEADER(jansson.h,JANSSON="yes",JANSSON="no")
759 AC_CHECK_LIB(jansson, json_dump_callback,, JANSSON="no")
761 if test "$JANSSON" = "no"; then
763 echo " ERROR: Jansson is now required."
765 echo " Go get it from your distribution or from:"
766 echo " http://www.digip.org/jansson/"
768 echo " Ubuntu/Debian: apt install libjansson-dev"
769 echo " CentOS: yum install jansson-devel"
770 echo " Fedora: dnf install jansson-devel"
776 enable_unixsocket="no"
778 AC_ARG_ENABLE(unix-socket,
779 AS_HELP_STRING([--enable-unix-socket], [Enable unix socket [default=test]]),[enable_unixsocket="$enableval"],[enable_unixsocket=test])
781 if test "$JANSSON" = "yes"; then
783 if test "$JANSSON" = "no"; then
785 echo " Jansson >= 2.2 is required for features like unix socket"
786 echo " Go get it from your distribution or from:"
787 echo " http://www.digip.org/jansson/"
788 echo " Ubuntu: apt-get install libjansson-dev"
789 echo " Fedora: dnf install jansson-devel"
790 echo " CentOS/RHEL: yum install jansson-devel"
792 if test "x$enable_unixsocket" = "xyes"; then
795 enable_unixsocket="no"
799 *-*-mingw32*|*-*-msys*|*-*-cygwin)
800 enable_unixsocket="no"
803 if test "x$enable_unixsocket" = "xtest"; then
804 enable_unixsocket="yes"
810 if test "x$enable_unixsocket" = "xyes"; then
812 echo " Jansson >= 2.2 is required for features like unix socket"
813 echo " Go get it from your distribution or from:"
814 echo " http://www.digip.org/jansson/"
815 echo " Ubuntu: apt-get install libjansson-dev"
816 echo " Fedora: dnf install jansson-devel"
817 echo " CentOS/RHEL: yum install jansson-devel"
821 enable_unixsocket="no"
824 AS_IF([test "x$enable_unixsocket" = "xyes"], [AC_DEFINE([BUILD_UNIX_SOCKET], [1], [Unix socket support enabled])])
825 e_enable_evelog=$enable_jansson
828 AS_HELP_STRING([--enable-nflog],[Enable libnetfilter_log support]),
829 [ enable_nflog="$enableval"],
830 [ enable_nflog="no"])
831 AC_ARG_ENABLE(nfqueue,
832 AS_HELP_STRING([--enable-nfqueue], [Enable NFQUEUE support for inline IDP]),[enable_nfqueue=$enableval],[enable_nfqueue=no])
833 if test "$enable_nfqueue" != "no"; then
834 PKG_CHECK_MODULES([libnetfilter_queue], [libnetfilter_queue], [enable_nfqueue=yes], [enable_nfqueue=no])
835 CPPFLAGS="${CPPFLAGS} ${libnetfilter_queue_CFLAGS}"
838 if test "x$enable_nflog" = "xyes" || test "x$enable_nfqueue" = "xyes"; then
844 AC_ARG_WITH(libnfnetlink_includes,
845 [ --with-libnfnetlink-includes=DIR libnfnetlink include directory],
846 [with_libnfnetlink_includes="$withval"],[with_libnfnetlink_includes=no])
847 AC_ARG_WITH(libnfnetlink_libraries,
848 [ --with-libnfnetlink-libraries=DIR libnfnetlink library directory],
849 [with_libnfnetlink_libraries="$withval"],[with_libnfnetlink_libraries="no"])
851 if test "$with_libnfnetlink_includes" != "no"; then
852 CPPFLAGS="${CPPFLAGS} -I${with_libnfnetlink_includes}"
855 if test "$with_libnfnetlink_libraries" != "no"; then
856 LDFLAGS="${LDFLAGS} -L${with_libnfnetlink_libraries}"
860 AC_CHECK_LIB(nfnetlink, nfnl_fd,, NFNL="no")
862 if test "$NFNL" = "no"; then
864 echo " nfnetlink library not found, go get it"
865 echo " from www.netfilter.org."
866 echo " we automatically append libnetfilter_queue/ when searching"
867 echo " for headers etc. when the --with-libnfnetlink-includes directive"
869 echo " Ubuntu: apt-get install libnetfilter-queue-dev"
870 echo " Fedora: dnf install libnetfilter_queue-devel"
871 echo " CentOS/RHEL: yum install libnetfilter_queue-devel"
878 # enable support for NFQUEUE
879 if test "x$enable_nfqueue" = "xyes"; then
880 AC_DEFINE_UNQUOTED([NFQ],[1],[Enable Linux Netfilter NFQUEUE support for inline IDP])
883 AC_ARG_WITH(libnetfilter_queue_includes,
884 [ --with-libnetfilter_queue-includes=DIR libnetfilter_queue include directory],
885 [with_libnetfilter_queue_includes="$withval"],[with_libnetfilter_queue_includes=no])
886 AC_ARG_WITH(libnetfilter_queue_libraries,
887 [ --with-libnetfilter_queue-libraries=DIR libnetfilter_queue library directory],
888 [with_libnetfilter_queue_libraries="$withval"],[with_libnetfilter_queue_libraries="no"])
890 if test "$with_libnetfilter_queue_includes" != "no"; then
891 CPPFLAGS="${CPPFLAGS} -I${with_libnetfilter_queue_includes}"
894 AC_CHECK_HEADER(libnetfilter_queue/libnetfilter_queue.h,,
895 [AC_MSG_ERROR(libnetfilter_queue/libnetfilter_queue.h not found ...)],
898 #include <sys/types.h>
902 if test "$with_libnetfilter_queue_libraries" != "no"; then
903 LDFLAGS="${LDFLAGS} -L${with_libnetfilter_queue_libraries}"
907 AC_CHECK_LIB(netfilter_queue, nfq_open,, NFQ="no",)
908 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])
909 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])
910 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])
911 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])
913 # check if the argument to nfq_get_payload is signed or unsigned
914 AC_MSG_CHECKING([for signed nfq_get_payload payload argument])
915 STORECFLAGS="${CFLAGS}"
916 if test `basename $CC` = "clang"; then
917 CFLAGS="${CFLAGS} -Werror=incompatible-pointer-types"
919 CFLAGS="${CFLAGS} -Werror"
925 #include <sys/types.h>
928 #include <libnetfilter_queue/libnetfilter_queue.h>
932 nfq_get_payload(NULL, &pktdata);
934 [libnetfilter_queue_nfq_get_payload_signed="yes"],
935 [libnetfilter_queue_nfq_get_payload_signed="no"])
936 AC_MSG_RESULT($libnetfilter_queue_nfq_get_payload_signed)
937 if test "x$libnetfilter_queue_nfq_get_payload_signed" = "xyes"; then
938 AC_DEFINE([NFQ_GET_PAYLOAD_SIGNED], [1], [For signed version of nfq_get_payload])
940 CFLAGS="${STORECFLAGS}"
942 if test "$NFQ" = "no"; then
944 echo " ERROR! libnetfilter_queue library not found, go get it"
945 echo " from www.netfilter.org."
946 echo " we automatically append libnetfilter_queue/ when searching"
947 echo " for headers etc. when the --with-libnfq-includes directive"
949 echo " Ubuntu: apt-get install libnetfilter-queue-dev"
950 echo " Fedora: dnf install libnetfilter_queue-devel"
951 echo " CentOS/RHEL: yum install libnetfilter_queue-devel"
958 AC_ARG_WITH(libnetfilter_log_includes,
959 [ --with-libnetfilter_log-includes=DIR libnetfilter_log include directory],
960 [with_libnetfilter_log_includes="$withval"],[with_libnetfilter_log_includes="no"])
961 AC_ARG_WITH(libnetfilter_log_libraries,
962 [ --with-libnetfilter_log-libraries=DIR libnetfilter_log library directory],
963 [with_libnetfilter_log_libraries="$withval"],[with_libnetfilter_log_libraries="no"])
965 if test "$enable_nflog" = "yes"; then
966 if test "$with_libnetfilter_log_includes" != "no"; then
967 CPPFLAGS="${CPPFLAGS} -I${with_libnetfilter_log_includes}"
970 AC_CHECK_HEADER(libnetfilter_log/libnetfilter_log.h,,[AC_MSG_ERROR(libnetfilter_log.h not found ...)])
972 if test "$with_libnetfilter_log_libraries" != "no"; then
973 LDFLAGS="${LDFLAGS} -L${with_libnetfilter_log_libraries}"
977 AC_CHECK_LIB(netfilter_log, nflog_open,, NFLOG="no")
979 if test "$NFLOG" = "no"; then
981 echo " ERROR! libnetfilter_log library not found, go get it"
982 echo " from http://www.netfilter.org."
986 AC_DEFINE([HAVE_NFLOG],[1],[nflog available])
992 AC_ARG_ENABLE(windivert,
993 AS_HELP_STRING([--enable-windivert],[Enable WinDivert support [default=no]]),[enable_windivert=$enableval],
994 [enable_windivert="no"])
996 # WinDivert can only be enabled on Windows builds
997 AC_CHECK_DECL([OS_WIN32],,[enable_windivert="no"])
999 if test "x$enable_windivert" = "xyes"; then
1000 # WinDivert requires Vista at a minimum. If the user has selected their own NTDDI_VERSION
1001 # then don't override it.
1002 AC_CHECK_DECL([NTDDI_VERSION],,
1003 [CFLAGS="${CFLAGS} -DNTDDI_VERSION=NTDDI_VISTA -D_WIN32_WINNT=_WIN32_WINNT_VISTA"])
1005 AC_DEFINE_UNQUOTED([WINDIVERT],[1],[Enable Windows WinDivert support for inline IDP])
1007 AC_ARG_WITH(windivert_include,
1008 [ --with-windivert-include=DIR WinDivert include path],
1009 [with_windivert_include="$withval"],[with_windivert_include="no"])
1010 AC_ARG_WITH(windivert_libraries,
1011 [ --with-windivert-libraries=DIR WinDivert library path],
1012 [with_windivert_libraries="$withval"],[with_windivert_libraries="no"])
1014 if test "$with_windivert_include" != "no"; then
1015 CPPFLAGS="${CPPFLAGS} -I${with_windivert_include}"
1018 if test "$with_windivert_libraries" != "no"; then
1019 LDFLAGS="${LDFLAGS} -L${with_windivert_libraries}"
1022 AC_CHECK_HEADER(windivert.h,,WINDIVERT_INC="no")
1023 AC_CHECK_LIB(WinDivert, WinDivertOpen,, WINDIVERT_LIB="no")
1025 if test "$WINDIVERT_LIB" = "no" || test "$WINDIVERT_INC" = "no"; then
1027 echo " ERROR! WinDivert not found, go get it from"
1028 echo " https://www.reqrypt.org/windivert.html"
1037 AC_ARG_WITH(libnet_includes,
1038 [ --with-libnet-includes=DIR libnet include directory],
1039 [with_libnet_includes="$withval"],[with_libnet_includes="no"])
1041 AC_ARG_WITH(libnet_libraries,
1042 [ --with-libnet-libraries=DIR libnet library directory],
1043 [with_libnet_libraries="$withval"],[with_libnet_libraries="no"])
1045 if test "x$with_libnet_includes" != "xno"; then
1046 CPPFLAGS="${CPPFLAGS} -I${with_libnet_includes}"
1047 libnet_dir="${with_libnet_includes}"
1049 libnet_dir="/usr/include /usr/local/include /usr/local/include/libnet11 /opt/local/include /usr/local/include/libnet-1.1"
1052 if test "x$with_libnet_libraries" != "xno"; then
1053 LDFLAGS="${LDFLAGS} -L${with_libnet_libraries}"
1056 LIBNET_DETECT_FAIL="no"
1059 for i in $libnet_dir; do
1060 if test -r "$i/libnet.h"; then
1066 AC_MSG_CHECKING(for libnet.h version 1.1.x)
1067 if test "$LIBNET_INC_DIR" != ""; then
1068 LIBNET_VER=`grep LIBNET_VERSION $LIBNET_INC_DIR/libnet.h | grep '1.[[12]]' | sed 's/[[^"]]*"\([[^"]]*\).*/\1/'`
1070 if test -z "$LIBNET_VER" ; then
1076 #CentOS, Fedora, Ubuntu-LTS, Ubuntu all set defines to the same values. libnet-config seems
1077 #to have been depreciated but all distro's seem to include it as part of the package.
1078 if test "$LIBNET_DETECT_FAIL" = "no"; then
1080 AC_CHECK_LIB(net, libnet_write,, LLIBNET="no")
1081 if test "$LLIBNET" != "no"; then
1082 AC_DEFINE([HAVE_LIBNET11],[1],(libnet 1.1 available))
1083 AC_DEFINE([_DEFAULT_SOURCE],[1],(default source))
1084 AC_DEFINE([_BSD_SOURCE],[1],(bsd source))
1085 AC_DEFINE([__BSD_SOURCE],[1],(bsd source))
1086 AC_DEFINE([__FAVOR_BSD],[1],(favor bsd))
1087 AC_DEFINE([HAVE_NET_ETHERNET_H],[1],(ethernet.h))
1091 # see if we have the patched libnet 1.1
1092 # https://www.inliniac.net/blog/2007/10/16/libnet-11-ipv6-fixes-and-additions.html
1094 # To prevent duping the lib link we reset LIBS after this check. Setting action-if-found to NULL doesn't seem to work
1095 # see: http://blog.flameeyes.eu/2008/04/29/i-consider-ac_check_lib-harmful
1096 if test "$enable_libnet" = "yes"; then
1099 AC_CHECK_LIB(net, libnet_build_icmpv6_unreach,, LLIBNET="no")
1100 if test "$LLIBNET" != "no"; then
1101 AC_DEFINE([HAVE_LIBNET_ICMPV6_UNREACH],[1],(libnet_build_icmpv6_unreach available))
1106 # See if we have libnet 1.1.6 or newer - these versions handle capabilities correctly
1107 # Some patched 1.1.4 versions are also good, but it's not guaranteed for all distros.
1109 # Details: https://bugzilla.redhat.com/show_bug.cgi?id=589770
1110 AS_VERSION_COMPARE([LIBNET_VER], [1.1.6],
1112 [AC_DEFINE([HAVE_LIBNET_CAPABILITIES],[1], (libnet_have_capabilities_patch))],
1113 [AC_DEFINE([HAVE_LIBNET_CAPABILITIES],[1], (libnet_have_capabilities_patch))])
1116 # check if the argument to libnet_init is char* or const char*
1117 AC_MSG_CHECKING([libnet_init dev type])
1118 STORECFLAGS="${CFLAGS}"
1119 if test `basename $CC` = "clang"; then
1120 CFLAGS="${CFLAGS} -Werror=incompatible-pointer-types"
1122 CFLAGS="${CFLAGS} -Werror"
1131 const char dev[32] = "";
1132 char ebuf[LIBNET_ERRBUF_SIZE];
1133 (void)libnet_init(LIBNET_LINK, dev, ebuf);
1135 [libnet_init_const="yes"],
1136 [libnet_init_const="no"])
1137 AC_MSG_RESULT($libnet_init_const)
1138 if test "x$libnet_init_const" = "xyes"; then
1139 AC_DEFINE([HAVE_LIBNET_INIT_CONST], [1], [libnet_init takes const argument])
1141 CFLAGS="${STORECFLAGS}"
1148 AC_ARG_WITH(libpcap_includes,
1149 [ --with-libpcap-includes=DIR libpcap include directory],
1150 [with_libpcap_includes="$withval"],[with_libpcap_includes=no])
1151 AC_ARG_WITH(libpcap_libraries,
1152 [ --with-libpcap-libraries=DIR libpcap library directory],
1153 [with_libpcap_libraries="$withval"],[with_libpcap_libraries="no"])
1155 if test "$with_libpcap_includes" != "no"; then
1156 CPPFLAGS="${CPPFLAGS} -I${with_libpcap_includes}"
1159 AC_CHECK_HEADERS([pcap.h],[],[AC_MSG_ERROR(pcap.h not found ...)],
1161 #ifdef HAVE_WINSOCK2_H
1162 #include <winsock2.h>
1164 #define _DEFAULT_SOURCE 1
1167 if test "$with_libpcap_libraries" != "no"; then
1168 LDFLAGS="${LDFLAGS} -L${with_libpcap_libraries}"
1170 AC_CHECK_HEADERS([pcap.h pcap/pcap.h pcap/bpf.h],[],[],
1172 #ifdef HAVE_WINSOCK2_H
1173 #include <winsock2.h>
1175 #define _DEFAULT_SOURCE 1
1179 PKG_CHECK_MODULES([PCAP],libpcap,[CPPFLAGS="${CPPFLAGS} ${PCAP_CFLAGS}" LIBS="${LIBS} ${PCAP_LIBS}"],[:])
1180 AC_CHECK_LIB(${PCAP_LIB_NAME}, pcap_open_live,, LIBPCAP="no")
1181 if test "$LIBPCAP" = "no"; then
1183 echo " ERROR! libpcap library not found, go get it"
1184 echo " from http://www.tcpdump.org or your distribution:"
1186 echo " Ubuntu: apt-get install libpcap-dev"
1187 echo " Fedora: dnf install libpcap-devel"
1188 echo " CentOS/RHEL: yum install libpcap-devel"
1193 # pcap_activate and pcap_create only exists in libpcap >= 1.0
1195 #To prevent duping the lib link we reset LIBS after this check. Setting action-if-found to NULL doesn't seem to work
1196 #see: http://blog.flameeyes.eu/2008/04/29/i-consider-ac_check_lib-harmful
1198 AC_CHECK_LIB(${PCAP_LIB_NAME}, pcap_activate,, LPCAPVTEST="no")
1199 if test "$LPCAPVTEST" = "no"; then
1201 echo " ERROR! libpcap library too old, need at least 1+, "
1202 echo " go get it from http://www.tcpdump.org or your distribution:"
1204 echo " Ubuntu: apt-get install libpcap-dev"
1205 echo " Fedora: dnf install libpcap-devel"
1206 echo " CentOS/RHEL: yum install libpcap-devel"
1210 AC_PATH_PROG(HAVE_PCAP_CONFIG, pcap-config, "no")
1211 if test "$HAVE_PCAP_CONFIG" = "no" -o "$cross_compiling" = "yes"; then
1212 AC_MSG_RESULT(no pcap-config is use)
1214 PCAP_CFLAGS="$(pcap-config --defines) $(pcap-config --cflags)"
1215 AC_SUBST(PCAP_CFLAGS)
1219 #Appears as if pcap_set_buffer_size is linux only?
1221 #To prevent duping the lib link we reset LIBS after this check. Setting action-if-found to NULL doesn't seem to work
1222 #see: http://blog.flameeyes.eu/2008/04/29/i-consider-ac_check_lib-harmful
1224 AC_CHECK_LIB(${PCAP_LIB_NAME}, pcap_set_buffer_size,, LPCAPSBUFF="no")
1225 if test "$LPCAPSBUFF" != "no"; then
1226 AC_DEFINE([HAVE_PCAP_SET_BUFF],[1],(libpcap has pcap_set_buffer_size function))
1231 # libpfring (currently only supported for libpcap enabled pfring)
1232 # Error on the side of caution. If libpfring enabled pcap is being used and we don't link against -lpfring compilation will fail.
1233 AC_ARG_ENABLE(pfring,
1234 AS_HELP_STRING([--enable-pfring], [Enable Native PF_RING support]),[enable_pfring=$enableval],[enable_pfring=no])
1235 AS_IF([test "x$enable_pfring" = "xyes"], [
1236 AC_DEFINE([HAVE_PFRING],[1],(PF_RING support enabled))
1238 #We have to set CFLAGS for AC_COMPILE_IFELSE as it doesn't pay attention to CPPFLAGS
1239 AC_ARG_WITH(libpfring_includes,
1240 [ --with-libpfring-includes=DIR libpfring include directory],
1241 [with_libpfring_includes="$withval"],[with_libpfring_includes=no])
1242 AC_ARG_WITH(libpfring_libraries,
1243 [ --with-libpfring-libraries=DIR libpfring library directory],
1244 [with_libpfring_libraries="$withval"],[with_libpfring_libraries="no"])
1246 if test "$with_libpfring_includes" != "no"; then
1247 CPPFLAGS="${CPPFLAGS} -I${with_libpfring_includes}"
1250 if test "$with_libpfring_libraries" != "no"; then
1251 LDFLAGS="${LDFLAGS} -L${with_libpfring_libraries}"
1255 AC_CHECK_LIB(pfring, pfring_open,, LIBPFRING="no", [-lpcap])
1256 if test "$LIBPFRING" != "no"; then
1257 STORECFLAGS="${CFLAGS}"
1258 CFLAGS="${CFLAGS} -Werror"
1265 pfring_recv_chunk(NULL, NULL, 0, 0);
1267 [pfring_recv_chunk="yes"],
1268 [pfring_recv_chunk="no"])
1269 CFLAGS="${STORECFLAGS}"
1270 if test "x$pfring_recv_chunk" != "xyes"; then
1271 if test "x$enable_pfring" = "xyes"; then
1273 echo " ERROR! --enable-pfring was passed but the library version is < 6, go get it"
1274 echo " from http://www.ntop.org/products/pf_ring/"
1282 #ifndef PF_RING_FLOW_OFFLOAD
1283 # error PF_RING_FLOW_OFFLOAD not defined
1287 AC_DEFINE([HAVE_PF_RING_FLOW_OFFLOAD], [1], [PF_RING bypass support enabled])
1291 echo " Warning! Pfring hw bypass not supported by this library version < 7,"
1292 echo " please upgrade to a newer version to use this feature."
1294 echo " Continuing for now with hw bypass support disabled..."
1298 if test "x$enable_pfring" = "xyes"; then
1300 echo " ERROR! --enable-pfring was passed but the library was not found, go get it"
1301 echo " from http://www.ntop.org/products/pf_ring/"
1309 AC_ARG_ENABLE(af-packet,
1310 AS_HELP_STRING([--enable-af-packet], [Enable AF_PACKET support [default=yes]]),
1311 [enable_af_packet=$enableval],[enable_af_packet=yes])
1312 AS_IF([test "x$enable_af_packet" = "xyes"], [
1313 AC_CHECK_DECL([TPACKET_V2],
1314 AC_DEFINE([HAVE_AF_PACKET],[1],[AF_PACKET support is available]),
1315 [enable_af_packet="no"],
1316 [[#include <sys/socket.h>
1317 #include <linux/if_packet.h>]])
1318 AC_CHECK_DECL([PACKET_FANOUT_QM],
1319 AC_DEFINE([HAVE_PACKET_FANOUT],[1],[Recent packet fanout support is available]),
1321 [[#include <linux/if_packet.h>]])
1322 AC_CHECK_DECL([TPACKET_V3],
1323 AC_DEFINE([HAVE_TPACKET_V3],[1],[AF_PACKET tpcket_v3 support is available]),
1325 [[#include <sys/socket.h>
1326 #include <linux/if_packet.h>]])
1327 AC_CHECK_DECL([SOF_TIMESTAMPING_RAW_HARDWARE],
1328 AC_DEFINE([HAVE_HW_TIMESTAMPING],[1],[Hardware timestamping support is available]),
1330 [[#include <linux/net_tstamp.h>]])
1334 AC_ARG_ENABLE(netmap,
1335 AS_HELP_STRING([--enable-netmap], [Enable Netmap support]),[enable_netmap=$enableval],[enable_netmap=no])
1336 AC_ARG_WITH(netmap_includes,
1337 [ --with-netmap-includes=DIR netmap include directory],
1338 [with_netmap_includes="$withval"],[with_netmap_includes=no])
1340 AS_IF([test "x$enable_netmap" = "xyes"], [
1341 AC_DEFINE([HAVE_NETMAP],[1],(NETMAP support enabled))
1343 if test "$with_netmap_includes" != "no"; then
1344 CPPFLAGS="${CPPFLAGS} -I${with_netmap_includes}"
1347 AC_CHECK_HEADER(net/netmap_user.h,,[AC_MSG_ERROR(net/netmap_user.h not found ...)],)
1349 have_recent_netmap="no"
1350 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
1351 #include <net/netmap_user.h>
1354 #error "outdated netmap, need one with NETMAP_API"
1357 #error "outdated netmap, need at least api version 11"
1359 ])], [have_recent_netmap="yes"])
1360 if test "x$have_recent_netmap" != "xyes"; then
1361 echo "ERROR: outdated netmap"
1364 have_netmap_version="unknown"
1365 have_v11_netmap="no"
1366 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
1367 #include <net/netmap_user.h>
1369 #if NETMAP_API != 11
1372 ])], [have_v11_netmap="yes"])
1373 if test "x$have_v11_netmap" = "xyes"; then
1374 have_netmap_version="v11"
1376 have_v12_netmap="no"
1377 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
1378 #include <net/netmap_user.h>
1380 #if NETMAP_API != 12
1383 ])], [have_v12_netmap="yes"])
1384 if test "x$have_v12_netmap" = "xyes"; then
1385 have_netmap_version="v12"
1387 have_v13_netmap="no"
1388 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
1389 #include <net/netmap_user.h>
1391 #if NETMAP_API != 13
1394 ])], [have_v13_netmap="yes"])
1395 if test "x$have_v13_netmap" = "xyes"; then
1396 have_netmap_version="v13"
1398 have_gtv13_netmap="no"
1399 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
1400 #include <net/netmap_user.h>
1402 #if NETMAP_API <= 13
1405 ])], [have_gtv13_netmap="yes"])
1406 if test "x$have_gtv13_netmap" = "xyes"; then
1407 have_netmap_version="> v13"
1412 AC_ARG_ENABLE([suricata-update], AS_HELP_STRING([--disable-suricata-update],
1413 [Disable suricata-update]), [enable_suricata_update=$enableval],
1414 [enable_suricata_update="yes"])
1416 # Assume suircata-update will not be installed.
1417 have_suricata_update="no"
1418 ruledirprefix="$sysconfdir"
1420 if test "$enable_suricata_update" = "yes"; then
1421 if test -f "$srcdir/suricata-update/setup.py"; then
1422 have_suricata_update="yes"
1426 if test "$have_suricata_update" = "yes"; then
1427 if test "$have_python_yaml" != "yes"; then
1429 echo " Warning: suricata-update will not be installed as the"
1430 echo " Python yaml module is not installed.."
1432 echo " Install the yaml module for Python ${pymv} to enable"
1433 echo " suricata-update."
1436 SURICATA_UPDATE_DIR="suricata-update"
1437 AC_SUBST(SURICATA_UPDATE_DIR)
1438 AC_CONFIG_FILES(suricata-update/Makefile)
1440 ruledirprefix="$localstatedir/lib"
1444 # Test to see if suricatactl (and suricatasc) can be installed.
1445 if test "x$enable_python" != "xyes"; then
1446 install_suricatactl="requires python"
1447 elif test "x$have_python_distutils" != "xyes"; then
1448 install_suricatactl="no, requires distutils"
1450 install_suricatactl="yes"
1453 # Test to see if suricata-update can be installed.
1454 if test "x$have_suricata_update" != "xyes"; then
1455 install_suricata_update="no, "
1456 install_suricata_update_reason="not bundled"
1457 elif test "x$enable_python" != "xyes"; then
1458 install_suricata_update="no, "
1459 install_suricata_update_reason="requires python"
1460 elif test "x$have_python_distutils" != "xyes"; then
1461 install_suricata_update="no, "
1462 install_suricata_update_reason="requires distutils"
1463 elif test "x$have_python_yaml" != "xyes"; then
1464 install_suricata_update="no, "
1465 install_suricata_update_reason="requires pyyaml"
1467 install_suricata_update="yes"
1470 AM_CONDITIONAL([INSTALL_SURICATA_UPDATE],
1471 [test "x$install_suricata_update" = "xyes"])
1472 AC_SUBST([install_suricata_update_reason])
1475 AC_ARG_ENABLE(non-bundled-htp,
1476 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])
1477 AS_IF([test "x$enable_non_bundled_htp" = "xyes"], [
1478 PKG_CHECK_MODULES([libhtp], htp,, [with_pkgconfig_htp=no])
1479 if test "$with_pkgconfig_htp" != "no"; then
1480 CPPFLAGS="${CPPFLAGS} ${libhtp_CFLAGS}"
1481 LIBS="${LIBS} ${libhtp_LIBS}"
1484 AC_ARG_WITH(libhtp_includes,
1485 [ --with-libhtp-includes=DIR libhtp include directory],
1486 [with_libhtp_includes="$withval"],[with_libhtp_includes=no])
1487 AC_ARG_WITH(libhtp_libraries,
1488 [ --with-libhtp-libraries=DIR libhtp library directory],
1489 [with_libhtp_libraries="$withval"],[with_libhtp_libraries="no"])
1491 if test "$with_libhtp_includes" != "no"; then
1492 CPPFLAGS="-I${with_libhtp_includes} ${CPPFLAGS}"
1495 if test "$with_libhtp_libraries" != "no"; then
1496 LDFLAGS="${LDFLAGS} -L${with_libhtp_libraries}"
1499 AC_CHECK_HEADER(htp/htp.h,,[AC_MSG_ERROR(htp/htp.h not found ...)])
1502 AC_CHECK_LIB(htp, htp_conn_create,, LIBHTP="no")
1503 if test "$LIBHTP" = "no"; then
1505 echo " ERROR! libhtp library not found"
1509 PKG_CHECK_MODULES(LIBHTPMINVERSION, [htp >= 0.5.36],[libhtp_minver_found="yes"],[libhtp_minver_found="no"])
1510 if test "$libhtp_minver_found" = "no"; then
1511 PKG_CHECK_MODULES(LIBHTPDEVVERSION, [htp = 0.5.X],[libhtp_devver_found="yes"],[libhtp_devver_found="no"])
1512 if test "$libhtp_devver_found" = "no"; then
1514 echo " ERROR! libhtp was found but it is neither >= 0.5.36, nor the dev 0.5.X"
1520 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])
1521 # check for htp_tx_get_response_headers_raw
1522 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])
1523 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])
1524 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])
1525 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]) )
1526 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])
1527 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])
1528 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])
1529 AC_CHECK_LIB([htp], [htp_config_set_compression_time_limit],AC_DEFINE_UNQUOTED([HAVE_HTP_CONFIG_SET_COMPRESSION_TIME_LIMIT],[1],[Found htp_config_set_compression_time_limit function in libhtp]) ,,[-lhtp])
1532 if test "x$enable_non_bundled_htp" = "xno"; then
1533 # test if we have a bundled htp
1534 if test -d "$srcdir/libhtp"; then
1535 AC_CONFIG_SUBDIRS([libhtp])
1538 HTP_LDADD="../libhtp/htp/libhtp.la"
1540 # make sure libhtp is added to the includes
1541 CPPFLAGS="-I\${srcdir}/../libhtp/ ${CPPFLAGS}"
1543 AC_CHECK_HEADER(iconv.h,,[AC_MSG_ERROR(iconv.h not found ...)])
1544 AC_CHECK_LIB(iconv, libiconv_close)
1545 AC_DEFINE_UNQUOTED([HAVE_HTP_URI_NORMALIZE_HOOK],[1],[Assuming htp_config_register_request_uri_normalize function in bundled libhtp])
1546 AC_DEFINE_UNQUOTED([HAVE_HTP_TX_GET_RESPONSE_HEADERS_RAW],[1],[Assuming htp_tx_get_response_headers_raw function in bundled libhtp])
1547 AC_DEFINE_UNQUOTED([HAVE_HTP_DECODE_QUERY_INPLACE],[1],[Assuming htp_decode_query_inplace function in bundled libhtp])
1548 # enable when libhtp has been updated
1549 AC_DEFINE_UNQUOTED([HAVE_HTP_CONFIG_SET_RESPONSE_DECOMPRESSION_LAYER_LIMIT],[1],[Assuming htp_config_set_response_decompression_layer_limit function in bundled libhtp])
1550 AC_DEFINE_UNQUOTED([HAVE_HTP_CONFIG_SET_LZMA_MEMLIMIT],[1],[Assuming htp_config_set_lzma_memlimit function in bundled libhtp])
1551 AC_DEFINE_UNQUOTED([HAVE_HTP_CONFIG_SET_LZMA_LAYERS],[1],[Assuming htp_config_set_lzma_layers function in bundled libhtp])
1552 AC_DEFINE_UNQUOTED([HAVE_HTP_CONFIG_SET_COMPRESSION_BOMB_LIMIT],[1],[Assuming htp_config_set_compression_bomb_limit function in bundled libhtp])
1553 AC_DEFINE_UNQUOTED([HAVE_HTP_CONFIG_SET_COMPRESSION_TIME_LIMIT],[1],[Assuming htp_config_set_compression_time_limit function in bundled libhtp])
1556 echo " ERROR: Libhtp is not bundled. Get libhtp by doing:"
1557 echo " git clone https://github.com/OISF/libhtp"
1558 echo " Then re-run Suricata's autogen.sh and configure script."
1559 echo " Or, if libhtp is installed in a different location,"
1560 echo " pass --enable-non-bundled-htp to Suricata's configure script."
1561 echo " Add --with-libhtp-includes=<dir> and --with-libhtp-libraries=<dir> if"
1562 echo " libhtp is not installed in the include and library paths."
1569 # Check for libcap-ng
1572 AC_ARG_WITH(libcap_ng_includes,
1573 [ --with-libcap_ng-includes=DIR libcap_ng include directory],
1574 [with_libcap_ng_includes="$withval"],[with_libcap_ng_includes=no])
1575 AC_ARG_WITH(libcap_ng_libraries,
1576 [ --with-libcap_ng-libraries=DIR libcap_ng library directory],
1577 [with_libcap_ng_libraries="$withval"],[with_libcap_ng_libraries="no"])
1579 if test "$with_libcap_ng_includes" != "no"; then
1580 CPPFLAGS="${CPPFLAGS} -I${with_libcap_ng_includes}"
1583 if test "$with_libcap_ng_libraries" != "no"; then
1584 LDFLAGS="${LDFLAGS} -L${with_libcap_ng_libraries}"
1587 AC_CHECK_HEADER(cap-ng.h,,LIBCAP_NG="no")
1588 if test "$LIBCAP_NG" != "no"; then
1590 AC_CHECK_LIB(cap-ng,capng_clear,,LIBCAP_NG="no")
1593 if test "$LIBCAP_NG" != "no"; then
1594 AC_DEFINE([HAVE_LIBCAP_NG],[1],[Libpcap-ng support])
1597 if test "$LIBCAP_NG" = "no"; then
1599 echo " WARNING! libcap-ng library not found, go get it"
1600 echo " from http://people.redhat.com/sgrubb/libcap-ng/"
1601 echo " or your distribution:"
1603 echo " Ubuntu: apt-get install libcap-ng-dev"
1604 echo " Fedora: dnf install libcap-ng-devel"
1605 echo " CentOS/RHEL: yum install libcap-ng-devel"
1607 echo " Suricata will be built without support for dropping privs."
1615 AS_HELP_STRING([--enable-ebpf],[Enable eBPF support]),
1616 [ enable_ebpf="$enableval"],
1617 [ enable_ebpf="no"])
1620 if test "$enable_ebpf" = "yes"; then
1621 AC_CHECK_LIB(elf,elf_begin,,LIBELF="no")
1622 if test "$LIBELF" = "no"; then
1624 echo " libelf library and development headers not found but"
1625 echo " but needed to use eBPF code"
1630 AC_CHECK_LIB(bpf,bpf_object__open,,LIBBPF="no")
1631 if test "$LIBBPF" = "no"; then
1633 echo " libbpf library and development headers not found but"
1634 echo " needed to use eBPF code. It can be found at"
1635 echo " https://github.com/libbpf/libbpf"
1639 AC_CHECK_DECL([PACKET_FANOUT_EBPF],
1640 AC_DEFINE([HAVE_PACKET_EBPF],[1],[Recent ebpf fanout support is available]),
1642 [[#include <linux/if_packet.h>]])
1643 AC_CHECK_LIB(bpf, bpf_set_link_xdp_fd,have_xdp="yes")
1644 if test "$have_xdp" = "yes"; then
1645 AC_DEFINE([HAVE_PACKET_XDP],[1],[XDP support is available])
1647 AC_CHECK_FUNCS(bpf_program__section_name)
1650 # Check for DAG support.
1652 AS_HELP_STRING([--enable-dag],[Enable DAG capture]),
1653 [ enable_dag=$enableval ],
1655 AC_ARG_WITH(dag_includes,
1656 [ --with-dag-includes=DIR dagapi include directory],
1657 [with_dag_includes="$withval"],[with_dag_includes="no"])
1658 AC_ARG_WITH(dag_libraries,
1659 [ --with-dag-libraries=DIR dagapi library directory],
1660 [with_dag_libraries="$withval"],[with_dag_libraries="no"])
1662 if test "$enable_dag" = "yes"; then
1664 if test "$with_dag_includes" != "no"; then
1665 CPPFLAGS="${CPPFLAGS} -I${with_dag_includes}"
1668 if test "$with_dag_libraries" != "no"; then
1669 LDFLAGS="${LDFLAGS} -L${with_dag_libraries}"
1672 AC_CHECK_HEADER(dagapi.h,DAG="yes",DAG="no")
1673 if test "$DAG" != "no"; then
1675 AC_CHECK_LIB(dag,dag_open,,DAG="no",)
1678 if test "$DAG" = "no"; then
1680 echo " ERROR! libdag library not found"
1685 AC_DEFINE([HAVE_DAG],[1],(Endace DAG card support enabled))
1690 AC_ARG_ENABLE(libmagic,
1691 AS_HELP_STRING([--enable-libmagic], [Enable libmagic support [default=yes]]),
1692 [enable_magic=$enableval],[enable_magic=yes])
1693 if test "$enable_magic" = "yes"; then
1694 AC_ARG_WITH(libmagic_includes,
1695 [ --with-libmagic-includes=DIR libmagic include directory],
1696 [with_libmagic_includes="$withval"],[with_libmagic_includes=no])
1697 AC_ARG_WITH(libmagic_libraries,
1698 [ --with-libmagic-libraries=DIR libmagic library directory],
1699 [with_libmagic_libraries="$withval"],[with_libmagic_libraries="no"])
1701 if test "$with_libmagic_includes" != "no"; then
1702 CPPFLAGS="${CPPFLAGS} -I${with_libmagic_includes}"
1705 AC_CHECK_HEADER(magic.h,,MAGIC="no")
1706 if test "$MAGIC" != "no"; then
1708 AC_CHECK_LIB(magic, magic_open,, MAGIC="no")
1711 if test "x$MAGIC" != "xno"; then
1712 if test "$with_libmagic_libraries" != "no"; then
1713 LDFLAGS="${LDFLAGS} -L${with_libmagic_libraries}"
1715 AC_DEFINE([HAVE_MAGIC],[1],(Libmagic for file handling))
1718 echo " WARNING! magic library not found, go get it"
1719 echo " from http://www.darwinsys.com/file/ or your distribution:"
1721 echo " Ubuntu: apt-get install libmagic-dev"
1722 echo " Fedora: dnf install file-devel"
1723 echo " CentOS/RHEL: yum install file-devel"
1729 # Napatech - Using the 3GD API
1730 AC_ARG_ENABLE(napatech,
1731 AS_HELP_STRING([--enable-napatech],[Enabled Napatech Devices]),
1732 [ enable_napatech=$enableval ],
1733 [ enable_napatech=no])
1734 AC_ARG_ENABLE(napatech_bypass,
1735 AS_HELP_STRING([--disable-napatech-bypass],[Disable Bypass feature on Napatech cards]),
1736 [ napatech_bypass=$enableval ],
1737 [ napatech_bypass=yes])
1738 AC_ARG_WITH(napatech_includes,
1739 [ --with-napatech-includes=DIR napatech include directory],
1740 [with_napatech_includes="$withval"],[with_napatech_includes="/opt/napatech3/include"])
1741 AC_ARG_WITH(napatech_libraries,
1742 [ --with-napatech-libraries=DIR napatech library directory],
1743 [with_napatech_libraries="$withval"],[with_napatech_libraries="/opt/napatech3/lib"])
1745 if test "$enable_napatech" = "yes"; then
1746 CPPFLAGS="${CPPFLAGS} -I${with_napatech_includes}"
1747 LDFLAGS="${LDFLAGS} -L${with_napatech_libraries} -lntapi"
1748 AC_CHECK_HEADER(nt.h,NAPATECH="yes",NAPATECH="no")
1749 if test "$NAPATECH" != "no"; then
1751 AC_CHECK_LIB(ntapi, NT_Init,NAPATECH="yes",NAPATECH="no")
1754 if test "$NAPATECH" = "no"; then
1756 echo " ERROR! libntapi library not found"
1760 AC_CHECK_LIB(numa, numa_available,, LIBNUMA="no")
1761 if test "$LIBNUMA" = "no"; then
1763 echo " WARNING: libnuma is required to use Napatech auto-config"
1764 echo " libnuma is not found. Go get it"
1765 echo " from http://github.com/numactl/numactl or your distribution:"
1766 echo " Ubuntu: apt-get install libnuma-dev"
1767 echo " Fedora: dnf install numactl-devel"
1768 echo " CentOS/RHEL: yum install numactl-devel"
1774 AC_DEFINE([HAVE_NAPATECH],[1],(Napatech capture card support))
1775 if test "$napatech_bypass" = "yes"; then
1776 AC_CHECK_LIB(ntapi, NT_FlowOpenAttrInit,NTFLOW="yes",NTFLOW="no")
1777 if test "$NTFLOW" = "yes"; then
1778 echo " Napatech Flow Processing is Enabled (--disable-napatech-bypass if not needed)"
1779 AC_DEFINE([NAPATECH_ENABLE_BYPASS],[1],(Napatech flowdirector support))
1781 echo "Napatech Flow Processing is not available"
1784 echo "Napatech Flow Processing is Disabled."
1790 AS_HELP_STRING([--enable-lua],[Enable Lua support]),
1791 [ enable_lua="$enableval"],
1793 AC_ARG_ENABLE(luajit,
1794 AS_HELP_STRING([--enable-luajit],[Enable Luajit support]),
1795 [ enable_luajit="$enableval"],
1796 [ enable_luajit="no"])
1797 if test "$enable_lua" = "yes"; then
1798 if test "$enable_luajit" = "yes"; then
1799 echo "ERROR: can't enable liblua and luajit at the same time."
1800 echo "For LuaJIT, just use --enable-luajit. For liblua (no jit)"
1801 echo "support, use just --enable-lua."
1802 echo "Both options will enable the Lua scripting capabilities"
1809 AC_ARG_WITH(liblua_includes,
1810 [ --with-liblua-includes=DIR liblua include directory],
1811 [with_liblua_includes="$withval"],[with_liblua_includes="no"])
1812 AC_ARG_WITH(liblua_libraries,
1813 [ --with-liblua-libraries=DIR liblua library directory],
1814 [with_liblua_libraries="$withval"],[with_liblua_libraries="no"])
1816 if test "$enable_lua" = "yes"; then
1817 if test "$with_liblua_includes" != "no"; then
1818 CPPFLAGS="${CPPFLAGS} -I${with_liblua_includes}"
1820 # lua lua51 lua5.1 lua-5.1
1821 PKG_CHECK_MODULES([LUA], [lua], [LUA="yes"], [
1822 PKG_CHECK_MODULES([LUA], [lua5.1], [LUA="yes"], [
1823 PKG_CHECK_MODULES([LUA], [lua-5.1], [LUA="yes"], [
1824 PKG_CHECK_MODULES([LUA], [lua51], [LUA="yes"], [
1830 CPPFLAGS="${CPPFLAGS} ${LUA_CFLAGS}"
1833 AC_CHECK_HEADER(lualib.h,LUA="yes",LUA="no")
1834 if test "$LUA" = "yes"; then
1835 if test "$with_liblua_libraries" != "no"; then
1836 LDFLAGS="${LDFLAGS} -L${with_liblua_libraries}"
1837 AC_CHECK_LIB(${LUA_LIB_NAME}, luaL_openlibs,, LUA="no")
1838 if test "$LUA" = "no"; then
1840 echo " ERROR! liblua library not found, go get it"
1841 echo " from http://lua.org/index.html or your distribution:"
1843 echo " Ubuntu: apt-get install liblua5.1-dev"
1844 echo " Fedora: dnf install lua-devel"
1845 echo " CentOS/RHEL: yum install lua-devel"
1847 echo " If you installed software in a non-standard prefix"
1848 echo " consider adjusting the PKG_CONFIG_PATH environment variable"
1849 echo " or use --with-liblua-libraries configure option."
1854 # lua lua51 lua5.1 lua-5.1
1855 PKG_CHECK_MODULES([LUA], [lua], [LUA="yes"], [
1856 PKG_CHECK_MODULES([LUA], [lua5.1], [LUA="yes"], [
1857 PKG_CHECK_MODULES([LUA], [lua-5.1], [LUA="yes"], [
1858 PKG_CHECK_MODULES([LUA], [lua51], [LUA="yes"], [
1864 LIBS="${LIBS} ${LUA_LIBS}"
1867 if test "$LUA" = "no"; then
1868 AC_CHECK_LIB(lua, luaL_openlibs,, LUA="no")
1871 if test "$LUA" = "yes"; then
1872 AC_DEFINE([HAVE_LUA],[1],[liblua available])
1877 echo " ERROR! liblua headers not found, go get them"
1878 echo " from http://lua.org/index.html or your distribution:"
1880 echo " Ubuntu: apt-get install liblua5.1-dev"
1881 echo " Fedora: dnf install lua-devel"
1882 echo " CentOS/RHEL: yum install lua-devel"
1884 echo " If you installed software in a non-standard prefix"
1885 echo " consider adjusting the PKG_CONFIG_PATH environment variable"
1886 echo " or use --with-liblua-includes and --with-liblua-libraries"
1887 echo " configure option."
1894 AC_ARG_WITH(libluajit_includes,
1895 [ --with-libluajit-includes=DIR libluajit include directory],
1896 [with_libluajit_includes="$withval"],[with_libluajit_includes="no"])
1897 AC_ARG_WITH(libluajit_libraries,
1898 [ --with-libluajit-libraries=DIR libluajit library directory],
1899 [with_libluajit_libraries="$withval"],[with_libluajit_libraries="no"])
1901 if test "$enable_luajit" = "yes"; then
1902 if test "$with_libluajit_includes" != "no"; then
1903 CPPFLAGS="${CPPFLAGS} -I${with_libluajit_includes}"
1905 PKG_CHECK_MODULES([LUAJIT], [luajit], , LUAJIT="no")
1906 CPPFLAGS="${CPPFLAGS} ${LUAJIT_CFLAGS}"
1909 AC_CHECK_HEADER(lualib.h,LUAJIT="yes",LUAJIT="no")
1910 if test "$LUAJIT" = "yes"; then
1911 if test "$with_libluajit_libraries" != "no"; then
1912 LDFLAGS="${LDFLAGS} -L${with_libluajit_libraries}"
1914 PKG_CHECK_MODULES([LUAJIT], [luajit])
1915 LIBS="${LIBS} ${LUAJIT_LIBS}"
1918 AC_CHECK_LIB(luajit-5.1, luaL_openlibs,, LUAJIT="no")
1920 if test "$LUAJIT" = "no"; then
1922 echo " ERROR! libluajit library not found, go get it"
1923 echo " from http://luajit.org/index.html or your distribution:"
1925 echo " Ubuntu: apt-get install libluajit-5.1-dev"
1927 echo " If you installed software in a non-standard prefix"
1928 echo " consider adjusting the PKG_CONFIG_PATH environment variable"
1929 echo " or use --with-libluajit-libraries configure option."
1934 AC_DEFINE([HAVE_LUA],[1],[lua support available])
1935 AC_DEFINE([HAVE_LUAJIT],[1],[libluajit available])
1936 enable_lua="yes, through luajit"
1940 echo " ERROR! libluajit headers not found, go get them"
1941 echo " from http://luajit.org/index.html or your distribution:"
1943 echo " Ubuntu: apt-get install libluajit-5.1-dev"
1945 echo " If you installed software in a non-standard prefix"
1946 echo " consider adjusting the PKG_CONFIG_PATH environment variable"
1947 echo " or use --with-libluajit-includes and --with-libluajit-libraries"
1948 echo " configure option."
1954 AM_CONDITIONAL([HAVE_LUA], [test "x$enable_lua" != "xno"])
1956 # If Lua is enabled, test the integer size.
1957 if test "x$enable_lua" = "xyes" -a "$cross_compiling" != "yes"; then
1961 AC_MSG_CHECKING([size of lua integer])
1962 AC_RUN_IFELSE([AC_LANG_PROGRAM([[#include <lua.h>]],
1964 if (sizeof(lua_Integer) == 8) {
1974 AC_SUBST([LUA_INT8], ["lua_int8"])
1980 AC_ARG_ENABLE(geoip,
1981 AS_HELP_STRING([--enable-geoip],[Enable GeoIP2 support]),
1982 [ enable_geoip="$enableval"],
1983 [ enable_geoip="no"])
1984 AC_ARG_WITH(libmaxminddb_includes,
1985 [ --with-libmaxminddb-includes=DIR libmaxminddb include directory],
1986 [with_libmaxminddb_includes="$withval"],[with_libmaxminddb_includes="no"])
1987 AC_ARG_WITH(libmaxminddb_libraries,
1988 [ --with-libmaxminddb-libraries=DIR libmaxminddb library directory],
1989 [with_libmaxminddb_libraries="$withval"],[with_libmaxminddb_libraries="no"])
1991 if test "$enable_geoip" = "yes"; then
1992 if test "$with_libmaxminddb_includes" != "no"; then
1993 CPPFLAGS="${CPPFLAGS} -I${with_libmaxminddb_includes}"
1996 AC_CHECK_HEADER(maxminddb.h,GEOIP="yes",GEOIP="no")
1997 if test "$GEOIP" = "yes"; then
1998 if test "$with_libmaxminddb_libraries" != "no"; then
1999 LDFLAGS="${LDFLAGS} -L${with_libmaxminddb_libraries}"
2001 AC_CHECK_LIB(maxminddb, MMDB_open,, GEOIP="no")
2003 if test "$GEOIP" = "no"; then
2005 echo " ERROR! libmaxminddb GeoIP2 library not found, go get it"
2006 echo " from https://github.com/maxmind/libmaxminddb or your distribution:"
2008 echo " Ubuntu: apt-get install libmaxminddb-dev"
2009 echo " Fedora: dnf install libmaxminddb-devel"
2010 echo " CentOS/RHEL: yum install libmaxminddb-devel"
2015 AC_DEFINE([HAVE_GEOIP],[1],[libmaxminddb available])
2019 # Position Independent Executable
2021 AS_HELP_STRING([--enable-pie],[Enable compiling as a position independent executable]),
2022 [ enable_pie="$enableval"],
2024 if test "$enable_pie" = "yes"; then
2025 CPPFLAGS="${CPPFLAGS} -fPIC"
2026 LDFLAGS="${LDFLAGS} -pie"
2029 #libevent includes and libraries
2030 AC_ARG_WITH(libevent_includes,
2031 [ --with-libevent-includes=DIR libevent include directory],
2032 [with_libevent_includes="$withval"],[with_libevent_includes="no"])
2033 AC_ARG_WITH(libevent_libraries,
2034 [ --with-libevent-libraries=DIR libevent library directory],
2035 [with_libevent_libraries="$withval"],[with_libevent_libraries="no"])
2038 AC_ARG_ENABLE(hiredis,
2039 AS_HELP_STRING([--enable-hiredis],[Enable Redis support]),
2040 [ enable_hiredis="$enableval"],
2041 [ enable_hiredis="no"])
2042 AC_ARG_WITH(libhiredis_includes,
2043 [ --with-libhiredis-includes=DIR libhiredis include directory],
2044 [with_libhiredis_includes="$withval"],[with_libhiredis_includes="no"])
2045 AC_ARG_WITH(libhiredis_libraries,
2046 [ --with-libhiredis-libraries=DIR libhiredis library directory],
2047 [with_libhiredis_libraries="$withval"],[with_libhiredis_libraries="no"])
2049 enable_hiredis_async="no"
2050 if test "$enable_hiredis" = "yes"; then
2051 if test "$with_libhiredis_includes" != "no"; then
2052 CPPFLAGS="${CPPFLAGS} -I${with_libhiredis_includes}"
2055 AC_CHECK_HEADER("hiredis/hiredis.h",HIREDIS="yes",HIREDIS="no")
2056 if test "$HIREDIS" = "yes"; then
2057 if test "$with_libhiredis_libraries" != "no"; then
2058 LDFLAGS="${LDFLAGS} -L${with_libhiredis_libraries}"
2060 AC_CHECK_LIB(hiredis, redisConnect,, HIREDIS="no")
2062 if test "$HIREDIS" = "no"; then
2064 echo " ERROR! libhiredis library not found, go get it"
2065 echo " from https://github.com/redis/hiredis or your distribution:"
2067 echo " Ubuntu: apt-get install libhiredis-dev"
2068 echo " Fedora: dnf install hiredis-devel"
2069 echo " CentOS/RHEL: yum install hiredis-devel"
2073 if test "$HIREDIS" = "yes"; then
2074 AC_DEFINE([HAVE_LIBHIREDIS],[1],[libhiredis available])
2075 enable_hiredis="yes"
2077 # Check if async adapters and libevent is installed
2079 AC_CHECK_HEADER("hiredis/adapters/libevent.h",HIREDIS_LIBEVENT_ADAPTER="yes",HIREDIS_LIBEVENT_ADAPTER="no")
2080 if test "$HIREDIS_LIBEVENT_ADAPTER" = "yes"; then
2081 #Look for libevent headers
2082 if test "$with_libevent_includes" != "no"; then
2083 CPPFLAGS="${CPPFLAGS} -I${with_libevent_includes}"
2085 AC_CHECK_HEADER("event.h",LIBEVENT="yes",LIBEVENT="no")
2086 if test "$LIBEVENT" = "yes"; then
2087 if test "$with_libevent_libraries" != "no"; then
2088 LDFLAGS="${LDFLAGS} -L${with_libevent_libraries}"
2090 AC_CHECK_LIB(event, event_base_free,, HAVE_LIBEVENT="no")
2091 AC_CHECK_LIB(event_pthreads, evthread_use_pthreads,, HAVE_LIBEVENT_PTHREADS="no")
2093 if [ test "$HAVE_LIBEVENT" = "no" ] && [ -o test "$HAVE_LIBEVENT_PTHREADS" = "no"]; then
2094 if test "$HAVE_LIBEVENT" = "no"; then
2096 echo " Async mode for redis output will not be available."
2097 echo " To enable it install libevent"
2099 echo " Ubuntu: apt-get install libevent-dev"
2100 echo " Fedora: dnf install libevent-devel"
2101 echo " CentOS/RHEL: yum install libevent-devel"
2104 if test "$HAVE_LIBEVENT_PTHREADS" = "no"; then
2106 echo " Async mode for redis output will not be available."
2107 echo " To enable it install libevent with pthreads support"
2109 echo " Ubuntu: apt-get install libevent-pthreads-2.0-5"
2113 AC_DEFINE([HAVE_LIBEVENT],[1],[libevent available])
2114 enable_hiredis_async="yes"
2122 AC_CHECK_LIB(lz4, LZ4F_createCompressionContext, , enable_liblz4="no")
2124 if test "$enable_liblz4" = "no"; then
2126 echo " Compressed pcap logging is not available without liblz4."
2127 echo " If you want to enable compression, you need to install it."
2129 echo " Ubuntu: apt-get install liblz4-dev"
2130 echo " Fedora: dnf install lz4-devel"
2131 echo " CentOS/RHEL: yum install epel-release"
2132 echo " yum install lz4-devel"
2136 # get cache line size
2137 AC_PATH_PROG(HAVE_GETCONF_CMD, getconf, "no")
2138 if test "$HAVE_GETCONF_CMD" != "no"; then
2139 CLS=$(getconf LEVEL1_DCACHE_LINESIZE)
2140 if [test "$CLS" != "" && test "$CLS" != "0"]; then
2141 AC_DEFINE_UNQUOTED([CLS],[${CLS}],[L1 cache line size])
2143 AC_DEFINE([CLS],[64],[L1 cache line size])
2146 AC_DEFINE([CLS],[64],[L1 cache line size])
2149 # mscgen for devguide images
2150 AC_PATH_PROG([HAVE_MSCGEN], mscgen, "no")
2151 if test "$HAVE_MSCGEN" = "no"; then
2153 echo "WARNING! mscgen package not installed."
2154 echo " Devguide images won't be generated!"
2155 echo " Get mscgen package:"
2156 echo " https://www.mcternan.me.uk/mscgen/"
2157 echo " or install it from your distribution"
2159 AM_CONDITIONAL([HAVE_MSCGEN], [test "x$enable_mscgen" != "xno" ])
2161 # sphinx for documentation
2162 AC_PATH_PROG(HAVE_SPHINXBUILD, sphinx-build, "no")
2163 if test "$HAVE_SPHINXBUILD" = "no"; then
2164 enable_sphinxbuild=no
2165 if test -e "$srcdir/doc/userguide/suricata.1"; then
2166 have_suricata_man=yes
2169 AM_CONDITIONAL([HAVE_SPHINXBUILD], [test "x$enable_sphinxbuild" != "xno"])
2170 AM_CONDITIONAL([HAVE_SURICATA_MAN], [test "x$have_suricata_man" = "xyes"])
2172 # pdflatex for the pdf version of the user manual
2173 AC_PATH_PROG(HAVE_PDFLATEX, pdflatex, "no")
2174 if test "$HAVE_PDFLATEX" = "no"; then
2177 AM_CONDITIONAL([HAVE_PDFLATEX], [test "x$enable_pdflatex" != "xno"])
2180 AM_CONDITIONAL([RUST_CROSS_COMPILE], [test "x$cross_compiling" = "xyes"])
2181 AC_PATH_PROG(RUSTC, rustc, "no")
2182 if test "$RUSTC" = "no"; then
2184 echo " ERROR: Suricata now requires Rust to build."
2186 echo " Ubuntu/Debian: apt install rustc cargo"
2187 echo " Fedora: dnf install rustc cargo"
2188 echo " CentOS: yum install rustc cargo (requires EPEL)"
2190 echo " Rustup works as well: https://rustup.rs/"
2195 AC_PATH_PROG(CARGO, cargo, "no")
2196 if test "CARGO" = "no"; then
2197 AC_MSG_ERROR([cargo required])
2200 AC_DEFINE([HAVE_RUST],[1],[Enable Rust language])
2201 AM_CONDITIONAL([HAVE_RUST],true)
2202 AC_SUBST([CARGO], [$CARGO])
2205 rust_compiler_version=$($RUSTC --version)
2206 rustc_version=$(echo "$rust_compiler_version" | sed 's/^.*[[^0-9]]\([[0-9]]*\.[[0-9]]*\.[[0-9]]*\).*$/\1/')
2207 cargo_version_output=$($CARGO --version)
2208 cargo_version=$(echo "$cargo_version_output" | sed 's/^.*[[^0-9]]\([[0-9]]*\.[[0-9]]*\.[[0-9]]*\).*$/\1/')
2210 MIN_RUSTC_VERSION="1.34.2"
2211 AC_MSG_CHECKING(for Rust version $MIN_RUSTC_VERSION or newer)
2212 AS_VERSION_COMPARE([$rustc_version], [$MIN_RUSTC_VERSION],
2215 echo "ERROR: Rust $MIN_RUSTC_VERSION or newer required."
2217 echo "Rust version ${rustc_version} was found."
2226 AS_VERSION_COMPARE([$rustc_version], [1.38.0],
2228 [RUST_FEATURES="$RUST_FEATURES function-macro"],
2229 [RUST_FEATURES="$RUST_FEATURES function-macro"])
2231 rust_vendor_comment="# "
2232 have_rust_vendor="no"
2234 if test "x$cross_compiling" = "xyes"; then
2235 RUST_SURICATA_LIB_XC_DIR="${host_alias}/"
2237 if test "x$CARGO_BUILD_TARGET" = "x"; then
2238 RUST_SURICATA_LIB_XC_DIR=
2240 RUST_SURICATA_LIB_XC_DIR="${CARGO_BUILD_TARGET}/"
2244 if test "x$enable_debug" = "xyes"; then
2245 RUST_SURICATA_LIBDIR="../rust/target/${RUST_SURICATA_LIB_XC_DIR}debug"
2247 RUST_SURICATA_LIBDIR="../rust/target/${RUST_SURICATA_LIB_XC_DIR}release"
2249 RUST_SURICATA_LIB="${RUST_SURICATA_LIBDIR}/${RUST_SURICATA_LIBNAME}"
2251 CFLAGS="${CFLAGS} -I\${srcdir}/../rust/gen -I\${srcdir}/../rust/dist"
2252 AC_SUBST(RUST_SURICATA_LIB)
2253 AC_SUBST(RUST_LDADD)
2254 if test "x$CARGO_HOME" = "x"; then
2255 if test "x$HAVE_CYGPATH" != "xno"; then
2256 CYGPATH_CARGO_HOME=$(cygpath -a -t mixed ~/.cargo)
2257 AC_SUBST([CARGO_HOME], [$CYGPATH_CARGO_HOME])
2259 AC_SUBST([CARGO_HOME], [~/.cargo])
2262 AC_SUBST([CARGO_HOME], [$CARGO_HOME])
2265 # Check for rustup. RUSTUP_HOME needs to be set if rustup is in
2266 # use, and a user uses sudo (depending on configuration), or su to
2267 # perform the install
2268 rustup_home_path="no"
2269 if test "x$RUSTUP_HOME" != "x"; then
2270 rustup_home_path="$RUSTUP_HOME"
2272 AC_PATH_PROG(have_rustup, rustup, "no")
2273 if test "x$have_rustup" != "xno"; then
2274 rustup_home_path=$($have_rustup show home 2>/dev/null || echo "no")
2278 if test "x$rustup_home_path" != "xno"; then
2279 rustup_home="RUSTUP_HOME=\$(RUSTUP_HOME_PATH)"
2281 AC_SUBST([RUSTUP_HOME_PATH], [$rustup_home_path])
2282 AC_SUBST([rustup_home])
2284 if test -e "$srcdir/rust/vendor"; then
2285 have_rust_vendor="yes"
2288 if test "x$have_rust_vendor" = "xyes"; then
2289 rust_vendor_comment=""
2292 AC_SUBST(rust_vendor_comment)
2293 AM_CONDITIONAL([HAVE_RUST_VENDOR], [test "x$have_rust_vendor" = "xyes"])
2295 # With Rust/Cargo 1.37 and greater, cargo-vendor is built-in.
2296 AC_MSG_CHECKING(for cargo vendor support)
2297 AS_VERSION_COMPARE([$cargo_version], [1.37.0],
2298 [have_cargo_vendor="no"],
2299 [have_cargo_vendor="yes"],
2300 [have_cargo_vendor="yes"])
2301 AC_MSG_RESULT($have_cargo_vendor)
2303 # If Rust is older than 1.37, check for cargo-vendor as an
2304 # external sub-command.
2305 if test "x$have_cargo_vendor" != "xyes"; then
2306 AC_CHECK_PROG(have_cargo_vendor_bin, cargo-vendor, yes, no)
2307 have_cargo_vendor=$have_cargo_vendor_bin
2310 have_rust_headers="no"
2311 AC_MSG_CHECKING(for $srcdir/rust/dist/rust-bindings.h)
2312 if test -f "$srcdir/rust/dist/rust-bindings.h"; then
2314 have_rust_headers="yes"
2317 AC_MSG_CHECKING(for $srcdir/rust/gen/rust-bindings.h)
2318 if test -f "$srcdir/rust/gen/rust-bindings.h"; then
2320 have_rust_headers="yes"
2326 AC_PATH_PROG(CBINDGEN, cbindgen, "no")
2327 if test "x$CBINDGEN" != "xno"; then
2328 cbindgen_version=$(cbindgen --version | cut -d' ' -f2-)
2329 min_cbindgen_version="0.10.0"
2330 AS_VERSION_COMPARE([$cbindgen_version], [$min_cbindgen_version],
2332 [cbindgen_ok="yes"],
2333 [cbindgen_ok="yes"])
2334 if test "x$cbindgen_ok" != "xyes"; then
2335 echo " Warning: cbindgen must be at least version $min_cbindgen_version,"
2336 echo " found $cbindgen_version."
2337 echo " To update: cargo install --force cbindgen"
2340 have_rust_headers="no"
2344 AC_SUBST([CBINDGEN], [$CBINDGEN])
2346 # Require cbindgen if generated headers are not bundled.
2347 if test "x$have_rust_headers" != "xyes"; then
2348 if test "x$CBINDGEN" = "xno"; then
2349 echo " Warning: cbindgen too old or not found, it is required to "
2350 echo " generate header files."
2351 echo " To install: cargo install --force cbindgen"
2352 AC_MSG_ERROR([cbindgen required])
2356 AM_CONDITIONAL([HAVE_RUST_HEADERS], [test "x$have_rust_headers" = "xyes"])
2357 AM_CONDITIONAL([HAVE_CBINDGEN], [test "x$CBINDGEN" != "xno"])
2358 AM_CONDITIONAL([HAVE_CARGO_VENDOR], [test "x$have_cargo_vendor" != "xno"])
2360 AC_ARG_ENABLE(rust_strict,
2361 AS_HELP_STRING([--enable-rust-strict], [Rust warnings as errors]),[enable_rust_strict=$enableval],[enable_rust_strict=no])
2362 AS_IF([test "x$enable_rust_strict" = "xyes"], [
2363 RUST_FEATURES="strict"
2365 AC_SUBST(RUST_FEATURES)
2367 AC_CHECK_LIB(fuzzpcap, FPC_IsFuzzPacketCapture, HAS_FUZZPCAP="yes")
2368 AM_CONDITIONAL([HAS_FUZZPCAP], [test "x$HAS_FUZZPCAP" = "xyes"])
2369 AC_ARG_ENABLE(fuzztargets,
2370 AS_HELP_STRING([--enable-fuzztargets], [Enable fuzz targets]),[enable_fuzztargets=$enableval],[enable_fuzztargets=no])
2371 AM_CONDITIONAL([BUILD_FUZZTARGETS], [test "x$enable_fuzztargets" = "xyes"])
2372 AM_CONDITIONAL([RUST_BUILD_STD], [test "x$enable_fuzztargets" = "xyes" && echo "$rust_compiler_version" | grep -q nightly && echo "$RUSTFLAGS" | grep -v -q coverage])
2374 AS_IF([test "x$enable_fuzztargets" = "xyes"], [
2375 AS_IF([test "x$CARGO_BUILD_TARGET" = "x" && echo "$rust_compiler_version" | grep -q nightly], [
2376 CARGO_BUILD_TARGET=x86_64-unknown-linux-gnu
2377 AC_SUBST(CARGO_BUILD_TARGET)
2379 AC_DEFINE([FUZZ], [1], [Fuzz targets are enabled])
2380 AC_DEFINE([AFLFUZZ_NO_RANDOM], [1], [Disable all use of random functions])
2383 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[while (__AFL_LOOP(1000))]])],
2384 [AC_DEFINE([AFLFUZZ_PERSISTANT_MODE], [1], [Enable AFL PERSISTANT_MODE])],
2388 tmp_saved_flags=$[]_AC_LANG_PREFIX[]FLAGS
2389 AS_IF([test "x$LIB_FUZZING_ENGINE" = "x"], [
2390 LIB_FUZZING_ENGINE=-fsanitize=fuzzer
2391 AC_SUBST(LIB_FUZZING_ENGINE)
2393 _AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $LIB_FUZZING_ENGINE"
2394 AC_MSG_CHECKING([whether $CXX accepts $LIB_FUZZING_ENGINE])
2395 AC_LINK_IFELSE([AC_LANG_SOURCE([[
2396 #include <sys/types.h>
2397 extern "C" int LLVMFuzzerTestOneInput(const unsigned char *Data, size_t Size);
2398 extern "C" int LLVMFuzzerTestOneInput(const unsigned char *Data, size_t Size) {
2404 [ AC_MSG_RESULT(yes)
2405 has_sanitizefuzzer=yes],
2406 [ AC_MSG_RESULT(no) ]
2408 _AC_LANG_PREFIX[]FLAGS=$tmp_saved_flags
2412 AM_CONDITIONAL([HAS_FUZZLDFLAGS], [test "x$has_sanitizefuzzer" = "xyes"])
2415 if test -f ./revision; then
2416 REVISION=`cat ./revision`
2417 AC_DEFINE_UNQUOTED([REVISION],[${REVISION}],[Git revision])
2419 AC_PATH_PROG(HAVE_GIT_CMD, git, "no")
2420 if test "$HAVE_GIT_CMD" != "no"; then
2421 if [ test -d .git ]; then
2422 REVISION=`git rev-parse --short HEAD`
2423 DATE=`git log -1 --date=short --pretty=format:%cd`
2424 REVISION="$REVISION $DATE"
2425 AC_DEFINE_UNQUOTED([REVISION],[${REVISION}],[Git revision])
2430 if test "${enable_ebpf}" = "yes" || test "${enable_unittests}" = "yes"; then
2431 AC_DEFINE([CAPTURE_OFFLOAD_MANAGER], [1],[Building flow bypass manager code])
2433 if test "${enable_ebpf}" = "yes" || test "${enable_nfqueue}" = "yes" || test "${enable_pfring}" = "yes" || test "${enable_napatech}" = "yes" || test "${enable_unittests}" = "yes"; then
2434 AC_DEFINE([CAPTURE_OFFLOAD], [1],[Building flow capture bypass code])
2441 define([EXPAND_VARIABLE],
2443 if test $prefix = 'NONE'; then
2448 *\[$]* ) eval "$2=[$]$2" ;;
2453 ])dnl EXPAND_VARIABLE
2456 if test "$WINDOWS_PATH" = "yes"; then
2459 e_winbase="C:\\\\Program Files\\\\Suricata"
2462 systemtype="`systeminfo | grep \"based PC\"`"
2463 case "$systemtype" in
2465 e_winbase="C:\\\\Program Files (x86)\\\\Suricata"
2468 e_winbase="C:\\\\Program Files\\\\Suricata"
2473 e_sysconfdir="${e_winbase}\\\\"
2474 e_defaultruledir="$e_winbase\\\\rules\\\\"
2475 e_magic_file="$e_winbase\\\\magic.mgc"
2476 e_logdir="$e_winbase\\\\log"
2477 e_logfilesdir="$e_logdir\\\\files"
2478 e_logcertsdir="$e_logdir\\\\certs"
2479 e_datarulesdir="$e_winbase\\\\rules\\\\"
2480 if test "x$HAVE_CYGPATH" != "xno"; then
2481 # turn srcdir into abs path and convert to the
2482 # mixed output (/c/Users/dev into c:/Users/dev)
2483 e_rustdir="$(cygpath -a -t mixed ${srcdir})/rust"
2485 e_abs_srcdir=$(cd $srcdir && pwd)
2486 e_rustdir="$e_abs_srcdir/rust"
2489 EXPAND_VARIABLE(localstatedir, e_logdir, "/log/suricata/")
2490 EXPAND_VARIABLE(localstatedir, e_rundir, "/run/")
2491 EXPAND_VARIABLE(localstatedir, e_logfilesdir, "/log/suricata/files")
2492 EXPAND_VARIABLE(localstatedir, e_logcertsdir, "/log/suricata/certs")
2493 EXPAND_VARIABLE(sysconfdir, e_sysconfdir, "/suricata/")
2494 EXPAND_VARIABLE(localstatedir, e_localstatedir, "/run/suricata")
2495 EXPAND_VARIABLE(datadir, e_datarulesdir, "/suricata/rules")
2496 EXPAND_VARIABLE(localstatedir, e_datadir, "/lib/suricata/data")
2497 EXPAND_VARIABLE(ruledirprefix, e_defaultruledir, "/suricata/rules")
2499 e_abs_srcdir=$(cd $srcdir && pwd)
2500 EXPAND_VARIABLE(e_abs_srcdir, e_rustdir, "/rust")
2504 AC_SUBST(e_logfilesdir)
2505 AC_SUBST(e_logcertsdir)
2506 AC_SUBST(e_sysconfdir)
2507 AC_DEFINE_UNQUOTED([CONFIG_DIR],["$e_sysconfdir"],[Our CONFIG_DIR])
2508 AC_SUBST(e_localstatedir)
2509 AC_DEFINE_UNQUOTED([DATA_DIR],["$e_datadir"],[Our DATA_DIR])
2510 AC_SUBST(e_magic_file)
2511 AC_SUBST(e_magic_file_comment)
2512 AC_SUBST(e_enable_evelog)
2513 AC_SUBST(e_datarulesdir)
2514 AC_SUBST(e_defaultruledir)
2517 EXPAND_VARIABLE(prefix, CONFIGURE_PREFIX)
2518 EXPAND_VARIABLE(sysconfdir, CONFIGURE_SYSCONDIR)
2519 EXPAND_VARIABLE(localstatedir, CONFIGURE_LOCALSTATEDIR)
2520 EXPAND_VARIABLE(datadir, CONFIGURE_DATAROOTDIR)
2521 AC_SUBST(CONFIGURE_PREFIX)
2522 AC_SUBST(CONFIGURE_SYSCONDIR)
2523 AC_SUBST(CONFIGURE_LOCALSTATEDIR)
2524 AC_SUBST(CONFIGURE_DATAROOTDIR)
2525 AC_SUBST(PACKAGE_VERSION)
2526 AC_SUBST(RUST_FEATURES)
2527 AC_SUBST(RUST_SURICATA_LIBDIR)
2528 AC_SUBST(RUST_SURICATA_LIBNAME)
2529 AC_SUBST(enable_non_bundled_htp)
2531 AM_CONDITIONAL([BUILD_SHARED_LIBRARY], [test "x$enable_shared" = "xyes"] && [test "x$can_build_shared_library" = "xyes"])
2533 AC_CONFIG_FILES(Makefile src/Makefile rust/Makefile rust/Cargo.toml rust/derive/Cargo.toml rust/.cargo/config)
2534 AC_CONFIG_FILES(qa/Makefile qa/coccinelle/Makefile)
2535 AC_CONFIG_FILES(rules/Makefile doc/Makefile doc/userguide/Makefile doc/devguide/Makefile)
2536 AC_CONFIG_FILES(contrib/Makefile contrib/file_processor/Makefile contrib/file_processor/Action/Makefile contrib/file_processor/Processor/Makefile)
2537 AC_CONFIG_FILES(suricata.yaml etc/Makefile etc/suricata.logrotate etc/suricata.service)
2538 AC_CONFIG_FILES(python/Makefile python/suricata/config/defaults.py)
2539 AC_CONFIG_FILES(ebpf/Makefile)
2540 AC_CONFIG_FILES(libsuricata-config)
2543 SURICATA_BUILD_CONF="Suricata Configuration:
2544 AF_PACKET support: ${enable_af_packet}
2545 eBPF support: ${enable_ebpf}
2546 XDP support: ${have_xdp}
2547 PF_RING support: ${enable_pfring}
2548 NFQueue support: ${enable_nfqueue}
2549 NFLOG support: ${enable_nflog}
2550 IPFW support: ${enable_ipfw}
2551 Netmap support: ${enable_netmap} ${have_netmap_version}
2552 DAG enabled: ${enable_dag}
2553 Napatech enabled: ${enable_napatech}
2554 WinDivert enabled: ${enable_windivert}
2556 Unix socket enabled: ${enable_unixsocket}
2557 Detection enabled: ${enable_detection}
2559 Libmagic support: ${enable_magic}
2560 libjansson support: ${enable_jansson}
2561 hiredis support: ${enable_hiredis}
2562 hiredis async with libevent: ${enable_hiredis_async}
2563 PCRE jit: ${pcre2_jit_available}
2564 LUA support: ${enable_lua}
2565 libluajit: ${enable_luajit}
2566 GeoIP2 support: ${enable_geoip}
2567 Non-bundled htp: ${enable_non_bundled_htp}
2568 Hyperscan support: ${enable_hyperscan}
2569 Libnet support: ${enable_libnet}
2570 liblz4 support: ${enable_liblz4}
2572 Rust support: ${enable_rust}
2573 Rust strict mode: ${enable_rust_strict}
2574 Rust compiler path: ${RUSTC}
2575 Rust compiler version: ${rust_compiler_version}
2576 Cargo path: ${CARGO}
2577 Cargo version: ${cargo_version_output}
2578 Cargo vendor: ${have_cargo_vendor}
2580 Python support: ${enable_python}
2581 Python path: ${python_path}
2582 Python distutils ${have_python_distutils}
2583 Python yaml ${have_python_yaml}
2584 Install suricatactl: ${install_suricatactl}
2585 Install suricatasc: ${install_suricatactl}
2586 Install suricata-update: ${install_suricata_update}${install_suricata_update_reason}
2588 Profiling enabled: ${enable_profiling}
2589 Profiling locks enabled: ${enable_profiling_locks}
2591 Plugin support (experimental): ${plugin_support}
2593 Development settings:
2594 Coccinelle / spatch: ${enable_coccinelle}
2595 Unit tests enabled: ${enable_unittests}
2596 Debug output enabled: ${enable_debug}
2597 Debug validation enabled: ${enable_debug_validation}
2599 Generic build parameters:
2600 Installation prefix: ${prefix}
2601 Configuration directory: ${e_sysconfdir}
2602 Log directory: ${e_logdir}
2604 --prefix ${CONFIGURE_PREFIX}
2605 --sysconfdir ${CONFIGURE_SYSCONDIR}
2606 --localstatedir ${CONFIGURE_LOCALSTATEDIR}
2607 --datarootdir ${CONFIGURE_DATAROOTDIR}
2610 Compiler: ${CC} (exec name) / ${compiler} (real)
2611 GCC Protect enabled: ${enable_gccprotect}
2612 GCC march native enabled: ${enable_gccmarch_native}
2613 GCC Profile enabled: ${enable_gccprofile}
2614 Position Independent Executable enabled: ${enable_pie}
2616 PCAP_CFLAGS ${PCAP_CFLAGS}
2617 SECCFLAGS ${SECCFLAGS}"
2620 echo "$SURICATA_BUILD_CONF"
2621 echo "printf(" >src/build-info.h
2622 echo "$SURICATA_BUILD_CONF" | sed -e 's/^/"/' | sed -e 's/$/\\n"/' >>src/build-info.h
2623 echo ");" >>src/build-info.h
2626 To build and install run 'make' and 'make install'.
2628 You can run 'make install-conf' if you want to install initial configuration
2629 files to ${e_sysconfdir}. Running 'make install-full' will install configuration
2630 and rules and provide you a ready-to-run suricata."
2632 echo "To install Suricata into /usr/bin/suricata, have the config in
2633 /etc/suricata and use /var/log/suricata as log dir, use:
2634 ./configure --prefix=/usr/ --sysconfdir=/etc/ --localstatedir=/var/"