# Process this file with autoconf to produce a configure script. # $Id: configure.in,v 1.46 2014/09/11 00:43:25 kovert Exp $ AC_INIT(spamass-milter, 0.4.0) AC_PREREQ(2.53) AC_REVISION($Revision: 1.46 $) AC_CONFIG_SRCDIR([spamass-milter.cpp]) # Initialize automake now AM_CONFIG_HEADER(config.h) AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION) # Checks for programs. AC_PROG_CXX AC_PROG_CC VL_PROG_CC_WARNINGS CFLAGS="$CFLAGS $VL_WARN_CFLAGS" CXXFLAGS="$CXXFLAGS $VL_WARN_CFLAGS" AC_LANG(C++) # Enable useable exception handler if it exists. AC_CXX_VERBOSE_TERMINATE_HANDLER # Try and disable all inlining; gdb shows the inlined function in a # stack trace and you lose the caller's frame. Bad for debugging. AC_PIKE_COMPILER_FLAG(-fno-default-inline,fno_default_inline,CXXFLAGS) AC_PIKE_COMPILER_FLAG(-fno-inline,fno_inline,CXXFLAGS) #PIKE_INCLUDE_PATHS #PIKE_LIBRARY_PATHS # Search for spamc dnl AC_ARG_VAR(SPAMC,[Spamc command]) AC_PATH_PROG(SPAMC, spamc) if test "x$SPAMC" = x ; then AC_MSG_ERROR([Spamc not found. Is SpamAssassin installed?]) fi AC_ARG_VAR(SPAMC, [Path to spamc]) AC_DEFINE_UNQUOTED(SPAMC, "$SPAMC", [Path to spamc]) # Search for sendmail AC_PATH_PROG(SENDMAIL, sendmail, , [$PATH:/usr/sbin:/usr/lib]) if test "x$SENDMAIL" = x ; then AC_MSG_ERROR([Sendmail not found. Check your PATH variable]) fi AC_ARG_VAR(SENDMAIL, [Path to sendmail]) AC_DEFINE_UNQUOTED(SENDMAIL, "$SENDMAIL", [Path to sendmail]) # Check nroff and the options it supports AC_CHECK_PROGS(NROFF, nroff) MDOC=no if test "x$NROFF" != x; then AC_MSG_CHECKING([for mdoc nroff macros]) AC_CACHE_VAL(ac_cv_mdoc, [ nroff -mdoc < /dev/null > /dev/null 2>&1 if test $? = 0; then ac_cv_mdoc=yes else ac_cv_mdoc=no fi ]) MDOC=$ac_cv_mdoc AC_MSG_RESULT([$MDOC]) fi AM_CONDITIONAL(HAVE_MDOC, test $MDOC = yes) # Search for pthreads, and make them the default (have to do it here else # the -lmilter check will fail to link) ACX_PTHREAD(,AC_MSG_ERROR([Cannot determine how to use pthreads])) CFLAGS="$CFLAGS $PTHREAD_CFLAGS" CXXFLAGS="$CXXFLAGS $PTHREAD_CFLAGS" LIBS="$LIBS $PTHREAD_LIBS" # Checks for header files. AC_HEADER_STDC AC_HEADER_SYS_WAIT AC_CHECK_HEADERS([fcntl.h syslog.h sys/cdefs.h sys/select.h]) # Checks for typedefs, structures, and compiler characteristics. AC_C_CONST AC_TYPE_PID_T AC_TYPE_SIZE_T CF_GNU_SOURCE AC_ARG_ENABLE(emulate-poll, AC_HELP_STRING([--enable-emulate-poll],[use a select wrapper instead of poll (autodetected)])) # If the system doesn't have poll.h, or if the user forced it, provide # our own poll function if test x$enable_emulate_poll != xyes ; then AC_CHECK_HEADERS(poll.h) fi if test x$enable_emulate_poll = xyes -o x$ac_cv_header_poll_h = xno ; then AC_MSG_NOTICE([Emulating poll with select]) AC_LIBOBJ(poll) fi DN_WITH_DMALLOC # Checks for library functions. AC_CHECK_FUNCS([vsyslog vasprintf vsnprintf]) AC_CHECK_FUNCS([asprintf snprintf]) AC_SEARCH_LIBS(gethostbyname, nsl) AC_SEARCH_LIBS(connect, socket) AC_SEARCH_LIBS(inet_aton, resolv) # Check for functions and verify that the system provides a prototype for them. # Switch to C linkage. Though the autoconf manual claims it does # automatically. It lies. AC_LANG_PUSH(C) AC_REPLACE_FUNCS(strsep daemon) AC_CHECK_DECLS([strsep, daemon]) AC_LANG_POP(C) # Check for libmilter and its header files in the usual locations if test -d /usr/lib/libmilter ; then LDFLAGS="$LDFLAGS -L/usr/lib/libmilter" fi AC_CHECK_LIB(milter, mi_stop,,[ # Older sendmails require libsm for support functions AC_SEARCH_LIBS(strlcpy, sm smutil) $as_unset ac_cv_lib_milter_mi_stop AC_CHECK_LIB(milter, mi_stop,,[ AC_MSG_ERROR([Cannot find libmilter]) ]) ]) AC_CHECK_HEADERS(libmilter/mfapi.h,,[ AC_MSG_ERROR([Please install mfapi.h from the sendmail distribution]) ]) # Files to create from .in templates: AC_OUTPUT(Makefile contrib/spamass-milter.spec spamass-milter.1)