-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
232 lines (203 loc) · 5.86 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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
dnl Process this file with autoconf to produce a configure script.
AC_PREREQ([2.71])
AC_INIT([masqmail],[0.3.6-dev],[meillo@marmaro.de])
AC_CONFIG_SRCDIR([src/masqmail.c])
AC_CONFIG_HEADERS([config.h])
AM_INIT_AUTOMAKE()
dnl Checks for programs.
AC_PROG_CC
AC_PROG_RANLIB
dnl Checks for libraries.
PKG_CHECK_MODULES(GLIB, glib-2.0)
AC_SUBST(GLIB_LIBS)
AC_SUBST(GLIB_CFLAGS)
dnl resolver support (default is use it)
AC_ARG_ENABLE(resolver,
[ --disable-resolver disable resolver support],
if test "$enable_resolver" != 'no'; then
resolver_enabled='yes'
fi,
resolver_enabled='yes'
)
if test "$resolver_enabled" = yes; then
AC_DEFINE(ENABLE_RESOLVER, 1, [If the resolver is to be used])
dnl checks necessary for libc5:
dnl if there is res_search in libc, it is probably libc5
dnl if not, it is probably libc6 and we need libresolv
AC_CHECK_LIB(c, res_search, need_resolv=no, need_resolv=yes)
if test "$need_resolv" = yes; then
AC_CHECK_LIB(resolv, res_search,
has_resolv=yes; RESOLV_LIBS="-lresolv",
has_resolv=no)
if test "$has_resolv" = no; then
saved_LIBS="$LIBS"
LIBS="$LIBS -lresolv"
AC_MSG_CHECKING(for res_search in -lresolv)
AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[[#include <resolv.h>]],
[[res_search (0, 0, 0, 0, 0);]]
)],
[RESOLV_LIBS="-lresolv"; has_resolv=yes; AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)])
LIBS="$saved_LIBS"
fi
if test "$has_resolv" = no; then
AC_MSG_ERROR("no libresolv")
RESOLV_LIBS=''
fi
fi
else
RESOLV_LIBS=''
fi
AC_SUBST(RESOLV_LIBS)
dnl if there is no getline, we define it using getdelim in src/masqmail.h
AC_CHECK_FUNCS(getline)
dnl if there is no fdatasync, we define it to fsync in src/masqmail.h
AC_CHECK_FUNCS(fdatasync)
dnl Checks for header files.
AC_CHECK_HEADERS(fcntl.h sys/time.h syslog.h unistd.h)
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_STRUCT_TM
dnl Checks for library functions.
AC_FUNC_FNMATCH
AC_FUNC_STRFTIME
AC_FUNC_VPRINTF
AC_CHECK_FUNCS(select socket strerror strstr)
dnl user and group configuration
AC_ARG_WITH(user,
[ --with-user=USER set user [mail]],
)
if test "x$with_user" = 'x'; then
with_user='mail'
fi
AC_ARG_WITH(group,
[ --with-group=GROUP set group [mail]],
)
if test "x$with_group" = 'x'; then
with_group='mail'
fi
dnl debugging support (default is use it)
AC_ARG_ENABLE(debug,
[ --disable-debug disable debugging],
if test "x$enable_debug" != 'xno'; then
debug_enabled='yes'
fi,
debug_enabled='yes'
)
if test "x$debug_enabled" = xyes; then
AC_DEFINE(ENABLE_DEBUG, 1, [If debugging is enabled])
fi
AC_DEFINE_UNQUOTED(DEF_MAIL_USER, "${with_user}", [The mail user])
AC_SUBST(with_user)
AC_DEFINE_UNQUOTED(DEF_MAIL_GROUP, "${with_group}", [The mail group])
AC_SUBST(with_group)
dnl optional features
MD5_LIBS=''
BASE64_LIBS=''
dnl auth support (default: use it)
AC_ARG_ENABLE(auth,
[ --disable-auth disable AUTH (RFC 2554) client support],
if test "x$enable_auth" != 'xno'; then
auth_enabled='yes'
fi,
auth_enabled='yes'
)
if test "x$auth_enabled" = xyes; then
AC_DEFINE(ENABLE_AUTH, 1, [If AUTH is enabled])
BASE64_LIBS='base64/libbase64.a'
need_md5='yes'
fi
AC_SUBST(BASE64_LIBS)
if test "x$need_md5" = 'xyes'; then
MD5_LIBS='md5/libmd5.a'
fi
AC_SUBST(MD5_LIBS)
dnl liblockfile
AC_ARG_WITH(liblockfile,
[ --with-liblockfile use liblock (for Debian)],
)
if test "x$with_liblockfile" = 'xno'; then
with_liblockfile=''
fi
if test "x$with_liblockfile" != 'x'; then
with_liblockfile='yes'
fi
if test "x$with_liblockfile" = xyes; then
AC_CHECK_LIB(lockfile, maillock, has_lockfile=yes, AC_MSG_ERROR("no liblockfile"))
LOCKFILE_LIBS='-llockfile'
AC_DEFINE(USE_LIBLOCKFILE, 1, [If liblockfile is to be used])
else
LOCKFILE_LIBS=''
fi
AC_SUBST(LOCKFILE_LIBS)
AC_SUBST(USE_LIBLOCKFILE)
dnl log and spool directories
AC_ARG_WITH(logdir,
[ --with-logdir=DIR set log directory [/var/log/masqmail]],
,
with_logdir='/var/log/masqmail'
)
AC_DEFINE_UNQUOTED(LOG_DIR, "${with_logdir}", [The log directory])
AC_SUBST(with_logdir)
AC_ARG_WITH(spooldir,
[ --with-spooldir=DIR set spool directory [/var/spool/masqmail]],
,
with_spooldir='/var/spool/masqmail'
)
AC_DEFINE_UNQUOTED(SPOOL_DIR, "${with_spooldir}", [The spool directory])
AC_SUBST(with_spooldir)
dnl configuration file
AC_ARG_WITH(confdir,
[ --with-confdir=DIR directory for configuration [/etc/masqmail]],
,
with_confdir='/etc/masqmail'
)
AC_DEFINE_UNQUOTED(CONF_DIR, "${with_confdir}", [The configuration file location])
AC_SUBST(with_confdir)
dnl dir for pid files
AC_ARG_WITH(piddir,
[ --with-piddir=DIR directory for pid files [/var/run]],
,
with_piddir='/var/run'
)
AC_DEFINE_UNQUOTED(PID_DIR, "${with_piddir}", [The pid file location])
AC_SUBST(with_piddir)
dnl dir for lock files
AC_ARG_WITH(lockdir,
[ --with-lockdir=DIR directory for lock files [/var/lock/masqmail]],
,
with_lockdir='/var/lock/masqmail'
)
AC_DEFINE_UNQUOTED(LOCK_DIR, "${with_lockdir}", [The lock file location])
AC_SUBST(with_lockdir)
test "x$prefix" = xNONE && prefix="$ac_default_prefix"
dnl well, /me/ thought that autoconf should make things _easy_ ... -- oku
dnl I needed the two `eval's to get the variable expanded in all cases -- meillo
dnl this is just horrible! -- meillo
AC_DEFINE_UNQUOTED(DATA_DIR, "`eval eval echo $datadir`/masqmail", [The data directory])
dnl gymnastics to get the correct path where masqmail should be installed
dnl we need this to call ourselves in failmsg.c
if test "x${exec_prefix}" != 'xNONE'; then
AC_DEFINE_UNQUOTED(SBINDIR, "${exec_prefix}/sbin", [The sbin directory])
else
if test "x${prefix}" != 'xNONE'; then
AC_DEFINE_UNQUOTED(SBINDIR, "${prefix}/sbin")
else
AC_DEFINE_UNQUOTED(SBINDIR, "/usr/sbin")
fi
fi
AC_CONFIG_FILES([
Makefile
src/Makefile
src/base64/Makefile
src/md5/Makefile
man/Makefile
docs/Makefile
examples/Makefile
tpl/Makefile
])
AC_OUTPUT