configure.in at [7c39ff9950]

File configure.in artifact 5b48f01251 part of check-in 7c39ff9950



AC_INIT(packetbl, 0.7-beta1)

AC_ARG_WITH(firedns, 
	AC_HELP_STRING([--with-firedns], [If enabled, firedns is used for the name resolution]),
	[ac_cv_use_firedns=yes], [ac_cv_use_firedns=no])

AC_ARG_WITH(cache,
	AC_HELP_STRING([--with-cache], [If enabled, a caching mechanism is used.]),
	[ac_cv_use_cache=yes], [ac_cv_use_cache=no])

AC_CANONICAL_TARGET

AC_MSG_CHECKING(operating system type)

case $target in
*-*-linux-*)
	AC_MSG_RESULT(linux)
	ac_cv_target_ok=yes
	;;
*)
	AC_MSG_RESULT(not linux)
	;;
esac

if test "$ac_cv_target_ok" != "yes" ; then
	AC_MSG_ERROR(This program can only be compiled under Linux.)
fi

AC_PROG_CC
AC_PROG_INSTALL

AC_ARG_WITH(stats, AC_HELP_STRING([--with-stats], [Enable statistics collection packetbl_getstat]), [
	ACX_PTHREAD([
		AC_DEFINE(HAVE_THREADING, [], [Enable if you have threading support])
		AC_DEFINE(USE_SOCKSTAT, [], [Enable if you want to use socket statistics])
	])
])

AC_ARG_WITH(stats-socket, AC_HELP_STRING([--with-stats-socket], [define a location for the stats socket]), [
	if test "$withval+set" != "set"; then
		AC_DEFINE_UNQUOTED(SOCKSTAT_PATH, ["$withval"], [Define the path of the stats socket])
	fi
	])
	

AC_CHECK_HEADERS(libipq.h stdlib.h stdio.h string.h netinet/in.h netinet/tcp.h resolv.h netdb.h ctype.h syslog.h sys/stat.h sys/types.h unistd.h getopt.h dotconf.h libpool.h time.h)

AC_CHECK_LIB(config, config_init, [
	AC_DEFINE(HAVE_LIBCONFIG, [], [Enable if you have the required libconfig library.])
	LIBS="$LIBS -lconfig"
], [
	AC_MSG_FAILURE([You must have libconfig])
])

AC_CHECK_LIB(netfilter_queue, nfq_set_verdict, [
	AC_DEFINE(HAVE_NFQUEUE, [], [Enable if you have nfqueue])
	LIBS="$LIBS -lnetfilter_queue"
	INCLUDES="$INCLUDES -I/usr/include/libnetfilter_queue"
	have_nfqueue='yes'
])

if test "$have_nfqueue" != 'yes'; then
	AC_MSG_FAILURE([nfqueue was not found.])
fi

AC_CHECK_LIB([nfnetlink], [nfnl_listen], [
	AC_DEFINE(HAVE_NFNETLINK, [], [Enable if netlink exists])
	LIBS="$LIBS -lnfnetlink"
	have_nfnetlink='yes'
])

if test "$have_nfnetlink" != 'yes'; then
	AC_MSG_FAILURE([nfnetlink was not found.])
fi

AC_MSG_CHECKING(whether to use firedns)
if test "$ac_cv_use_firedns" == "yes" ; then
	AC_MSG_RESULT(yes)
	AC_CHECK_LIB(firedns, firedns_resolveip4, [
		AC_DEFINE(HAVE_FIREDNS, [], [Enable if you have the optional firedns library])
		LIBS="$LIBS -lfiredns"
	], [
		AC_MSG_FAILURE([You asked for firedns, but the libraries aren't installed.  Install them, then rerun configure.])
	])
else
	AC_MSG_RESULT(no)
fi

AC_MSG_CHECKING(whether caching is enabled)
if test "$ac_cv_use_cache" == "yes" ; then
	AC_MSG_RESULT(yes)
	AC_DEFINE(USE_CACHE, [], [Enable if you want to use a caching mechanism.])
else
	AC_MSG_RESULT(no)
fi

AC_CONFIG_FILES([Makefile])
AC_CONFIG_HEADERS([config.h])
AC_OUTPUT

# vim:syntax=off