# -*- Autoconf -*- # Process this file with autoconf to produce a configure script. AC_PREREQ(2.50) AC_INIT(src/barnyard2.c) AM_CONFIG_HEADER(config.h) AM_INIT_AUTOMAKE(barnyard2,1.13) AC_CONFIG_MACRO_DIR([m4]) LT_INIT NO_OPTIMIZE="no" ADD_WERROR="no" # Test for -Werror and sed it out for now since some of the auto tests, # for example AC_CHECK_LIB, will fail because of # warning: conflicting types for built-in function if eval "echo $CFLAGS | grep -e -Werror"; then CFLAGS=`echo $CFLAGS | sed -e "s/-Werror//g"` ADD_WERROR="yes" fi # Disable annoying practice of recursively re-running the autotools AM_MAINTAINER_MODE AC_PROG_CC_STDC AC_PROG_CC AC_PROG_LIBTOOL AC_C_BIGENDIAN #AC_CANONICAL_HOST linux="no" sunos4="no" case "$host" in *-openbsd2.6|*-openbsd2.5|*-openbsd2.4|*-openbsd2.3*) AC_DEFINE([OPENBSD],[1],[Define if OpenBSD]) AC_DEFINE([BROKEN_SIOCGIFMTU],[1],[Define if BROKEN_SIOCGIFMTU]) ;; *-openbsd*) AC_DEFINE([OPENBSD],[1],[Define if OpenBSD < 2.3]) ;; *-sgi-irix5*) AC_DEFINE([IRIX],[1],[Define if Irix 5]) 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],[1],[Define if Irix 6]) 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],[1],[Define if Solaris]) CPPFLAGS="${CPPFLAGS} -DBSD_COMP -D_REENTRANT" ;; *-sunos*) AC_DEFINE([SUNOS],[1],[Define if SunOS]) sunos4="yes" ;; *-linux*) linux="yes" AC_DEFINE([LINUX],[1],[Define if Linux]) # libpcap doesn't even LOOK at the timeout you give it under Linux AC_DEFINE([PCAP_TIMEOUT_IGNORED],[1],[Define if pcap timeout is ignored]) AC_SUBST(extra_incl) extra_incl="-I/usr/include/pcap" ;; *-hpux10*|*-hpux11*) AC_DEFINE([HPUX],[1],[Define if HP-UX 10 or 11]) AC_DEFINE([WORDS_BIGENDIAN],[1],[Define if words are big endian]) AC_SUBST(extra_incl) extra_incl="-I/usr/local/include" ;; *-freebsd*) AC_DEFINE([FREEBSD],[1],[Define if FreeBSD]) ;; *-bsdi*) AC_DEFINE([BSDI],[1],[Define if BSDi]) ;; *-aix*) AC_DEFINE([AIX],[1],[Define if AIX]) ;; *-osf4*) AC_DEFINE([OSF1],[1],[Define if OSF-4]) ;; *-osf5.1*) AC_DEFINE([OSF1],[1],[Define if OSF-5.1]) ;; *-tru64*) AC_DEFINE([OSF1],[1],[Define if Tru64]) ;; # it is actually -apple-darwin1.2 or -apple-rhapsody5.x but lets stick with this for the moment *-apple*) AC_DEFINE([MACOS],[1],[Define if MacOS]) AC_DEFINE([BROKEN_SIOCGIFMTU],[1],[Define if broken SIOCGIFMTU]) LDFLAGS="${LDFLAGS} -L/sw/lib" extra_incl="-I/sw/include" ;; *-cygwin*) AC_DEFINE([CYGWIN],[1],[Define if CYGWIN]) ;; esac # This is really meant for Solaris Sparc v9 where it has 32bit and 64bit # capability but builds 32bit by default AC_ARG_ENABLE(64bit-gcc, [ --enable-64bit-gcc Try to compile 64bit (only tested on Sparc Solaris 9 and 10).], enable_64bit_gcc="$enableval", enable_64bit_gcc="no") if test "x$enable_64bit_gcc" = "xyes"; then CFLAGS="$CFLAGS -m64" fi # AC_PROG_YACC defaults to "yacc" when not found # this check defaults to "none" AC_CHECK_PROGS(YACC,bison yacc,none) # AC_PROG_YACC includes the -y arg if bison is found if test "x$YACC" = "xbison"; then YACC="$YACC -y" fi # AC_PROG_LEX defaults to ":" when not found # this check defaults to "none" # We're using flex specific options so we don't support lex AC_CHECK_PROGS(LEX,flex,none) # dnl checking headers AC_CHECK_HEADERS([strings.h string.h stdlib.h unistd.h sys/sockio.h paths.h inttypes.h wchar.h math.h]) AC_CHECK_LIB([m],[floor]) AC_CHECK_LIB([m],[ceil]) 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 # 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_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #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); 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 strlcpy strlcat strerror vswprintf wprintf]) AC_CHECK_SIZEOF([char]) AC_CHECK_SIZEOF([short]) AC_CHECK_SIZEOF([int]) AC_CHECK_SIZEOF([long int]) AC_CHECK_SIZEOF([long long int]) AC_CHECK_SIZEOF([unsigned int]) AC_CHECK_SIZEOF([unsigned long int]) AC_CHECK_SIZEOF([unsigned long long int]) # Check for int types AC_CHECK_TYPES([u_int8_t,u_int16_t,u_int32_t,u_int64_t,uint8_t,uint16_t,uint32_t,uint64_t]) AC_CHECK_TYPES([int8_t,int16_t,int32_t,int64_t]) # In case INADDR_NONE is not defined (like on Solaris) have_inaddr_none="no" AC_MSG_CHECKING([for INADDR_NONE]) AC_RUN_IFELSE( [AC_LANG_PROGRAM( [[ #include #include #include ]], [[ if (inet_addr("10,5,2") == INADDR_NONE); return 0; ]])], [have_inaddr_none="yes"], [have_inaddr_none="no"]) AC_MSG_RESULT($have_inaddr_none) if test "x$have_inaddr_none" = "xno"; then AC_DEFINE([INADDR_NONE],[-1],[For INADDR_NONE definition]) fi AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include ]], [[const char *foo; foo = sys_errlist[0];]])],[AC_DEFINE(ERRLIST_PREDEFINED,1,Define if errlist is predefined)],[]) AC_MSG_CHECKING(for __FUNCTION__) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #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_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #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_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 "x$with_libpcap_includes" != "xno"; then CPPFLAGS="${CPPFLAGS} -I${with_libpcap_includes}" fi if test "x$with_libpcap_libraries" != "xno"; then LDFLAGS="${LDFLAGS} -L${with_libpcap_libraries}" fi # --with-libpfring-* options AC_ARG_WITH(libpfring_includes, [ --with-libpfring-includes=DIR libpfring include directory], [with_libpfring_includes="$withval"],[with_libpfring_includes="no"]) AC_ARG_WITH(libpfring_libraries, [ --with-libpfring-libraries=DIR libpfring library directory], [with_libpfring_libraries="$withval"],[with_libpfring_libraries="no"]) if test "x$with_libpfring_includes" != "xno"; then CPPFLAGS="${CPPFLAGS} -I${with_libpfring_includes}" fi if test "x$with_libpfring_libraries" != "xno"; then LDFLAGS="${LDFLAGS} -L${with_libpfring_libraries}" fi PCAP_HEADERS="" # Test for pcap headers AC_CHECK_HEADERS(pcap.h,,PCAP_HEADERS="no") if test "x$PCAP_HEADERS" = "xno"; then if test "x$CYGWIN" = "x1" ; then echo echo " ERROR: You will need to get Winpcap headers in your path" echo " Downlad from http://www.winpcap.org, uncompress it and copy" echo " */Include/* to your include path (/usr/include)" echo " or use the --with-libpcap-headers* options, if you have it installed" echo " in unusual place." echo exit 1 else echo echo " ERROR! Libpcap headers (pcap.h)" echo " not found, go get it from http://www.tcpdump.org" echo " or use the --with-libpcap-headers=* options, if you have it installed" echo " in unusual place." echo exit 1 fi fi LPCAP="" if test "x$with_libpcap_libraries" != "xyes"; then if test "x$CYGWIN" = "x1"; then AC_CHECK_LIB(wpcap, pcap_datalink,, LPCAP="no") else AC_CHECK_LIB(pcap, pcap_datalink,, LPCAP="no") fi fi # If the normal AC_CHECK_LIB for pcap fails then check to see if we are # using a pfring-enabled pcap. if test "x$LPCAP" = "xno"; then PFRING_H="" AC_CHECK_HEADERS(pfring.h,, PFRING_H="no") # It is important to have the AC_CHECK_LIB for the pfring library BEFORE # the one for pfring-enabled pcap. When the Makefile is created, all the # libraries used during linking are added to the LIBS variable in the # Makefile in the opposite orded that their AC_CHECK_LIB macros appear # in configure.in. Durring linking, the pfring library (-lpfring) MUST come # _after_ the libpcap library (-lpcap) or linking will fail. PFRING_L="" AC_CHECK_LIB(pfring, pfring_open,, PFRING_L="no") LPFRING_PCAP="" AC_CHECK_LIB(pcap, pfring_open,, LPFRING_PCAP="no",-lpfring) fi # If both the AC_CHECK_LIB for normal pcap and pfring-enabled pcap fail then exit. if test "x$LPCAP" = "xno"; then if test "x$LPFRING_PCAP" = "xno"; then if test "x$CYGWIN" = "1" ; then echo echo " Warning: You will need to get Winpcap, install libraries and headers in your path " echo " to compile barnyard2 with the output plugin LogTcpdump" echo " Downlad from http://www.winpcap.org, uncompress it and copy */Lib/* to your lib path (/lib)" echo " and */Include/* to your include path (/usr/include)" echo " or use the --with-libpcap-* options, if you have it installed" echo " in unusual place." echo else echo echo " Warning: you will need Libpcap library/headers (libpcap.a (or .so)/pcap.h) in your path" echo " to compile barnyard2 with the output plugin LogTcpdump" echo " You can download source from from http://www.tcpdump.org" echo " or use the --with-libpcap-* options, if you have it installed" echo " in unusual place." echo fi fi fi 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 ]) # any sparc platform has to have this one defined. AC_MSG_CHECKING(for sparc) if eval "echo $host_cpu|grep -i sparc >/dev/null"; then AC_DEFINE([WORDS_MUSTALIGN],[1],[Define if words must align]) AC_MSG_RESULT(yes) # gcc, sparc and optimization not so good if test -n "$GCC"; then NO_OPTIMIZE="yes" fi else AC_MSG_RESULT(no) fi # check for sparc %time register if eval "echo $host_cpu|grep -i sparc >/dev/null"; then OLD_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -mcpu=v9 " AC_MSG_CHECKING([for sparc %time register]) AC_RUN_IFELSE( [AC_LANG_PROGRAM( [[]], [[ int val; __asm__ __volatile__("rd %%tick, %0" : "=r"(val)); ]])], [sparcv9="yes"], [sparcv9="no"]) AC_MSG_RESULT($sparcv9) if test "x$sparcv9" = "xyes"; then AC_DEFINE([SPARCV9],[1],[For sparc v9 with %time register]) else CFLAGS="$OLD_CFLAGS" fi fi AC_ARG_ENABLE(ipv6, [ --enable-ipv6 Enable IPv6 support], enable_ipv6="$enableval", enable_ipv6="no") if test "x$enable_ipv6" = "xyes"; then CPPFLAGS="$CPPFLAGS -DSUP_IP6" fi AM_CONDITIONAL(HAVE_SUP_IP6, test "x$enable_ipv6" = "xyes") AC_ARG_ENABLE(gre, [ --enable-gre Enable GRE and IP in IP encapsulation support], enable_gre="$enableval", enable_gre="no") if test "x$enable_gre" = "xyes"; then CPPFLAGS="$CPPFLAGS -DGRE" fi AC_ARG_ENABLE(mpls, [ --enable-mpls Enable MPLS support], enable_mpls="$enableval", enable_mpls="no") if test "x$enable_mpls" = "xyes"; then CPPFLAGS="$CPPFLAGS -DMPLS" fi AC_ARG_ENABLE(prelude, [ --enable-prelude Enable Prelude Hybrid IDS support], enable_prelude="$enableval", enable_prelude="no") if test "x$enable_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],[1],[Define whether Prelude support is enabled]) fi fi AC_ARG_ENABLE(debug, [ --enable-debug Enable debugging options (bugreports and developers only)], enable_debug="$enableval", enable_debug="no") if test "x$enable_debug" = "xyes"; then NO_OPTIMIZE="yes" CPPFLAGS="$CPPFLAGS -DDEBUG" # in case user override doesn't include -g if echo $CFLAGS | grep -qve -g ; then CFLAGS="$CFLAGS -g" fi fi AC_ARG_WITH(mysql, [ --with-mysql=DIR Support for MySQL], [ with_mysql="$withval"], [ with_mysql="no" ]) AC_ARG_WITH(mysql_includes, [ --with-mysql-includes=DIR MySQL include directory], [with_mysql_includes="$withval"; with_mysql="yes"],[with_mysql_includes="no"]) AC_ARG_WITH(mysql_libraries, [ --with-mysql-libraries=DIR MySQL library directory], [with_mysql_libraries="$withval"; with_mysql="yes"],[with_mysql_libraries="no"]) default_directory="/usr /usr/local" if test "x$with_mysql" != "xno"; then if test "x$with_mysql" = "xyes"; then if test "x$with_mysql_includes" != "xno"; then mysql_inc_directory="$with_mysql_includes"; else mysql_inc_directory="$default_directory"; fi if test "x$with_mysql_libraries" != "xno"; then mysql_lib_directory="$with_mysql_libraries"; else mysql_lib_directory="$default_directory"; fi mysql_fail="yes" elif test -d "$withval"; then AC_MSG_WARN(Providing a directory for the --with-mysql option) AC_MSG_WARN(will be deprecated in the future in favour of) AC_MSG_WARN(--with-mysql-libraries and --with-mysql-includes) AC_MSG_WARN(options to address issues with non-standard) AC_MSG_WARN(installations and 64bit platforms.) mysql_inc_directory="$withval" mysql_lib_directory="$withval" mysql_fail="yes" elif test "x$with_mysql" = "x"; then mysql_inc_directory="$default_directory" mysql_lib_directory="$default_directory" mysql_fail="yes" fi AC_MSG_CHECKING(for mysql) for i in $mysql_inc_directory; do if test -r "$i/mysql.h"; then MYSQL_INC_DIR="$i" elif test -r "$i/include/mysql.h"; then MYSQL_INC_DIR="$i/include" elif test -r "$i/include/mysql/mysql.h"; then MYSQL_INC_DIR="$i/include/mysql" elif test -r "$i/mysql/mysql.h"; then MYSQL_INC_DIR="$i/mysql" elif test -r "$i/mysql/include/mysql.h"; then MYSQL_INC_DIR="$i/mysql/include" fi done for i in $mysql_lib_directory; do if test -z "$MYSQL_LIB_DIR"; then str="$i/libmysqlclient.*" for j in `echo $str`; do if test -r $j; then MYSQL_LIB_DIR=$i break 2 fi done fi if test -z "$MYSQL_LIB_DIR"; then str="$i/lib/libmysqlclient.*" for j in `echo $str`; do if test -r "$j"; then MYSQL_LIB_DIR="$i/lib" break 2 fi done fi if test -z "$MYSQL_LIB_DIR"; then str="$i/mysql/libmysqlclient.*" for j in `echo $str`; do if test -r "$j"; then MYSQL_LIB_DIR="$i/mysql" break 2 fi done fi if test -z "$MYSQL_LIB_DIR"; then str="$i/mysql/lib/libmysqlclient.*" for j in `echo $str`; do if test -r "$j"; then MYSQL_LIB_DIR="$i/mysql/lib" break 2 fi done fi if test -z "$MYSQL_LIB_DIR"; then str="$i/lib/mysql/libmysqlclient.*" for j in `echo $str`; do if test -r "$j"; then MYSQL_LIB_DIR="$i/lib/mysql" break 2 fi done fi done if test -z "$MYSQL_INC_DIR"; then if test "x$mysql_fail" != "xno"; then tmp="" for i in $mysql_inc_directory; do tmp="$tmp $i $i/include $i/include/mysql $i/mysql $i/mysql/include" done FAIL_MESSAGE("mysql headers (mysql.h)", $tmp) else AC_MSG_RESULT(no) fi else if test -z "$MYSQL_LIB_DIR"; then if test "x$mysql_fail" != "xno"; then tmp="" for i in $mysql_lib_directory; do tmp="$tmp $i $i/lib $i/mysql $i/mysql/lib $i/lib/mysql" done FAIL_MESSAGE("mysqlclient library (libmysqlclient.*)", $tmp) 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 AC_MSG_CHECKING([for mysql default client reconnect]) AC_RUN_IFELSE( [AC_LANG_PROGRAM( [[ #include ]], [[ if (mysql_get_client_version() < 50003) return 1; ]])], [mysql_default_reconnect="no"], [mysql_default_reconnect="yes"]) AC_MSG_RESULT($mysql_default_reconnect) if test "x$mysql_default_reconnect" = "xno"; then AC_MSG_CHECKING([for mysql reconnect option]) AC_RUN_IFELSE( [AC_LANG_PROGRAM( [[ #include ]], [[ if (mysql_get_client_version() < 50013) return 1; ]])], [mysql_has_reconnect="yes"], [mysql_has_reconnect="no"]) AC_MSG_RESULT($mysql_has_reconnect) if test "x$mysql_has_reconnect" = "xyes"; then AC_DEFINE([MYSQL_HAS_OPT_RECONNECT],[1],[For MySQL versions 5.0.13 and greater]) AC_MSG_CHECKING([for mysql setting of reconnect option before connect bug]) AC_RUN_IFELSE( [AC_LANG_PROGRAM( [[ #include ]], [[ if (mysql_get_client_version() < 50019) return 1; ]])], [mysql_has_reconnect_bug="no"], [mysql_has_reconnect_bug="yes"]) AC_MSG_RESULT($mysql_has_reconnect_bug) if test "x$mysql_has_reconnect_bug" = "xyes"; then AC_DEFINE([MYSQL_HAS_OPT_RECONNECT_BUG],[1],[For MySQL versions 5.0.13 to 5.0.18]) fi fi fi fi AC_ARG_ENABLE(mysql-ssl-support, [ --enable-mysql-ssl-support Enable support for mysql SSL connections (experimental)], enable_mysql_ssl_support="$enableval", enable_debug="no") if test "x$enable_mysql_ssl_support" = "xyes"; then CPPFLAGS="$CPPFLAGS -DMYSQL_SSL_SUPPORT" # in case user override doesn't include -g # if echo $CFLAGS | grep -qve -g ; then # CFLAGS="$CFLAGS -g" # fi fi AC_ARG_WITH(odbc, [ --with-odbc=DIR Support for ODBC], [ with_odbc="$withval" ], [ with_odbc="no" ]) if test "x$with_odbc" != "xno"; then if test "x$with_odbc" = "xyes"; then odbc_directory="$default_directory" odbc_fail="yes" elif test -d $withval; then odbc_directory="$withval $default_directory"; odbc_fail="yes" elif test "x$with_odbc" = "x"; 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 "x$odbc_fail" != "xno"; 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 "x$odbc_fail" != "xno"; 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 "x$with_postgresql" != "xno"; then if test "x$with_postgresql" = "xyes"; 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 "x$with_pgsql_includes" != "xno"; 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 "x$postgresql_fail" != "xno"; then tmp="" if test "x$with_pgsql_includes" != "xno"; 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 "x$PQLIB" != "xno"; then LIBS="${LIBS} -lpq" else echo echo " ERROR! libpq (postgresql) not found!" echo exit 1 fi fi AC_CHECK_FUNC([PQping], [AC_DEFINE([HAVE_PQPING], [1], [Define if PQping exists.])]) fi AC_ARG_WITH(oracle, [ --with-oracle=DIR Support for Oracle], [ with_oracle="$withval" ], [ with_oracle="no" ]) if test "x$with_oracle" != "xno"; then if test "x$with_oracle" = "xyes"; 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 "x$with_oracle" = "x"; 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 "x$oracle_fail" != "xno"; 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 AC_ARG_ENABLE(aruba, [ --enable-aruba Enable Aruba output plugin], enable_aruba="$enableval", enable_aruba="no") if test "x$enable_aruba" = "xyes"; then CPPFLAGS="$CPPFLAGS -DARUBA" fi AC_ARG_ENABLE(bro, [ --enable-bro Enable Bro output plugin], enable_bro="$enableval", enable_bro="no") AC_ARG_WITH(broccoli, [ --with-broccoli=DIR Prefix where libbroccoli is installed for Bro output plugin support (optional)], [ with_broccoli="$withval" ], [ with_broccoli="no" ]) if test "x$enable_bro" = "xyes"; then if test -d $withval; then broccoli_directory="$withval $default_directory"; else broccoli_directory="$default_directory /usr/local/bro"; fi AC_MSG_CHECKING(for broccoli) for i in $broccoli_directory; do if test -x "$i/bin/broccoli-config"; then BROCCOLI_DIR="$i" fi done if test -z "$BROCCOLI_DIR"; then tmp="" for i in $broccoli_directory; do tmp="$tmp $i/include" done FAIL_MESSAGE("Broccoli header file (broccoli.h)", $tmp) fi AC_MSG_RESULT(yes) LDFLAGS="${LDFLAGS} `${BROCCOLI_DIR}/bin/broccoli-config --libs`" CPPFLAGS="${CPPFLAGS} `${BROCCOLI_DIR}/bin/broccoli-config --cflags`" LIBS="${LIBS} -lbroccoli" fi # Checking for Tcl support (required by spo_sguil) AC_ARG_WITH(tcl, [ --with-tcl=DIR support for Tcl], [ with_tcl="$withval"], [ with_tcl=no ]) if test "$with_tcl" != "no"; then # prioritise manual definition of the Tcl library. if test -d "$with_tcl"; then tclpath="$with_tcl" else # let tclsh tell us where it was installed (prefer new Tcl versions). AC_CHECK_PROGS(TCLSH, tclsh8.4 tclsh8.3 tclsh8.2 tclsh8.1 tclsh8.0 tclsh) if test "$TCLSH" != ""; then tclpath=`echo 'puts [[lindex $tcl_pkgPath 0]]' | $TCLSH` fi fi # check, if tclConfig.sh can be found in tclsh's installation directory. if test ! -r $tclpath/tclConfig.sh; then AC_MSG_RESULT( [ Can't find Tcl libraries. Use --with-tcl to specify the directory containing tclConfig.sh on your system. Continuing build without Tcl support.]) else # source tclsh's configuration file and tell the user about the version. . $tclpath/tclConfig.sh AC_MSG_CHECKING([for the tcl version number]) AC_MSG_RESULT([$TCL_VERSION, patchlevel $TCL_PATCH_LEVEL]) LIBS="$LIBS $TCL_LIBS $TCL_LIB_SPEC" TCL_INCLUDE="$TCL_PREFIX/include/tcl$TCL_VERSION" CPPFLAGS="$CPPFLAGS -I$TCL_INCLUDE -DENABLE_TCL"; fi fi # # OUTPUT PLUGIN - ECHIDNA AC_ARG_ENABLE(plugin-echidna, [ --enable-plugin-echidna Enable echidna plugin (experimental)], enable_plugin_echidna="$enableval", enable_plugin_echidna="no") if test "x$enable_plugin_echidna" = "xyes"; then AC_CHECK_LIB([crypto], [SHA256_Init], [], [AC_MSG_ERROR([SHA256_Init was not found in libcrypto])]) AC_CHECK_LIB([curl], [curl_easy_setopt], [], [AC_MSG_ERROR([curl_easy_setopt was not found in libcurl])]) AC_CHECK_LIB([websockets], [libwebsocket_create_context], [], [AC_MSG_ERROR([libwebsocket_create_context was not found in libwebsockets])]) AC_CHECK_LIB([json], [json_tokener_parse], [], [AC_MSG_ERROR([json_tokener_parse was not found in libjson])]) CPPFLAGS="$CPPFLAGS -DENABLE_PLUGIN_ECHIDNA" LIBS="$LIBS -lwebsockets -ljson -lcurl -lcrypto" 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 "x$GCC" = "xyes" ; then echo `$CC -v 2>&1` | grep "version 4" > /dev/null if test $? = 0 ; then CFLAGS="$CFLAGS -fno-strict-aliasing" fi fi if test "x$linux" = "xyes"; then AC_MSG_CHECKING(for linuxthreads) tstr=`getconf GNU_LIBPTHREAD_VERSION 2>&1` if test $? = 0; then # GNU_LIBPTHREAD_VERSION is a valid system variable echo $tstr | grep -i linuxthreads > /dev/null 2>&1 if test $? = 0; then AC_DEFINE([HAVE_LINUXTHREADS],[1],[Define whether linuxthreads is being used]) AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) fi else # Use libc.so to see if linuxthreads is being used $( ldd `which --skip-alias ls` | grep libc.so | awk '{print $3}' ) | grep -i linuxthreads > /dev/null 2>&1 if test $? = 0; then AC_DEFINE([HAVE_LINUXTHREADS],[1],[Define whether linuxthreads is being used]) AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) fi fi fi # Set to no optimization regardless of what user or autostuff set if test "x$NO_OPTIMIZE" = "xyes"; then CFLAGS=`echo $CFLAGS | sed -e "s/-O./-O0/"` # in case user override doesn't include -O if echo $CFLAGS | grep -qve -O0 ; then CFLAGS="$CFLAGS -O0" fi fi if test "x$ADD_WERROR" = "xyes"; then CFLAGS="$CFLAGS -Werror" fi if test -n "$GCC"; then CFLAGS="$CFLAGS -Wall" fi echo $CFLAGS > cflags.out echo $CPPFLAGS > cppflags.out 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/input-plugins' AC_SUBST(INCLUDES) AC_PROG_INSTALL AC_CONFIG_FILES([ \ Makefile \ src/Makefile \ src/sfutil/Makefile \ src/input-plugins/Makefile \ src/output-plugins/Makefile \ etc/Makefile \ doc/Makefile \ rpm/Makefile \ schemas/Makefile \ m4/Makefile]) AC_OUTPUT if test "x$mysql_has_reconnect" = "xno"; then cat <@ section of my.cnf, e.g. wait-timeout=31536000. This should give you a good year of inactivity before the server terminates the connection ... if your network is this clean, you probably don't need to use Barnyard2. ******************************************************************************** EOF fi