-
Notifications
You must be signed in to change notification settings - Fork 6
/
configure.ac
123 lines (95 loc) · 3.6 KB
/
configure.ac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# Copyright (C)2008 Laurence Tratt http:#tratt.net/laurie/
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
AC_INIT([extsmail], [2.8])
################################################################################
# Generic initialization
#
AC_CONFIG_HEADER(Config.h)
AC_LANG(C)
AC_PROG_CC
AC_PROG_LEX
AC_PROG_SED
AC_PROG_YACC
AC_ISC_POSIX
AC_PROG_GCC_TRADITIONAL
AC_GNU_SOURCE
###############################################################################
# Function / feature checks
#
CFLAGS="$CFLAGS -std=c99 -Wall -pedantic -Wextra"
# pledge
AH_TEMPLATE(HAVE_PLEDGE,
[Define if your platform has the pledge(2) syscall.])
AC_CHECK_HEADERS(sys/pledge.h, [AC_DEFINE(HAVE_PLEDGE)])
# kqueue (*BSD)
AH_TEMPLATE(HAVE_KQUEUE,
[Define if your platform has the kqueue family of functions.])
AC_CHECK_FUNC(kqueue, [AC_DEFINE(HAVE_KQUEUE)])
# inotify (Linux)
AH_TEMPLATE(HAVE_INOTIFY,
[Define if your platform has the inotify family of functions.])
AC_CHECK_HEADERS(sys/inotify.h, [AC_DEFINE(HAVE_INOTIFY)])
# fileno (Linux)
case `uname -s` in
Linux*|GNU* )
CFLAGS="$CFLAGS -D_POSIX_C_SOURCE=2"
LDFLAGS="$LDFLAGS -lbsd"
# arc4random_uniform
AH_TEMPLATE(HAVE_BSD_STDLIB_H,
[Define if your platform has the <bsd/stdlib.h> header file.])
AC_CHECK_HEADERS(bsd/stdlib.h, [AC_DEFINE(HAVE_BSD_STDLIB_H)])
AH_TEMPLATE(HAVE_BSD_STRING_H,
[Define if your platform has the <bsd/string.h> header file.])
AC_CHECK_HEADERS(bsd/string.h, [AC_DEFINE(HAVE_BSD_STRING_H)])
;;
esac
# set hardening flags
LDFLAGS="$LDFLAGS -Wl,-z,relro,-z,now"
# strtonum
AH_TEMPLATE(HAVE_STRTONUM, [Define if your platform has the strtonum function.])
AC_CHECK_FUNC(strtonum, [AC_DEFINE(HAVE_STRTONUM)], [AC_SUBST(COMPAT_STRTONUM,
compat/strtonum.o)])
# yylex_destroy
AH_TEMPLATE([HAVE_YYLEX_DESTROY],
[Define if lex/flex has yylex_destroy])
AC_MSG_CHECKING([whether yylex_destroy is generated by flex])
flex_version=`$LEX -V -v --version 2>/dev/null | $SED -e 's/^.* //'`
case $flex_version in
[[0-1].*] | [2.[0-4].*] | [2.5.[0-8]] | [2.5.[0-8][A-Za-z]*])
AC_MSG_RESULT([no])
;;
*)
AC_MSG_RESULT([yes])
AC_DEFINE([HAVE_YYLEX_DESTROY])
;;
esac
################################################################################
# Testing feature checks
#
AC_CHECK_PROGS(JOT, jot, false)
if test "${JOT}" = "false"; then
AC_MSG_WARN([jot not installed: cannot run test suite.])
unset JOT
fi
################################################################################
# Output
#
AC_CONFIG_FILES([Makefile])
AC_OUTPUT