]>
Commit | Line | Data |
---|---|---|
8f81792d | 1 | AC_INIT(suricata, 4.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 | |
fa5939ca | 76 | |
9f1d779a WM |
77 | AC_PATH_PROG(HAVE_PKG_CONFIG, pkg-config, "no") |
78 | if test "$HAVE_PKG_CONFIG" = "no"; then | |
89cee0ad VJ |
79 | echo |
80 | echo " ERROR! pkg-config not found, go get it " | |
81 | echo " http://pkg-config.freedesktop.org/wiki/ " | |
82 | echo " or install from your distribution " | |
83 | echo | |
84 | exit 1 | |
9f1d779a WM |
85 | fi |
86 | ||
dc1bd5b6 AH |
87 | AC_ARG_ENABLE(python, |
88 | AS_HELP_STRING([--enable-python], [Enable python]),,[enable_python=yes]) | |
6bddc4d3 | 89 | AC_PATH_PROGS(HAVE_PYTHON, python python2 python2.7, "no") |
dc1bd5b6 AH |
90 | if test "x$enable_python" = "xno" ; then |
91 | echo | |
92 | echo " Warning! python disabled, you will not be " | |
baf528e7 | 93 | echo " able to install suricatasc unix socket client " |
dc1bd5b6 AH |
94 | echo |
95 | enable_python="no" | |
96 | fi | |
6bddc4d3 | 97 | if test "$HAVE_PYTHON" = "no"; then |
cd305c3a EL |
98 | echo |
99 | echo " Warning! python not found, you will not be " | |
baf528e7 | 100 | echo " able to install suricatasc unix socket client " |
cd305c3a EL |
101 | echo |
102 | enable_python="no" | |
cd305c3a | 103 | fi |
dc1bd5b6 | 104 | AM_CONDITIONAL([HAVE_PYTHON], [test "x$enable_python" = "xyes"]) |
cd305c3a | 105 | |
daa9dcb7 EL |
106 | AC_PATH_PROG(HAVE_WGET, wget, "no") |
107 | if test "$HAVE_WGET" = "no"; then | |
108 | AC_PATH_PROG(HAVE_CURL, curl, "no") | |
109 | if test "$HAVE_CURL" = "no"; then | |
110 | echo | |
111 | echo " Warning curl or wget not found, you won't be able to" | |
112 | echo " download latest ruleset with 'make install-rules'" | |
113 | fi | |
114 | fi | |
115 | AM_CONDITIONAL([HAVE_FETCH_COMMAND], [test "x$HAVE_WGET" != "xno" || test "x$HAVE_CURL" != "xno"]) | |
116 | AM_CONDITIONAL([HAVE_WGET_COMMAND], [test "x$HAVE_WGET" != "xno"]) | |
7c841e1d | 117 | |
89cee0ad | 118 | # Checks for libraries. |
7c841e1d | 119 | |
89cee0ad | 120 | # Checks for header files. |
4086938f | 121 | AC_CHECK_HEADERS([stddef.h]) |
472e061c VJ |
122 | AC_CHECK_HEADERS([arpa/inet.h assert.h ctype.h errno.h fcntl.h inttypes.h]) |
123 | AC_CHECK_HEADERS([getopt.h]) | |
124 | AC_CHECK_HEADERS([limits.h netdb.h netinet/in.h poll.h sched.h signal.h]) | |
2c01985e | 125 | AC_CHECK_HEADERS([stdarg.h stdint.h stdio.h stdlib.h stdbool.h string.h strings.h sys/ioctl.h]) |
472e061c | 126 | AC_CHECK_HEADERS([syslog.h sys/prctl.h sys/socket.h sys/stat.h sys/syscall.h]) |
b63c2eda | 127 | AC_CHECK_HEADERS([sys/time.h time.h unistd.h]) |
472e061c | 128 | AC_CHECK_HEADERS([sys/ioctl.h linux/if_ether.h linux/if_packet.h linux/filter.h]) |
fcc87595 | 129 | AC_CHECK_HEADERS([linux/ethtool.h linux/sockios.h]) |
f11e237d | 130 | AC_CHECK_HEADER(glob.h,,[AC_ERROR(glob.h not found ...)]) |
bbb93e48 | 131 | AC_CHECK_HEADERS([dirent.h fnmatch.h]) |
a4dce241 | 132 | AC_CHECK_HEADERS([sys/resource.h]) |
472e061c VJ |
133 | |
134 | AC_CHECK_HEADERS([sys/socket.h net/if.h sys/mman.h linux/if_arp.h], [], [], | |
5656e344 | 135 | [[#ifdef HAVE_SYS_SOCKET_H |
472e061c VJ |
136 | #include <sys/types.h> |
137 | #include <sys/socket.h> | |
138 | #endif | |
5656e344 EL |
139 | ]]) |
140 | ||
dd70b3fd | 141 | AC_CHECK_HEADERS([windows.h winsock2.h ws2tcpip.h w32api/wtypes.h wincrypt.h], [], [], |
06f9b0ad VJ |
142 | [[ |
143 | #ifndef _X86_ | |
144 | #define _X86_ | |
145 | #endif | |
b63c2eda VJ |
146 | ]]) |
147 | AC_CHECK_HEADERS([w32api/winbase.h], [], [], | |
06f9b0ad VJ |
148 | [[ |
149 | #ifndef _X86_ | |
150 | #define _X86_ | |
151 | #endif | |
152 | #include <windows.h> | |
b63c2eda | 153 | ]]) |
fa5939ca | 154 | |
89cee0ad | 155 | # Checks for typedefs, structures, and compiler characteristics. |
fa5939ca BR |
156 | AC_C_INLINE |
157 | AC_TYPE_PID_T | |
158 | AC_TYPE_SIZE_T | |
159 | AC_TYPE_INT32_T | |
160 | AC_TYPE_UINT16_T | |
161 | AC_TYPE_UINT32_T | |
162 | AC_TYPE_UINT64_T | |
163 | AC_TYPE_UINT8_T | |
164 | AC_HEADER_STDBOOL | |
165 | ||
89cee0ad | 166 | # Checks for library functions. |
fa5939ca BR |
167 | AC_FUNC_MALLOC |
168 | AC_FUNC_REALLOC | |
dd70b3fd | 169 | AC_CHECK_FUNCS([gettimeofday memset strcasecmp strchr strdup strerror strncasecmp strtol strtoul memchr memrchr clock_gettime]) |
ba81c4d2 VJ |
170 | |
171 | OCFLAGS=$CFLAGS | |
172 | CFLAGS="" | |
8e946b92 | 173 | AC_CHECK_FUNCS([strlcpy strlcat]) |
ba81c4d2 | 174 | CFLAGS=$OCFLAGS |
fa5939ca | 175 | |
89cee0ad | 176 | # Add large file support |
3b3f5816 WM |
177 | AC_SYS_LARGEFILE |
178 | ||
89cee0ad | 179 | #check for os |
769022f4 PR |
180 | AC_MSG_CHECKING([host os]) |
181 | ||
7396237c VJ |
182 | # lua pkg-config name differs per OS |
183 | LUA_PC_NAME="lua5.1" | |
184 | LUA_LIB_NAME="lua5.1" | |
185 | ||
769022f4 | 186 | # If no host os was detected, try with uname |
25804f5a | 187 | if test -z "$host" ; then |
769022f4 PR |
188 | host="`uname`" |
189 | fi | |
a49bce63 | 190 | echo -n "installation for $host OS... " |
769022f4 | 191 | |
15c98c60 AH |
192 | e_magic_file="" |
193 | e_magic_file_comment="#" | |
769022f4 | 194 | case "$host" in |
829238e4 | 195 | *-*-*freebsd*) |
7396237c VJ |
196 | LUA_PC_NAME="lua-5.1" |
197 | LUA_LIB_NAME="lua-5.1" | |
829238e4 VJ |
198 | CFLAGS="${CFLAGS} -DOS_FREEBSD" |
199 | CPPFLAGS="${CPPFLAGS} -I/usr/local/include -I/usr/local/include/libnet11" | |
200 | LDFLAGS="${LDFLAGS} -L/usr/local/lib -L/usr/local/lib/libnet11" | |
829238e4 | 201 | ;; |
829238e4 | 202 | *-*-openbsd*) |
7396237c | 203 | LUA_PC_NAME="lua51" |
ddf9b417 | 204 | CFLAGS="${CFLAGS} -D__OpenBSD__" |
829238e4 VJ |
205 | CPPFLAGS="${CPPFLAGS} -I/usr/local/include -I/usr/local/include/libnet-1.1" |
206 | LDFLAGS="${LDFLAGS} -L/usr/local/lib -I/usr/local/lib/libnet-1.1" | |
829238e4 VJ |
207 | ;; |
208 | *darwin*|*Darwin*) | |
1177d489 VJ |
209 | LUA_PC_NAME="lua-5.1" |
210 | LUA_LIB_NAME="lua-5.1" | |
829238e4 VJ |
211 | CFLAGS="${CFLAGS} -DOS_DARWIN" |
212 | CPPFLAGS="${CPPFLAGS} -I/opt/local/include" | |
213 | LDFLAGS="${LDFLAGS} -L/opt/local/lib" | |
214 | ;; | |
215 | *-*-linux*) | |
216 | #for now do nothing | |
8f81792d | 217 | RUST_LDADD="-ldl -lrt -lm" |
829238e4 VJ |
218 | ;; |
219 | *-*-mingw32*) | |
220 | CFLAGS="${CFLAGS} -DOS_WIN32" | |
221 | LDFLAGS="${LDFLAGS} -lws2_32" | |
222 | WINDOWS_PATH="yes" | |
223 | ;; | |
224 | *-*-cygwin) | |
43c5b949 VJ |
225 | LUA_PC_NAME="lua" |
226 | LUA_LIB_NAME="lua" | |
829238e4 VJ |
227 | WINDOWS_PATH="yes" |
228 | ;; | |
7847c4f8 VJ |
229 | *-*-solaris*) |
230 | AC_MSG_WARN([support for Solaris/Illumos/SunOS is experimental]) | |
231 | LDFLAGS="${LDFLAGS} -lsocket -lnsl" | |
232 | ;; | |
829238e4 VJ |
233 | *) |
234 | AC_MSG_WARN([unsupported OS this may or may not work]) | |
235 | ;; | |
769022f4 PR |
236 | esac |
237 | AC_MSG_RESULT(ok) | |
238 | ||
faad6bd3 VJ |
239 | # enable modifications for AFL fuzzing |
240 | AC_ARG_ENABLE(afl, | |
241 | AS_HELP_STRING([--enable-afl], Enable AFL fuzzing logic[])], [enable_afl="$enableval"],[enable_afl=no]) | |
242 | ||
243 | AS_IF([test "x$enable_afl" = "xyes"], [ | |
244 | AC_DEFINE([AFLFUZZ_NO_RANDOM], [1], [Disable all use of random functions]) | |
245 | AC_DEFINE([AFLFUZZ_DISABLE_MGTTHREADS], [1], [Disable all management threads]) | |
246 | AC_DEFINE([AFLFUZZ_PCAP_RUNMODE], [1], [Enable special AFL 'single' runmode]) | |
247 | AC_DEFINE([AFLFUZZ_CONF_TEST], [1], [Enable special --afl-parse-rules commandline option]) | |
248 | AC_DEFINE([AFLFUZZ_APPLAYER], [1], [Enable --afl-$proto-request commandline option]) | |
249 | AC_DEFINE([AFLFUZZ_MIME], [1], [Enable --afl-mime commandline option]) | |
250 | AC_DEFINE([AFLFUZZ_DECODER], [1], [Enable --afl-decoder-$proto commandline option]) | |
251 | AC_DEFINE([AFLFUZZ_DER], [1], [Enable --afl-der commandline option]) | |
1c8775b3 | 252 | AC_DEFINE([AFLFUZZ_RULES], [1], [Enable --afl-rules commandline option]) |
faad6bd3 VJ |
253 | |
254 | # test for AFL PERSISTANT_MODE support | |
255 | CFLAGS_ORIG=$CFLAGS | |
256 | CFLAGS="-Werror" | |
257 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[while (__AFL_LOOP(1000))]])], | |
258 | [AC_DEFINE([AFLFUZZ_PERSISTANT_MODE], [1], [Enable AFL PERSISTANT_MODE])], | |
259 | []) | |
260 | CFLAGS=$CFLAGS_ORIG | |
261 | ]) | |
262 | ||
6fa8922c VJ |
263 | # disable TLS on user request |
264 | AC_ARG_ENABLE(threading-tls, | |
2a17e3e8 | 265 | AS_HELP_STRING([--disable-threading-tls], [Disable TLS (thread local storage)]), [enable_tls="$enableval"],[enable_tls=yes]) |
6fa8922c VJ |
266 | AS_IF([test "x$enable_tls" = "xyes"], [ |
267 | # check if our target supports thread local storage | |
268 | AC_MSG_CHECKING(for thread local storage __thread support) | |
269 | AC_TRY_COMPILE([#include <stdlib.h>], | |
270 | [ static __thread int i; i = 1; i++; ], | |
271 | [AC_DEFINE([TLS], [1], [Thread local storage]) | |
272 | AC_MSG_RESULT([yes]) ], | |
273 | [AC_MSG_RESULT([no])]) | |
274 | ]) | |
900918a5 | 275 | |
89cee0ad VJ |
276 | #Enable support for gcc compile time security options. There is no great way to do detection of valid cflags that I have found |
277 | #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. | |
278 | #These flags seem to be supported on CentOS 5+, Ubuntu 8.04+, and FedoreCore 11+ | |
279 | #Options are taken from https://wiki.ubuntu.com/CompilerFlags | |
c49785fb | 280 | AC_ARG_ENABLE(gccprotect, |
e07e9e16 | 281 | AS_HELP_STRING([--enable-gccprotect], [Detect and use gcc hardening options]),,[enable_gccprotect=no]) |
c49785fb | 282 | |
e07e9e16 | 283 | AS_IF([test "x$enable_gccprotect" = "xyes"], [ |
98b9009b WM |
284 | #buffer overflow protection |
285 | AC_MSG_CHECKING(for -fstack-protector) | |
286 | TMPCFLAGS="${CFLAGS}" | |
287 | CFLAGS="${CFLAGS} -fstack-protector" | |
ba81c4d2 VJ |
288 | AC_TRY_LINK(,,SECCFLAGS="-fstack-protector" |
289 | AC_MSG_RESULT(yes), | |
290 | AC_MSG_RESULT(no)) | |
98b9009b WM |
291 | CFLAGS="${TMPCFLAGS}" |
292 | ||
293 | #compile-time best-practices errors for certain libc functions, provides checks of buffer lengths and memory regions | |
294 | AC_MSG_CHECKING(for -D_FORTIFY_SOURCE=2) | |
295 | TMPCFLAGS="${CFLAGS}" | |
296 | CFLAGS="${CFLAGS} -D_FORTIFY_SOURCE=2" | |
297 | AC_TRY_COMPILE(,,SECCFLAGS="${SECCFLAGS} -D_FORTIFY_SOURCE=2" | |
ba81c4d2 VJ |
298 | AC_MSG_RESULT(yes), |
299 | AC_MSG_RESULT(no)) | |
98b9009b WM |
300 | CFLAGS="${TMPCFLAGS}" |
301 | ||
302 | #compile-time warnings about misuse of format strings | |
303 | AC_MSG_CHECKING(for -Wformat -Wformat-security) | |
304 | TMPCFLAGS="${CFLAGS}" | |
305 | CFLAGS="${CFLAGS} -Wformat -Wformat-security" | |
306 | AC_TRY_COMPILE(,,SECCFLAGS="${SECCFLAGS} -Wformat -Wformat-security" | |
ba81c4d2 VJ |
307 | AC_MSG_RESULT(yes), |
308 | AC_MSG_RESULT(no)) | |
98b9009b WM |
309 | CFLAGS="${TMPCFLAGS}" |
310 | ||
311 | #provides a read-only relocation table area in the final ELF | |
312 | AC_MSG_CHECKING(for -z relro) | |
313 | TMPLDFLAGS="${LDFLAGS}" | |
314 | LDFLAGS="${LDFLAGS} -z relro" | |
315 | AC_TRY_LINK(,,SECLDFLAGS="${SECLDFLAGS} -z relro" | |
ba81c4d2 VJ |
316 | AC_MSG_RESULT(yes), |
317 | AC_MSG_RESULT(no)) | |
98b9009b WM |
318 | LDFLAGS="${TMPLDFLAGS}" |
319 | ||
320 | #forces all relocations to be resolved at run-time | |
321 | AC_MSG_CHECKING(for -z now) | |
322 | TMPLDFLAGS="${LDFLAGS}" | |
323 | LDFLAGS="${LDFLAGS} -z now" | |
324 | AC_TRY_LINK(,,SECLDFLAGS="${SECLDFLAGS} -z now" | |
ba81c4d2 VJ |
325 | AC_MSG_RESULT(yes), |
326 | AC_MSG_RESULT(no)) | |
98b9009b WM |
327 | LDFLAGS="${TMPLDFLAGS}" |
328 | ||
ba81c4d2 VJ |
329 | AC_SUBST(SECCFLAGS) |
330 | AC_SUBST(SECLDFLAGS) | |
e07e9e16 | 331 | ]) |
5bde1217 | 332 | |
89cee0ad | 333 | #enable profile generation |
5bde1217 | 334 | AC_ARG_ENABLE(gccprofile, |
e07e9e16 WM |
335 | AS_HELP_STRING([--enable-gccprofile], [Enable gcc profile info i.e -pg flag is set]),,[enable_gccprofile=no]) |
336 | AS_IF([test "x$enable_gccprofile" = "xyes"], [ | |
337 | CFLAGS="${CFLAGS} -pg" | |
338 | ]) | |
5bde1217 | 339 | |
89cee0ad | 340 | #enable gcc march=native gcc 4.2 or later |
22f3e3d8 | 341 | AC_ARG_ENABLE(gccmarch_native, |
9f0bf35c | 342 | AS_HELP_STRING([--enable-gccmarch-native], [Enable gcc march=native gcc 4.2 and later only]),,[enable_gccmarch_native=yes]) |
e07e9e16 | 343 | AS_IF([test "x$enable_gccmarch_native" = "xyes"], [ |
ffba26d0 VJ |
344 | case "$host" in |
345 | *powerpc*) | |
346 | ;; | |
347 | *) | |
37b05b23 EL |
348 | OFLAGS="$CFLAGS" |
349 | CFLAGS="$CFLAGS -march=native" | |
350 | AC_MSG_CHECKING([checking if $CC supports -march=native]) | |
351 | AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([[#include <stdlib.h>]])], | |
352 | [ | |
353 | AC_MSG_RESULT([yes]) | |
ba81c4d2 VJ |
354 | OPTIMIZATION_CFLAGS="-march=native" |
355 | AC_SUBST(OPTIMIZATION_CFLAGS) | |
37b05b23 EL |
356 | ], |
357 | [ | |
358 | AC_MSG_RESULT([no]) | |
359 | CFLAGS="$OFLAGS" | |
360 | enable_gccmarch_native=no | |
361 | ] | |
362 | ) | |
ffba26d0 VJ |
363 | ;; |
364 | esac | |
e07e9e16 | 365 | ]) |
22f3e3d8 | 366 | |
89cee0ad VJ |
367 | # options |
368 | ||
369 | # enable the running of unit tests | |
370 | AC_ARG_ENABLE(unittests, | |
371 | AS_HELP_STRING([--enable-unittests], [Enable compilation of the unit tests]),,[enable_unittests=no]) | |
372 | AS_IF([test "x$enable_unittests" = "xyes"], [ | |
ba81c4d2 | 373 | AC_DEFINE([UNITTESTS],[1],[Enable built-in unittests]) |
89cee0ad | 374 | ]) |
89cee0ad VJ |
375 | AM_CONDITIONAL([BUILD_UNITTESTS], [test "x$enable_unittests" = "xyes"]) |
376 | ||
377 | # enable workaround for old barnyard2 for unified alert output | |
378 | AC_ARG_ENABLE(old-barnyard2, | |
379 | AS_HELP_STRING([--enable-old-barnyard2], [Use workaround for old barnyard2 in unified2 output]),,[enable_old_barnyard2=no]) | |
380 | AS_IF([test "x$enable_old_barnyard2" = "xyes"], [ | |
ba81c4d2 | 381 | AC_DEFINE([HAVE_OLD_BARNYARD2],[1],[Use workaround for old barnyard2 in unified2 output]) |
89cee0ad VJ |
382 | ]) |
383 | ||
384 | # enable debug output | |
385 | AC_ARG_ENABLE(debug, | |
386 | AS_HELP_STRING([--enable-debug], [Enable debug output]),,[enable_debug=no]) | |
387 | AS_IF([test "x$enable_debug" = "xyes"], [ | |
ba81c4d2 | 388 | AC_DEFINE([DEBUG],[1],[Enable debug output]) |
89cee0ad | 389 | ]) |
ba81c4d2 | 390 | AM_CONDITIONAL([DEBUG], [test "x$enable_debug" = "xyes"]) |
89cee0ad VJ |
391 | |
392 | # enable debug validation functions & macro's output | |
393 | AC_ARG_ENABLE(debug-validation, | |
394 | AS_HELP_STRING([--enable-debug-validation], [Enable (debug) validation code output]),,[enable_debug_validation=no]) | |
395 | AS_IF([test "x$enable_debug_validation" = "xyes"], [ | |
a18af732 AH |
396 | if test "$enable_unittests" = "yes"; then |
397 | AC_MSG_ERROR([debug_validation can't be enabled with enabled unittests!]) | |
398 | else | |
399 | AC_DEFINE([DEBUG_VALIDATION],[1],[Enable (debug) validation code output]) | |
400 | fi | |
89cee0ad VJ |
401 | ]) |
402 | ||
403 | # profiling support | |
404 | AC_ARG_ENABLE(profiling, | |
405 | AS_HELP_STRING([--enable-profiling], [Enable performance profiling]),,[enable_profiling=no]) | |
406 | AS_IF([test "x$enable_profiling" = "xyes"], [ | |
ba81c4d2 VJ |
407 | case "$host" in |
408 | *-*-openbsd*) | |
409 | AC_MSG_ERROR([profiling is not supported on OpenBSD]) | |
410 | ;; | |
411 | *) | |
412 | AC_DEFINE([PROFILING],[1],[Enable performance profiling]) | |
413 | ;; | |
414 | esac | |
89cee0ad VJ |
415 | ]) |
416 | ||
d908e707 VJ |
417 | # profiling support, locking |
418 | AC_ARG_ENABLE(profiling-locks, | |
419 | AS_HELP_STRING([--enable-profiling-locks], [Enable performance profiling for locks]),,[enable_profiling_locks=no]) | |
420 | AS_IF([test "x$enable_profiling_locks" = "xyes"], [ | |
ba81c4d2 VJ |
421 | AC_DEFINE([PROFILING],[1],[Enable performance profiling]) |
422 | AC_DEFINE([PROFILE_LOCKING],[1],[Enable performance profiling for locks]) | |
d908e707 VJ |
423 | ]) |
424 | ||
89cee0ad VJ |
425 | # enable support for IPFW |
426 | AC_ARG_ENABLE(ipfw, | |
427 | AS_HELP_STRING([--enable-ipfw], [Enable FreeBSD IPFW support for inline IDP]),,[enable_ipfw=no]) | |
428 | AS_IF([test "x$enable_ipfw" = "xyes"], [ | |
ba81c4d2 | 429 | AC_DEFINE([IPFW],[1],[Enable FreeBSD IPFW support for inline IDP]) |
89cee0ad VJ |
430 | ]) |
431 | ||
7fb860ac | 432 | AC_ARG_ENABLE(coccinelle, |
20dd5939 | 433 | AS_HELP_STRING([--disable-coccinelle], [Disable coccinelle QA steps during make check]),[enable_coccinelle="$enableval"],[enable_coccinelle=yes]) |
7fb860ac VJ |
434 | AS_IF([test "x$enable_coccinelle" = "xyes"], [ |
435 | AC_PATH_PROG(HAVE_COCCINELLE_CONFIG, spatch, "no") | |
436 | if test "$HAVE_COCCINELLE_CONFIG" = "no"; then | |
e4b39a41 | 437 | enable_coccinelle=no |
7fb860ac VJ |
438 | fi |
439 | ]) | |
440 | AM_CONDITIONAL([HAVE_COCCINELLE], [test "x$enable_coccinelle" != "xno"]) | |
441 | ||
f4872a2f VJ |
442 | # disable detection |
443 | AC_ARG_ENABLE(detection, | |
20dd5939 | 444 | AS_HELP_STRING([--disable-detection], [Disable Detection Modules]), [enable_detection="$enableval"],[enable_detection=yes]) |
f4872a2f | 445 | AS_IF([test "x$enable_detection" = "xno"], [ |
65d8ae93 | 446 | AC_DEFINE([HAVE_DETECT_DISABLED], [1], [Detection is disabled]) |
f4872a2f VJ |
447 | ]) |
448 | ||
ba81c4d2 | 449 | # Tilera PCIE logging |
497575d3 KS |
450 | AM_CONDITIONAL([BUILD_PCIE_LOGGING], [test ! -z "$TILERA_ROOT"]) |
451 | ||
89cee0ad VJ |
452 | # libraries |
453 | ||
3db717db KS |
454 | AC_MSG_CHECKING([for Mpipe]) |
455 | AC_COMPILE_IFELSE( | |
456 | [AC_LANG_PROGRAM([[#include <gxio/mpipe.h>]])], | |
457 | [ | |
458 | AC_MSG_RESULT([yes]) | |
459 | AC_DEFINE([HAVE_MPIPE],[1],[mPIPE support is available]) | |
497575d3 | 460 | LDFLAGS="$LDFLAGS -lgxpci -lgxio -ltmc" |
3db717db KS |
461 | ], |
462 | [AC_MSG_RESULT([no])]) | |
463 | ||
89cee0ad | 464 | #libpcre |
a3510f20 WM |
465 | AC_ARG_WITH(libpcre_includes, |
466 | [ --with-libpcre-includes=DIR libpcre include directory], | |
467 | [with_libpcre_includes="$withval"],[with_libpcre_includes=no]) | |
468 | AC_ARG_WITH(libpcre_libraries, | |
469 | [ --with-libpcre-libraries=DIR libpcre library directory], | |
470 | [with_libpcre_libraries="$withval"],[with_libpcre_libraries="no"]) | |
471 | ||
472 | if test "$with_libpcre_includes" != "no"; then | |
89f83c2e | 473 | CPPFLAGS="${CPPFLAGS} -I${with_libpcre_includes}" |
a3510f20 | 474 | fi |
a3510f20 | 475 | AC_CHECK_HEADER(pcre.h,,[AC_ERROR(pcre.h not found ...)]) |
6899b3da | 476 | |
a3510f20 | 477 | if test "$with_libpcre_libraries" != "no"; then |
ba81c4d2 | 478 | LDFLAGS="${LDFLAGS} -L${with_libpcre_libraries}" |
a3510f20 | 479 | fi |
a3510f20 | 480 | PCRE="" |
9858ae41 | 481 | AC_CHECK_LIB(pcre, pcre_get_substring,, PCRE="no") |
89f83c2e VJ |
482 | if test "$PCRE" = "no"; then |
483 | echo | |
484 | echo " ERROR! pcre library not found, go get it" | |
485 | echo " from www.pcre.org." | |
486 | echo | |
487 | exit 1 | |
488 | fi | |
6899b3da | 489 | |
8c0e5750 AH |
490 | # libpcre 8.35 (especially on debian) has a known issue that results in segfaults |
491 | # see https://redmine.openinfosecfoundation.org/issues/1693 | |
c8399e8c AH |
492 | if test "$with_libpcre_libraries" = "no"; then |
493 | PKG_CHECK_MODULES(LIBPCREVERSION, [libpcre = 8.35],[libpcre_buggy_found="yes"],[libprce_buggy_found="no"]) | |
494 | if test "$libpcre_buggy_found" = "yes"; then | |
495 | echo | |
496 | echo " Warning! vulnerable libpcre version 8.35 found" | |
497 | echo " This version has a known issue that could result in segfaults" | |
498 | echo " please upgrade to a newer version of pcre which you can get from" | |
499 | echo " www.pcre.org. For more information, see issue #1693" | |
500 | echo | |
501 | echo " Continuing for now with JIT disabled..." | |
502 | echo | |
503 | fi | |
8c0e5750 AH |
504 | fi |
505 | ||
89f83c2e VJ |
506 | # To prevent duping the lib link we reset LIBS after this check. Setting action-if-found to NULL doesn't seem to work |
507 | # see: http://blog.flameeyes.eu/2008/04/29/i-consider-ac_check_lib-harmful | |
508 | PCRE="" | |
509 | TMPLIBS="${LIBS}" | |
510 | AC_CHECK_LIB(pcre, pcre_dfa_exec,, PCRE="no") | |
a3510f20 | 511 | if test "$PCRE" = "no"; then |
89f83c2e VJ |
512 | echo |
513 | echo " ERROR! pcre library was found but version was < 6.0" | |
514 | echo " please upgrade to a newer version of pcre which you can get from" | |
515 | echo " www.pcre.org." | |
516 | echo | |
517 | exit 1 | |
a3510f20 | 518 | fi |
89f83c2e | 519 | LIBS="${TMPLIBS}" |
6899b3da | 520 | |
89f83c2e VJ |
521 | AC_TRY_COMPILE([ #include <pcre.h> ], |
522 | [ int eo = 0; eo |= PCRE_EXTRA_MATCH_LIMIT_RECURSION; ], | |
523 | [ pcre_match_limit_recursion_available=yes ], [:] | |
524 | ) | |
525 | if test "$pcre_match_limit_recursion_available" != "yes"; then | |
89f83c2e VJ |
526 | echo |
527 | echo " Warning! pcre extra opt PCRE_EXTRA_MATCH_LIMIT_RECURSION not found" | |
528 | echo " This could lead to potential DoS please upgrade to pcre >= 6.5" | |
89f83c2e | 529 | echo " from www.pcre.org." |
ba81c4d2 | 530 | echo " Continuing for now...." |
89f83c2e | 531 | echo |
ba81c4d2 | 532 | AC_DEFINE([NO_PCRE_MATCH_RLIMIT],[1],[Pcre PCRE_EXTRA_MATCH_LIMIT_RECURSION not available]) |
89f83c2e | 533 | fi |
5bde1217 | 534 | |
0bfba835 VJ |
535 | TMPCFLAGS="${CFLAGS}" |
536 | CFLAGS="-O0 -g -Werror -Wall" | |
537 | AC_TRY_COMPILE([ #include <pcre.h> ], | |
538 | [ pcre_extra *extra = NULL; pcre_free_study(extra); ], | |
539 | [ AC_DEFINE([HAVE_PCRE_FREE_STUDY], [1], [Pcre pcre_free_study supported])], [:] | |
540 | ) | |
541 | CFLAGS="${TMPCFLAGS}" | |
542 | ||
3d396e8b | 543 | #enable support for PCRE-jit available since pcre-8.20 |
3d558bf0 EL |
544 | AC_MSG_CHECKING(for PCRE JIT support) |
545 | AC_TRY_COMPILE([ #include <pcre.h> ], | |
546 | [ | |
547 | int jit = 0; | |
548 | pcre_config(PCRE_CONFIG_JIT, &jit); | |
549 | ], | |
550 | [ pcre_jit_available=yes ], [ pcre_jit_available=no ] | |
551 | ) | |
552 | ||
bc480fa8 VJ |
553 | case $host in |
554 | *powerpc64*) | |
cee5c9fa VJ |
555 | PKG_CHECK_MODULES(LIBPCREVERSION, [libpcre = 8.39],[libpcre_ppc64_buggy_found1="yes"],[libprce_ppc64_buggy_found1="no"]) |
556 | PKG_CHECK_MODULES(LIBPCREVERSION, [libpcre = 8.40],[libpcre_ppc64_buggy_found2="yes"],[libprce_ppc64_buggy_found2="no"]) | |
557 | ||
558 | if test "$libprce_ppc64_buggy_found1" = "yes" || test "$libprce_ppc64_buggy_found2"; then | |
559 | # on powerpc64, both gcc and clang lead to SIGILL in | |
560 | # unittests when jit is enabled. | |
561 | pcre_jit_available="no, pcre 8.39/8.40 jit disabled for powerpc64" | |
562 | fi | |
bc480fa8 VJ |
563 | ;; |
564 | *) | |
565 | # bug 1693, libpcre 8.35 is broken and debian jessie is still using that | |
566 | if test "$libpcre_buggy_found" = "yes"; then | |
567 | pcre_jit_available="no, libpcre 8.35 blacklisted" | |
568 | fi | |
569 | ;; | |
570 | esac | |
e51707be | 571 | |
3d558bf0 EL |
572 | if test "x$pcre_jit_available" = "xyes"; then |
573 | AC_MSG_RESULT(yes) | |
574 | AC_DEFINE([PCRE_HAVE_JIT], [1], [Pcre with JIT compiler support enabled]) | |
575 | ||
576 | AC_MSG_CHECKING(for PCRE JIT support usability) | |
577 | AC_TRY_COMPILE([ #include <pcre.h> ], | |
578 | [ | |
579 | const char* regexstr = "(a|b|c|d)"; | |
580 | pcre *re; | |
581 | const char *error; | |
582 | pcre_extra *extra; | |
583 | int err_offset; | |
584 | re = pcre_compile(regexstr,0, &error, &err_offset,NULL); | |
585 | extra = pcre_study(re, PCRE_STUDY_JIT_COMPILE, &error); | |
586 | if (extra == NULL) | |
587 | exit(EXIT_FAILURE); | |
588 | int jit = 0; | |
589 | int ret = pcre_fullinfo(re, extra, PCRE_INFO_JIT, &jit); | |
590 | if (ret != 0 || jit != 1) | |
591 | exit(EXIT_FAILURE); | |
592 | exit(EXIT_SUCCESS); | |
593 | ], | |
594 | [ pcre_jit_works=yes ], [:] | |
595 | ) | |
596 | if test "x$pcre_jit_works" != "xyes"; then | |
597 | AC_MSG_RESULT(no) | |
598 | echo | |
599 | echo " PCRE JIT support detection worked but testing it failed" | |
600 | echo " something odd is going on, please file a bug report." | |
601 | echo | |
602 | exit 1 | |
603 | else | |
604 | AC_MSG_RESULT(yes) | |
605 | fi | |
5ea1b1d1 | 606 | else |
89f83c2e | 607 | AC_MSG_RESULT(no) |
3d558bf0 | 608 | fi |
3d396e8b | 609 | |
13b87f5a JV |
610 | # libhs |
611 | enable_hyperscan="no" | |
612 | ||
613 | # Try pkg-config first: | |
614 | PKG_CHECK_MODULES([libhs], libhs,, [with_pkgconfig_libhs=no]) | |
615 | if test "$with_pkgconfig_libhs" != "no"; then | |
616 | CPPFLAGS="${CPPFLAGS} ${libhs_CFLAGS}" | |
617 | LIBS="${LIBS} ${libhs_LIBS}" | |
618 | fi | |
619 | ||
620 | AC_ARG_WITH(libhs_includes, | |
621 | [ --with-libhs-includes=DIR libhs include directory], | |
622 | [with_libhs_includes="$withval"],[with_libhs_includes=no]) | |
623 | AC_ARG_WITH(libhs_libraries, | |
624 | [ --with-libhs-libraries=DIR libhs library directory], | |
625 | [with_libhs_libraries="$withval"],[with_libhs_libraries="no"]) | |
626 | ||
627 | if test "$with_libhs_includes" != "no"; then | |
628 | CPPFLAGS="${CPPFLAGS} -I${with_libhs_includes}" | |
629 | fi | |
630 | AC_CHECK_HEADER(hs.h,HYPERSCAN="yes",HYPERSCAN="no") | |
631 | if test "$HYPERSCAN" = "yes"; then | |
632 | if test "$with_libhs_libraries" != "no"; then | |
633 | LDFLAGS="${LDFLAGS} -L${with_libhs_libraries}" | |
634 | fi | |
635 | ||
636 | AC_CHECK_LIB(hs,hs_compile,,HYPERSCAN="no") | |
e6044aaf | 637 | AC_CHECK_FUNCS(hs_valid_platform) |
13b87f5a JV |
638 | enable_hyperscan="yes" |
639 | if test "$HYPERSCAN" = "no"; then | |
640 | echo | |
641 | echo " Hyperscan headers are present, but link test failed." | |
642 | echo " Check that you have a shared library and C++ linkage available." | |
643 | echo | |
644 | enable_hyperscan="no" | |
645 | fi | |
646 | fi | |
647 | AS_IF([test "x$enable_hyperscan" = "xyes"], [AC_DEFINE([BUILD_HYPERSCAN], [1], [Intel Hyperscan support enabled])]) | |
648 | ||
89cee0ad | 649 | # libyaml |
c91a4baa JI |
650 | AC_ARG_WITH(libyaml_includes, |
651 | [ --with-libyaml-includes=DIR libyaml include directory], | |
652 | [with_libyaml_includes="$withval"],[with_libyaml_includes=no]) | |
653 | AC_ARG_WITH(libyaml_libraries, | |
654 | [ --with-libyaml-libraries=DIR libyaml library directory], | |
655 | [with_libyaml_libraries="$withval"],[with_libyaml_libraries="no"]) | |
656 | ||
657 | if test "$with_libyaml_includes" != "no"; then | |
89f83c2e | 658 | CPPFLAGS="${CPPFLAGS} -I${with_libyaml_includes}" |
c91a4baa JI |
659 | fi |
660 | ||
661 | AC_CHECK_HEADER(yaml.h,,LIBYAML="no") | |
662 | ||
663 | if test "$with_libyaml_libraries" != "no"; then | |
ba81c4d2 | 664 | LDFLAGS="${LDFLAGS} -L${with_libyaml_libraries}" |
c91a4baa JI |
665 | fi |
666 | ||
667 | LIBYAML="" | |
668 | AC_CHECK_LIB(yaml,yaml_parser_initialize,,LIBYAML="no") | |
669 | ||
670 | if test "$LIBYAML" = "no"; then | |
89cee0ad VJ |
671 | echo |
672 | echo " ERROR! libyaml library not found, go get it" | |
673 | echo " from http://pyyaml.org/wiki/LibYAML " | |
674 | echo " or your distribution:" | |
675 | echo | |
676 | echo " Ubuntu: apt-get install libyaml-dev" | |
677 | echo " Fedora: yum install libyaml-devel" | |
678 | echo | |
679 | exit 1 | |
c91a4baa JI |
680 | fi |
681 | ||
89cee0ad | 682 | # libpthread |
a3510f20 WM |
683 | AC_ARG_WITH(libpthread_includes, |
684 | [ --with-libpthread-includes=DIR libpthread include directory], | |
685 | [with_libpthread_includes="$withval"],[with_libpthread_includes=no]) | |
686 | AC_ARG_WITH(libpthread_libraries, | |
687 | [ --with-libpthread-libraries=DIR libpthread library directory], | |
688 | [with_libpthread_libraries="$withval"],[with_libpthread_libraries="no"]) | |
689 | ||
690 | if test "$with_libpthread_includes" != "no"; then | |
89f83c2e | 691 | CPPFLAGS="${CPPFLAGS} -I${with_libpthread_includes}" |
a3510f20 | 692 | fi |
6899b3da | 693 | |
fa5939ca | 694 | dnl AC_CHECK_HEADER(pthread.h,,[AC_ERROR(pthread.h not found ...)]) |
6899b3da | 695 | |
a3510f20 | 696 | if test "$with_libpthread_libraries" != "no"; then |
89f83c2e | 697 | LDFLAGS="${LDFLAGS} -L${with_libpthread_libraries}" |
a3510f20 | 698 | fi |
6899b3da | 699 | |
a3510f20 WM |
700 | PTHREAD="" |
701 | AC_CHECK_LIB(pthread, pthread_create,, PTHREAD="no") | |
6899b3da | 702 | |
a3510f20 | 703 | if test "$PTHREAD" = "no"; then |
89f83c2e VJ |
704 | echo |
705 | echo " ERROR! libpthread library not found, glibc problem?" | |
706 | echo | |
707 | exit 1 | |
a3510f20 WM |
708 | fi |
709 | ||
20a8b9db EL |
710 | # libjansson |
711 | enable_jansson="no" | |
712 | AC_ARG_WITH(libjansson_includes, | |
713 | [ --with-libjansson-includes=DIR libjansson include directory], | |
714 | [with_libjansson_includes="$withval"],[with_libjansson_includes=no]) | |
715 | AC_ARG_WITH(libjansson_libraries, | |
716 | [ --with-libjansson-libraries=DIR libjansson library directory], | |
717 | [with_libjansson_libraries="$withval"],[with_libjansson_libraries="no"]) | |
718 | ||
719 | if test "$with_libjansson_includes" != "no"; then | |
720 | CPPFLAGS="${CPPFLAGS} -I${with_libjansson_includes}" | |
721 | fi | |
722 | ||
723 | enable_jansson="no" | |
724 | enable_unixsocket="no" | |
7d706563 EL |
725 | |
726 | AC_ARG_ENABLE(unix-socket, | |
727 | AS_HELP_STRING([--enable-unix-socket], [Enable unix socket [default=test]]),[enable_unixsocket="$enableval"],[enable_unixsocket=test]) | |
728 | ||
20a8b9db EL |
729 | AC_CHECK_HEADER(jansson.h,JANSSON="yes",JANSSON="no") |
730 | if test "$JANSSON" = "yes"; then | |
731 | if test "$with_libjansson_libraries" != "no"; then | |
732 | LDFLAGS="${LDFLAGS} -L${with_libjansson_libraries}" | |
733 | fi | |
734 | ||
0470c0f6 | 735 | AC_CHECK_LIB(jansson, json_dump_callback,, JANSSON="no") |
20a8b9db EL |
736 | enable_jansson="yes" |
737 | if test "$JANSSON" = "no"; then | |
738 | echo | |
0470c0f6 | 739 | echo " Jansson >= 2.2 is required for features like unix socket" |
42227e87 | 740 | echo " Go get it from your distribution or from:" |
7d706563 | 741 | echo " http://www.digip.org/jansson/" |
20a8b9db | 742 | echo |
ba81c4d2 | 743 | if test "x$enable_unixsocket" = "xyes"; then |
7d706563 EL |
744 | exit 1 |
745 | fi | |
20a8b9db EL |
746 | enable_unixsocket="no" |
747 | enable_jansson="no" | |
748 | else | |
749 | case $host in | |
750 | *-*-mingw32*) | |
ba81c4d2 | 751 | ;; |
20a8b9db | 752 | *-*-cygwin) |
ba81c4d2 | 753 | ;; |
20a8b9db | 754 | *) |
ba81c4d2 VJ |
755 | if test "x$enable_unixsocket" = "xtest"; then |
756 | enable_unixsocket="yes" | |
757 | fi | |
758 | ;; | |
20a8b9db EL |
759 | esac |
760 | fi | |
7d706563 EL |
761 | else |
762 | if test "x$enable_unixsocket" = "xyes"; then | |
763 | echo | |
764 | echo " Jansson >= 2.2 is required for features like unix socket" | |
42227e87 | 765 | echo " Go get it from your distribution or from:" |
7d706563 EL |
766 | echo " http://www.digip.org/jansson/" |
767 | echo | |
768 | exit 1 | |
769 | fi | |
770 | enable_unixsocket="no" | |
20a8b9db EL |
771 | fi |
772 | ||
773 | AS_IF([test "x$enable_unixsocket" = "xyes"], [AC_DEFINE([BUILD_UNIX_SOCKET], [1], [Unix socket support enabled])]) | |
f55dbca5 | 774 | e_enable_evelog=$enable_jansson |
20a8b9db | 775 | |
5f4b745f EL |
776 | AC_ARG_ENABLE(nflog, |
777 | AS_HELP_STRING([--enable-nflog],[Enable libnetfilter_log support]), | |
778 | [ enable_nflog="yes"], | |
779 | [ enable_nflog="no"]) | |
780 | AC_ARG_ENABLE(nfqueue, | |
781 | AS_HELP_STRING([--enable-nfqueue], [Enable NFQUEUE support for inline IDP]),[enable_nfqueue=yes],[enable_nfqueue=no]) | |
15766ce2 AH |
782 | if test "$enable_nfqueue" != "no"; then |
783 | PKG_CHECK_MODULES([libnetfilter_queue], [libnetfilter_queue], [enable_nfqueue=yes], [enable_nfqueue=no]) | |
784 | CPPFLAGS="${CPPFLAGS} ${libnetfilter_queue_CFLAGS}" | |
785 | fi | |
0ffa1c24 | 786 | |
5f4b745f EL |
787 | if test "x$enable_nflog" = "xyes" || test "x$enable_nfqueue" = "xyes"; then |
788 | # libnfnetlink | |
789 | case $host in | |
790 | *-*-mingw32*) | |
791 | ;; | |
792 | *) | |
793 | AC_ARG_WITH(libnfnetlink_includes, | |
794 | [ --with-libnfnetlink-includes=DIR libnfnetlink include directory], | |
795 | [with_libnfnetlink_includes="$withval"],[with_libnfnetlink_includes=no]) | |
796 | AC_ARG_WITH(libnfnetlink_libraries, | |
797 | [ --with-libnfnetlink-libraries=DIR libnfnetlink library directory], | |
798 | [with_libnfnetlink_libraries="$withval"],[with_libnfnetlink_libraries="no"]) | |
799 | ||
800 | if test "$with_libnfnetlink_includes" != "no"; then | |
801 | CPPFLAGS="${CPPFLAGS} -I${with_libnfnetlink_includes}" | |
802 | fi | |
0ffa1c24 | 803 | |
5f4b745f EL |
804 | if test "$with_libnfnetlink_libraries" != "no"; then |
805 | LDFLAGS="${LDFLAGS} -L${with_libnfnetlink_libraries}" | |
806 | fi | |
0ffa1c24 | 807 | |
5f4b745f EL |
808 | NFNL="" |
809 | AC_CHECK_LIB(nfnetlink, nfnl_fd,, NFNL="no") | |
810 | ||
811 | if test "$NFNL" = "no"; then | |
812 | echo | |
813 | echo " ERROR! nfnetlink library not found, go get it" | |
814 | echo " from www.netfilter.org." | |
815 | echo " we automatically append libnetfilter_queue/ when searching" | |
816 | echo " for headers etc. when the --with-libnfnetlink-includes directive" | |
817 | echo " is used" | |
818 | echo | |
819 | fi | |
820 | ;; | |
821 | esac | |
822 | fi | |
0ffa1c24 | 823 | |
ba81c4d2 | 824 | # enable support for NFQUEUE |
3ff5dc36 | 825 | if test "x$enable_nfqueue" = "xyes"; then |
ba81c4d2 | 826 | AC_DEFINE_UNQUOTED([NFQ],[1],[Enable Linux Netfilter NFQUEUE support for inline IDP]) |
4851568a | 827 | |
3ff5dc36 VJ |
828 | #libnetfilter_queue |
829 | AC_ARG_WITH(libnetfilter_queue_includes, | |
a3510f20 WM |
830 | [ --with-libnetfilter_queue-includes=DIR libnetfilter_queue include directory], |
831 | [with_libnetfilter_queue_includes="$withval"],[with_libnetfilter_queue_includes=no]) | |
3ff5dc36 | 832 | AC_ARG_WITH(libnetfilter_queue_libraries, |
a3510f20 WM |
833 | [ --with-libnetfilter_queue-libraries=DIR libnetfilter_queue library directory], |
834 | [with_libnetfilter_queue_libraries="$withval"],[with_libnetfilter_queue_libraries="no"]) | |
835 | ||
3ff5dc36 VJ |
836 | if test "$with_libnetfilter_queue_includes" != "no"; then |
837 | CPPFLAGS="${CPPFLAGS} -I${with_libnetfilter_queue_includes}" | |
838 | fi | |
366671a8 | 839 | |
3ff5dc36 | 840 | AC_CHECK_HEADER(libnetfilter_queue/libnetfilter_queue.h,,[AC_ERROR(libnetfilter_queue/libnetfilter_queue.h not found ...)]) |
366671a8 | 841 | |
3ff5dc36 VJ |
842 | if test "$with_libnetfilter_queue_libraries" != "no"; then |
843 | LDFLAGS="${LDFLAGS} -L${with_libnetfilter_queue_libraries}" | |
89cee0ad | 844 | fi |
3ff5dc36 VJ |
845 | |
846 | NFQ="" | |
89cee0ad VJ |
847 | AC_CHECK_LIB(netfilter_queue, nfq_open,, NFQ="no",) |
848 | 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]) | |
849 | 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 | 850 | 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 | 851 | 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 |
852 | |
853 | # check if the argument to nfq_get_payload is signed or unsigned | |
854 | AC_MSG_CHECKING([for signed nfq_get_payload payload argument]) | |
855 | STORECFLAGS="${CFLAGS}" | |
adbf85c4 EL |
856 | if test `basename $CC` = "clang"; then |
857 | CFLAGS="${CFLAGS} -Werror=incompatible-pointer-types" | |
858 | else | |
58bf4ea4 | 859 | CFLAGS="${CFLAGS} -Werror" |
adbf85c4 | 860 | fi |
89cee0ad | 861 | AC_COMPILE_IFELSE( |
c9f9e3f9 VJ |
862 | [AC_LANG_PROGRAM( |
863 | [ | |
3ff5dc36 VJ |
864 | #include <stdio.h> |
865 | #include <libnetfilter_queue/libnetfilter_queue.h> | |
c9f9e3f9 VJ |
866 | ], |
867 | [ | |
3ff5dc36 VJ |
868 | char *pktdata; |
869 | nfq_get_payload(NULL, &pktdata); | |
c9f9e3f9 VJ |
870 | ])], |
871 | [libnetfilter_queue_nfq_get_payload_signed="yes"], | |
872 | [libnetfilter_queue_nfq_get_payload_signed="no"]) | |
89cee0ad VJ |
873 | AC_MSG_RESULT($libnetfilter_queue_nfq_get_payload_signed) |
874 | if test "x$libnetfilter_queue_nfq_get_payload_signed" = "xyes"; then | |
adbf85c4 | 875 | AC_DEFINE([NFQ_GET_PAYLOAD_SIGNED], [1], [For signed version of nfq_get_payload]) |
89cee0ad VJ |
876 | fi |
877 | CFLAGS="${STORECFLAGS}" | |
0ffa1c24 | 878 | |
3ff5dc36 VJ |
879 | if test "$NFQ" = "no"; then |
880 | echo | |
881 | echo " ERROR! libnetfilter_queue library not found, go get it" | |
882 | echo " from www.netfilter.org." | |
883 | echo " we automatically append libnetfilter_queue/ when searching" | |
884 | echo " for headers etc. when the --with-libnfq-includes directive" | |
885 | echo " is used" | |
886 | echo | |
887 | exit 1 | |
888 | fi | |
a3510f20 | 889 | fi |
2b7b78f1 | 890 | |
4851568a | 891 | # libnetfilter_log |
4851568a GL |
892 | AC_ARG_WITH(libnetfilter_log_includes, |
893 | [ --with-libnetfilter_log-includes=DIR libnetfilter_log include directory], | |
894 | [with_libnetfilter_log_includes="$withval"],[with_libnetfilter_log_includes="no"]) | |
895 | AC_ARG_WITH(libnetfilter_log_libraries, | |
896 | [ --with-libnetfilter_log-libraries=DIR libnetfilter_log library directory], | |
897 | [with_libnetfilter_log_libraries="$withval"],[with_libnetfilter_log_libraries="no"]) | |
898 | ||
899 | if test "$enable_nflog" = "yes"; then | |
900 | if test "$with_libnetfilter_log_includes" != "no"; then | |
901 | CPPFLAGS="${CPPFLAGS} -I${with_libnetfilter_log_includes}" | |
902 | fi | |
903 | ||
904 | AC_CHECK_HEADER(libnetfilter_log/libnetfilter_log.h,,[AC_ERROR(libnetfilter_log.h not found ...)]) | |
905 | ||
906 | if test "$with_libnetfilter_log_libraries" != "no"; then | |
907 | LDFLAGS="${LDFLAGS} -L${with_libnetfilter_log_libraries}" | |
908 | fi | |
909 | ||
910 | NFLOG="" | |
911 | AC_CHECK_LIB(netfilter_log, nflog_open,, NFLOG="no") | |
912 | ||
913 | if test "$NFLOG" = "no"; then | |
914 | echo | |
915 | echo " ERROR! libnetfilter_log library not found, go get it" | |
916 | echo " from http://www.netfilter.org." | |
917 | echo | |
918 | exit 1 | |
919 | else | |
920 | AC_DEFINE([HAVE_NFLOG],[1],[nflog available]) | |
921 | enable_nflog="yes" | |
922 | fi | |
923 | fi | |
924 | ||
89cee0ad | 925 | # prelude |
eb33dc16 | 926 | AC_ARG_ENABLE(prelude, |
e07e9e16 | 927 | AS_HELP_STRING([--enable-prelude], [Enable Prelude support for alerts]),,[enable_prelude=no]) |
f0c785cc KS |
928 | # Prelude doesn't work with -Werror |
929 | STORECFLAGS="${CFLAGS}" | |
930 | CFLAGS="${CFLAGS} -Wno-error=unused-result" | |
931 | ||
4e84ffe2 | 932 | AS_IF([test "x$enable_prelude" = "xyes"], [ |
eb33dc16 PC |
933 | AM_PATH_LIBPRELUDE(0.9.9, , AC_MSG_ERROR(Cannot find libprelude: Is libprelude-config in the path?), no) |
934 | if test "x${LIBPRELUDE_CFLAGS}" != "x"; then | |
935 | CPPFLAGS="${CPPFLAGS} ${LIBPRELUDE_CFLAGS}" | |
936 | fi | |
937 | ||
938 | if test "x${LIBPRELUDE_LDFLAGS}" != "x"; then | |
939 | LDFLAGS="${LDFLAGS} ${LIBPRELUDE_LDFLAGS}" | |
940 | fi | |
941 | ||
942 | if test "x${LIBPRELUDE_LIBS}" != "x"; then | |
943 | LDFLAGS="${LDFLAGS} ${LIBPRELUDE_LIBS}" | |
944 | fi | |
8623b8f9 | 945 | AC_DEFINE([PRELUDE], [1], [Libprelude support enabled]) |
4e84ffe2 | 946 | ]) |
f0c785cc KS |
947 | CFLAGS="${STORECFLAGS}" |
948 | ||
eb33dc16 | 949 | |
89cee0ad | 950 | # libnet |
a3510f20 WM |
951 | AC_ARG_WITH(libnet_includes, |
952 | [ --with-libnet-includes=DIR libnet include directory], | |
953 | [with_libnet_includes="$withval"],[with_libnet_includes="no"]) | |
954 | ||
955 | AC_ARG_WITH(libnet_libraries, | |
956 | [ --with-libnet-libraries=DIR libnet library directory], | |
957 | [with_libnet_libraries="$withval"],[with_libnet_libraries="no"]) | |
958 | ||
959 | if test "x$with_libnet_includes" != "xno"; then | |
3678dda1 WM |
960 | CPPFLAGS="${CPPFLAGS} -I${with_libnet_includes}" |
961 | libnet_dir="${with_libnet_includes}" | |
f7111f38 | 962 | else |
829238e4 | 963 | libnet_dir="/usr/include /usr/local/include /usr/local/include/libnet11 /opt/local/include /usr/local/include/libnet-1.1" |
a3510f20 | 964 | fi |
0ffa1c24 | 965 | |
a3510f20 | 966 | if test "x$with_libnet_libraries" != "xno"; then |
3678dda1 | 967 | LDFLAGS="${LDFLAGS} -L${with_libnet_libraries}" |
a3510f20 WM |
968 | fi |
969 | ||
3678dda1 | 970 | LIBNET_DETECT_FAIL="no" |
a3510f20 | 971 | LIBNET_INC_DIR="" |
3678dda1 | 972 | |
a3510f20 WM |
973 | for i in $libnet_dir; do |
974 | if test -r "$i/libnet.h"; then | |
3678dda1 | 975 | LIBNET_INC_DIR="$i" |
a3510f20 WM |
976 | fi |
977 | done | |
978 | ||
439b62fe | 979 | enable_libnet="no" |
3678dda1 | 980 | AC_MSG_CHECKING(for libnet.h version 1.1.x) |
a3510f20 | 981 | if test "$LIBNET_INC_DIR" != ""; then |
365015c2 AG |
982 | LIBNET_VER=`grep LIBNET_VERSION $LIBNET_INC_DIR/libnet.h | grep '1.[[12]]' | sed 's/[[^"]]*"\([[^"]]*\).*/\1/'` |
983 | ||
984 | if test -z "$LIBNET_VER" ; then | |
3678dda1 | 985 | AC_MSG_RESULT(no) |
3678dda1 WM |
986 | else |
987 | AC_MSG_RESULT(yes) | |
988 | fi | |
6e8c75ff | 989 | |
3678dda1 WM |
990 | #CentOS, Fedora, Ubuntu-LTS, Ubuntu all set defines to the same values. libnet-config seems |
991 | #to have been depreciated but all distro's seem to include it as part of the package. | |
992 | if test "$LIBNET_DETECT_FAIL" = "no"; then | |
993 | LLIBNET="" | |
994 | AC_CHECK_LIB(net, libnet_write,, LLIBNET="no") | |
995 | if test "$LLIBNET" != "no"; then | |
ba81c4d2 VJ |
996 | AC_DEFINE([HAVE_LIBNET11],[1],(libnet 1.1 available)) |
997 | AC_DEFINE([_DEFAULT_SOURCE],[1],(default source)) | |
998 | AC_DEFINE([_BSD_SOURCE],[1],(bsd source)) | |
999 | AC_DEFINE([__BSD_SOURCE],[1],(bsd source)) | |
1000 | AC_DEFINE([__FAVOR_BSD],[1],(favor bsd)) | |
1001 | AC_DEFINE([HAVE_NET_ETHERNET_H],[1],(ethernet.h)) | |
439b62fe | 1002 | enable_libnet="yes" |
3678dda1 WM |
1003 | fi |
1004 | ||
1005 | # see if we have the patched libnet 1.1 | |
1006 | # http://www.inliniac.net/blog/2007/10/16/libnet-11-ipv6-fixes-and-additions.html | |
1007 | # | |
1008 | # To prevent duping the lib link we reset LIBS after this check. Setting action-if-found to NULL doesn't seem to work | |
1009 | # see: http://blog.flameeyes.eu/2008/04/29/i-consider-ac_check_lib-harmful | |
439b62fe | 1010 | if test "$enable_libnet" = "yes"; then |
3678dda1 WM |
1011 | LLIBNET="" |
1012 | TMPLIBS="${LIBS}" | |
1013 | AC_CHECK_LIB(net, libnet_build_icmpv6_unreach,, LLIBNET="no") | |
1014 | if test "$LLIBNET" != "no"; then | |
ba81c4d2 | 1015 | AC_DEFINE([HAVE_LIBNET_ICMPV6_UNREACH],[1],(libnet_build_icmpv6_unreach available)) |
3678dda1 WM |
1016 | fi |
1017 | LIBS="${TMPLIBS}" | |
1018 | fi | |
365015c2 AG |
1019 | |
1020 | # See if we have libnet 1.1.6 or newer - these versions handle capabilities correctly | |
1021 | # Some patched 1.1.4 versions are also good, but it's not guaranteed for all distros. | |
1022 | # | |
1023 | # Details: https://bugzilla.redhat.com/show_bug.cgi?id=589770 | |
1024 | AS_VERSION_COMPARE([LIBNET_VER], [1.1.6], | |
1025 | [], | |
1026 | [AC_DEFINE([HAVE_LIBNET_CAPABILITIES],[1], (libnet_have_capabilities_patch))], | |
1027 | [AC_DEFINE([HAVE_LIBNET_CAPABILITIES],[1], (libnet_have_capabilities_patch))]) | |
66346e46 VJ |
1028 | |
1029 | ||
1030 | # check if the argument to libnet_init is char* or const char* | |
1031 | AC_MSG_CHECKING([libnet_init dev type]) | |
1032 | STORECFLAGS="${CFLAGS}" | |
1033 | if test `basename $CC` = "clang"; then | |
1034 | CFLAGS="${CFLAGS} -Werror=incompatible-pointer-types" | |
1035 | else | |
1036 | CFLAGS="${CFLAGS} -Werror" | |
1037 | fi | |
1038 | AC_COMPILE_IFELSE( | |
1039 | [AC_LANG_PROGRAM( | |
1040 | [ | |
1041 | #include <stdio.h> | |
1042 | #include <libnet.h> | |
1043 | ], | |
1044 | [[ | |
1045 | const char dev[32] = ""; | |
1046 | char ebuf[LIBNET_ERRBUF_SIZE]; | |
1047 | (void)libnet_init(LIBNET_LINK, dev, ebuf); | |
1048 | ]])], | |
1049 | [libnet_init_const="yes"], | |
1050 | [libnet_init_const="no"]) | |
1051 | AC_MSG_RESULT($libnet_init_const) | |
1052 | if test "x$libnet_init_const" = "xyes"; then | |
1053 | AC_DEFINE([HAVE_LIBNET_INIT_CONST], [1], [libnet_init takes const argument]) | |
1054 | fi | |
1055 | CFLAGS="${STORECFLAGS}" | |
3678dda1 | 1056 | fi |
a3510f20 | 1057 | else |
439b62fe | 1058 | AC_MSG_RESULT(no) |
a3510f20 | 1059 | fi |
0d15d4f6 MK |
1060 | |
1061 | # libpcap | |
1062 | AC_ARG_WITH(libpcap_includes, | |
1063 | [ --with-libpcap-includes=DIR libpcap include directory], | |
1064 | [with_libpcap_includes="$withval"],[with_libpcap_includes=no]) | |
1065 | AC_ARG_WITH(libpcap_libraries, | |
1066 | [ --with-libpcap-libraries=DIR libpcap library directory], | |
1067 | [with_libpcap_libraries="$withval"],[with_libpcap_libraries="no"]) | |
1068 | ||
1069 | if test "$with_libpcap_includes" != "no"; then | |
1070 | CPPFLAGS="${CPPFLAGS} -I${with_libpcap_includes}" | |
1071 | fi | |
1072 | ||
1073 | AC_CHECK_HEADER(pcap.h,,[AC_ERROR(pcap.h not found ...)]) | |
1074 | ||
1075 | if test "$with_libpcap_libraries" != "no"; then | |
1076 | LDFLAGS="${LDFLAGS} -L${with_libpcap_libraries}" | |
1077 | fi | |
1078 | AC_CHECK_HEADERS([pcap.h pcap/pcap.h pcap/bpf.h]) | |
1079 | ||
1080 | LIBPCAP="" | |
9858ae41 | 1081 | AC_CHECK_LIB(pcap, pcap_open_live,, LIBPCAP="no") |
0d15d4f6 MK |
1082 | if test "$LIBPCAP" = "no"; then |
1083 | echo | |
1084 | echo " ERROR! libpcap library not found, go get it" | |
1085 | echo " from http://www.tcpdump.org or your distribution:" | |
1086 | echo | |
1087 | echo " Ubuntu: apt-get install libpcap-dev" | |
1088 | echo " Fedora: yum install libpcap-devel" | |
1089 | echo | |
1090 | exit 1 | |
1091 | fi | |
1092 | ||
1093 | # pcap_activate and pcap_create only exists in libpcap >= 1.0 | |
1094 | LIBPCAPVTEST="" | |
1095 | #To prevent duping the lib link we reset LIBS after this check. Setting action-if-found to NULL doesn't seem to work | |
1096 | #see: http://blog.flameeyes.eu/2008/04/29/i-consider-ac_check_lib-harmful | |
1097 | TMPLIBS="${LIBS}" | |
1098 | AC_CHECK_LIB(pcap, pcap_activate,, LPCAPVTEST="no") | |
cda6e029 VJ |
1099 | if test "$LPCAPVTEST" = "no"; then |
1100 | echo | |
1101 | echo " ERROR! libpcap library too old, need at least 1+, " | |
1102 | echo " go get it from http://www.tcpdump.org or your distribution:" | |
1103 | echo | |
1104 | echo " Ubuntu: apt-get install libpcap-dev" | |
1105 | echo " Fedora: yum install libpcap-devel" | |
1106 | echo | |
1107 | exit 1 | |
1108 | fi | |
1109 | AC_PATH_PROG(HAVE_PCAP_CONFIG, pcap-config, "no") | |
1110 | if test "$HAVE_PCAP_CONFIG" = "no" -o "$cross_compiling" = "yes"; then | |
1111 | AC_MSG_RESULT(no pcap-config is use) | |
0d15d4f6 | 1112 | else |
cda6e029 VJ |
1113 | PCAP_CFLAGS="$(pcap-config --defines) $(pcap-config --cflags)" |
1114 | AC_SUBST(PCAP_CFLAGS) | |
0d15d4f6 MK |
1115 | fi |
1116 | LIBS="${TMPLIBS}" | |
1117 | ||
1118 | #Appears as if pcap_set_buffer_size is linux only? | |
1119 | LIBPCAPSBUFF="" | |
1120 | #To prevent duping the lib link we reset LIBS after this check. Setting action-if-found to NULL doesn't seem to work | |
1121 | #see: http://blog.flameeyes.eu/2008/04/29/i-consider-ac_check_lib-harmful | |
1122 | TMPLIBS="${LIBS}" | |
1123 | AC_CHECK_LIB(pcap, pcap_set_buffer_size,, LPCAPSBUFF="no") | |
1124 | if test "$LPCAPSBUFF" != "no"; then | |
ba81c4d2 | 1125 | AC_DEFINE([HAVE_PCAP_SET_BUFF],[1],(libpcap has pcap_set_buffer_size function)) |
0d15d4f6 MK |
1126 | fi |
1127 | LIBS="${TMPLIBS}" | |
1128 | ||
1129 | # libpfring | |
89cee0ad VJ |
1130 | # libpfring (currently only supported for libpcap enabled pfring) |
1131 | # Error on the side of caution. If libpfring enabled pcap is being used and we don't link against -lpfring compilation will fail. | |
04b0f177 | 1132 | AC_ARG_ENABLE(pfring, |
e07e9e16 WM |
1133 | AS_HELP_STRING([--enable-pfring], [Enable Native PF_RING support]),,[enable_pfring=no]) |
1134 | AS_IF([test "x$enable_pfring" = "xyes"], [ | |
ba81c4d2 | 1135 | AC_DEFINE([HAVE_PFRING],[1],(PF_RING support enabled)) |
ddf995da | 1136 | |
89cee0ad | 1137 | #We have to set CFLAGS for AC_TRY_COMPILE as it doesn't pay attention to CPPFLAGS |
6408feba W |
1138 | AC_ARG_WITH(libpfring_includes, |
1139 | [ --with-libpfring-includes=DIR libpfring include directory], | |
1140 | [with_libpfring_includes="$withval"],[with_libpfring_includes=no]) | |
1141 | AC_ARG_WITH(libpfring_libraries, | |
1142 | [ --with-libpfring-libraries=DIR libpfring library directory], | |
1143 | [with_libpfring_libraries="$withval"],[with_libpfring_libraries="no"]) | |
1144 | ||
1145 | if test "$with_libpfring_includes" != "no"; then | |
89f83c2e | 1146 | CPPFLAGS="${CPPFLAGS} -I${with_libpfring_includes}" |
6408feba | 1147 | fi |
073d0421 | 1148 | |
6408feba | 1149 | if test "$with_libpfring_libraries" != "no"; then |
89f83c2e | 1150 | LDFLAGS="${LDFLAGS} -L${with_libpfring_libraries}" |
6408feba | 1151 | fi |
073d0421 | 1152 | |
6408feba | 1153 | LIBPFRING="" |
43ffd779 | 1154 | AC_CHECK_LIB(pfring, pfring_open,, LIBPFRING="no", [-lpcap]) |
dde78e49 GL |
1155 | if test "$LIBPFRING" != "no"; then |
1156 | STORECFLAGS="${CFLAGS}" | |
1157 | CFLAGS="${CFLAGS} -Werror" | |
1158 | AC_COMPILE_IFELSE( | |
1159 | [AC_LANG_PROGRAM( | |
1160 | [ | |
1161 | #include <pfring.h> | |
1162 | ], | |
1163 | [ | |
1164 | pfring_recv_chunk(NULL, NULL, 0, 0); | |
1165 | ])], | |
1166 | [pfring_recv_chunk="yes"], | |
1167 | [pfring_recv_chunk="no"]) | |
1168 | CFLAGS="${STORECFLAGS}" | |
1169 | if test "x$pfring_recv_chunk" != "xyes"; then | |
a75911e0 EL |
1170 | if test "x$enable_pfring" = "xyes"; then |
1171 | echo | |
dde78e49 GL |
1172 | echo " ERROR! --enable-pfring was passed but the library version is < 6, go get it" |
1173 | echo " from http://www.ntop.org/products/pf_ring/" | |
a75911e0 EL |
1174 | echo |
1175 | exit 1 | |
1176 | fi | |
6408feba | 1177 | fi |
6408feba | 1178 | else |
dde78e49 GL |
1179 | if test "x$enable_pfring" = "xyes"; then |
1180 | echo | |
1181 | echo " ERROR! --enable-pfring was passed but the library was not found, go get it" | |
1182 | echo " from http://www.ntop.org/products/pf_ring/" | |
1183 | echo | |
1184 | exit 1 | |
1185 | fi | |
dbf5d79e | 1186 | fi |
6408feba | 1187 | ]) |
ddf995da | 1188 | |
89cee0ad | 1189 | # AF_PACKET support |
e80b30c0 | 1190 | AC_ARG_ENABLE(af-packet, |
b2ebd4a1 EL |
1191 | AS_HELP_STRING([--enable-af-packet], [Enable AF_PACKET support [default=yes]]), |
1192 | ,[enable_af_packet=yes]) | |
e80b30c0 | 1193 | AS_IF([test "x$enable_af_packet" = "xyes"], [ |
ac2d13d6 | 1194 | AC_CHECK_DECL([TPACKET_V2], |
e80b30c0 | 1195 | AC_DEFINE([HAVE_AF_PACKET],[1],[AF_PACKET support is available]), |
ac2d13d6 EL |
1196 | [enable_af_packet="no"], |
1197 | [[#include <sys/socket.h> | |
1198 | #include <linux/if_packet.h>]]) | |
851fcef9 EL |
1199 | AC_CHECK_DECL([PACKET_FANOUT_QM], |
1200 | AC_DEFINE([HAVE_PACKET_FANOUT],[1],[Recent packet fanout support is available]), | |
e80b30c0 EL |
1201 | [], |
1202 | [[#include <linux/if_packet.h>]]) | |
c2d0d938 EL |
1203 | AC_CHECK_DECL([TPACKET_V3], |
1204 | AC_DEFINE([HAVE_TPACKET_V3],[1],[AF_PACKET tpcket_v3 support is available]), | |
1205 | [], | |
1206 | [[#include <sys/socket.h> | |
1207 | #include <linux/if_packet.h>]]) | |
a40f08a2 EL |
1208 | AC_CHECK_DECL([SOF_TIMESTAMPING_RAW_HARDWARE], |
1209 | AC_DEFINE([HAVE_HW_TIMESTAMPING],[1],[Hardware timestamping support is available]), | |
1210 | [], | |
1211 | [[#include <linux/net_tstamp.h>]]) | |
e80b30c0 EL |
1212 | ]) |
1213 | ||
10104066 | 1214 | # Netmap support |
1215 | AC_ARG_ENABLE(netmap, | |
1216 | AS_HELP_STRING([--enable-netmap], [Enable Netmap support]),,[enable_netmap=no]) | |
1217 | AC_ARG_WITH(netmap_includes, | |
1218 | [ --with-netmap-includes=DIR netmap include directory], | |
1219 | [with_netmap_includes="$withval"],[with_netmap_includes=no]) | |
1220 | ||
1221 | AS_IF([test "x$enable_netmap" = "xyes"], [ | |
ba81c4d2 | 1222 | AC_DEFINE([HAVE_NETMAP],[1],(NETMAP support enabled)) |
10104066 | 1223 | |
1224 | if test "$with_netmap_includes" != "no"; then | |
1225 | CPPFLAGS="${CPPFLAGS} -I${with_netmap_includes}" | |
1226 | fi | |
1227 | ||
1228 | AC_CHECK_HEADER(net/netmap_user.h,,[AC_ERROR(net/netmap_user.h not found ...)],) | |
1229 | ]) | |
c45d8985 | 1230 | |
89cee0ad | 1231 | # libhtp |
e07e9e16 WM |
1232 | AC_ARG_ENABLE(non-bundled-htp, |
1233 | AS_HELP_STRING([--enable-non-bundled-htp], [Enable the use of an already installed version of htp]),,[enable_non_bundled_htp=no]) | |
1234 | AS_IF([test "x$enable_non_bundled_htp" = "xyes"], [ | |
f8b8b6f7 EL |
1235 | PKG_CHECK_MODULES([libhtp], htp,, [with_pkgconfig_htp=no]) |
1236 | if test "$with_pkgconfig_htp" != "no"; then | |
1237 | CPPFLAGS="${CPPFLAGS} ${libhtp_CFLAGS}" | |
1238 | LIBS="${LIBS} ${libhtp_LIBS}" | |
1239 | fi | |
1240 | ||
e07e9e16 WM |
1241 | AC_ARG_WITH(libhtp_includes, |
1242 | [ --with-libhtp-includes=DIR libhtp include directory], | |
1243 | [with_libhtp_includes="$withval"],[with_libhtp_includes=no]) | |
1244 | AC_ARG_WITH(libhtp_libraries, | |
1245 | [ --with-libhtp-libraries=DIR libhtp library directory], | |
1246 | [with_libhtp_libraries="$withval"],[with_libhtp_libraries="no"]) | |
1247 | ||
1248 | if test "$with_libhtp_includes" != "no"; then | |
0c37f76f | 1249 | CPPFLAGS="-I${with_libhtp_includes} ${CPPFLAGS}" |
e07e9e16 | 1250 | fi |
07f7ba55 | 1251 | |
e07e9e16 | 1252 | if test "$with_libhtp_libraries" != "no"; then |
89cee0ad | 1253 | LDFLAGS="${LDFLAGS} -L${with_libhtp_libraries}" |
e07e9e16 | 1254 | fi |
ed856de9 | 1255 | |
e07e9e16 | 1256 | AC_CHECK_HEADER(htp/htp.h,,[AC_ERROR(htp/htp.h not found ...)]) |
ed856de9 | 1257 | |
e07e9e16 WM |
1258 | LIBHTP="" |
1259 | AC_CHECK_LIB(htp, htp_conn_create,, LIBHTP="no") | |
1260 | if test "$LIBHTP" = "no"; then | |
89cee0ad VJ |
1261 | echo |
1262 | echo " ERROR! libhtp library not found" | |
1263 | echo | |
1264 | exit 1 | |
e07e9e16 | 1265 | fi |
37b10c13 | 1266 | PKG_CHECK_MODULES(LIBHTPMINVERSION, [htp >= 0.5.20],[libhtp_minver_found="yes"],[libhtp_minver_found="no"]) |
e07e9e16 | 1267 | if test "$libhtp_minver_found" = "no"; then |
f85a2dc8 AS |
1268 | PKG_CHECK_MODULES(LIBHTPDEVVERSION, [htp = 0.5.X],[libhtp_devver_found="yes"],[libhtp_devver_found="no"]) |
1269 | if test "$libhtp_devver_found" = "no"; then | |
1270 | echo | |
37b10c13 | 1271 | echo " ERROR! libhtp was found but it is neither >= 0.5.20, nor the dev 0.5.X" |
f85a2dc8 AS |
1272 | echo |
1273 | exit 1 | |
1274 | fi | |
d472d606 EL |
1275 | fi |
1276 | ||
a3e2b355 | 1277 | 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 |
1278 | # check for htp_tx_get_response_headers_raw |
1279 | 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 | 1280 | 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 | 1281 | 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 | 1282 | 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 | 1283 | ]) |
4acd5a04 | 1284 | |
aafc65c7 VJ |
1285 | if test "x$enable_non_bundled_htp" = "xno"; then |
1286 | # test if we have a bundled htp | |
1287 | if test -d "$srcdir/libhtp"; then | |
1288 | AC_CONFIG_SUBDIRS([libhtp]) | |
1289 | HTP_DIR="libhtp" | |
1290 | AC_SUBST(HTP_DIR) | |
1291 | HTP_LDADD="../libhtp/htp/libhtp.la" | |
1292 | AC_SUBST(HTP_LDADD) | |
1293 | # make sure libhtp is added to the includes | |
667e4e68 | 1294 | CPPFLAGS="-I\${srcdir}/../libhtp/ ${CPPFLAGS}" |
aafc65c7 | 1295 | |
8060ef41 | 1296 | AC_CHECK_HEADER(iconv.h,,[AC_ERROR(iconv.h not found ...)]) |
c0993495 | 1297 | AC_CHECK_LIB(iconv, libiconv_close) |
aafc65c7 VJ |
1298 | AC_DEFINE_UNQUOTED([HAVE_HTP_URI_NORMALIZE_HOOK],[1],[Assuming htp_config_register_request_uri_normalize function in bundled libhtp]) |
1299 | AC_DEFINE_UNQUOTED([HAVE_HTP_TX_GET_RESPONSE_HEADERS_RAW],[1],[Assuming htp_tx_get_response_headers_raw function in bundled libhtp]) | |
1300 | AC_DEFINE_UNQUOTED([HAVE_HTP_DECODE_QUERY_INPLACE],[1],[Assuming htp_decode_query_inplace function in bundled libhtp]) | |
5ec885e4 VJ |
1301 | # enable when libhtp has been updated |
1302 | 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 |
1303 | else |
1304 | echo | |
1bbbcf51 | 1305 | echo " ERROR: Libhtp is not bundled. Get libhtp by doing:" |
5ec885e4 | 1306 | echo " git clone https://github.com/OISF/libhtp" |
1bbbcf51 KS |
1307 | echo " Then re-run Suricata's autogen.sh and configure script." |
1308 | echo " Or, if libhtp is installed in a different location," | |
1309 | echo " pass --enable-non-bundled-htp to Suricata's configure script." | |
aafc65c7 VJ |
1310 | echo " Add --with-libhtp-includes=<dir> and --with-libhtp-libraries=<dir> if" |
1311 | echo " libhtp is not installed in the include and library paths." | |
1312 | echo | |
1313 | exit 1 | |
1314 | fi | |
1315 | fi | |
36917c7d | 1316 | |
08328f9d | 1317 | |
89cee0ad | 1318 | # enable CUDA output |
d281a6b8 | 1319 | AC_ARG_ENABLE(cuda, |
1fb11e93 | 1320 | AS_HELP_STRING([--enable-cuda], [Enable experimental CUDA pattern matching]),,[enable_cuda=no]) |
e07e9e16 WM |
1321 | AS_IF([test "x$enable_cuda" = "xyes"], [ |
1322 | AC_ARG_WITH(cuda_includes, | |
1323 | [ --with-cuda-includes=DIR cuda include directory], | |
1324 | [with_cuda_includes="$withval"],[with_cuda_includes=no]) | |
1325 | AC_ARG_WITH(cuda_libraries, | |
1326 | [ --with-cuda-libraries=DIR cuda library directory], | |
1327 | [with_cuda_libraries="$withval"],[with_cuda_libraries="no"]) | |
49d66430 MB |
1328 | AC_ARG_WITH(cuda_nvcc, |
1329 | [ --with-cuda-nvcc=DIR cuda nvcc compiler directory], | |
1330 | [with_cuda_nvcc="$withval"],[with_cuda_nvcc=no]) | |
e07e9e16 | 1331 | |
fde7a2f6 | 1332 | AC_DEFINE([__SC_CUDA_SUPPORT__],[1],(CUDA support enabled)) |
d281a6b8 VJ |
1333 | |
1334 | if test "$with_cuda_includes" != "no"; then | |
1335 | CPPFLAGS="${CPPFLAGS} -I${with_cuda_includes}" | |
1336 | else | |
2f1262b4 | 1337 | CPPFLAGS="${CPPFLAGS} -I/usr/local/cuda/include" |
d281a6b8 VJ |
1338 | fi |
1339 | ||
1340 | if test "$with_cuda_libraries" != "no"; then | |
1341 | LDFLAGS="${LDFLAGS} -L${with_cuda_libraries}" | |
1342 | fi | |
1343 | ||
49d66430 MB |
1344 | if test "$with_cuda_nvcc" != "no"; then |
1345 | NVCC_DIR="${with_cuda_nvcc}" | |
1346 | else | |
1347 | NVCC_DIR="/usr/local/cuda/bin" | |
1348 | fi | |
1349 | ||
d281a6b8 VJ |
1350 | AC_CHECK_HEADER(cuda.h,,[AC_ERROR(cuda.h not found ...)]) |
1351 | ||
1352 | LIBCUDA="" | |
1353 | AC_CHECK_LIB(cuda, cuArray3DCreate,, LIBCUDA="no") | |
1354 | if test "$LIBCUDA" = "no"; then | |
1355 | echo | |
1356 | echo " ERROR! libcuda library not found" | |
1357 | echo | |
1358 | exit 1 | |
1359 | fi | |
49d66430 | 1360 | |
2f1262b4 MB |
1361 | AC_PATH_PROG([NVCC], [nvcc], no, [$PATH:$NVCC_DIR]) |
1362 | if test "x$NVCC" = "xno"; then | |
49d66430 MB |
1363 | echo |
1364 | echo " ERROR! CUDA nvcc compiler not found: use --with-cuda-nvcc=DIR" | |
1365 | echo | |
1366 | exit 1 | |
1367 | fi | |
1368 | ||
2f1262b4 MB |
1369 | AC_MSG_CHECKING(for nvcc version) |
1370 | NVCCVER=`$NVCC --version | grep "release" | sed 's/.*release \(@<:@0-9@:>@\)\.\(@<:@0-9@:>@\).*/\1\2/'` | |
1371 | AC_MSG_RESULT($NVCCVER) | |
1372 | if test "$NVCCVER" -lt 31; then | |
49d66430 | 1373 | echo |
2f1262b4 MB |
1374 | echo " Warning! Your CUDA nvcc version might be outdated." |
1375 | echo " If compilation fails try the latest CUDA toolkit from" | |
1376 | echo " www.nvidia.com/object/cuda_develop.html" | |
1377 | echo | |
1378 | fi | |
1379 | ||
1380 | AM_PATH_PYTHON(,, no) | |
1381 | if test "x$PYTHON" = "xno"; then | |
1382 | echo | |
1383 | echo " ERROR! Compiling CUDA kernels requires python." | |
49d66430 MB |
1384 | echo |
1385 | exit 1 | |
1386 | fi | |
e07e9e16 | 1387 | ]) |
2f1262b4 | 1388 | AM_CONDITIONAL([BUILD_CUDA], [test "x$enable_cuda" = "xyes"]) |
fde7a2f6 | 1389 | AM_CONDITIONAL([__SC_CUDA_SUPPORT__], [test "x$enable_cuda" = "xyes"]) |
d281a6b8 | 1390 | |
070ed778 | 1391 | |
89cee0ad | 1392 | # Check for libcap-ng |
829238e4 VJ |
1393 | case $host in |
1394 | *-*-linux*) | |
070ed778 VJ |
1395 | AC_ARG_WITH(libcap_ng_includes, |
1396 | [ --with-libcap_ng-includes=DIR libcap_ng include directory], | |
f01027e9 | 1397 | [with_libcap_ng_includes="$withval"],[with_libcap_ng_includes=no]) |
070ed778 VJ |
1398 | AC_ARG_WITH(libcap_ng_libraries, |
1399 | [ --with-libcap_ng-libraries=DIR libcap_ng library directory], | |
1400 | [with_libcap_ng_libraries="$withval"],[with_libcap_ng_libraries="no"]) | |
1401 | ||
1402 | if test "$with_libcap_ng_includes" != "no"; then | |
89cee0ad | 1403 | CPPFLAGS="${CPPFLAGS} -I${with_libcap_ng_includes}" |
070ed778 VJ |
1404 | fi |
1405 | ||
1406 | if test "$with_libcap_ng_libraries" != "no"; then | |
89cee0ad | 1407 | LDFLAGS="${LDFLAGS} -L${with_libcap_ng_libraries}" |
070ed778 VJ |
1408 | fi |
1409 | ||
1410 | AC_CHECK_HEADER(cap-ng.h,,LIBCAP_NG="no") | |
1411 | if test "$LIBCAP_NG" != "no"; then | |
1412 | LIBCAP_NG="" | |
1413 | AC_CHECK_LIB(cap-ng,capng_clear,,LIBCAP_NG="no") | |
1414 | fi | |
1415 | ||
1416 | if test "$LIBCAP_NG" != "no"; then | |
ba81c4d2 | 1417 | AC_DEFINE([HAVE_LIBCAP_NG],[1],[Libpcap-ng support]) |
070ed778 VJ |
1418 | fi |
1419 | ||
1420 | if test "$LIBCAP_NG" = "no"; then | |
89cee0ad VJ |
1421 | echo |
1422 | echo " WARNING! libcap-ng library not found, go get it" | |
1423 | echo " from http://people.redhat.com/sgrubb/libcap-ng/" | |
1424 | echo " or your distribution:" | |
1425 | echo | |
1426 | echo " Ubuntu: apt-get install libcap-ng-dev" | |
1427 | echo " Fedora: yum install libcap-ng-devel" | |
1428 | echo | |
1429 | echo " Suricata will be built without support for dropping privs." | |
1430 | echo | |
070ed778 | 1431 | fi |
829238e4 VJ |
1432 | ;; |
1433 | esac | |
835630ef | 1434 | |
89cee0ad | 1435 | # Check for DAG support. |
835630ef | 1436 | AC_ARG_ENABLE(dag, |
6913109b | 1437 | AS_HELP_STRING([--enable-dag],[Enable DAG capture]), |
835630ef JM |
1438 | [ enable_dag=yes ], |
1439 | [ enable_dag=no]) | |
1440 | AC_ARG_WITH(dag_includes, | |
1441 | [ --with-dag-includes=DIR dagapi include directory], | |
1442 | [with_dag_includes="$withval"],[with_dag_includes="no"]) | |
1443 | AC_ARG_WITH(dag_libraries, | |
1444 | [ --with-dag-libraries=DIR dagapi library directory], | |
1445 | [with_dag_libraries="$withval"],[with_dag_libraries="no"]) | |
1446 | ||
1447 | if test "$enable_dag" = "yes"; then | |
1448 | ||
c9cc137d | 1449 | if test "$with_dag_includes" != "no"; then |
835630ef JM |
1450 | CPPFLAGS="${CPPFLAGS} -I${with_dag_includes}" |
1451 | fi | |
1452 | ||
1453 | if test "$with_dag_libraries" != "no"; then | |
573f31b2 | 1454 | LDFLAGS="${LDFLAGS} -L${with_dag_libraries}" |
835630ef JM |
1455 | fi |
1456 | ||
1457 | AC_CHECK_HEADER(dagapi.h,DAG="yes",DAG="no") | |
1458 | if test "$DAG" != "no"; then | |
1459 | DAG="" | |
ba81c4d2 | 1460 | AC_CHECK_LIB(dag,dag_open,,DAG="no",) |
835630ef JM |
1461 | fi |
1462 | ||
1463 | if test "$DAG" = "no"; then | |
1464 | echo | |
1465 | echo " ERROR! libdag library not found" | |
1466 | echo | |
1467 | exit 1 | |
1468 | fi | |
ba81c4d2 VJ |
1469 | |
1470 | AC_DEFINE([HAVE_DAG],[1],(Endace DAG card support enabled)) | |
835630ef JM |
1471 | fi |
1472 | ||
89cee0ad | 1473 | # libnspr |
4a186bcf | 1474 | enable_nspr="no" |
04d7d00d VJ |
1475 | |
1476 | # Try pkg-config first: | |
1477 | PKG_CHECK_MODULES([libnspr], nspr,, [with_pkgconfig_nspr=no]) | |
1478 | if test "$with_pkgconfig_nspr" != "no"; then | |
1479 | CPPFLAGS="${CPPFLAGS} ${libnspr_CFLAGS}" | |
1480 | LIBS="${LIBS} ${libnspr_LIBS}" | |
1481 | fi | |
1482 | ||
69b3df96 VJ |
1483 | AC_ARG_WITH(libnspr_includes, |
1484 | [ --with-libnspr-includes=DIR libnspr include directory], | |
1485 | [with_libnspr_includes="$withval"],[with_libnspr_includes=no]) | |
1486 | AC_ARG_WITH(libnspr_libraries, | |
1487 | [ --with-libnspr-libraries=DIR libnspr library directory], | |
1488 | [with_libnspr_libraries="$withval"],[with_libnspr_libraries="no"]) | |
1489 | ||
1490 | if test "$with_libnspr_includes" != "no"; then | |
1491 | CPPFLAGS="${CPPFLAGS} -I${with_libnspr_includes}" | |
1492 | fi | |
1493 | ||
90422c9f | 1494 | AC_CHECK_HEADER(nspr.h,NSPR="yes",NSPR="no") |
337f7861 VJ |
1495 | if test "$NSPR" = "yes"; then |
1496 | if test "$with_libnspr_libraries" != "no"; then | |
1497 | LDFLAGS="${LDFLAGS} -L${with_libnspr_libraries}" | |
1498 | fi | |
69b3df96 | 1499 | |
337f7861 | 1500 | AC_CHECK_LIB(nspr4, PR_GetCurrentThread,, NSPR="no") |
69b3df96 | 1501 | |
337f7861 VJ |
1502 | if test "$NSPR" = "no"; then |
1503 | echo | |
1504 | echo " ERROR! libnspr library not found, go get it" | |
89cee0ad VJ |
1505 | echo " from Mozilla or your distribution:" |
1506 | echo | |
1507 | echo " Ubuntu: apt-get install libnspr4-dev" | |
1508 | echo " Fedora: yum install nspr-devel" | |
337f7861 VJ |
1509 | echo |
1510 | exit 1 | |
1511 | fi | |
4a186bcf | 1512 | enable_nspr="yes" |
69b3df96 | 1513 | fi |
337f7861 | 1514 | |
89cee0ad | 1515 | # libnss |
4a186bcf | 1516 | enable_nss="no" |
cb8e5bc5 CK |
1517 | |
1518 | # Try pkg-config first: | |
1519 | PKG_CHECK_MODULES([libnss], nss,, [with_pkgconfig_nss=no]) | |
1520 | if test "$with_pkgconfig_nss" != "no"; then | |
1521 | CPPFLAGS="${CPPFLAGS} ${libnss_CFLAGS}" | |
1522 | LIBS="${LIBS} ${libnss_LIBS}" | |
1523 | fi | |
1524 | ||
69b3df96 VJ |
1525 | AC_ARG_WITH(libnss_includes, |
1526 | [ --with-libnss-includes=DIR libnss include directory], | |
1527 | [with_libnss_includes="$withval"],[with_libnss_includes=no]) | |
1528 | AC_ARG_WITH(libnss_libraries, | |
1529 | [ --with-libnss-libraries=DIR libnss library directory], | |
1530 | [with_libnss_libraries="$withval"],[with_libnss_libraries="no"]) | |
1531 | ||
1532 | if test "$with_libnss_includes" != "no"; then | |
1533 | CPPFLAGS="${CPPFLAGS} -I${with_libnss_includes}" | |
1534 | fi | |
1535 | ||
337f7861 VJ |
1536 | AC_CHECK_HEADER(sechash.h,NSS="yes",NSS="no") |
1537 | if test "$NSS" = "yes"; then | |
1538 | if test "$with_libnss_libraries" != "no"; then | |
1539 | LDFLAGS="${LDFLAGS} -L${with_libnss_libraries}" | |
1540 | fi | |
69b3df96 | 1541 | |
337f7861 | 1542 | AC_CHECK_LIB(nss3, HASH_Begin,, NSS="no") |
69b3df96 | 1543 | |
337f7861 VJ |
1544 | if test "$NSS" = "no"; then |
1545 | echo | |
1546 | echo " ERROR! libnss library not found, go get it" | |
89cee0ad VJ |
1547 | echo " from Mozilla or your distribution:" |
1548 | echo | |
1549 | echo " Ubuntu: apt-get install libnss3-dev" | |
1550 | echo " Fedora: yum install nss-devel" | |
337f7861 VJ |
1551 | echo |
1552 | exit 1 | |
1553 | fi | |
69b3df96 | 1554 | |
337f7861 | 1555 | AC_DEFINE([HAVE_NSS],[1],[libnss available for md5]) |
4a186bcf | 1556 | enable_nss="yes" |
69b3df96 VJ |
1557 | fi |
1558 | ||
89cee0ad | 1559 | # libmagic |
810e43f3 VJ |
1560 | enable_magic="no" |
1561 | AC_ARG_ENABLE(libmagic, | |
1562 | AS_HELP_STRING([--enable-libmagic], [Enable libmagic support [default=yes]]), | |
1563 | ,[enable_magic=yes]) | |
1564 | if test "$enable_magic" = "yes"; then | |
1565 | AC_ARG_WITH(libmagic_includes, | |
1566 | [ --with-libmagic-includes=DIR libmagic include directory], | |
1567 | [with_libmagic_includes="$withval"],[with_libmagic_includes=no]) | |
1568 | AC_ARG_WITH(libmagic_libraries, | |
1569 | [ --with-libmagic-libraries=DIR libmagic library directory], | |
1570 | [with_libmagic_libraries="$withval"],[with_libmagic_libraries="no"]) | |
1571 | ||
1572 | if test "$with_libmagic_includes" != "no"; then | |
1573 | CPPFLAGS="${CPPFLAGS} -I${with_libmagic_includes}" | |
1574 | fi | |
f4a6f4b2 | 1575 | |
810e43f3 VJ |
1576 | AC_CHECK_HEADER(magic.h,,MAGIC="no") |
1577 | if test "$MAGIC" != "no"; then | |
1578 | MAGIC="" | |
1579 | AC_CHECK_LIB(magic, magic_open,, MAGIC="no") | |
1580 | fi | |
f4a6f4b2 | 1581 | |
810e43f3 VJ |
1582 | if test "x$MAGIC" != "xno"; then |
1583 | if test "$with_libmagic_libraries" != "no"; then | |
1584 | LDFLAGS="${LDFLAGS} -L${with_libmagic_libraries}" | |
1585 | fi | |
1586 | AC_DEFINE([HAVE_MAGIC],[1],(Libmagic for file handling)) | |
1587 | else | |
1588 | echo | |
1589 | echo " WARNING! magic library not found, go get it" | |
1590 | echo " from http://www.darwinsys.com/file/ or your distribution:" | |
1591 | echo | |
1592 | echo " Ubuntu: apt-get install libmagic-dev" | |
1593 | echo " Fedora: yum install file-devel" | |
1594 | echo | |
1595 | enable_magic="no" | |
1596 | fi | |
f4a6f4b2 VJ |
1597 | fi |
1598 | ||
37e3de84 MK |
1599 | # Napatech - Using the 3GD API |
1600 | AC_ARG_ENABLE(napatech, | |
6913109b | 1601 | AS_HELP_STRING([--enable-napatech],[Enabled Napatech Devices]), |
37e3de84 MK |
1602 | [ enable_napatech=yes ], |
1603 | [ enable_napatech=no]) | |
1604 | AC_ARG_WITH(napatech_includes, | |
1605 | [ --with-napatech-includes=DIR napatech include directory], | |
1606 | [with_napatech_includes="$withval"],[with_napatech_includes="/opt/napatech3/include"]) | |
1607 | AC_ARG_WITH(napatech_libraries, | |
1608 | [ --with-napatech-libraries=DIR napatech library directory], | |
1609 | [with_napatech_libraries="$withval"],[with_napatech_libraries="/opt/napatech3/lib"]) | |
1610 | ||
1611 | if test "$enable_napatech" = "yes"; then | |
1612 | CPPFLAGS="${CPPFLAGS} -I${with_napatech_includes}" | |
1613 | LDFLAGS="${LDFLAGS} -L${with_napatech_libraries} -lntapi" | |
1614 | AC_CHECK_HEADER(nt.h,NAPATECH="yes",NAPATECH="no") | |
1615 | if test "$NAPATECH" != "no"; then | |
1616 | NAPATECH="" | |
1617 | AC_CHECK_LIB(ntapi, NT_Init,NAPATECH="yes",NAPATECH="no") | |
844e4dba MK |
1618 | fi |
1619 | ||
37e3de84 | 1620 | if test "$NAPATECH" = "no"; then |
844e4dba MK |
1621 | echo |
1622 | echo " ERROR! libntapi library not found" | |
1623 | echo | |
1624 | exit 1 | |
1625 | fi | |
ba81c4d2 VJ |
1626 | |
1627 | AC_DEFINE([HAVE_NAPATECH],[1],(Napatech capture card support)) | |
844e4dba MK |
1628 | fi |
1629 | ||
e366c62c VJ |
1630 | # liblua |
1631 | AC_ARG_ENABLE(lua, | |
1632 | AS_HELP_STRING([--enable-lua],[Enable Lua support]), | |
1633 | [ enable_lua="yes"], | |
1634 | [ enable_lua="no"]) | |
ba81c4d2 VJ |
1635 | AC_ARG_ENABLE(luajit, |
1636 | AS_HELP_STRING([--enable-luajit],[Enable Luajit support]), | |
1637 | [ enable_luajit="yes"], | |
1638 | [ enable_luajit="no"]) | |
1639 | if test "$enable_lua" = "yes"; then | |
1640 | if test "$enable_luajit" = "yes"; then | |
1641 | echo "ERROR: can't enable liblua and luajit at the same time." | |
1642 | echo "For LuaJIT, just use --enable-luajit. For liblua (no jit)" | |
1643 | echo "support, use just --enable-lua." | |
1644 | echo "Both options will enable the Lua scripting capabilities" | |
1645 | echo "in Suricata". | |
1646 | echo | |
1647 | exit 1 | |
1648 | fi | |
1649 | fi | |
1650 | ||
e366c62c VJ |
1651 | AC_ARG_WITH(liblua_includes, |
1652 | [ --with-liblua-includes=DIR liblua include directory], | |
1653 | [with_liblua_includes="$withval"],[with_liblua_includes="no"]) | |
1654 | AC_ARG_WITH(liblua_libraries, | |
1655 | [ --with-liblua-libraries=DIR liblua library directory], | |
1656 | [with_liblua_libraries="$withval"],[with_liblua_libraries="no"]) | |
1657 | ||
1658 | if test "$enable_lua" = "yes"; then | |
1659 | if test "$with_liblua_includes" != "no"; then | |
1660 | CPPFLAGS="${CPPFLAGS} -I${with_liblua_includes}" | |
1661 | else | |
da1fe759 VJ |
1662 | # lua lua51 lua5.1 lua-5.1 |
1663 | PKG_CHECK_MODULES([LUA], [lua], [LUA="yes"], [ | |
1664 | PKG_CHECK_MODULES([LUA], [lua5.1], [LUA="yes"], [ | |
1665 | PKG_CHECK_MODULES([LUA], [lua-5.1], [LUA="yes"], [ | |
1666 | PKG_CHECK_MODULES([LUA], [lua51], [LUA="yes"], [ | |
1667 | LUA="no" | |
1668 | ]) | |
1669 | ]) | |
1670 | ]) | |
1671 | ]) | |
e366c62c VJ |
1672 | CPPFLAGS="${CPPFLAGS} ${LUA_CFLAGS}" |
1673 | fi | |
1674 | ||
1675 | AC_CHECK_HEADER(lualib.h,LUA="yes",LUA="no") | |
1676 | if test "$LUA" = "yes"; then | |
1677 | if test "$with_liblua_libraries" != "no"; then | |
1678 | LDFLAGS="${LDFLAGS} -L${with_liblua_libraries}" | |
da1fe759 VJ |
1679 | AC_CHECK_LIB(${LUA_LIB_NAME}, luaL_openlibs,, LUA="no") |
1680 | if test "$LUA" = "no"; then | |
1681 | echo | |
1682 | echo " ERROR! liblua library not found, go get it" | |
1683 | echo " from http://lua.org/index.html or your distribution:" | |
1684 | echo | |
5db32204 | 1685 | echo " Ubuntu: apt-get install liblua5.1-dev" |
da1fe759 VJ |
1686 | echo " CentOS/Fedora: yum install lua-devel" |
1687 | echo | |
1688 | echo " If you installed software in a non-standard prefix" | |
1689 | echo " consider adjusting the PKG_CONFIG_PATH environment variable" | |
1690 | echo " or use --with-liblua-libraries configure option." | |
1691 | echo | |
1692 | exit 1 | |
1693 | fi | |
e366c62c | 1694 | else |
da1fe759 VJ |
1695 | # lua lua51 lua5.1 lua-5.1 |
1696 | PKG_CHECK_MODULES([LUA], [lua], [LUA="yes"], [ | |
1697 | PKG_CHECK_MODULES([LUA], [lua5.1], [LUA="yes"], [ | |
1698 | PKG_CHECK_MODULES([LUA], [lua-5.1], [LUA="yes"], [ | |
1699 | PKG_CHECK_MODULES([LUA], [lua51], [LUA="yes"], [ | |
1700 | LUA="no" | |
1701 | ]) | |
1702 | ]) | |
1703 | ]) | |
1704 | ]) | |
e366c62c VJ |
1705 | LDFLAGS="${LDFLAGS} ${LUA_LIBS}" |
1706 | fi | |
1707 | ||
6228f5f6 VJ |
1708 | if test "$LUA" = "no"; then |
1709 | AC_CHECK_LIB(lua, luaL_openlibs,, LUA="no") | |
1710 | fi | |
1711 | ||
1712 | if test "$LUA" = "yes"; then | |
1713 | AC_DEFINE([HAVE_LUA],[1],[liblua available]) | |
1714 | enable_lua="yes" | |
1715 | fi | |
e366c62c VJ |
1716 | else |
1717 | echo | |
1718 | echo " ERROR! liblua headers not found, go get them" | |
1719 | echo " from http://lua.org/index.html or your distribution:" | |
1720 | echo | |
5db32204 | 1721 | echo " Ubuntu: apt-get install liblua5.1-dev" |
da1fe759 | 1722 | echo " CentOS/Fedora: yum install lua-devel" |
e366c62c VJ |
1723 | echo |
1724 | echo " If you installed software in a non-standard prefix" | |
1725 | echo " consider adjusting the PKG_CONFIG_PATH environment variable" | |
1726 | echo " or use --with-liblua-includes and --with-liblua-libraries" | |
1727 | echo " configure option." | |
1728 | echo | |
1729 | exit 1 | |
1730 | fi | |
1731 | fi | |
1732 | ||
5b2fbfb1 | 1733 | # libluajit |
5b2fbfb1 VJ |
1734 | AC_ARG_WITH(libluajit_includes, |
1735 | [ --with-libluajit-includes=DIR libluajit include directory], | |
c9cc137d | 1736 | [with_libluajit_includes="$withval"],[with_libluajit_includes="no"]) |
5b2fbfb1 VJ |
1737 | AC_ARG_WITH(libluajit_libraries, |
1738 | [ --with-libluajit-libraries=DIR libluajit library directory], | |
1739 | [with_libluajit_libraries="$withval"],[with_libluajit_libraries="no"]) | |
1740 | ||
c9cc137d VJ |
1741 | if test "$enable_luajit" = "yes"; then |
1742 | if test "$with_libluajit_includes" != "no"; then | |
1743 | CPPFLAGS="${CPPFLAGS} -I${with_libluajit_includes}" | |
819debdc | 1744 | else |
344ea3fa | 1745 | PKG_CHECK_MODULES([LUAJIT], [luajit], , LUAJIT="no") |
819debdc | 1746 | CPPFLAGS="${CPPFLAGS} ${LUAJIT_CFLAGS}" |
5b2fbfb1 VJ |
1747 | fi |
1748 | ||
c9cc137d VJ |
1749 | AC_CHECK_HEADER(lualib.h,LUAJIT="yes",LUAJIT="no") |
1750 | if test "$LUAJIT" = "yes"; then | |
1751 | if test "$with_libluajit_libraries" != "no"; then | |
1752 | LDFLAGS="${LDFLAGS} -L${with_libluajit_libraries}" | |
819debdc EL |
1753 | else |
1754 | PKG_CHECK_MODULES([LUAJIT], [luajit]) | |
1755 | LDFLAGS="${LDFLAGS} ${LUAJIT_LIBS}" | |
c9cc137d | 1756 | fi |
5b2fbfb1 | 1757 | |
c9cc137d | 1758 | AC_CHECK_LIB(luajit-5.1, luaL_openlibs,, LUAJIT="no") |
5b2fbfb1 | 1759 | |
c9cc137d VJ |
1760 | if test "$LUAJIT" = "no"; then |
1761 | echo | |
1762 | echo " ERROR! libluajit library not found, go get it" | |
1763 | echo " from http://luajit.org/index.html or your distribution:" | |
1764 | echo | |
1765 | echo " Ubuntu: apt-get install libluajit-5.1-dev" | |
1766 | echo | |
344ea3fa EL |
1767 | echo " If you installed software in a non-standard prefix" |
1768 | echo " consider adjusting the PKG_CONFIG_PATH environment variable" | |
1769 | echo " or use --with-libluajit-libraries configure option." | |
1770 | echo | |
c9cc137d VJ |
1771 | exit 1 |
1772 | fi | |
1773 | ||
e366c62c | 1774 | AC_DEFINE([HAVE_LUA],[1],[lua support available]) |
c9cc137d | 1775 | AC_DEFINE([HAVE_LUAJIT],[1],[libluajit available]) |
ba81c4d2 | 1776 | enable_lua="yes, through luajit" |
c9cc137d | 1777 | enable_luajit="yes" |
e125869d EL |
1778 | else |
1779 | echo | |
1780 | echo " ERROR! libluajit headers not found, go get them" | |
1781 | echo " from http://luajit.org/index.html or your distribution:" | |
1782 | echo | |
1783 | echo " Ubuntu: apt-get install libluajit-5.1-dev" | |
1784 | echo | |
344ea3fa EL |
1785 | echo " If you installed software in a non-standard prefix" |
1786 | echo " consider adjusting the PKG_CONFIG_PATH environment variable" | |
1787 | echo " or use --with-libluajit-includes and --with-libluajit-libraries" | |
1788 | echo " configure option." | |
1789 | echo | |
e125869d | 1790 | exit 1 |
c9cc137d | 1791 | fi |
5b2fbfb1 VJ |
1792 | fi |
1793 | ||
9d687025 JI |
1794 | AM_CONDITIONAL([HAVE_LUA], [test "x$enable_lua" != "xno"]) |
1795 | ||
d771e081 IS |
1796 | # libgeoip |
1797 | AC_ARG_ENABLE(geoip, | |
6913109b | 1798 | AS_HELP_STRING([--enable-geoip],[Enable GeoIP support]), |
d771e081 IS |
1799 | [ enable_geoip="yes"], |
1800 | [ enable_geoip="no"]) | |
1801 | AC_ARG_WITH(libgeoip_includes, | |
1802 | [ --with-libgeoip-includes=DIR libgeoip include directory], | |
1803 | [with_libgeoip_includes="$withval"],[with_libgeoip_includes="no"]) | |
1804 | AC_ARG_WITH(libgeoip_libraries, | |
1805 | [ --with-libgeoip-libraries=DIR libgeoip library directory], | |
1806 | [with_libgeoip_libraries="$withval"],[with_libgeoip_libraries="no"]) | |
1807 | ||
1808 | if test "$enable_geoip" = "yes"; then | |
1809 | if test "$with_libgeoip_includes" != "no"; then | |
1810 | CPPFLAGS="${CPPFLAGS} -I${with_libgeoip_includes}" | |
1811 | fi | |
1812 | ||
1813 | AC_CHECK_HEADER(GeoIP.h,GEOIP="yes",GEOIP="no") | |
1814 | if test "$GEOIP" = "yes"; then | |
1815 | if test "$with_libgeoip_libraries" != "no"; then | |
ba81c4d2 | 1816 | LDFLAGS="${LDFLAGS} -L${with_libgeoip_libraries}" |
d771e081 IS |
1817 | fi |
1818 | AC_CHECK_LIB(GeoIP, GeoIP_country_code_by_ipnum,, GEOIP="no") | |
1819 | fi | |
1820 | if test "$GEOIP" = "no"; then | |
1821 | echo | |
1822 | echo " ERROR! libgeoip library not found, go get it" | |
1823 | echo " from http://www.maxmind.com/en/geolite or your distribution:" | |
1824 | echo | |
1825 | echo " Ubuntu: apt-get install libgeoip-dev" | |
8f190249 | 1826 | echo " Fedora: yum install GeoIP-devel" |
d771e081 IS |
1827 | echo |
1828 | exit 1 | |
1829 | fi | |
ba81c4d2 VJ |
1830 | |
1831 | AC_DEFINE([HAVE_GEOIP],[1],[libgeoip available]) | |
1832 | enable_geoip="yes" | |
d771e081 IS |
1833 | fi |
1834 | ||
437fe406 AG |
1835 | # Position Independent Executable |
1836 | AC_ARG_ENABLE(pie, | |
1837 | AS_HELP_STRING([--enable-pie],[Enable compiling as a position independent executable]), | |
1838 | [ enable_pie="yes"], | |
1839 | [ enable_pie="no"]) | |
1840 | if test "$enable_pie" = "yes"; then | |
1841 | CPPFLAGS="${CPPFLAGS} -fPIC" | |
1842 | LDFLAGS="${LDFLAGS} -pie" | |
1843 | fi | |
1844 | ||
a64e5e77 | 1845 | #libevent includes and libraries |
1846 | AC_ARG_WITH(libevent_includes, | |
1847 | [ --with-libevent-includes=DIR libevent include directory], | |
1848 | [with_libevent_includes="$withval"],[with_libevent_includes="no"]) | |
1849 | AC_ARG_WITH(libevent_libraries, | |
1850 | [ --with-libevent-libraries=DIR libevent library directory], | |
1851 | [with_libevent_libraries="$withval"],[with_libevent_libraries="no"]) | |
1852 | ||
eef5678e EL |
1853 | # libhiredis |
1854 | AC_ARG_ENABLE(hiredis, | |
1855 | AS_HELP_STRING([--enable-hiredis],[Enable Redis support]), | |
1856 | [ enable_hiredis="yes"], | |
1857 | [ enable_hiredis="no"]) | |
1858 | AC_ARG_WITH(libhiredis_includes, | |
1859 | [ --with-libhiredis-includes=DIR libhiredis include directory], | |
1860 | [with_libhiredis_includes="$withval"],[with_libhiredis_includes="no"]) | |
1861 | AC_ARG_WITH(libhiredis_libraries, | |
1862 | [ --with-libhiredis-libraries=DIR libhiredis library directory], | |
1863 | [with_libhiredis_libraries="$withval"],[with_libhiredis_libraries="no"]) | |
1864 | ||
a64e5e77 | 1865 | enable_hiredis_async="no" |
eef5678e EL |
1866 | if test "$enable_hiredis" = "yes"; then |
1867 | if test "$with_libhiredis_includes" != "no"; then | |
1868 | CPPFLAGS="${CPPFLAGS} -I${with_libhiredis_includes}" | |
1869 | fi | |
1870 | ||
1871 | AC_CHECK_HEADER("hiredis/hiredis.h",HIREDIS="yes",HIREDIS="no") | |
1872 | if test "$HIREDIS" = "yes"; then | |
1873 | if test "$with_libhiredis_libraries" != "no"; then | |
1874 | LDFLAGS="${LDFLAGS} -L${with_libhiredis_libraries}" | |
1875 | fi | |
1876 | AC_CHECK_LIB(hiredis, redisConnect,, HIREDIS="no") | |
1877 | fi | |
1878 | if test "$HIREDIS" = "no"; then | |
1879 | echo | |
1880 | echo " ERROR! libhiredis library not found, go get it" | |
1881 | echo " from https://github.com/redis/hiredis or your distribution:" | |
1882 | echo | |
1883 | echo " Ubuntu: apt-get install libhiredis-dev" | |
80bd59ae VJ |
1884 | echo " Fedora: dnf install hiredis-devel" |
1885 | echo " RHEL/CentOS: yum install hiredis-devel" | |
eef5678e EL |
1886 | echo |
1887 | exit 1 | |
1888 | fi | |
1889 | if test "$HIREDIS" = "yes"; then | |
1890 | AC_DEFINE([HAVE_LIBHIREDIS],[1],[libhiredis available]) | |
1891 | enable_hiredis="yes" | |
a64e5e77 | 1892 | # |
1893 | # Check if async adapters and libevent is installed | |
1894 | # | |
1895 | AC_CHECK_HEADER("hiredis/adapters/libevent.h",HIREDIS_LIBEVENT_ADAPTER="yes",HIREDIS_LIBEVENT_ADAPTER="no") | |
1896 | if test "$HIREDIS_LIBEVENT_ADAPTER" = "yes"; then | |
1897 | #Look for libevent headers | |
1898 | if test "$with_libevent_includes" != "no"; then | |
1899 | CPPFLAGS="${CPPFLAGS} -I${with_libevent_includes}" | |
1900 | fi | |
1901 | AC_CHECK_HEADER("event.h",LIBEVENT="yes",LIBEVENT="no") | |
1902 | if test "$LIBEVENT" = "yes"; then | |
1903 | if test "$with_libevent_libraries" != "no"; then | |
1904 | LDFLAGS="${LDFLAGS} -L${with_libevent_libraries}" | |
1905 | fi | |
1906 | AC_CHECK_LIB(event, event_base_free,, HAVE_LIBEVENT="no") | |
1907 | AC_CHECK_LIB(event_pthreads, evthread_use_pthreads,, HAVE_LIBEVENT_PTHREADS="no") | |
1908 | fi | |
1909 | if test "$HAVE_LIBEVENT" = "no" -o test "$HAVE_LIBEVENT_PTHREADS" = "no" ; then | |
1910 | if test "$HAVE_LIBEVENT" = "no"; then | |
1911 | echo | |
1912 | echo " Async mode for redis output will not be available." | |
1913 | echo " To enable it install libevent" | |
1914 | echo | |
1915 | echo " Ubuntu: apt-get install libevent-dev" | |
1916 | echo " Fedora: dnf install event-devel" | |
1917 | echo " RHEL/CentOS: yum install event-devel" | |
1918 | echo | |
1919 | fi | |
1920 | if test "$HAVE_LIBEVENT_PTHREADS" = "no"; then | |
1921 | echo | |
1922 | echo " Async mode for redis output will not be available." | |
1923 | echo " To enable it install libevent with pthreads support" | |
1924 | echo | |
1925 | echo " Ubuntu: apt-get install libevent-pthreads-2.0-5" | |
1926 | echo | |
1927 | fi | |
1928 | else | |
1929 | AC_DEFINE([HAVE_LIBEVENT],[1],[libevent available]) | |
1930 | enable_hiredis_async="yes" | |
1931 | fi | |
1932 | fi | |
eef5678e EL |
1933 | fi |
1934 | fi | |
1935 | ||
724ad9e8 VJ |
1936 | # get cache line size |
1937 | AC_PATH_PROG(HAVE_GETCONF_CMD, getconf, "no") | |
1938 | if test "$HAVE_GETCONF_CMD" != "no"; then | |
1939 | CLS=$(getconf LEVEL1_DCACHE_LINESIZE) | |
fdc3b5ba | 1940 | if [test "$CLS" != "" && test "$CLS" != "0"]; then |
0ddd57cb | 1941 | AC_DEFINE_UNQUOTED([CLS],[${CLS}],[L1 cache line size]) |
71c22ddf | 1942 | else |
ba81c4d2 | 1943 | AC_DEFINE([CLS],[64],[L1 cache line size]) |
0ddd57cb | 1944 | fi |
71c22ddf | 1945 | else |
ba81c4d2 | 1946 | AC_DEFINE([CLS],[64],[L1 cache line size]) |
724ad9e8 | 1947 | fi |
d771e081 | 1948 | |
6eedd006 JI |
1949 | # sphinx for documentation |
1950 | AC_PATH_PROG(HAVE_SPHINXBUILD, sphinx-build, "no") | |
1951 | if test "$HAVE_SPHINXBUILD" = "no"; then | |
1952 | enable_sphinxbuild=no | |
7fa390de JI |
1953 | if test -e "$srcdir/doc/userguide/suricata.1"; then |
1954 | have_suricata_man=yes | |
1955 | fi | |
6eedd006 JI |
1956 | fi |
1957 | AM_CONDITIONAL([HAVE_SPHINXBUILD], [test "x$enable_sphinxbuild" != "xno"]) | |
7fa390de | 1958 | AM_CONDITIONAL([HAVE_SURICATA_MAN], [test "x$have_suricata_man" = "xyes"]) |
6eedd006 | 1959 | |
0792f809 JI |
1960 | # pdflatex for the pdf version of the user manual |
1961 | AC_PATH_PROG(HAVE_PDFLATEX, pdflatex, "no") | |
1962 | if test "$HAVE_PDFLATEX" = "no"; then | |
1963 | enable_pdflatex=no | |
1964 | fi | |
1965 | AM_CONDITIONAL([HAVE_PDFLATEX], [test "x$enable_pdflatex" != "xno"]) | |
1966 | ||
8f81792d | 1967 | # Cargo/Rust. |
d00b914d | 1968 | AC_ARG_ENABLE([rust], AS_HELP_STRING([--enable-rust], [Enable Experimental Rust support])) |
4fe9292e PC |
1969 | AC_ARG_ENABLE([rust_experimental], AS_HELP_STRING([--enable-rust-experimental], [Enable support for experimental Rus parsers])) |
1970 | ||
9dab3ec7 VJ |
1971 | rust_config_enabled="no" # used in suricata.yaml.in to enable/disable app-layers |
1972 | rust_config_comment="#" # used in suricata.yaml.in to enable/disable eve loggers | |
1973 | rust_config_exp_enabled="no" # used in suricata.yaml.in to enable/disable app-layers | |
8f81792d JI |
1974 | rust_vendor_comment="# " |
1975 | have_rust_vendor="no" | |
1976 | ||
1977 | if test "x$enable_rust" != "xyes"; then | |
1978 | enable_rust="no" | |
1979 | else | |
1980 | AC_PATH_PROG(HAVE_CARGO, cargo, "no") | |
1981 | AC_PATH_PROG(HAVE_RUSTC, rustc, "no") | |
1982 | ||
1983 | # Deal with the case where Rust was requested but rustc or cargo | |
1984 | # cannot be found. | |
1985 | if test "x$HAVE_CARGO" = "xno"; then | |
1986 | echo "" | |
1987 | echo " ERROR! Rust support requested but cargo not found." | |
1988 | echo "" | |
1989 | exit 1 | |
1990 | fi | |
1991 | if test "x$HAVE_RUST" = "xno"; then | |
1992 | echo "" | |
1993 | echo " ERROR! Rust support requested but rustc not found." | |
1994 | echo "" | |
1995 | exit 1 | |
1996 | fi | |
1997 | ||
1998 | if test "x$HAVE_CARGO" != "xno"; then | |
1999 | if test "x$HAVE_RUSTC" != "xno"; then | |
2000 | enable_rust="yes" | |
2001 | AC_DEFINE([HAVE_RUST],[1],[Enable Rust language]) | |
2002 | if test "x$enable_debug" = "xyes"; then | |
2003 | RUST_SURICATA_LIB="../rust/target/debug/libsuricata.a" | |
2004 | else | |
2005 | RUST_SURICATA_LIB="../rust/target/release/libsuricata.a" | |
2006 | fi | |
2007 | RUST_LDADD="${RUST_SURICATA_LIB} ${RUST_LDADD}" | |
61d9f4bb | 2008 | CFLAGS="${CFLAGS} -I\${srcdir}/../rust/gen/c-headers" |
8f81792d JI |
2009 | AC_SUBST(RUST_SURICATA_LIB) |
2010 | AC_SUBST(RUST_LDADD) | |
9dab3ec7 VJ |
2011 | AC_SUBST([CARGO], [$HAVE_CARGO]) |
2012 | if test "x$CARGO_HOME" = "x"; then | |
2013 | AC_SUBST([CARGO_HOME], [~/.cargo]) | |
2014 | else | |
2015 | AC_SUBST([CARGO_HOME], [$CARGO_HOME]) | |
2016 | fi | |
8f81792d JI |
2017 | AC_CHECK_FILES([$srcdir/rust/vendor], [have_rust_vendor="yes"]) |
2018 | if test "x$have_rust_vendor" = "xyes"; then | |
9dab3ec7 | 2019 | rust_vendor_comment="" |
8f81792d | 2020 | fi |
9dab3ec7 VJ |
2021 | |
2022 | rust_config_enabled="yes" | |
2023 | rust_config_comment="" | |
8f81792d JI |
2024 | fi |
2025 | fi | |
2026 | fi | |
2027 | ||
9dab3ec7 VJ |
2028 | if test "x$enable_rust_experimental" = "xyes"; then |
2029 | rust_config_exp_enabled="yes" | |
2030 | rust_config_exp_comment="" | |
2031 | else | |
2032 | enable_rust_experimental="no" | |
2033 | fi | |
2034 | ||
8f81792d | 2035 | AM_CONDITIONAL([HAVE_RUST], [test "x$enable_rust" = "xyes"]) |
4fe9292e | 2036 | AM_CONDITIONAL([HAVE_RUST_EXTERNAL], [test "x$enable_rust_experimental" = "xyes"]) |
8f81792d | 2037 | AC_SUBST(rust_vendor_comment) |
9dab3ec7 VJ |
2038 | AC_SUBST(rust_config_enabled) |
2039 | AC_SUBST(rust_config_comment) | |
2040 | AC_SUBST(rust_config_exp_comment) | |
2041 | AC_SUBST(rust_config_exp_enabled) | |
8f81792d JI |
2042 | AM_CONDITIONAL([HAVE_RUST_VENDOR], [test "x$have_rust_vendor" = "xyes"]) |
2043 | ||
2044 | if test "x$enable_rust" = "xyes"; then | |
2045 | AC_PATH_PROG(HAVE_CARGO_VENDOR, cargo-vendor, "no") | |
2046 | if test "x$HAVE_CARGO_VENDOR" = "xno"; then | |
2047 | echo " Warning: cargo-vendor not found, but it is only required" | |
2048 | echo " for building the distribution" | |
2049 | echo " To install: cargo install cargo-vendor" | |
2050 | fi | |
4fe9292e PC |
2051 | |
2052 | if test "x$enable_rust_experimental" = "xyes"; then | |
2053 | AC_DEFINE([HAVE_RUST_EXTERNAL],[1],[Enable support for experimental Rust parsers]) | |
2054 | fi | |
8f81792d JI |
2055 | fi |
2056 | AM_CONDITIONAL([HAVE_CARGO_VENDOR], [test "x$HAVE_CARGO_VENDOR" != "xno"]) | |
2057 | ||
e3bde3e9 VJ |
2058 | # get revision |
2059 | if test -f ./revision; then | |
2060 | REVISION=`cat ./revision` | |
ba81c4d2 | 2061 | AC_DEFINE_UNQUOTED([REVISION],[${REVISION}],[Git revision]) |
e3bde3e9 | 2062 | else |
042d0c6e VJ |
2063 | AC_PATH_PROG(HAVE_GIT_CMD, git, "no") |
2064 | if test "$HAVE_GIT_CMD" != "no"; then | |
5886ef82 VJ |
2065 | if [ test -d .git ]; then |
2066 | REVISION=`git rev-parse --short HEAD` | |
ba81c4d2 | 2067 | AC_DEFINE_UNQUOTED([REVISION],[${REVISION}],[Git revision]) |
5886ef82 | 2068 | fi |
e3bde3e9 VJ |
2069 | fi |
2070 | fi | |
2071 | ||
0ffa1c24 WM |
2072 | AC_SUBST(CFLAGS) |
2073 | AC_SUBST(LDFLAGS) | |
2074 | AC_SUBST(CPPFLAGS) | |
2075 | ||
25804f5a EL |
2076 | define([EXPAND_VARIABLE], |
2077 | [$2=[$]$1 | |
2078 | if test $prefix = 'NONE'; then | |
2079 | prefix="/usr/local" | |
2080 | fi | |
2081 | while true; do | |
2082 | case "[$]$2" in | |
2083 | *\[$]* ) eval "$2=[$]$2" ;; | |
2084 | *) break ;; | |
2085 | esac | |
2086 | done | |
2087 | eval "$2=[$]$2$3" | |
2088 | ])dnl EXPAND_VARIABLE | |
2089 | ||
2090 | # suricata log dir | |
2091 | if test "$WINDOWS_PATH" = "yes"; then | |
d8356c5e VJ |
2092 | systemtype="`systeminfo | grep \"based PC\"`" |
2093 | case "$systemtype" in | |
25804f5a | 2094 | *x64*) |
d8356c5e | 2095 | e_winbase="C:\\\\Program Files (x86)\\\\Suricata" |
25804f5a EL |
2096 | ;; |
2097 | *) | |
d8356c5e | 2098 | e_winbase="C:\\\\Program Files\\\\Suricata" |
25804f5a EL |
2099 | ;; |
2100 | esac | |
d8356c5e VJ |
2101 | |
2102 | e_sysconfdir="$e_winbase\\\\" | |
2103 | e_sysconfrulesdir="$e_winbase\\\\rules\\\\" | |
2104 | e_magic_file="$e_winbase\\\\magic.mgc" | |
2105 | e_logdir="$e_winbase\\\\log" | |
2106 | e_logfilesdir="$e_logdir\\\\files" | |
55625d73 | 2107 | e_logcertsdir="$e_logdir\\\\certs" |
25804f5a | 2108 | else |
697e9e66 | 2109 | EXPAND_VARIABLE(localstatedir, e_logdir, "/log/suricata/") |
1c3546fe | 2110 | EXPAND_VARIABLE(localstatedir, e_rundir, "/run/") |
d8356c5e | 2111 | EXPAND_VARIABLE(localstatedir, e_logfilesdir, "/log/suricata/files") |
55625d73 | 2112 | EXPAND_VARIABLE(localstatedir, e_logcertsdir, "/log/suricata/certs") |
697e9e66 | 2113 | EXPAND_VARIABLE(sysconfdir, e_sysconfdir, "/suricata/") |
d8356c5e | 2114 | EXPAND_VARIABLE(sysconfdir, e_sysconfrulesdir, "/suricata/rules") |
20a8b9db | 2115 | EXPAND_VARIABLE(localstatedir, e_localstatedir, "/run/suricata") |
25804f5a EL |
2116 | fi |
2117 | AC_SUBST(e_logdir) | |
1c3546fe | 2118 | AC_SUBST(e_rundir) |
d8356c5e | 2119 | AC_SUBST(e_logfilesdir) |
55625d73 | 2120 | AC_SUBST(e_logcertsdir) |
25804f5a | 2121 | AC_SUBST(e_sysconfdir) |
d8356c5e | 2122 | AC_SUBST(e_sysconfrulesdir) |
20a8b9db | 2123 | AC_SUBST(e_localstatedir) |
d8356c5e | 2124 | AC_DEFINE_UNQUOTED([CONFIG_DIR],["$e_sysconfdir"],[Our CONFIG_DIR]) |
25804f5a | 2125 | AC_SUBST(e_magic_file) |
15c98c60 | 2126 | AC_SUBST(e_magic_file_comment) |
f55dbca5 | 2127 | AC_SUBST(e_enable_evelog) |
25804f5a | 2128 | |
ba81c4d2 VJ |
2129 | EXPAND_VARIABLE(prefix, CONFIGURE_PREFIX) |
2130 | EXPAND_VARIABLE(sysconfdir, CONFIGURE_SYSCONDIR) | |
2131 | EXPAND_VARIABLE(localstatedir, CONFIGURE_LOCALSTATEDIR) | |
2132 | AC_SUBST(CONFIGURE_PREFIX) | |
2133 | AC_SUBST(CONFIGURE_SYSCONDIR) | |
2134 | AC_SUBST(CONFIGURE_LOCALSTATEDIR) | |
8f81792d | 2135 | AC_SUBST(PACKAGE_VERSION) |
ba81c4d2 | 2136 | |
8f81792d | 2137 | 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 contrib/tile_pcie_logd/Makefile suricata.yaml scripts/Makefile scripts/suricatasc/Makefile scripts/suricatasc/suricatasc) |
a098e39b | 2138 | |
668113af | 2139 | SURICATA_BUILD_CONF="Suricata Configuration: |
73a1b972 VJ |
2140 | AF_PACKET support: ${enable_af_packet} |
2141 | PF_RING support: ${enable_pfring} | |
ef463457 | 2142 | NFQueue support: ${enable_nfqueue} |
4851568a | 2143 | NFLOG support: ${enable_nflog} |
ef463457 | 2144 | IPFW support: ${enable_ipfw} |
10104066 | 2145 | Netmap support: ${enable_netmap} |
73a1b972 | 2146 | DAG enabled: ${enable_dag} |
37e3de84 | 2147 | Napatech enabled: ${enable_napatech} |
ba81c4d2 | 2148 | |
20a8b9db | 2149 | Unix socket enabled: ${enable_unixsocket} |
f4872a2f | 2150 | Detection enabled: ${enable_detection} |
73a1b972 | 2151 | |
810e43f3 | 2152 | Libmagic support: ${enable_magic} |
89cee0ad VJ |
2153 | libnss support: ${enable_nss} |
2154 | libnspr support: ${enable_nspr} | |
20a8b9db | 2155 | libjansson support: ${enable_jansson} |
eef5678e | 2156 | hiredis support: ${enable_hiredis} |
a64e5e77 | 2157 | hiredis async with libevent: ${enable_hiredis_async} |
ef463457 | 2158 | Prelude support: ${enable_prelude} |
73a1b972 | 2159 | PCRE jit: ${pcre_jit_available} |
e366c62c | 2160 | LUA support: ${enable_lua} |
5b2fbfb1 | 2161 | libluajit: ${enable_luajit} |
d771e081 | 2162 | libgeoip: ${enable_geoip} |
73a1b972 VJ |
2163 | Non-bundled htp: ${enable_non_bundled_htp} |
2164 | Old barnyard2 support: ${enable_old_barnyard2} | |
2165 | CUDA enabled: ${enable_cuda} | |
13b87f5a | 2166 | Hyperscan support: ${enable_hyperscan} |
439b62fe | 2167 | Libnet support: ${enable_libnet} |
73a1b972 | 2168 | |
d00b914d | 2169 | Rust support (experimental): ${enable_rust} |
4fe9292e | 2170 | Experimental Rust parsers: ${enable_rust_experimental} |
8f81792d | 2171 | |
cd305c3a EL |
2172 | Suricatasc install: ${enable_python} |
2173 | ||
ef463457 | 2174 | Profiling enabled: ${enable_profiling} |
d908e707 | 2175 | Profiling locks enabled: ${enable_profiling_locks} |
439b62fe VJ |
2176 | |
2177 | Development settings: | |
7fb860ac | 2178 | Coccinelle / spatch: ${enable_coccinelle} |
439b62fe VJ |
2179 | Unit tests enabled: ${enable_unittests} |
2180 | Debug output enabled: ${enable_debug} | |
2181 | Debug validation enabled: ${enable_debug_validation} | |
ef463457 EL |
2182 | |
2183 | Generic build parameters: | |
ba81c4d2 VJ |
2184 | Installation prefix: ${prefix} |
2185 | Configuration directory: ${e_sysconfdir} | |
2186 | Log directory: ${e_logdir} | |
2187 | ||
2188 | --prefix ${CONFIGURE_PREFIX} | |
2189 | --sysconfdir ${CONFIGURE_SYSCONDIR} | |
2190 | --localstatedir ${CONFIGURE_LOCALSTATEDIR} | |
73a1b972 | 2191 | |
ef463457 | 2192 | Host: ${host} |
ba81c4d2 | 2193 | Compiler: ${CC} (exec name) / ${compiler} (real) |
ef463457 EL |
2194 | GCC Protect enabled: ${enable_gccprotect} |
2195 | GCC march native enabled: ${enable_gccmarch_native} | |
ba81c4d2 | 2196 | GCC Profile enabled: ${enable_gccprofile} |
437fe406 | 2197 | Position Independent Executable enabled: ${enable_pie} |
ba81c4d2 VJ |
2198 | CFLAGS ${CFLAGS} |
2199 | PCAP_CFLAGS ${PCAP_CFLAGS} | |
2200 | SECCFLAGS ${SECCFLAGS}" | |
668113af EL |
2201 | |
2202 | echo | |
2203 | echo "$SURICATA_BUILD_CONF" | |
4749420f VJ |
2204 | echo "printf(" >src/build-info.h |
2205 | echo "$SURICATA_BUILD_CONF" | sed -e 's/^/"/' | sed -e 's/$/\\n"/' >>src/build-info.h | |
2206 | echo ");" >>src/build-info.h | |
25804f5a | 2207 | |
668113af | 2208 | echo " |
25804f5a | 2209 | To build and install run 'make' and 'make install'. |
73a1b972 | 2210 | |
697e9e66 VJ |
2211 | You can run 'make install-conf' if you want to install initial configuration |
2212 | files to ${e_sysconfdir}. Running 'make install-full' will install configuration | |
2213 | and rules and provide you a ready-to-run suricata." | |
73a1b972 VJ |
2214 | echo |
2215 | echo "To install Suricata into /usr/bin/suricata, have the config in | |
2216 | /etc/suricata and use /var/log/suricata as log dir, use: | |
697e9e66 VJ |
2217 | ./configure --prefix=/usr/ --sysconfdir=/etc/ --localstatedir=/var/" |
2218 | echo |