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