dnl Process this file with autoconf to produce a configure script. AC_INIT(src) AC_CANONICAL_SYSTEM AM_INIT_AUTOMAKE(prelude-cm-agent, 0.4.1) AM_CONFIG_HEADER(config.h) AM_DISABLE_STATIC AM_MAINTAINER_MODE AM_PROG_LIBTOOL dnl Checks for programs. AC_PROG_CC AC_PROG_INSTALL AC_PROG_MAKE_SET AC_C_INLINE AC_C_BIGENDIAN AC_SUBST(CPPFLAGS) AC_SUBST(LDFLAGS) if test "x$prefix" = "xNONE"; then prefix="/usr/local" fi if test "x$localstatedir" = "x\${prefix}/var"; then localstatedir="$prefix/var" fi if test "x$sysconfdir" = "x\${prefix}/etc"; then sysconfdir="$prefix/etc" fi dnl ************************************************** dnl * Check for libprelude * dnl ************************************************** AC_PATH_GENERIC(libprelude, 0.4.1, , AC_MSG_ERROR(Cannot find libprelude: Is libprelude-config in the path?) ) dnl ************************************************** dnl * Check for OpenSSL. * dnl ************************************************** AC_CHECK_HEADER(openssl/ssl.h, openssl_header=yes) AC_ARG_ENABLE(openssl, [ --enable-openssl Use OpenSSL to communicate with Report Server [default=auto]], \ enable_openssl="$enableval", enable_openssl=auto) if test x$enable_openssl = xauto ; then if test x$openssl_header = xyes; then AC_DEFINE(HAVE_SSL) enable_openssl=yes else enable_openssl=no fi fi dnl ************************************************** dnl * Check for the iptc library (Netfilter plugin) * dnl ************************************************** AC_CHECK_HEADER(libiptc/libiptc.h, iptc_header=yes) if test x$iptc_header != xyes; then for dir in /usr/include /usr/local/include; do AC_CHECK_FILES(libiptc/libiptc.h, iptc_header_dir=$dir) done if test $iptc_header_dir ; then NETFILTER_CFLAGS="-I$iptc_header_dir" iptc_header="yes" fi fi AC_CHECK_HEADER(linux/netfilter.h, netfilter_header=yes) if test x$netfilter_header != xyes; then for dir in /usr/include /usr/local/include; do AC_CHECK_FILES(libiptc/libiptc.h, iptc_netfilter_dir=$dir) done if test $iptc_netfilter_dir ; then NETFILTER_CFLAGS="$NETFILTER_CFLAGS -I$iptc_netfilter_dir" netfilter_header="yes" fi fi AC_CHECK_LIB(iptc, iptc_init, has_iptc_init=yes) if test x$has_iptc_init = xyes; then NETFILTER_LIBS="-liptc" else for dir in /usr/lib /usr/local/lib; do AC_CHECK_FILE($dir/libiptc.a, iptc_dir=$dir) done if test $iptc_dir ; then NETFILTER_LIBS="-L$iptc_dir -liptc" has_iptc_init=yes fi fi AC_ARG_ENABLE(netfilter, [ --enable-netfilter Enable Netfilter plugin [default=auto]], \ enable_netfilter="$enableval", enable_netfilter=auto) if test x$enable_netfilter = xauto ; then if test x$netfilter_header = xyes && test x$iptc_header = xyes; then enable_netfilter=yes else enable_netfilter=no fi fi AM_CONDITIONAL(HAVE_NETFILTER, test x$enable_netfilter = xyes) AC_SUBST(HAVE_NETFILTER) AC_SUBST(NETFILTER_CFLAGS) AC_SUBST(NETFILTER_LIBS) dnl ************************************************** dnl * Enable / Disable gprof profiling. * dnl ************************************************** AC_ARG_ENABLE(profiling, [ --enable-profiling Enable Gprof profiling - with thread workaround [default=no]], \ enable_profiling=yes, enable_profiling=no) if test x$enable_profiling = xyes ; then CFLAGS="$CFLAGS -O0 -pg" dnl *** for gcc3 *** cat > conftest.c << EOF int main(void) { exit(0); } EOF AC_MSG_CHECKING(whether compiler support -fprofile-arcs) ${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.c $LIBS >/dev/null 2>&1 if test -x conftest ; then CFLAGS="$CFLAGS -fprofile-arcs"; AC_MSG_RESULT(yes); rm -f conftest; else AC_MSG_RESULT(no); fi fi dnl ************************************************** dnl * Check for Gtkdoc. * dnl ************************************************** AC_CHECK_PROG(GTKDOC, gtkdoc-mkdb, true, false) AM_CONDITIONAL(HAVE_GTK_DOC, test -n $GTKDOC) AC_SUBST(HAVE_GTK_DOC) AC_ARG_ENABLE(gtk-doc, [ --enable-gtk-doc Use gtk-doc to build documentation [default=auto]], enable_gtk_doc="$enableval", enable_gtk_doc=auto) if test x$enable_gtk_doc = xauto ; then if test x$GTKDOC = xtrue ; then enable_gtk_doc=yes else enable_gtk_doc=no fi fi AM_CONDITIONAL(ENABLE_GTK_DOC, test x$enable_gtk_doc = xyes) dnl ************************************************** dnl * Html dir ? * dnl ************************************************** if test "x$with_html_dir" = "x" ; then HTML_DIR='${datadir}/doc/prelude-cm-agent/html' else HTML_DIR=$with_html_dir fi AC_SUBST(HTML_DIR) dnl ************************************************** dnl * Do we need aligned access ? (from tcpdump) * dnl ************************************************** AC_MSG_CHECKING(if unaligned accesses fail) AC_CACHE_VAL(ac_cv_lbl_unaligned_fail, [case "$host_cpu" in # XXX: should also check that they don't do weird things (like on arm) alpha*|arm*|hp*|mips*|sparc*|ia64) ac_cv_lbl_unaligned_fail=yes ;; *) cat >conftest.c < # include # include unsigned char a[[5]] = { 1, 2, 3, 4, 5 }; main() { unsigned int i; pid_t pid; int status; /* avoid "core dumped" message */ pid = fork(); if (pid < 0) exit(2); if (pid > 0) { /* parent */ pid = waitpid(pid, &status, 0); if (pid < 0) exit(3); exit(!WIFEXITED(status)); } /* child */ i = *(unsigned int *)&a[[1]]; printf("%d\n", i); exit(0); } EOF ${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS \ conftest.c $LIBS >/dev/null 2>&1 if test ! -x conftest ; then dnl failed to compile for some reason ac_cv_lbl_unaligned_fail=yes else ./conftest >conftest.out if test ! -s conftest.out ; then ac_cv_lbl_unaligned_fail=yes else ac_cv_lbl_unaligned_fail=no fi fi rm -f conftest* core core.conftest ;; esac]) AC_MSG_RESULT($ac_cv_lbl_unaligned_fail) if test $ac_cv_lbl_unaligned_fail = yes ; then AC_DEFINE(NEED_ALIGNED_ACCESS) fi dnl Checks for header files. AC_HEADER_DIRENT AC_HEADER_STDC dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST AC_TYPE_PID_T AC_TYPE_SIZE_T AC_HEADER_TIME dnl Checks for library functions. AC_TYPE_SIGNAL AC_FUNC_VPRINTF AC_CHECK_FUNCS(gettimeofday select socket strdup strerror strstr) configdir=$sysconfdir/prelude-cm-agent prelude_cm_conf=$configdir/prelude-cm-agent.conf plugindir=$libdir/prelude-cm-agent firewall_plugin_dir=$plugindir/firewall AC_DEFINE_UNQUOTED(PRELUDE_CM_AGENT_CONF, "$prelude_cm_conf") defined="$defined $LIBPRELUDE_CFLAGS" AC_SUBST(defined) AC_SUBST(configdir) AC_SUBST(localstatedir) AC_SUBST(prelude_conf) AC_SUBST(regex_conf) AC_SUBST(firewall_plugin_dir) AC_SUBST(LIBWRAP_LIBS) if test x$enable_profiling = xno; then CFLAGS="$CFLAGS -O2 -fomit-frame-pointer" fi CFLAGS="$CFLAGS -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations \ -Wbad-function-cast -Wcast-qual -Wcast-align -Wnested-externs -Wunused" AC_SUBST(CFLAGS) AC_OUTPUT([ prelude-cm-agent.conf Makefile src/Makefile src/include/Makefile plugins/Makefile plugins/firewall/Makefile plugins/firewall/netfilter/Makefile ]) echo echo "*** Dumping configuration ***" echo " - Enable OpenSSL : $enable_openssl" echo " - Generate documentation : $enable_gtk_doc" echo " - Enable profiling : $enable_profiling" echo " - Enable Netfilter plugin : $enable_netfilter";