dnl @(#) $Id: configure.in 6960 2009-12-19 06:22:16Z vern $ (LBL) dnl dnl Copyright (c) 1997, 1998, 2001, 2002 dnl The Regents of the University of California. All rights reserved. dnl dnl Process this file with autoconf to produce a configure script. dnl ## broken versioning stuff ##m4_include([version.m4]) ##AC_INIT([bro], VERSION_NUMBER) ## NOTICE: this sets the version at the autoconf time, not ## at configure time, so it may be out of date! ## start of changes for different versions of automake/conf # this will work with automake 1.8.5 dnl AC_INIT(bro, esyscmd([tr -d '\n' < VERSION])) dnl AC_CONFIG_SRCDIR(src/Active.cc) dnl AC_CANONICAL_SYSTEM dnl AM_INIT_AUTOMAKE dnl AC_CONFIG_HEADER(config.h) dnl AC_LBL_C_INIT(V_CCOPT, V_INCLS) dnl AC_PROG_LEX ## This should work with automake 1.6 AC_INIT(src/Active.cc) AC_CANONICAL_SYSTEM #AM_INIT_AUTOMAKE(bro, 0.1.0) AM_INIT_AUTOMAKE(bro, esyscmd([tr -d '\n' < VERSION])) AM_CONFIG_HEADER(config.h) AC_LBL_C_INIT(V_CCOPT, V_INCLS) AM_PROG_LEX ## end of changes for versions of automake/conf dnl Commands for funkier shell output: BLD_ON=`./shtool echo -n -e %B` BLD_OFF=`./shtool echo -n -e %b` # We should install everything in /usr/local/bro{bin,lib,policy,etc} AC_PREFIX_DEFAULT(/usr/local/bro) dnl ################################################ dnl # Checks for programs dnl ################################################ AC_PROG_YACC AC_PROG_CXX AC_PROG_INSTALL AC_PROG_MAKE_SET AC_PROG_RANLIB AC_CHECK_PROGS(COMPRESS, gzip, compress) AM_CONDITIONAL(USEV6, false) AC_ARG_ENABLE(brov6, [ --enable-brov6 enable IPV6 processing], AC_DEFINE(BROv6,,[enable IPV6 processing]) AM_CONDITIONAL(USEV6,true)) AC_ARG_ENABLE(int64, [ --enable-int64 enable use of int64 (long long) for integers], AC_DEFINE(USE_INT64,1,[enable use of 64-bit integers])) AC_ARG_ENABLE(activemapping, [ --enable-activemapping enable active mapping processing], AC_DEFINE(ACTIVE_MAPPING,,[Enable active mapping processing])) AC_ARG_ENABLE(expire-dfa-states, [ --enable-expire-dfa-states enable DFA state expiration], AC_DEFINE(EXPIRE_DFA_STATES,,[Enable DFA state expiration])) AC_ARG_ENABLE(debug, [ --enable-debug no compiler optimizations], debug="yes" V_CCOPT="-g -DDEBUG" CFLAGS="-DDEBUG `echo $CFLAGS | sed -e 's/-O2//'`" CPPFLAGS="-DDEBUG `echo $CPPFLAGS | sed -e 's/-O2//'`" CXXFLAGS="-DDEBUG `echo $CXXFLAGS | sed -e 's/-O2//'`", debug="no") AC_ARG_ENABLE(select-loop, [ --disable-select-loop disable select-based main loop], check_select_loop=no, check_select_loop=yes) AC_ARG_ENABLE(perftools, [ --enable-perftools use Google's perftools], use_perftools=yes, use_perftools=no) AC_ARG_WITH(openssl, [ --with-openssl=PATH path to OpenSSL (needed for SSL analyzer and secure communication)], if test "$withval" != "no" -a "$withval" != "NO"; then use_openssl=yes OPENSSL="$withval" LDFLAGS="${LDFLAGS} -L${OPENSSL}/lib " V_INCLS="${V_INCLS} -I${OPENSSL}/include" CXXFLAGS="${CXXFLAGS} -I${OPENSSL}/include" else use_openssl=no fi ) AC_ARG_ENABLE(shippedpcap, [ --enable-shippedpcap use the shipped version of libpcap ], [ if test "$enableval" = yes; then use_shippedpcap=yes else use_shippedpcap=no fi ], [ use_shippedpcap=no ]) AC_ARG_WITH(perl, [ --with-perl=PATH path/name of the Perl interpreter], PERL=$withval, PERL=${PERL:-}) AC_ARG_WITH(dag, [ --with-dag=PATH path to the DAG library (for native support for Endace Tech.'s DAG monitoring cards)], if test "$withval" != "no" -a "$withval" != "NO"; then use_dag=yes DAGPATH="$withval" LDFLAGS="${LDFLAGS} -L${DAGPATH}/lib " V_INCLS="${V_INCLS} -I${DAGPATH}/include" else use_dag=no fi ) AC_ARG_WITH(binpac, [ --with-binpac=PATH path to a binpac executable for compiling analyzer code], BINPAC="$withval") AC_ARG_ENABLE(nbdns, AC_HELP_STRING([--disable-nbdns], [Disable non-blocking DNS support]), nbdns="no", nbdns="yes") AC_LBL_ENABLE_CHECK([activemapping binpac broccoli brov6 debug \ expire-dfa-states gtk-doc int64 openssl perftools perl \ select-loop shippedpcap broctl cluster nbdns]) dnl ################################################ dnl # OpenSSL dnl ################################################ if test "$use_openssl" != "no" -a "$use_openssl" != "NO"; then saved_libs="${LIBS}" AC_CHECK_LIB(crypto, OPENSSL_add_all_algorithms_conf, LIBS="${LDFLAGS} -lcrypto" AC_CHECK_LIB(ssl, SSL_new,, AC_MSG_ERROR([Can't find SSL library])) LIBS="${LDFLAGS} -lssl" use_openssl=yes, use_openssl=no ) LIBS="${saved_libs}" else use_openssl=no fi if test "$use_openssl" != "no"; then saved_cflags="${CFLAGS}" CFLAGS="${CFLAGS} -I${OPENSSL}/include" AC_CHECK_DECL(OPENSSL_add_all_algorithms_conf,, use_openssl=no, [#include ]) CFLAGS="${saved_cflags}" fi if test "$use_openssl" = "yes"; then # On Red Hat we may need to include Kerberos header. # (CHECK_HEADER doesn't work here) saved_cflags="${CFLAGS}" CFLAGS="${CFLAGS} -I${OPENSSL}/include" AC_COMPILE_IFELSE([#include ],, CFLAGS="${CFLAGS} -I/usr/kerberos/include" AC_CHECK_HEADER(krb5.h, V_INCLS="${V_INCLS} -I/usr/kerberos/include" AC_DEFINE(NEED_KRB5_H,,[Include krb5.h]), use_openssl=no AC_MSG_WARN([Can't compile OpenSSL test; disabling OpenSSL.]); , [#include #include ] ) CFLAGS="${saved_cflags}" ) fi # Check for version >= 0.9.7 if test "$use_openssl" = "yes"; then saved_libs="${LIBS}" LIBS="${LIBS} -lssl -lcrypto" AC_MSG_CHECKING([for OpenSSL >= 0.9.7]) AC_LINK_IFELSE(AC_LANG_PROGRAM([[#include ]], [[OPENSSL_add_all_algorithms_conf();]]), AC_MSG_RESULT(yes) use_openssl=yes, AC_MSG_RESULT(no) use_openssl=no) LIBS="${saved_libs}" fi AM_CONDITIONAL(USE_OPENSSL, false) if test "$use_openssl" = "yes"; then AM_CONDITIONAL(USE_OPENSSL, true) AC_DEFINE(USE_OPENSSL,,[Use OpenSSL]) LIBS="${LIBS} -lssl -lcrypto" fi # A test to see whether d2i_X509() uses const for the u_char** # argument. Since one cannot just cast a u_char** to a const one # (http://parashift.com/c++-faq-lite/const-correctness.html#faq-18.17) # we test and then force a u_char** cast only when needed. # if test "$use_openssl" = "yes"; then AC_MSG_CHECKING([whether d2i_X509() uses a const unsigned char**]) AC_LANG_PUSH([C++]) AC_COMPILE_IFELSE( AC_LANG_PROGRAM([[#include ]], [[const unsigned char** cpp = 0; X509** x = 0; d2i_X509(x, cpp, 0);]]), AC_DEFINE(OPENSSL_D2I_X509_USES_CONST_CHAR,,[d2i_x509 uses const char**]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no)) AC_LANG_POP([C++]) fi # do we use ssl? AM_CONDITIONAL(USE_SSL, test "$use_openssl" = "yes") dnl ################################################ dnl # Check for Perl executable dnl ################################################ if test -n "$PERL"; then if echo "$PERL" | grep '^/' >/dev/null; then AC_MSG_CHECKING(for $PERL) if test -s "$PERL"; then AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) PERL='none' fi else find_perl="$PERL" PERL='' fi fi dnl if there is no perl, go find one! if test -z "$PERL"; then AC_PATH_PROGS(PERL,perl5 perl,,/usr/local/bin:/opt/local/bin:/usr/bin::.) fi dnl if we still can't find it, warn them if test -z "$PERL"; then AC_MSG_WARN([Cannot find perl; please use --with-perl=/path/to/perl option.]) else dnl this seems backwards to me .....? but works if ${PERL} -e 'exit ($] >= 5.006001)' > /dev/null 2>&1; then AC_MSG_WARN([Bad perl version, need perl 5.6.1 or higher.; please use --with-perl=/path/to/perl option.]) fi fi AC_SUBST(PERL) dnl ################################################ dnl # Check for chown binary dnl ################################################ AC_PATH_PROG(CHOWN, chown, , [/usr/sbin:/bin:/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin]) AC_SUBST(CHOWN) dnl ################################################ dnl # OS-specific hacks and tweaks dnl ################################################ AC_LBL_DEVEL(V_CCOPT) AM_CONDITIONAL(USE_NMALLOC, false) dnl Our resolver tests below include an absolute libray location. dnl This is its default, it may be changed for some OSs. bro_absolute_libresolv="/usr/lib/libresolv.a" case "$target_os" in freebsd*) # alternate malloc is faster for FreeBSD, but needs more testing # need to add way to set this from the command line AM_CONDITIONAL(USE_NMALLOC, true) ;; darwin*) AC_MSG_CHECKING([if we need to include arpa/nameser_compat.h]) AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[#include ]], [[HEADER *hdr; int d = NS_IN6ADDRSZ;]]), bro_ns_header_defined=yes, bro_ns_header_defined=no) # if the header is found, we don't need compatibility if test "x$bro_ns_header_defined" = xyes; then AC_MSG_RESULT(no) else AC_DEFINE(NEED_NAMESER_COMPAT_H,,[Compatibility for Darwin]) AC_MSG_RESULT(yes) fi # Support for MacPorts and Fink package-management. test -d /opt/local/lib && LDFLAGS="${LDFLAGS} -L/opt/local/lib" test -d /sw/lib && LDFLAGS="${LDFLAGS} -L/sw/lib" V_INCLS="${V_INCLS} -I/opt/local/include -I/sw/include" CXXFLAGS="${CXXFLAGS} -I/opt/local/include -I/sw/include" ;; openbsd*) AM_CONDITIONAL(USE_NMALLOC, true) AC_DEFINE(HAVE_OPENBSD,,[We are on a OpenBSD system]) LDFLAGS="${LDFLAGS} -L/usr/local/lib" V_INCLS="${V_INCLS} -I/usr/local/include" CXXFLAGS="${CXXFLAGS} -I/usr/local/include" ;; linux*) V_INCLS="$V_INCLS -I\${top_srcdir}/linux-include" AC_DEFINE(HAVE_LINUX,,[We are on a Linux system]) AC_MSG_CHECKING(Linux kernel version) AC_CACHE_VAL(ac_cv_linux_vers, ac_cv_linux_vers=`uname -r 2>&1 | \ sed -n -e '$s/.* //' -e '$s/\..*//p'`) AC_MSG_RESULT($ac_cv_linux_vers) if test $ac_cv_linux_vers -lt 2 ; then AC_MSG_ERROR(version 2 or higher required; see the INSTALL doc for more info) fi if test "a$build_cpu" = "ax86_64"; then bro_absolute_libresolv="/usr/lib64/libresolv.a" fi ;; solaris*) LIBS="${LIBS} -lnsl -lsocket" ;; osf*) dnl Workaround around ip_hl vs. ip_vhl problem in netinet/ip.h V_CCOPT="$V_CCOPT -D__STDC__=2" esac dnl ################################################ dnl # Enable large file support for all platforms. dnl # Can be disabled with --disable-largefile dnl ################################################ AC_SYS_LARGEFILE dnl ################################################ dnl # Checks for types and header files. dnl ################################################ AC_HEADER_STDC AC_LBL_TYPE_SIGNAL AC_LBL_CHECK_TYPE(int32_t, int) AC_LBL_CHECK_TYPE(u_int32_t, u_int) AC_LBL_CHECK_TYPE(u_int16_t, u_short) AC_LBL_CHECK_TYPE(u_int8_t, u_char) AC_HEADER_TIME AC_CHECK_HEADERS(memory.h netinet/in.h socket.h getopt.h) AC_CHECK_HEADERS(net/ethernet.h netinet/ether.h netinet/if_ether.h sys/ethernet.h,,, [#include #include #include #include ]) AC_CHECK_HEADERS(netinet/ip6.h,,, [#include #include #include #include ]) AC_DEFUN([AC_C_SOCKLEN_T], [AC_CACHE_CHECK(for socklen_t, ac_cv_c_socklen_t, [ AC_TRY_COMPILE([ #include #include ],[ socklen_t foo; ],[ ac_cv_c_socklen_t=yes ],[ ac_cv_c_socklen_t=no ]) ]) if test $ac_cv_c_socklen_t = no; then AC_DEFINE(socklen_t, int, [define to int if socklen_t not available]) fi ]) AC_C_SOCKLEN_T AC_BRO_SYSLOG_INT AC_BRO_SOCK_DECL dnl ################################################ dnl # PCAP stuff. dnl ################################################ # ensure we are either YES or NO if test "$use_shippedpcap" = "no" ; then pcap_local="NO" pcapmsg="system-provided" AM_CONDITIONAL(USE_LOCALPCAP, false) else pcap_local="YES" pcapmsg="shipped with Bro" AM_CONDITIONAL(USE_LOCALPCAP, true) fi # if not using local version, find one on the system if test "$pcap_local" = "NO"; then AC_LBL_LIBPCAP(V_PCAPDEP, V_INCLS) CPPFLAGS="$CPPFLAGS $V_INCLS" AC_CHECK_HEADERS(pcap-int.h) AC_CHECK_FUNCS(bpf_set_bufsize) dnl ################################################ dnl # Check whether pcap provides pcap_version dnl ################################################ AC_MSG_CHECKING([for pcap_version in libpcap]) AC_LINK_IFELSE( AC_LANG_PROGRAM([extern char pcap_version[];], [puts(pcap_version);]), AC_MSG_RESULT(yes) AC_DEFINE(PCAP_VERSION_STRING,,[Have a version string in libpcap]), AC_MSG_RESULT(no)) dnl ################################################ dnl # Check whether linking to pcap works dnl ################################################ AC_CHECK_LIB(pcap, main, , AC_MSG_ERROR([Bro requires pcap - install from aux/ if necessary.])) else # we have to define the abilites of the local pcap # as it hasn't been unpacked/configured/installed # yet and we can't query it. AC_DEFINE(HAVE_PCAP_INT_H, 1, [Define to 1 if you have the header file.]) AC_DEFINE(HAVE_BPF_SET_BUFSIZE, 0, [Define to 1 if you have the bpf_set_bufsize function.]) AC_DEFINE(PCAP_VERSION_STRING, 1, [Have a version string in libpcap]) AC_DEFINE(HAVE_LIBPCAP, 1, [Define to 1 if you have the pcap library (-lpcap).]) fi dnl AC_CHECK_HEADERS(pcap-int.h) dnl AC_CHECK_FUNCS(bpf_set_bufsize) dnl ################################################ dnl # STL compatibility tests. dnl ################################################ dnl # Whether basic_string<> requires additional dnl # definitions for char_traits. In that case, we dnl # fall back to vector. dnl # AC_MSG_CHECKING([if char_traits defines all methods]) AC_LANG_PUSH([C++]) AC_LINK_IFELSE( AC_LANG_PROGRAM([[ #include using namespace std; class Foo { }; ]], [[ char_traits foo; Foo f; Foo *fp; foo.assign(&fp, 10, &f);]]), AC_MSG_RESULT([yes]) basic_string_works=yes, AC_MSG_RESULT([no]) basic_string_works=no AC_DEFINE(BASIC_STRING_BROKEN,,[basic_string not usable with non-char template arg])) AC_LANG_POP([C++]) dnl ################################################ dnl # Include the Broccoli tree in aux/broccoli in dnl # the setup, unless specifically disabled. dnl ################################################ AC_ARG_ENABLE(broccoli, AC_HELP_STRING([--disable-broccoli], [Do not build/package Broccoli]), broccoli="no", broccoli="yes") AM_CONDITIONAL(USE_BROCCOLI, test "x$broccoli" = xyes) if test "x$broccoli" = xyes; then AC_CONFIG_SUBDIRS(aux/broccoli) fi dnl ################################################ dnl # Include the broctl tree in aux/broctl into dnl # the setup, unless specifically disabled. dnl # Per default, we configure it in standalone mode; dnl # if --enable-cluster is given, we switch to dnl # cluster mode. dnl ################################################ AC_ARG_ENABLE(broctl, AC_HELP_STRING([--disable-broctl], [Do not build/package broctl framework]), broctl=$enableval, broctl="yes") AC_ARG_ENABLE(cluster, AC_HELP_STRING([--enable-cluster], [Configure broctl for cluster usage]), cluster=$enableval, cluster="no") dnl ################################################ dnl # Include the Binpac tree in aux/binpac in the dnl # build, unless the user selected another binpac dnl # via --with-binpac=. dnl ################################################ if test "$BINPAC" = ""; then AC_CONFIG_SUBDIRS(aux/binpac) BINPAC="\${top_builddir}/aux/binpac/src/binpac" binpacmsg="shipped with Bro" else # Check (somewhat) whether the binpac given is valid AC_MSG_CHECKING([whether given binpac is executable]) if test -x "$BINPAC"; then AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) echo "Please check whether $BINPAC is correct." exit 1 fi binpacmsg="$BINPAC" fi AC_SUBST(BINPAC) dnl ################################################ dnl # DNS resolver checks. dnl ################################################ dnl dnl Check whether our arpa/nameser.h provides type ns_msg. dnl If not, we disable nonblocking DNS lookups. dnl We assume worst case first and improve on it below. AM_CONDITIONAL(USE_NBDNS, false) dnl Add potential header locations to path if test -d /usr/local/include/bind; then CFLAGS="$CFLAGS -I/usr/local/include/bind" fi AC_CHECK_TYPE(ns_msg, bro_check_nb_dns=yes, bro_check_nb_dns=no, [#include ]) if test $bro_check_nb_dns = no; then AC_MSG_NOTICE([Nonblocking DNS disabled.]) use_nb_dns=no else dnl We will check for ns_initparse and res_mkquery using a number dnl of resolver library variations, a list of which we build up now. bro_resolver_options="none -lresolv ${bro_absolute_libresolv} -lbind" save_cflags="$CFLAGS" save_ldflags="$LDFLAGS" save_libs="$LIBS" dnl Okay now try to link both symbols with each of the resolver dnl location variants. As soon as one works, we're happy. for res in $bro_resolver_options; do AC_MSG_CHECKING([for ns_inittab/res_mkquery with resolver '$res']) dnl "none" just means "try without any additional flags". if test "$res" = "none"; then res="" fi CFLAGS="${save_cflags}" LDFLAGS="${save_ldflags}" LIBS="${save_libs} $res" dnl In the generic -lbind case, we check for the existence dnl of a number of directories and add them to the relevant dnl paths. dnl if test "$res" = "-lbind"; then if test -d /usr/local/bind/lib; then LDFLAGS="$LDFLAGS -L/usr/local/bind/lib" fi if test -d /usr/local/lib; then LDFLAGS="$LDFLAGS -L/usr/local/lib" fi fi bro_ns_initparse_works=no bro_res_mkquery_works=no AC_LINK_IFELSE(AC_LANG_PROGRAM([[#include ]], [[ns_initparse(0,0,0);]]), bro_ns_initparse_works=yes) AC_LINK_IFELSE(AC_LANG_PROGRAM([[ #include #include #include #include #include ]], [[int (*p)() = res_mkquery]]), bro_res_mkquery_works=yes) if test $bro_ns_initparse_works = yes && test $bro_res_mkquery_works = yes && test $nbdns = yes; then AC_MSG_RESULT(yes) AC_MSG_NOTICE([Nonblocking DNS enabled.]) dnl Make sure that nb_dns.o is linked in. NBDNS="nb_dns.o" AC_SUBST(NBDNS) AM_CONDITIONAL(USE_NBDNS, true) AC_DEFINE(HAVE_NB_DNS,,[async dns support]) use_nb_dns=yes break else AC_MSG_RESULT(no) fi done if test "x$NBDNS" != "xnb_dns.o"; then AC_MSG_NOTICE([Nonblocking DNS disabled.]) use_nb_dns=no CFLAGS="${save_cflags}" LDFLAGS="${save_ldflags}" LIBS="${save_libs}" fi fi dnl ################################################ dnl # Checks for library functions. dnl ################################################ AC_FUNC_MEMCMP AC_FUNC_STRFTIME AC_CHECK_FUNCS(strerror strsep strcasestr mallinfo getopt_long) AC_SEARCH_LIBS(inet_aton, resolv) # We use deflatePrime() to make sure that zlib is recent enough. AC_CHECK_LIB(z, deflatePrime) # Libmagic have_libmagic=yes AC_CHECK_HEADERS([magic.h],,have_libmagic=no) AC_CHECK_LIB(magic,magic_open,,have_libmagic=no) # Libclamav # have_libclamav=yes # AC_CHECK_HEADERS([clamav.h],,have_libclamav=no) # AC_CHECK_LIB(clamav,cl_retdbdir,,have_libclamav=no) # Libclamav is broken because of changed API. have_libclamav=no if test "$have_libclamav" = "yes"; then AC_DEFINE(USE_LIBCLAMAV,,[Use libclamav]) fi # LibGeoIP have_libgeoip=yes AC_CHECK_HEADERS([GeoIPCity.h],,have_libgeoip=no) if test "$have_libgeoip" = "yes"; then AC_CHECK_LIB(GeoIP,GeoIP_open_type,,have_libgeoip=no) fi if test "$have_libgeoip" = "yes"; then AC_DEFINE(USE_GEOIP,,[GeoIP geographic lookup functionality]) fi dnl ################################################ dnl # Terminal library support dnl ################################################ bro_have_termlibrary=no dnl 1) Check if termcap is available AC_CHECK_LIB(termcap, tgetnum, [AC_CHECK_HEADERS([termcap.h term.h], LIBS="${LIBS} -ltermcap" bro_have_termlibrary=yes)]) dnl 2) Check if curses is available instaed if test "$bro_have_termlibrary" = no; then AC_CHECK_LIB(curses, tgetnum, [AC_CHECK_HEADERS([curses.h term.h], LIBS="${LIBS} -lcurses" bro_have_termlibrary=yes)]) fi dnl 3) Check for ncurses as a final resort if test "$bro_have_termlibrary" = no; then AC_CHECK_LIB(ncurses, tgetnum, [AC_CHECK_HEADERS([ncurses.h curses.h term.h], LIBS="${LIBS} -lncurses" bro_have_termlibrary=yes)]) fi if test "$bro_have_termlibrary" != yes; then AC_MSG_RESULT(no) AC_MSG_ERROR([No terminal emulation library found! Consider installing termcap, curses, or ncurses.]) else AC_MSG_RESULT(yes) fi dnl Check whether we have readline and history libraries AC_CHECK_HEADER([readline/readline.h], bro_readline=yes) AC_CHECK_HEADER([readline/history.h], bro_history=yes) AC_CHECK_LIB(readline, using_history,, bro_libreadline=no) if test "$bro_history" = yes; then AC_CHECK_MEMBER([HISTORY_STATE.entries], [bro_history_entries=yes], [], [#include #include ]) fi if test "$bro_readline" = yes -a \ "$bro_history" = yes -a \ "$bro_libreadline" != no -a \ "$bro_history_entries" = yes; then AC_DEFINE(HAVE_READLINE,1,[line editing & history powers]) fi AC_C_BIGENDIAN( AC_DEFINE(WORDS_BIGENDIAN,1,[whether words are stored with the most significant byte first]) dnl This is intentionally named differently so as to not collide with WORDS_BIGENDIAN HOST_BIGENDIAN="#define HOST_BIGENDIAN 1" AC_SUBST(HOST_BIGENDIAN)) AC_CHECK_TYPES([union semun, struct sembuf],[],[], [#include #include ]) # see if we have sin_len AC_CHECK_MEMBER(struct sockaddr_in.sin_len, [AC_DEFINE(SIN_LEN,,[have sin_len field in sockaddr_in])],, [ #if HAVE_SYS_TYPES_H # include #endif #if HAVE_SYS_SOCKET_H # include #endif #if HAVE_NETINET_IN_H # include #endif ]) AC_CHECK_SIZEOF(long long) AC_CHECK_SIZEOF(long int) AC_CHECK_SIZEOF(void *) # Per default we do not use the select-based main loop. We activate it only if # (i) the user requests it # (ii) we know the OS to support selectable pcap fds use_select_loop=no if test $check_select_loop = yes; then case "$target_os" in linux*) # Linux should support selectable at least since 2.2 (not sure # about earlier versions) AC_MSG_CHECKING(Linux kernel version support selectable fds) AC_CACHE_VAL(ac_cv_linux_major_vers, ac_cv_linux_major_vers=`uname -r 2>&1 | \ sed 's/-.*$//g' | awk -v FS='.' '{print $1}'`) AC_CACHE_VAL(ac_cv_linux_minor_vers, ac_cv_linux_minor_vers=`uname -r 2>&1 | \ sed 's/-.*$//g' | awk -v FS='.' '{print $2}'`) linux_version=`expr $ac_cv_linux_major_vers '*' 10 '+' $ac_cv_linux_minor_vers` if test $linux_version -gt 21; then use_select_loop=yes AC_MSG_RESULT($ac_cv_linux_major_vers.$ac_cv_linux_minor_vers is ok) else AC_MSG_RESULT($ac_cv_linux_major_vers.$ac_cv_linux_minor_vers is too old) fi ;; freebsd*) # FreeBSD supports selectable fds correctly since 4.6. AC_MSG_CHECKING(FreeBSD kernel version support selectable fds) AC_CACHE_VAL(ac_cv_freebsd_major_vers, ac_cv_freebsd_major_vers=`uname -r 2>&1 | \ sed 's/-.*$//g' | awk -v FS='.' '{print $1}'`) AC_CACHE_VAL(ac_cv_freebsd_minor_vers, ac_cv_freebsd_minor_vers=`uname -r 2>&1 | \ sed 's/-.*$//g' | awk -v FS='.' '{print $2}'`) freebsd_version=`expr $ac_cv_freebsd_major_vers '*' 10 '+' $ac_cv_freebsd_minor_vers` if test $freebsd_version -gt 45; then use_select_loop=yes AC_MSG_RESULT($ac_cv_freebsd_major_vers.$ac_cv_freebsd_minor_vers is ok) else AC_MSG_RESULT($ac_cv_freebsd_major_vers X $ac_cv_freebsd_minor_vers is too old) fi ;; esac fi if test "$use_select_loop" = "yes"; then AC_DEFINE(USE_SELECT_LOOP,,[Use select-based main loop]) fi dnl ################################################ dnl # Endace DAG support dnl ################################################ if test "$use_dag" != "no" -a "$use_dag" != "NO"; then AC_CHECK_LIB(dag, dag_open, use_dag=yes, use_dag=no) AC_CHECK_HEADER(pcap.h,,use_dag=no) if test "$use_dag" = "yes"; then AC_DEFINE(USE_DAG,,[Include Endace DAG support]) LIBS="${LIBS} -ldag" AC_SUBST(WANT_DAG_OBJ, "\$(DAG_OBJ)") else AC_SUBST(WANT_DAG_OBJ, "") fi else use_dag=no fi dnl ################################################ dnl # If configured with --enable-perftools, look for dnl # Google's perftools to do heap checking. dnl ################################################ if test "$use_perftools" != "no" -a "$use_perftools" != "NO"; then AC_LANG_PUSH(C++) saved_libs="${LIBS}" LIBS="${LIBS} -ltcmalloc -lpthread" AC_TRY_LINK([#include ], [HeapLeakChecker heap_checker("test");], [use_perftools="yes"],[use_perftools="no"]) LIBS="${saved_libs}" AC_LANG_POP([C++]) if test "$use_perftools" = "yes"; then AC_DEFINE(USE_PERFTOOLS,,[Use Google's perftools]) LIBS="${LIBS} -ltcmalloc -lpthread" fi fi ############################### # Configure broctl. ############################### # Need Python >= 2.4. have_python=no AC_PATH_TOOL(pybin, python, "") if test "x$pybin" != x -a "x$broctl" = xyes; then AC_MSG_CHECKING([for Python >= 2.4]) AC_CACHE_VAL(ac_cv_python_major_vers, ac_cv_python_major_vers=`python -V 2>&1 | \ sed 's/^Python //g' | awk -v FS='.' '{print $1}'`) AC_CACHE_VAL(ac_cv_python_minor_vers, ac_cv_python_minor_vers=`python -V 2>&1 | \ sed 's/^Python //g' | awk -v FS='.' '{print $2}'`) pyversion=`expr $ac_cv_python_major_vers '*' 10 '+' $ac_cv_python_minor_vers` if test $pyversion -ge 24; then AC_MSG_RESULT([yes]) have_python=yes fi AC_CHECK_PROG(have_python, python-config, $have_python, no) if test "x$have_python" != xyes; then AC_MSG_RESULT([no, disabling broctl]) fi fi if test "x$have_python" != xyes; then broctl=no fi AM_CONDITIONAL(USE_BROCTL, test "x$broctl" = xyes) if test "x$broctl" = xyes; then if test "x$cluster" = xno; then standalone="--standalone" fi echo "=== configuring in aux/broctl" test -d aux || mkdir aux test -d aux/broctl || mkdir aux/broctl ${srcdir}/aux/broctl/configure --prefix=${prefix} --builddir=`pwd`/aux/broctl --brodist=${srcdir} ${standalone} AC_CONFIG_SUBDIRS([aux/broctl/aux/capstats]) fi if test "$use_xqilla" = "yes"; then LIBS="${LIBS} -lxqilla" fi # grab the hostname BROHOST=`hostname 2>/dev/null` || `uname -n 2>/dev/null` AC_SUBST(BROHOST) dnl Setup pcap path just before creating files, this way tests won't fail dnl with 'can't find libpcap' when we use the local pcap which hasn't dnl been unpacked yet if test "$pcap_local" = "YES"; then LIBS="-L\${top_srcdir}/aux/libpcap-0.9.8 -lpcap $LIBS" V_INCLS="$V_INCLS -I\${top_builddir}/aux/libpcap-0.9.8" fi AC_SUBST(V_CCOPT) AC_SUBST(V_INCLS) AC_SUBST(LDFLAGS) dnl AC_SUBST(V_PCAPDEP) dnl (libpcap dependancies -- not used) AC_OUTPUT([Makefile src/Makefile doc/Makefile doc/ref-manual/Makefile doc/quick-start/Makefile doc/user-manual/Makefile aux/adtrace/Makefile aux/cf/Makefile aux/hf/Makefile aux/nftools/Makefile aux/scripts/Makefile aux/bdcat/Makefile aux/rst/Makefile aux/Makefile policy/Makefile policy/sigs/Makefile policy/time-machine/Makefile scripts/Makefile scripts/bro_config scripts/bro.rc scripts/localnetMAC.pl scripts/s2b/Makefile scripts/s2b/bro-include/Makefile scripts/s2b/example_bro_files/Makefile scripts/s2b/etc/Makefile scripts/s2b/bin/Makefile scripts/s2b/pm/Makefile scripts/s2b/snort_rules2.2/Makefile ], [chmod +x scripts/bro_config chmod +x scripts/localnetMAC.pl] ) if test "$use_openssl" != "yes"; then OPENSSL="" #else # AC_OUTPUT(aux/bdcat/Makefile) fi echo echo " "${BLD_ON}"Bro Configuration Summary"${BLD_OFF} echo "==========================================================" echo echo " - Debugging enabled: "${BLD_ON}$debug${BLD_OFF} echo " - OpenSSL support: "${BLD_ON}$use_openssl $OPENSSL${BLD_OFF} echo " - Non-blocking main loop: "${BLD_ON}$use_select_loop${BLD_OFF} echo " - Non-blocking resolver: "${BLD_ON}$use_nb_dns${BLD_OFF} echo " - Installation prefix: "${BLD_ON}$prefix${BLD_OFF} echo " - Perl interpreter: "${BLD_ON}$PERL${BLD_OFF} echo " - Using basic_string: "${BLD_ON}$basic_string_works${BLD_OFF} echo " - Using libmagic: "${BLD_ON}$have_libmagic${BLD_OFF} # echo " - Using libclamav: "${BLD_ON}$have_libclamav${BLD_OFF} echo " - Using perftools: "${BLD_ON}$use_perftools${BLD_OFF} echo " - Binpac used: "${BLD_ON}$binpacmsg${BLD_OFF} echo " - Using libGeoIP: "${BLD_ON}$have_libgeoip${BLD_OFF} echo " - Enabled broctl: "${BLD_ON}$broctl${BLD_OFF} echo " - Enabled cluster: "${BLD_ON}$cluster${BLD_OFF} echo " - Pcap used: "${BLD_ON}$pcapmsg${BLD_OFF} echo exit 0