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