]>
Commit | Line | Data |
---|---|---|
6899b3da | 1 | #TODO A better place for default CFLAGS? |
0ffa1c24 | 2 | |
bab4b623 VJ |
3 | AC_INIT(configure.in) |
4 | ||
a3510f20 | 5 | AM_CONFIG_HEADER(config.h) |
fb76561b | 6 | AM_INIT_AUTOMAKE(suricata, 1.2dev) |
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 | ||
bda87024 EL |
38 | dnl get gcc version |
39 | AC_MSG_CHECKING([gcc version]) | |
40 | gccver=$($CC -dumpversion) | |
41 | gccvermajor=$(echo $gccver | cut -d . -f1) | |
42 | gccverminor=$(echo $gccver | cut -d . -f2) | |
43 | gccvernum=$(expr $gccvermajor "*" 100 + $gccverminor) | |
44 | AC_MSG_RESULT($gccver) | |
45 | ||
46 | if test "$gccvernum" -ge "400"; then | |
47 | dnl gcc 4.0 or later | |
48 | CFLAGS="$CFLAGS -Wextra" | |
49 | else | |
50 | CFLAGS="$CFLAGS -W" | |
51 | fi | |
52 | ||
1dbbdce0 VJ |
53 | # remove optimization options that break our code |
54 | # VJ 2010/06/27: no-tree-pre added. It breaks ringbuffers code. | |
55 | CFLAGS="$CFLAGS -Wall -fno-strict-aliasing -fno-tree-pre" | |
bda87024 | 56 | CFLAGS="$CFLAGS -Wno-unused-parameter" |
9f0bf35c | 57 | CFLAGS="$CFLAGS -std=gnu99" |
0ffa1c24 | 58 | |
fa5939ca | 59 | # Checks for programs. |
fa5939ca BR |
60 | AC_PROG_AWK |
61 | AC_PROG_CC | |
62 | AC_PROG_CPP | |
63 | AC_PROG_INSTALL | |
64 | AC_PROG_LN_S | |
65 | AC_PROG_MAKE_SET | |
fa5939ca | 66 | |
9f1d779a WM |
67 | AC_PATH_PROG(HAVE_PKG_CONFIG, pkg-config, "no") |
68 | if test "$HAVE_PKG_CONFIG" = "no"; then | |
69 | echo | |
70 | echo " ERROR! pkg-config not found, go get it " | |
71 | echo " http://pkg-config.freedesktop.org/wiki/ " | |
72 | echo " or install from your distribution " | |
73 | echo | |
74 | exit 1 | |
75 | fi | |
76 | ||
7c841e1d EL |
77 | AC_PATH_PROG(HAVE_COCCINELLE_CONFIG, spatch, "no") |
78 | if test "$HAVE_COCCINELLE_CONFIG" = "no"; then | |
79 | echo | |
80 | echo " Warning! spatch not found, you will not be " | |
81 | echo " able to run code checking with coccinelle " | |
82 | echo " get it from http://coccinelle.lip6.fr " | |
83 | echo " or install from your distribution " | |
84 | echo | |
85 | fi | |
86 | AM_CONDITIONAL([HAVE_COCCINELLE], [test "$HAVE_COCCINELLE_CONFIG" != "no"]) | |
87 | ||
88 | ||
89 | ||
fa5939ca BR |
90 | # Checks for libraries. |
91 | ||
92 | # Checks for header files. | |
5656e344 | 93 | AC_CHECK_HEADERS([arpa/inet.h inttypes.h limits.h netdb.h poll.h signal.h stdint.h stdlib.h string.h syslog.h sys/ioctl.h sys/prctl.h sys/socket.h sys/syscall.h netinet/in.h sys/time.h unistd.h windows.h winsock2.h ws2tcpip.h]) |
842b01cc | 94 | AC_CHECK_HEADERS([sys/socket.h net/if.h], [], [], |
5656e344 EL |
95 | [[#ifdef HAVE_SYS_SOCKET_H |
96 | #include <sys/socket.h> | |
97 | #endif | |
98 | ]]) | |
99 | ||
fa5939ca BR |
100 | |
101 | # Checks for typedefs, structures, and compiler characteristics. | |
102 | AC_C_INLINE | |
103 | AC_TYPE_PID_T | |
104 | AC_TYPE_SIZE_T | |
105 | AC_TYPE_INT32_T | |
106 | AC_TYPE_UINT16_T | |
107 | AC_TYPE_UINT32_T | |
108 | AC_TYPE_UINT64_T | |
109 | AC_TYPE_UINT8_T | |
110 | AC_HEADER_STDBOOL | |
111 | ||
112 | # Checks for library functions. | |
113 | AC_FUNC_MALLOC | |
114 | AC_FUNC_REALLOC | |
115 | AC_CHECK_FUNCS([gettimeofday memset strcasecmp strchr strdup strerror strncasecmp strtol strtoul]) | |
116 | ||
3b3f5816 WM |
117 | # Add large file support |
118 | AC_SYS_LARGEFILE | |
119 | ||
769022f4 PR |
120 | #check for os |
121 | AC_MSG_CHECKING([host os]) | |
122 | ||
123 | # If no host os was detected, try with uname | |
124 | if test -z "$host" ; then | |
125 | host="`uname`" | |
126 | fi | |
127 | echo -n "installation for $host OS... \c" | |
128 | ||
129 | case "$host" in | |
130 | *-*-*freebsd*) | |
131 | CFLAGS="${CFLAGS} -DOS_FREEBSD" | |
132 | CPPFLAGS="${CPPFLAGS} -I/usr/local/include -I/usr/local/include/libnet11" | |
133 | LDFLAGS="${LDFLAGS} -L/usr/local/lib -L/usr/local/lib/libnet11" | |
134 | ;; | |
4e923126 EL |
135 | *-*-openbsd*) |
136 | CFLAGS="${CFLAGS} -D__OpenBSD__" | |
137 | CPPFLAGS="${CPPFLAGS} -I/usr/local/include -I/usr/local/include/libnet-1.1" | |
138 | LDFLAGS="${LDFLAGS} -L/usr/local/lib -I/usr/local/lib/libnet-1.1" | |
139 | ;; | |
769022f4 PR |
140 | *darwin*|*Darwin*) |
141 | CFLAGS="${CFLAGS} -DOS_DARWIN" | |
142 | CPPFLAGS="${CPPFLAGS} -I/opt/local/include" | |
143 | LDFLAGS="${LDFLAGS} -L/opt/local/lib" | |
144 | ;; | |
145 | *-*-linux*) | |
146 | #for now do nothing | |
147 | ;; | |
fe6a72be JJ |
148 | *-*-mingw32*) |
149 | CFLAGS="${CFLAGS} -DOS_WIN32" | |
150 | LDFLAGS="${LDFLAGS} -lws2_32" | |
151 | ;; | |
769022f4 PR |
152 | *) |
153 | AC_MSG_WARN([unsupported OS this may or may not work]) | |
154 | ;; | |
155 | esac | |
156 | AC_MSG_RESULT(ok) | |
157 | ||
c49785fb WM |
158 | #Enable support for gcc compile time security options. There is no great way to do detection of valid cflags that I have found |
159 | #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. | |
160 | #These flags seem to be supported on CentOS 5+, Ubuntu 8.04+, and FedoreCore 11+ | |
161 | #Options are taken from https://wiki.ubuntu.com/CompilerFlags | |
162 | AC_ARG_ENABLE(gccprotect, | |
e07e9e16 | 163 | AS_HELP_STRING([--enable-gccprotect], [Detect and use gcc hardening options]),,[enable_gccprotect=no]) |
c49785fb | 164 | |
e07e9e16 | 165 | AS_IF([test "x$enable_gccprotect" = "xyes"], [ |
98b9009b WM |
166 | #buffer overflow protection |
167 | AC_MSG_CHECKING(for -fstack-protector) | |
168 | TMPCFLAGS="${CFLAGS}" | |
169 | CFLAGS="${CFLAGS} -fstack-protector" | |
170 | AC_TRY_LINK(,,SECCFLAGS="${SECCFLAGS} -fstack-protector" | |
171 | AC_MSG_RESULT(yes), | |
172 | AC_MSG_RESULT(no)) | |
173 | CFLAGS="${TMPCFLAGS}" | |
174 | ||
175 | #compile-time best-practices errors for certain libc functions, provides checks of buffer lengths and memory regions | |
176 | AC_MSG_CHECKING(for -D_FORTIFY_SOURCE=2) | |
177 | TMPCFLAGS="${CFLAGS}" | |
178 | CFLAGS="${CFLAGS} -D_FORTIFY_SOURCE=2" | |
179 | AC_TRY_COMPILE(,,SECCFLAGS="${SECCFLAGS} -D_FORTIFY_SOURCE=2" | |
180 | AC_MSG_RESULT(yes), | |
181 | AC_MSG_RESULT(no)) | |
182 | CFLAGS="${TMPCFLAGS}" | |
183 | ||
184 | #compile-time warnings about misuse of format strings | |
185 | AC_MSG_CHECKING(for -Wformat -Wformat-security) | |
186 | TMPCFLAGS="${CFLAGS}" | |
187 | CFLAGS="${CFLAGS} -Wformat -Wformat-security" | |
188 | AC_TRY_COMPILE(,,SECCFLAGS="${SECCFLAGS} -Wformat -Wformat-security" | |
189 | AC_MSG_RESULT(yes), | |
190 | AC_MSG_RESULT(no)) | |
191 | CFLAGS="${TMPCFLAGS}" | |
192 | ||
193 | #provides a read-only relocation table area in the final ELF | |
194 | AC_MSG_CHECKING(for -z relro) | |
195 | TMPLDFLAGS="${LDFLAGS}" | |
196 | LDFLAGS="${LDFLAGS} -z relro" | |
197 | AC_TRY_LINK(,,SECLDFLAGS="${SECLDFLAGS} -z relro" | |
198 | AC_MSG_RESULT(yes), | |
199 | AC_MSG_RESULT(no)) | |
200 | LDFLAGS="${TMPLDFLAGS}" | |
201 | ||
202 | #forces all relocations to be resolved at run-time | |
203 | AC_MSG_CHECKING(for -z now) | |
204 | TMPLDFLAGS="${LDFLAGS}" | |
205 | LDFLAGS="${LDFLAGS} -z now" | |
206 | AC_TRY_LINK(,,SECLDFLAGS="${SECLDFLAGS} -z now" | |
207 | AC_MSG_RESULT(yes), | |
208 | AC_MSG_RESULT(no)) | |
209 | LDFLAGS="${TMPLDFLAGS}" | |
210 | ||
211 | CFLAGS="${CFLAGS} ${SECCFLAGS}" | |
212 | LDFLAGS="${LDFLAGS} ${SECLDFLAGS}" | |
e07e9e16 | 213 | ]) |
5bde1217 WM |
214 | |
215 | #enable profile generation | |
216 | AC_ARG_ENABLE(gccprofile, | |
e07e9e16 WM |
217 | AS_HELP_STRING([--enable-gccprofile], [Enable gcc profile info i.e -pg flag is set]),,[enable_gccprofile=no]) |
218 | AS_IF([test "x$enable_gccprofile" = "xyes"], [ | |
219 | CFLAGS="${CFLAGS} -pg" | |
220 | ]) | |
5bde1217 | 221 | |
22f3e3d8 WM |
222 | #enable gcc march=native gcc 4.2 or later |
223 | AC_ARG_ENABLE(gccmarch_native, | |
9f0bf35c | 224 | AS_HELP_STRING([--enable-gccmarch-native], [Enable gcc march=native gcc 4.2 and later only]),,[enable_gccmarch_native=yes]) |
e07e9e16 | 225 | AS_IF([test "x$enable_gccmarch_native" = "xyes"], [ |
92223863 JI |
226 | case $host in |
227 | *darwin*|*Darwin*) | |
228 | if test "$gccvernum" -ge "403"; then | |
229 | dnl gcc 4.3 or later | |
230 | CFLAGS="$CFLAGS -march=native" | |
231 | else | |
232 | enable_gccmarch_native=no | |
233 | fi | |
234 | ;; | |
235 | *) | |
236 | if test "$gccvernum" -ge "402"; then | |
237 | dnl gcc 4.2 or later | |
238 | CFLAGS="$CFLAGS -march=native" | |
239 | fi | |
240 | ;; | |
241 | esac | |
e07e9e16 | 242 | ]) |
22f3e3d8 | 243 | |
6899b3da | 244 | #libpcre |
a3510f20 WM |
245 | AC_ARG_WITH(libpcre_includes, |
246 | [ --with-libpcre-includes=DIR libpcre include directory], | |
247 | [with_libpcre_includes="$withval"],[with_libpcre_includes=no]) | |
248 | AC_ARG_WITH(libpcre_libraries, | |
249 | [ --with-libpcre-libraries=DIR libpcre library directory], | |
250 | [with_libpcre_libraries="$withval"],[with_libpcre_libraries="no"]) | |
251 | ||
252 | if test "$with_libpcre_includes" != "no"; then | |
6899b3da | 253 | CPPFLAGS="${CPPFLAGS} -I${with_libpcre_includes}" |
a3510f20 | 254 | fi |
6899b3da | 255 | |
a3510f20 | 256 | AC_CHECK_HEADER(pcre.h,,[AC_ERROR(pcre.h not found ...)]) |
6899b3da | 257 | |
a3510f20 | 258 | if test "$with_libpcre_libraries" != "no"; then |
6899b3da | 259 | LDFLAGS="${LDFLAGS} -L${with_libpcre_libraries}" |
a3510f20 | 260 | fi |
6899b3da | 261 | |
a3510f20 WM |
262 | PCRE="" |
263 | AC_CHECK_LIB(pcre, pcre_get_substring,, PCRE="no") | |
6899b3da | 264 | |
a3510f20 | 265 | if test "$PCRE" = "no"; then |
6899b3da WM |
266 | echo |
267 | echo " ERROR! pcre library not found, go get it" | |
268 | echo " from www.pcre.org." | |
269 | echo | |
270 | exit 1 | |
a3510f20 | 271 | fi |
6899b3da | 272 | |
7d63fbda WM |
273 | # To prevent duping the lib link we reset LIBS after this check. Setting action-if-found to NULL doesn't seem to work |
274 | # see: http://blog.flameeyes.eu/2008/04/29/i-consider-ac_check_lib-harmful | |
275 | PCRE="" | |
276 | TMPLIBS="${LIBS}" | |
277 | AC_CHECK_LIB(pcre, pcre_dfa_exec,, PCRE="no") | |
278 | if test "$PCRE" = "no"; then | |
279 | echo | |
280 | echo " ERROR! pcre library was found but version was < 6.0" | |
281 | echo " please upgrade to a newer version of pcre which you can get from" | |
282 | echo " www.pcre.org." | |
283 | echo | |
284 | exit 1 | |
285 | fi | |
286 | LIBS="${TMPLIBS}" | |
287 | ||
5bde1217 | 288 | AC_TRY_COMPILE([ #include <pcre.h> ], |
42e8a012 | 289 | [ int eo = 0; eo |= PCRE_EXTRA_MATCH_LIMIT_RECURSION; ], |
5bde1217 WM |
290 | [ pcre_match_limit_recursion_available=yes ], [:] |
291 | ) | |
292 | if test "$pcre_match_limit_recursion_available" != "yes"; then | |
42e8a012 | 293 | CFLAGS="${CFLAGS} -DNO_PCRE_MATCH_RLIMIT" |
5bde1217 WM |
294 | echo |
295 | echo " Warning! pcre extra opt PCRE_EXTRA_MATCH_LIMIT_RECURSION not found" | |
296 | echo " This could lead to potential DoS please upgrade to pcre >= 6.5" | |
297 | echo " Continuing for now...." | |
298 | echo " from www.pcre.org." | |
299 | echo | |
300 | fi | |
301 | ||
3d396e8b | 302 | #enable support for PCRE-jit available since pcre-8.20 |
3d558bf0 EL |
303 | AC_MSG_CHECKING(for PCRE JIT support) |
304 | AC_TRY_COMPILE([ #include <pcre.h> ], | |
305 | [ | |
306 | int jit = 0; | |
307 | pcre_config(PCRE_CONFIG_JIT, &jit); | |
308 | ], | |
309 | [ pcre_jit_available=yes ], [ pcre_jit_available=no ] | |
310 | ) | |
311 | ||
312 | if test "x$pcre_jit_available" = "xyes"; then | |
313 | AC_MSG_RESULT(yes) | |
314 | AC_DEFINE([PCRE_HAVE_JIT], [1], [Pcre with JIT compiler support enabled]) | |
315 | ||
316 | AC_MSG_CHECKING(for PCRE JIT support usability) | |
317 | AC_TRY_COMPILE([ #include <pcre.h> ], | |
318 | [ | |
319 | const char* regexstr = "(a|b|c|d)"; | |
320 | pcre *re; | |
321 | const char *error; | |
322 | pcre_extra *extra; | |
323 | int err_offset; | |
324 | re = pcre_compile(regexstr,0, &error, &err_offset,NULL); | |
325 | extra = pcre_study(re, PCRE_STUDY_JIT_COMPILE, &error); | |
326 | if (extra == NULL) | |
327 | exit(EXIT_FAILURE); | |
328 | int jit = 0; | |
329 | int ret = pcre_fullinfo(re, extra, PCRE_INFO_JIT, &jit); | |
330 | if (ret != 0 || jit != 1) | |
331 | exit(EXIT_FAILURE); | |
332 | exit(EXIT_SUCCESS); | |
333 | ], | |
334 | [ pcre_jit_works=yes ], [:] | |
335 | ) | |
336 | if test "x$pcre_jit_works" != "xyes"; then | |
337 | AC_MSG_RESULT(no) | |
338 | echo | |
339 | echo " PCRE JIT support detection worked but testing it failed" | |
340 | echo " something odd is going on, please file a bug report." | |
341 | echo | |
342 | exit 1 | |
343 | else | |
344 | AC_MSG_RESULT(yes) | |
345 | fi | |
346 | fi | |
3d396e8b | 347 | |
c91a4baa JI |
348 | #libyaml |
349 | AC_ARG_WITH(libyaml_includes, | |
350 | [ --with-libyaml-includes=DIR libyaml include directory], | |
351 | [with_libyaml_includes="$withval"],[with_libyaml_includes=no]) | |
352 | AC_ARG_WITH(libyaml_libraries, | |
353 | [ --with-libyaml-libraries=DIR libyaml library directory], | |
354 | [with_libyaml_libraries="$withval"],[with_libyaml_libraries="no"]) | |
355 | ||
356 | if test "$with_libyaml_includes" != "no"; then | |
357 | CPPFLAGS="${CPPFLAGS} -I${with_libyaml_includes}" | |
358 | fi | |
359 | ||
360 | AC_CHECK_HEADER(yaml.h,,LIBYAML="no") | |
361 | ||
362 | if test "$with_libyaml_libraries" != "no"; then | |
363 | LDFLAGS="${LDFLAGS} -L${with_libyaml_libraries}" | |
364 | fi | |
365 | ||
366 | LIBYAML="" | |
367 | AC_CHECK_LIB(yaml,yaml_parser_initialize,,LIBYAML="no") | |
368 | ||
369 | if test "$LIBYAML" = "no"; then | |
370 | echo | |
371 | echo " ERROR! libyaml library not found, go get it" | |
372 | echo " from http://pyyaml.org/wiki/LibYAML." | |
373 | echo " or check your package manager." | |
374 | echo | |
375 | exit 1 | |
376 | fi | |
377 | ||
6899b3da | 378 | #libpthread |
a3510f20 WM |
379 | AC_ARG_WITH(libpthread_includes, |
380 | [ --with-libpthread-includes=DIR libpthread include directory], | |
381 | [with_libpthread_includes="$withval"],[with_libpthread_includes=no]) | |
382 | AC_ARG_WITH(libpthread_libraries, | |
383 | [ --with-libpthread-libraries=DIR libpthread library directory], | |
384 | [with_libpthread_libraries="$withval"],[with_libpthread_libraries="no"]) | |
385 | ||
386 | if test "$with_libpthread_includes" != "no"; then | |
6899b3da | 387 | CPPFLAGS="${CPPFLAGS} -I${with_libpthread_includes}" |
a3510f20 | 388 | fi |
6899b3da | 389 | |
fa5939ca | 390 | dnl AC_CHECK_HEADER(pthread.h,,[AC_ERROR(pthread.h not found ...)]) |
6899b3da | 391 | |
a3510f20 | 392 | if test "$with_libpthread_libraries" != "no"; then |
6899b3da | 393 | LDFLAGS="${LDFLAGS} -L${with_libpthread_libraries}" |
a3510f20 | 394 | fi |
6899b3da | 395 | |
a3510f20 WM |
396 | PTHREAD="" |
397 | AC_CHECK_LIB(pthread, pthread_create,, PTHREAD="no") | |
6899b3da | 398 | |
a3510f20 | 399 | if test "$PTHREAD" = "no"; then |
6899b3da WM |
400 | echo |
401 | echo " ERROR! libpthread library not found, glibc problem?" | |
402 | echo | |
403 | exit 1 | |
a3510f20 WM |
404 | fi |
405 | ||
406 | #enable support for NFQUEUE | |
407 | AC_ARG_ENABLE(nfqueue, | |
e07e9e16 WM |
408 | AS_HELP_STRING([--enable-nfqueue], [Enable NFQUEUE support for inline IDP]),,[enable_nfqueue=no]) |
409 | AS_IF([test "x$enable_nfqueue" = "xyes"], [ | |
410 | CFLAGS="$CFLAGS -DNFQ" | |
6899b3da WM |
411 | |
412 | #libnfnetlink | |
366671a8 JJ |
413 | case $host in |
414 | *-*-mingw32*) | |
415 | ;; | |
416 | *) | |
a3510f20 WM |
417 | AC_ARG_WITH(libnfnetlink_includes, |
418 | [ --with-libnfnetlink-includes=DIR libnfnetlink include directory], | |
419 | [with_libnfnetlink_includes="$withval"],[with_libnfnetlink_includes=no]) | |
420 | AC_ARG_WITH(libnfnetlink_libraries, | |
421 | [ --with-libnfnetlink-libraries=DIR libnfnetlink library directory], | |
422 | [with_libnfnetlink_libraries="$withval"],[with_libnfnetlink_libraries="no"]) | |
423 | ||
424 | if test "$with_libnfnetlink_includes" != "no"; then | |
0ffa1c24 | 425 | CPPFLAGS="${CPPFLAGS} -I${with_libnfnetlink_includes}" |
a3510f20 | 426 | fi |
0ffa1c24 | 427 | |
a3510f20 | 428 | AC_CHECK_HEADER(libnfnetlink/libnfnetlink.h,,[AC_ERROR(libnfnetlink.h not found ...)]) |
0ffa1c24 | 429 | |
a3510f20 | 430 | if test "$with_libnfnetlink_libraries" != "no"; then |
0ffa1c24 | 431 | LDFLAGS="${LDFLAGS} -L${with_libnfnetlink_libraries}" |
a3510f20 | 432 | fi |
0ffa1c24 | 433 | |
a3510f20 WM |
434 | NFNL="" |
435 | AC_CHECK_LIB(nfnetlink, nfnl_fd,, NFNL="no") | |
0ffa1c24 | 436 | |
a3510f20 | 437 | if test "$NFNL" = "no"; then |
0ffa1c24 WM |
438 | echo |
439 | echo " ERROR! nfnetlink library not found, go get it" | |
440 | echo " from www.netfilter.org." | |
441 | echo " we automatically append libnetfilter_queue/ when searching" | |
442 | echo " for headers etc. when the --with-libnfnetlink-inlcudes directive" | |
443 | echo " is used" | |
444 | echo | |
445 | exit | |
a3510f20 | 446 | fi |
366671a8 JJ |
447 | ;; |
448 | esac | |
0ffa1c24 | 449 | |
6899b3da | 450 | #libnetfilter_queue |
a3510f20 WM |
451 | AC_ARG_WITH(libnetfilter_queue_includes, |
452 | [ --with-libnetfilter_queue-includes=DIR libnetfilter_queue include directory], | |
453 | [with_libnetfilter_queue_includes="$withval"],[with_libnetfilter_queue_includes=no]) | |
454 | AC_ARG_WITH(libnetfilter_queue_libraries, | |
455 | [ --with-libnetfilter_queue-libraries=DIR libnetfilter_queue library directory], | |
456 | [with_libnetfilter_queue_libraries="$withval"],[with_libnetfilter_queue_libraries="no"]) | |
457 | ||
458 | if test "$with_libnetfilter_queue_includes" != "no"; then | |
0ffa1c24 | 459 | CPPFLAGS="${CPPFLAGS} -I${with_libnetfilter_queue_includes}" |
a3510f20 | 460 | fi |
0ffa1c24 | 461 | |
a3510f20 | 462 | AC_CHECK_HEADER(libnetfilter_queue/libnetfilter_queue.h,,[AC_ERROR(libnetfilter_queue/libnetfilter_queue.h not found ...)]) |
0ffa1c24 | 463 | |
a3510f20 | 464 | if test "$with_libnetfilter_queue_libraries" != "no"; then |
0ffa1c24 | 465 | LDFLAGS="${LDFLAGS} -L${with_libnetfilter_queue_libraries}" |
a3510f20 | 466 | fi |
0ffa1c24 WM |
467 | |
468 | #LDFLAGS="${LDFLAGS} -lnetfilter_queue" | |
469 | ||
a3510f20 | 470 | NFQ="" |
366671a8 JJ |
471 | |
472 | case $host in | |
473 | *-*-mingw32*) | |
474 | AC_CHECK_LIB(netfilter_queue, nfq_open,, NFQ="no",-lws2_32) | |
475 | ||
476 | AC_ARG_WITH(netfilterforwin_includes, | |
477 | [ --with-netfilterforwin-includes=DIR netfilterforwin include directory], | |
478 | [with_netfilterforwin_includes="$withval"],[with_netfilterforwin_includes=no]) | |
479 | ||
480 | if test "$with_netfilterforwin_includes" != "no"; then | |
481 | CPPFLAGS="${CPPFLAGS} -I${with_netfilterforwin_includes}" | |
482 | else | |
483 | CPPFLAGS="${CPPFLAGS} -I../../netfilterforwin" | |
484 | fi | |
485 | ;; | |
486 | *) | |
a3510f20 | 487 | AC_CHECK_LIB(netfilter_queue, nfq_open,, NFQ="no",) |
72ec56ab | 488 | 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]) |
1e600c10 | 489 | 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]) |
72ec56ab | 490 | |
c9f9e3f9 VJ |
491 | # check if the argument to nfq_get_payload is signed or unsigned |
492 | AC_MSG_CHECKING([for signed nfq_get_payload payload argument]) | |
493 | STORECFLAGS="${CFLAGS}" | |
494 | CFLAGS="${CFLAGS} -Werror" | |
495 | AC_COMPILE_IFELSE( | |
496 | [AC_LANG_PROGRAM( | |
497 | [ | |
498 | #include <libnetfilter_queue/libnetfilter_queue.h> | |
499 | ], | |
500 | [ | |
501 | char *pktdata; | |
502 | nfq_get_payload(NULL, &pktdata); | |
503 | ])], | |
504 | [libnetfilter_queue_nfq_get_payload_signed="yes"], | |
505 | [libnetfilter_queue_nfq_get_payload_signed="no"]) | |
506 | AC_MSG_RESULT($libnetfilter_queue_nfq_get_payload_signed) | |
507 | if test "x$libnetfilter_queue_nfq_get_payload_signed" = "xyes"; then | |
508 | AC_DEFINE([NFQ_GET_PAYLOAD_SIGNED], [], [For signed version of nfq_get_payload]) | |
509 | fi | |
510 | CFLAGS="${STORECFLAGS}" | |
366671a8 JJ |
511 | ;; |
512 | esac | |
0ffa1c24 | 513 | |
a3510f20 | 514 | if test "$NFQ" = "no"; then |
0ffa1c24 WM |
515 | echo |
516 | echo " ERROR! libnetfilter_queue library not found, go get it" | |
517 | echo " from www.netfilter.org." | |
518 | echo " we automatically append libnetfilter_queue/ when searching" | |
2600d203 | 519 | echo " for headers etc. when the --with-libnfq-includes directive" |
0ffa1c24 WM |
520 | echo " is used" |
521 | echo | |
522 | exit 1 | |
a3510f20 | 523 | fi |
e07e9e16 | 524 | ]) |
2b7b78f1 NR |
525 | #enable support for IPFW |
526 | AC_ARG_ENABLE(ipfw, | |
e07e9e16 WM |
527 | AS_HELP_STRING([--enable-ipfw], [Enable FreeBSD IPFW support for inline IDP]),,[enable_ipfw=no]) |
528 | AS_IF([test "x$enable_ipfw" = "xyes"], [ | |
eb33dc16 | 529 | CFLAGS="$CFLAGS -DIPFW" |
e07e9e16 | 530 | ]) |
2b7b78f1 | 531 | |
eb33dc16 | 532 | #prelude |
eb33dc16 | 533 | AC_ARG_ENABLE(prelude, |
e07e9e16 | 534 | AS_HELP_STRING([--enable-prelude], [Enable Prelude support for alerts]),,[enable_prelude=no]) |
4e84ffe2 | 535 | AS_IF([test "x$enable_prelude" = "xyes"], [ |
eb33dc16 PC |
536 | CFLAGS="$CFLAGS -DPRELUDE" |
537 | AM_PATH_LIBPRELUDE(0.9.9, , AC_MSG_ERROR(Cannot find libprelude: Is libprelude-config in the path?), no) | |
538 | if test "x${LIBPRELUDE_CFLAGS}" != "x"; then | |
539 | CPPFLAGS="${CPPFLAGS} ${LIBPRELUDE_CFLAGS}" | |
540 | fi | |
541 | ||
542 | if test "x${LIBPRELUDE_LDFLAGS}" != "x"; then | |
543 | LDFLAGS="${LDFLAGS} ${LIBPRELUDE_LDFLAGS}" | |
544 | fi | |
545 | ||
546 | if test "x${LIBPRELUDE_LIBS}" != "x"; then | |
547 | LDFLAGS="${LDFLAGS} ${LIBPRELUDE_LIBS}" | |
548 | fi | |
4e84ffe2 | 549 | ]) |
eb33dc16 | 550 | |
6899b3da | 551 | #libnet |
a3510f20 WM |
552 | AC_ARG_WITH(libnet_includes, |
553 | [ --with-libnet-includes=DIR libnet include directory], | |
554 | [with_libnet_includes="$withval"],[with_libnet_includes="no"]) | |
555 | ||
556 | AC_ARG_WITH(libnet_libraries, | |
557 | [ --with-libnet-libraries=DIR libnet library directory], | |
558 | [with_libnet_libraries="$withval"],[with_libnet_libraries="no"]) | |
559 | ||
560 | if test "x$with_libnet_includes" != "xno"; then | |
3678dda1 WM |
561 | CPPFLAGS="${CPPFLAGS} -I${with_libnet_includes}" |
562 | libnet_dir="${with_libnet_includes}" | |
f7111f38 | 563 | else |
3678dda1 | 564 | libnet_dir="/usr/include /usr/local/include /usr/local/include/libnet11 /opt/local/include" |
a3510f20 | 565 | fi |
0ffa1c24 | 566 | |
a3510f20 | 567 | if test "x$with_libnet_libraries" != "xno"; then |
3678dda1 | 568 | LDFLAGS="${LDFLAGS} -L${with_libnet_libraries}" |
a3510f20 WM |
569 | fi |
570 | ||
3678dda1 | 571 | LIBNET_DETECT_FAIL="no" |
a3510f20 | 572 | LIBNET_INC_DIR="" |
3678dda1 | 573 | |
a3510f20 WM |
574 | for i in $libnet_dir; do |
575 | if test -r "$i/libnet.h"; then | |
3678dda1 | 576 | LIBNET_INC_DIR="$i" |
a3510f20 WM |
577 | fi |
578 | done | |
579 | ||
3678dda1 | 580 | AC_MSG_CHECKING(for libnet.h version 1.1.x) |
a3510f20 | 581 | if test "$LIBNET_INC_DIR" != ""; then |
3678dda1 WM |
582 | if eval "grep LIBNET_VERSION $LIBNET_INC_DIR/libnet.h | grep -v 1.1 >/dev/null"; then |
583 | AC_MSG_RESULT(no) | |
584 | LIBNET_DETECT_FAIL="yes" | |
585 | LIBNET_FAIL_WARN($libnet_dir) | |
586 | else | |
587 | AC_MSG_RESULT(yes) | |
588 | fi | |
6e8c75ff | 589 | |
3678dda1 WM |
590 | #CentOS, Fedora, Ubuntu-LTS, Ubuntu all set defines to the same values. libnet-config seems |
591 | #to have been depreciated but all distro's seem to include it as part of the package. | |
592 | if test "$LIBNET_DETECT_FAIL" = "no"; then | |
593 | LLIBNET="" | |
594 | AC_CHECK_LIB(net, libnet_write,, LLIBNET="no") | |
595 | if test "$LLIBNET" != "no"; then | |
596 | CFLAGS="${CFLAGS} -DHAVE_LIBNET11 -D_BSD_SOURCE -D__BSD_SOURCE -D__FAVOR_BSD -DHAVE_NET_ETHERNET_H" | |
597 | else | |
598 | #if we displayed a warning already no reason to do it again. | |
599 | if test "$LIBNET_DETECT_FAIL" = "no"; then | |
600 | LIBNET_DETECT_FAIL="yes" | |
601 | LIBNET_FAIL_WARN($libnet_dir) | |
602 | fi | |
603 | fi | |
604 | ||
605 | # see if we have the patched libnet 1.1 | |
606 | # http://www.inliniac.net/blog/2007/10/16/libnet-11-ipv6-fixes-and-additions.html | |
607 | # | |
608 | # To prevent duping the lib link we reset LIBS after this check. Setting action-if-found to NULL doesn't seem to work | |
609 | # see: http://blog.flameeyes.eu/2008/04/29/i-consider-ac_check_lib-harmful | |
610 | if test "$LIBNET_DETECT_FAIL" = "no"; then | |
611 | LLIBNET="" | |
612 | TMPLIBS="${LIBS}" | |
613 | AC_CHECK_LIB(net, libnet_build_icmpv6_unreach,, LLIBNET="no") | |
614 | if test "$LLIBNET" != "no"; then | |
615 | CFLAGS="$CFLAGS -DHAVE_LIBNET_ICMPV6_UNREACH" | |
616 | fi | |
617 | LIBS="${TMPLIBS}" | |
618 | fi | |
619 | fi | |
a3510f20 | 620 | else |
3678dda1 WM |
621 | LIBNET_DETECT_FAIL="yes" |
622 | LIBNET_FAIL_WARN($libnet_dir) | |
a3510f20 | 623 | fi |
073d0421 WM |
624 | # libpfring (currently only supported for libpcap enabled pfring) |
625 | # Error on the side of caution. If libpfring enabled pcap is being used and we don't link against -lpfring compilation will fail. | |
04b0f177 | 626 | AC_ARG_ENABLE(pfring, |
e07e9e16 WM |
627 | AS_HELP_STRING([--enable-pfring], [Enable Native PF_RING support]),,[enable_pfring=no]) |
628 | AS_IF([test "x$enable_pfring" = "xyes"], [ | |
629 | CFLAGS="$CFLAGS -DHAVE_PFRING" | |
ddf995da | 630 | |
631 | #We have to set CFLAGS for AC_TRY_COMPILE as it doesn't pay attention to CPPFLAGS | |
6408feba W |
632 | AC_ARG_WITH(libpfring_includes, |
633 | [ --with-libpfring-includes=DIR libpfring include directory], | |
634 | [with_libpfring_includes="$withval"],[with_libpfring_includes=no]) | |
635 | AC_ARG_WITH(libpfring_libraries, | |
636 | [ --with-libpfring-libraries=DIR libpfring library directory], | |
637 | [with_libpfring_libraries="$withval"],[with_libpfring_libraries="no"]) | |
638 | ||
639 | if test "$with_libpfring_includes" != "no"; then | |
640 | CPPFLAGS="${CPPFLAGS} -I${with_libpfring_includes}" | |
641 | fi | |
073d0421 | 642 | |
6408feba W |
643 | if test "$with_libpfring_libraries" != "no"; then |
644 | LDFLAGS="${LDFLAGS} -L${with_libpfring_libraries}" | |
645 | fi | |
073d0421 | 646 | |
6408feba | 647 | LIBPFRING="" |
43ffd779 | 648 | AC_CHECK_LIB(pfring, pfring_open,, LIBPFRING="no", [-lpcap]) |
6408feba W |
649 | if test "$LIBPFRING" = "no"; then |
650 | if test "x$enable_pfring" = "xyes"; then | |
651 | echo | |
652 | echo " ERROR! --enable-pfring was passed but the library was not found or version is >4, go get it" | |
653 | echo " from http://www.ntop.org/PF_RING.html" | |
654 | echo | |
655 | exit 1 | |
656 | fi | |
04b0f177 | 657 | fi |
073d0421 | 658 | |
6408feba | 659 | LIBPFRING_ENABLE_RING="" |
43ffd779 | 660 | AC_CHECK_LIB(pfring, pfring_enable_ring,, LIBPFRING_ENABLE_RING="no", [-lpcap]) |
6408feba W |
661 | if test "$LIBPFRING_ENABLE_RING" != "no"; then |
662 | AC_DEFINE([HAVE_PFRING_ENABLE],[1],[PF_RING pfring_enable_ring is available]) | |
663 | fi | |
1099093e | 664 | |
0ac1cabf EL |
665 | LIBPFRING_CLUSTER_TYPE="" |
666 | AC_CHECK_LIB(pfring, pfring_set_cluster, | |
43ffd779 | 667 | , LIBPFRING_CLUSTER_TYPE="no", [-lpcap]) |
0ac1cabf | 668 | if test "$LIBPFRING_CLUSTER_TYPE" != "no"; then |
6408feba | 669 | AC_DEFINE([HAVE_PFRING_CLUSTER_TYPE],[1],[PF_RING pfring_set_cluster is available]) |
6408feba W |
670 | fi |
671 | ||
0ac1cabf EL |
672 | LIBPFRING_BPF_FILTER="" |
673 | AC_CHECK_LIB(pfring, pfring_set_bpf_filter, | |
43ffd779 | 674 | , LIBPFRING_BPF_FILTER="no", [-lpcap]) |
2aa04add CW |
675 | LIBPFRING_REMOVE_BPF_FILTER="" |
676 | AC_CHECK_LIB(pfring, pfring_remove_bpf_filter, | |
677 | , LIBPFRING_REMOVE_BPF_FILTER="no", [-lpcap]) | |
678 | if test "$LIBPFRING_BPF_FILTER" != "no" -a "$LIBPFRING_REMOVE_BPF_FILTER" != "no"; then | |
d5e254d5 | 679 | AC_DEFINE([HAVE_PFRING_SET_BPF_FILTER],[1],[PF_RING pfring_set_bpf_filter is available]) |
d5e254d5 | 680 | fi |
681 | ||
6408feba W |
682 | STORE_CFLAGS="${CFLAGS}" |
683 | CFLAGS="${CFLAGS} -Werror" | |
684 | AC_MSG_CHECKING([if pfring_recv expects u_char**]) | |
685 | AC_TRY_COMPILE([ | |
686 | #include <pfring.h> | |
687 | ], | |
688 | [ | |
689 | u_char *buffer; | |
690 | struct pfring_pkthdr hdr; | |
691 | pfring *pd; memset(&hdr, 0, sizeof(hdr)); | |
692 | pd = pfring_open("eth1", 1, 1515, 1); | |
693 | pfring_recv(pd, &buffer, 0, &hdr, 1); | |
694 | ], | |
695 | [ pfring_recv_uchar_buff=yes ], [:]) | |
696 | ||
697 | CFLAGS="${STORE_CFLAGS}" | |
698 | ||
6408feba W |
699 | if test "$pfring_recv_uchar_buff" = "yes"; then |
700 | AC_DEFINE([HAVE_PFRING_RECV_UCHAR],[1],[PF_RING pfring_recv buffer is u_char**]) | |
701 | AC_MSG_RESULT(yes) | |
702 | else | |
703 | AC_MSG_RESULT(no) | |
704 | fi | |
705 | ]) | |
ddf995da | 706 | |
c45d8985 | 707 | |
9c7f5afa | 708 | # libpcap |
a3510f20 WM |
709 | AC_ARG_WITH(libpcap_includes, |
710 | [ --with-libpcap-includes=DIR libpcap include directory], | |
711 | [with_libpcap_includes="$withval"],[with_libpcap_includes=no]) | |
712 | AC_ARG_WITH(libpcap_libraries, | |
713 | [ --with-libpcap-libraries=DIR libpcap library directory], | |
714 | [with_libpcap_libraries="$withval"],[with_libpcap_libraries="no"]) | |
715 | ||
716 | if test "$with_libpcap_includes" != "no"; then | |
6899b3da | 717 | CPPFLAGS="${CPPFLAGS} -I${with_libpcap_includes}" |
a3510f20 | 718 | fi |
6899b3da WM |
719 | |
720 | AC_CHECK_HEADER(pcap.h,,[AC_ERROR(pcap.h not found ...)]) | |
721 | ||
a3510f20 | 722 | if test "$with_libpcap_libraries" != "no"; then |
6899b3da | 723 | LDFLAGS="${LDFLAGS} -L${with_libpcap_libraries}" |
a3510f20 | 724 | fi |
6899b3da | 725 | |
a3510f20 WM |
726 | LIBPCAP="" |
727 | AC_CHECK_LIB(pcap, pcap_open_live,, LIBPCAP="no") | |
728 | if test "$LIBPCAP" = "no"; then | |
af992242 | 729 | echo |
ed856de9 | 730 | echo " ERROR! libpcap library not found, go get it" |
af992242 WM |
731 | echo " from http://www.tcpdump.org." |
732 | echo | |
733 | exit 1 | |
a3510f20 | 734 | fi |
af992242 WM |
735 | |
736 | # pcap_activate and pcap_create only exists in libpcap >= 1.0 | |
a3510f20 | 737 | LIBPCAPVTEST="" |
6e8c75ff WM |
738 | #To prevent duping the lib link we reset LIBS after this check. Setting action-if-found to NULL doesn't seem to work |
739 | #see: http://blog.flameeyes.eu/2008/04/29/i-consider-ac_check_lib-harmful | |
740 | TMPLIBS="${LIBS}" | |
a3510f20 | 741 | AC_CHECK_LIB(pcap, pcap_activate,, LPCAPVTEST="no") |
af992242 | 742 | if test "$LPCAPVTEST" != "no"; then |
a3510f20 | 743 | CFLAGS="${CFLAGS} `pcap-config --defines` `pcap-config --cflags` -DLIBPCAP_VERSION_MAJOR=1" |
af992242 | 744 | else |
a3510f20 WM |
745 | CFLAGS="${CFLAGS} -DLIBPCAP_VERSION_MAJOR=0" |
746 | fi | |
6e8c75ff | 747 | LIBS="${TMPLIBS}" |
a3510f20 | 748 | |
9ce1399d WM |
749 | #Appears as if pcap_set_buffer_size is linux only? |
750 | LIBPCAPSBUFF="" | |
751 | #To prevent duping the lib link we reset LIBS after this check. Setting action-if-found to NULL doesn't seem to work | |
752 | #see: http://blog.flameeyes.eu/2008/04/29/i-consider-ac_check_lib-harmful | |
753 | TMPLIBS="${LIBS}" | |
754 | AC_CHECK_LIB(pcap, pcap_set_buffer_size,, LPCAPSBUFF="no") | |
755 | if test "$LPCAPSBUFF" != "no"; then | |
756 | CFLAGS="${CFLAGS} -DHAVE_PCAP_SET_BUFF" | |
757 | fi | |
758 | LIBS="${TMPLIBS}" | |
759 | ||
a3510f20 | 760 | # enable the running of unit tests |
e6400bf4 | 761 | AC_ARG_ENABLE(unittests, |
e07e9e16 WM |
762 | AS_HELP_STRING([--enable-unittests], [Enable compilation of the unit tests]),,[enable_unittests=no]) |
763 | AS_IF([test "x$enable_unittests" = "xyes"], [ | |
764 | UT_ENABLED="yes" | |
765 | CFLAGS="${CFLAGS} -DUNITTESTS" | |
766 | ]) | |
a3510f20 | 767 | |
0044bb22 EL |
768 | AM_CONDITIONAL([BUILD_UNITTESTS], [test "x$enable_unittests" = "xyes"]) |
769 | ||
c45d8985 | 770 | # AF_PACKET support |
e80b30c0 EL |
771 | AC_ARG_ENABLE(af-packet, |
772 | AS_HELP_STRING([--enable-af-packet], [Enable AF_PACKET support]), | |
773 | ,[enable_af_packet=no]) | |
774 | AS_IF([test "x$enable_af_packet" = "xyes"], [ | |
775 | AC_CHECK_DECL([AF_PACKET], | |
776 | AC_DEFINE([HAVE_AF_PACKET],[1],[AF_PACKET support is available]), | |
777 | [enable_af_packet=no], | |
778 | [[#include <sys/socket.h>]]) | |
779 | AC_CHECK_DECL([PACKET_FANOUT], | |
780 | AC_DEFINE([HAVE_PACKET_FANOUT],[1],[Packet fanout support is available]), | |
781 | [], | |
782 | [[#include <linux/if_packet.h>]]) | |
783 | CFLAGS="${CFLAGS} -DUNITTESTS" | |
784 | ]) | |
785 | ||
c45d8985 | 786 | |
50ddd2df EL |
787 | # enable workaround for old barnyard2 for unified alert output |
788 | AC_ARG_ENABLE(old-barnyard2, | |
789 | AS_HELP_STRING([--enable-old-barnyard2], [Use workaround for old barnyard2 in unified2 output]),,[enable_old_barnyard2=no]) | |
790 | AS_IF([test "x$enable_old_barnyard2" = "xyes"], [ | |
791 | CFLAGS="${CFLAGS} -DHAVE_OLD_BARNYARD2" | |
792 | ]) | |
793 | ||
8069fc75 WM |
794 | # enable debug output |
795 | AC_ARG_ENABLE(debug, | |
e07e9e16 WM |
796 | AS_HELP_STRING([--enable-debug], [Enable debug output]),,[enable_debug=no]) |
797 | AS_IF([test "x$enable_debug" = "xyes"], [ | |
798 | CFLAGS="${CFLAGS} -DDEBUG" | |
799 | ]) | |
8069fc75 | 800 | |
e6855792 | 801 | # enable debug validation functions & macro's output |
1fb11e93 | 802 | AC_ARG_ENABLE(debug-validation, |
e6855792 VJ |
803 | AS_HELP_STRING([--enable-debug-validation], [Enable (debug) validation code output]),,[enable_debug_validation=no]) |
804 | AS_IF([test "x$enable_debug_validation" = "xyes"], [ | |
805 | CFLAGS="${CFLAGS} -DDEBUG_VALIDATION" | |
806 | ]) | |
807 | ||
07f7ba55 | 808 | #libhtp |
e07e9e16 WM |
809 | AC_ARG_ENABLE(non-bundled-htp, |
810 | AS_HELP_STRING([--enable-non-bundled-htp], [Enable the use of an already installed version of htp]),,[enable_non_bundled_htp=no]) | |
811 | AS_IF([test "x$enable_non_bundled_htp" = "xyes"], [ | |
812 | AC_ARG_WITH(libhtp_includes, | |
813 | [ --with-libhtp-includes=DIR libhtp include directory], | |
814 | [with_libhtp_includes="$withval"],[with_libhtp_includes=no]) | |
815 | AC_ARG_WITH(libhtp_libraries, | |
816 | [ --with-libhtp-libraries=DIR libhtp library directory], | |
817 | [with_libhtp_libraries="$withval"],[with_libhtp_libraries="no"]) | |
818 | ||
819 | if test "$with_libhtp_includes" != "no"; then | |
820 | CPPFLAGS="${CPPFLAGS} -I${with_libhtp_includes}" | |
821 | fi | |
07f7ba55 | 822 | |
e07e9e16 WM |
823 | if test "$with_libhtp_libraries" != "no"; then |
824 | LDFLAGS="${LDFLAGS} -L${with_libhtp_libraries}" | |
825 | fi | |
ed856de9 | 826 | |
e07e9e16 | 827 | AC_CHECK_HEADER(htp/htp.h,,[AC_ERROR(htp/htp.h not found ...)]) |
ed856de9 | 828 | |
e07e9e16 WM |
829 | LIBHTP="" |
830 | AC_CHECK_LIB(htp, htp_conn_create,, LIBHTP="no") | |
831 | if test "$LIBHTP" = "no"; then | |
832 | echo | |
833 | echo " ERROR! libhtp library not found" | |
834 | echo | |
835 | exit 1 | |
836 | fi | |
837 | PKG_CHECK_MODULES(LIBHTPMINVERSION, htp >= 0.2.3,[libhtp_minver_found="yes"],[libhtp_minver_found="no"]) | |
838 | if test "$libhtp_minver_found" = "no"; then | |
839 | echo | |
840 | echo " ERROR! libhtp was found but is not the minimum version required >=0.2.3" | |
841 | echo | |
842 | exit 1 | |
843 | fi | |
a3e2b355 VJ |
844 | |
845 | 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]) | |
e07e9e16 | 846 | ]) |
f7111f38 | 847 | |
36917c7d VJ |
848 | #even if we are using an installed htp lib we still need to gen Makefiles inside of htp |
849 | AC_CONFIG_SUBDIRS([libhtp]) | |
850 | AM_CONDITIONAL([BUILD_LIBHTP], [test "x$enable_non_bundled_htp" = "xno"]) | |
851 | AS_IF([test "x$enable_non_bundled_htp" = "xno"], [ | |
852 | AC_DEFINE_UNQUOTED([HAVE_HTP_URI_NORMALIZE_HOOK],[1],[Assuming htp_config_register_request_uri_normalize function in bundled libhtp]) | |
853 | ]) | |
854 | ||
08328f9d | 855 | |
d281a6b8 VJ |
856 | # enable CUDA output |
857 | AC_ARG_ENABLE(cuda, | |
1fb11e93 | 858 | AS_HELP_STRING([--enable-cuda], [Enable experimental CUDA pattern matching]),,[enable_cuda=no]) |
e07e9e16 WM |
859 | AS_IF([test "x$enable_cuda" = "xyes"], [ |
860 | AC_ARG_WITH(cuda_includes, | |
861 | [ --with-cuda-includes=DIR cuda include directory], | |
862 | [with_cuda_includes="$withval"],[with_cuda_includes=no]) | |
863 | AC_ARG_WITH(cuda_libraries, | |
864 | [ --with-cuda-libraries=DIR cuda library directory], | |
865 | [with_cuda_libraries="$withval"],[with_cuda_libraries="no"]) | |
49d66430 MB |
866 | AC_ARG_WITH(cuda_nvcc, |
867 | [ --with-cuda-nvcc=DIR cuda nvcc compiler directory], | |
868 | [with_cuda_nvcc="$withval"],[with_cuda_nvcc=no]) | |
e07e9e16 | 869 | |
d281a6b8 VJ |
870 | CFLAGS="${CFLAGS} -D__SC_CUDA_SUPPORT__" |
871 | ||
872 | if test "$with_cuda_includes" != "no"; then | |
873 | CPPFLAGS="${CPPFLAGS} -I${with_cuda_includes}" | |
874 | else | |
2f1262b4 | 875 | CPPFLAGS="${CPPFLAGS} -I/usr/local/cuda/include" |
d281a6b8 VJ |
876 | fi |
877 | ||
878 | if test "$with_cuda_libraries" != "no"; then | |
879 | LDFLAGS="${LDFLAGS} -L${with_cuda_libraries}" | |
880 | fi | |
881 | ||
49d66430 MB |
882 | if test "$with_cuda_nvcc" != "no"; then |
883 | NVCC_DIR="${with_cuda_nvcc}" | |
884 | else | |
885 | NVCC_DIR="/usr/local/cuda/bin" | |
886 | fi | |
887 | ||
d281a6b8 VJ |
888 | AC_CHECK_HEADER(cuda.h,,[AC_ERROR(cuda.h not found ...)]) |
889 | ||
890 | LIBCUDA="" | |
891 | AC_CHECK_LIB(cuda, cuArray3DCreate,, LIBCUDA="no") | |
892 | if test "$LIBCUDA" = "no"; then | |
893 | echo | |
894 | echo " ERROR! libcuda library not found" | |
895 | echo | |
896 | exit 1 | |
897 | fi | |
49d66430 | 898 | |
2f1262b4 MB |
899 | AC_PATH_PROG([NVCC], [nvcc], no, [$PATH:$NVCC_DIR]) |
900 | if test "x$NVCC" = "xno"; then | |
49d66430 MB |
901 | echo |
902 | echo " ERROR! CUDA nvcc compiler not found: use --with-cuda-nvcc=DIR" | |
903 | echo | |
904 | exit 1 | |
905 | fi | |
906 | ||
2f1262b4 MB |
907 | AC_MSG_CHECKING(for nvcc version) |
908 | NVCCVER=`$NVCC --version | grep "release" | sed 's/.*release \(@<:@0-9@:>@\)\.\(@<:@0-9@:>@\).*/\1\2/'` | |
909 | AC_MSG_RESULT($NVCCVER) | |
910 | if test "$NVCCVER" -lt 31; then | |
49d66430 | 911 | echo |
2f1262b4 MB |
912 | echo " Warning! Your CUDA nvcc version might be outdated." |
913 | echo " If compilation fails try the latest CUDA toolkit from" | |
914 | echo " www.nvidia.com/object/cuda_develop.html" | |
915 | echo | |
916 | fi | |
917 | ||
918 | AM_PATH_PYTHON(,, no) | |
919 | if test "x$PYTHON" = "xno"; then | |
920 | echo | |
921 | echo " ERROR! Compiling CUDA kernels requires python." | |
49d66430 MB |
922 | echo |
923 | exit 1 | |
924 | fi | |
e07e9e16 | 925 | ]) |
2f1262b4 | 926 | AM_CONDITIONAL([BUILD_CUDA], [test "x$enable_cuda" = "xyes"]) |
d281a6b8 | 927 | |
070ed778 VJ |
928 | # Check for libcap-ng |
929 | ||
930 | AC_ARG_WITH(libcap_ng_includes, | |
931 | [ --with-libcap_ng-includes=DIR libcap_ng include directory], | |
932 | [with_libcap-ng_includes="$withval"],[with_libcap_ng_includes=no]) | |
933 | AC_ARG_WITH(libcap_ng_libraries, | |
934 | [ --with-libcap_ng-libraries=DIR libcap_ng library directory], | |
935 | [with_libcap_ng_libraries="$withval"],[with_libcap_ng_libraries="no"]) | |
936 | ||
937 | if test "$with_libcap_ng_includes" != "no"; then | |
938 | CPPFLAGS="${CPPFLAGS} -I${with_libcap_ng_includes}" | |
939 | fi | |
940 | ||
941 | if test "$with_libcap_ng_libraries" != "no"; then | |
942 | LDFLAGS="${LDFLAGS} -L${with_libcap_ng_libraries}" | |
943 | fi | |
944 | ||
945 | AC_CHECK_HEADER(cap-ng.h,,LIBCAP_NG="no") | |
946 | if test "$LIBCAP_NG" != "no"; then | |
947 | LIBCAP_NG="" | |
948 | AC_CHECK_LIB(cap-ng,capng_clear,,LIBCAP_NG="no") | |
949 | fi | |
950 | ||
951 | if test "$LIBCAP_NG" != "no"; then | |
952 | CFLAGS="${CFLAGS} -DHAVE_LIBCAP_NG" | |
953 | fi | |
954 | ||
955 | if test "$LIBCAP_NG" = "no"; then | |
956 | echo | |
957 | echo " WARNING! libcap-ng library not found, go get it" | |
958 | echo " from http://people.redhat.com/sgrubb/libcap-ng/" | |
959 | echo " or check your package manager." | |
960 | echo | |
961 | echo " Suricata will be built without support for dropping privs." | |
962 | echo | |
963 | fi | |
07f7ba55 | 964 | |
18e5ac8c | 965 | AC_ARG_ENABLE(profiling, |
e07e9e16 WM |
966 | AS_HELP_STRING([--enable-profiling], [Enable performance profiling]),,[enable_profiling=no]) |
967 | AS_IF([test "x$enable_profiling" = "xyes"], [ | |
968 | CFLAGS="${CFLAGS} -DPROFILING" | |
969 | ]) | |
18e5ac8c | 970 | |
835630ef JM |
971 | # Check for DAG support. |
972 | ||
973 | AC_ARG_ENABLE(dag, | |
974 | [ --enable-dag Enable DAG capture], | |
975 | [ enable_dag=yes ], | |
976 | [ enable_dag=no]) | |
977 | AC_ARG_WITH(dag_includes, | |
978 | [ --with-dag-includes=DIR dagapi include directory], | |
979 | [with_dag_includes="$withval"],[with_dag_includes="no"]) | |
980 | AC_ARG_WITH(dag_libraries, | |
981 | [ --with-dag-libraries=DIR dagapi library directory], | |
982 | [with_dag_libraries="$withval"],[with_dag_libraries="no"]) | |
983 | ||
984 | if test "$enable_dag" = "yes"; then | |
985 | ||
986 | if test "$with_dag_includes" != "no"; then | |
987 | CPPFLAGS="${CPPFLAGS} -I${with_dag_includes}" | |
988 | fi | |
989 | ||
990 | if test "$with_dag_libraries" != "no"; then | |
991 | LDFLAGS="${LDFLAGS} -I${with_dag_libraries}" | |
992 | fi | |
993 | ||
994 | AC_CHECK_HEADER(dagapi.h,DAG="yes",DAG="no") | |
995 | if test "$DAG" != "no"; then | |
996 | DAG="" | |
997 | AC_CHECK_LIB(dag,dag_open,DAG="yes",DAG="no") | |
998 | fi | |
999 | ||
1000 | if test "$DAG" != "no"; then | |
1001 | CFLAGS="${CFLAGS} -DHAVE_DAG" | |
1002 | fi | |
1003 | ||
1004 | if test "$DAG" = "no"; then | |
1005 | echo | |
1006 | echo " ERROR! libdag library not found" | |
1007 | echo | |
1008 | exit 1 | |
1009 | fi | |
1010 | fi | |
1011 | ||
f4a6f4b2 VJ |
1012 | #libmagic |
1013 | AC_ARG_WITH(libmagic_includes, | |
1014 | [ --with-libmagic-includes=DIR libmagic include directory], | |
1015 | [with_libmagic_includes="$withval"],[with_libmagic_includes=no]) | |
1016 | AC_ARG_WITH(libmagic_libraries, | |
1017 | [ --with-libmagic-libraries=DIR libmagic library directory], | |
1018 | [with_libmagic_libraries="$withval"],[with_libmagic_libraries="no"]) | |
1019 | ||
1020 | if test "$with_libmagic_includes" != "no"; then | |
1021 | CPPFLAGS="${CPPFLAGS} -I${with_libmagic_includes}" | |
1022 | fi | |
1023 | ||
1024 | AC_CHECK_HEADER(magic.h,,[AC_ERROR(magic.h not found ...)]) | |
1025 | ||
1026 | if test "$with_libmagic_libraries" != "no"; then | |
1027 | LDFLAGS="${LDFLAGS} -L${with_libmagic_libraries}" | |
1028 | fi | |
1029 | ||
1030 | MAGIC="" | |
1031 | AC_CHECK_LIB(magic, magic_open,, MAGIC="no") | |
1032 | ||
1033 | if test "$MAGIC" = "no"; then | |
1034 | echo | |
1035 | echo " ERROR! magic library not found, go get it" | |
1036 | echo " from http://www.darwinsys.com/file/." | |
1037 | echo | |
1038 | exit 1 | |
1039 | fi | |
1040 | ||
e3bde3e9 VJ |
1041 | # get revision |
1042 | if test -f ./revision; then | |
1043 | REVISION=`cat ./revision` | |
1044 | CFLAGS="${CFLAGS} -DREVISION=\"${REVISION}\"" | |
1045 | else | |
1046 | GIT=`which git` | |
1047 | if test "$GIT" != ""; then | |
627c02e3 | 1048 | REVISION=`git rev-parse --short HEAD` |
e3bde3e9 VJ |
1049 | CFLAGS="${CFLAGS} -DREVISION=\"${REVISION}\"" |
1050 | fi | |
1051 | fi | |
1052 | ||
0ffa1c24 WM |
1053 | AC_SUBST(CFLAGS) |
1054 | AC_SUBST(LDFLAGS) | |
1055 | AC_SUBST(CPPFLAGS) | |
1056 | ||
7c841e1d | 1057 | AC_OUTPUT(Makefile src/Makefile qa/Makefile qa/coccinelle/Makefile) |
a098e39b JI |
1058 | |
1059 | echo " | |
1060 | Suricata Configuration: | |
e07e9e16 WM |
1061 | NFQueue support: ${enable_nfqueue} |
1062 | IPFW support: ${enable_ipfw} | |
1063 | PF_RING support: ${enable_pfring} | |
e80b30c0 | 1064 | AF_PACKET support: ${enable_af_packet} |
e07e9e16 WM |
1065 | Prelude support: ${enable_prelude} |
1066 | Unit tests enabled: ${enable_unittests} | |
1067 | Debug output enabled: ${enable_debug} | |
e6855792 | 1068 | Debug validation enabled: ${enable_debug_validation} |
e07e9e16 | 1069 | CUDA enabled: ${enable_cuda} |
835630ef | 1070 | DAG enabled: ${enable_dag} |
e07e9e16 WM |
1071 | Profiling enabled: ${enable_profiling} |
1072 | GCC Protect enabled: ${enable_gccprotect} | |
1073 | GCC march native enabled: ${enable_gccmarch_native} | |
1074 | GCC Profile enabled: ${enable_gccprofile} | |
50ddd2df | 1075 | Old barnyard2 support: ${enable_old_barnyard2} |
e07e9e16 | 1076 | Non-bundled htp: ${enable_non_bundled_htp} |
3d558bf0 | 1077 | PCRE jit: ${pcre_jit_available} |
e07e9e16 | 1078 | " |