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