]> git.donarmstrong.com Git - deb_pkgs/spamass-milter.git/blob - configure.in
Imported Upstream version 0.4.0
[deb_pkgs/spamass-milter.git] / configure.in
1 # Process this file with autoconf to produce a configure script.
2 # $Id: configure.in,v 1.46 2014/09/11 00:43:25 kovert Exp $
3 AC_INIT(spamass-milter, 0.4.0)
4 AC_PREREQ(2.53)
5 AC_REVISION($Revision: 1.46 $)
6 AC_CONFIG_SRCDIR([spamass-milter.cpp])
7
8 # Initialize automake now
9 AM_CONFIG_HEADER(config.h)
10 AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)
11
12 # Checks for programs.
13 AC_PROG_CXX
14 AC_PROG_CC
15 VL_PROG_CC_WARNINGS
16 CFLAGS="$CFLAGS $VL_WARN_CFLAGS"
17 CXXFLAGS="$CXXFLAGS $VL_WARN_CFLAGS"
18 AC_LANG(C++)
19
20 # Enable useable exception handler if it exists.
21 AC_CXX_VERBOSE_TERMINATE_HANDLER
22
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)
27
28 #PIKE_INCLUDE_PATHS
29 #PIKE_LIBRARY_PATHS
30
31 # Search for spamc
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?])
36 fi
37 AC_ARG_VAR(SPAMC, [Path to spamc])
38 AC_DEFINE_UNQUOTED(SPAMC, "$SPAMC", [Path to spamc])
39
40 # Search for sendmail
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])
44 fi
45 AC_ARG_VAR(SENDMAIL, [Path to sendmail])
46 AC_DEFINE_UNQUOTED(SENDMAIL, "$SENDMAIL", [Path to sendmail])
47
48 # Check nroff and the options it supports
49 AC_CHECK_PROGS(NROFF, nroff)
50
51 MDOC=no
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
56     if test $? = 0; then
57         ac_cv_mdoc=yes
58     else
59         ac_cv_mdoc=no
60     fi
61     ])
62     MDOC=$ac_cv_mdoc
63     AC_MSG_RESULT([$MDOC])
64 fi
65
66 AM_CONDITIONAL(HAVE_MDOC, test $MDOC = yes)
67
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"
74
75 # Checks for header files.
76 AC_HEADER_STDC
77 AC_HEADER_SYS_WAIT
78 AC_CHECK_HEADERS([fcntl.h syslog.h sys/cdefs.h sys/select.h])
79
80 # Checks for typedefs, structures, and compiler characteristics.
81 AC_C_CONST
82 AC_TYPE_PID_T
83 AC_TYPE_SIZE_T
84
85 CF_GNU_SOURCE
86
87 AC_ARG_ENABLE(emulate-poll, AC_HELP_STRING([--enable-emulate-poll],[use a select wrapper instead of poll (autodetected)]))
88
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)
93 fi
94
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])
97 AC_LIBOBJ(poll)
98 fi
99
100 DN_WITH_DMALLOC
101
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)
108
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.
112 AC_LANG_PUSH(C)
113 AC_REPLACE_FUNCS(strsep daemon)
114 AC_CHECK_DECLS([strsep, daemon])
115 AC_LANG_POP(C)
116
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"
120 fi
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])
127         ])
128 ])
129 AC_CHECK_HEADERS(libmilter/mfapi.h,,[
130         AC_MSG_ERROR([Please install mfapi.h from the sendmail distribution])
131 ])
132
133 # Files to create from .in templates:
134 AC_OUTPUT(Makefile contrib/spamass-milter.spec spamass-milter.1)