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