Merge branch 'fastpath' into devel

This commit is contained in:
Seth Hall 2010-11-15 15:46:12 -05:00
commit 4f1ed0c5ef
2 changed files with 71 additions and 33 deletions

View file

@ -60,26 +60,24 @@ AC_DEFUN([AC_LBL_TYPE_SIGNAL],
esac]]) esac]])
dnl dnl
dnl Determine which compiler we're using (cc or gcc) dnl Do whatever AC_LBL_C_INIT work is necessary before using AC_PROG_CC.
dnl If using gcc, determine the version number
dnl If using cc, require that it support ansi prototypes
dnl If using gcc, use -O2 (otherwise use -O)
dnl If using cc, explicitly specify /usr/local/include
dnl dnl
dnl usage: dnl It appears that newer versions of autoconf (2.64 and later) will,
dnl if you use AC_TRY_COMPILE in a macro, stick AC_PROG_CC at the
dnl beginning of the macro, even if the macro itself calls AC_PROG_CC.
dnl See the "Prerequisite Macros" and "Expanded Before Required" sections
dnl in the Autoconf documentation.
dnl dnl
dnl AC_LBL_C_INIT(copt, incls) dnl This causes a steaming heap of fail in our case, as we were, in
dnl AC_LBL_C_INIT, doing the tests we now do in AC_LBL_C_INIT_BEFORE_CC,
dnl calling AC_PROG_CC, and then doing the tests we now do in
dnl AC_LBL_C_INIT. Now, we run AC_LBL_C_INIT_BEFORE_CC, AC_PROG_CC,
dnl and AC_LBL_C_INIT at the top level.
dnl dnl
dnl results: dnl Borrowed from libpcap-1.1.1 by Gregor
dnl AC_DEFUN([AC_LBL_C_INIT_BEFORE_CC],
dnl $1 (copt set)
dnl $2 (incls set)
dnl CC
dnl LDFLAGS
dnl LBL_CFLAGS
dnl
AC_DEFUN([AC_LBL_C_INIT],
[AC_PREREQ(2.12) [AC_PREREQ(2.12)
AC_BEFORE([$0], [AC_LBL_C_INIT])
AC_BEFORE([$0], [AC_PROG_CC]) AC_BEFORE([$0], [AC_PROG_CC])
AC_BEFORE([$0], [AC_LBL_FIXINCLUDES]) AC_BEFORE([$0], [AC_LBL_FIXINCLUDES])
AC_BEFORE([$0], [AC_LBL_DEVEL]) AC_BEFORE([$0], [AC_LBL_DEVEL])
@ -108,7 +106,31 @@ AC_DEFUN([AC_LBL_C_INIT],
CC=cc CC=cc
export CC export CC
fi fi
AC_PROG_CC ])
dnl
dnl Determine which compiler we're using (cc or gcc)
dnl If using gcc, determine the version number
dnl If using cc, require that it support ansi prototypes
dnl If using gcc, use -O2 (otherwise use -O)
dnl If using cc, explicitly specify /usr/local/include
dnl
dnl usage:
dnl
dnl AC_LBL_C_INIT(copt, incls)
dnl
dnl results:
dnl
dnl $1 (copt set)
dnl $2 (incls set)
dnl CC
dnl LDFLAGS
dnl LBL_CFLAGS
dnl
AC_DEFUN([AC_LBL_C_INIT],
[AC_PREREQ(2.12)
AC_BEFORE([$0], [AC_LBL_FIXINCLUDES])
AC_BEFORE([$0], [AC_LBL_DEVEL])
if test "$GCC" != yes ; then if test "$GCC" != yes ; then
AC_MSG_CHECKING(that $CC handles ansi prototypes) AC_MSG_CHECKING(that $CC handles ansi prototypes)
AC_CACHE_VAL(ac_cv_lbl_cc_ansi_prototypes, AC_CACHE_VAL(ac_cv_lbl_cc_ansi_prototypes,

View file

@ -30,6 +30,8 @@ AC_CANONICAL_SYSTEM
#AM_INIT_AUTOMAKE(bro, 0.1.0) #AM_INIT_AUTOMAKE(bro, 0.1.0)
AM_INIT_AUTOMAKE(bro, esyscmd([tr -d '\n' < VERSION])) AM_INIT_AUTOMAKE(bro, esyscmd([tr -d '\n' < VERSION]))
AM_CONFIG_HEADER(config.h) AM_CONFIG_HEADER(config.h)
AC_LBL_C_INIT_BEFORE_CC(V_CCOPT, V_INCLS)
AC_PROG_CC
AC_LBL_C_INIT(V_CCOPT, V_INCLS) AC_LBL_C_INIT(V_CCOPT, V_INCLS)
AM_PROG_LEX AM_PROG_LEX
@ -136,6 +138,20 @@ AC_LBL_ENABLE_CHECK([activemapping binpac broccoli brov6 debug \
expire-dfa-states gtk-doc int64 openssl perftools perl \ expire-dfa-states gtk-doc int64 openssl perftools perl \
select-loop shippedpcap broctl cluster nbdns]) select-loop shippedpcap broctl cluster nbdns])
dnl ################################################
dnl # Writing around broken autoconf
dnl ################################################
dnl It seems that AC_CHECK_HEADER defines a bash function called
dnl ac_fn_c_check_header_compile in the output when it is first
dnl encountered. While in general a neat idea, this fails, if the
dnl first use of AC_CHECK_HEADER is in an if/else clause. In this
dnl case the function's scope is limited to the enclosing if/els
dnl block and later calls to the function fail (more or less silently)
dnl Solution: we just place a phony AC_CHECK_HEADER call here.
AC_CHECK_HEADER([stdio.h])
AC_CHECK_HEADERS([stdio.h stdio.h])
dnl ################################################ dnl ################################################
dnl # OpenSSL dnl # OpenSSL
dnl ################################################ dnl ################################################
@ -168,9 +184,9 @@ if test "$use_openssl" = "yes"; then
# (CHECK_HEADER doesn't work here) # (CHECK_HEADER doesn't work here)
saved_cflags="${CFLAGS}" saved_cflags="${CFLAGS}"
CFLAGS="${CFLAGS} -I${OPENSSL}/include" CFLAGS="${CFLAGS} -I${OPENSSL}/include"
AC_COMPILE_IFELSE([#include <openssl/ssl.h>],, AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <openssl/ssl.h>]])],,
CFLAGS="${CFLAGS} -I/usr/kerberos/include" CFLAGS="${CFLAGS} -I/usr/kerberos/include"
AC_CHECK_HEADER(krb5.h, AC_CHECK_HEADER([krb5.h],
V_INCLS="${V_INCLS} -I/usr/kerberos/include" V_INCLS="${V_INCLS} -I/usr/kerberos/include"
AC_DEFINE(NEED_KRB5_H,,[Include krb5.h]), AC_DEFINE(NEED_KRB5_H,,[Include krb5.h]),
use_openssl=no use_openssl=no
@ -188,7 +204,7 @@ if test "$use_openssl" = "yes"; then
saved_libs="${LIBS}" saved_libs="${LIBS}"
LIBS="${LIBS} -lssl -lcrypto" LIBS="${LIBS} -lssl -lcrypto"
AC_MSG_CHECKING([for OpenSSL >= 0.9.7]) AC_MSG_CHECKING([for OpenSSL >= 0.9.7])
AC_LINK_IFELSE(AC_LANG_PROGRAM([[#include <openssl/evp.h>]], [[OPENSSL_add_all_algorithms_conf();]]), AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <openssl/evp.h>]], [[OPENSSL_add_all_algorithms_conf();]])],
AC_MSG_RESULT(yes) AC_MSG_RESULT(yes)
use_openssl=yes, use_openssl=yes,
AC_MSG_RESULT(no) AC_MSG_RESULT(no)
@ -212,9 +228,9 @@ if test "$use_openssl" = "yes"; then
AC_MSG_CHECKING([whether d2i_X509() uses a const unsigned char**]) AC_MSG_CHECKING([whether d2i_X509() uses a const unsigned char**])
AC_LANG_PUSH([C++]) AC_LANG_PUSH([C++])
AC_COMPILE_IFELSE( AC_COMPILE_IFELSE(
AC_LANG_PROGRAM([[#include <openssl/x509.h>]], [AC_LANG_PROGRAM([[#include <openssl/x509.h>]],
[[const unsigned char** cpp = 0; [[const unsigned char** cpp = 0;
X509** x = 0; d2i_X509(x, cpp, 0);]]), X509** x = 0; d2i_X509(x, cpp, 0);]])],
AC_DEFINE(OPENSSL_D2I_X509_USES_CONST_CHAR,,[d2i_x509 uses const char**]) AC_DEFINE(OPENSSL_D2I_X509_USES_CONST_CHAR,,[d2i_x509 uses const char**])
AC_MSG_RESULT(yes), AC_MSG_RESULT(yes),
AC_MSG_RESULT(no)) AC_MSG_RESULT(no))
@ -288,7 +304,7 @@ freebsd*)
darwin*) darwin*)
AC_MSG_CHECKING([if we need to include arpa/nameser_compat.h]) AC_MSG_CHECKING([if we need to include arpa/nameser_compat.h])
AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[#include <arpa/nameser.h>]], [[HEADER *hdr; int d = NS_IN6ADDRSZ;]]), bro_ns_header_defined=yes, bro_ns_header_defined=no) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <arpa/nameser.h>]], [[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 the header is found, we don't need compatibility
if test "x$bro_ns_header_defined" = xyes; then if test "x$bro_ns_header_defined" = xyes; then
AC_MSG_RESULT(no) AC_MSG_RESULT(no)
@ -353,14 +369,14 @@ AC_LBL_CHECK_TYPE(u_int16_t, u_short)
AC_LBL_CHECK_TYPE(u_int8_t, u_char) AC_LBL_CHECK_TYPE(u_int8_t, u_char)
AC_HEADER_TIME AC_HEADER_TIME
AC_CHECK_HEADERS(memory.h netinet/in.h socket.h getopt.h) 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,,, AC_CHECK_HEADERS([net/ethernet.h netinet/ether.h netinet/if_ether.h sys/ethernet.h],,,
[#include <sys/types.h> [#include <sys/types.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <netinet/in.h> #include <netinet/in.h>
#include <net/if.h>]) #include <net/if.h>])
AC_CHECK_HEADERS(netinet/ip6.h,,, AC_CHECK_HEADERS([netinet/ip6.h],,,
[#include <sys/types.h> [#include <sys/types.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <netinet/in.h> #include <netinet/in.h>
@ -416,7 +432,7 @@ if test "$pcap_local" = "NO"; then
dnl ################################################ dnl ################################################
AC_MSG_CHECKING([for pcap_version in libpcap]) AC_MSG_CHECKING([for pcap_version in libpcap])
AC_LINK_IFELSE( AC_LINK_IFELSE(
AC_LANG_PROGRAM([extern char pcap_version[];], [puts(pcap_version);]), [AC_LANG_PROGRAM([extern char pcap_version[];], [puts(pcap_version);])],
AC_MSG_RESULT(yes) AC_MSG_RESULT(yes)
AC_DEFINE(PCAP_VERSION_STRING,,[Have a version string in libpcap]), AC_DEFINE(PCAP_VERSION_STRING,,[Have a version string in libpcap]),
AC_MSG_RESULT(no)) AC_MSG_RESULT(no))
@ -448,7 +464,7 @@ dnl #
AC_MSG_CHECKING([if char_traits defines all methods]) AC_MSG_CHECKING([if char_traits defines all methods])
AC_LANG_PUSH([C++]) AC_LANG_PUSH([C++])
AC_LINK_IFELSE( AC_LINK_IFELSE(
AC_LANG_PROGRAM([[ [AC_LANG_PROGRAM([[
#include <string> #include <string>
using namespace std; using namespace std;
class Foo { }; class Foo { };
@ -456,7 +472,7 @@ class Foo { };
char_traits<Foo*> foo; char_traits<Foo*> foo;
Foo f; Foo f;
Foo *fp; Foo *fp;
foo.assign(&fp, 10, &f);]]), foo.assign(&fp, 10, &f);]])],
AC_MSG_RESULT([yes]) AC_MSG_RESULT([yes])
basic_string_works=yes, basic_string_works=yes,
AC_MSG_RESULT([no]) AC_MSG_RESULT([no])
@ -575,17 +591,17 @@ else
bro_ns_initparse_works=no bro_ns_initparse_works=no
bro_res_mkquery_works=no bro_res_mkquery_works=no
AC_LINK_IFELSE(AC_LANG_PROGRAM([[#include <arpa/nameser.h>]], AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <arpa/nameser.h>]],
[[ns_initparse(0,0,0);]]), [[ns_initparse(0,0,0);]])],
bro_ns_initparse_works=yes) bro_ns_initparse_works=yes)
AC_LINK_IFELSE(AC_LANG_PROGRAM([[ AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <sys/types.h> #include <sys/types.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <netinet/in.h> #include <netinet/in.h>
#include <arpa/nameser.h> #include <arpa/nameser.h>
#include <resolv.h>]], #include <resolv.h>]],
[[int (*p)() = res_mkquery]]), bro_res_mkquery_works=yes) [[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 if test $bro_ns_initparse_works = yes && test $bro_res_mkquery_works = yes && test $nbdns = yes; then
AC_MSG_RESULT(yes) AC_MSG_RESULT(yes)