1 # Process this file with autoconf to produce a configure script.
2 # $Id: configure.in,v 1.43 2006/04/05 15:59:18 dnelson Exp $
3 AC_INIT(spamass-milter, 0.3.1)
5 AC_REVISION($Revision: 1.43 $)
6 AC_CONFIG_SRCDIR([spamass-milter.cpp])
8 # Initialize automake now
9 AM_CONFIG_HEADER(config.h)
10 AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)
12 # Checks for programs.
16 CFLAGS="$CFLAGS $VL_WARN_CFLAGS"
17 CXXFLAGS="$CXXFLAGS $VL_WARN_CFLAGS"
20 # Enable useable exception handler if it exists.
21 AC_CXX_VERBOSE_TERMINATE_HANDLER
23 # Try and disable all inlining; gdb shows the inlined function in a
24 # stack trace and you lose the caller's frame. Bad for debugging.
25 AC_PIKE_COMPILER_FLAG(-fno-default-inline,fno_default_inline,CXXFLAGS)
26 AC_PIKE_COMPILER_FLAG(-fno-inline,fno_inline,CXXFLAGS)
32 dnl AC_ARG_VAR(SPAMC,[Spamc command])
33 AC_PATH_PROG(SPAMC, spamc)
34 if test "x$SPAMC" = x ; then
35 AC_MSG_ERROR([Spamc not found. Is SpamAssassin installed?])
37 AC_ARG_VAR(SPAMC, [Path to spamc])
38 AC_DEFINE_UNQUOTED(SPAMC, "$SPAMC", [Path to spamc])
41 AC_PATH_PROG(SENDMAIL, sendmail, , [$PATH:/usr/sbin:/usr/lib])
42 if test "x$SENDMAIL" = x ; then
43 AC_MSG_ERROR([Sendmail not found. Check your PATH variable])
45 AC_ARG_VAR(SENDMAIL, [Path to sendmail])
46 AC_DEFINE_UNQUOTED(SENDMAIL, "$SENDMAIL", [Path to sendmail])
48 # Check nroff and the options it supports
49 AC_CHECK_PROGS(NROFF, nroff)
52 if test "x$NROFF" != x; then
53 AC_MSG_CHECKING([for mdoc nroff macros])
54 AC_CACHE_VAL(ac_cv_mdoc, [
55 nroff -mdoc < /dev/null > /dev/null 2>&1
63 AC_MSG_RESULT([$MDOC])
66 AM_CONDITIONAL(HAVE_MDOC, test $MDOC = yes)
68 # Search for pthreads, and make them the default (have to do it here else
69 # the -lmilter check will fail to link)
70 ACX_PTHREAD(,AC_MSG_ERROR([Cannot determine how to use pthreads]))
71 CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
72 CXXFLAGS="$CXXFLAGS $PTHREAD_CFLAGS"
73 LIBS="$LIBS $PTHREAD_LIBS"
75 # Checks for header files.
78 AC_CHECK_HEADERS([fcntl.h syslog.h sys/cdefs.h sys/select.h])
80 # Checks for typedefs, structures, and compiler characteristics.
87 AC_ARG_ENABLE(emulate-poll, AC_HELP_STRING([--enable-emulate-poll],[use a select wrapper instead of poll (autodetected)]))
89 # If the system doesn't have poll.h, or if the user forced it, provide
90 # our own poll function
91 if test x$enable_emulate_poll != xyes ; then
92 AC_CHECK_HEADERS(poll.h)
95 if test x$enable_emulate_poll = xyes -o x$ac_cv_header_poll_h = xno ; then
96 AC_MSG_NOTICE([Emulating poll with select])
102 # Checks for library functions.
103 AC_CHECK_FUNCS([vsyslog vasprintf vsnprintf])
104 AC_CHECK_FUNCS([asprintf snprintf])
105 AC_SEARCH_LIBS(gethostbyname, nsl)
106 AC_SEARCH_LIBS(connect, socket)
107 AC_SEARCH_LIBS(inet_aton, resolv)
109 # Check for functions and verify that the system provides a prototype for them.
110 # Switch to C linkage. Though the autoconf manual claims it does
111 # automatically. It lies.
113 AC_REPLACE_FUNCS(strsep daemon)
114 AC_CHECK_DECLS([strsep, daemon])
117 # Check for libmilter and its header files in the usual locations
118 if test -d /usr/lib/libmilter ; then
119 LDFLAGS="$LDFLAGS -L/usr/lib/libmilter"
121 AC_CHECK_LIB(milter, mi_stop,,[
122 # Older sendmails require libsm for support functions
123 AC_SEARCH_LIBS(strlcpy, sm smutil)
124 $as_unset ac_cv_lib_milter_mi_stop
125 AC_CHECK_LIB(milter, mi_stop,,[
126 AC_MSG_ERROR([Cannot find libmilter])
129 AC_CHECK_HEADERS(libmilter/mfapi.h,,[
130 AC_MSG_ERROR([Please install mfapi.h from the sendmail distribution])
133 # Files to create from .in templates:
134 AC_OUTPUT(Makefile contrib/spamass-milter.spec spamass-milter.1)