Fix bug 4248 “Suport C99 compilers in m4/spamassassin.m4”
[claws.git] / m4 / spamassassin.m4
1 dnl check for libspamc required includes
2 dnl Copyright (C) 2003 Free Software Foundation, Inc.
3 dnl This file is free software; the Free Software Foundation
4 dnl gives unlimited permission to copy and/or distribute it,
5 dnl with or without modifications, as long as this notice is preserved.
6
7 AC_DEFUN([AC_SPAMASSASSIN],
8 [dnl
9
10 AC_CHECK_HEADERS(sys/time.h syslog.h unistd.h errno.h sys/errno.h)
11 AC_CHECK_HEADERS(time.h sysexits.h sys/socket.h netdb.h netinet/in.h)
12
13 AC_CACHE_CHECK([for SHUT_RD],
14        spamassassin_cv_has_shutrd, [
15                 AC_TRY_COMPILE([#include <sys/types.h>
16 #include <stdio.h>
17 #include <sys/socket.h>],
18                         [printf ("%d", SHUT_RD); return 0;],
19                                         [spamassassin_cv_has_shutrd=yes],
20                                         [spamassassin_cv_has_shutrd=no]),
21        ])
22 if test $spamassassin_cv_has_shutrd = yes ; then
23   AC_DEFINE(HAVE_SHUT_RD, 1, HAVE_SHUT_RD)
24 fi
25
26 dnl ----------------------------------------------------------------------
27
28 AC_CHECK_FUNCS(socket strdup strtod strtol snprintf shutdown)
29
30 dnl ----------------------------------------------------------------------
31
32 AC_CACHE_CHECK([for h_errno],
33         spamassassin_cv_has_herrno, [
34                 AC_TRY_COMPILE([#include <netdb.h>
35 #include <stdio.h>
36 ],
37                         [printf ("%d", h_errno); return 0;],
38                                         [spamassassin_cv_has_herrno=yes],
39                                         [spamassassin_cv_has_herrno=no]),
40         ])
41 if test $spamassassin_cv_has_herrno = yes ; then
42   AC_DEFINE(HAVE_H_ERRNO, 1, HAVE_H_ERRNO)
43 fi
44
45 dnl ----------------------------------------------------------------------
46
47 dnl ----------------------------------------------------------------------
48
49 AC_CACHE_CHECK([for in_addr_t],
50         spamassassin_cv_has_inaddrt, [
51                 AC_TRY_COMPILE([#include <sys/types.h>
52 #include <netinet/in.h>],
53                         [in_addr_t foo; return 0;],
54                                         [spamassassin_cv_has_inaddrt=yes],
55                                         [spamassassin_cv_has_inaddrt=no]),
56         ])
57 if test $spamassassin_cv_has_inaddrt = no ; then
58   AC_CHECK_TYPE(in_addr_t, unsigned long)
59 fi
60
61 dnl ----------------------------------------------------------------------
62
63 AC_CACHE_CHECK([for INADDR_NONE],
64         spamassassin_cv_has_haveinaddrnone, [
65                 AC_TRY_COMPILE([#include <sys/types.h>
66 #include <netinet/in.h>],
67                         [in_addr_t foo = INADDR_NONE; return 0;],
68                                         [spamassassin_cv_has_haveinaddrnone=yes],
69                                         [spamassassin_cv_has_haveinaddrnone=no]),
70         ])
71 if test $spamassassin_cv_has_haveinaddrnone = yes ; then
72   AC_DEFINE(HAVE_INADDR_NONE, 1, HAVE_INADDR_NONE)
73 fi
74
75 dnl ----------------------------------------------------------------------
76
77 AC_CACHE_CHECK([for EX__MAX],
78         spamassassin_cv_has_haveexmax, [
79                 AC_TRY_COMPILE([#ifdef HAVE_SYSEXITS_H
80 #include <sysexits.h>
81 #endif
82 #include <errno.h>],
83                         [int foo = EX__MAX; return 0;],
84                                         [spamassassin_cv_has_haveexmax=yes],
85                                         [spamassassin_cv_has_haveexmax=no]),
86         ])
87 if test $spamassassin_cv_has_haveexmax = yes ; then
88   AC_DEFINE(HAVE_EX__MAX, 1, HAVE_EX__MAX)
89 fi
90
91 ])