]>
Commit | Line | Data |
---|---|---|
6899b3da | 1 | #TODO A better place for default CFLAGS? |
0ffa1c24 | 2 | |
e0ddcdd1 | 3 | AC_INIT(configure.ac) |
bab4b623 | 4 | |
a3510f20 | 5 | AM_CONFIG_HEADER(config.h) |
86608779 | 6 | AM_INIT_AUTOMAKE(suricata, 1.4dev) |
a3510f20 WM |
7 | |
8 | AC_LANG_C | |
ff6a2a01 | 9 | AC_PROG_CC_C99 |
769022f4 | 10 | AC_PROG_LIBTOOL |
a3510f20 WM |
11 | |
12 | AC_DEFUN([FAIL_MESSAGE],[ | |
13 | echo | |
14 | echo | |
15 | echo "**********************************************" | |
16 | echo " ERROR: unable to find" $1 | |
17 | echo " checked in the following places" | |
18 | for i in `echo $2`; do | |
19 | echo " $i" | |
20 | done | |
21 | echo "**********************************************" | |
22 | echo | |
23 | exit 1 | |
24 | ]) | |
25 | ||
3678dda1 WM |
26 | AC_DEFUN([LIBNET_FAIL_WARN],[ |
27 | echo | |
28 | echo "*************************************************************************" | |
29 | echo " Warning! libnet version 1.1.x could not be found in " $1 | |
30 | echo " Reject keywords will not be supported." | |
31 | echo " If you require reject support plese install libnet 1.1.x. " | |
32 | echo " If libnet is not installed in a non-standard location please use the" | |
33 | echo " --with-libnet-includes and --with-libnet-libraries configure options" | |
34 | echo "*************************************************************************" | |
35 | echo | |
36 | ]) | |
37 | ||
1f94239d EL |
38 | if test `basename $CC` = "clang"; then |
39 | CFLAGS="$CFLAGS -Wextra -Werror-implicit-function-declaration" | |
467f28e9 VJ |
40 | AC_MSG_CHECKING([clang __sync_bool_compare_and_swap]) |
41 | AC_TRY_COMPILE([#include <stdio.h>], | |
42 | [ unsigned int i = 0; (void)__sync_bool_compare_and_swap(&i, 1, 1);], | |
43 | [ | |
44 | AC_DEFINE([__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1], [1], [Fake GCC atomic support]) | |
45 | AC_DEFINE([__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2], [1], [Fake GCC atomic support]) | |
46 | AC_DEFINE([__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4], [1], [Fake GCC atomic support]) | |
47 | AC_DEFINE([__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8], [1], [Fake GCC atomic support]) | |
48 | AC_MSG_RESULT([yes]) ], | |
49 | [AC_MSG_RESULT([no])]) | |
bda87024 | 50 | fi |
1f94239d EL |
51 | if test `basename $CC` = "gcc"; then |
52 | dnl get gcc version | |
53 | AC_MSG_CHECKING([gcc version]) | |
54 | gccver=$($CC -dumpversion) | |
55 | gccvermajor=$(echo $gccver | cut -d . -f1) | |
56 | gccverminor=$(echo $gccver | cut -d . -f2) | |
57 | gccvernum=$(expr $gccvermajor "*" 100 + $gccverminor) | |
58 | AC_MSG_RESULT($gccver) | |
59 | ||
60 | if test "$gccvernum" -ge "400"; then | |
61 | dnl gcc 4.0 or later | |
62 | CFLAGS="$CFLAGS -Wextra -Werror-implicit-function-declaration" | |
042d0c6e VJ |
63 | # remove optimization options that break our code |
64 | # VJ 2010/06/27: no-tree-pre added. It breaks ringbuffers code. | |
65 | CFLAGS="$CFLAGS -fno-tree-pre" | |
1f94239d EL |
66 | else |
67 | CFLAGS="$CFLAGS -W" | |
68 | fi | |
1f94239d EL |
69 | fi |
70 | CFLAGS="$CFLAGS -Wall -fno-strict-aliasing" | |
bda87024 | 71 | CFLAGS="$CFLAGS -Wno-unused-parameter" |
9f0bf35c | 72 | CFLAGS="$CFLAGS -std=gnu99" |
0ffa1c24 | 73 | |
89cee0ad | 74 | # Checks for programs. |
fa5939ca BR |
75 | AC_PROG_AWK |
76 | AC_PROG_CC | |
77 | AC_PROG_CPP | |
78 | AC_PROG_INSTALL | |
79 | AC_PROG_LN_S | |
80 | AC_PROG_MAKE_SET | |
fa5939ca | 81 | |
9f1d779a WM |
82 | AC_PATH_PROG(HAVE_PKG_CONFIG, pkg-config, "no") |
83 | if test "$HAVE_PKG_CONFIG" = "no"; then | |
89cee0ad VJ |
84 | echo |
85 | echo " ERROR! pkg-config not found, go get it " | |
86 | echo " http://pkg-config.freedesktop.org/wiki/ " | |
87 | echo " or install from your distribution " | |
88 | echo | |
89 | exit 1 | |
9f1d779a WM |
90 | fi |
91 | ||
7c841e1d EL |
92 | AC_PATH_PROG(HAVE_COCCINELLE_CONFIG, spatch, "no") |
93 | if test "$HAVE_COCCINELLE_CONFIG" = "no"; then | |
89cee0ad VJ |
94 | echo |
95 | echo " Warning! spatch not found, you will not be " | |
96 | echo " able to run code checking with coccinelle " | |
97 | echo " get it from http://coccinelle.lip6.fr " | |
98 | echo " or install from your distribution " | |
99 | echo | |
7c841e1d EL |
100 | fi |
101 | AM_CONDITIONAL([HAVE_COCCINELLE], [test "$HAVE_COCCINELLE_CONFIG" != "no"]) | |
102 | ||
103 | ||
89cee0ad | 104 | # Checks for libraries. |
7c841e1d | 105 | |
89cee0ad | 106 | # Checks for header files. |
472e061c VJ |
107 | AC_CHECK_HEADERS([arpa/inet.h assert.h ctype.h errno.h fcntl.h inttypes.h]) |
108 | AC_CHECK_HEADERS([getopt.h]) | |
109 | AC_CHECK_HEADERS([limits.h netdb.h netinet/in.h poll.h sched.h signal.h]) | |
110 | AC_CHECK_HEADERS([stdarg.h stdint.h stdio.h stdlib.h string.h sys/ioctl.h]) | |
111 | AC_CHECK_HEADERS([syslog.h sys/prctl.h sys/socket.h sys/stat.h sys/syscall.h]) | |
b63c2eda | 112 | AC_CHECK_HEADERS([sys/time.h time.h unistd.h]) |
472e061c VJ |
113 | AC_CHECK_HEADERS([sys/ioctl.h linux/if_ether.h linux/if_packet.h linux/filter.h]) |
114 | ||
115 | AC_CHECK_HEADERS([sys/socket.h net/if.h sys/mman.h linux/if_arp.h], [], [], | |
5656e344 | 116 | [[#ifdef HAVE_SYS_SOCKET_H |
472e061c VJ |
117 | #include <sys/types.h> |
118 | #include <sys/socket.h> | |
119 | #endif | |
5656e344 EL |
120 | ]]) |
121 | ||
b63c2eda VJ |
122 | AC_CHECK_HEADERS([windows.h winsock2.h ws2tcpip.h], [], [], |
123 | [[#define _X86_ | |
124 | ]]) | |
125 | AC_CHECK_HEADERS([w32api/winbase.h], [], [], | |
126 | [[#define _X86_ | |
127 | #include <windows.h> | |
128 | ]]) | |
fa5939ca | 129 | |
89cee0ad | 130 | # Checks for typedefs, structures, and compiler characteristics. |
fa5939ca BR |
131 | AC_C_INLINE |
132 | AC_TYPE_PID_T | |
133 | AC_TYPE_SIZE_T | |
134 | AC_TYPE_INT32_T | |
135 | AC_TYPE_UINT16_T | |
136 | AC_TYPE_UINT32_T | |
137 | AC_TYPE_UINT64_T | |
138 | AC_TYPE_UINT8_T | |
139 | AC_HEADER_STDBOOL | |
140 | ||
89cee0ad | 141 | # Checks for library functions. |
fa5939ca BR |
142 | AC_FUNC_MALLOC |
143 | AC_FUNC_REALLOC | |
89cee0ad | 144 | AC_CHECK_FUNCS([gettimeofday memset strcasecmp strchr strdup strerror strncasecmp strtol strtoul memchr]) |
fa5939ca | 145 | |
89cee0ad | 146 | # Add large file support |
3b3f5816 WM |
147 | AC_SYS_LARGEFILE |
148 | ||
89cee0ad | 149 | #check for os |
769022f4 PR |
150 | AC_MSG_CHECKING([host os]) |
151 | ||
152 | # If no host os was detected, try with uname | |
25804f5a | 153 | if test -z "$host" ; then |
769022f4 PR |
154 | host="`uname`" |
155 | fi | |
a49bce63 | 156 | echo -n "installation for $host OS... " |
769022f4 | 157 | |
e2bf0fab | 158 | e_magic_file="/usr/share/file/magic" |
769022f4 | 159 | case "$host" in |
829238e4 VJ |
160 | *-*-*freebsd*) |
161 | CFLAGS="${CFLAGS} -DOS_FREEBSD" | |
162 | CPPFLAGS="${CPPFLAGS} -I/usr/local/include -I/usr/local/include/libnet11" | |
163 | LDFLAGS="${LDFLAGS} -L/usr/local/lib -L/usr/local/lib/libnet11" | |
164 | e_magic_file="/usr/share/misc/magic" | |
165 | ;; | |
166 | *-*-openbsd5.1) | |
167 | CFLAGS="${CFLAGS} -D__OpenBSD__ -fgnu89-inline" | |
168 | CPPFLAGS="${CPPFLAGS} -I/usr/local/include -I/usr/local/include/libnet-1.1" | |
169 | LDFLAGS="${LDFLAGS} -L/usr/local/lib -I/usr/local/lib/libnet-1.1" | |
170 | e_magic_file="/usr/local/share/misc/magic.mgc" | |
171 | ;; | |
172 | *-*-openbsd5.2) | |
173 | CFLAGS="${CFLAGS} -D__OpenBSD__" | |
174 | CPPFLAGS="${CPPFLAGS} -I/usr/local/include -I/usr/local/include/libnet-1.1" | |
175 | LDFLAGS="${LDFLAGS} -L/usr/local/lib -I/usr/local/lib/libnet-1.1" | |
176 | e_magic_file="/usr/local/share/misc/magic.mgc" | |
177 | ;; | |
178 | *-*-openbsd*) | |
179 | CFLAGS="${CFLAGS} -D__OpenBSD__ -fgnu89-inline" | |
180 | CPPFLAGS="${CPPFLAGS} -I/usr/local/include -I/usr/local/include/libnet-1.1" | |
181 | LDFLAGS="${LDFLAGS} -L/usr/local/lib -I/usr/local/lib/libnet-1.1" | |
182 | e_magic_file="/usr/local/share/file/magic.mgc" | |
183 | ;; | |
184 | *darwin*|*Darwin*) | |
185 | CFLAGS="${CFLAGS} -DOS_DARWIN" | |
186 | CPPFLAGS="${CPPFLAGS} -I/opt/local/include" | |
187 | LDFLAGS="${LDFLAGS} -L/opt/local/lib" | |
188 | ;; | |
189 | *-*-linux*) | |
190 | #for now do nothing | |
191 | ;; | |
192 | *-*-mingw32*) | |
193 | CFLAGS="${CFLAGS} -DOS_WIN32" | |
194 | LDFLAGS="${LDFLAGS} -lws2_32" | |
195 | WINDOWS_PATH="yes" | |
196 | ;; | |
197 | *-*-cygwin) | |
198 | WINDOWS_PATH="yes" | |
199 | ;; | |
200 | *) | |
201 | AC_MSG_WARN([unsupported OS this may or may not work]) | |
202 | ;; | |
769022f4 PR |
203 | esac |
204 | AC_MSG_RESULT(ok) | |
205 | ||
89cee0ad VJ |
206 | #Enable support for gcc compile time security options. There is no great way to do detection of valid cflags that I have found |
207 | #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. | |
208 | #These flags seem to be supported on CentOS 5+, Ubuntu 8.04+, and FedoreCore 11+ | |
209 | #Options are taken from https://wiki.ubuntu.com/CompilerFlags | |
c49785fb | 210 | AC_ARG_ENABLE(gccprotect, |
e07e9e16 | 211 | AS_HELP_STRING([--enable-gccprotect], [Detect and use gcc hardening options]),,[enable_gccprotect=no]) |
c49785fb | 212 | |
e07e9e16 | 213 | AS_IF([test "x$enable_gccprotect" = "xyes"], [ |
98b9009b WM |
214 | #buffer overflow protection |
215 | AC_MSG_CHECKING(for -fstack-protector) | |
216 | TMPCFLAGS="${CFLAGS}" | |
217 | CFLAGS="${CFLAGS} -fstack-protector" | |
218 | AC_TRY_LINK(,,SECCFLAGS="${SECCFLAGS} -fstack-protector" | |
219 | AC_MSG_RESULT(yes), | |
220 | AC_MSG_RESULT(no)) | |
221 | CFLAGS="${TMPCFLAGS}" | |
222 | ||
223 | #compile-time best-practices errors for certain libc functions, provides checks of buffer lengths and memory regions | |
224 | AC_MSG_CHECKING(for -D_FORTIFY_SOURCE=2) | |
225 | TMPCFLAGS="${CFLAGS}" | |
226 | CFLAGS="${CFLAGS} -D_FORTIFY_SOURCE=2" | |
227 | AC_TRY_COMPILE(,,SECCFLAGS="${SECCFLAGS} -D_FORTIFY_SOURCE=2" | |
228 | AC_MSG_RESULT(yes), | |
229 | AC_MSG_RESULT(no)) | |
230 | CFLAGS="${TMPCFLAGS}" | |
231 | ||
232 | #compile-time warnings about misuse of format strings | |
233 | AC_MSG_CHECKING(for -Wformat -Wformat-security) | |
234 | TMPCFLAGS="${CFLAGS}" | |
235 | CFLAGS="${CFLAGS} -Wformat -Wformat-security" | |
236 | AC_TRY_COMPILE(,,SECCFLAGS="${SECCFLAGS} -Wformat -Wformat-security" | |
237 | AC_MSG_RESULT(yes), | |
238 | AC_MSG_RESULT(no)) | |
239 | CFLAGS="${TMPCFLAGS}" | |
240 | ||
241 | #provides a read-only relocation table area in the final ELF | |
242 | AC_MSG_CHECKING(for -z relro) | |
243 | TMPLDFLAGS="${LDFLAGS}" | |
244 | LDFLAGS="${LDFLAGS} -z relro" | |
245 | AC_TRY_LINK(,,SECLDFLAGS="${SECLDFLAGS} -z relro" | |
246 | AC_MSG_RESULT(yes), | |
247 | AC_MSG_RESULT(no)) | |
248 | LDFLAGS="${TMPLDFLAGS}" | |
249 | ||
250 | #forces all relocations to be resolved at run-time | |
251 | AC_MSG_CHECKING(for -z now) | |
252 | TMPLDFLAGS="${LDFLAGS}" | |
253 | LDFLAGS="${LDFLAGS} -z now" | |
254 | AC_TRY_LINK(,,SECLDFLAGS="${SECLDFLAGS} -z now" | |
255 | AC_MSG_RESULT(yes), | |
256 | AC_MSG_RESULT(no)) | |
257 | LDFLAGS="${TMPLDFLAGS}" | |
258 | ||
259 | CFLAGS="${CFLAGS} ${SECCFLAGS}" | |
260 | LDFLAGS="${LDFLAGS} ${SECLDFLAGS}" | |
e07e9e16 | 261 | ]) |
5bde1217 | 262 | |
89cee0ad | 263 | #enable profile generation |
5bde1217 | 264 | AC_ARG_ENABLE(gccprofile, |
e07e9e16 WM |
265 | AS_HELP_STRING([--enable-gccprofile], [Enable gcc profile info i.e -pg flag is set]),,[enable_gccprofile=no]) |
266 | AS_IF([test "x$enable_gccprofile" = "xyes"], [ | |
267 | CFLAGS="${CFLAGS} -pg" | |
268 | ]) | |
5bde1217 | 269 | |
89cee0ad | 270 | #enable gcc march=native gcc 4.2 or later |
22f3e3d8 | 271 | AC_ARG_ENABLE(gccmarch_native, |
9f0bf35c | 272 | AS_HELP_STRING([--enable-gccmarch-native], [Enable gcc march=native gcc 4.2 and later only]),,[enable_gccmarch_native=yes]) |
e07e9e16 | 273 | AS_IF([test "x$enable_gccmarch_native" = "xyes"], [ |
37b05b23 EL |
274 | if test `basename $CC` = "clang"; then |
275 | OFLAGS="$CFLAGS" | |
276 | CFLAGS="$CFLAGS -march=native" | |
277 | AC_MSG_CHECKING([checking if $CC supports -march=native]) | |
278 | AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([[#include <stdlib.h>]])], | |
279 | [ | |
280 | AC_MSG_RESULT([yes]) | |
281 | CFLAGS="$OFLAGS -march=native" | |
282 | ], | |
283 | [ | |
284 | AC_MSG_RESULT([no]) | |
285 | CFLAGS="$OFLAGS" | |
286 | enable_gccmarch_native=no | |
287 | ] | |
288 | ) | |
289 | fi | |
290 | if test `basename $CC` = "gcc"; then | |
291 | case $host in | |
292 | *darwin*|*Darwin*) | |
293 | if test "$gccvernum" -ge "403"; then | |
294 | dnl gcc 4.3 or later | |
295 | CFLAGS="$CFLAGS -march=native" | |
296 | else | |
297 | enable_gccmarch_native=no | |
298 | fi | |
299 | ;; | |
300 | *) | |
301 | if test "$gccvernum" -ge "402"; then | |
302 | dnl gcc 4.2 or later | |
303 | CFLAGS="$CFLAGS -march=native" | |
304 | fi | |
305 | ;; | |
306 | esac | |
307 | fi | |
e07e9e16 | 308 | ]) |
22f3e3d8 | 309 | |
89cee0ad VJ |
310 | # options |
311 | ||
312 | # enable the running of unit tests | |
313 | AC_ARG_ENABLE(unittests, | |
314 | AS_HELP_STRING([--enable-unittests], [Enable compilation of the unit tests]),,[enable_unittests=no]) | |
315 | AS_IF([test "x$enable_unittests" = "xyes"], [ | |
316 | UT_ENABLED="yes" | |
317 | CFLAGS="${CFLAGS} -DUNITTESTS" | |
318 | ]) | |
319 | ||
320 | AM_CONDITIONAL([BUILD_UNITTESTS], [test "x$enable_unittests" = "xyes"]) | |
321 | ||
322 | # enable workaround for old barnyard2 for unified alert output | |
323 | AC_ARG_ENABLE(old-barnyard2, | |
324 | AS_HELP_STRING([--enable-old-barnyard2], [Use workaround for old barnyard2 in unified2 output]),,[enable_old_barnyard2=no]) | |
325 | AS_IF([test "x$enable_old_barnyard2" = "xyes"], [ | |
326 | CFLAGS="${CFLAGS} -DHAVE_OLD_BARNYARD2" | |
327 | ]) | |
328 | ||
329 | # enable debug output | |
330 | AC_ARG_ENABLE(debug, | |
331 | AS_HELP_STRING([--enable-debug], [Enable debug output]),,[enable_debug=no]) | |
332 | AS_IF([test "x$enable_debug" = "xyes"], [ | |
333 | CFLAGS="${CFLAGS} -DDEBUG" | |
334 | ]) | |
335 | ||
336 | # enable debug validation functions & macro's output | |
337 | AC_ARG_ENABLE(debug-validation, | |
338 | AS_HELP_STRING([--enable-debug-validation], [Enable (debug) validation code output]),,[enable_debug_validation=no]) | |
339 | AS_IF([test "x$enable_debug_validation" = "xyes"], [ | |
340 | CFLAGS="${CFLAGS} -DDEBUG_VALIDATION" | |
341 | ]) | |
342 | ||
343 | # profiling support | |
344 | AC_ARG_ENABLE(profiling, | |
345 | AS_HELP_STRING([--enable-profiling], [Enable performance profiling]),,[enable_profiling=no]) | |
346 | AS_IF([test "x$enable_profiling" = "xyes"], [ | |
ac5bab88 EL |
347 | |
348 | case "$host" in | |
349 | *-*-openbsd*) | |
350 | AC_MSG_ERROR([profiling is not supported on OpenBSD]) | |
351 | ;; | |
352 | *) | |
353 | CFLAGS="${CFLAGS} -DPROFILING" | |
354 | ;; | |
355 | esac | |
89cee0ad VJ |
356 | ]) |
357 | ||
d908e707 VJ |
358 | # profiling support, locking |
359 | AC_ARG_ENABLE(profiling-locks, | |
360 | AS_HELP_STRING([--enable-profiling-locks], [Enable performance profiling for locks]),,[enable_profiling_locks=no]) | |
361 | AS_IF([test "x$enable_profiling_locks" = "xyes"], [ | |
362 | CFLAGS="${CFLAGS} -DPROFILING -DPROFILE_LOCKING" | |
363 | ]) | |
364 | ||
89cee0ad VJ |
365 | # enable support for IPFW |
366 | AC_ARG_ENABLE(ipfw, | |
367 | AS_HELP_STRING([--enable-ipfw], [Enable FreeBSD IPFW support for inline IDP]),,[enable_ipfw=no]) | |
368 | AS_IF([test "x$enable_ipfw" = "xyes"], [ | |
369 | CFLAGS="$CFLAGS -DIPFW" | |
370 | ]) | |
371 | ||
372 | # libraries | |
373 | ||
374 | #libpcre | |
a3510f20 WM |
375 | AC_ARG_WITH(libpcre_includes, |
376 | [ --with-libpcre-includes=DIR libpcre include directory], | |
377 | [with_libpcre_includes="$withval"],[with_libpcre_includes=no]) | |
378 | AC_ARG_WITH(libpcre_libraries, | |
379 | [ --with-libpcre-libraries=DIR libpcre library directory], | |
380 | [with_libpcre_libraries="$withval"],[with_libpcre_libraries="no"]) | |
381 | ||
382 | if test "$with_libpcre_includes" != "no"; then | |
89f83c2e | 383 | CPPFLAGS="${CPPFLAGS} -I${with_libpcre_includes}" |
a3510f20 | 384 | fi |
a3510f20 | 385 | AC_CHECK_HEADER(pcre.h,,[AC_ERROR(pcre.h not found ...)]) |
6899b3da | 386 | |
a3510f20 | 387 | if test "$with_libpcre_libraries" != "no"; then |
89f83c2e | 388 | LDFLAGS="${LDFLAGS} -L${with_libpcre_libraries}" |
a3510f20 | 389 | fi |
a3510f20 WM |
390 | PCRE="" |
391 | AC_CHECK_LIB(pcre, pcre_get_substring,, PCRE="no") | |
89f83c2e VJ |
392 | if test "$PCRE" = "no"; then |
393 | echo | |
394 | echo " ERROR! pcre library not found, go get it" | |
395 | echo " from www.pcre.org." | |
396 | echo | |
397 | exit 1 | |
398 | fi | |
6899b3da | 399 | |
89f83c2e VJ |
400 | # To prevent duping the lib link we reset LIBS after this check. Setting action-if-found to NULL doesn't seem to work |
401 | # see: http://blog.flameeyes.eu/2008/04/29/i-consider-ac_check_lib-harmful | |
402 | PCRE="" | |
403 | TMPLIBS="${LIBS}" | |
404 | AC_CHECK_LIB(pcre, pcre_dfa_exec,, PCRE="no") | |
a3510f20 | 405 | if test "$PCRE" = "no"; then |
89f83c2e VJ |
406 | echo |
407 | echo " ERROR! pcre library was found but version was < 6.0" | |
408 | echo " please upgrade to a newer version of pcre which you can get from" | |
409 | echo " www.pcre.org." | |
410 | echo | |
411 | exit 1 | |
a3510f20 | 412 | fi |
89f83c2e | 413 | LIBS="${TMPLIBS}" |
6899b3da | 414 | |
89f83c2e VJ |
415 | AC_TRY_COMPILE([ #include <pcre.h> ], |
416 | [ int eo = 0; eo |= PCRE_EXTRA_MATCH_LIMIT_RECURSION; ], | |
417 | [ pcre_match_limit_recursion_available=yes ], [:] | |
418 | ) | |
419 | if test "$pcre_match_limit_recursion_available" != "yes"; then | |
420 | CFLAGS="${CFLAGS} -DNO_PCRE_MATCH_RLIMIT" | |
421 | echo | |
422 | echo " Warning! pcre extra opt PCRE_EXTRA_MATCH_LIMIT_RECURSION not found" | |
423 | echo " This could lead to potential DoS please upgrade to pcre >= 6.5" | |
424 | echo " Continuing for now...." | |
425 | echo " from www.pcre.org." | |
426 | echo | |
427 | fi | |
5bde1217 | 428 | |
3d396e8b | 429 | #enable support for PCRE-jit available since pcre-8.20 |
3d558bf0 EL |
430 | AC_MSG_CHECKING(for PCRE JIT support) |
431 | AC_TRY_COMPILE([ #include <pcre.h> ], | |
432 | [ | |
433 | int jit = 0; | |
434 | pcre_config(PCRE_CONFIG_JIT, &jit); | |
435 | ], | |
436 | [ pcre_jit_available=yes ], [ pcre_jit_available=no ] | |
437 | ) | |
438 | ||
439 | if test "x$pcre_jit_available" = "xyes"; then | |
440 | AC_MSG_RESULT(yes) | |
441 | AC_DEFINE([PCRE_HAVE_JIT], [1], [Pcre with JIT compiler support enabled]) | |
442 | ||
443 | AC_MSG_CHECKING(for PCRE JIT support usability) | |
444 | AC_TRY_COMPILE([ #include <pcre.h> ], | |
445 | [ | |
446 | const char* regexstr = "(a|b|c|d)"; | |
447 | pcre *re; | |
448 | const char *error; | |
449 | pcre_extra *extra; | |
450 | int err_offset; | |
451 | re = pcre_compile(regexstr,0, &error, &err_offset,NULL); | |
452 | extra = pcre_study(re, PCRE_STUDY_JIT_COMPILE, &error); | |
453 | if (extra == NULL) | |
454 | exit(EXIT_FAILURE); | |
455 | int jit = 0; | |
456 | int ret = pcre_fullinfo(re, extra, PCRE_INFO_JIT, &jit); | |
457 | if (ret != 0 || jit != 1) | |
458 | exit(EXIT_FAILURE); | |
459 | exit(EXIT_SUCCESS); | |
460 | ], | |
461 | [ pcre_jit_works=yes ], [:] | |
462 | ) | |
463 | if test "x$pcre_jit_works" != "xyes"; then | |
464 | AC_MSG_RESULT(no) | |
465 | echo | |
466 | echo " PCRE JIT support detection worked but testing it failed" | |
467 | echo " something odd is going on, please file a bug report." | |
468 | echo | |
469 | exit 1 | |
470 | else | |
471 | AC_MSG_RESULT(yes) | |
472 | fi | |
5ea1b1d1 | 473 | else |
89f83c2e | 474 | AC_MSG_RESULT(no) |
3d558bf0 | 475 | fi |
3d396e8b | 476 | |
89cee0ad | 477 | # libyaml |
c91a4baa JI |
478 | AC_ARG_WITH(libyaml_includes, |
479 | [ --with-libyaml-includes=DIR libyaml include directory], | |
480 | [with_libyaml_includes="$withval"],[with_libyaml_includes=no]) | |
481 | AC_ARG_WITH(libyaml_libraries, | |
482 | [ --with-libyaml-libraries=DIR libyaml library directory], | |
483 | [with_libyaml_libraries="$withval"],[with_libyaml_libraries="no"]) | |
484 | ||
485 | if test "$with_libyaml_includes" != "no"; then | |
89f83c2e | 486 | CPPFLAGS="${CPPFLAGS} -I${with_libyaml_includes}" |
c91a4baa JI |
487 | fi |
488 | ||
489 | AC_CHECK_HEADER(yaml.h,,LIBYAML="no") | |
490 | ||
491 | if test "$with_libyaml_libraries" != "no"; then | |
89f83c2e | 492 | LDFLAGS="${LDFLAGS} -L${with_libyaml_libraries}" |
c91a4baa JI |
493 | fi |
494 | ||
495 | LIBYAML="" | |
496 | AC_CHECK_LIB(yaml,yaml_parser_initialize,,LIBYAML="no") | |
497 | ||
498 | if test "$LIBYAML" = "no"; then | |
89cee0ad VJ |
499 | echo |
500 | echo " ERROR! libyaml library not found, go get it" | |
501 | echo " from http://pyyaml.org/wiki/LibYAML " | |
502 | echo " or your distribution:" | |
503 | echo | |
504 | echo " Ubuntu: apt-get install libyaml-dev" | |
505 | echo " Fedora: yum install libyaml-devel" | |
506 | echo | |
507 | exit 1 | |
c91a4baa JI |
508 | fi |
509 | ||
89cee0ad | 510 | # libpthread |
a3510f20 WM |
511 | AC_ARG_WITH(libpthread_includes, |
512 | [ --with-libpthread-includes=DIR libpthread include directory], | |
513 | [with_libpthread_includes="$withval"],[with_libpthread_includes=no]) | |
514 | AC_ARG_WITH(libpthread_libraries, | |
515 | [ --with-libpthread-libraries=DIR libpthread library directory], | |
516 | [with_libpthread_libraries="$withval"],[with_libpthread_libraries="no"]) | |
517 | ||
518 | if test "$with_libpthread_includes" != "no"; then | |
89f83c2e | 519 | CPPFLAGS="${CPPFLAGS} -I${with_libpthread_includes}" |
a3510f20 | 520 | fi |
6899b3da | 521 | |
fa5939ca | 522 | dnl AC_CHECK_HEADER(pthread.h,,[AC_ERROR(pthread.h not found ...)]) |
6899b3da | 523 | |
a3510f20 | 524 | if test "$with_libpthread_libraries" != "no"; then |
89f83c2e | 525 | LDFLAGS="${LDFLAGS} -L${with_libpthread_libraries}" |
a3510f20 | 526 | fi |
6899b3da | 527 | |
a3510f20 WM |
528 | PTHREAD="" |
529 | AC_CHECK_LIB(pthread, pthread_create,, PTHREAD="no") | |
6899b3da | 530 | |
a3510f20 | 531 | if test "$PTHREAD" = "no"; then |
89f83c2e VJ |
532 | echo |
533 | echo " ERROR! libpthread library not found, glibc problem?" | |
534 | echo | |
535 | exit 1 | |
a3510f20 WM |
536 | fi |
537 | ||
20a8b9db EL |
538 | # libjansson |
539 | enable_jansson="no" | |
540 | AC_ARG_WITH(libjansson_includes, | |
541 | [ --with-libjansson-includes=DIR libjansson include directory], | |
542 | [with_libjansson_includes="$withval"],[with_libjansson_includes=no]) | |
543 | AC_ARG_WITH(libjansson_libraries, | |
544 | [ --with-libjansson-libraries=DIR libjansson library directory], | |
545 | [with_libjansson_libraries="$withval"],[with_libjansson_libraries="no"]) | |
546 | ||
547 | if test "$with_libjansson_includes" != "no"; then | |
548 | CPPFLAGS="${CPPFLAGS} -I${with_libjansson_includes}" | |
549 | fi | |
550 | ||
551 | enable_jansson="no" | |
552 | enable_unixsocket="no" | |
553 | AC_CHECK_HEADER(jansson.h,JANSSON="yes",JANSSON="no") | |
554 | if test "$JANSSON" = "yes"; then | |
555 | if test "$with_libjansson_libraries" != "no"; then | |
556 | LDFLAGS="${LDFLAGS} -L${with_libjansson_libraries}" | |
557 | fi | |
558 | ||
559 | AC_CHECK_LIB(jansson, json_loads,, JANSSON="no") | |
560 | enable_jansson="yes" | |
561 | if test "$JANSSON" = "no"; then | |
562 | echo | |
563 | echo " Jansson is required for features like unix socket" | |
ef45f7da EL |
564 | echo " Go get it from your distribution of from:" |
565 | echo " http://www.digip.org/jansson/" | |
20a8b9db EL |
566 | echo |
567 | enable_unixsocket="no" | |
568 | enable_jansson="no" | |
569 | else | |
570 | case $host in | |
571 | *-*-mingw32*) | |
572 | ;; | |
573 | *-*-cygwin) | |
574 | ;; | |
575 | *) | |
576 | enable_unixsocket="yes" | |
577 | ;; | |
578 | esac | |
579 | fi | |
580 | fi | |
581 | ||
582 | AS_IF([test "x$enable_unixsocket" = "xyes"], [AC_DEFINE([BUILD_UNIX_SOCKET], [1], [Unix socket support enabled])]) | |
583 | ||
89cee0ad | 584 | #enable support for NFQUEUE |
a3510f20 | 585 | AC_ARG_ENABLE(nfqueue, |
e07e9e16 WM |
586 | AS_HELP_STRING([--enable-nfqueue], [Enable NFQUEUE support for inline IDP]),,[enable_nfqueue=no]) |
587 | AS_IF([test "x$enable_nfqueue" = "xyes"], [ | |
588 | CFLAGS="$CFLAGS -DNFQ" | |
6899b3da | 589 | |
89cee0ad VJ |
590 | # libnfnetlink |
591 | case $host in | |
592 | *-*-mingw32*) | |
593 | ;; | |
594 | *) | |
595 | AC_ARG_WITH(libnfnetlink_includes, | |
596 | [ --with-libnfnetlink-includes=DIR libnfnetlink include directory], | |
597 | [with_libnfnetlink_includes="$withval"],[with_libnfnetlink_includes=no]) | |
598 | AC_ARG_WITH(libnfnetlink_libraries, | |
599 | [ --with-libnfnetlink-libraries=DIR libnfnetlink library directory], | |
600 | [with_libnfnetlink_libraries="$withval"],[with_libnfnetlink_libraries="no"]) | |
601 | ||
602 | if test "$with_libnfnetlink_includes" != "no"; then | |
603 | CPPFLAGS="${CPPFLAGS} -I${with_libnfnetlink_includes}" | |
604 | fi | |
0ffa1c24 | 605 | |
89cee0ad | 606 | AC_CHECK_HEADER(libnfnetlink/libnfnetlink.h,,[AC_ERROR(libnfnetlink.h not found ...)]) |
0ffa1c24 | 607 | |
89cee0ad VJ |
608 | if test "$with_libnfnetlink_libraries" != "no"; then |
609 | LDFLAGS="${LDFLAGS} -L${with_libnfnetlink_libraries}" | |
610 | fi | |
0ffa1c24 | 611 | |
89cee0ad VJ |
612 | NFNL="" |
613 | AC_CHECK_LIB(nfnetlink, nfnl_fd,, NFNL="no") | |
0ffa1c24 | 614 | |
89cee0ad VJ |
615 | if test "$NFNL" = "no"; then |
616 | echo | |
617 | echo " ERROR! nfnetlink library not found, go get it" | |
618 | echo " from www.netfilter.org." | |
619 | echo " we automatically append libnetfilter_queue/ when searching" | |
620 | echo " for headers etc. when the --with-libnfnetlink-inlcudes directive" | |
621 | echo " is used" | |
622 | echo | |
623 | exit 1 | |
624 | fi | |
625 | ;; | |
626 | esac | |
0ffa1c24 | 627 | |
89cee0ad | 628 | #libnetfilter_queue |
a3510f20 WM |
629 | AC_ARG_WITH(libnetfilter_queue_includes, |
630 | [ --with-libnetfilter_queue-includes=DIR libnetfilter_queue include directory], | |
631 | [with_libnetfilter_queue_includes="$withval"],[with_libnetfilter_queue_includes=no]) | |
632 | AC_ARG_WITH(libnetfilter_queue_libraries, | |
633 | [ --with-libnetfilter_queue-libraries=DIR libnetfilter_queue library directory], | |
634 | [with_libnetfilter_queue_libraries="$withval"],[with_libnetfilter_queue_libraries="no"]) | |
635 | ||
636 | if test "$with_libnetfilter_queue_includes" != "no"; then | |
89cee0ad | 637 | CPPFLAGS="${CPPFLAGS} -I${with_libnetfilter_queue_includes}" |
a3510f20 | 638 | fi |
0ffa1c24 | 639 | |
a3510f20 | 640 | AC_CHECK_HEADER(libnetfilter_queue/libnetfilter_queue.h,,[AC_ERROR(libnetfilter_queue/libnetfilter_queue.h not found ...)]) |
0ffa1c24 | 641 | |
a3510f20 | 642 | if test "$with_libnetfilter_queue_libraries" != "no"; then |
89cee0ad | 643 | LDFLAGS="${LDFLAGS} -L${with_libnetfilter_queue_libraries}" |
a3510f20 | 644 | fi |
0ffa1c24 | 645 | |
89cee0ad | 646 | #LDFLAGS="${LDFLAGS} -lnetfilter_queue" |
0ffa1c24 | 647 | |
a3510f20 | 648 | NFQ="" |
89cee0ad VJ |
649 | case $host in |
650 | *-*-mingw32*) | |
651 | AC_CHECK_LIB(netfilter_queue, nfq_open,, NFQ="no",-lws2_32) | |
366671a8 | 652 | |
89cee0ad | 653 | AC_ARG_WITH(netfilterforwin_includes, |
366671a8 JJ |
654 | [ --with-netfilterforwin-includes=DIR netfilterforwin include directory], |
655 | [with_netfilterforwin_includes="$withval"],[with_netfilterforwin_includes=no]) | |
656 | ||
89cee0ad VJ |
657 | if test "$with_netfilterforwin_includes" != "no"; then |
658 | CPPFLAGS="${CPPFLAGS} -I${with_netfilterforwin_includes}" | |
659 | else | |
660 | CPPFLAGS="${CPPFLAGS} -I../../netfilterforwin" | |
661 | fi | |
662 | ;; | |
663 | *) | |
664 | AC_CHECK_LIB(netfilter_queue, nfq_open,, NFQ="no",) | |
665 | 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]) | |
666 | 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 | 667 | 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]) |
89cee0ad VJ |
668 | |
669 | # check if the argument to nfq_get_payload is signed or unsigned | |
670 | AC_MSG_CHECKING([for signed nfq_get_payload payload argument]) | |
671 | STORECFLAGS="${CFLAGS}" | |
adbf85c4 EL |
672 | if test `basename $CC` = "clang"; then |
673 | CFLAGS="${CFLAGS} -Werror=incompatible-pointer-types" | |
674 | else | |
58bf4ea4 | 675 | CFLAGS="${CFLAGS} -Werror" |
adbf85c4 | 676 | fi |
89cee0ad | 677 | AC_COMPILE_IFELSE( |
c9f9e3f9 VJ |
678 | [AC_LANG_PROGRAM( |
679 | [ | |
680 | #include <libnetfilter_queue/libnetfilter_queue.h> | |
681 | ], | |
682 | [ | |
683 | char *pktdata; | |
684 | nfq_get_payload(NULL, &pktdata); | |
685 | ])], | |
686 | [libnetfilter_queue_nfq_get_payload_signed="yes"], | |
687 | [libnetfilter_queue_nfq_get_payload_signed="no"]) | |
89cee0ad VJ |
688 | AC_MSG_RESULT($libnetfilter_queue_nfq_get_payload_signed) |
689 | if test "x$libnetfilter_queue_nfq_get_payload_signed" = "xyes"; then | |
adbf85c4 | 690 | AC_DEFINE([NFQ_GET_PAYLOAD_SIGNED], [1], [For signed version of nfq_get_payload]) |
89cee0ad VJ |
691 | fi |
692 | CFLAGS="${STORECFLAGS}" | |
693 | ;; | |
694 | esac | |
0ffa1c24 | 695 | |
a3510f20 | 696 | if test "$NFQ" = "no"; then |
89cee0ad VJ |
697 | echo |
698 | echo " ERROR! libnetfilter_queue library not found, go get it" | |
699 | echo " from www.netfilter.org." | |
700 | echo " we automatically append libnetfilter_queue/ when searching" | |
701 | echo " for headers etc. when the --with-libnfq-includes directive" | |
702 | echo " is used" | |
703 | echo | |
e0ddcdd1 | 704 | exit 1 |
a3510f20 | 705 | fi |
89cee0ad | 706 | ]) |
2b7b78f1 | 707 | |
89cee0ad | 708 | # prelude |
eb33dc16 | 709 | AC_ARG_ENABLE(prelude, |
e07e9e16 | 710 | AS_HELP_STRING([--enable-prelude], [Enable Prelude support for alerts]),,[enable_prelude=no]) |
4e84ffe2 | 711 | AS_IF([test "x$enable_prelude" = "xyes"], [ |
eb33dc16 PC |
712 | CFLAGS="$CFLAGS -DPRELUDE" |
713 | AM_PATH_LIBPRELUDE(0.9.9, , AC_MSG_ERROR(Cannot find libprelude: Is libprelude-config in the path?), no) | |
714 | if test "x${LIBPRELUDE_CFLAGS}" != "x"; then | |
715 | CPPFLAGS="${CPPFLAGS} ${LIBPRELUDE_CFLAGS}" | |
716 | fi | |
717 | ||
718 | if test "x${LIBPRELUDE_LDFLAGS}" != "x"; then | |
719 | LDFLAGS="${LDFLAGS} ${LIBPRELUDE_LDFLAGS}" | |
720 | fi | |
721 | ||
722 | if test "x${LIBPRELUDE_LIBS}" != "x"; then | |
723 | LDFLAGS="${LDFLAGS} ${LIBPRELUDE_LIBS}" | |
724 | fi | |
4e84ffe2 | 725 | ]) |
eb33dc16 | 726 | |
89cee0ad | 727 | # libnet |
a3510f20 WM |
728 | AC_ARG_WITH(libnet_includes, |
729 | [ --with-libnet-includes=DIR libnet include directory], | |
730 | [with_libnet_includes="$withval"],[with_libnet_includes="no"]) | |
731 | ||
732 | AC_ARG_WITH(libnet_libraries, | |
733 | [ --with-libnet-libraries=DIR libnet library directory], | |
734 | [with_libnet_libraries="$withval"],[with_libnet_libraries="no"]) | |
735 | ||
736 | if test "x$with_libnet_includes" != "xno"; then | |
3678dda1 WM |
737 | CPPFLAGS="${CPPFLAGS} -I${with_libnet_includes}" |
738 | libnet_dir="${with_libnet_includes}" | |
f7111f38 | 739 | else |
829238e4 | 740 | libnet_dir="/usr/include /usr/local/include /usr/local/include/libnet11 /opt/local/include /usr/local/include/libnet-1.1" |
a3510f20 | 741 | fi |
0ffa1c24 | 742 | |
a3510f20 | 743 | if test "x$with_libnet_libraries" != "xno"; then |
3678dda1 | 744 | LDFLAGS="${LDFLAGS} -L${with_libnet_libraries}" |
a3510f20 WM |
745 | fi |
746 | ||
3678dda1 | 747 | LIBNET_DETECT_FAIL="no" |
a3510f20 | 748 | LIBNET_INC_DIR="" |
3678dda1 | 749 | |
a3510f20 WM |
750 | for i in $libnet_dir; do |
751 | if test -r "$i/libnet.h"; then | |
3678dda1 | 752 | LIBNET_INC_DIR="$i" |
a3510f20 WM |
753 | fi |
754 | done | |
755 | ||
3678dda1 | 756 | AC_MSG_CHECKING(for libnet.h version 1.1.x) |
a3510f20 | 757 | if test "$LIBNET_INC_DIR" != ""; then |
3678dda1 WM |
758 | if eval "grep LIBNET_VERSION $LIBNET_INC_DIR/libnet.h | grep -v 1.1 >/dev/null"; then |
759 | AC_MSG_RESULT(no) | |
760 | LIBNET_DETECT_FAIL="yes" | |
761 | LIBNET_FAIL_WARN($libnet_dir) | |
762 | else | |
763 | AC_MSG_RESULT(yes) | |
764 | fi | |
6e8c75ff | 765 | |
3678dda1 WM |
766 | #CentOS, Fedora, Ubuntu-LTS, Ubuntu all set defines to the same values. libnet-config seems |
767 | #to have been depreciated but all distro's seem to include it as part of the package. | |
768 | if test "$LIBNET_DETECT_FAIL" = "no"; then | |
769 | LLIBNET="" | |
770 | AC_CHECK_LIB(net, libnet_write,, LLIBNET="no") | |
771 | if test "$LLIBNET" != "no"; then | |
772 | CFLAGS="${CFLAGS} -DHAVE_LIBNET11 -D_BSD_SOURCE -D__BSD_SOURCE -D__FAVOR_BSD -DHAVE_NET_ETHERNET_H" | |
773 | else | |
774 | #if we displayed a warning already no reason to do it again. | |
775 | if test "$LIBNET_DETECT_FAIL" = "no"; then | |
776 | LIBNET_DETECT_FAIL="yes" | |
777 | LIBNET_FAIL_WARN($libnet_dir) | |
778 | fi | |
779 | fi | |
780 | ||
781 | # see if we have the patched libnet 1.1 | |
782 | # http://www.inliniac.net/blog/2007/10/16/libnet-11-ipv6-fixes-and-additions.html | |
783 | # | |
784 | # To prevent duping the lib link we reset LIBS after this check. Setting action-if-found to NULL doesn't seem to work | |
785 | # see: http://blog.flameeyes.eu/2008/04/29/i-consider-ac_check_lib-harmful | |
786 | if test "$LIBNET_DETECT_FAIL" = "no"; then | |
787 | LLIBNET="" | |
788 | TMPLIBS="${LIBS}" | |
789 | AC_CHECK_LIB(net, libnet_build_icmpv6_unreach,, LLIBNET="no") | |
790 | if test "$LLIBNET" != "no"; then | |
791 | CFLAGS="$CFLAGS -DHAVE_LIBNET_ICMPV6_UNREACH" | |
792 | fi | |
793 | LIBS="${TMPLIBS}" | |
794 | fi | |
795 | fi | |
a3510f20 | 796 | else |
3678dda1 WM |
797 | LIBNET_DETECT_FAIL="yes" |
798 | LIBNET_FAIL_WARN($libnet_dir) | |
a3510f20 | 799 | fi |
89cee0ad VJ |
800 | # libpfring (currently only supported for libpcap enabled pfring) |
801 | # Error on the side of caution. If libpfring enabled pcap is being used and we don't link against -lpfring compilation will fail. | |
04b0f177 | 802 | AC_ARG_ENABLE(pfring, |
e07e9e16 WM |
803 | AS_HELP_STRING([--enable-pfring], [Enable Native PF_RING support]),,[enable_pfring=no]) |
804 | AS_IF([test "x$enable_pfring" = "xyes"], [ | |
805 | CFLAGS="$CFLAGS -DHAVE_PFRING" | |
ddf995da | 806 | |
89cee0ad | 807 | #We have to set CFLAGS for AC_TRY_COMPILE as it doesn't pay attention to CPPFLAGS |
6408feba W |
808 | AC_ARG_WITH(libpfring_includes, |
809 | [ --with-libpfring-includes=DIR libpfring include directory], | |
810 | [with_libpfring_includes="$withval"],[with_libpfring_includes=no]) | |
811 | AC_ARG_WITH(libpfring_libraries, | |
812 | [ --with-libpfring-libraries=DIR libpfring library directory], | |
813 | [with_libpfring_libraries="$withval"],[with_libpfring_libraries="no"]) | |
814 | ||
815 | if test "$with_libpfring_includes" != "no"; then | |
89f83c2e | 816 | CPPFLAGS="${CPPFLAGS} -I${with_libpfring_includes}" |
6408feba | 817 | fi |
073d0421 | 818 | |
6408feba | 819 | if test "$with_libpfring_libraries" != "no"; then |
89f83c2e | 820 | LDFLAGS="${LDFLAGS} -L${with_libpfring_libraries}" |
6408feba | 821 | fi |
073d0421 | 822 | |
6408feba | 823 | LIBPFRING="" |
43ffd779 | 824 | AC_CHECK_LIB(pfring, pfring_open,, LIBPFRING="no", [-lpcap]) |
6408feba W |
825 | if test "$LIBPFRING" = "no"; then |
826 | if test "x$enable_pfring" = "xyes"; then | |
827 | echo | |
828 | echo " ERROR! --enable-pfring was passed but the library was not found or version is >4, go get it" | |
829 | echo " from http://www.ntop.org/PF_RING.html" | |
830 | echo | |
831 | exit 1 | |
832 | fi | |
04b0f177 | 833 | fi |
073d0421 | 834 | |
6408feba | 835 | LIBPFRING_ENABLE_RING="" |
43ffd779 | 836 | AC_CHECK_LIB(pfring, pfring_enable_ring,, LIBPFRING_ENABLE_RING="no", [-lpcap]) |
6408feba W |
837 | if test "$LIBPFRING_ENABLE_RING" != "no"; then |
838 | AC_DEFINE([HAVE_PFRING_ENABLE],[1],[PF_RING pfring_enable_ring is available]) | |
839 | fi | |
1099093e | 840 | |
0ac1cabf EL |
841 | LIBPFRING_CLUSTER_TYPE="" |
842 | AC_CHECK_LIB(pfring, pfring_set_cluster, | |
43ffd779 | 843 | , LIBPFRING_CLUSTER_TYPE="no", [-lpcap]) |
0ac1cabf | 844 | if test "$LIBPFRING_CLUSTER_TYPE" != "no"; then |
6408feba | 845 | AC_DEFINE([HAVE_PFRING_CLUSTER_TYPE],[1],[PF_RING pfring_set_cluster is available]) |
6408feba W |
846 | fi |
847 | ||
0ac1cabf EL |
848 | LIBPFRING_BPF_FILTER="" |
849 | AC_CHECK_LIB(pfring, pfring_set_bpf_filter, | |
43ffd779 | 850 | , LIBPFRING_BPF_FILTER="no", [-lpcap]) |
2aa04add CW |
851 | LIBPFRING_REMOVE_BPF_FILTER="" |
852 | AC_CHECK_LIB(pfring, pfring_remove_bpf_filter, | |
853 | , LIBPFRING_REMOVE_BPF_FILTER="no", [-lpcap]) | |
854 | if test "$LIBPFRING_BPF_FILTER" != "no" -a "$LIBPFRING_REMOVE_BPF_FILTER" != "no"; then | |
d5e254d5 | 855 | AC_DEFINE([HAVE_PFRING_SET_BPF_FILTER],[1],[PF_RING pfring_set_bpf_filter is available]) |
d5e254d5 | 856 | fi |
857 | ||
6408feba W |
858 | STORE_CFLAGS="${CFLAGS}" |
859 | CFLAGS="${CFLAGS} -Werror" | |
860 | AC_MSG_CHECKING([if pfring_recv expects u_char**]) | |
861 | AC_TRY_COMPILE([ | |
862 | #include <pfring.h> | |
863 | ], | |
864 | [ | |
865 | u_char *buffer; | |
dbf5d79e | 866 | pfring_recv(NULL, &buffer, 0, NULL, 1); |
6408feba W |
867 | ], |
868 | [ pfring_recv_uchar_buff=yes ], [:]) | |
869 | ||
870 | CFLAGS="${STORE_CFLAGS}" | |
871 | ||
6408feba W |
872 | if test "$pfring_recv_uchar_buff" = "yes"; then |
873 | AC_DEFINE([HAVE_PFRING_RECV_UCHAR],[1],[PF_RING pfring_recv buffer is u_char**]) | |
874 | AC_MSG_RESULT(yes) | |
875 | else | |
876 | AC_MSG_RESULT(no) | |
877 | fi | |
dbf5d79e EL |
878 | |
879 | # check if the argument to nfq_get_payload is signed or unsigned | |
880 | AC_MSG_CHECKING([for post 5.4.0 pfring_open function]) | |
881 | STORECFLAGS="${CFLAGS}" | |
882 | CFLAGS="${CFLAGS} -Werror" | |
883 | AC_COMPILE_IFELSE( | |
884 | [AC_LANG_PROGRAM( | |
885 | [ | |
886 | #include <pfring.h> | |
887 | ], | |
888 | [ | |
889 | pfring_open(NULL, 0, 0); | |
890 | ])], | |
891 | [pfring_new_open="yes"], | |
892 | [pfring_new_open="no"]) | |
893 | AC_MSG_RESULT($pfring_new_open) | |
894 | if test "x$pfring_new_open" = "xyes"; then | |
895 | AC_DEFINE([HAVE_PFRING_OPEN_NEW], [1], [For post 5.4.0 version of pfring_open]) | |
896 | fi | |
897 | CFLAGS="${STORECFLAGS}" | |
898 | ||
6408feba | 899 | ]) |
ddf995da | 900 | |
c45d8985 | 901 | |
89cee0ad | 902 | # libpcap |
a3510f20 WM |
903 | AC_ARG_WITH(libpcap_includes, |
904 | [ --with-libpcap-includes=DIR libpcap include directory], | |
905 | [with_libpcap_includes="$withval"],[with_libpcap_includes=no]) | |
906 | AC_ARG_WITH(libpcap_libraries, | |
907 | [ --with-libpcap-libraries=DIR libpcap library directory], | |
908 | [with_libpcap_libraries="$withval"],[with_libpcap_libraries="no"]) | |
909 | ||
910 | if test "$with_libpcap_includes" != "no"; then | |
89cee0ad | 911 | CPPFLAGS="${CPPFLAGS} -I${with_libpcap_includes}" |
a3510f20 | 912 | fi |
6899b3da | 913 | |
89cee0ad | 914 | AC_CHECK_HEADER(pcap.h,,[AC_ERROR(pcap.h not found ...)]) |
6899b3da | 915 | |
a3510f20 | 916 | if test "$with_libpcap_libraries" != "no"; then |
89cee0ad | 917 | LDFLAGS="${LDFLAGS} -L${with_libpcap_libraries}" |
a3510f20 | 918 | fi |
472e061c | 919 | AC_CHECK_HEADERS([pcap.h pcap/pcap.h pcap/bpf.h]) |
6899b3da | 920 | |
a3510f20 | 921 | LIBPCAP="" |
ac092197 | 922 | AC_CHECK_LIB(pcap, pcap_open_live,, LIBPCAP="no", [-lpthread]) |
a3510f20 | 923 | if test "$LIBPCAP" = "no"; then |
89cee0ad VJ |
924 | echo |
925 | echo " ERROR! libpcap library not found, go get it" | |
926 | echo " from http://www.tcpdump.org or your distribution:" | |
927 | echo | |
928 | echo " Ubuntu: apt-get install libpcap-dev" | |
929 | echo " Fedora: yum install libpcap-devel" | |
930 | echo | |
931 | exit 1 | |
a3510f20 | 932 | fi |
af992242 | 933 | |
89cee0ad | 934 | # pcap_activate and pcap_create only exists in libpcap >= 1.0 |
a3510f20 | 935 | LIBPCAPVTEST="" |
89cee0ad VJ |
936 | #To prevent duping the lib link we reset LIBS after this check. Setting action-if-found to NULL doesn't seem to work |
937 | #see: http://blog.flameeyes.eu/2008/04/29/i-consider-ac_check_lib-harmful | |
6e8c75ff | 938 | TMPLIBS="${LIBS}" |
a3510f20 | 939 | AC_CHECK_LIB(pcap, pcap_activate,, LPCAPVTEST="no") |
af992242 | 940 | if test "$LPCAPVTEST" != "no"; then |
829238e4 VJ |
941 | AC_PATH_PROG(HAVE_PCAP_CONFIG, pcap-config, "no") |
942 | if test "$HAVE_PCAP_CONFIG" = "no"; then | |
943 | CFLAGS="${CFLAGS} -DLIBPCAP_VERSION_MAJOR=1" | |
944 | else | |
945 | CFLAGS="${CFLAGS} `pcap-config --defines` `pcap-config --cflags` -DLIBPCAP_VERSION_MAJOR=1" | |
946 | fi | |
af992242 | 947 | else |
89cee0ad | 948 | CFLAGS="${CFLAGS} -DLIBPCAP_VERSION_MAJOR=0" |
a3510f20 | 949 | fi |
6e8c75ff | 950 | LIBS="${TMPLIBS}" |
a3510f20 | 951 | |
89cee0ad | 952 | #Appears as if pcap_set_buffer_size is linux only? |
9ce1399d | 953 | LIBPCAPSBUFF="" |
89cee0ad VJ |
954 | #To prevent duping the lib link we reset LIBS after this check. Setting action-if-found to NULL doesn't seem to work |
955 | #see: http://blog.flameeyes.eu/2008/04/29/i-consider-ac_check_lib-harmful | |
9ce1399d WM |
956 | TMPLIBS="${LIBS}" |
957 | AC_CHECK_LIB(pcap, pcap_set_buffer_size,, LPCAPSBUFF="no") | |
958 | if test "$LPCAPSBUFF" != "no"; then | |
89cee0ad | 959 | CFLAGS="${CFLAGS} -DHAVE_PCAP_SET_BUFF" |
9ce1399d WM |
960 | fi |
961 | LIBS="${TMPLIBS}" | |
962 | ||
89cee0ad | 963 | # AF_PACKET support |
e80b30c0 | 964 | AC_ARG_ENABLE(af-packet, |
b2ebd4a1 EL |
965 | AS_HELP_STRING([--enable-af-packet], [Enable AF_PACKET support [default=yes]]), |
966 | ,[enable_af_packet=yes]) | |
e80b30c0 | 967 | AS_IF([test "x$enable_af_packet" = "xyes"], [ |
ac2d13d6 | 968 | AC_CHECK_DECL([TPACKET_V2], |
e80b30c0 | 969 | AC_DEFINE([HAVE_AF_PACKET],[1],[AF_PACKET support is available]), |
ac2d13d6 EL |
970 | [enable_af_packet="no"], |
971 | [[#include <sys/socket.h> | |
972 | #include <linux/if_packet.h>]]) | |
e80b30c0 EL |
973 | AC_CHECK_DECL([PACKET_FANOUT], |
974 | AC_DEFINE([HAVE_PACKET_FANOUT],[1],[Packet fanout support is available]), | |
975 | [], | |
976 | [[#include <linux/if_packet.h>]]) | |
e80b30c0 EL |
977 | ]) |
978 | ||
c45d8985 | 979 | |
89cee0ad | 980 | # libhtp |
e07e9e16 WM |
981 | AC_ARG_ENABLE(non-bundled-htp, |
982 | AS_HELP_STRING([--enable-non-bundled-htp], [Enable the use of an already installed version of htp]),,[enable_non_bundled_htp=no]) | |
983 | AS_IF([test "x$enable_non_bundled_htp" = "xyes"], [ | |
984 | AC_ARG_WITH(libhtp_includes, | |
985 | [ --with-libhtp-includes=DIR libhtp include directory], | |
986 | [with_libhtp_includes="$withval"],[with_libhtp_includes=no]) | |
987 | AC_ARG_WITH(libhtp_libraries, | |
988 | [ --with-libhtp-libraries=DIR libhtp library directory], | |
989 | [with_libhtp_libraries="$withval"],[with_libhtp_libraries="no"]) | |
990 | ||
991 | if test "$with_libhtp_includes" != "no"; then | |
89cee0ad | 992 | CPPFLAGS="${CPPFLAGS} -I${with_libhtp_includes}" |
e07e9e16 | 993 | fi |
07f7ba55 | 994 | |
e07e9e16 | 995 | if test "$with_libhtp_libraries" != "no"; then |
89cee0ad | 996 | LDFLAGS="${LDFLAGS} -L${with_libhtp_libraries}" |
e07e9e16 | 997 | fi |
ed856de9 | 998 | |
e07e9e16 | 999 | AC_CHECK_HEADER(htp/htp.h,,[AC_ERROR(htp/htp.h not found ...)]) |
ed856de9 | 1000 | |
e07e9e16 WM |
1001 | LIBHTP="" |
1002 | AC_CHECK_LIB(htp, htp_conn_create,, LIBHTP="no") | |
1003 | if test "$LIBHTP" = "no"; then | |
89cee0ad VJ |
1004 | echo |
1005 | echo " ERROR! libhtp library not found" | |
1006 | echo | |
1007 | exit 1 | |
e07e9e16 WM |
1008 | fi |
1009 | PKG_CHECK_MODULES(LIBHTPMINVERSION, htp >= 0.2.3,[libhtp_minver_found="yes"],[libhtp_minver_found="no"]) | |
1010 | if test "$libhtp_minver_found" = "no"; then | |
89cee0ad VJ |
1011 | echo |
1012 | echo " ERROR! libhtp was found but is not the minimum version required >=0.2.3" | |
1013 | echo | |
1014 | exit 1 | |
e07e9e16 | 1015 | fi |
a3e2b355 VJ |
1016 | |
1017 | 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 |
1018 | # check for htp_tx_get_response_headers_raw |
1019 | 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]) | |
f7111f38 | 1020 | |
80fb33c6 | 1021 | ]) |
4acd5a04 | 1022 | |
89cee0ad | 1023 | # even if we are using an installed htp lib we still need to gen Makefiles inside of htp |
36917c7d VJ |
1024 | AC_CONFIG_SUBDIRS([libhtp]) |
1025 | AM_CONDITIONAL([BUILD_LIBHTP], [test "x$enable_non_bundled_htp" = "xno"]) | |
1026 | AS_IF([test "x$enable_non_bundled_htp" = "xno"], [ | |
1027 | AC_DEFINE_UNQUOTED([HAVE_HTP_URI_NORMALIZE_HOOK],[1],[Assuming htp_config_register_request_uri_normalize function in bundled libhtp]) | |
80fb33c6 | 1028 | AC_DEFINE_UNQUOTED([HAVE_HTP_TX_GET_RESPONSE_HEADERS_RAW],[1],[Assuming htp_tx_get_response_headers_raw function in bundled libhtp]) |
36917c7d VJ |
1029 | ]) |
1030 | ||
08328f9d | 1031 | |
89cee0ad | 1032 | # enable CUDA output |
d281a6b8 | 1033 | AC_ARG_ENABLE(cuda, |
1fb11e93 | 1034 | AS_HELP_STRING([--enable-cuda], [Enable experimental CUDA pattern matching]),,[enable_cuda=no]) |
e07e9e16 WM |
1035 | AS_IF([test "x$enable_cuda" = "xyes"], [ |
1036 | AC_ARG_WITH(cuda_includes, | |
1037 | [ --with-cuda-includes=DIR cuda include directory], | |
1038 | [with_cuda_includes="$withval"],[with_cuda_includes=no]) | |
1039 | AC_ARG_WITH(cuda_libraries, | |
1040 | [ --with-cuda-libraries=DIR cuda library directory], | |
1041 | [with_cuda_libraries="$withval"],[with_cuda_libraries="no"]) | |
49d66430 MB |
1042 | AC_ARG_WITH(cuda_nvcc, |
1043 | [ --with-cuda-nvcc=DIR cuda nvcc compiler directory], | |
1044 | [with_cuda_nvcc="$withval"],[with_cuda_nvcc=no]) | |
e07e9e16 | 1045 | |
d281a6b8 VJ |
1046 | CFLAGS="${CFLAGS} -D__SC_CUDA_SUPPORT__" |
1047 | ||
1048 | if test "$with_cuda_includes" != "no"; then | |
1049 | CPPFLAGS="${CPPFLAGS} -I${with_cuda_includes}" | |
1050 | else | |
2f1262b4 | 1051 | CPPFLAGS="${CPPFLAGS} -I/usr/local/cuda/include" |
d281a6b8 VJ |
1052 | fi |
1053 | ||
1054 | if test "$with_cuda_libraries" != "no"; then | |
1055 | LDFLAGS="${LDFLAGS} -L${with_cuda_libraries}" | |
1056 | fi | |
1057 | ||
49d66430 MB |
1058 | if test "$with_cuda_nvcc" != "no"; then |
1059 | NVCC_DIR="${with_cuda_nvcc}" | |
1060 | else | |
1061 | NVCC_DIR="/usr/local/cuda/bin" | |
1062 | fi | |
1063 | ||
d281a6b8 VJ |
1064 | AC_CHECK_HEADER(cuda.h,,[AC_ERROR(cuda.h not found ...)]) |
1065 | ||
1066 | LIBCUDA="" | |
1067 | AC_CHECK_LIB(cuda, cuArray3DCreate,, LIBCUDA="no") | |
1068 | if test "$LIBCUDA" = "no"; then | |
1069 | echo | |
1070 | echo " ERROR! libcuda library not found" | |
1071 | echo | |
1072 | exit 1 | |
1073 | fi | |
49d66430 | 1074 | |
2f1262b4 MB |
1075 | AC_PATH_PROG([NVCC], [nvcc], no, [$PATH:$NVCC_DIR]) |
1076 | if test "x$NVCC" = "xno"; then | |
49d66430 MB |
1077 | echo |
1078 | echo " ERROR! CUDA nvcc compiler not found: use --with-cuda-nvcc=DIR" | |
1079 | echo | |
1080 | exit 1 | |
1081 | fi | |
1082 | ||
2f1262b4 MB |
1083 | AC_MSG_CHECKING(for nvcc version) |
1084 | NVCCVER=`$NVCC --version | grep "release" | sed 's/.*release \(@<:@0-9@:>@\)\.\(@<:@0-9@:>@\).*/\1\2/'` | |
1085 | AC_MSG_RESULT($NVCCVER) | |
1086 | if test "$NVCCVER" -lt 31; then | |
49d66430 | 1087 | echo |
2f1262b4 MB |
1088 | echo " Warning! Your CUDA nvcc version might be outdated." |
1089 | echo " If compilation fails try the latest CUDA toolkit from" | |
1090 | echo " www.nvidia.com/object/cuda_develop.html" | |
1091 | echo | |
1092 | fi | |
1093 | ||
1094 | AM_PATH_PYTHON(,, no) | |
1095 | if test "x$PYTHON" = "xno"; then | |
1096 | echo | |
1097 | echo " ERROR! Compiling CUDA kernels requires python." | |
49d66430 MB |
1098 | echo |
1099 | exit 1 | |
1100 | fi | |
e07e9e16 | 1101 | ]) |
2f1262b4 | 1102 | AM_CONDITIONAL([BUILD_CUDA], [test "x$enable_cuda" = "xyes"]) |
d281a6b8 | 1103 | |
070ed778 | 1104 | |
89cee0ad | 1105 | # Check for libcap-ng |
829238e4 VJ |
1106 | case $host in |
1107 | *-*-linux*) | |
070ed778 VJ |
1108 | AC_ARG_WITH(libcap_ng_includes, |
1109 | [ --with-libcap_ng-includes=DIR libcap_ng include directory], | |
1110 | [with_libcap-ng_includes="$withval"],[with_libcap_ng_includes=no]) | |
1111 | AC_ARG_WITH(libcap_ng_libraries, | |
1112 | [ --with-libcap_ng-libraries=DIR libcap_ng library directory], | |
1113 | [with_libcap_ng_libraries="$withval"],[with_libcap_ng_libraries="no"]) | |
1114 | ||
1115 | if test "$with_libcap_ng_includes" != "no"; then | |
89cee0ad | 1116 | CPPFLAGS="${CPPFLAGS} -I${with_libcap_ng_includes}" |
070ed778 VJ |
1117 | fi |
1118 | ||
1119 | if test "$with_libcap_ng_libraries" != "no"; then | |
89cee0ad | 1120 | LDFLAGS="${LDFLAGS} -L${with_libcap_ng_libraries}" |
070ed778 VJ |
1121 | fi |
1122 | ||
1123 | AC_CHECK_HEADER(cap-ng.h,,LIBCAP_NG="no") | |
1124 | if test "$LIBCAP_NG" != "no"; then | |
1125 | LIBCAP_NG="" | |
1126 | AC_CHECK_LIB(cap-ng,capng_clear,,LIBCAP_NG="no") | |
1127 | fi | |
1128 | ||
1129 | if test "$LIBCAP_NG" != "no"; then | |
1130 | CFLAGS="${CFLAGS} -DHAVE_LIBCAP_NG" | |
1131 | fi | |
1132 | ||
1133 | if test "$LIBCAP_NG" = "no"; then | |
89cee0ad VJ |
1134 | echo |
1135 | echo " WARNING! libcap-ng library not found, go get it" | |
1136 | echo " from http://people.redhat.com/sgrubb/libcap-ng/" | |
1137 | echo " or your distribution:" | |
1138 | echo | |
1139 | echo " Ubuntu: apt-get install libcap-ng-dev" | |
1140 | echo " Fedora: yum install libcap-ng-devel" | |
1141 | echo | |
1142 | echo " Suricata will be built without support for dropping privs." | |
1143 | echo | |
070ed778 | 1144 | fi |
829238e4 VJ |
1145 | ;; |
1146 | esac | |
835630ef | 1147 | |
89cee0ad | 1148 | # Check for DAG support. |
835630ef JM |
1149 | AC_ARG_ENABLE(dag, |
1150 | [ --enable-dag Enable DAG capture], | |
1151 | [ enable_dag=yes ], | |
1152 | [ enable_dag=no]) | |
1153 | AC_ARG_WITH(dag_includes, | |
1154 | [ --with-dag-includes=DIR dagapi include directory], | |
1155 | [with_dag_includes="$withval"],[with_dag_includes="no"]) | |
1156 | AC_ARG_WITH(dag_libraries, | |
1157 | [ --with-dag-libraries=DIR dagapi library directory], | |
1158 | [with_dag_libraries="$withval"],[with_dag_libraries="no"]) | |
1159 | ||
1160 | if test "$enable_dag" = "yes"; then | |
1161 | ||
c9cc137d | 1162 | if test "$with_dag_includes" != "no"; then |
835630ef JM |
1163 | CPPFLAGS="${CPPFLAGS} -I${with_dag_includes}" |
1164 | fi | |
1165 | ||
1166 | if test "$with_dag_libraries" != "no"; then | |
573f31b2 | 1167 | LDFLAGS="${LDFLAGS} -L${with_dag_libraries}" |
835630ef JM |
1168 | fi |
1169 | ||
1170 | AC_CHECK_HEADER(dagapi.h,DAG="yes",DAG="no") | |
1171 | if test "$DAG" != "no"; then | |
1172 | DAG="" | |
573f31b2 | 1173 | AC_CHECK_LIB(dag,dag_open,,DAG="no",) |
835630ef JM |
1174 | fi |
1175 | ||
1176 | if test "$DAG" != "no"; then | |
1177 | CFLAGS="${CFLAGS} -DHAVE_DAG" | |
1178 | fi | |
1179 | ||
1180 | if test "$DAG" = "no"; then | |
1181 | echo | |
1182 | echo " ERROR! libdag library not found" | |
1183 | echo | |
1184 | exit 1 | |
1185 | fi | |
1186 | fi | |
1187 | ||
89cee0ad | 1188 | # libnspr |
4a186bcf | 1189 | enable_nspr="no" |
69b3df96 VJ |
1190 | AC_ARG_WITH(libnspr_includes, |
1191 | [ --with-libnspr-includes=DIR libnspr include directory], | |
1192 | [with_libnspr_includes="$withval"],[with_libnspr_includes=no]) | |
1193 | AC_ARG_WITH(libnspr_libraries, | |
1194 | [ --with-libnspr-libraries=DIR libnspr library directory], | |
1195 | [with_libnspr_libraries="$withval"],[with_libnspr_libraries="no"]) | |
1196 | ||
1197 | if test "$with_libnspr_includes" != "no"; then | |
1198 | CPPFLAGS="${CPPFLAGS} -I${with_libnspr_includes}" | |
1199 | fi | |
1200 | ||
90422c9f | 1201 | AC_CHECK_HEADER(nspr.h,NSPR="yes",NSPR="no") |
337f7861 VJ |
1202 | if test "$NSPR" = "yes"; then |
1203 | if test "$with_libnspr_libraries" != "no"; then | |
1204 | LDFLAGS="${LDFLAGS} -L${with_libnspr_libraries}" | |
1205 | fi | |
69b3df96 | 1206 | |
337f7861 | 1207 | AC_CHECK_LIB(nspr4, PR_GetCurrentThread,, NSPR="no") |
69b3df96 | 1208 | |
337f7861 VJ |
1209 | if test "$NSPR" = "no"; then |
1210 | echo | |
1211 | echo " ERROR! libnspr library not found, go get it" | |
89cee0ad VJ |
1212 | echo " from Mozilla or your distribution:" |
1213 | echo | |
1214 | echo " Ubuntu: apt-get install libnspr4-dev" | |
1215 | echo " Fedora: yum install nspr-devel" | |
337f7861 VJ |
1216 | echo |
1217 | exit 1 | |
1218 | fi | |
4a186bcf | 1219 | enable_nspr="yes" |
69b3df96 | 1220 | fi |
337f7861 | 1221 | |
89cee0ad | 1222 | # libnss |
4a186bcf | 1223 | enable_nss="no" |
69b3df96 VJ |
1224 | AC_ARG_WITH(libnss_includes, |
1225 | [ --with-libnss-includes=DIR libnss include directory], | |
1226 | [with_libnss_includes="$withval"],[with_libnss_includes=no]) | |
1227 | AC_ARG_WITH(libnss_libraries, | |
1228 | [ --with-libnss-libraries=DIR libnss library directory], | |
1229 | [with_libnss_libraries="$withval"],[with_libnss_libraries="no"]) | |
1230 | ||
1231 | if test "$with_libnss_includes" != "no"; then | |
1232 | CPPFLAGS="${CPPFLAGS} -I${with_libnss_includes}" | |
1233 | fi | |
1234 | ||
337f7861 VJ |
1235 | AC_CHECK_HEADER(sechash.h,NSS="yes",NSS="no") |
1236 | if test "$NSS" = "yes"; then | |
1237 | if test "$with_libnss_libraries" != "no"; then | |
1238 | LDFLAGS="${LDFLAGS} -L${with_libnss_libraries}" | |
1239 | fi | |
69b3df96 | 1240 | |
337f7861 | 1241 | AC_CHECK_LIB(nss3, HASH_Begin,, NSS="no") |
69b3df96 | 1242 | |
337f7861 VJ |
1243 | if test "$NSS" = "no"; then |
1244 | echo | |
1245 | echo " ERROR! libnss library not found, go get it" | |
89cee0ad VJ |
1246 | echo " from Mozilla or your distribution:" |
1247 | echo | |
1248 | echo " Ubuntu: apt-get install libnss3-dev" | |
1249 | echo " Fedora: yum install nss-devel" | |
337f7861 VJ |
1250 | echo |
1251 | exit 1 | |
1252 | fi | |
69b3df96 | 1253 | |
337f7861 | 1254 | AC_DEFINE([HAVE_NSS],[1],[libnss available for md5]) |
4a186bcf | 1255 | enable_nss="yes" |
69b3df96 VJ |
1256 | fi |
1257 | ||
89cee0ad | 1258 | # libmagic |
f4a6f4b2 VJ |
1259 | AC_ARG_WITH(libmagic_includes, |
1260 | [ --with-libmagic-includes=DIR libmagic include directory], | |
1261 | [with_libmagic_includes="$withval"],[with_libmagic_includes=no]) | |
1262 | AC_ARG_WITH(libmagic_libraries, | |
1263 | [ --with-libmagic-libraries=DIR libmagic library directory], | |
1264 | [with_libmagic_libraries="$withval"],[with_libmagic_libraries="no"]) | |
1265 | ||
1266 | if test "$with_libmagic_includes" != "no"; then | |
1267 | CPPFLAGS="${CPPFLAGS} -I${with_libmagic_includes}" | |
1268 | fi | |
1269 | ||
1270 | AC_CHECK_HEADER(magic.h,,[AC_ERROR(magic.h not found ...)]) | |
1271 | ||
1272 | if test "$with_libmagic_libraries" != "no"; then | |
1273 | LDFLAGS="${LDFLAGS} -L${with_libmagic_libraries}" | |
1274 | fi | |
1275 | ||
1276 | MAGIC="" | |
1277 | AC_CHECK_LIB(magic, magic_open,, MAGIC="no") | |
1278 | ||
1279 | if test "$MAGIC" = "no"; then | |
1280 | echo | |
1281 | echo " ERROR! magic library not found, go get it" | |
89cee0ad VJ |
1282 | echo " from http://www.darwinsys.com/file/ or your distribution:" |
1283 | echo | |
1284 | echo " Ubuntu: apt-get install libmagic-dev" | |
1285 | echo " Fedora: yum install file-devel" | |
f4a6f4b2 VJ |
1286 | echo |
1287 | exit 1 | |
1288 | fi | |
1289 | ||
37e3de84 MK |
1290 | # Napatech - Using the 3GD API |
1291 | AC_ARG_ENABLE(napatech, | |
1292 | [ --enable-napatech Enabled Napatech Devices], | |
1293 | [ enable_napatech=yes ], | |
1294 | [ enable_napatech=no]) | |
1295 | AC_ARG_WITH(napatech_includes, | |
1296 | [ --with-napatech-includes=DIR napatech include directory], | |
1297 | [with_napatech_includes="$withval"],[with_napatech_includes="/opt/napatech3/include"]) | |
1298 | AC_ARG_WITH(napatech_libraries, | |
1299 | [ --with-napatech-libraries=DIR napatech library directory], | |
1300 | [with_napatech_libraries="$withval"],[with_napatech_libraries="/opt/napatech3/lib"]) | |
1301 | ||
1302 | if test "$enable_napatech" = "yes"; then | |
1303 | CPPFLAGS="${CPPFLAGS} -I${with_napatech_includes}" | |
1304 | LDFLAGS="${LDFLAGS} -L${with_napatech_libraries} -lntapi" | |
1305 | AC_CHECK_HEADER(nt.h,NAPATECH="yes",NAPATECH="no") | |
1306 | if test "$NAPATECH" != "no"; then | |
1307 | NAPATECH="" | |
1308 | AC_CHECK_LIB(ntapi, NT_Init,NAPATECH="yes",NAPATECH="no") | |
844e4dba MK |
1309 | fi |
1310 | ||
37e3de84 MK |
1311 | if test "$NAPATECH" != "no"; then |
1312 | CFLAGS="${CFLAGS} -DHAVE_NAPATECH" | |
844e4dba MK |
1313 | fi |
1314 | ||
37e3de84 | 1315 | if test "$NAPATECH" = "no"; then |
844e4dba MK |
1316 | echo |
1317 | echo " ERROR! libntapi library not found" | |
1318 | echo | |
1319 | exit 1 | |
1320 | fi | |
1321 | fi | |
1322 | ||
5b2fbfb1 | 1323 | # libluajit |
c9cc137d VJ |
1324 | AC_ARG_ENABLE(luajit, |
1325 | [ --enable-luajit Enable Luajit support], | |
1326 | [ enable_luajit="yes"], | |
1327 | [ enable_luajit="no"]) | |
5b2fbfb1 VJ |
1328 | AC_ARG_WITH(libluajit_includes, |
1329 | [ --with-libluajit-includes=DIR libluajit include directory], | |
c9cc137d | 1330 | [with_libluajit_includes="$withval"],[with_libluajit_includes="no"]) |
5b2fbfb1 VJ |
1331 | AC_ARG_WITH(libluajit_libraries, |
1332 | [ --with-libluajit-libraries=DIR libluajit library directory], | |
1333 | [with_libluajit_libraries="$withval"],[with_libluajit_libraries="no"]) | |
1334 | ||
c9cc137d VJ |
1335 | if test "$enable_luajit" = "yes"; then |
1336 | if test "$with_libluajit_includes" != "no"; then | |
1337 | CPPFLAGS="${CPPFLAGS} -I${with_libluajit_includes}" | |
819debdc | 1338 | else |
344ea3fa | 1339 | PKG_CHECK_MODULES([LUAJIT], [luajit], , LUAJIT="no") |
819debdc | 1340 | CPPFLAGS="${CPPFLAGS} ${LUAJIT_CFLAGS}" |
5b2fbfb1 VJ |
1341 | fi |
1342 | ||
c9cc137d VJ |
1343 | AC_CHECK_HEADER(lualib.h,LUAJIT="yes",LUAJIT="no") |
1344 | if test "$LUAJIT" = "yes"; then | |
1345 | if test "$with_libluajit_libraries" != "no"; then | |
1346 | LDFLAGS="${LDFLAGS} -L${with_libluajit_libraries}" | |
819debdc EL |
1347 | else |
1348 | PKG_CHECK_MODULES([LUAJIT], [luajit]) | |
1349 | LDFLAGS="${LDFLAGS} ${LUAJIT_LIBS}" | |
c9cc137d | 1350 | fi |
5b2fbfb1 | 1351 | |
c9cc137d | 1352 | AC_CHECK_LIB(luajit-5.1, luaL_openlibs,, LUAJIT="no") |
5b2fbfb1 | 1353 | |
c9cc137d VJ |
1354 | if test "$LUAJIT" = "no"; then |
1355 | echo | |
1356 | echo " ERROR! libluajit library not found, go get it" | |
1357 | echo " from http://luajit.org/index.html or your distribution:" | |
1358 | echo | |
1359 | echo " Ubuntu: apt-get install libluajit-5.1-dev" | |
1360 | echo | |
344ea3fa EL |
1361 | echo " If you installed software in a non-standard prefix" |
1362 | echo " consider adjusting the PKG_CONFIG_PATH environment variable" | |
1363 | echo " or use --with-libluajit-libraries configure option." | |
1364 | echo | |
c9cc137d VJ |
1365 | exit 1 |
1366 | fi | |
1367 | ||
1368 | AC_DEFINE([HAVE_LUAJIT],[1],[libluajit available]) | |
1369 | enable_luajit="yes" | |
e125869d EL |
1370 | else |
1371 | echo | |
1372 | echo " ERROR! libluajit headers not found, go get them" | |
1373 | echo " from http://luajit.org/index.html or your distribution:" | |
1374 | echo | |
1375 | echo " Ubuntu: apt-get install libluajit-5.1-dev" | |
1376 | echo | |
344ea3fa EL |
1377 | echo " If you installed software in a non-standard prefix" |
1378 | echo " consider adjusting the PKG_CONFIG_PATH environment variable" | |
1379 | echo " or use --with-libluajit-includes and --with-libluajit-libraries" | |
1380 | echo " configure option." | |
1381 | echo | |
e125869d | 1382 | exit 1 |
c9cc137d | 1383 | fi |
5b2fbfb1 VJ |
1384 | fi |
1385 | ||
d771e081 IS |
1386 | # libgeoip |
1387 | AC_ARG_ENABLE(geoip, | |
1388 | [ --enable-geoip Enable GeoIP support], | |
1389 | [ enable_geoip="yes"], | |
1390 | [ enable_geoip="no"]) | |
1391 | AC_ARG_WITH(libgeoip_includes, | |
1392 | [ --with-libgeoip-includes=DIR libgeoip include directory], | |
1393 | [with_libgeoip_includes="$withval"],[with_libgeoip_includes="no"]) | |
1394 | AC_ARG_WITH(libgeoip_libraries, | |
1395 | [ --with-libgeoip-libraries=DIR libgeoip library directory], | |
1396 | [with_libgeoip_libraries="$withval"],[with_libgeoip_libraries="no"]) | |
1397 | ||
1398 | if test "$enable_geoip" = "yes"; then | |
1399 | if test "$with_libgeoip_includes" != "no"; then | |
1400 | CPPFLAGS="${CPPFLAGS} -I${with_libgeoip_includes}" | |
1401 | fi | |
1402 | ||
1403 | AC_CHECK_HEADER(GeoIP.h,GEOIP="yes",GEOIP="no") | |
1404 | if test "$GEOIP" = "yes"; then | |
1405 | if test "$with_libgeoip_libraries" != "no"; then | |
1406 | LDFLAGS="${LDFLAGS} -L${with_libgeoip_libraries}" | |
1407 | fi | |
1408 | AC_CHECK_LIB(GeoIP, GeoIP_country_code_by_ipnum,, GEOIP="no") | |
1409 | fi | |
1410 | if test "$GEOIP" = "no"; then | |
1411 | echo | |
1412 | echo " ERROR! libgeoip library not found, go get it" | |
1413 | echo " from http://www.maxmind.com/en/geolite or your distribution:" | |
1414 | echo | |
1415 | echo " Ubuntu: apt-get install libgeoip-dev" | |
8f190249 | 1416 | echo " Fedora: yum install GeoIP-devel" |
d771e081 IS |
1417 | echo |
1418 | exit 1 | |
1419 | fi | |
1420 | if test "$GEOIP" = "yes"; then | |
1421 | AC_DEFINE([HAVE_GEOIP],[1],[libgeoip available]) | |
1422 | enable_geoip="yes" | |
1423 | fi | |
1424 | fi | |
1425 | ||
1426 | ||
e3bde3e9 VJ |
1427 | # get revision |
1428 | if test -f ./revision; then | |
1429 | REVISION=`cat ./revision` | |
1430 | CFLAGS="${CFLAGS} -DREVISION=\"${REVISION}\"" | |
1431 | else | |
042d0c6e VJ |
1432 | AC_PATH_PROG(HAVE_GIT_CMD, git, "no") |
1433 | if test "$HAVE_GIT_CMD" != "no"; then | |
5886ef82 VJ |
1434 | if [ test -d .git ]; then |
1435 | REVISION=`git rev-parse --short HEAD` | |
1436 | CFLAGS="${CFLAGS} -DREVISION=\"${REVISION}\"" | |
1437 | fi | |
e3bde3e9 VJ |
1438 | fi |
1439 | fi | |
1440 | ||
0ffa1c24 WM |
1441 | AC_SUBST(CFLAGS) |
1442 | AC_SUBST(LDFLAGS) | |
1443 | AC_SUBST(CPPFLAGS) | |
1444 | ||
25804f5a EL |
1445 | define([EXPAND_VARIABLE], |
1446 | [$2=[$]$1 | |
1447 | if test $prefix = 'NONE'; then | |
1448 | prefix="/usr/local" | |
1449 | fi | |
1450 | while true; do | |
1451 | case "[$]$2" in | |
1452 | *\[$]* ) eval "$2=[$]$2" ;; | |
1453 | *) break ;; | |
1454 | esac | |
1455 | done | |
1456 | eval "$2=[$]$2$3" | |
1457 | ])dnl EXPAND_VARIABLE | |
1458 | ||
1459 | # suricata log dir | |
1460 | if test "$WINDOWS_PATH" = "yes"; then | |
d8356c5e VJ |
1461 | systemtype="`systeminfo | grep \"based PC\"`" |
1462 | case "$systemtype" in | |
25804f5a | 1463 | *x64*) |
d8356c5e | 1464 | e_winbase="C:\\\\Program Files (x86)\\\\Suricata" |
25804f5a EL |
1465 | ;; |
1466 | *) | |
d8356c5e | 1467 | e_winbase="C:\\\\Program Files\\\\Suricata" |
25804f5a EL |
1468 | ;; |
1469 | esac | |
d8356c5e VJ |
1470 | |
1471 | e_sysconfdir="$e_winbase\\\\" | |
1472 | e_sysconfrulesdir="$e_winbase\\\\rules\\\\" | |
1473 | e_magic_file="$e_winbase\\\\magic.mgc" | |
1474 | e_logdir="$e_winbase\\\\log" | |
1475 | e_logfilesdir="$e_logdir\\\\files" | |
25804f5a | 1476 | else |
697e9e66 | 1477 | EXPAND_VARIABLE(localstatedir, e_logdir, "/log/suricata/") |
1c3546fe | 1478 | EXPAND_VARIABLE(localstatedir, e_rundir, "/run/") |
d8356c5e | 1479 | EXPAND_VARIABLE(localstatedir, e_logfilesdir, "/log/suricata/files") |
697e9e66 | 1480 | EXPAND_VARIABLE(sysconfdir, e_sysconfdir, "/suricata/") |
d8356c5e | 1481 | EXPAND_VARIABLE(sysconfdir, e_sysconfrulesdir, "/suricata/rules") |
20a8b9db | 1482 | EXPAND_VARIABLE(localstatedir, e_localstatedir, "/run/suricata") |
25804f5a EL |
1483 | fi |
1484 | AC_SUBST(e_logdir) | |
1c3546fe | 1485 | AC_SUBST(e_rundir) |
d8356c5e | 1486 | AC_SUBST(e_logfilesdir) |
25804f5a | 1487 | AC_SUBST(e_sysconfdir) |
d8356c5e | 1488 | AC_SUBST(e_sysconfrulesdir) |
20a8b9db | 1489 | AC_SUBST(e_localstatedir) |
d8356c5e | 1490 | AC_DEFINE_UNQUOTED([CONFIG_DIR],["$e_sysconfdir"],[Our CONFIG_DIR]) |
25804f5a EL |
1491 | AC_SUBST(e_magic_file) |
1492 | ||
0f42f0e8 | 1493 | AC_OUTPUT(Makefile src/Makefile qa/Makefile qa/coccinelle/Makefile rules/Makefile doc/Makefile contrib/Makefile contrib/file_processor/Makefile contrib/file_processor/Action/Makefile contrib/file_processor/Processor/Makefile suricata.yaml scripts/Makefile scripts/suricatasc/Makefile scripts/suricatasc/suricatasc) |
a098e39b | 1494 | |
668113af | 1495 | SURICATA_BUILD_CONF="Suricata Configuration: |
73a1b972 VJ |
1496 | AF_PACKET support: ${enable_af_packet} |
1497 | PF_RING support: ${enable_pfring} | |
ef463457 EL |
1498 | NFQueue support: ${enable_nfqueue} |
1499 | IPFW support: ${enable_ipfw} | |
73a1b972 | 1500 | DAG enabled: ${enable_dag} |
37e3de84 | 1501 | Napatech enabled: ${enable_napatech} |
20a8b9db | 1502 | Unix socket enabled: ${enable_unixsocket} |
73a1b972 | 1503 | |
89cee0ad VJ |
1504 | libnss support: ${enable_nss} |
1505 | libnspr support: ${enable_nspr} | |
20a8b9db | 1506 | libjansson support: ${enable_jansson} |
ef463457 | 1507 | Prelude support: ${enable_prelude} |
73a1b972 | 1508 | PCRE jit: ${pcre_jit_available} |
5b2fbfb1 | 1509 | libluajit: ${enable_luajit} |
d771e081 | 1510 | libgeoip: ${enable_geoip} |
73a1b972 VJ |
1511 | Non-bundled htp: ${enable_non_bundled_htp} |
1512 | Old barnyard2 support: ${enable_old_barnyard2} | |
1513 | CUDA enabled: ${enable_cuda} | |
1514 | ||
ef463457 EL |
1515 | Unit tests enabled: ${enable_unittests} |
1516 | Debug output enabled: ${enable_debug} | |
1517 | Debug validation enabled: ${enable_debug_validation} | |
ef463457 | 1518 | Profiling enabled: ${enable_profiling} |
d908e707 | 1519 | Profiling locks enabled: ${enable_profiling_locks} |
ef463457 EL |
1520 | |
1521 | Generic build parameters: | |
1522 | Installation prefix (--prefix): ${prefix} | |
1523 | Configuration directory (--sysconfdir): ${e_sysconfdir} | |
1524 | Log directory (--localstatedir) : ${e_logdir} | |
73a1b972 | 1525 | |
ef463457 EL |
1526 | Host: ${host} |
1527 | GCC binary: ${CC} | |
1528 | GCC Protect enabled: ${enable_gccprotect} | |
1529 | GCC march native enabled: ${enable_gccmarch_native} | |
668113af EL |
1530 | GCC Profile enabled: ${enable_gccprofile}" |
1531 | ||
1532 | echo | |
1533 | echo "$SURICATA_BUILD_CONF" | |
8d7b9703 EL |
1534 | echo "printf(" >${ac_builddir}/src/build-info.h |
1535 | echo "$SURICATA_BUILD_CONF" | sed -e 's/^/"/' | sed -e 's/$/\\n"/' >>${ac_builddir}/src/build-info.h | |
1536 | echo ");" >>${ac_builddir}/src/build-info.h | |
25804f5a | 1537 | |
668113af | 1538 | echo " |
25804f5a | 1539 | To build and install run 'make' and 'make install'. |
73a1b972 | 1540 | |
697e9e66 VJ |
1541 | You can run 'make install-conf' if you want to install initial configuration |
1542 | files to ${e_sysconfdir}. Running 'make install-full' will install configuration | |
1543 | and rules and provide you a ready-to-run suricata." | |
73a1b972 VJ |
1544 | echo |
1545 | echo "To install Suricata into /usr/bin/suricata, have the config in | |
1546 | /etc/suricata and use /var/log/suricata as log dir, use: | |
697e9e66 VJ |
1547 | ./configure --prefix=/usr/ --sysconfdir=/etc/ --localstatedir=/var/" |
1548 | echo |