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