]> git.ipfire.org Git - people/ms/suricata.git/blob - configure.ac
doc/devguide: add Transactions documentation page
[people/ms/suricata.git] / configure.ac
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])
7
8 AC_LANG([C])
9 LT_INIT
10 PKG_PROG_PKG_CONFIG
11
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])
16 AC_LANG_PUSH([C])
17 compiler=unknown
18 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#if ! __clang__
19 #error
20 #endif
21 ]])],
22 compiler=clang,
23 [AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#if ! __GNUC__
24 #error
25 #endif
26 ]])],
27 compiler=gcc, [])])
28 AC_LANG_POP([C])
29 AC_MSG_RESULT([${compiler}])
30
31 AC_ARG_WITH([clang],
32 [ --with-clang=PROGRAM path to Clang for compiling eBPF code. Use if the main C compiler is not Clang.],
33 [CLANG="$withval"],
34 [AS_IF([test "$compiler" = clang],
35 [CLANG="$CC"],
36 [AC_PATH_PROG([CLANG],[clang])])])
37
38 AC_SUBST([CLANG])
39
40 case "$compiler" in
41 clang)
42 CLANG_CFLAGS="-Wextra -Werror-implicit-function-declaration -Wno-error=unused-command-line-argument"
43 AC_SUBST(CLANG_CFLAGS)
44 ;;
45 gcc)
46 dnl get gcc version
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)
53
54 if test "$gccvernum" -ge "400"; then
55 dnl gcc 4.0 or later
56 GCC_CFLAGS="-Wextra -Werror-implicit-function-declaration"
57 else
58 GCC_CFLAGS="-W"
59 fi
60 AC_SUBST(GCC_CFLAGS)
61 ;;
62 *)
63 AC_MSG_WARN([unsupported/untested compiler, this may or may not work])
64 ;;
65 esac
66
67 # Checks for programs.
68 AC_PROG_AWK
69 AC_PROG_CC
70 AC_PROG_CPP
71 AC_PROG_RANLIB
72 AC_PROG_INSTALL
73 AC_PROG_LN_S
74 AC_PROG_MAKE_SET
75 AC_PROG_GREP
76
77 AC_PATH_PROG(HAVE_CYGPATH, cygpath, "no")
78 AM_CONDITIONAL([HAVE_CYGPATH], [test "x$HAVE_CYGPATH" != "xno"])
79
80 AC_PATH_PROG(HAVE_PKG_CONFIG, pkg-config, "no")
81 if test "$HAVE_PKG_CONFIG" = "no"; then
82 echo
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 "
86 echo
87 exit 1
88 fi
89
90 python_path="not set"
91
92 AC_ARG_ENABLE(python,
93 AS_HELP_STRING([--enable-python], [Enable python]),
94 [enable_python=$enableval],[enable_python=yes])
95 if test "x$enable_python" != "xyes"; then
96 enable_python="no"
97 else
98 AC_PATH_PROGS(HAVE_PYTHON, python3 python2.7 python2 python, "no")
99 if test "$HAVE_PYTHON" = "no"; then
100 echo
101 echo " Warning! Python not found."
102 echo
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."
106 echo
107 enable_python="no"
108 else
109 python_path="$HAVE_PYTHON"
110 fi
111 fi
112 AM_CONDITIONAL([HAVE_PYTHON], [test "x$enable_python" = "xyes"])
113
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]]);')"
118 fi
119
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
125 AC_MSG_RESULT([yes])
126 have_python_distutils="yes"
127 else
128 AC_MSG_RESULT([no])
129 fi
130 fi
131 AM_CONDITIONAL([HAVE_PYTHON_DISTUTILS],
132 [test "x$have_python_distutils" = "xyes"])
133 if test "$have_python_distutils" = "no"; then
134 echo ""
135 echo " Warning: Python distutils not found. Python tools will"
136 echo " not be installed."
137 echo ""
138 echo " Install the distutils module for Python ${pymv} to enable"
139 echo " the Python tools."
140 echo ""
141 fi
142
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"
149 AC_MSG_RESULT([yes])
150 else
151 AC_MSG_RESULT([no])
152 fi
153 fi
154 AM_CONDITIONAL([HAVE_PYTHON_YAML], [test "x$have_python_yaml" = "xyes"])
155
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
160 echo
161 echo " Warning curl or wget not found, you won't be able to"
162 echo " download latest ruleset with 'make install-rules'"
163 fi
164 fi
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"])
167
168 # Checks for libraries.
169
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])
188
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>
193 #endif
194 ]])
195
196 AC_CHECK_HEADERS([windows.h winsock2.h ws2tcpip.h w32api/wtypes.h], [], [],
197 [[
198 #ifndef _X86_
199 #define _X86_
200 #endif
201 ]])
202 AC_CHECK_HEADERS([w32api/winbase.h wincrypt.h], [], [],
203 [[
204 #ifndef _X86_
205 #define _X86_
206 #endif
207 #include <windows.h>
208 ]])
209
210 # Checks for typedefs, structures, and compiler characteristics.
211 AC_C_INLINE
212 AC_C_RESTRICT
213 AC_TYPE_PID_T
214 AC_TYPE_MODE_T
215 AC_TYPE_SIZE_T
216 AC_TYPE_SSIZE_T
217 AC_TYPE_INT8_T
218 AC_TYPE_INT16_T
219 AC_TYPE_INT32_T
220 AC_TYPE_INT64_T
221 AC_TYPE_UINT8_T
222 AC_TYPE_UINT16_T
223 AC_TYPE_UINT32_T
224 AC_TYPE_UINT64_T
225 AC_TYPE_UINT
226 AC_TYPE_USHORT
227 AC_TYPE_ULONG
228 AC_TYPE_UCHAR
229 AC_STRUCT_TIMEZONE
230 AC_CHECK_TYPES([ptrdiff_t])
231 AC_HEADER_STDBOOL
232
233 # Checks for library functions.
234 AC_FUNC_MALLOC
235 AC_FUNC_REALLOC
236 AC_FUNC_FORK
237 AC_FUNC_MKTIME
238 AC_FUNC_MMAP
239 AC_FUNC_STRTOD
240
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])
247
248 AC_CHECK_FUNCS([fwrite_unlocked])
249
250 AC_CHECK_DECL([getrandom],
251 AC_DEFINE([HAVE_GETRANDOM], [1], [Use getrandom]),
252 [], [
253 #include <sys/random.h>
254 ])
255
256 OCFLAGS=$CFLAGS
257 CFLAGS=""
258 AC_CHECK_FUNCS([strlcpy strlcat])
259 CFLAGS=$OCFLAGS
260
261 # Add large file support
262 AC_SYS_LARGEFILE
263
264 #check for os
265 AC_MSG_CHECKING([host os])
266
267 # Default lua libname if not detected otherwise.
268 LUA_LIB_NAME="lua5.1"
269
270 # If no host os was detected, try with uname
271 if test -z "$host" ; then
272 host="`uname`"
273 fi
274 echo -n "installation for $host OS... "
275
276 RUST_SURICATA_LIBNAME="libsuricata_rust.a"
277
278 e_magic_file=""
279 e_magic_file_comment="#"
280 PCAP_LIB_NAME="pcap"
281 case "$host" in
282 *-*-*freebsd*)
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"
288 ;;
289 *-*-openbsd*)
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"
294 ;;
295 *darwin*|*Darwin*)
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"
300 ;;
301 *-*-linux*)
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"
306 ;;
307 *-*-mingw32*|*-*-msys)
308 CFLAGS="${CFLAGS} -DOS_WIN32"
309 WINDOWS_PATH="yes"
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"
313 ;;
314 *-*-cygwin)
315 LUA_LIB_NAME="lua"
316 WINDOWS_PATH="yes"
317 PCAP_LIB_NAME="wpcap"
318 ;;
319 *-*-solaris*)
320 AC_MSG_WARN([support for Solaris/Illumos/SunOS is experimental])
321 LDFLAGS="${LDFLAGS} -lsocket -lnsl"
322 ;;
323 *)
324 AC_MSG_WARN([unsupported OS this may or may not work])
325 ;;
326 esac
327 AC_MSG_RESULT(ok)
328
329 # check if our target supports c11
330 AC_MSG_CHECKING(for c11 support)
331 OCFLAGS=$CFLAGS
332 CFLAGS="-std=c11"
333 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h>]],
334 [[ static _Thread_local int i; i = 1; i++; ]])],
335 AC_MSG_RESULT([yes])
336 [AC_DEFINE([TLS_C11], [1], [C11 Thread local storage])
337 CFLAGS="$OCFLAGS -std=c11"],
338 [AC_MSG_RESULT([no])
339 CFLAGS="$OCFLAGS"
340 have_c11=no
341 have_c11_tls=no])
342 if [ test "x$have_c11" = "xno" ]; then
343 CFLAGS="$CFLAGS -std=gnu99"
344 fi
345
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])],
352 [AC_MSG_RESULT([no])
353 have_gnu_tls=no])
354 if [ test "x$have_c11_tls" = "xno" ] && [ test "x$have_gnu_tls" = "xno" ]; then
355 AC_MSG_ERROR("no thread local support available.")
356 exit 1
357 fi
358
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])
365
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"
372 AC_MSG_RESULT(yes)],
373 [AC_MSG_RESULT(no)])
374 CFLAGS="${TMPCFLAGS}"
375
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"
381 AC_MSG_RESULT(yes)],
382 [AC_MSG_RESULT(no)])
383 CFLAGS="${TMPCFLAGS}"
384
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"
390 AC_MSG_RESULT(yes)],
391 [AC_MSG_RESULT(no)])
392 CFLAGS="${TMPCFLAGS}"
393
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"
399 AC_MSG_RESULT(yes)],
400 [AC_MSG_RESULT(no)])
401 LDFLAGS="${TMPLDFLAGS}"
402
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"
408 AC_MSG_RESULT(yes)],
409 [AC_MSG_RESULT(no)])
410 LDFLAGS="${TMPLDFLAGS}"
411
412 AC_SUBST(SECCFLAGS)
413 AC_SUBST(SECLDFLAGS)
414 ])
415
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>]], [[]])],
422 [
423 AC_MSG_RESULT(yes)
424 has_rdynamic=yes
425 ],
426 [
427 AC_MSG_RESULT(no)
428 has_rdynamic=no
429 ])
430
431 if test "x$has_rdynamic" = "xyes"; then
432 plugin_support=yes
433 AC_DEFINE([HAVE_PLUGINS], [1], [Plugin support])
434 else
435 plugin_support=no
436 LDFLAGS="${TMPLDFLAGS}"
437 fi
438
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"
444 ])
445
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"], [
450 case "$host" in
451 *powerpc*)
452 ;;
453 *)
454 OFLAGS="$CFLAGS"
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>]])],
458 [
459 AC_MSG_RESULT([yes])
460 OPTIMIZATION_CFLAGS="-march=native"
461 AC_SUBST(OPTIMIZATION_CFLAGS)
462 ],
463 [
464 AC_MSG_RESULT([no])
465 CFLAGS="$OFLAGS"
466 enable_gccmarch_native=no
467 ]
468 )
469 ;;
470 esac
471 ])
472
473 # options
474
475
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])
481 ])
482 AM_CONDITIONAL([BUILD_UNITTESTS], [test "x$enable_unittests" = "xyes"])
483
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"])
488
489 AS_IF([test "x$enable_ebpf_build" = "xyes"],
490 [
491 AS_IF([test "$CLANG" != no],
492 [
493 llc_candidates=$($CLANG --version | sed -e 's/.*clang version/clang version/' | \
494 awk '/^clang version/ {
495 split($3, v, ".");
496 printf("llc-%s.%s llc-%s llc", v[[1]], v[[2]], v[[1]])
497 }')
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])
501 fi
502 AC_SUBST(LLC)
503 ],
504 [AC_MSG_ERROR([clang needed to build ebpf files])])
505 ])
506
507 # enable debug output
508 AC_ARG_ENABLE(debug,
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])
512 ])
513 AM_CONDITIONAL([DEBUG], [test "x$enable_debug" = "xyes"])
514
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!])
521 else
522 AC_DEFINE([DEBUG_VALIDATION],[1],[Enable (debug) validation code output])
523 fi
524 ])
525 AM_CONDITIONAL([DEBUG_VALIDATION], [test "x$enable_debug_validation" = "xyes"])
526
527 # profiling support
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"], [
531 case "$host" in
532 *-*-openbsd*)
533 AC_MSG_ERROR([profiling is not supported on OpenBSD])
534 ;;
535 *)
536 AC_DEFINE([PROFILING],[1],[Enable performance profiling])
537 ;;
538 esac
539 ])
540
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])
547 ])
548
549 # enable support for IPFW
550 AC_ARG_ENABLE(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])
554 ])
555
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
561 enable_coccinelle=no
562 fi
563 ])
564 AM_CONDITIONAL([HAVE_COCCINELLE], [test "x$enable_coccinelle" != "xno"])
565
566 # disable detection
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])
571 ])
572
573 # libraries
574
575 # zlib
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"])
582
583 if test "$with_zlib_includes" != "no"; then
584 CPPFLAGS="${CPPFLAGS} -I${with_zlib_includes}"
585 fi
586
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}"
591 fi
592
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
595 ZLIB=""
596 TMPLIBS="${LIBS}"
597 AC_CHECK_LIB(z,inflate,,ZLIB="no")
598
599 if test "$ZLIB" = "no"; then
600 echo
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"
605 echo
606 exit 1
607 fi
608 LIBS="${TMPLIBS} -lz"
609 fi
610
611 PCRE2=""
612 AC_CHECK_LIB(pcre2-8, pcre2_compile_8,,PCRE2="no")
613 if test "$PCRE2" = "no"; then
614 echo
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"
620 echo
621 exit 1
622 fi
623
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> ]],
627 [[
628 int jit = 0;
629 pcre2_config(PCRE2_CONFIG_JIT, &jit);
630 ]])],[ pcre2_jit_available=yes ],[ pcre2_jit_available=no ]
631 )
632 if test "x$pcre2_jit_available" = "xyes"; then
633 AC_MSG_RESULT(yes)
634 AC_DEFINE([PCRE2_HAVE_JIT], [1], [Pcre2 with JIT compiler support enabled])
635 else
636 AC_MSG_RESULT(no)
637 fi
638
639 # libhs
640 enable_hyperscan="no"
641
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}"
647 fi
648
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"])
655
656 if test "$with_libhs_includes" != "no"; then
657 CPPFLAGS="${CPPFLAGS} -I${with_libhs_includes}"
658 fi
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}"
663 fi
664
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
669 echo
670 echo " Hyperscan headers are present, but link test failed."
671 echo " Check that you have a shared library and C++ linkage available."
672 echo
673 enable_hyperscan="no"
674 fi
675 fi
676 AS_IF([test "x$enable_hyperscan" = "xyes"], [AC_DEFINE([BUILD_HYPERSCAN], [1], [Intel Hyperscan support enabled])])
677
678 # libyaml
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"])
685
686 if test "$with_libyaml_includes" != "no"; then
687 CPPFLAGS="${CPPFLAGS} -I${with_libyaml_includes}"
688 fi
689
690 AC_CHECK_HEADER(yaml.h,,LIBYAML="no")
691
692 if test "$with_libyaml_libraries" != "no"; then
693 LDFLAGS="${LDFLAGS} -L${with_libyaml_libraries}"
694 fi
695
696 LIBYAML=""
697 AC_CHECK_LIB(yaml,yaml_parser_initialize,,LIBYAML="no")
698
699 if test "$LIBYAML" = "no"; then
700 echo
701 echo " ERROR! libyaml library not found, go get it"
702 echo " from http://pyyaml.org/wiki/LibYAML "
703 echo " or your distribution:"
704 echo
705 echo " Ubuntu: apt-get install libyaml-dev"
706 echo " Fedora: dnf install libyaml-devel"
707 echo " CentOS/RHEL: yum install libyaml-devel"
708 echo
709 exit 1
710 fi
711
712 # libpthread
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"])
719
720 if test "$with_libpthread_includes" != "no"; then
721 CPPFLAGS="${CPPFLAGS} -I${with_libpthread_includes}"
722 fi
723
724 dnl AC_CHECK_HEADER(pthread.h,,[AC_MSG_ERROR(pthread.h not found ...)])
725
726 if test "$with_libpthread_libraries" != "no"; then
727 LDFLAGS="${LDFLAGS} -L${with_libpthread_libraries}"
728 fi
729
730 PTHREAD=""
731 AC_CHECK_LIB(pthread, pthread_create,, PTHREAD="no")
732
733 if test "$PTHREAD" = "no"; then
734 echo
735 echo " ERROR! libpthread library not found, glibc problem?"
736 echo
737 exit 1
738 fi
739
740 AC_CHECK_FUNCS([pthread_spin_unlock])
741
742 # libjansson
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"])
749
750 if test "$with_libjansson_includes" != "no"; then
751 CPPFLAGS="${CPPFLAGS} -I${with_libjansson_includes}"
752 fi
753
754 if test "$with_libjansson_libraries" != "no"; then
755 LDFLAGS="${LDFLAGS} -L${with_libjansson_libraries}"
756 fi
757
758 AC_CHECK_HEADER(jansson.h,JANSSON="yes",JANSSON="no")
759 AC_CHECK_LIB(jansson, json_dump_callback,, JANSSON="no")
760
761 if test "$JANSSON" = "no"; then
762 echo ""
763 echo " ERROR: Jansson is now required."
764 echo ""
765 echo " Go get it from your distribution or from:"
766 echo " http://www.digip.org/jansson/"
767 echo ""
768 echo " Ubuntu/Debian: apt install libjansson-dev"
769 echo " CentOS: yum install jansson-devel"
770 echo " Fedora: dnf install jansson-devel"
771 echo ""
772 exit 1
773 fi
774
775 enable_jansson="yes"
776 enable_unixsocket="no"
777
778 AC_ARG_ENABLE(unix-socket,
779 AS_HELP_STRING([--enable-unix-socket], [Enable unix socket [default=test]]),[enable_unixsocket="$enableval"],[enable_unixsocket=test])
780
781 if test "$JANSSON" = "yes"; then
782 enable_jansson="yes"
783 if test "$JANSSON" = "no"; then
784 echo
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"
791 echo
792 if test "x$enable_unixsocket" = "xyes"; then
793 exit 1
794 fi
795 enable_unixsocket="no"
796 enable_jansson="no"
797 else
798 case $host in
799 *-*-mingw32*|*-*-msys*|*-*-cygwin)
800 enable_unixsocket="no"
801 ;;
802 *)
803 if test "x$enable_unixsocket" = "xtest"; then
804 enable_unixsocket="yes"
805 fi
806 ;;
807 esac
808 fi
809 else
810 if test "x$enable_unixsocket" = "xyes"; then
811 echo
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"
818 echo
819 exit 1
820 fi
821 enable_unixsocket="no"
822 fi
823
824 AS_IF([test "x$enable_unixsocket" = "xyes"], [AC_DEFINE([BUILD_UNIX_SOCKET], [1], [Unix socket support enabled])])
825 e_enable_evelog=$enable_jansson
826
827 AC_ARG_ENABLE(nflog,
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}"
836 fi
837
838 if test "x$enable_nflog" = "xyes" || test "x$enable_nfqueue" = "xyes"; then
839 # libnfnetlink
840 case $host in
841 *-*-mingw32*)
842 ;;
843 *)
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"])
850
851 if test "$with_libnfnetlink_includes" != "no"; then
852 CPPFLAGS="${CPPFLAGS} -I${with_libnfnetlink_includes}"
853 fi
854
855 if test "$with_libnfnetlink_libraries" != "no"; then
856 LDFLAGS="${LDFLAGS} -L${with_libnfnetlink_libraries}"
857 fi
858
859 NFNL=""
860 AC_CHECK_LIB(nfnetlink, nfnl_fd,, NFNL="no")
861
862 if test "$NFNL" = "no"; then
863 echo
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"
868 echo " is used"
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"
872 echo
873 fi
874 ;;
875 esac
876 fi
877
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])
881
882 #libnetfilter_queue
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"])
889
890 if test "$with_libnetfilter_queue_includes" != "no"; then
891 CPPFLAGS="${CPPFLAGS} -I${with_libnetfilter_queue_includes}"
892 fi
893
894 AC_CHECK_HEADER(libnetfilter_queue/libnetfilter_queue.h,,
895 [AC_MSG_ERROR(libnetfilter_queue/libnetfilter_queue.h not found ...)],
896 [
897 #define _GNU_SOURCE
898 #include <sys/types.h>
899 #include <stdint.h>
900 ])
901
902 if test "$with_libnetfilter_queue_libraries" != "no"; then
903 LDFLAGS="${LDFLAGS} -L${with_libnetfilter_queue_libraries}"
904 fi
905
906 NFQ=""
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])
912
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"
918 else
919 CFLAGS="${CFLAGS} -Werror"
920 fi
921 AC_COMPILE_IFELSE(
922 [AC_LANG_PROGRAM(
923 [
924 #define _GNU_SOURCE
925 #include <sys/types.h>
926 #include <stdint.h>
927 #include <stdio.h>
928 #include <libnetfilter_queue/libnetfilter_queue.h>
929 ],
930 [
931 char *pktdata;
932 nfq_get_payload(NULL, &pktdata);
933 ])],
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])
939 fi
940 CFLAGS="${STORECFLAGS}"
941
942 if test "$NFQ" = "no"; then
943 echo
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"
948 echo " is used"
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"
952 echo
953 exit 1
954 fi
955 fi
956
957 # libnetfilter_log
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"])
964
965 if test "$enable_nflog" = "yes"; then
966 if test "$with_libnetfilter_log_includes" != "no"; then
967 CPPFLAGS="${CPPFLAGS} -I${with_libnetfilter_log_includes}"
968 fi
969
970 AC_CHECK_HEADER(libnetfilter_log/libnetfilter_log.h,,[AC_MSG_ERROR(libnetfilter_log.h not found ...)])
971
972 if test "$with_libnetfilter_log_libraries" != "no"; then
973 LDFLAGS="${LDFLAGS} -L${with_libnetfilter_log_libraries}"
974 fi
975
976 NFLOG=""
977 AC_CHECK_LIB(netfilter_log, nflog_open,, NFLOG="no")
978
979 if test "$NFLOG" = "no"; then
980 echo
981 echo " ERROR! libnetfilter_log library not found, go get it"
982 echo " from http://www.netfilter.org."
983 echo
984 exit 1
985 else
986 AC_DEFINE([HAVE_NFLOG],[1],[nflog available])
987 enable_nflog="yes"
988 fi
989 fi
990
991 # WinDivert support
992 AC_ARG_ENABLE(windivert,
993 AS_HELP_STRING([--enable-windivert],[Enable WinDivert support [default=no]]),[enable_windivert=$enableval],
994 [enable_windivert="no"])
995
996 # WinDivert can only be enabled on Windows builds
997 AC_CHECK_DECL([OS_WIN32],,[enable_windivert="no"])
998
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"])
1004
1005 AC_DEFINE_UNQUOTED([WINDIVERT],[1],[Enable Windows WinDivert support for inline IDP])
1006
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"])
1013
1014 if test "$with_windivert_include" != "no"; then
1015 CPPFLAGS="${CPPFLAGS} -I${with_windivert_include}"
1016 fi
1017
1018 if test "$with_windivert_libraries" != "no"; then
1019 LDFLAGS="${LDFLAGS} -L${with_windivert_libraries}"
1020 fi
1021
1022 AC_CHECK_HEADER(windivert.h,,WINDIVERT_INC="no")
1023 AC_CHECK_LIB(WinDivert, WinDivertOpen,, WINDIVERT_LIB="no")
1024
1025 if test "$WINDIVERT_LIB" = "no" || test "$WINDIVERT_INC" = "no"; then
1026 echo
1027 echo " ERROR! WinDivert not found, go get it from"
1028 echo " https://www.reqrypt.org/windivert.html"
1029 echo
1030 exit 1
1031 fi
1032 fi
1033 # /WinDivert
1034
1035
1036 # libnet
1037 AC_ARG_WITH(libnet_includes,
1038 [ --with-libnet-includes=DIR libnet include directory],
1039 [with_libnet_includes="$withval"],[with_libnet_includes="no"])
1040
1041 AC_ARG_WITH(libnet_libraries,
1042 [ --with-libnet-libraries=DIR libnet library directory],
1043 [with_libnet_libraries="$withval"],[with_libnet_libraries="no"])
1044
1045 if test "x$with_libnet_includes" != "xno"; then
1046 CPPFLAGS="${CPPFLAGS} -I${with_libnet_includes}"
1047 libnet_dir="${with_libnet_includes}"
1048 else
1049 libnet_dir="/usr/include /usr/local/include /usr/local/include/libnet11 /opt/local/include /usr/local/include/libnet-1.1"
1050 fi
1051
1052 if test "x$with_libnet_libraries" != "xno"; then
1053 LDFLAGS="${LDFLAGS} -L${with_libnet_libraries}"
1054 fi
1055
1056 LIBNET_DETECT_FAIL="no"
1057 LIBNET_INC_DIR=""
1058
1059 for i in $libnet_dir; do
1060 if test -r "$i/libnet.h"; then
1061 LIBNET_INC_DIR="$i"
1062 fi
1063 done
1064
1065 enable_libnet="no"
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/'`
1069
1070 if test -z "$LIBNET_VER" ; then
1071 AC_MSG_RESULT(no)
1072 else
1073 AC_MSG_RESULT(yes)
1074 fi
1075
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
1079 LLIBNET=""
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))
1088 enable_libnet="yes"
1089 fi
1090
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
1093 #
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
1097 LLIBNET=""
1098 TMPLIBS="${LIBS}"
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))
1102 fi
1103 LIBS="${TMPLIBS}"
1104 fi
1105
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.
1108 #
1109 # Details: https://bugzilla.redhat.com/show_bug.cgi?id=589770
1110 AS_VERSION_COMPARE([LIBNET_VER], [1.1.6],
1111 [],
1112 [AC_DEFINE([HAVE_LIBNET_CAPABILITIES],[1], (libnet_have_capabilities_patch))],
1113 [AC_DEFINE([HAVE_LIBNET_CAPABILITIES],[1], (libnet_have_capabilities_patch))])
1114
1115
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"
1121 else
1122 CFLAGS="${CFLAGS} -Werror"
1123 fi
1124 AC_COMPILE_IFELSE(
1125 [AC_LANG_PROGRAM(
1126 [
1127 #include <stdio.h>
1128 #include <libnet.h>
1129 ],
1130 [[
1131 const char dev[32] = "";
1132 char ebuf[LIBNET_ERRBUF_SIZE];
1133 (void)libnet_init(LIBNET_LINK, dev, ebuf);
1134 ]])],
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])
1140 fi
1141 CFLAGS="${STORECFLAGS}"
1142 fi
1143 else
1144 AC_MSG_RESULT(no)
1145 fi
1146
1147 # libpcap
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"])
1154
1155 if test "$with_libpcap_includes" != "no"; then
1156 CPPFLAGS="${CPPFLAGS} -I${with_libpcap_includes}"
1157 fi
1158
1159 AC_CHECK_HEADERS([pcap.h],[],[AC_MSG_ERROR(pcap.h not found ...)],
1160 [[
1161 #ifdef HAVE_WINSOCK2_H
1162 #include <winsock2.h>
1163 #endif
1164 #define _DEFAULT_SOURCE 1
1165 ]])
1166
1167 if test "$with_libpcap_libraries" != "no"; then
1168 LDFLAGS="${LDFLAGS} -L${with_libpcap_libraries}"
1169 fi
1170 AC_CHECK_HEADERS([pcap.h pcap/pcap.h pcap/bpf.h],[],[],
1171 [[
1172 #ifdef HAVE_WINSOCK2_H
1173 #include <winsock2.h>
1174 #endif
1175 #define _DEFAULT_SOURCE 1
1176 ]])
1177
1178 LIBPCAP=""
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
1182 echo
1183 echo " ERROR! libpcap library not found, go get it"
1184 echo " from http://www.tcpdump.org or your distribution:"
1185 echo
1186 echo " Ubuntu: apt-get install libpcap-dev"
1187 echo " Fedora: dnf install libpcap-devel"
1188 echo " CentOS/RHEL: yum install libpcap-devel"
1189 echo
1190 exit 1
1191 fi
1192
1193 # pcap_activate and pcap_create only exists in libpcap >= 1.0
1194 LIBPCAPVTEST=""
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
1197 TMPLIBS="${LIBS}"
1198 AC_CHECK_LIB(${PCAP_LIB_NAME}, pcap_activate,, LPCAPVTEST="no")
1199 if test "$LPCAPVTEST" = "no"; then
1200 echo
1201 echo " ERROR! libpcap library too old, need at least 1+, "
1202 echo " go get it from http://www.tcpdump.org or your distribution:"
1203 echo
1204 echo " Ubuntu: apt-get install libpcap-dev"
1205 echo " Fedora: dnf install libpcap-devel"
1206 echo " CentOS/RHEL: yum install libpcap-devel"
1207 echo
1208 exit 1
1209 fi
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)
1213 else
1214 PCAP_CFLAGS="$(pcap-config --defines) $(pcap-config --cflags)"
1215 AC_SUBST(PCAP_CFLAGS)
1216 fi
1217 LIBS="${TMPLIBS}"
1218
1219 #Appears as if pcap_set_buffer_size is linux only?
1220 LIBPCAPSBUFF=""
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
1223 TMPLIBS="${LIBS}"
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))
1227 fi
1228 LIBS="${TMPLIBS}"
1229
1230 # libpfring
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))
1237
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"])
1245
1246 if test "$with_libpfring_includes" != "no"; then
1247 CPPFLAGS="${CPPFLAGS} -I${with_libpfring_includes}"
1248 fi
1249
1250 if test "$with_libpfring_libraries" != "no"; then
1251 LDFLAGS="${LDFLAGS} -L${with_libpfring_libraries}"
1252 fi
1253
1254 LIBPFRING=""
1255 AC_CHECK_LIB(pfring, pfring_open,, LIBPFRING="no", [-lpcap])
1256 if test "$LIBPFRING" != "no"; then
1257 STORECFLAGS="${CFLAGS}"
1258 CFLAGS="${CFLAGS} -Werror"
1259 AC_COMPILE_IFELSE(
1260 [AC_LANG_PROGRAM(
1261 [
1262 #include <pfring.h>
1263 ],
1264 [
1265 pfring_recv_chunk(NULL, NULL, 0, 0);
1266 ])],
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
1272 echo
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/"
1275 echo
1276 exit 1
1277 fi
1278 fi
1279 AC_COMPILE_IFELSE(
1280 [AC_LANG_SOURCE([[
1281 #include <pfring.h>
1282 #ifndef PF_RING_FLOW_OFFLOAD
1283 # error PF_RING_FLOW_OFFLOAD not defined
1284 #endif
1285 ]])],
1286 [
1287 AC_DEFINE([HAVE_PF_RING_FLOW_OFFLOAD], [1], [PF_RING bypass support enabled])
1288 ],
1289 [
1290 echo
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."
1293 echo
1294 echo " Continuing for now with hw bypass support disabled..."
1295 echo
1296 ])
1297 else
1298 if test "x$enable_pfring" = "xyes"; then
1299 echo
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/"
1302 echo
1303 exit 1
1304 fi
1305 fi
1306 ])
1307
1308 # AF_PACKET support
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]),
1320 [],
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]),
1324 [],
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]),
1329 [],
1330 [[#include <linux/net_tstamp.h>]])
1331 ])
1332
1333 # Netmap support
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])
1339
1340 AS_IF([test "x$enable_netmap" = "xyes"], [
1341 AC_DEFINE([HAVE_NETMAP],[1],(NETMAP support enabled))
1342
1343 if test "$with_netmap_includes" != "no"; then
1344 CPPFLAGS="${CPPFLAGS} -I${with_netmap_includes}"
1345 fi
1346
1347 AC_CHECK_HEADER(net/netmap_user.h,,[AC_MSG_ERROR(net/netmap_user.h not found ...)],)
1348
1349 have_recent_netmap="no"
1350 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
1351 #include <net/netmap_user.h>
1352 ],[
1353 #ifndef NETMAP_API
1354 #error "outdated netmap, need one with NETMAP_API"
1355 #endif
1356 #if NETMAP_API < 11
1357 #error "outdated netmap, need at least api version 11"
1358 #endif
1359 ])], [have_recent_netmap="yes"])
1360 if test "x$have_recent_netmap" != "xyes"; then
1361 echo "ERROR: outdated netmap"
1362 exit 1
1363 fi
1364 have_netmap_version="unknown"
1365 have_v11_netmap="no"
1366 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
1367 #include <net/netmap_user.h>
1368 ],[
1369 #if NETMAP_API != 11
1370 #error "not 11"
1371 #endif
1372 ])], [have_v11_netmap="yes"])
1373 if test "x$have_v11_netmap" = "xyes"; then
1374 have_netmap_version="v11"
1375 fi
1376 have_v12_netmap="no"
1377 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
1378 #include <net/netmap_user.h>
1379 ],[
1380 #if NETMAP_API != 12
1381 #error "not 12"
1382 #endif
1383 ])], [have_v12_netmap="yes"])
1384 if test "x$have_v12_netmap" = "xyes"; then
1385 have_netmap_version="v12"
1386 fi
1387 have_v13_netmap="no"
1388 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
1389 #include <net/netmap_user.h>
1390 ],[
1391 #if NETMAP_API != 13
1392 #error "not 13"
1393 #endif
1394 ])], [have_v13_netmap="yes"])
1395 if test "x$have_v13_netmap" = "xyes"; then
1396 have_netmap_version="v13"
1397 fi
1398 have_gtv13_netmap="no"
1399 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
1400 #include <net/netmap_user.h>
1401 ],[
1402 #if NETMAP_API <= 13
1403 #error "not gt 13"
1404 #endif
1405 ])], [have_gtv13_netmap="yes"])
1406 if test "x$have_gtv13_netmap" = "xyes"; then
1407 have_netmap_version="> v13"
1408 fi
1409 ])
1410
1411 # Suricata-Update.
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"])
1415
1416 # Assume suircata-update will not be installed.
1417 have_suricata_update="no"
1418 ruledirprefix="$sysconfdir"
1419
1420 if test "$enable_suricata_update" = "yes"; then
1421 if test -f "$srcdir/suricata-update/setup.py"; then
1422 have_suricata_update="yes"
1423 fi
1424 fi
1425
1426 if test "$have_suricata_update" = "yes"; then
1427 if test "$have_python_yaml" != "yes"; then
1428 echo ""
1429 echo " Warning: suricata-update will not be installed as the"
1430 echo " Python yaml module is not installed.."
1431 echo ""
1432 echo " Install the yaml module for Python ${pymv} to enable"
1433 echo " suricata-update."
1434 echo
1435 else
1436 SURICATA_UPDATE_DIR="suricata-update"
1437 AC_SUBST(SURICATA_UPDATE_DIR)
1438 AC_CONFIG_FILES(suricata-update/Makefile)
1439 AC_OUTPUT
1440 ruledirprefix="$localstatedir/lib"
1441 fi
1442 fi
1443
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"
1449 else
1450 install_suricatactl="yes"
1451 fi
1452
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"
1466 else
1467 install_suricata_update="yes"
1468 fi
1469
1470 AM_CONDITIONAL([INSTALL_SURICATA_UPDATE],
1471 [test "x$install_suricata_update" = "xyes"])
1472 AC_SUBST([install_suricata_update_reason])
1473
1474 # libhtp
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}"
1482 fi
1483
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"])
1490
1491 if test "$with_libhtp_includes" != "no"; then
1492 CPPFLAGS="-I${with_libhtp_includes} ${CPPFLAGS}"
1493 fi
1494
1495 if test "$with_libhtp_libraries" != "no"; then
1496 LDFLAGS="${LDFLAGS} -L${with_libhtp_libraries}"
1497 fi
1498
1499 AC_CHECK_HEADER(htp/htp.h,,[AC_MSG_ERROR(htp/htp.h not found ...)])
1500
1501 LIBHTP=""
1502 AC_CHECK_LIB(htp, htp_conn_create,, LIBHTP="no")
1503 if test "$LIBHTP" = "no"; then
1504 echo
1505 echo " ERROR! libhtp library not found"
1506 echo
1507 exit 1
1508 fi
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
1513 echo
1514 echo " ERROR! libhtp was found but it is neither >= 0.5.36, nor the dev 0.5.X"
1515 echo
1516 exit 1
1517 fi
1518 fi
1519
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])
1530 ])
1531
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])
1536 HTP_DIR="libhtp"
1537 AC_SUBST(HTP_DIR)
1538 HTP_LDADD="../libhtp/htp/libhtp.la"
1539 AC_SUBST(HTP_LDADD)
1540 # make sure libhtp is added to the includes
1541 CPPFLAGS="-I\${srcdir}/../libhtp/ ${CPPFLAGS}"
1542
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])
1554 else
1555 echo
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."
1563 echo
1564 exit 1
1565 fi
1566 fi
1567
1568
1569 # Check for libcap-ng
1570 case $host in
1571 *-*-linux*)
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"])
1578
1579 if test "$with_libcap_ng_includes" != "no"; then
1580 CPPFLAGS="${CPPFLAGS} -I${with_libcap_ng_includes}"
1581 fi
1582
1583 if test "$with_libcap_ng_libraries" != "no"; then
1584 LDFLAGS="${LDFLAGS} -L${with_libcap_ng_libraries}"
1585 fi
1586
1587 AC_CHECK_HEADER(cap-ng.h,,LIBCAP_NG="no")
1588 if test "$LIBCAP_NG" != "no"; then
1589 LIBCAP_NG=""
1590 AC_CHECK_LIB(cap-ng,capng_clear,,LIBCAP_NG="no")
1591 fi
1592
1593 if test "$LIBCAP_NG" != "no"; then
1594 AC_DEFINE([HAVE_LIBCAP_NG],[1],[Libpcap-ng support])
1595 fi
1596
1597 if test "$LIBCAP_NG" = "no"; then
1598 echo
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:"
1602 echo
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"
1606 echo
1607 echo " Suricata will be built without support for dropping privs."
1608 echo
1609 fi
1610 ;;
1611 esac
1612
1613
1614 AC_ARG_ENABLE(ebpf,
1615 AS_HELP_STRING([--enable-ebpf],[Enable eBPF support]),
1616 [ enable_ebpf="$enableval"],
1617 [ enable_ebpf="no"])
1618
1619 have_xdp="no"
1620 if test "$enable_ebpf" = "yes"; then
1621 AC_CHECK_LIB(elf,elf_begin,,LIBELF="no")
1622 if test "$LIBELF" = "no"; then
1623 echo
1624 echo " libelf library and development headers not found but"
1625 echo " but needed to use eBPF code"
1626 echo
1627 exit 1
1628 fi;
1629
1630 AC_CHECK_LIB(bpf,bpf_object__open,,LIBBPF="no")
1631 if test "$LIBBPF" = "no"; then
1632 echo
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"
1636 echo
1637 exit 1
1638 fi;
1639 AC_CHECK_DECL([PACKET_FANOUT_EBPF],
1640 AC_DEFINE([HAVE_PACKET_EBPF],[1],[Recent ebpf fanout support is available]),
1641 [],
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])
1646 fi
1647 AC_CHECK_FUNCS(bpf_program__section_name)
1648 fi;
1649
1650 # Check for DAG support.
1651 AC_ARG_ENABLE(dag,
1652 AS_HELP_STRING([--enable-dag],[Enable DAG capture]),
1653 [ enable_dag=$enableval ],
1654 [ enable_dag=no])
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"])
1661
1662 if test "$enable_dag" = "yes"; then
1663
1664 if test "$with_dag_includes" != "no"; then
1665 CPPFLAGS="${CPPFLAGS} -I${with_dag_includes}"
1666 fi
1667
1668 if test "$with_dag_libraries" != "no"; then
1669 LDFLAGS="${LDFLAGS} -L${with_dag_libraries}"
1670 fi
1671
1672 AC_CHECK_HEADER(dagapi.h,DAG="yes",DAG="no")
1673 if test "$DAG" != "no"; then
1674 DAG=""
1675 AC_CHECK_LIB(dag,dag_open,,DAG="no",)
1676 fi
1677
1678 if test "$DAG" = "no"; then
1679 echo
1680 echo " ERROR! libdag library not found"
1681 echo
1682 exit 1
1683 fi
1684
1685 AC_DEFINE([HAVE_DAG],[1],(Endace DAG card support enabled))
1686 fi
1687
1688 # libmagic
1689 enable_magic="no"
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"])
1700
1701 if test "$with_libmagic_includes" != "no"; then
1702 CPPFLAGS="${CPPFLAGS} -I${with_libmagic_includes}"
1703 fi
1704
1705 AC_CHECK_HEADER(magic.h,,MAGIC="no")
1706 if test "$MAGIC" != "no"; then
1707 MAGIC=""
1708 AC_CHECK_LIB(magic, magic_open,, MAGIC="no")
1709 fi
1710
1711 if test "x$MAGIC" != "xno"; then
1712 if test "$with_libmagic_libraries" != "no"; then
1713 LDFLAGS="${LDFLAGS} -L${with_libmagic_libraries}"
1714 fi
1715 AC_DEFINE([HAVE_MAGIC],[1],(Libmagic for file handling))
1716 else
1717 echo
1718 echo " WARNING! magic library not found, go get it"
1719 echo " from http://www.darwinsys.com/file/ or your distribution:"
1720 echo
1721 echo " Ubuntu: apt-get install libmagic-dev"
1722 echo " Fedora: dnf install file-devel"
1723 echo " CentOS/RHEL: yum install file-devel"
1724 echo
1725 enable_magic="no"
1726 fi
1727 fi
1728
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"])
1744
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
1750 NAPATECH=""
1751 AC_CHECK_LIB(ntapi, NT_Init,NAPATECH="yes",NAPATECH="no")
1752 fi
1753
1754 if test "$NAPATECH" = "no"; then
1755 echo
1756 echo " ERROR! libntapi library not found"
1757 echo
1758 exit 1
1759 else
1760 AC_CHECK_LIB(numa, numa_available,, LIBNUMA="no")
1761 if test "$LIBNUMA" = "no"; then
1762 echo
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"
1769 echo
1770 exit 1
1771 fi
1772 fi
1773
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))
1780 else
1781 echo "Napatech Flow Processing is not available"
1782 fi
1783 else
1784 echo "Napatech Flow Processing is Disabled."
1785 fi
1786 fi
1787
1788 # liblua
1789 AC_ARG_ENABLE(lua,
1790 AS_HELP_STRING([--enable-lua],[Enable Lua support]),
1791 [ enable_lua="$enableval"],
1792 [ enable_lua="no"])
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"
1803 echo "in Suricata".
1804 echo
1805 exit 1
1806 fi
1807 fi
1808
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"])
1815
1816 if test "$enable_lua" = "yes"; then
1817 if test "$with_liblua_includes" != "no"; then
1818 CPPFLAGS="${CPPFLAGS} -I${with_liblua_includes}"
1819 else
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"], [
1825 LUA="no"
1826 ])
1827 ])
1828 ])
1829 ])
1830 CPPFLAGS="${CPPFLAGS} ${LUA_CFLAGS}"
1831 fi
1832
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
1839 echo
1840 echo " ERROR! liblua library not found, go get it"
1841 echo " from http://lua.org/index.html or your distribution:"
1842 echo
1843 echo " Ubuntu: apt-get install liblua5.1-dev"
1844 echo " Fedora: dnf install lua-devel"
1845 echo " CentOS/RHEL: yum install lua-devel"
1846 echo
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."
1850 echo
1851 exit 1
1852 fi
1853 else
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"], [
1859 LUA="no"
1860 ])
1861 ])
1862 ])
1863 ])
1864 LIBS="${LIBS} ${LUA_LIBS}"
1865 fi
1866
1867 if test "$LUA" = "no"; then
1868 AC_CHECK_LIB(lua, luaL_openlibs,, LUA="no")
1869 fi
1870
1871 if test "$LUA" = "yes"; then
1872 AC_DEFINE([HAVE_LUA],[1],[liblua available])
1873 enable_lua="yes"
1874 fi
1875 else
1876 echo
1877 echo " ERROR! liblua headers not found, go get them"
1878 echo " from http://lua.org/index.html or your distribution:"
1879 echo
1880 echo " Ubuntu: apt-get install liblua5.1-dev"
1881 echo " Fedora: dnf install lua-devel"
1882 echo " CentOS/RHEL: yum install lua-devel"
1883 echo
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."
1888 echo
1889 exit 1
1890 fi
1891 fi
1892
1893 # libluajit
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"])
1900
1901 if test "$enable_luajit" = "yes"; then
1902 if test "$with_libluajit_includes" != "no"; then
1903 CPPFLAGS="${CPPFLAGS} -I${with_libluajit_includes}"
1904 else
1905 PKG_CHECK_MODULES([LUAJIT], [luajit], , LUAJIT="no")
1906 CPPFLAGS="${CPPFLAGS} ${LUAJIT_CFLAGS}"
1907 fi
1908
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}"
1913 else
1914 PKG_CHECK_MODULES([LUAJIT], [luajit])
1915 LIBS="${LIBS} ${LUAJIT_LIBS}"
1916 fi
1917
1918 AC_CHECK_LIB(luajit-5.1, luaL_openlibs,, LUAJIT="no")
1919
1920 if test "$LUAJIT" = "no"; then
1921 echo
1922 echo " ERROR! libluajit library not found, go get it"
1923 echo " from http://luajit.org/index.html or your distribution:"
1924 echo
1925 echo " Ubuntu: apt-get install libluajit-5.1-dev"
1926 echo
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."
1930 echo
1931 exit 1
1932 fi
1933
1934 AC_DEFINE([HAVE_LUA],[1],[lua support available])
1935 AC_DEFINE([HAVE_LUAJIT],[1],[libluajit available])
1936 enable_lua="yes, through luajit"
1937 enable_luajit="yes"
1938 else
1939 echo
1940 echo " ERROR! libluajit headers not found, go get them"
1941 echo " from http://luajit.org/index.html or your distribution:"
1942 echo
1943 echo " Ubuntu: apt-get install libluajit-5.1-dev"
1944 echo
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."
1949 echo
1950 exit 1
1951 fi
1952 fi
1953
1954 AM_CONDITIONAL([HAVE_LUA], [test "x$enable_lua" != "xno"])
1955
1956 # If Lua is enabled, test the integer size.
1957 if test "x$enable_lua" = "xyes" -a "$cross_compiling" != "yes"; then
1958 TMPLIBS="$LIBS"
1959 LIBS=""
1960
1961 AC_MSG_CHECKING([size of lua integer])
1962 AC_RUN_IFELSE([AC_LANG_PROGRAM([[#include <lua.h>]],
1963 [[
1964 if (sizeof(lua_Integer) == 8) {
1965 return 1;
1966 }
1967 return 0;
1968 ]])],
1969 [
1970 AC_MSG_RESULT([4])
1971 ],
1972 [
1973 AC_MSG_RESULT([8])
1974 AC_SUBST([LUA_INT8], ["lua_int8"])
1975 ])
1976 LIBS="$TMPLIBS"
1977 fi
1978
1979 # libmaxminddb
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"])
1990
1991 if test "$enable_geoip" = "yes"; then
1992 if test "$with_libmaxminddb_includes" != "no"; then
1993 CPPFLAGS="${CPPFLAGS} -I${with_libmaxminddb_includes}"
1994 fi
1995
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}"
2000 fi
2001 AC_CHECK_LIB(maxminddb, MMDB_open,, GEOIP="no")
2002 fi
2003 if test "$GEOIP" = "no"; then
2004 echo
2005 echo " ERROR! libmaxminddb GeoIP2 library not found, go get it"
2006 echo " from https://github.com/maxmind/libmaxminddb or your distribution:"
2007 echo
2008 echo " Ubuntu: apt-get install libmaxminddb-dev"
2009 echo " Fedora: dnf install libmaxminddb-devel"
2010 echo " CentOS/RHEL: yum install libmaxminddb-devel"
2011 echo
2012 exit 1
2013 fi
2014
2015 AC_DEFINE([HAVE_GEOIP],[1],[libmaxminddb available])
2016 enable_geoip="yes"
2017 fi
2018
2019 # Position Independent Executable
2020 AC_ARG_ENABLE(pie,
2021 AS_HELP_STRING([--enable-pie],[Enable compiling as a position independent executable]),
2022 [ enable_pie="$enableval"],
2023 [ enable_pie="no"])
2024 if test "$enable_pie" = "yes"; then
2025 CPPFLAGS="${CPPFLAGS} -fPIC"
2026 LDFLAGS="${LDFLAGS} -pie"
2027 fi
2028
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"])
2036
2037 # libhiredis
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"])
2048
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}"
2053 fi
2054
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}"
2059 fi
2060 AC_CHECK_LIB(hiredis, redisConnect,, HIREDIS="no")
2061 fi
2062 if test "$HIREDIS" = "no"; then
2063 echo
2064 echo " ERROR! libhiredis library not found, go get it"
2065 echo " from https://github.com/redis/hiredis or your distribution:"
2066 echo
2067 echo " Ubuntu: apt-get install libhiredis-dev"
2068 echo " Fedora: dnf install hiredis-devel"
2069 echo " CentOS/RHEL: yum install hiredis-devel"
2070 echo
2071 exit 1
2072 fi
2073 if test "$HIREDIS" = "yes"; then
2074 AC_DEFINE([HAVE_LIBHIREDIS],[1],[libhiredis available])
2075 enable_hiredis="yes"
2076 #
2077 # Check if async adapters and libevent is installed
2078 #
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}"
2084 fi
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}"
2089 fi
2090 AC_CHECK_LIB(event, event_base_free,, HAVE_LIBEVENT="no")
2091 AC_CHECK_LIB(event_pthreads, evthread_use_pthreads,, HAVE_LIBEVENT_PTHREADS="no")
2092 fi
2093 if [ test "$HAVE_LIBEVENT" = "no" ] && [ -o test "$HAVE_LIBEVENT_PTHREADS" = "no"]; then
2094 if test "$HAVE_LIBEVENT" = "no"; then
2095 echo
2096 echo " Async mode for redis output will not be available."
2097 echo " To enable it install libevent"
2098 echo
2099 echo " Ubuntu: apt-get install libevent-dev"
2100 echo " Fedora: dnf install libevent-devel"
2101 echo " CentOS/RHEL: yum install libevent-devel"
2102 echo
2103 fi
2104 if test "$HAVE_LIBEVENT_PTHREADS" = "no"; then
2105 echo
2106 echo " Async mode for redis output will not be available."
2107 echo " To enable it install libevent with pthreads support"
2108 echo
2109 echo " Ubuntu: apt-get install libevent-pthreads-2.0-5"
2110 echo
2111 fi
2112 else
2113 AC_DEFINE([HAVE_LIBEVENT],[1],[libevent available])
2114 enable_hiredis_async="yes"
2115 fi
2116 fi
2117 fi
2118 fi
2119
2120 # Check for lz4
2121 enable_liblz4="yes"
2122 AC_CHECK_LIB(lz4, LZ4F_createCompressionContext, , enable_liblz4="no")
2123
2124 if test "$enable_liblz4" = "no"; then
2125 echo
2126 echo " Compressed pcap logging is not available without liblz4."
2127 echo " If you want to enable compression, you need to install it."
2128 echo
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"
2133 echo
2134 fi
2135
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])
2142 else
2143 AC_DEFINE([CLS],[64],[L1 cache line size])
2144 fi
2145 else
2146 AC_DEFINE([CLS],[64],[L1 cache line size])
2147 fi
2148
2149 # mscgen for devguide images
2150 AC_PATH_PROG([HAVE_MSCGEN], mscgen, "no")
2151 if test "$HAVE_MSCGEN" = "no"; then
2152 enable_mscgen=no
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"
2158 fi
2159 AM_CONDITIONAL([HAVE_MSCGEN], [test "x$enable_mscgen" != "xno" ])
2160
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
2167 fi
2168 fi
2169 AM_CONDITIONAL([HAVE_SPHINXBUILD], [test "x$enable_sphinxbuild" != "xno"])
2170 AM_CONDITIONAL([HAVE_SURICATA_MAN], [test "x$have_suricata_man" = "xyes"])
2171
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
2175 enable_pdflatex=no
2176 fi
2177 AM_CONDITIONAL([HAVE_PDFLATEX], [test "x$enable_pdflatex" != "xno"])
2178
2179 # Cargo/Rust
2180 AM_CONDITIONAL([RUST_CROSS_COMPILE], [test "x$cross_compiling" = "xyes"])
2181 AC_PATH_PROG(RUSTC, rustc, "no")
2182 if test "$RUSTC" = "no"; then
2183 echo ""
2184 echo " ERROR: Suricata now requires Rust to build."
2185 echo ""
2186 echo " Ubuntu/Debian: apt install rustc cargo"
2187 echo " Fedora: dnf install rustc cargo"
2188 echo " CentOS: yum install rustc cargo (requires EPEL)"
2189 echo ""
2190 echo " Rustup works as well: https://rustup.rs/"
2191 echo ""
2192 exit 1
2193 fi
2194
2195 AC_PATH_PROG(CARGO, cargo, "no")
2196 if test "CARGO" = "no"; then
2197 AC_MSG_ERROR([cargo required])
2198 fi
2199
2200 AC_DEFINE([HAVE_RUST],[1],[Enable Rust language])
2201 AM_CONDITIONAL([HAVE_RUST],true)
2202 AC_SUBST([CARGO], [$CARGO])
2203
2204 enable_rust="yes"
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/')
2209
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],
2213 [
2214 echo ""
2215 echo "ERROR: Rust $MIN_RUSTC_VERSION or newer required."
2216 echo ""
2217 echo "Rust version ${rustc_version} was found."
2218 echo ""
2219 exit 1
2220 ],
2221 [],
2222 [])
2223 AC_MSG_RESULT(yes)
2224
2225 RUST_FEATURES=""
2226 AS_VERSION_COMPARE([$rustc_version], [1.38.0],
2227 [],
2228 [RUST_FEATURES="$RUST_FEATURES function-macro"],
2229 [RUST_FEATURES="$RUST_FEATURES function-macro"])
2230
2231 rust_vendor_comment="# "
2232 have_rust_vendor="no"
2233
2234 if test "x$cross_compiling" = "xyes"; then
2235 RUST_SURICATA_LIB_XC_DIR="${host_alias}/"
2236 else
2237 if test "x$CARGO_BUILD_TARGET" = "x"; then
2238 RUST_SURICATA_LIB_XC_DIR=
2239 else
2240 RUST_SURICATA_LIB_XC_DIR="${CARGO_BUILD_TARGET}/"
2241 fi
2242 fi
2243
2244 if test "x$enable_debug" = "xyes"; then
2245 RUST_SURICATA_LIBDIR="../rust/target/${RUST_SURICATA_LIB_XC_DIR}debug"
2246 else
2247 RUST_SURICATA_LIBDIR="../rust/target/${RUST_SURICATA_LIB_XC_DIR}release"
2248 fi
2249 RUST_SURICATA_LIB="${RUST_SURICATA_LIBDIR}/${RUST_SURICATA_LIBNAME}"
2250
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])
2258 else
2259 AC_SUBST([CARGO_HOME], [~/.cargo])
2260 fi
2261 else
2262 AC_SUBST([CARGO_HOME], [$CARGO_HOME])
2263 fi
2264
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"
2271 else
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")
2275 fi
2276 fi
2277 rustup_home=""
2278 if test "x$rustup_home_path" != "xno"; then
2279 rustup_home="RUSTUP_HOME=\$(RUSTUP_HOME_PATH)"
2280 fi
2281 AC_SUBST([RUSTUP_HOME_PATH], [$rustup_home_path])
2282 AC_SUBST([rustup_home])
2283
2284 if test -e "$srcdir/rust/vendor"; then
2285 have_rust_vendor="yes"
2286 fi
2287
2288 if test "x$have_rust_vendor" = "xyes"; then
2289 rust_vendor_comment=""
2290 fi
2291
2292 AC_SUBST(rust_vendor_comment)
2293 AM_CONDITIONAL([HAVE_RUST_VENDOR], [test "x$have_rust_vendor" = "xyes"])
2294
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)
2302
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
2308 fi
2309
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
2313 AC_MSG_RESULT(yes)
2314 have_rust_headers="yes"
2315 else
2316 AC_MSG_RESULT(no)
2317 AC_MSG_CHECKING(for $srcdir/rust/gen/rust-bindings.h)
2318 if test -f "$srcdir/rust/gen/rust-bindings.h"; then
2319 AC_MSG_RESULT(yes)
2320 have_rust_headers="yes"
2321 else
2322 AC_MSG_RESULT(no)
2323 fi
2324 fi
2325
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],
2331 [cbindgen_ok="no"],
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"
2338 CBINDGEN="no"
2339 else
2340 have_rust_headers="no"
2341 fi
2342 fi
2343
2344 AC_SUBST([CBINDGEN], [$CBINDGEN])
2345
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])
2353 fi
2354 fi
2355
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"])
2359
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"
2364 ])
2365 AC_SUBST(RUST_FEATURES)
2366
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])
2373 AC_PROG_CXX
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)
2378 ])
2379 AC_DEFINE([FUZZ], [1], [Fuzz targets are enabled])
2380 AC_DEFINE([AFLFUZZ_NO_RANDOM], [1], [Disable all use of random functions])
2381 CFLAGS_ORIG=$CFLAGS
2382 CFLAGS="-Werror"
2383 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[while (__AFL_LOOP(1000))]])],
2384 [AC_DEFINE([AFLFUZZ_PERSISTANT_MODE], [1], [Enable AFL PERSISTANT_MODE])],
2385 [])
2386 CFLAGS=$CFLAGS_ORIG
2387 AC_LANG_PUSH(C++)
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)
2392 ])
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) {
2399 (void)Data;
2400 (void)Size;
2401 return 0;
2402 }
2403 ]])],
2404 [ AC_MSG_RESULT(yes)
2405 has_sanitizefuzzer=yes],
2406 [ AC_MSG_RESULT(no) ]
2407 )
2408 _AC_LANG_PREFIX[]FLAGS=$tmp_saved_flags
2409 AC_LANG_POP()
2410 ])
2411
2412 AM_CONDITIONAL([HAS_FUZZLDFLAGS], [test "x$has_sanitizefuzzer" = "xyes"])
2413
2414 # get revision
2415 if test -f ./revision; then
2416 REVISION=`cat ./revision`
2417 AC_DEFINE_UNQUOTED([REVISION],[${REVISION}],[Git revision])
2418 else
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])
2426 fi
2427 fi
2428 fi
2429
2430 if test "${enable_ebpf}" = "yes" || test "${enable_unittests}" = "yes"; then
2431 AC_DEFINE([CAPTURE_OFFLOAD_MANAGER], [1],[Building flow bypass manager code])
2432 fi
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])
2435 fi
2436
2437 AC_SUBST(CFLAGS)
2438 AC_SUBST(LDFLAGS)
2439 AC_SUBST(CPPFLAGS)
2440
2441 define([EXPAND_VARIABLE],
2442 [$2=[$]$1
2443 if test $prefix = 'NONE'; then
2444 prefix="/usr/local"
2445 fi
2446 while true; do
2447 case "[$]$2" in
2448 *\[$]* ) eval "$2=[$]$2" ;;
2449 *) break ;;
2450 esac
2451 done
2452 eval "$2=[$]$2$3"
2453 ])dnl EXPAND_VARIABLE
2454
2455 # suricata log dir
2456 if test "$WINDOWS_PATH" = "yes"; then
2457 case $host in
2458 x86_64-w64-mingw32)
2459 e_winbase="C:\\\\Program Files\\\\Suricata"
2460 ;;
2461 *)
2462 systemtype="`systeminfo | grep \"based PC\"`"
2463 case "$systemtype" in
2464 *x64*)
2465 e_winbase="C:\\\\Program Files (x86)\\\\Suricata"
2466 ;;
2467 *)
2468 e_winbase="C:\\\\Program Files\\\\Suricata"
2469 ;;
2470 esac
2471 esac
2472
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"
2484 else
2485 e_abs_srcdir=$(cd $srcdir && pwd)
2486 e_rustdir="$e_abs_srcdir/rust"
2487 fi
2488 else
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")
2498
2499 e_abs_srcdir=$(cd $srcdir && pwd)
2500 EXPAND_VARIABLE(e_abs_srcdir, e_rustdir, "/rust")
2501 fi
2502 AC_SUBST(e_logdir)
2503 AC_SUBST(e_rundir)
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)
2515 AC_SUBST(e_rustdir)
2516
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)
2530
2531 AM_CONDITIONAL([BUILD_SHARED_LIBRARY], [test "x$enable_shared" = "xyes"] && [test "x$can_build_shared_library" = "xyes"])
2532
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)
2541 AC_OUTPUT
2542
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}
2555
2556 Unix socket enabled: ${enable_unixsocket}
2557 Detection enabled: ${enable_detection}
2558
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}
2571
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}
2579
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}
2587
2588 Profiling enabled: ${enable_profiling}
2589 Profiling locks enabled: ${enable_profiling_locks}
2590
2591 Plugin support (experimental): ${plugin_support}
2592
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}
2598
2599 Generic build parameters:
2600 Installation prefix: ${prefix}
2601 Configuration directory: ${e_sysconfdir}
2602 Log directory: ${e_logdir}
2603
2604 --prefix ${CONFIGURE_PREFIX}
2605 --sysconfdir ${CONFIGURE_SYSCONDIR}
2606 --localstatedir ${CONFIGURE_LOCALSTATEDIR}
2607 --datarootdir ${CONFIGURE_DATAROOTDIR}
2608
2609 Host: ${host}
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}
2615 CFLAGS ${CFLAGS}
2616 PCAP_CFLAGS ${PCAP_CFLAGS}
2617 SECCFLAGS ${SECCFLAGS}"
2618
2619 echo
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
2624
2625 echo "
2626 To build and install run 'make' and 'make install'.
2627
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."
2631 echo
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/"
2635 echo