0.9.6claws50
[claws.git] / ac / 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_LIB(socket, socket)
25 AC_CHECK_LIB(crypto, CRYPTO_lock)
26 AC_CHECK_LIB(ssl, SSL_CTX_free,,,-lcrypto)
27 AC_CHECK_LIB(inet, connect)
28 AC_CHECK_LIB(nsl, t_accept)
29 AC_CHECK_LIB(dl, dlopen)
30
31 AC_CHECK_FUNCS(socket strdup strtod strtol snprintf shutdown)
32
33 dnl ----------------------------------------------------------------------
34
35 AC_CACHE_CHECK([for h_errno],
36         herrno, [
37                 AC_TRY_COMPILE([#include <netdb.h>],
38                         [printf ("%d", h_errno); return 0;],
39                                         [herrno=yes],
40                                         [herrno=no]),
41         ])
42 if test $herrno = yes ; then
43   AC_DEFINE(HAVE_H_ERRNO, 1, HAVE_H_ERRNO)
44 fi
45
46 dnl ----------------------------------------------------------------------
47
48 dnl ----------------------------------------------------------------------
49
50 AC_CACHE_CHECK([for in_addr_t],
51         inaddrt, [
52                 AC_TRY_COMPILE([#include <sys/types.h>
53 #include <netinet/in.h>],
54                         [in_addr_t foo; return 0;],
55                                         [inaddrt=yes],
56                                         [inaddrt=no]),
57         ])
58 if test $inaddrt = no ; then
59   AC_CHECK_TYPE(in_addr_t, unsigned long)
60 fi
61
62 dnl ----------------------------------------------------------------------
63
64 AC_CACHE_CHECK([for INADDR_NONE],
65         haveinaddrnone, [
66                 AC_TRY_COMPILE([#include <sys/types.h>
67 #include <netinet/in.h>],
68                         [in_addr_t foo = INADDR_NONE; return 0;],
69                                         [haveinaddrnone=yes],
70                                         [haveinaddrnone=no]),
71         ])
72 if test $haveinaddrnone = yes ; then
73   AC_DEFINE(HAVE_INADDR_NONE, 1, HAVE_INADDR_NONE)
74 fi
75
76 dnl ----------------------------------------------------------------------
77
78 AC_CACHE_CHECK([for EX__MAX],
79         haveexmax, [
80                 AC_TRY_COMPILE([#ifdef HAVE_SYSEXITS_H
81 #include <sysexits.h>
82 #endif
83 #include <errno.h>],
84                         [int foo = EX__MAX; return 0;],
85                                         [haveexmax=yes],
86                                         [haveexmax=no]),
87         ])
88 if test $haveexmax = yes ; then
89   AC_DEFINE(HAVE_EX__MAX, 1, HAVE_EX__MAX)
90 fi
91
92 if test "$USE_OPENSSL" -ne 0; then
93     AC_DEFINE(SPAMC_SSL, 1, Compile libspamc with OpenSSL support)
94 fi
95
96 ])