2005-08-13 [hoa] 1.9.13cvs33
[claws.git] / m4 / spamassassin.m4
1 dnl check for libspamc required includes
2
3 AC_DEFUN([AC_SPAMASSASSIN],
4 [dnl
5
6 AC_CHECK_HEADERS(sys/time.h syslog.h unistd.h errno.h sys/errno.h)
7 AC_CHECK_HEADERS(time.h sysexits.h sys/socket.h netdb.h netinet/in.h)
8 AC_CHECK_HEADERS(openssl/crypto.h)
9
10 AC_CACHE_CHECK([for SHUT_RD],
11        shutrd, [
12                 AC_TRY_COMPILE([#include <sys/types.h>
13 #include <sys/socket.h>],
14                         [printf ("%d", SHUT_RD); return 0;],
15                                         [shutrd=yes],
16                                         [shutrd=no]),
17        ])
18 if test $shutrd = yes ; then
19   AC_DEFINE(HAVE_SHUT_RD, 1, HAVE_SHUT_RD)
20 fi
21
22 dnl ----------------------------------------------------------------------
23
24 AC_CHECK_FUNCS(socket strdup strtod strtol snprintf shutdown)
25
26 dnl ----------------------------------------------------------------------
27
28 AC_CACHE_CHECK([for h_errno],
29         herrno, [
30                 AC_TRY_COMPILE([#include <netdb.h>],
31                         [printf ("%d", h_errno); return 0;],
32                                         [herrno=yes],
33                                         [herrno=no]),
34         ])
35 if test $herrno = yes ; then
36   AC_DEFINE(HAVE_H_ERRNO, 1, HAVE_H_ERRNO)
37 fi
38
39 dnl ----------------------------------------------------------------------
40
41 dnl ----------------------------------------------------------------------
42
43 AC_CACHE_CHECK([for in_addr_t],
44         inaddrt, [
45                 AC_TRY_COMPILE([#include <sys/types.h>
46 #include <netinet/in.h>],
47                         [in_addr_t foo; return 0;],
48                                         [inaddrt=yes],
49                                         [inaddrt=no]),
50         ])
51 if test $inaddrt = no ; then
52   AC_CHECK_TYPE(in_addr_t, unsigned long)
53 fi
54
55 dnl ----------------------------------------------------------------------
56
57 AC_CACHE_CHECK([for INADDR_NONE],
58         haveinaddrnone, [
59                 AC_TRY_COMPILE([#include <sys/types.h>
60 #include <netinet/in.h>],
61                         [in_addr_t foo = INADDR_NONE; return 0;],
62                                         [haveinaddrnone=yes],
63                                         [haveinaddrnone=no]),
64         ])
65 if test $haveinaddrnone = yes ; then
66   AC_DEFINE(HAVE_INADDR_NONE, 1, HAVE_INADDR_NONE)
67 fi
68
69 dnl ----------------------------------------------------------------------
70
71 AC_CACHE_CHECK([for EX__MAX],
72         haveexmax, [
73                 AC_TRY_COMPILE([#ifdef HAVE_SYSEXITS_H
74 #include <sysexits.h>
75 #endif
76 #include <errno.h>],
77                         [int foo = EX__MAX; return 0;],
78                                         [haveexmax=yes],
79                                         [haveexmax=no]),
80         ])
81 if test $haveexmax = yes ; then
82   AC_DEFINE(HAVE_EX__MAX, 1, HAVE_EX__MAX)
83 fi
84
85 if test x$ac_cv_enable_openssl = xyes; then
86     AC_DEFINE(SPAMC_SSL, 1, Compile libspamc with OpenSSL support)
87 fi
88
89 ])