dnl Process this file with autoconf to produce a configure script. AC_INIT(src) AC_PREREQ(2.53) AC_CANONICAL_SYSTEM AM_INIT_AUTOMAKE(prelude-manager, 0.8.0) 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 CFLAGS="" 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 if test "x$datadir" = "x\${prefix}/share"; then datadir="$prefix/share" fi dnl ************************************************** dnl * Check for libprelude * dnl ************************************************** AC_PATH_GENERIC(libprelude, 0.8.0, , AC_MSG_ERROR(Cannot find libprelude: Is libprelude-config in the path?) ) defined="$defined $LIBPRELUDE_CFLAGS" 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 MySQL library (MySQL plugin * dnl *************************************************** # Check for mysql_config. If it is not found, look for mysql libraries # and headers in standard places AC_CHECK_PROG(MYSQL_CONFIG, mysql_config, true, false) if test x$MYSQL_CONFIG = xtrue; then MYSQL_LIBS=`mysql_config --libs` MYSQL_CFLAGS=`mysql_config --cflags` mysql_use=true else for dir in /usr/lib /usr/lib/mysql /usr/local/lib \ /usr/local/lib/mysql; do AC_CHECK_FILE($dir/libmysqlclient.so, mysql_dir=$dir) done if test $mysql_dir ; then mysql_use=true; MYSQL_LIBS="-L$mysql_dir -lmysqlclient" fi for dir in /usr/include /usr/include/mysql /usr/local/include \ /usr/local/include/mysql; do AC_CHECK_FILE($dir/mysql.h, mysql_inc=$dir) done if test $mysql_inc ; then MYSQL_CFLAGS=-I$mysql_inc else mysql_use=false; fi fi if test x$mysql_use = xtrue; then # mysql_config --libs outputs -L'directory' instead of -Ldirectory # and escaped version fools gcc in AC_CHECK_LIB so we must remove # apostrophes temp_mysql_flags=`echo $MYSQL_LIBS | sed -e s/\'//g` # this is needed for correct linking. If we don't add mysql library # flags to CFLAGS the test will always fail due to a linker error CFLAGS_bak=$CFLAGS CFLAGS="$CFLAGS $temp_mysql_flags" AC_CHECK_LIB(mysqlclient, mysql_real_escape_string, have_real_escape_string=yes) if test x$have_real_escape_string = xyes; then AC_DEFINE(HAVE_MYSQL_REAL_ESCAPE_STRING) fi # restore the normal setting CFLAGS=$CFLAGS_bak fi AC_ARG_ENABLE(mysql, [ --enable-mysql Enable MySQL plugin [default=auto]], enable_mysql="$enableval", enable_mysql=auto) if test x$enable_mysql = xauto; then if test x$mysql_use = xtrue; then enable_mysql=yes; else enable_mysql=no; fi fi AM_CONDITIONAL(HAVE_MYSQL, test x$enable_mysql = xyes) AC_SUBST(HAVE_MYSQL) AC_SUBST(MYSQL_LIBS) AC_SUBST(MYSQL_CFLAGS) dnl ******************************************************** dnl * Check for the PostgreSQL library (PostgreSQL plugin) * dnl ******************************************************** AC_CHECK_PROG(PGSQL_CONFIG, pg_config, true, false) if test x$PGSQL_CONFIG = xtrue; then PGSQL_LIBDIR=`pg_config --libdir` PGSQL_INCLUDEDIR=`pg_config --includedir` AC_CHECK_HEADER($PGSQL_INCLUDEDIR/libpq-fe.h, pgsql_hdr=true) fi AC_ARG_ENABLE(pgsql, [ --enable-pgsql Enable PostgreSQL plugin [default=auto]], enable_pgsql="$enableval", enable_pgsql=auto) if test x$enable_pgsql = xauto; then if test x$PGSQL_CONFIG = xtrue && test x$pgsql_hdr = xtrue; then enable_pgsql=yes; else enable_pgsql=no; fi fi AM_CONDITIONAL(HAVE_PGSQL, test x$enable_pgsql = xyes) AC_SUBST(HAVE_PGSQL) AC_SUBST(PGSQL_LIBDIR) AC_SUBST(PGSQL_INCLUDEDIR) 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 -O3 -pg" else CFLAGS="$CFLAGS -O3 -fomit-frame-pointer" fi 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 ************************************************** dnl * Check for GTK-DOC * dnl ************************************************** AC_ARG_WITH(html-dir, [ --with-html-dir=PATH path to installed docs ]) if test "x$with_html_dir" = "x" ; then HTML_DIR='${datadir}/gtk-doc/html'; else HTML_DIR=$with_html_dir; fi AC_SUBST(HTML_DIR) AC_CHECK_PROG(GTKDOC, gtkdoc-mkdb, true, false) gtk_doc_min_version=0.6 if $GTKDOC; then gtk_doc_version=`gtkdoc-mkdb --version` AC_MSG_CHECKING([gtk-doc version ($gtk_doc_version) >= $gtk_doc_min_version]) if perl << EOF ; then exit (("$gtk_doc_version" =~ /^[[0-9]]+\.[[0-9]]+$/) && ("$gtk_doc_version" >= "$gtk_doc_min_version") ? 0 : 1); EOF AC_MSG_RESULT(yes); else AC_MSG_RESULT(no); GTKDOC=false; fi fi dnl Let people disable the gtk-doc stuff. AC_ARG_ENABLE(gtk-doc, [ --enable-gtk-doc Use gtk-doc to build documentation [default=no]], enable_gtk_doc="$enableval", enable_gtk_doc=no) 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/html' else HTML_DIR=$with_html_dir fi AC_SUBST(HTML_DIR) dnl ************************************************** dnl * TCP WRAPPER CHECK * dnl ************************************************** AC_CHECK_HEADER(tcpd.h, have_tcpd_header=yes) if test x$have_tcpd_header = xyes; then AC_MSG_CHECKING(whether to use TCP wrappers) for tcpd_lib_path in /usr/lib /usr/local/lib; do if test -f $tcpd_lib_path/libwrap.a; then libwrap="$tcpd_lib_path/libwrap.a" break fi done if test -n "$libwrap"; then AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) fi AC_CHECK_LIB(nsl, yp_get_default_domain, libnsl="-lnsl") AC_MSG_CHECKING(whether -lwrap require -lnsl) tcpd_ldflags="-L$tcpd_lib_path $libwrap" orig_libs=$LIBS LIBS="$LIBS $tcpd_ldflags" AC_TRY_LINK([extern int hosts_access; int allow_severity, deny_severity;], [return hosts_access;], [have_tcp_wrapper=yes libnsl=""], [LIBS="$LIBS $libnsl" AC_TRY_LINK([extern int hosts_access; int allow_severity, deny_severity;], [return hosts_access;], have_tcp_wrapper=yes) ]) if test -n "$libnsl"; then AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) fi LIBWRAP_LIBS="$LIBS" LIBS=$orig_libs if test x$have_tcp_wrapper = xyes; then AC_DEFINE(HAVE_TCP_WRAPPERS) AC_SUBST(LIBWRAP_LIBS) fi 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-manager prelude_manager_conf=$configdir/prelude-manager.conf plugindir=$libdir/prelude-manager report_plugin_dir=$plugindir/reports/ decode_plugin_dir=$plugindir/decodes/ filter_plugin_dir=$plugindir/filters/ db_plugin_dir=$plugindir/db/ cm_plugin_dir=$plugindir/cm/ cm_trigger_plugin_dir=$cm_plugin_dir/trigger/ cm_comm_plugin_dir=$cm_plugin_dir/comm/ manager_fifo_dir=$localstatedir/spool/prelude-manager manager_data_dir=$datadir/prelude-manager AC_DEFINE_UNQUOTED(PRELUDE_MANAGER_CONFDIR, "$configdir") AC_DEFINE_UNQUOTED(PRELUDE_MANAGER_CONF, "$prelude_manager_conf") AC_SUBST(manager_data_dir) AC_SUBST(defined) AC_SUBST(configdir) AC_SUBST(localstatedir) AC_SUBST(prelude_manager_conf) AC_SUBST(report_plugin_dir) AC_SUBST(decode_plugin_dir) AC_SUBST(filter_plugin_dir) AC_SUBST(db_plugin_dir) AC_SUBST(cm_plugin_dir) AC_SUBST(cm_trigger_plugin_dir) AC_SUBST(cm_comm_plugin_dir) AC_SUBST(LIBWRAP_LIBS) AC_SUBST(manager_fifo_dir) CFLAGS="$CFLAGS -Wall -Wmissing-prototypes -Wmissing-declarations \ -Wbad-function-cast -Wcast-qual -Wcast-align -Wnested-externs -Wunused" AC_SUBST(CFLAGS) AC_OUTPUT([ Makefile docs/Makefile docs/api/Makefile prelude-manager.conf prelude-manager-db-create.sh manager-adduser/Makefile src/Makefile src/include/Makefile plugins/Makefile plugins/cm/Makefile plugins/cm/comm/Makefile plugins/cm/comm/generic-comm/Makefile plugins/cm/trigger/Makefile plugins/cm/trigger/generic-trigger/Makefile plugins/db/Makefile plugins/db/mysql/Makefile plugins/db/pgsql/Makefile plugins/decodes/Makefile plugins/decodes/prelude-nids/Makefile plugins/filters/Makefile plugins/reports/Makefile plugins/reports/debug/Makefile plugins/reports/textmod/Makefile ]) dnl **** TODO add the following lines in above section **** dnl docs/Makefile dnl docs/api/Makefile dnl plugins/execmod/Makefile dnl plugins/filemod/Makefile dnl plugins/htmlmod/Makefile dnl plugins/xmlmod/Makefile echo echo "*** Dumping configuration ***" echo " - Enable OpenSSL : $enable_openssl" echo " - Generate documentation : $enable_gtk_doc" echo " - Enable profiling : $enable_profiling" echo " - Enable MySQL plugin : $enable_mysql" echo " - Enable PostgreSQL plugin : $enable_pgsql";