# $Id$ AC_PREREQ(2.50) AC_INIT(src/snort.c) AM_CONFIG_HEADER(config.h) # When changing the snort version, please also update the VERSION # definition in "src/win32/WIN32-Includes/config.h" AM_INIT_AUTOMAKE(snort,2.6.1.5) # Since we get -O2 from configure defaults, which doesn't work in 64bit # mode, let's make some changes here before calling _CC macros. AC_ARG_ENABLE(64bit-gcc, [ --enable-64bit-gcc Try to compile 64bit (only tested on Sparc Solaris 9).], [ CFLAGS="-O0 -g" CC="gcc -m64"; export CFLAGS CC ],) # Disable annoying practice of recursively re-running the autotools AM_MAINTAINER_MODE AM_PROG_CC_STDC AC_PROG_RANLIB AC_PROG_CC AC_PROG_LIBTOOL if test -n "$GCC"; then CFLAGS="$CFLAGS -Wall " fi AC_ARG_ENABLE(debug, [ --enable-debug Enable debugging options (bugreports and developers only)], [ if test -n "$GCC"; then CFLAGS="-O0 -DDEBUG -g" else CFLAGS="$CFLAGS -DDEBUG" fi ],) AC_ARG_ENABLE(profile, [ --enable-profile Enable profiling options (developers only)], [ if test -n "$GCC"; then CFLAGS="$CFLAGS -DPROFILE -pg" else CFLAGS="$CFLAGS -DPROFILE" fi ],) #AC_CANONICAL_HOST linux=no sunos4=no AC_C_BIGENDIAN SHELL="/bin/sh" case "$host" in *-openbsd2.6|*-openbsd2.5|*-openbsd2.4|*-openbsd2.3*) AC_DEFINE(OPENBSD,,[Define if OPENBSD]) AC_DEFINE(BROKEN_SIOCGIFMTU,,[Define if BROKEN_SIOCGIFMTU]) ;; *-openbsd*) AC_DEFINE(OPENBSD) ;; *-sgi-irix5*) AC_DEFINE(IRIX,,[Define if IRIX]) no_libsocket=yes no_libnsl=yes if test -z "$GCC"; then sgi_cc=yes fi LDFLAGS=${LDFLAGS} -L/usr/local/lib extra_incl=-I/usr/local/include ;; *-sgi-irix6*) AC_DEFINE(IRIX) no_libsocket=yes no_libnsl=yes if test -z "$GCC"; then sgi_cc=yes fi LDFLAGS=${LDFLAGS} -L/usr/local/lib extra_incl=-I/usr/local/include ;; *-solaris*) AC_DEFINE(SOLARIS,,[Define if SOLARIS]) CPPFLAGS="${CPPFLAGS} -DBSD_COMP -D_REENTRANT" ;; *-sunos*) AC_DEFINE(SUNOS,,[Define if SUNOS]) sunos4=yes ;; *-linux*) linux=yes AC_DEFINE(LINUX,,[Define if LINUX]) # libpcap doesn't even LOOK at the timeout you give it under Linux AC_DEFINE(PCAP_TIMEOUT_IGNORED,,[Define if PCAP_TIMEOUT_IGNORED]) #AC_SUBST(extra_incl) #extra_incl=-I/usr/include/pcap ;; *-hpux10*|*-hpux11*) AC_DEFINE(HPUX,,[Define if HPUX]) AC_DEFINE(WORDS_BIGENDIAN) AC_SUBST(extra_incl) extra_incl=-I/usr/local/include ;; *-freebsd*) AC_DEFINE(FREEBSD,,[Define if FREEBSD]) ;; *-bsdi*) AC_DEFINE(BSDI,,[Define if BSDI]) ;; *-aix*) AC_DEFINE(AIX,,[Define if AIX]) broken_types=yes ;; *-osf4*) AC_DEFINE(OSF1,,[Define if OSF1]) tru64_types=yes ;; *-osf5.1*) AC_DEFINE(OSF1) ;; *-tru64*) AC_DEFINE(OSF1) tru64_types=yes ;; # it is actually -apple-darwin1.2 or -apple-rhapsody5.x but lets stick with this for the moment *-apple*) AC_DEFINE(MACOS,,[Define if MACOS]) AC_DEFINE(BROKEN_SIOCGIFMTU) LDFLAGS="${LDFLAGS} -L/sw/lib" extra_incl=-I/sw/include esac # any sparc platform has to have this one defined. AC_MSG_CHECKING(for sparc alignment) if eval "echo $host_cpu|grep -i sparc >/dev/null"; then AC_DEFINE(WORDS_MUSTALIGN,,[Define if WORDS_MUSTALIGN]) AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) fi dnl checking headers AC_CHECK_HEADERS(strings.h) AC_CHECK_HEADERS(string.h) AC_CHECK_HEADERS(stdlib.h) AC_CHECK_HEADERS(unistd.h) AC_CHECK_HEADERS(sys/sockio.h) AC_CHECK_HEADERS(paths.h) dnl make sure we've got all our libraries if test -z "$no_libnsl"; then AC_CHECK_LIB(nsl, inet_ntoa) fi if test -z "$no_libsocket"; then AC_CHECK_LIB(socket, socket) fi LIBS="${LIBS}" # SunOS4 has several things `broken' if test "$sunos4" != "no"; then AC_CHECK_FUNCS(vsnprintf,, LIBS=" $LIBS -ldb") AC_CHECK_FUNCS(strtoul,, LIBS=" $LIBS -l44bsd") fi # some funky macro to be backwards compatible with earlier autoconfs # in current they have AC_CHECK_DECLS AC_DEFUN(SN_CHECK_DECL,[ AC_MSG_CHECKING([whether $1 must be declared]) AC_CACHE_VAL(sn_cv_decl_needed_$1, [AC_TRY_COMPILE([ #include #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_STRINGS_H #include #endif #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_UNISTD_H #include #endif #include #include #include ], [char *(*pfn) = (char *(*)) $1], eval "sn_cv_decl_needed_$1=no",eval "sn_cv_decl_needed_$1=yes") ]) if eval "test \"`echo '$sn_cv_decl_needed_'$1`\" != no"; then AC_MSG_RESULT(yes) ifelse([$2], , :, [$2]) else AC_MSG_RESULT(no) ifelse([$3], , ,[$3]) fi ])dnl AC_DEFUN(SN_CHECK_DECLS, [for sn_decl in $1 do sn_def_decl=`echo $sn_decl | tr [a-z] [A-Z]` SN_CHECK_DECL($sn_decl, [ AC_DEFINE_UNQUOTED(NEED_DECL_$sn_def_decl, 1, [you have this cuz autoheader is dumb]) $2], $3)dnl done ]) # some stuff for declarations which were missed on sunos4 platform too. # # add `#undef NEED_DECL_FUNCTIONAME to acconfig.h` because autoheader # fails to work properly with custom macroses. # you will see also #undef for each SN_CHECK_DECLS macros invocation # because autoheader doesn't execute shell script commands. # it is possible to make loops using m4 but the code would look even # more confusing.. SN_CHECK_DECLS(printf fprintf syslog puts fputs fputc fopen \ fclose fwrite fflush getopt bzero bcopy memset strtol \ strcasecmp strncasecmp strerror perror socket sendto \ vsnprintf snprintf strtoul) AC_CHECK_FUNCS(snprintf) AC_CHECK_FUNCS(strlcpy) AC_CHECK_FUNCS(strlcat) AC_CHECK_FUNCS(strerror) AC_TRY_COMPILE([ #include ],[char *foo; foo = sys_errlist[0];], AC_DEFINE(ERRLIST_PREDEFINED,,[Define if ERRLIST_PREDEFINED])) AC_MSG_CHECKING(for __FUNCTION__) AC_TRY_COMPILE([ #include ],[printf ("%s", __FUNCTION__);], sn_cv_have___FUNCTION__=yes, sn_cv__have___FUNCTION__=no) if test "x$sn_cv_have___FUNCTION__" = "xyes"; then AC_MSG_RESULT(yes) AC_DEFINE(HAVE___FUNCTION__, 1, [Define if the compiler understands __FUNCTION__.]) else AC_MSG_RESULT(no) AC_MSG_CHECKING(for __func__) AC_TRY_COMPILE([ #include ],[printf ("%s", __func__);], sn_cv_have___func__=yes, sn_cv__have___func__=no) if test "x$sn_cv_have___func__" = "xyes"; then AC_MSG_RESULT(yes) AC_DEFINE(HAVE___func__, 1, [Define if the compiler understands __func__.]) AC_DEFINE(__FUNCTION__, __func__, [Define __FUNCTION__ as required.]) else AC_MSG_RESULT(no) AC_DEFINE(__FUNCTION__, "mystery function") fi fi AC_ARG_ENABLE(pthread, [ --enable-pthread Enable pthread support], LIBS="$LIBS -lpthread", ) AC_ARG_WITH(libpcap_includes, [ --with-libpcap-includes=DIR libpcap include directory], [with_libpcap_includes="$withval"],[with_libpcap_includes=no]) AC_ARG_WITH(libpcap_libraries, [ --with-libpcap-libraries=DIR libpcap library directory], [with_libpcap_libraries="$withval"],[with_libpcap_libraries=no]) if test "$with_libpcap_includes" != "no"; then CPPFLAGS="${CPPFLAGS} -I${with_libpcap_includes}" fi if test "$with_libpcap_libraries" != "no"; then LDFLAGS="${LDFLAGS} -L${with_libpcap_libraries}" fi AC_CHECK_LIB(m, floor,,) LPCAP="" AC_CHECK_LIB(pcap, pcap_datalink,, LPCAP="no") if test "$LPCAP" = "no"; then echo echo " ERROR! Libpcap library/headers not found, go get it from" echo " http://www.tcpdump.org" echo " or use the --with-libpcap-* options, if you have it installed" echo " in unusual place" exit 1 fi default_directory="/usr /usr/local" AC_DEFUN(FAIL_MESSAGE,[ echo echo echo "**********************************************" echo " ERROR: unable to find" $1 echo " checked in the following places" for i in `echo $2`; do echo " $i" done echo "**********************************************" echo exit 1 ]) AC_ARG_WITH(libpcre_includes, [ --with-libpcre-includes=DIR libpcre include directory], [with_libpcre_includes="$withval"],[with_libpcre_includes=no]) AC_ARG_WITH(libpcre_libraries, [ --with-libpcre-libraries=DIR libpcre library directory], [with_libpcre_libraries="$withval"],[with_libpcre_libraries=no]) if test "$with_libpcre_includes" != "no"; then CPPFLAGS="${CPPFLAGS} -I${with_libpcre_includes}" else CPPFLAGS="${CPPFLAGS} `pcre-config --cflags`" fi if test "$with_libpcre_libraries" != "no"; then LDFLAGS="${LDFLAGS} -L${with_libpcre_libraries}" else LDFLAGS="${LDFLAGS} `pcre-config --libs`" fi # PCRE configuration (required) # Verify that we have the headers PCRE_H="" AC_CHECK_HEADERS(pcre.h,, PCRE_H="no") if test "$PCRE_H" = "no"; then echo echo " ERROR! Libpcre header not found, go get it from" echo " http://www.pcre.org" exit 1 fi # Verify that we have the library PCRE_L="" AC_CHECK_LIB(pcre, pcre_compile, ,PCRE_L="no") if test "$PCRE_L" = "no"; then echo echo " ERROR! Libpcre library not found, go get it from" echo " http://www.pcre.org" echo exit 1 fi AC_ARG_WITH(libnet, [ --with-libnet=DIR libnet directory], [with_libnet="$withval"],[with_libnet=no]) AC_ARG_WITH(libnet_includes, [ --with-libnet-includes=DIR libnet include directory], [with_libnet_includes="$withval"],[with_libnet_includes=no]) AC_ARG_WITH(libnet_libraries, [ --with-libnet-libraries=DIR libnet library directory], [with_libnet_libraries="$withval"],[with_libnet_libraries=no]) AC_PATH_PROG([libnet_config],libnet-config,[no],$with_libnet:$PATH) if test "$with_libnet_includes" != "no"; then CPPFLAGS="${CPPFLAGS} -I${with_libnet_includes}" fi if test "$with_libnet_libraries" != "no"; then LDFLAGS="${LDFLAGS} -L${with_libnet_libraries}" fi AC_ARG_WITH(dnet_includes, [ --with-dnet-includes=DIR libdnet include directory], [with_dnet_includes="$withval"],[with_dnet_includes=no]) AC_ARG_WITH(dnet_libraries, [ --with-dnet-libraries=DIR libdnet library directory], [with_dnet_libraries="$withval"],[with_dnet_libraries=no]) if test "$with_dnet_includes" != "no"; then CPPFLAGS="${CPPFLAGS} -I${with_dnet_includes}" fi if test "$with_dnet_libraries" != "no"; then LDFLAGS="${LDFLAGS} -L${with_dnet_libraries}" fi AC_ARG_WITH(mysql, [ --with-mysql=DIR support for mysql], [ with_mysql="$withval" ], [ with_mysql=no ]) if test "$with_mysql" != "no"; then if test "$with_mysql" = "yes"; then mysql_directory="$default_directory"; mysql_fail="yes" elif test -d "$withval"; then mysql_directory="$withval" mysql_fail="yes" elif test "$with_mysql" = ""; then mysql_directory="$default_directory"; mysql_fail="yes" fi AC_MSG_CHECKING(for mysql) for i in $mysql_directory; do if test -r $i/include/mysql/mysql.h; then MYSQL_DIR=$i MYSQL_INC_DIR=$i/include/mysql elif test -r $i/include/mysql.h; then MYSQL_DIR=$i MYSQL_INC_DIR=$i/include fi done if test -z "$MYSQL_DIR"; then if test "$mysql_fail" != "no"; then tmp="" for i in $mysql_directory; do tmp="$tmp $i/include $i/include/mysql" done FAIL_MESSAGE("mysql headers (mysql.h)", $tmp) else AC_MSG_RESULT(no) fi else for i in lib libmysql/.libs lib/mysql; do str="$MYSQL_DIR/$i/libmysqlclient.*" for j in `echo $str`; do if test -r $j; then MYSQL_LIB_DIR="$MYSQL_DIR/$i" break 2 fi done done if test -z "$MYSQL_LIB_DIR"; then if test "$mysql_fail" != "no"; then FAIL_MESSAGE("mysqlclient library", "$MYSQL_DIR/lib $MYSQL_DIR/lib/mysql") else AC_MSG_RESULT(no) fi else AC_MSG_RESULT(yes) LDFLAGS="${LDFLAGS} -L${MYSQL_LIB_DIR}" CPPFLAGS="${CPPFLAGS} -I${MYSQL_INC_DIR} -DENABLE_MYSQL" AC_CHECK_LIB(z, compress) LIBS="-lmysqlclient ${LIBS}" fi fi fi AC_ARG_WITH(odbc, [ --with-odbc=DIR support for odbc], [ with_odbc="$withval" ], [ with_odbc=no ]) if test "$with_odbc" != "no"; then if test "$with_odbc" = "yes"; then odbc_directory="$default_directory" odbc_fail="yes" elif test -d $withval; then odbc_directory="$withval $default_directory"; odbc_fail="yes" elif test "$with_odbc" = ""; then odbc_directory="$default_directory" odbc_fail="no" fi AC_MSG_CHECKING("for odbc") for i in $odbc_directory; do if test -r $i/include/sql.h; then if test -r $i/include/sqlext.h; then if test -r $i/include/sqltypes.h; then ODBC_DIR=$i ODBC_INC_DIR=$i/include fi fi fi done if test -z "$ODBC_DIR"; then if test "$odbc_fail" != "no"; then tmp="" for i in $odbc_directory; do tmp="$tmp $i/include" done FAIL_MESSAGE("odbc headers (sql.h sqlext.h sqltypes.h)", $tmp) else AC_MSG_RESULT(no) fi else str="$ODBC_DIR/lib/libodbc.*" for j in `echo $str`; do if test -r $j; then ODBC_LIB_DIR="$ODBC_DIR/lib" ODBC_LIB="odbc" fi done dnl if test -z "$ODBC_LIB_DIR"; then dnl str="$ODBC_DIR/lib/libiodbc.*" dnl for j in `echo $str`; do dnl if test -r $j; then dnl ODBC_LIB_DIR="$ODBC_DIR/lib" dnl ODBC_LIB="iodbc" dnl fi dnl done dnl fi if test -z "$ODBC_LIB_DIR"; then if test "$odbc_fail" != "no"; then FAIL_MESSAGE("odbc library (libodbc)", "$ODBC_DIR/lib") else AC_MSG_RESULT(no) fi else AC_MSG_RESULT(yes) LDFLAGS="${LDFLAGS} -L${ODBC_LIB_DIR}" CPPFLAGS="${CPPFLAGS} -I${ODBC_INC_DIR} -DENABLE_ODBC" LIBS="${LIBS} -l$ODBC_LIB" fi fi fi AC_ARG_WITH(postgresql, [ --with-postgresql=DIR support for postgresql], [ with_postgresql="$withval" ], [ with_postgresql=no ]) AC_ARG_WITH(pgsql_includes, [ --with-pgsql-includes=DIR postgresql include directory], [with_pgsql_includes="$withval" ], [with_pgsql_includes=no ]) if test "$with_postgresql" != "no"; then if test "$with_postgresql" = "yes"; then postgresql_directory="$default_directory /usr/local/pgsql /usr/pgsql /usr/local" postgresql_fail="yes" elif test -d $withval; then postgresql_directory="$withval $default_directory /usr/local/pgsql /usr/pgsql" postgresql_fail="yes" elif test "$with_postgresql" = ""; then postgresql_directory="$default_directory /usr/local/pgsql /usr/pgsql" postgresql_fail="no" fi AC_MSG_CHECKING(for postgresql) if test "$with_pgsql_includes" != "no"; then for i in $with_pgsql_includes $postgresql_directory; do if test -r $i/libpq-fe.h; then POSTGRESQL_INC_DIR=$i elif test -r $i/include/pgsql/libpq-fe.h; then POSTGRESQL_INC_DIR=$i/include/pgsql elif test -r $i/include/libpq-fe.h; then POSTGRESQL_INC_DIR=$i/include elif test -r $i/include/postgresql/libpq-fe.h; then POSTGRESQL_INC_DIR=$i/include/postgresql fi done fi if test -z "$POSTGRESQL_INC_DIR"; then for i in $postgresql_directory; do if test -r $i/include/pgsql/libpq-fe.h; then POSTGRESQL_DIR=$i POSTGRESQL_INC_DIR=$i/include/pgsql elif test -r $i/include/libpq-fe.h; then POSTGRESQL_DIR=$i POSTGRESQL_INC_DIR=$i/include elif test -r $i/include/postgresql/libpq-fe.h; then POSTGRESQL_DIR=$i POSTGRESQL_INC_DIR=$i/include/postgresql fi done fi if test -z "$POSTGRESQL_INC_DIR"; then if test "$postgresql_fail" != "no"; then tmp="" if test "$with_pgsql_includes" != "no"; then tmp="$tmp $with_pgsql_includes" fi for i in $postgresql_directory; do tmp="$tmp $i/include $i/include/pgsql" done FAIL_MESSAGE("postgresql header file (libpq-fe.h)", $tmp) else AC_MSG_RESULT(no) fi fi if test -z "$POSTGRESQL_DIR"; then for dir in $postgresql_directory; do for i in lib lib/pgsql; do str="$dir/$i/libpq.*" for j in `echo $str`; do if test -r $j; then POSTGRESQL_LIB_DIR="$dir/$i" break 2 fi done done done else POSTGRESQL_LIB_DIR="$POSTGRESQL_DIR/lib" fi if test -z "$POSTGRESQL_LIB_DIR"; then if test "$postgresql_fail" != "no"; then FAIL_MESSAGE("postgresql library libpq", "$POSTGRESQL_DIR/lib $POSTGRESQL_DIR/lib/pgsql") else AC_MSG_RESULT(no); fi else AC_MSG_RESULT(yes) LDFLAGS="${LDFLAGS} -L${POSTGRESQL_LIB_DIR}" CPPFLAGS="${CPPFLAGS} -I${POSTGRESQL_INC_DIR} -DENABLE_POSTGRESQL" AC_CHECK_LIB(pq, PQexec,, PQLIB="no") if test "$PQLIB" != "no"; then LIBS="${LIBS} -lpq" else echo echo " ERROR! libpq (postgresql) not found!" echo exit 1 fi fi fi AC_ARG_WITH(oracle, [ --with-oracle=DIR support for oracle], [ with_oracle="$withval" ], [ with_oracle=no ]) if test "$with_oracle" != "no"; then if test "$with_oracle" = "yes"; then oracle_directory="$default_directory ${ORACLE_HOME}" oracle_fail="yes" elif test -d $withval; then oracle_directory="$withval $default_directory ${ORACLE_HOME}" oracle_fail="yes" elif test "$with_oracle" = ""; then oracle_directory="$default_directory ${ORACLE_HOME}" oracle_fail="no" fi AC_MSG_CHECKING(for oracle) for i in $oracle_directory; do if test -r $i/rdbms/demo/oci.h; then ORACLE_DIR=$i fi done if test -z "$ORACLE_DIR"; then if test "$oracle_fail" != "no"; then tmp="" for i in $oracle_directory; do tmp="$tmp $i/rdbms/demo" done FAIL_MESSAGE("OCI header file (oci.h)", $tmp) else AC_MSG_RESULT(no) fi else for i in rdbms/demo rdbms/public network/public; do ORACLE_CPP_FLAGS="$ORACLE_CPP_FLAGS -I$ORACLE_DIR/$i" done ORACLE_LIB_DIR="$ORACLE_DIR/lib" AC_MSG_RESULT(yes) LDFLAGS="${LDFLAGS} -L${ORACLE_LIB_DIR}" CPPFLAGS="${CPPFLAGS} ${ORACLE_CPP_FLAGS} -DENABLE_ORACLE" ORACLE_LIBS="-lclntsh" if test -r $ORACLE_LIB_DIR/libwtc9.so; then ORACLE_LIBS="${ORACLE_LIBS} -lwtc9" elif test -r $ORACLE_LIB_DIR/libwtc8.so; then ORACLE_LIBS="${ORACLE_LIBS} -lwtc8" fi LIBS="${LIBS} ${ORACLE_LIBS}" fi fi dnl dnl Prelude support dnl AC_ARG_ENABLE(prelude, [ --enable-prelude Enable Prelude Hybrid IDS support], want_prelude="$enableval", want_prelude=no) if test x$want_prelude = xyes; then AM_PATH_LIBPRELUDE(0.9.6, use_prelude=yes, use_prelude=no) if test "$use_prelude" = "yes"; then LDFLAGS="${LDFLAGS} ${LIBPRELUDE_LDFLAGS}" LIBS="$LIBS ${LIBPRELUDE_LIBS}" CFLAGS="$CFLAGS ${LIBPRELUDE_PTHREAD_CFLAGS}" AC_DEFINE(HAVE_LIBPRELUDE,, Define whether Prelude support is enabled) fi fi AC_ARG_ENABLE(sourcefire, [ --enable-sourcefire Enable Sourcefire specific build options], CFLAGS="$CFLAGS -DSOURCEFIRE -DPERF_PROFILING -DSTREAM4_UDP -DNOCOREFILE",) AC_ARG_ENABLE(stream4udp, [ --enable-stream4udp Enable UDP session tracking in Stream4], CFLAGS="$CFLAGS -DSTREAM4_UDP",) AC_ARG_ENABLE(dynamicplugin, [ --enable-dynamicplugin Enable Ability to dynamically load preprocessors, detection engine, and rules lib (on by default, use --disable to not use dynamic libraries)], use_dynamic="$enableval", use_dynamic=yes) AM_CONDITIONAL(HAVE_DYNAMIC_PLUGINS, test x$use_dynamic = xyes) if test x$use_dynamic = xyes; then CFLAGS="$CFLAGS -DDYNAMIC_PLUGIN" AC_CHECK_LIB(dl, dlsym,, DLLIB="no") if test "$DLLIB" != "no"; then LIBS="$LIBS -ldl" else AC_CHECK_LIB(c, dlsym,, DLCLIB="no") if test "$DLCLIB" = "no"; then echo echo " ERROR! programmatic interface to dynamic link loader" echo " not found. Cannot use dynamic plugin libraries." echo exit 1 fi fi fi AC_ARG_ENABLE(timestats, [ --enable-timestats Enable TimeStats functionality], CFLAGS="$CFLAGS -DTIMESTATS",) AC_ARG_ENABLE(perfprofiling, [ --enable-perfprofiling Enable preprocessor and rule performance profiling], CFLAGS="$CFLAGS -DPERF_PROFILING",) AC_ARG_ENABLE(linux-smp-stats, [ --enable-linux-smp-stats Enable statistics reporting through proc], CFLAGS="$CFLAGS -DLINUX_SMP",) AC_ARG_ENABLE(inline, [ --enable-inline Use the libipq interface for inline snort], enable_inline="$enableval", enable_inline="no") AC_ARG_ENABLE(ipfw, [ --enable-ipfw Enable ipfw Divert mode for use with inline], enable_ipfw="$enableval", enable_ipfw="no") if test "$enable_inline" != "no"; then if test "$enable_inline" = "yes"; then CFLAGS="$CFLAGS -DGIDS" if test "$enable_ipfw" = "yes"; then CFLAGS="$CFLAGS -DIPFW" else AC_ARG_WITH(libipq_includes, [ --with-libipq-includes=DIR libipq include directory], [with_libipq_includes="$withval"],[with_libipq_includes=no]) AC_ARG_WITH(libipq_libraries, [ --with-libipq-libraries=DIR libipq library directory], [with_libipq_libraries="$withval"],[with_libipq_libraries=no]) if test "$with_libipq_includes" != "no"; then CPPFLAGS="${CPPFLAGS} -I${with_libipq_includes}" fi AC_CHECK_HEADER(libipq.h,,[AC_ERROR(libipq.h not found ...)]) if test "$with_libipq_libraries" != "no"; then LDFLAGS="${LDFLAGS} -L${with_libipq_libraries}" fi LIPQ="" AC_CHECK_LIB(ipq, ipq_set_mode,, LIPQ="no") if test "$LIPQ" = "no"; then echo echo " ERROR! Libipq library/headers not found, go get it from" echo " www.netfilter.org or use the --with-libipq-* options, " echo " if you have it installed in unusual place" echo exit 1 fi fi LIBNET_INC_DIR="" if test -n "$with_libnet_includes" -a "$with_libnet_includes" != "no"; then libnet_dir="${with_libnet_includes}" else libnet_dir="/usr/include /usr/local/include /sw/include" fi AC_MSG_CHECKING("for libnet.h version 1.0.x") for i in $libnet_dir; do if test -r $i/libnet.h; then LIBNET_INC_DIR=$i fi done if test "$LIBNET_INC_DIR" != ""; then if eval "grep LIBNET_VERSION $LIBNET_INC_DIR/libnet.h | grep -v 1.0 >/dev/null"; then FAIL_MESSAGE("libnet 1.0.x (libnet.h)", $LIBNET_INC_DIR) fi if test "$libnet_config" != "no"; then CFLAGS="${CFLAGS} `$libnet_config --defines` `$libnet_config --cflags`" LIBS="${LIBS} `$libnet_config --libs`" fi CPPFLAGS="${CPPFLAGS} -I${LIBNET_INC_DIR}" AC_MSG_RESULT($i) else AC_MSG_RESULT(no) AC_MSG_ERROR("libnet 1.0.x could not be found. please download and install the library from http://www.packetfactory.net/libnet/") fi fi fi AC_ARG_ENABLE(inline-init-failopen, [ --enable-inline-init-failopen Enable Fail Open during initialization for Inline Mode (adds pthread support implicitly)], CFLAGS="$CFLAGS -DINLINE_FAILOPEN" LIBS="$LIBS -lpthread", ) AC_ARG_ENABLE(flexresp, [ --enable-flexresp Flexible Responses on hostile connection attempts], [ CPPFLAGS="${CPPFLAGS} -DENABLE_RESPONSE"],) if test "$enable_flexresp" != "no" -a "$enable_flexresp" = "yes"; then if test "$enable_flexresp" = "yes" -a "$enable_flexresp2" = "yes"; then echo echo " ERROR! --enable-flexresp cannot be used with --enable-flexresp2" exit fi if test "$libnet_config" != "no"; then CPPFLAGS="${CPPFLAGS} `$libnet_config --defines --cflags`" LIBS="${LIBS} `$libnet_config --libs`" if test `$libnet_config --cflags | wc -c` = "1"; then CPPFLAGS="${CPPFLAGS} -I/usr/local/include -I/sw/include" LIBNET_CONFIG_BROKEN_CFLAGS=yes fi if test `$libnet_config --libs | wc -c` = "1"; then AC_MSG_WARN(libnet-config --libs is broken on your system. If you) AC_MSG_WARN(are using a precompiled package please notify the) AC_MSG_WARN(maintainer.) LDFLAGS="${LDFLAGS} -L/usr/local/lib -L/sw/lib" LIBS="${LIBS} -lnet" fi fi LNET="" AC_CHECK_HEADERS(libnet.h,, LNET="no") if test "$LNET" = "no"; then echo echo " ERROR! Libnet header not found, go get it from" echo " http://www.packetfactory.net/projects/libnet/" echo " or use the --with-libnet-* options, if you have it installed" echo " in unusual place" exit 1 fi AC_MSG_CHECKING(for libnet version 1.0.2a) if test "${LIBNET_CONFIG_BROKEN_CFLAGS}" = "yes"; then if test -n "$with_libnet_includes" -a "$with_libnet_includes" != "no"; then libnet_dir="${with_libnet_includes}" else libnet_dir="/usr/include /usr/local/include /sw/include" fi else libnet_dir=`$libnet_config --cflags | cut -dI -f2` fi LIBNET_INC_DIR="" for i in $libnet_dir; do if test -r $i/libnet.h; then LIBNET_INC_DIR=$i fi done if test "$LIBNET_INC_DIR" != ""; then if eval "grep LIBNET_VERSION $LIBNET_INC_DIR/libnet.h | grep -v 1.0.2a >/dev/null"; then AC_MSG_RESULT(no) echo echo " ERROR! Snort with --enable-flexresp will *only* work with" echo " libnet version 1.0.2a, go get it from" echo " http://www.packetfactory.net/projects/libnet/" FAIL_MESSAGE("libnet 1.0.2a (libnet.h)", $LIBNET_INC_DIR) fi AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) FAIL_MESSAGE("libnet 1.0.2a (libnet.h)", $libnet_dir) fi LNET="" AC_CHECK_LIB(net, libnet_build_ip,, LNET="no") if test "$LNET" = "no"; then echo echo " ERROR! Libnet library not found, go get it from" echo " http://www.packetfactory.net/projects/libnet/" echo " or use the --with-libnet-* options, if you have it installed" echo " in unusual place" exit 1 fi fi AC_ARG_ENABLE(flexresp2, [ --enable-flexresp2 NEW Flexible Responses on hostile connection attempts], [ CPPFLAGS="${CPPFLAGS} -DENABLE_RESPONSE2 `dnet-config --cflags`" LDFLAGS="${LDFLAGS} `dnet-config --libs`"],) if test "$enable_flexresp2" != "no" -a "$enable_flexresp2" = "yes"; then if test "$enable_flexresp2" = "yes" -a "$enable_flexresp" = "yes"; then echo echo " ERROR! --enable-flexresp2 cannot be used with --enable-flexresp" exit fi DNET="" AC_CHECK_HEADERS(dnet.h,, DNET="no") if test "$DNET" = "no"; then echo echo " ERROR! Libdnet header not found, go get it from" echo " http://libdnet.sourceforge.net or use the --with-dnet-*" echo " options, if you have it installed in an unusual place" exit fi DNET="" AC_CHECK_LIB(dnet, eth_set,, DNET="no") if test "$DNET" = "no"; then echo echo " ERROR! Libdnet header not found, go get it from" echo " http://libdnet.sourceforge.net or use the --with-dnet-*" echo " options, if you have it installed in an unusual place" exit fi fi AC_ARG_ENABLE(react, [ --enable-react Intercept and terminate offending HTTP accesses], [ CPPFLAGS="${CPPFLAGS} -DENABLE_REACT"],) if test "$enable_react" != "no" -a "$enable_react" = "yes"; then if test "$enable_flexresp" = "yes" -a "$enable_flexresp" = "yes"; then echo echo " ERROR! --enable-react cannot be used with --enable-flexresp" echo " because it is AUTOMATICALLY enabled with --enable-flexresp" exit fi if test "$libnet_config" != "no"; then CPPFLAGS="${CPPFLAGS} `$libnet_config --defines --cflags`" LDFLAGS="${LDFLAGS} `$libnet_config --libs`" if test `$libnet_config --cflags | wc -c` = "1"; then CPPFLAGS="${CPPFLAGS} -I/usr/local/include -I/sw/include" LIBNET_CONFIG_BROKEN_CFLAGS=yes fi if test `$libnet_config --libs | wc -c` = "1"; then AC_MSG_WARN(libnet-config --libs is broken on your system. If you) AC_MSG_WARN(are using a precompiled package please notify the) AC_MSG_WARN(maintainer.) LDFLAGS="${LDFLAGS} -L/usr/local/lib -L/sw/lib" LIBS="${LIBS} -lnet" fi fi LNET="" AC_CHECK_HEADERS(libnet.h,, LNET="no") if test "$LNET" = "no"; then echo echo " ERROR! Libnet header not found, go get it from" echo " http://www.packetfactory.net/projects/libnet/" echo " or use the --with-libnet-* options, if you have it installed" echo " in unusual place" exit fi AC_MSG_CHECKING(for libnet version 1.0.2a) if test "${LIBNET_CONFIG_BROKEN_CFLAGS}" = "yes"; then if test -n "$with_libnet_includes" -a "$with_libnet_includes" != "no"; then libnet_dir="${with_libnet_includes}" else libnet_dir="/usr/include /usr/local/include /sw/include" fi else libnet_dir=`$libnet_config --cflags | cut -dI -f2` fi LIBNET_INC_DIR="" for i in $libnet_dir; do if test -r $i/libnet.h; then LIBNET_INC_DIR=$i fi done if test "$LIBNET_INC_DIR" != ""; then if eval "grep LIBNET_VERSION $LIBNET_INC_DIR/libnet.h | grep -v 1.0.2a >/dev/null"; then AC_MSG_RESULT(no) echo echo " ERROR! Snort with --enable-react will *only* work with" echo " libnet version 1.0.2a, go get it from" echo " http://www.packetfactory.net/projects/libnet/" FAIL_MESSAGE("libnet 1.0.2a (libnet.h)", $LIBNET_INC_DIR) fi AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) FAIL_MESSAGE("libnet 1.0.2a (libnet.h)", $libnet_dir) fi LNET="" AC_CHECK_LIB(net, libnet_build_ip,, LNET="no") if test "$LNET" = "no"; then echo echo " ERROR! Libnet library not found, go get it from" echo " http://www.packetfactory.net/projects/libnet/" echo " or use the --with-libnet-* options, if you have it installed" echo " in unusual place" exit fi fi AC_ARG_ENABLE(aruba, [ --enable-aruba Enable Aruba output plugin], CFLAGS="$CFLAGS -DARUBA",) AC_ARG_ENABLE(gre, [ --enable-gre Enable GRE Decoder], CFLAGS="$CFLAGS -DGRE",) if test "$tru64_types" = "yes"; then AC_CHECK_TYPE(u_int8_t, unsigned char) AC_CHECK_TYPE(u_int16_t, unsigned short) AC_CHECK_TYPE(u_int32_t, unsigned int) else if test "$broken_types" = "yes" ; then AC_CHECK_TYPE(u_int8_t, unsigned char) AC_CHECK_TYPE(u_int16_t, unsigned short) AC_CHECK_TYPE(u_int32_t, unsigned long int) else AC_CHECK_TYPE(u_int8_t, uint8_t) AC_CHECK_TYPE(u_int16_t, uint16_t) AC_CHECK_TYPE(u_int32_t, uint32_t) fi fi # let's make some fixes.. CFLAGS=`echo $CFLAGS |sed -e 's/-I\/usr\/include //g'` CPPFLAGS=`echo $CPPFLAGS | sed -e 's/-I\/usr\/include //g'` if test $GCC = "yes" ; then echo `$CC -v 2>&1` | grep "version 4" > /dev/null if test $? = 0 ; then CFLAGS="$CFLAGS -fno-strict-aliasing" CPPFLAGS="$CPPFLAGS -fno-strict-aliasing" fi fi INCLUDES='-I$(top_srcdir) -I$(top_srcdir)/src -I$(top_srcdir)/src/sfutil $(extra_incl) -I$(top_srcdir)/src/output-plugins -I$(top_srcdir)/src/detection-plugins -I$(top_srcdir)/src/dynamic-plugins -I$(top_srcdir)/src/preprocessors -I$(top_srcdir)/src/preprocessors/flow -I$(top_srcdir)/src/preprocessors/portscan -I$(top_srcdir)/src/preprocessors/flow/int-snort -I$(top_srcdir)/src/preprocessors/HttpInspect/include -I$(top_srcdir)/src/preprocessors/Stream5' AC_SUBST(INCLUDES) AC_PROG_INSTALL AC_OUTPUT(Makefile \ src/Makefile \ src/sfutil/Makefile \ src/detection-plugins/Makefile \ src/dynamic-plugins/Makefile \ src/dynamic-plugins/sf_engine/Makefile \ src/dynamic-plugins/sf_engine/examples/Makefile \ src/dynamic-plugins/sf_preproc_example/Makefile \ src/dynamic-preprocessors/Makefile \ src/dynamic-preprocessors/ftptelnet/Makefile \ src/dynamic-preprocessors/smtp/Makefile \ src/dynamic-preprocessors/ssh/Makefile \ src/dynamic-preprocessors/dcerpc/Makefile \ src/dynamic-preprocessors/dns/Makefile \ src/dynamic-examples/Makefile \ src/dynamic-examples/dynamic-preprocessor/Makefile \ src/dynamic-examples/dynamic-rule/Makefile \ src/output-plugins/Makefile \ src/preprocessors/Makefile \ src/preprocessors/HttpInspect/Makefile \ src/preprocessors/HttpInspect/include/Makefile \ src/preprocessors/HttpInspect/utils/Makefile \ src/preprocessors/HttpInspect/anomaly_detection/Makefile \ src/preprocessors/HttpInspect/client/Makefile \ src/preprocessors/HttpInspect/event_output/Makefile \ src/preprocessors/HttpInspect/mode_inspection/Makefile \ src/preprocessors/HttpInspect/normalization/Makefile \ src/preprocessors/HttpInspect/server/Makefile \ src/preprocessors/HttpInspect/session_inspection/Makefile \ src/preprocessors/HttpInspect/user_interface/Makefile \ src/preprocessors/flow/Makefile \ src/preprocessors/flow/int-snort/Makefile \ src/preprocessors/flow/portscan/Makefile \ src/preprocessors/Stream5/Makefile \ src/parser/Makefile \ doc/Makefile \ contrib/Makefile \ schemas/Makefile \ rpm/Makefile \ m4/Makefile \ etc/Makefile \ templates/Makefile \ src/win32/Makefile)