1 #TODO A better place for default CFLAGS?
5 AC_CONFIG_HEADERS([config.h])
6 AM_INIT_AUTOMAKE(suricata, 2.0dev)
12 AC_DEFUN([FAIL_MESSAGE],[
15 echo "**********************************************"
16 echo " ERROR: unable to find" $1
17 echo " checked in the following places"
18 for i in `echo $2`; do
21 echo "**********************************************"
26 AC_DEFUN([LIBNET_FAIL_WARN],[
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 "*************************************************************************"
38 if test `basename $CC` = "clang"; then
39 CFLAGS="$CFLAGS -Wextra -Werror-implicit-function-declaration"
40 AC_MSG_CHECKING([clang __sync_bool_compare_and_swap])
41 AC_TRY_COMPILE([#include <stdio.h>],
42 [ unsigned int i = 0; (void)__sync_bool_compare_and_swap(&i, 1, 1);],
44 AC_DEFINE([__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1], [1], [Fake GCC atomic support])
45 AC_DEFINE([__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2], [1], [Fake GCC atomic support])
46 AC_DEFINE([__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4], [1], [Fake GCC atomic support])
47 AC_DEFINE([__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8], [1], [Fake GCC atomic support])
48 AC_MSG_RESULT([yes]) ],
49 [AC_MSG_RESULT([no])])
51 if test `basename $CC` = "gcc"; then
53 AC_MSG_CHECKING([gcc version])
54 gccver=$($CC -dumpversion)
55 gccvermajor=$(echo $gccver | cut -d . -f1)
56 gccverminor=$(echo $gccver | cut -d . -f2)
57 gccvernum=$(expr $gccvermajor "*" 100 + $gccverminor)
58 AC_MSG_RESULT($gccver)
60 if test "$gccvernum" -ge "400"; then
62 CFLAGS="$CFLAGS -Wextra -Werror-implicit-function-declaration"
63 # remove optimization options that break our code
64 # VJ 2010/06/27: no-tree-pre added. It breaks ringbuffers code.
65 CFLAGS="$CFLAGS -fno-tree-pre"
70 CFLAGS="$CFLAGS -Wall -fno-strict-aliasing"
71 CFLAGS="$CFLAGS -Wno-unused-parameter"
72 CFLAGS="$CFLAGS -std=gnu99"
74 # Checks for programs.
82 AC_PATH_PROG(HAVE_PKG_CONFIG, pkg-config, "no")
83 if test "$HAVE_PKG_CONFIG" = "no"; then
85 echo " ERROR! pkg-config not found, go get it "
86 echo " http://pkg-config.freedesktop.org/wiki/ "
87 echo " or install from your distribution "
92 AC_PATH_PROG(HAVE_COCCINELLE_CONFIG, spatch, "no")
93 if test "$HAVE_COCCINELLE_CONFIG" = "no"; then
95 echo " Warning! spatch not found, you will not be "
96 echo " able to run code checking with coccinelle "
97 echo " get it from http://coccinelle.lip6.fr "
98 echo " or install from your distribution "
101 AM_CONDITIONAL([HAVE_COCCINELLE], [test "$HAVE_COCCINELLE_CONFIG" != "no"])
103 AC_PATH_PROG(HAVE_PYTHON_CONFIG, python, "no")
104 if test "$HAVE_PYTHON_CONFIG" = "no"; then
106 echo " Warning! python not found, you will not be "
107 echo " able to install surictasc unix socket client "
113 AM_CONDITIONAL([HAVE_PYTHON], [test "$HAVE_PYTHON_CONFIG" != "no"])
117 # Checks for libraries.
119 # Checks for header files.
120 AC_CHECK_HEADERS([arpa/inet.h assert.h ctype.h errno.h fcntl.h inttypes.h])
121 AC_CHECK_HEADERS([getopt.h])
122 AC_CHECK_HEADERS([limits.h netdb.h netinet/in.h poll.h sched.h signal.h])
123 AC_CHECK_HEADERS([stdarg.h stdint.h stdio.h stdlib.h string.h sys/ioctl.h])
124 AC_CHECK_HEADERS([syslog.h sys/prctl.h sys/socket.h sys/stat.h sys/syscall.h])
125 AC_CHECK_HEADERS([sys/time.h time.h unistd.h])
126 AC_CHECK_HEADERS([sys/ioctl.h linux/if_ether.h linux/if_packet.h linux/filter.h])
128 AC_CHECK_HEADERS([sys/socket.h net/if.h sys/mman.h linux/if_arp.h], [], [],
129 [[#ifdef HAVE_SYS_SOCKET_H
130 #include <sys/types.h>
131 #include <sys/socket.h>
135 AC_CHECK_HEADERS([windows.h winsock2.h ws2tcpip.h], [], [],
138 AC_CHECK_HEADERS([w32api/winbase.h], [], [],
143 # Checks for typedefs, structures, and compiler characteristics.
154 # Checks for library functions.
157 AC_CHECK_FUNCS([gettimeofday memset strcasecmp strchr strdup strerror strncasecmp strtol strtoul memchr])
159 # Add large file support
163 AC_MSG_CHECKING([host os])
165 # If no host os was detected, try with uname
166 if test -z "$host" ; then
169 echo -n "installation for $host OS... "
171 e_magic_file="/usr/share/file/magic"
174 CFLAGS="${CFLAGS} -DOS_FREEBSD"
175 CPPFLAGS="${CPPFLAGS} -I/usr/local/include -I/usr/local/include/libnet11"
176 LDFLAGS="${LDFLAGS} -L/usr/local/lib -L/usr/local/lib/libnet11"
177 e_magic_file="/usr/share/misc/magic"
180 CFLAGS="${CFLAGS} -D__OpenBSD__ -fgnu89-inline"
181 CPPFLAGS="${CPPFLAGS} -I/usr/local/include -I/usr/local/include/libnet-1.1"
182 LDFLAGS="${LDFLAGS} -L/usr/local/lib -I/usr/local/lib/libnet-1.1"
183 e_magic_file="/usr/local/share/misc/magic.mgc"
186 CFLAGS="${CFLAGS} -D__OpenBSD__"
187 CPPFLAGS="${CPPFLAGS} -I/usr/local/include -I/usr/local/include/libnet-1.1"
188 LDFLAGS="${LDFLAGS} -L/usr/local/lib -I/usr/local/lib/libnet-1.1"
189 e_magic_file="/usr/local/share/misc/magic.mgc"
192 CFLAGS="${CFLAGS} -D__OpenBSD__ -fgnu89-inline"
193 CPPFLAGS="${CPPFLAGS} -I/usr/local/include -I/usr/local/include/libnet-1.1"
194 LDFLAGS="${LDFLAGS} -L/usr/local/lib -I/usr/local/lib/libnet-1.1"
195 e_magic_file="/usr/local/share/file/magic.mgc"
198 CFLAGS="${CFLAGS} -DOS_DARWIN"
199 CPPFLAGS="${CPPFLAGS} -I/opt/local/include"
200 LDFLAGS="${LDFLAGS} -L/opt/local/lib"
206 CFLAGS="${CFLAGS} -DOS_WIN32"
207 LDFLAGS="${LDFLAGS} -lws2_32"
214 AC_MSG_WARN([unsupported OS this may or may not work])
219 #Enable support for gcc compile time security options. There is no great way to do detection of valid cflags that I have found
220 #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.
221 #These flags seem to be supported on CentOS 5+, Ubuntu 8.04+, and FedoreCore 11+
222 #Options are taken from https://wiki.ubuntu.com/CompilerFlags
223 AC_ARG_ENABLE(gccprotect,
224 AS_HELP_STRING([--enable-gccprotect], [Detect and use gcc hardening options]),,[enable_gccprotect=no])
226 AS_IF([test "x$enable_gccprotect" = "xyes"], [
227 #buffer overflow protection
228 AC_MSG_CHECKING(for -fstack-protector)
229 TMPCFLAGS="${CFLAGS}"
230 CFLAGS="${CFLAGS} -fstack-protector"
231 AC_TRY_LINK(,,SECCFLAGS="${SECCFLAGS} -fstack-protector"
234 CFLAGS="${TMPCFLAGS}"
236 #compile-time best-practices errors for certain libc functions, provides checks of buffer lengths and memory regions
237 AC_MSG_CHECKING(for -D_FORTIFY_SOURCE=2)
238 TMPCFLAGS="${CFLAGS}"
239 CFLAGS="${CFLAGS} -D_FORTIFY_SOURCE=2"
240 AC_TRY_COMPILE(,,SECCFLAGS="${SECCFLAGS} -D_FORTIFY_SOURCE=2"
243 CFLAGS="${TMPCFLAGS}"
245 #compile-time warnings about misuse of format strings
246 AC_MSG_CHECKING(for -Wformat -Wformat-security)
247 TMPCFLAGS="${CFLAGS}"
248 CFLAGS="${CFLAGS} -Wformat -Wformat-security"
249 AC_TRY_COMPILE(,,SECCFLAGS="${SECCFLAGS} -Wformat -Wformat-security"
252 CFLAGS="${TMPCFLAGS}"
254 #provides a read-only relocation table area in the final ELF
255 AC_MSG_CHECKING(for -z relro)
256 TMPLDFLAGS="${LDFLAGS}"
257 LDFLAGS="${LDFLAGS} -z relro"
258 AC_TRY_LINK(,,SECLDFLAGS="${SECLDFLAGS} -z relro"
261 LDFLAGS="${TMPLDFLAGS}"
263 #forces all relocations to be resolved at run-time
264 AC_MSG_CHECKING(for -z now)
265 TMPLDFLAGS="${LDFLAGS}"
266 LDFLAGS="${LDFLAGS} -z now"
267 AC_TRY_LINK(,,SECLDFLAGS="${SECLDFLAGS} -z now"
270 LDFLAGS="${TMPLDFLAGS}"
272 CFLAGS="${CFLAGS} ${SECCFLAGS}"
273 LDFLAGS="${LDFLAGS} ${SECLDFLAGS}"
276 #enable profile generation
277 AC_ARG_ENABLE(gccprofile,
278 AS_HELP_STRING([--enable-gccprofile], [Enable gcc profile info i.e -pg flag is set]),,[enable_gccprofile=no])
279 AS_IF([test "x$enable_gccprofile" = "xyes"], [
280 CFLAGS="${CFLAGS} -pg"
283 #enable gcc march=native gcc 4.2 or later
284 AC_ARG_ENABLE(gccmarch_native,
285 AS_HELP_STRING([--enable-gccmarch-native], [Enable gcc march=native gcc 4.2 and later only]),,[enable_gccmarch_native=yes])
286 AS_IF([test "x$enable_gccmarch_native" = "xyes"], [
287 if test `basename $CC` = "clang"; then
289 CFLAGS="$CFLAGS -march=native"
290 AC_MSG_CHECKING([checking if $CC supports -march=native])
291 AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([[#include <stdlib.h>]])],
294 CFLAGS="$OFLAGS -march=native"
299 enable_gccmarch_native=no
303 if test `basename $CC` = "gcc"; then
306 if test "$gccvernum" -ge "403"; then
308 CFLAGS="$CFLAGS -march=native"
310 enable_gccmarch_native=no
314 if test "$gccvernum" -ge "402"; then
316 CFLAGS="$CFLAGS -march=native"
325 # enable the running of unit tests
326 AC_ARG_ENABLE(unittests,
327 AS_HELP_STRING([--enable-unittests], [Enable compilation of the unit tests]),,[enable_unittests=no])
328 AS_IF([test "x$enable_unittests" = "xyes"], [
330 CFLAGS="${CFLAGS} -DUNITTESTS"
333 AM_CONDITIONAL([BUILD_UNITTESTS], [test "x$enable_unittests" = "xyes"])
335 # enable workaround for old barnyard2 for unified alert output
336 AC_ARG_ENABLE(old-barnyard2,
337 AS_HELP_STRING([--enable-old-barnyard2], [Use workaround for old barnyard2 in unified2 output]),,[enable_old_barnyard2=no])
338 AS_IF([test "x$enable_old_barnyard2" = "xyes"], [
339 CFLAGS="${CFLAGS} -DHAVE_OLD_BARNYARD2"
342 # enable debug output
344 AS_HELP_STRING([--enable-debug], [Enable debug output]),,[enable_debug=no])
345 AS_IF([test "x$enable_debug" = "xyes"], [
346 CFLAGS="${CFLAGS} -DDEBUG"
349 # enable debug validation functions & macro's output
350 AC_ARG_ENABLE(debug-validation,
351 AS_HELP_STRING([--enable-debug-validation], [Enable (debug) validation code output]),,[enable_debug_validation=no])
352 AS_IF([test "x$enable_debug_validation" = "xyes"], [
353 CFLAGS="${CFLAGS} -DDEBUG_VALIDATION"
357 AC_ARG_ENABLE(profiling,
358 AS_HELP_STRING([--enable-profiling], [Enable performance profiling]),,[enable_profiling=no])
359 AS_IF([test "x$enable_profiling" = "xyes"], [
363 AC_MSG_ERROR([profiling is not supported on OpenBSD])
366 CFLAGS="${CFLAGS} -DPROFILING"
371 # profiling support, locking
372 AC_ARG_ENABLE(profiling-locks,
373 AS_HELP_STRING([--enable-profiling-locks], [Enable performance profiling for locks]),,[enable_profiling_locks=no])
374 AS_IF([test "x$enable_profiling_locks" = "xyes"], [
375 CFLAGS="${CFLAGS} -DPROFILING -DPROFILE_LOCKING"
378 # enable support for IPFW
380 AS_HELP_STRING([--enable-ipfw], [Enable FreeBSD IPFW support for inline IDP]),,[enable_ipfw=no])
381 AS_IF([test "x$enable_ipfw" = "xyes"], [
382 CFLAGS="$CFLAGS -DIPFW"
387 AC_MSG_CHECKING([for Mpipe])
389 [AC_LANG_PROGRAM([[#include <gxio/mpipe.h>]])],
392 AC_DEFINE([HAVE_MPIPE],[1],[mPIPE support is available])
393 LDFLAGS="$LDFLAGS -lgxio -ltmc"
395 [AC_MSG_RESULT([no])])
398 AC_ARG_WITH(libpcre_includes,
399 [ --with-libpcre-includes=DIR libpcre include directory],
400 [with_libpcre_includes="$withval"],[with_libpcre_includes=no])
401 AC_ARG_WITH(libpcre_libraries,
402 [ --with-libpcre-libraries=DIR libpcre library directory],
403 [with_libpcre_libraries="$withval"],[with_libpcre_libraries="no"])
405 if test "$with_libpcre_includes" != "no"; then
406 CPPFLAGS="${CPPFLAGS} -I${with_libpcre_includes}"
408 AC_CHECK_HEADER(pcre.h,,[AC_ERROR(pcre.h not found ...)])
410 if test "$with_libpcre_libraries" != "no"; then
411 LDFLAGS="${LDFLAGS} -L${with_libpcre_libraries}"
414 AC_CHECK_LIB(pcre, pcre_get_substring,, PCRE="no")
415 if test "$PCRE" = "no"; then
417 echo " ERROR! pcre library not found, go get it"
418 echo " from www.pcre.org."
423 # To prevent duping the lib link we reset LIBS after this check. Setting action-if-found to NULL doesn't seem to work
424 # see: http://blog.flameeyes.eu/2008/04/29/i-consider-ac_check_lib-harmful
427 AC_CHECK_LIB(pcre, pcre_dfa_exec,, PCRE="no")
428 if test "$PCRE" = "no"; then
430 echo " ERROR! pcre library was found but version was < 6.0"
431 echo " please upgrade to a newer version of pcre which you can get from"
432 echo " www.pcre.org."
438 AC_TRY_COMPILE([ #include <pcre.h> ],
439 [ int eo = 0; eo |= PCRE_EXTRA_MATCH_LIMIT_RECURSION; ],
440 [ pcre_match_limit_recursion_available=yes ], [:]
442 if test "$pcre_match_limit_recursion_available" != "yes"; then
443 CFLAGS="${CFLAGS} -DNO_PCRE_MATCH_RLIMIT"
445 echo " Warning! pcre extra opt PCRE_EXTRA_MATCH_LIMIT_RECURSION not found"
446 echo " This could lead to potential DoS please upgrade to pcre >= 6.5"
447 echo " Continuing for now...."
448 echo " from www.pcre.org."
452 #enable support for PCRE-jit available since pcre-8.20
453 AC_MSG_CHECKING(for PCRE JIT support)
454 AC_TRY_COMPILE([ #include <pcre.h> ],
457 pcre_config(PCRE_CONFIG_JIT, &jit);
459 [ pcre_jit_available=yes ], [ pcre_jit_available=no ]
462 if test "x$pcre_jit_available" = "xyes"; then
464 AC_DEFINE([PCRE_HAVE_JIT], [1], [Pcre with JIT compiler support enabled])
466 AC_MSG_CHECKING(for PCRE JIT support usability)
467 AC_TRY_COMPILE([ #include <pcre.h> ],
469 const char* regexstr = "(a|b|c|d)";
474 re = pcre_compile(regexstr,0, &error, &err_offset,NULL);
475 extra = pcre_study(re, PCRE_STUDY_JIT_COMPILE, &error);
479 int ret = pcre_fullinfo(re, extra, PCRE_INFO_JIT, &jit);
480 if (ret != 0 || jit != 1)
484 [ pcre_jit_works=yes ], [:]
486 if test "x$pcre_jit_works" != "xyes"; then
489 echo " PCRE JIT support detection worked but testing it failed"
490 echo " something odd is going on, please file a bug report."
501 AC_ARG_WITH(libyaml_includes,
502 [ --with-libyaml-includes=DIR libyaml include directory],
503 [with_libyaml_includes="$withval"],[with_libyaml_includes=no])
504 AC_ARG_WITH(libyaml_libraries,
505 [ --with-libyaml-libraries=DIR libyaml library directory],
506 [with_libyaml_libraries="$withval"],[with_libyaml_libraries="no"])
508 if test "$with_libyaml_includes" != "no"; then
509 CPPFLAGS="${CPPFLAGS} -I${with_libyaml_includes}"
512 AC_CHECK_HEADER(yaml.h,,LIBYAML="no")
514 if test "$with_libyaml_libraries" != "no"; then
515 LDFLAGS="${LDFLAGS} -L${with_libyaml_libraries}"
519 AC_CHECK_LIB(yaml,yaml_parser_initialize,,LIBYAML="no")
521 if test "$LIBYAML" = "no"; then
523 echo " ERROR! libyaml library not found, go get it"
524 echo " from http://pyyaml.org/wiki/LibYAML "
525 echo " or your distribution:"
527 echo " Ubuntu: apt-get install libyaml-dev"
528 echo " Fedora: yum install libyaml-devel"
534 AC_ARG_WITH(libpthread_includes,
535 [ --with-libpthread-includes=DIR libpthread include directory],
536 [with_libpthread_includes="$withval"],[with_libpthread_includes=no])
537 AC_ARG_WITH(libpthread_libraries,
538 [ --with-libpthread-libraries=DIR libpthread library directory],
539 [with_libpthread_libraries="$withval"],[with_libpthread_libraries="no"])
541 if test "$with_libpthread_includes" != "no"; then
542 CPPFLAGS="${CPPFLAGS} -I${with_libpthread_includes}"
545 dnl AC_CHECK_HEADER(pthread.h,,[AC_ERROR(pthread.h not found ...)])
547 if test "$with_libpthread_libraries" != "no"; then
548 LDFLAGS="${LDFLAGS} -L${with_libpthread_libraries}"
552 AC_CHECK_LIB(pthread, pthread_create,, PTHREAD="no")
554 if test "$PTHREAD" = "no"; then
556 echo " ERROR! libpthread library not found, glibc problem?"
563 AC_ARG_WITH(libjansson_includes,
564 [ --with-libjansson-includes=DIR libjansson include directory],
565 [with_libjansson_includes="$withval"],[with_libjansson_includes=no])
566 AC_ARG_WITH(libjansson_libraries,
567 [ --with-libjansson-libraries=DIR libjansson library directory],
568 [with_libjansson_libraries="$withval"],[with_libjansson_libraries="no"])
570 if test "$with_libjansson_includes" != "no"; then
571 CPPFLAGS="${CPPFLAGS} -I${with_libjansson_includes}"
575 enable_unixsocket="no"
577 AC_ARG_ENABLE(unix-socket,
578 AS_HELP_STRING([--enable-unix-socket], [Enable unix socket [default=test]]),[enable_unixsocket="$enableval"],[enable_unixsocket=test])
580 AC_CHECK_HEADER(jansson.h,JANSSON="yes",JANSSON="no")
581 if test "$JANSSON" = "yes"; then
582 if test "$with_libjansson_libraries" != "no"; then
583 LDFLAGS="${LDFLAGS} -L${with_libjansson_libraries}"
586 AC_CHECK_LIB(jansson, json_dump_callback,, JANSSON="no")
588 if test "$JANSSON" = "no"; then
590 echo " Jansson >= 2.2 is required for features like unix socket"
591 echo " Go get it from your distribution of from:"
592 echo " http://www.digip.org/jansson/"
594 if test "x$enable_unixsocket" = "xyes"; then
597 enable_unixsocket="no"
606 if test "x$enable_unixsocket" = "xtest"; then
607 enable_unixsocket="yes"
613 if test "x$enable_unixsocket" = "xyes"; then
615 echo " Jansson >= 2.2 is required for features like unix socket"
616 echo " Go get it from your distribution of from:"
617 echo " http://www.digip.org/jansson/"
621 enable_unixsocket="no"
624 AS_IF([test "x$enable_unixsocket" = "xyes"], [AC_DEFINE([BUILD_UNIX_SOCKET], [1], [Unix socket support enabled])])
626 #enable support for NFQUEUE
627 AC_ARG_ENABLE(nfqueue,
628 AS_HELP_STRING([--enable-nfqueue], [Enable NFQUEUE support for inline IDP]),,[enable_nfqueue=no])
629 AS_IF([test "x$enable_nfqueue" = "xyes"], [
630 CFLAGS="$CFLAGS -DNFQ"
637 AC_ARG_WITH(libnfnetlink_includes,
638 [ --with-libnfnetlink-includes=DIR libnfnetlink include directory],
639 [with_libnfnetlink_includes="$withval"],[with_libnfnetlink_includes=no])
640 AC_ARG_WITH(libnfnetlink_libraries,
641 [ --with-libnfnetlink-libraries=DIR libnfnetlink library directory],
642 [with_libnfnetlink_libraries="$withval"],[with_libnfnetlink_libraries="no"])
644 if test "$with_libnfnetlink_includes" != "no"; then
645 CPPFLAGS="${CPPFLAGS} -I${with_libnfnetlink_includes}"
648 AC_CHECK_HEADER(libnfnetlink/libnfnetlink.h,,[AC_ERROR(libnfnetlink.h not found ...)])
650 if test "$with_libnfnetlink_libraries" != "no"; then
651 LDFLAGS="${LDFLAGS} -L${with_libnfnetlink_libraries}"
655 AC_CHECK_LIB(nfnetlink, nfnl_fd,, NFNL="no")
657 if test "$NFNL" = "no"; then
659 echo " ERROR! nfnetlink library not found, go get it"
660 echo " from www.netfilter.org."
661 echo " we automatically append libnetfilter_queue/ when searching"
662 echo " for headers etc. when the --with-libnfnetlink-inlcudes directive"
671 AC_ARG_WITH(libnetfilter_queue_includes,
672 [ --with-libnetfilter_queue-includes=DIR libnetfilter_queue include directory],
673 [with_libnetfilter_queue_includes="$withval"],[with_libnetfilter_queue_includes=no])
674 AC_ARG_WITH(libnetfilter_queue_libraries,
675 [ --with-libnetfilter_queue-libraries=DIR libnetfilter_queue library directory],
676 [with_libnetfilter_queue_libraries="$withval"],[with_libnetfilter_queue_libraries="no"])
678 if test "$with_libnetfilter_queue_includes" != "no"; then
679 CPPFLAGS="${CPPFLAGS} -I${with_libnetfilter_queue_includes}"
682 AC_CHECK_HEADER(libnetfilter_queue/libnetfilter_queue.h,,[AC_ERROR(libnetfilter_queue/libnetfilter_queue.h not found ...)])
684 if test "$with_libnetfilter_queue_libraries" != "no"; then
685 LDFLAGS="${LDFLAGS} -L${with_libnetfilter_queue_libraries}"
688 #LDFLAGS="${LDFLAGS} -lnetfilter_queue"
693 AC_CHECK_LIB(netfilter_queue, nfq_open,, NFQ="no",-lws2_32)
695 AC_ARG_WITH(netfilterforwin_includes,
696 [ --with-netfilterforwin-includes=DIR netfilterforwin include directory],
697 [with_netfilterforwin_includes="$withval"],[with_netfilterforwin_includes=no])
699 if test "$with_netfilterforwin_includes" != "no"; then
700 CPPFLAGS="${CPPFLAGS} -I${with_netfilterforwin_includes}"
702 CPPFLAGS="${CPPFLAGS} -I../../netfilterforwin"
706 AC_CHECK_LIB(netfilter_queue, nfq_open,, NFQ="no",)
707 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])
708 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])
709 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])
710 AC_CHECK_LIB([netfilter_queue], [nfq_set_verdict_batch],AC_DEFINE_UNQUOTED([HAVE_NFQ_SET_VERDICT_BATCH],[1],[Found nfq_set_verdict_batch function in netfilter_queue]) ,,[-lnfnetlink])
712 # check if the argument to nfq_get_payload is signed or unsigned
713 AC_MSG_CHECKING([for signed nfq_get_payload payload argument])
714 STORECFLAGS="${CFLAGS}"
715 if test `basename $CC` = "clang"; then
716 CFLAGS="${CFLAGS} -Werror=incompatible-pointer-types"
718 CFLAGS="${CFLAGS} -Werror"
724 #include <libnetfilter_queue/libnetfilter_queue.h>
728 nfq_get_payload(NULL, &pktdata);
730 [libnetfilter_queue_nfq_get_payload_signed="yes"],
731 [libnetfilter_queue_nfq_get_payload_signed="no"])
732 AC_MSG_RESULT($libnetfilter_queue_nfq_get_payload_signed)
733 if test "x$libnetfilter_queue_nfq_get_payload_signed" = "xyes"; then
734 AC_DEFINE([NFQ_GET_PAYLOAD_SIGNED], [1], [For signed version of nfq_get_payload])
736 CFLAGS="${STORECFLAGS}"
740 if test "$NFQ" = "no"; then
742 echo " ERROR! libnetfilter_queue library not found, go get it"
743 echo " from www.netfilter.org."
744 echo " we automatically append libnetfilter_queue/ when searching"
745 echo " for headers etc. when the --with-libnfq-includes directive"
753 AC_ARG_ENABLE(prelude,
754 AS_HELP_STRING([--enable-prelude], [Enable Prelude support for alerts]),,[enable_prelude=no])
755 AS_IF([test "x$enable_prelude" = "xyes"], [
756 CFLAGS="$CFLAGS -DPRELUDE"
757 AM_PATH_LIBPRELUDE(0.9.9, , AC_MSG_ERROR(Cannot find libprelude: Is libprelude-config in the path?), no)
758 if test "x${LIBPRELUDE_CFLAGS}" != "x"; then
759 CPPFLAGS="${CPPFLAGS} ${LIBPRELUDE_CFLAGS}"
762 if test "x${LIBPRELUDE_LDFLAGS}" != "x"; then
763 LDFLAGS="${LDFLAGS} ${LIBPRELUDE_LDFLAGS}"
766 if test "x${LIBPRELUDE_LIBS}" != "x"; then
767 LDFLAGS="${LDFLAGS} ${LIBPRELUDE_LIBS}"
772 AC_ARG_WITH(libnet_includes,
773 [ --with-libnet-includes=DIR libnet include directory],
774 [with_libnet_includes="$withval"],[with_libnet_includes="no"])
776 AC_ARG_WITH(libnet_libraries,
777 [ --with-libnet-libraries=DIR libnet library directory],
778 [with_libnet_libraries="$withval"],[with_libnet_libraries="no"])
780 if test "x$with_libnet_includes" != "xno"; then
781 CPPFLAGS="${CPPFLAGS} -I${with_libnet_includes}"
782 libnet_dir="${with_libnet_includes}"
784 libnet_dir="/usr/include /usr/local/include /usr/local/include/libnet11 /opt/local/include /usr/local/include/libnet-1.1"
787 if test "x$with_libnet_libraries" != "xno"; then
788 LDFLAGS="${LDFLAGS} -L${with_libnet_libraries}"
791 LIBNET_DETECT_FAIL="no"
794 for i in $libnet_dir; do
795 if test -r "$i/libnet.h"; then
800 AC_MSG_CHECKING(for libnet.h version 1.1.x)
801 if test "$LIBNET_INC_DIR" != ""; then
802 if eval "grep LIBNET_VERSION $LIBNET_INC_DIR/libnet.h | grep -v 1.1 >/dev/null"; then
804 LIBNET_DETECT_FAIL="yes"
805 LIBNET_FAIL_WARN($libnet_dir)
810 #CentOS, Fedora, Ubuntu-LTS, Ubuntu all set defines to the same values. libnet-config seems
811 #to have been depreciated but all distro's seem to include it as part of the package.
812 if test "$LIBNET_DETECT_FAIL" = "no"; then
814 AC_CHECK_LIB(net, libnet_write,, LLIBNET="no")
815 if test "$LLIBNET" != "no"; then
816 CFLAGS="${CFLAGS} -DHAVE_LIBNET11 -D_BSD_SOURCE -D__BSD_SOURCE -D__FAVOR_BSD -DHAVE_NET_ETHERNET_H"
818 #if we displayed a warning already no reason to do it again.
819 if test "$LIBNET_DETECT_FAIL" = "no"; then
820 LIBNET_DETECT_FAIL="yes"
821 LIBNET_FAIL_WARN($libnet_dir)
825 # see if we have the patched libnet 1.1
826 # http://www.inliniac.net/blog/2007/10/16/libnet-11-ipv6-fixes-and-additions.html
828 # To prevent duping the lib link we reset LIBS after this check. Setting action-if-found to NULL doesn't seem to work
829 # see: http://blog.flameeyes.eu/2008/04/29/i-consider-ac_check_lib-harmful
830 if test "$LIBNET_DETECT_FAIL" = "no"; then
833 AC_CHECK_LIB(net, libnet_build_icmpv6_unreach,, LLIBNET="no")
834 if test "$LLIBNET" != "no"; then
835 CFLAGS="$CFLAGS -DHAVE_LIBNET_ICMPV6_UNREACH"
841 LIBNET_DETECT_FAIL="yes"
842 LIBNET_FAIL_WARN($libnet_dir)
844 # libpfring (currently only supported for libpcap enabled pfring)
845 # Error on the side of caution. If libpfring enabled pcap is being used and we don't link against -lpfring compilation will fail.
846 AC_ARG_ENABLE(pfring,
847 AS_HELP_STRING([--enable-pfring], [Enable Native PF_RING support]),,[enable_pfring=no])
848 AS_IF([test "x$enable_pfring" = "xyes"], [
849 CFLAGS="$CFLAGS -DHAVE_PFRING"
851 #We have to set CFLAGS for AC_TRY_COMPILE as it doesn't pay attention to CPPFLAGS
852 AC_ARG_WITH(libpfring_includes,
853 [ --with-libpfring-includes=DIR libpfring include directory],
854 [with_libpfring_includes="$withval"],[with_libpfring_includes=no])
855 AC_ARG_WITH(libpfring_libraries,
856 [ --with-libpfring-libraries=DIR libpfring library directory],
857 [with_libpfring_libraries="$withval"],[with_libpfring_libraries="no"])
859 if test "$with_libpfring_includes" != "no"; then
860 CPPFLAGS="${CPPFLAGS} -I${with_libpfring_includes}"
863 if test "$with_libpfring_libraries" != "no"; then
864 LDFLAGS="${LDFLAGS} -L${with_libpfring_libraries}"
868 AC_CHECK_LIB(pfring, pfring_open,, LIBPFRING="no", [-lpcap])
869 if test "$LIBPFRING" = "no"; then
870 if test "x$enable_pfring" = "xyes"; then
872 echo " ERROR! --enable-pfring was passed but the library was not found or version is >4, go get it"
873 echo " from http://www.ntop.org/PF_RING.html"
879 LIBPFRING_ENABLE_RING=""
880 AC_CHECK_LIB(pfring, pfring_enable_ring,, LIBPFRING_ENABLE_RING="no", [-lpcap])
881 if test "$LIBPFRING_ENABLE_RING" != "no"; then
882 AC_DEFINE([HAVE_PFRING_ENABLE],[1],[PF_RING pfring_enable_ring is available])
885 LIBPFRING_CLUSTER_TYPE=""
886 AC_CHECK_LIB(pfring, pfring_set_cluster,
887 , LIBPFRING_CLUSTER_TYPE="no", [-lpcap])
888 if test "$LIBPFRING_CLUSTER_TYPE" != "no"; then
889 AC_DEFINE([HAVE_PFRING_CLUSTER_TYPE],[1],[PF_RING pfring_set_cluster is available])
892 LIBPFRING_BPF_FILTER=""
893 AC_CHECK_LIB(pfring, pfring_set_bpf_filter,
894 , LIBPFRING_BPF_FILTER="no", [-lpcap])
895 LIBPFRING_REMOVE_BPF_FILTER=""
896 AC_CHECK_LIB(pfring, pfring_remove_bpf_filter,
897 , LIBPFRING_REMOVE_BPF_FILTER="no", [-lpcap])
898 if test "$LIBPFRING_BPF_FILTER" != "no" -a "$LIBPFRING_REMOVE_BPF_FILTER" != "no"; then
899 AC_DEFINE([HAVE_PFRING_SET_BPF_FILTER],[1],[PF_RING pfring_set_bpf_filter is available])
902 STORE_CFLAGS="${CFLAGS}"
903 CFLAGS="${CFLAGS} -Werror"
904 AC_MSG_CHECKING([if pfring_recv expects u_char**])
910 pfring_recv(NULL, &buffer, 0, NULL, 1);
912 [ pfring_recv_uchar_buff=yes ], [:])
914 CFLAGS="${STORE_CFLAGS}"
916 if test "$pfring_recv_uchar_buff" = "yes"; then
917 AC_DEFINE([HAVE_PFRING_RECV_UCHAR],[1],[PF_RING pfring_recv buffer is u_char**])
923 # check if the argument to nfq_get_payload is signed or unsigned
924 AC_MSG_CHECKING([for post 5.4.0 pfring_open function])
925 STORECFLAGS="${CFLAGS}"
926 CFLAGS="${CFLAGS} -Werror"
933 pfring_open(NULL, 0, 0);
935 [pfring_new_open="yes"],
936 [pfring_new_open="no"])
937 AC_MSG_RESULT($pfring_new_open)
938 if test "x$pfring_new_open" = "xyes"; then
939 AC_DEFINE([HAVE_PFRING_OPEN_NEW], [1], [For post 5.4.0 version of pfring_open])
941 CFLAGS="${STORECFLAGS}"
947 AC_ARG_WITH(libpcap_includes,
948 [ --with-libpcap-includes=DIR libpcap include directory],
949 [with_libpcap_includes="$withval"],[with_libpcap_includes=no])
950 AC_ARG_WITH(libpcap_libraries,
951 [ --with-libpcap-libraries=DIR libpcap library directory],
952 [with_libpcap_libraries="$withval"],[with_libpcap_libraries="no"])
954 if test "$with_libpcap_includes" != "no"; then
955 CPPFLAGS="${CPPFLAGS} -I${with_libpcap_includes}"
958 AC_CHECK_HEADER(pcap.h,,[AC_ERROR(pcap.h not found ...)])
960 if test "$with_libpcap_libraries" != "no"; then
961 LDFLAGS="${LDFLAGS} -L${with_libpcap_libraries}"
963 AC_CHECK_HEADERS([pcap.h pcap/pcap.h pcap/bpf.h])
966 AC_CHECK_LIB(pcap, pcap_open_live,, LIBPCAP="no", [-lpthread])
967 if test "$LIBPCAP" = "no"; then
969 echo " ERROR! libpcap library not found, go get it"
970 echo " from http://www.tcpdump.org or your distribution:"
972 echo " Ubuntu: apt-get install libpcap-dev"
973 echo " Fedora: yum install libpcap-devel"
978 # pcap_activate and pcap_create only exists in libpcap >= 1.0
980 #To prevent duping the lib link we reset LIBS after this check. Setting action-if-found to NULL doesn't seem to work
981 #see: http://blog.flameeyes.eu/2008/04/29/i-consider-ac_check_lib-harmful
983 AC_CHECK_LIB(pcap, pcap_activate,, LPCAPVTEST="no")
984 if test "$LPCAPVTEST" != "no"; then
985 AC_PATH_PROG(HAVE_PCAP_CONFIG, pcap-config, "no")
986 if test "$HAVE_PCAP_CONFIG" = "no"; then
987 CFLAGS="${CFLAGS} -DLIBPCAP_VERSION_MAJOR=1"
989 CFLAGS="${CFLAGS} `pcap-config --defines` `pcap-config --cflags` -DLIBPCAP_VERSION_MAJOR=1"
992 CFLAGS="${CFLAGS} -DLIBPCAP_VERSION_MAJOR=0"
996 #Appears as if pcap_set_buffer_size is linux only?
998 #To prevent duping the lib link we reset LIBS after this check. Setting action-if-found to NULL doesn't seem to work
999 #see: http://blog.flameeyes.eu/2008/04/29/i-consider-ac_check_lib-harmful
1001 AC_CHECK_LIB(pcap, pcap_set_buffer_size,, LPCAPSBUFF="no")
1002 if test "$LPCAPSBUFF" != "no"; then
1003 CFLAGS="${CFLAGS} -DHAVE_PCAP_SET_BUFF"
1008 AC_ARG_ENABLE(af-packet,
1009 AS_HELP_STRING([--enable-af-packet], [Enable AF_PACKET support [default=yes]]),
1010 ,[enable_af_packet=yes])
1011 AS_IF([test "x$enable_af_packet" = "xyes"], [
1012 AC_CHECK_DECL([TPACKET_V2],
1013 AC_DEFINE([HAVE_AF_PACKET],[1],[AF_PACKET support is available]),
1014 [enable_af_packet="no"],
1015 [[#include <sys/socket.h>
1016 #include <linux/if_packet.h>]])
1017 AC_CHECK_DECL([PACKET_FANOUT],
1018 AC_DEFINE([HAVE_PACKET_FANOUT],[1],[Packet fanout support is available]),
1020 [[#include <linux/if_packet.h>]])
1025 AC_ARG_ENABLE(non-bundled-htp,
1026 AS_HELP_STRING([--enable-non-bundled-htp], [Enable the use of an already installed version of htp]),,[enable_non_bundled_htp=no])
1027 AS_IF([test "x$enable_non_bundled_htp" = "xyes"], [
1028 AC_ARG_WITH(libhtp_includes,
1029 [ --with-libhtp-includes=DIR libhtp include directory],
1030 [with_libhtp_includes="$withval"],[with_libhtp_includes=no])
1031 AC_ARG_WITH(libhtp_libraries,
1032 [ --with-libhtp-libraries=DIR libhtp library directory],
1033 [with_libhtp_libraries="$withval"],[with_libhtp_libraries="no"])
1035 if test "$with_libhtp_includes" != "no"; then
1036 CPPFLAGS="${CPPFLAGS} -I${with_libhtp_includes}"
1039 if test "$with_libhtp_libraries" != "no"; then
1040 LDFLAGS="${LDFLAGS} -L${with_libhtp_libraries}"
1043 AC_CHECK_HEADER(htp/htp.h,,[AC_ERROR(htp/htp.h not found ...)])
1046 AC_CHECK_LIB(htp, htp_conn_create,, LIBHTP="no")
1047 if test "$LIBHTP" = "no"; then
1049 echo " ERROR! libhtp library not found"
1053 PKG_CHECK_MODULES(LIBHTPMINVERSION, htp >= 0.2.3,[libhtp_minver_found="yes"],[libhtp_minver_found="no"])
1054 if test "$libhtp_minver_found" = "no"; then
1056 echo " ERROR! libhtp was found but is not the minimum version required >=0.2.3"
1060 PKG_CHECK_MODULES(LIBHTPMAXVERSION, htp <= 0.3.0,[libhtp_maxver_found="yes"],[libhtp_maxver_found="no"])
1061 if test "$libhtp_maxver_found" = "no"; then
1063 echo " ERROR! libhtp 0.3.x was found but only 0.2.x is supported"
1068 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])
1069 # check for htp_tx_get_response_headers_raw
1070 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])
1071 AC_CHECK_LIB([htp], [htp_decode_query_inplace],AC_DEFINE_UNQUOTED([HAVE_HTP_DECODE_QUERY_INPLACE],[1],[Found htp_decode_query_inplace function in libhtp]) ,,[-lhtp])
1072 AC_EGREP_HEADER(htp_config_set_path_decode_u_encoding, htp/htp.h, AC_DEFINE_UNQUOTED([HAVE_HTP_SET_PATH_DECODE_U_ENCODING],[1],[Found usable htp_config_set_path_decode_u_encoding function in libhtp]) )
1075 # even if we are using an installed htp lib we still need to gen Makefiles inside of htp
1076 AC_CONFIG_SUBDIRS([libhtp])
1077 AM_CONDITIONAL([BUILD_LIBHTP], [test "x$enable_non_bundled_htp" = "xno"])
1078 AS_IF([test "x$enable_non_bundled_htp" = "xno"], [
1079 AC_DEFINE_UNQUOTED([HAVE_HTP_URI_NORMALIZE_HOOK],[1],[Assuming htp_config_register_request_uri_normalize function in bundled libhtp])
1080 AC_DEFINE_UNQUOTED([HAVE_HTP_TX_GET_RESPONSE_HEADERS_RAW],[1],[Assuming htp_tx_get_response_headers_raw function in bundled libhtp])
1081 AC_DEFINE_UNQUOTED([HAVE_HTP_DECODE_QUERY_INPLACE],[1],[Assuming htp_decode_query_inplace function in bundled libhtp])
1085 # enable CUDA output
1087 AS_HELP_STRING([--enable-cuda], [Enable experimental CUDA pattern matching]),,[enable_cuda=no])
1088 AS_IF([test "x$enable_cuda" = "xyes"], [
1089 AC_ARG_WITH(cuda_includes,
1090 [ --with-cuda-includes=DIR cuda include directory],
1091 [with_cuda_includes="$withval"],[with_cuda_includes=no])
1092 AC_ARG_WITH(cuda_libraries,
1093 [ --with-cuda-libraries=DIR cuda library directory],
1094 [with_cuda_libraries="$withval"],[with_cuda_libraries="no"])
1095 AC_ARG_WITH(cuda_nvcc,
1096 [ --with-cuda-nvcc=DIR cuda nvcc compiler directory],
1097 [with_cuda_nvcc="$withval"],[with_cuda_nvcc=no])
1099 CFLAGS="${CFLAGS} -D__SC_CUDA_SUPPORT__"
1101 if test "$with_cuda_includes" != "no"; then
1102 CPPFLAGS="${CPPFLAGS} -I${with_cuda_includes}"
1104 CPPFLAGS="${CPPFLAGS} -I/usr/local/cuda/include"
1107 if test "$with_cuda_libraries" != "no"; then
1108 LDFLAGS="${LDFLAGS} -L${with_cuda_libraries}"
1111 if test "$with_cuda_nvcc" != "no"; then
1112 NVCC_DIR="${with_cuda_nvcc}"
1114 NVCC_DIR="/usr/local/cuda/bin"
1117 AC_CHECK_HEADER(cuda.h,,[AC_ERROR(cuda.h not found ...)])
1120 AC_CHECK_LIB(cuda, cuArray3DCreate,, LIBCUDA="no")
1121 if test "$LIBCUDA" = "no"; then
1123 echo " ERROR! libcuda library not found"
1128 AC_PATH_PROG([NVCC], [nvcc], no, [$PATH:$NVCC_DIR])
1129 if test "x$NVCC" = "xno"; then
1131 echo " ERROR! CUDA nvcc compiler not found: use --with-cuda-nvcc=DIR"
1136 AC_MSG_CHECKING(for nvcc version)
1137 NVCCVER=`$NVCC --version | grep "release" | sed 's/.*release \(@<:@0-9@:>@\)\.\(@<:@0-9@:>@\).*/\1\2/'`
1138 AC_MSG_RESULT($NVCCVER)
1139 if test "$NVCCVER" -lt 31; then
1141 echo " Warning! Your CUDA nvcc version might be outdated."
1142 echo " If compilation fails try the latest CUDA toolkit from"
1143 echo " www.nvidia.com/object/cuda_develop.html"
1147 AM_PATH_PYTHON(,, no)
1148 if test "x$PYTHON" = "xno"; then
1150 echo " ERROR! Compiling CUDA kernels requires python."
1155 AM_CONDITIONAL([BUILD_CUDA], [test "x$enable_cuda" = "xyes"])
1158 # Check for libcap-ng
1161 AC_ARG_WITH(libcap_ng_includes,
1162 [ --with-libcap_ng-includes=DIR libcap_ng include directory],
1163 [with_libcap-ng_includes="$withval"],[with_libcap_ng_includes=no])
1164 AC_ARG_WITH(libcap_ng_libraries,
1165 [ --with-libcap_ng-libraries=DIR libcap_ng library directory],
1166 [with_libcap_ng_libraries="$withval"],[with_libcap_ng_libraries="no"])
1168 if test "$with_libcap_ng_includes" != "no"; then
1169 CPPFLAGS="${CPPFLAGS} -I${with_libcap_ng_includes}"
1172 if test "$with_libcap_ng_libraries" != "no"; then
1173 LDFLAGS="${LDFLAGS} -L${with_libcap_ng_libraries}"
1176 AC_CHECK_HEADER(cap-ng.h,,LIBCAP_NG="no")
1177 if test "$LIBCAP_NG" != "no"; then
1179 AC_CHECK_LIB(cap-ng,capng_clear,,LIBCAP_NG="no")
1182 if test "$LIBCAP_NG" != "no"; then
1183 CFLAGS="${CFLAGS} -DHAVE_LIBCAP_NG"
1186 if test "$LIBCAP_NG" = "no"; then
1188 echo " WARNING! libcap-ng library not found, go get it"
1189 echo " from http://people.redhat.com/sgrubb/libcap-ng/"
1190 echo " or your distribution:"
1192 echo " Ubuntu: apt-get install libcap-ng-dev"
1193 echo " Fedora: yum install libcap-ng-devel"
1195 echo " Suricata will be built without support for dropping privs."
1201 # Check for DAG support.
1203 AS_HELP_STRING([--enable-dag],[Enable DAG capture]),
1206 AC_ARG_WITH(dag_includes,
1207 [ --with-dag-includes=DIR dagapi include directory],
1208 [with_dag_includes="$withval"],[with_dag_includes="no"])
1209 AC_ARG_WITH(dag_libraries,
1210 [ --with-dag-libraries=DIR dagapi library directory],
1211 [with_dag_libraries="$withval"],[with_dag_libraries="no"])
1213 if test "$enable_dag" = "yes"; then
1215 if test "$with_dag_includes" != "no"; then
1216 CPPFLAGS="${CPPFLAGS} -I${with_dag_includes}"
1219 if test "$with_dag_libraries" != "no"; then
1220 LDFLAGS="${LDFLAGS} -L${with_dag_libraries}"
1223 AC_CHECK_HEADER(dagapi.h,DAG="yes",DAG="no")
1224 if test "$DAG" != "no"; then
1226 AC_CHECK_LIB(dag,dag_open,,DAG="no",)
1229 if test "$DAG" != "no"; then
1230 CFLAGS="${CFLAGS} -DHAVE_DAG"
1233 if test "$DAG" = "no"; then
1235 echo " ERROR! libdag library not found"
1244 # Try pkg-config first:
1245 PKG_CHECK_MODULES([libnspr], nspr,, [with_pkgconfig_nspr=no])
1246 if test "$with_pkgconfig_nspr" != "no"; then
1247 CPPFLAGS="${CPPFLAGS} ${libnspr_CFLAGS}"
1248 LIBS="${LIBS} ${libnspr_LIBS}"
1251 AC_ARG_WITH(libnspr_includes,
1252 [ --with-libnspr-includes=DIR libnspr include directory],
1253 [with_libnspr_includes="$withval"],[with_libnspr_includes=no])
1254 AC_ARG_WITH(libnspr_libraries,
1255 [ --with-libnspr-libraries=DIR libnspr library directory],
1256 [with_libnspr_libraries="$withval"],[with_libnspr_libraries="no"])
1258 if test "$with_libnspr_includes" != "no"; then
1259 CPPFLAGS="${CPPFLAGS} -I${with_libnspr_includes}"
1262 AC_CHECK_HEADER(nspr.h,NSPR="yes",NSPR="no")
1263 if test "$NSPR" = "yes"; then
1264 if test "$with_libnspr_libraries" != "no"; then
1265 LDFLAGS="${LDFLAGS} -L${with_libnspr_libraries}"
1268 AC_CHECK_LIB(nspr4, PR_GetCurrentThread,, NSPR="no")
1270 if test "$NSPR" = "no"; then
1272 echo " ERROR! libnspr library not found, go get it"
1273 echo " from Mozilla or your distribution:"
1275 echo " Ubuntu: apt-get install libnspr4-dev"
1276 echo " Fedora: yum install nspr-devel"
1286 # Try pkg-config first:
1287 PKG_CHECK_MODULES([libnss], nss,, [with_pkgconfig_nss=no])
1288 if test "$with_pkgconfig_nss" != "no"; then
1289 CPPFLAGS="${CPPFLAGS} ${libnss_CFLAGS}"
1290 LIBS="${LIBS} ${libnss_LIBS}"
1293 AC_ARG_WITH(libnss_includes,
1294 [ --with-libnss-includes=DIR libnss include directory],
1295 [with_libnss_includes="$withval"],[with_libnss_includes=no])
1296 AC_ARG_WITH(libnss_libraries,
1297 [ --with-libnss-libraries=DIR libnss library directory],
1298 [with_libnss_libraries="$withval"],[with_libnss_libraries="no"])
1300 if test "$with_libnss_includes" != "no"; then
1301 CPPFLAGS="${CPPFLAGS} -I${with_libnss_includes}"
1304 AC_CHECK_HEADER(sechash.h,NSS="yes",NSS="no")
1305 if test "$NSS" = "yes"; then
1306 if test "$with_libnss_libraries" != "no"; then
1307 LDFLAGS="${LDFLAGS} -L${with_libnss_libraries}"
1310 AC_CHECK_LIB(nss3, HASH_Begin,, NSS="no")
1312 if test "$NSS" = "no"; then
1314 echo " ERROR! libnss library not found, go get it"
1315 echo " from Mozilla or your distribution:"
1317 echo " Ubuntu: apt-get install libnss3-dev"
1318 echo " Fedora: yum install nss-devel"
1323 AC_DEFINE([HAVE_NSS],[1],[libnss available for md5])
1328 AC_ARG_WITH(libmagic_includes,
1329 [ --with-libmagic-includes=DIR libmagic include directory],
1330 [with_libmagic_includes="$withval"],[with_libmagic_includes=no])
1331 AC_ARG_WITH(libmagic_libraries,
1332 [ --with-libmagic-libraries=DIR libmagic library directory],
1333 [with_libmagic_libraries="$withval"],[with_libmagic_libraries="no"])
1335 if test "$with_libmagic_includes" != "no"; then
1336 CPPFLAGS="${CPPFLAGS} -I${with_libmagic_includes}"
1339 AC_CHECK_HEADER(magic.h,,[AC_ERROR(magic.h not found ...)])
1341 if test "$with_libmagic_libraries" != "no"; then
1342 LDFLAGS="${LDFLAGS} -L${with_libmagic_libraries}"
1346 AC_CHECK_LIB(magic, magic_open,, MAGIC="no")
1348 if test "$MAGIC" = "no"; then
1350 echo " ERROR! magic library not found, go get it"
1351 echo " from http://www.darwinsys.com/file/ or your distribution:"
1353 echo " Ubuntu: apt-get install libmagic-dev"
1354 echo " Fedora: yum install file-devel"
1359 # Napatech - Using the 3GD API
1360 AC_ARG_ENABLE(napatech,
1361 AS_HELP_STRING([--enable-napatech],[Enabled Napatech Devices]),
1362 [ enable_napatech=yes ],
1363 [ enable_napatech=no])
1364 AC_ARG_WITH(napatech_includes,
1365 [ --with-napatech-includes=DIR napatech include directory],
1366 [with_napatech_includes="$withval"],[with_napatech_includes="/opt/napatech3/include"])
1367 AC_ARG_WITH(napatech_libraries,
1368 [ --with-napatech-libraries=DIR napatech library directory],
1369 [with_napatech_libraries="$withval"],[with_napatech_libraries="/opt/napatech3/lib"])
1371 if test "$enable_napatech" = "yes"; then
1372 CPPFLAGS="${CPPFLAGS} -I${with_napatech_includes}"
1373 LDFLAGS="${LDFLAGS} -L${with_napatech_libraries} -lntapi"
1374 AC_CHECK_HEADER(nt.h,NAPATECH="yes",NAPATECH="no")
1375 if test "$NAPATECH" != "no"; then
1377 AC_CHECK_LIB(ntapi, NT_Init,NAPATECH="yes",NAPATECH="no")
1380 if test "$NAPATECH" != "no"; then
1381 CFLAGS="${CFLAGS} -DHAVE_NAPATECH"
1384 if test "$NAPATECH" = "no"; then
1386 echo " ERROR! libntapi library not found"
1393 AC_ARG_ENABLE(luajit,
1394 AS_HELP_STRING([--enable-luajit],[Enable Luajit support]),
1395 [ enable_luajit="yes"],
1396 [ enable_luajit="no"])
1397 AC_ARG_WITH(libluajit_includes,
1398 [ --with-libluajit-includes=DIR libluajit include directory],
1399 [with_libluajit_includes="$withval"],[with_libluajit_includes="no"])
1400 AC_ARG_WITH(libluajit_libraries,
1401 [ --with-libluajit-libraries=DIR libluajit library directory],
1402 [with_libluajit_libraries="$withval"],[with_libluajit_libraries="no"])
1404 if test "$enable_luajit" = "yes"; then
1405 if test "$with_libluajit_includes" != "no"; then
1406 CPPFLAGS="${CPPFLAGS} -I${with_libluajit_includes}"
1408 PKG_CHECK_MODULES([LUAJIT], [luajit], , LUAJIT="no")
1409 CPPFLAGS="${CPPFLAGS} ${LUAJIT_CFLAGS}"
1412 AC_CHECK_HEADER(lualib.h,LUAJIT="yes",LUAJIT="no")
1413 if test "$LUAJIT" = "yes"; then
1414 if test "$with_libluajit_libraries" != "no"; then
1415 LDFLAGS="${LDFLAGS} -L${with_libluajit_libraries}"
1417 PKG_CHECK_MODULES([LUAJIT], [luajit])
1418 LDFLAGS="${LDFLAGS} ${LUAJIT_LIBS}"
1421 AC_CHECK_LIB(luajit-5.1, luaL_openlibs,, LUAJIT="no")
1423 if test "$LUAJIT" = "no"; then
1425 echo " ERROR! libluajit library not found, go get it"
1426 echo " from http://luajit.org/index.html or your distribution:"
1428 echo " Ubuntu: apt-get install libluajit-5.1-dev"
1430 echo " If you installed software in a non-standard prefix"
1431 echo " consider adjusting the PKG_CONFIG_PATH environment variable"
1432 echo " or use --with-libluajit-libraries configure option."
1437 AC_DEFINE([HAVE_LUAJIT],[1],[libluajit available])
1441 echo " ERROR! libluajit headers not found, go get them"
1442 echo " from http://luajit.org/index.html or your distribution:"
1444 echo " Ubuntu: apt-get install libluajit-5.1-dev"
1446 echo " If you installed software in a non-standard prefix"
1447 echo " consider adjusting the PKG_CONFIG_PATH environment variable"
1448 echo " or use --with-libluajit-includes and --with-libluajit-libraries"
1449 echo " configure option."
1456 AC_ARG_ENABLE(geoip,
1457 AS_HELP_STRING([--enable-geoip],[Enable GeoIP support]),
1458 [ enable_geoip="yes"],
1459 [ enable_geoip="no"])
1460 AC_ARG_WITH(libgeoip_includes,
1461 [ --with-libgeoip-includes=DIR libgeoip include directory],
1462 [with_libgeoip_includes="$withval"],[with_libgeoip_includes="no"])
1463 AC_ARG_WITH(libgeoip_libraries,
1464 [ --with-libgeoip-libraries=DIR libgeoip library directory],
1465 [with_libgeoip_libraries="$withval"],[with_libgeoip_libraries="no"])
1467 if test "$enable_geoip" = "yes"; then
1468 if test "$with_libgeoip_includes" != "no"; then
1469 CPPFLAGS="${CPPFLAGS} -I${with_libgeoip_includes}"
1472 AC_CHECK_HEADER(GeoIP.h,GEOIP="yes",GEOIP="no")
1473 if test "$GEOIP" = "yes"; then
1474 if test "$with_libgeoip_libraries" != "no"; then
1475 LDFLAGS="${LDFLAGS} -L${with_libgeoip_libraries}"
1477 AC_CHECK_LIB(GeoIP, GeoIP_country_code_by_ipnum,, GEOIP="no")
1479 if test "$GEOIP" = "no"; then
1481 echo " ERROR! libgeoip library not found, go get it"
1482 echo " from http://www.maxmind.com/en/geolite or your distribution:"
1484 echo " Ubuntu: apt-get install libgeoip-dev"
1485 echo " Fedora: yum install GeoIP-devel"
1489 if test "$GEOIP" = "yes"; then
1490 AC_DEFINE([HAVE_GEOIP],[1],[libgeoip available])
1495 # get cache line size
1496 AC_PATH_PROG(HAVE_GETCONF_CMD, getconf, "no")
1497 if test "$HAVE_GETCONF_CMD" != "no"; then
1498 CLS=$(getconf LEVEL1_DCACHE_LINESIZE)
1499 if test "$CLS" != ""; then
1500 AC_DEFINE_UNQUOTED([CLS],[${CLS}],[L1 cache line size])
1502 AC_DEFINE_UNQUOTED([CLS],[64],[L1 cache line size])
1505 AC_DEFINE_UNQUOTED([CLS],[64],[L1 cache line size])
1509 if test -f ./revision; then
1510 REVISION=`cat ./revision`
1511 CFLAGS="${CFLAGS} -DREVISION=\"${REVISION}\""
1513 AC_PATH_PROG(HAVE_GIT_CMD, git, "no")
1514 if test "$HAVE_GIT_CMD" != "no"; then
1515 if [ test -d .git ]; then
1516 REVISION=`git rev-parse --short HEAD`
1517 CFLAGS="${CFLAGS} -DREVISION=\"${REVISION}\""
1526 define([EXPAND_VARIABLE],
1528 if test $prefix = 'NONE'; then
1533 *\[$]* ) eval "$2=[$]$2" ;;
1538 ])dnl EXPAND_VARIABLE
1541 if test "$WINDOWS_PATH" = "yes"; then
1542 systemtype="`systeminfo | grep \"based PC\"`"
1543 case "$systemtype" in
1545 e_winbase="C:\\\\Program Files (x86)\\\\Suricata"
1548 e_winbase="C:\\\\Program Files\\\\Suricata"
1552 e_sysconfdir="$e_winbase\\\\"
1553 e_sysconfrulesdir="$e_winbase\\\\rules\\\\"
1554 e_magic_file="$e_winbase\\\\magic.mgc"
1555 e_logdir="$e_winbase\\\\log"
1556 e_logfilesdir="$e_logdir\\\\files"
1558 EXPAND_VARIABLE(localstatedir, e_logdir, "/log/suricata/")
1559 EXPAND_VARIABLE(localstatedir, e_rundir, "/run/")
1560 EXPAND_VARIABLE(localstatedir, e_logfilesdir, "/log/suricata/files")
1561 EXPAND_VARIABLE(sysconfdir, e_sysconfdir, "/suricata/")
1562 EXPAND_VARIABLE(sysconfdir, e_sysconfrulesdir, "/suricata/rules")
1563 EXPAND_VARIABLE(localstatedir, e_localstatedir, "/run/suricata")
1567 AC_SUBST(e_logfilesdir)
1568 AC_SUBST(e_sysconfdir)
1569 AC_SUBST(e_sysconfrulesdir)
1570 AC_SUBST(e_localstatedir)
1571 AC_DEFINE_UNQUOTED([CONFIG_DIR],["$e_sysconfdir"],[Our CONFIG_DIR])
1572 AC_SUBST(e_magic_file)
1574 AC_OUTPUT(Makefile src/Makefile qa/Makefile qa/coccinelle/Makefile rules/Makefile doc/Makefile contrib/Makefile contrib/file_processor/Makefile contrib/file_processor/Action/Makefile contrib/file_processor/Processor/Makefile suricata.yaml scripts/Makefile scripts/suricatasc/Makefile scripts/suricatasc/suricatasc)
1576 SURICATA_BUILD_CONF="Suricata Configuration:
1577 AF_PACKET support: ${enable_af_packet}
1578 PF_RING support: ${enable_pfring}
1579 NFQueue support: ${enable_nfqueue}
1580 IPFW support: ${enable_ipfw}
1581 DAG enabled: ${enable_dag}
1582 Napatech enabled: ${enable_napatech}
1583 Unix socket enabled: ${enable_unixsocket}
1585 libnss support: ${enable_nss}
1586 libnspr support: ${enable_nspr}
1587 libjansson support: ${enable_jansson}
1588 Prelude support: ${enable_prelude}
1589 PCRE jit: ${pcre_jit_available}
1590 libluajit: ${enable_luajit}
1591 libgeoip: ${enable_geoip}
1592 Non-bundled htp: ${enable_non_bundled_htp}
1593 Old barnyard2 support: ${enable_old_barnyard2}
1594 CUDA enabled: ${enable_cuda}
1596 Suricatasc install: ${enable_python}
1598 Unit tests enabled: ${enable_unittests}
1599 Debug output enabled: ${enable_debug}
1600 Debug validation enabled: ${enable_debug_validation}
1601 Profiling enabled: ${enable_profiling}
1602 Profiling locks enabled: ${enable_profiling_locks}
1604 Generic build parameters:
1605 Installation prefix (--prefix): ${prefix}
1606 Configuration directory (--sysconfdir): ${e_sysconfdir}
1607 Log directory (--localstatedir) : ${e_logdir}
1611 GCC Protect enabled: ${enable_gccprotect}
1612 GCC march native enabled: ${enable_gccmarch_native}
1613 GCC Profile enabled: ${enable_gccprofile}"
1616 echo "$SURICATA_BUILD_CONF"
1617 echo "printf(" >${ac_builddir}/src/build-info.h
1618 echo "$SURICATA_BUILD_CONF" | sed -e 's/^/"/' | sed -e 's/$/\\n"/' >>${ac_builddir}/src/build-info.h
1619 echo ");" >>${ac_builddir}/src/build-info.h
1622 To build and install run 'make' and 'make install'.
1624 You can run 'make install-conf' if you want to install initial configuration
1625 files to ${e_sysconfdir}. Running 'make install-full' will install configuration
1626 and rules and provide you a ready-to-run suricata."
1628 echo "To install Suricata into /usr/bin/suricata, have the config in
1629 /etc/suricata and use /var/log/suricata as log dir, use:
1630 ./configure --prefix=/usr/ --sysconfdir=/etc/ --localstatedir=/var/"