www.pudn.com > ids_snort.zip > configure.in
# $Id: configure.in,v 1.31 2001/01/30 20:53:58 jpickel Exp $
AC_INIT(snort.c)
AM_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE(snort,1.7)
AM_PROG_CC_STDC
AC_PROG_CC
if test -n "$GCC"; then
CFLAGS="$CFLAGS -Wall "
fi
AC_CANONICAL_HOST
linux=no
sunos4=no
AC_C_BIGENDIAN
case "$host" in
*-openbsd*)
AC_DEFINE(OPENBSD)
;;
*-sgi-irix5*)
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
;;
*-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)
CPPFLAGS="${CPPFLAGS} -DBSD_COMP"
;;
*-sunos*)
AC_DEFINE(SUNOS)
sunos4=yes
;;
*-linux*)
linux=yes
AC_DEFINE(LINUX)
AC_DEFINE(PCAP_TIMEOUT_IGNORED) # libpcap doesn't even LOOK at
# the timeout you give it under Linux
AC_SUBST(extra_incl)
extra_incl=-I/usr/include/pcap
;;
*-hpux10*)
AC_DEFINE(HPUX)
AC_DEFINE(WORDS_BIGENDIAN)
AC_SUBST(extra_incl)
extra_incl=-I/usr/local/include
;;
*-freebsd*)
AC_DEFINE(FREEBSD)
;;
*-bsdi*)
AC_DEFINE(BSDI)
;;
*-aix*)
AC_DEFINE(AIX)
broken_types=yes
;;
*-osf4*)
AC_DEFINE(OSF1)
tru64_types=yes
;;
*-osf5.1*)
AC_DEFINE(OSF1)
;;
*-tru64*)
AC_DEFINE(OSF1)
tru64_types=yes
;;
esac
# any sparc platform has to have this one defined.
if test "$host_cpu" = "sparc"; then
AC_DEFINE(WORDS_MUSTALIGN)
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
# 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 strtoul)
AC_CHECK_FUNCS(snprintf)
AC_CHECK_FUNCS(strerror)
AC_TRY_COMPILE([
#include
],[char *foo; foo = sys_errlist[0];], AC_DEFINE(ERRLIST_PREDEFINED))
AC_ARG_WITH(libpcap_includes,
[ --with-libpcap-includes=DIR libcap include directory],
[with_libpcap_includes="$withval"],[with_libpcap_includes=no])
AC_ARG_WITH(libpcap_libraries,
[ --with-libpcap-libraries=DIR libcap 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 " ftp://ftp.ee.lbl.gov/libpcap.tar.Z"
echo " or use the --with-libpcap-* options, if you have it installed"
echo " in unusual place"
exit
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
])
AC_ARG_WITH(mysql, [ --with-mysql=DIR support for mysql])
if test "$with_mysql" != "no"; then
if test "$with_mysql" = "yes"; then
mysql_directory="$default_directory"; mysql_fail="yes"
elif test "$with_mysql" = ""; then
mysql_directory="$default_directory"; mysql_fail="no"
else
mysql_directory="$with_mysql"; 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 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="${LIBS} -lmysqlclient"
fi
fi
fi
AC_ARG_WITH(odbc, [ --with-odbc=DIR support for odbc])
if test "$with_odbc" != "no"; then
if test "$with_odbc" = "yes"; then
odbc_directory="$default_directory"; odbc_fail="yes"
elif test "$with_odbc" = ""; then
odbc_directory="$default_directory"; odbc_fail="no"
else
odbc_directory="$with_odbc"; odbc_fail="yes"
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])
if test "$with_postgresql" != "no"; then
if test "$with_postgresql" = "yes"; then
postgresql_directory="$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"
else
postgresql_directory="$with_postgresql"; postgresql_fail="yes"
fi
AC_MSG_CHECKING("for postgresql")
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
fi
done
if test -z "$POSTGRESQL_DIR"; then
if test "$postgresql_fail" != "no"; then
tmp=""
for i in $postgesql_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
else
for i in lib lib/pgsql; do
str="$POSTGRESQL_DIR/$i/libpq.*"
for j in `echo $str`; do
if test -r $j; then
POSTGRESQL_LIB_DIR="$POSTGRESQL_DIR/$i"
break 2
fi
done
done
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"
LIBS="${LIBS} -lpq"
fi
fi
fi
AC_ARG_WITH(oracle, [ --with-oracle=DIR support for oracle])
if test "$with_oracle" != "no"; then
if test "$with_oracle" = "yes"; then
oracle_directory="$default_directory ${ORACLE_HOME}"
oracle_fail="yes"
elif test "$with_oracle" = ""; then
oracle_directory="$default_directory ${ORACLE_HOME}"
oracle_fail="no"
else
oracle_directory="$with_oracle"; oracle_fail="yes"
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"
LIBS="${LIBS} -lclntsh -lwtc8"
fi
fi
AC_ARG_WITH(openssl, [ --with-openssl=DIR support for openssl])
if test "$with_openssl" != "no"; then
if test "$with_openssl" = "yes"; then
openssl_directory="$default_directory /usr/local/ssl /usr/ssl"
openssl_fail="yes"
elif test "$with_openssl" = ""; then
openssl_directory="$default_directory /usr/local/ssl /usr/ssl"
openssl_fail="no"
else
openssl_directory="$with_openssl"
openssl_fail="yes"
fi
AC_MSG_CHECKING("for openssl")
for i in $openssl_directory; do
if test -r $i/include/openssl/crypto.h; then
if test -r $i/include/openssl/x509.h; then
if test -r $i/include/openssl/x509_vfy.h; then
if test -r $i/include/openssl/pem.h; then
if test -r $i/include/openssl/ssl.h; then
if test -r $i/include/openssl/err.h; then
OPENSSL_DIR=$i
OPENSSL_INC_DIR=$i/include
fi fi fi fi fi fi
done
if test -z "$OPENSSL_DIR"; then
if test "$openssl_fail" != "no"; then
tmp=""
for i in $openssl_directory; do
tmp="$tmp $i/include $i/include/openssl"
done
FAIL_MESSAGE("openssl headers (crypto.h x509.h x509vrfy.h pem.h ssl.h err.h)", $tmp)
else
AC_MSG_RESULT(no)
fi
else
for i in lib lib/openssl; do
str="$OPENSSL_DIR/$i/libcrypto.* $OPENSSL_DIR/$i/libssl.*"
for j in `echo $str`; do
if test -r $j; then
OPENSSL_LIB_DIR="$OPENSSL_DIR/$i"
break 2
fi
done
done
if test -z "$OPENSSL_LIB_DIR"; then
if test "$openssl_fail" != "no"; then
FAIL_MESSAGE("openssl library (libcrypto)",
"$OPENSSL_DIR/lib $OPENSSL_DIR/lib/openssl")
else
AC_MSG_RESULT(no);
fi
else
AC_MSG_RESULT(yes)
LDFLAGS="${LDFLAGS} -L${OPENSSL_LIB_DIR}"
CPPFLAGS="${CPPFLAGS} -I${OPENSSL_INC_DIR} -DENABLE_SSL"
LIBS="${LIBS} -lssl -lcrypto"
fi
fi
fi
AC_ARG_ENABLE(smbalerts,
[ --enable-smbalerts SMB alerting capaility via Samba],
CFLAGS="$CFLAGS -DENABLE_SMB_ALERTS",)
AC_ARG_ENABLE(flexresp,
[ --enable-flexresp Flexible Responses on hostile connection attempts],
[ CFLAGS="$CFLAGS -DENABLE_RESPONSE `libnet-config --defines` `libnet-config --cflags`"
LIBS="$LIBS `libnet-config --libs`"],)
if test "$enable_flexresp" != "no"; then
if test "$enable_flexresp" = "yes"; then
LIBNET_INC_DIR=""
AC_MSG_CHECKING("for libnet.h")
libnet_dir="/usr/include /usr/local/include"
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
CPPFLAGS="${CPPFLAGS} -I${LIBNET_INC_DIR}"
AC_MSG_RESULT($i)
else
AC_MSG_RESULT(no)
fi
fi
fi
#########################################################
# -- uncomment if want to play with pthreads support -- #
#########################################################
#AC_ARG_ENABLE(pthreads,
#[ --enable-pthreads Multiple interfaces support using pthreads ],
# [ CFLAGS="$CFLAGS -pthread -DUSE_PTHREADS"
# ],)
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'`
AC_PROG_INSTALL
AC_OUTPUT(Makefile)