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