masqmail-0.2

view configure.ac @ 154:4917e764f108

Fix handling of --with-liblockfile=no or --without-liblockfile thanks to Nico R.
author meillo@marmaro.de
date Wed, 14 Jul 2010 11:48:59 +0200
parents 311d4ac8a2eb
children 0e7601b8cebf
line source
1 dnl Process this file with autoconf to produce a configure script.
3 AC_PREREQ(2.59)
4 AC_INIT(masqmail, 0.2.25, meillo@marmaro.de)
5 AC_CONFIG_SRCDIR([src/masqmail.c])
6 AM_CONFIG_HEADER(config.h)
7 AM_INIT_AUTOMAKE()
9 dnl Checks for programs.
11 dnl Checks for libraries.
13 AC_PROG_CC
14 AC_ISC_POSIX
15 AC_STDC_HEADERS
16 dnl AC_ARG_PROGRAM
17 AC_PROG_RANLIB
19 PKG_CHECK_MODULES(GLIB, glib-2.0)
20 AC_SUBST(GLIB_LIBS)
21 AC_SUBST(GLIB_CFLAGS)
23 dnl resolver support (default is use it)
24 AC_ARG_ENABLE(resolver,
25 [ --disable-resolver disable resolver support],
26 if test "$enable_resolver" != 'no'; then
27 resolver_enabled='yes'
28 fi,
29 resolver_enabled='yes'
30 )
32 if test "$resolver_enabled" = yes; then
33 AC_DEFINE(ENABLE_RESOLVER, 1, [If the resolver is to be used])
34 dnl checks necessary for libc5:
35 dnl if there is res_search in libc, it is probably libc5
36 dnl if not, it is probably libc6 and we need libresolv
37 AC_CHECK_LIB(c, res_search, need_resolv=no, need_resolv=yes)
38 if test "$need_resolv" = yes; then
39 AC_CHECK_LIB(resolv, res_search,
40 has_resolv=yes; RESOLV_LIBS="-lresolv",
41 has_resolv=no)
42 if test "$has_resolv" = no; then
43 saved_LIBS="$LIBS"
44 LIBS="$LIBS -lresolv"
45 AC_MSG_CHECKING(for res_search in -lresolv)
46 AC_TRY_LINK([#include <resolv.h>],
47 [res_search (0, 0, 0, 0, 0);],
48 RESOLV_LIBS="-lresolv"; has_resolv=yes; AC_MSG_RESULT(yes),
49 AC_MSG_RESULT(no));
50 LIBS="$saved_LIBS"
51 fi
52 if test "$has_resolv" = no; then
53 AC_MSG_ERROR("no libresolv")
54 RESOLV_LIBS=''
55 fi
56 fi
57 else
58 RESOLV_LIBS=''
59 fi
60 AC_SUBST(RESOLV_LIBS)
62 dnl if there is no getline, we define it using getdelim in src/masqmail.h
63 AC_CHECK_FUNCS(getline)
65 dnl if there is no fdatasync, we define it to fsync in src/masqmail.h
66 AC_CHECK_FUNCS(fdatasync)
68 dnl Checks for header files.
69 AC_HEADER_STDC
70 AC_CHECK_HEADERS(fcntl.h sys/time.h syslog.h unistd.h)
72 dnl Checks for typedefs, structures, and compiler characteristics.
73 AC_C_CONST
74 AC_TYPE_PID_T
75 AC_TYPE_SIZE_T
76 AC_HEADER_TIME
77 AC_STRUCT_TM
79 dnl Checks for library functions.
80 AC_FUNC_FNMATCH
81 AC_TYPE_SIGNAL
82 AC_FUNC_STRFTIME
83 AC_FUNC_VPRINTF
84 AC_CHECK_FUNCS(select socket strerror strstr)
86 dnl user and group configuration
87 AC_ARG_WITH(user,
88 [ --with-user=USER set user [mail]],
89 )
90 if test "x$with_user" = 'x'; then
91 with_user='mail'
92 fi
94 AC_ARG_WITH(group,
95 [ --with-group=GROUP set group [trusted]],
96 )
97 if test "x$with_group" = 'x'; then
98 with_group='trusted'
99 fi
101 dnl debugging support (default is use it)
102 AC_ARG_ENABLE(debug,
103 [ --disable-debug disable debugging],
104 if test "x$enable_debug" != 'xno'; then
105 debug_enabled='yes'
106 fi,
107 debug_enabled='yes'
108 )
109 if test "x$debug_enabled" = xyes; then
110 AC_DEFINE(ENABLE_DEBUG, 1, [If debugging is enabled])
111 fi
113 AC_DEFINE_UNQUOTED(DEF_MAIL_USER, "${with_user}", [The mail user])
114 AC_SUBST(with_user)
115 AC_DEFINE_UNQUOTED(DEF_MAIL_GROUP, "${with_group}", [The mail group])
116 AC_SUBST(with_group)
118 dnl link glib statically?
119 AC_ARG_WITH(glib_static,
120 [ --with-glib-static=path link glib statically (path mandatory!)],
121 )
122 if test "x$with_glib_static" != 'x'; then
123 GLIB_LIBS=$with_glib_static
124 AC_SUBST(GLIB_LIBS)
125 fi
127 dnl optional features
128 MD5_LIBS=''
129 BASE64_LIBS=''
131 dnl smtp server support (default is use it)
132 AC_ARG_ENABLE(smtp_server,
133 [ --disable-smtp-server disable smtp server support],
134 if test "x$enable_smtp_server" != 'xno'; then
135 smtp_server_enabled='yes'
136 fi,
137 smtp_server_enabled='yes'
138 )
139 if test "x$smtp_server_enabled" = xyes; then
140 AC_DEFINE(ENABLE_SMTP_SERVER, 1, [If the SMTP server is enabled])
141 fi
143 dnl pop support (default is use it)
144 AC_ARG_ENABLE(pop3,
145 [ --disable-pop3 disable pop3 support],
146 if test "x$enable_pop3" != 'xno'; then
147 pop3_enabled='yes'
148 fi,
149 pop3_enabled='yes'
150 )
151 if test "x$pop3_enabled" = xyes; then
152 AC_DEFINE(ENABLE_POP3, 1, [If the POP3 support is enabled])
153 # MD5_LIBS='md5/libmd5c.a'
154 need_md5='yes'
155 fi
157 dnl auth support (default is to not use it)
158 AC_ARG_ENABLE(auth,
159 [ --enable-auth enable AUTH (RFC 2554) client support],
160 if test "x$enable_auth" != 'xno'; then
161 auth_enabled='yes'
162 fi,
163 )
164 if test "x$auth_enabled" = xyes; then
165 AC_DEFINE(ENABLE_AUTH, 1, [If AUTH is enabled])
166 BASE64_LIBS='base64/libbase64.a'
167 # MD5_LIBS='md5/libmd5c.a'
168 need_md5='yes'
169 fi
170 AC_SUBST(BASE64_LIBS)
172 dnl maildir support (default is to not use it)
173 AC_ARG_ENABLE(maildir,
174 [ --enable-maildir enable qmail style maildir support],
175 if test "x$enable_maildir" != 'xno'; then
176 maildir_enabled='yes'
177 fi,
178 )
179 if test "x$maildir_enabled" = xyes; then
180 AC_DEFINE(ENABLE_MAILDIR, 1, [If Maildirs are enabled])
181 fi
183 dnl libcrypto
184 AC_ARG_WITH(libcrypto,
185 [ --with-libcrypto use libcrypto],
186 )
187 if test "x$with_libcrypto" != 'xyes'; then
188 with_libcrypto='no'
189 fi
191 if test "x$need_md5" = 'xyes'; then
192 dnl check whether we have md5 in libcrypto if md5 needed and we shall link with libcrypto
193 if test "x$with_libcrypto" = "xyes"; then
194 AC_CHECK_LIB(crypto, MD5, has_crypto='yes', AC_MSG_ERROR('no libcrypto'))
195 if test "x$has_crypto" = 'xyes'; then
196 AC_DEFINE(USE_LIB_CRYPTO, 1, [If libcrypto is available])
197 MD5_LIBS='-lcrypto'
198 fi
199 else
200 MD5_LIBS='md5/libmd5c.a'
201 fi
202 fi
203 AC_SUBST(MD5_LIBS)
205 dnl ident support (default is to not use it)
206 IDENT_LIBS=''
207 AC_ARG_ENABLE(ident,
208 [ --enable-ident enable ident (RFC 1413) support],
209 if test "x$enable_ident" != 'xno'; then
210 ident_enabled='yes'
211 fi,
212 )
213 AC_SUBST(has_ident)
214 if test "x$ident_enabled" = xyes; then
215 AC_DEFINE(ENABLE_IDENT, 1, [If ident is enabled])
216 AC_CHECK_LIB(ident, ident_id, IDENT_LIBS='-lident', IDENT_LIBS='libident/libident.a')
217 fi
218 AC_SUBST(IDENT_LIBS)
220 dnl mserver support (default is to not use it)
221 AC_ARG_ENABLE(mserver,
222 [ --enable-mserver enable mserver support],
223 if test "x$enable_mserver" != 'xno'; then
224 mserver_enabled='yes'
225 fi,
226 )
227 if test "x$mserver_enabled" = xyes; then
228 AC_DEFINE(ENABLE_MSERVER, 1, [If mserver support is enabled])
229 fi
231 dnl liblockfile
232 AC_ARG_WITH(liblockfile,
233 [ --with-liblockfile use liblock (for Debian)],
234 )
235 if test "x$with_liblockfile" = 'xno'; then
236 with_liblockfile=''
237 fi
238 if test "x$with_liblockfile" != 'x'; then
239 with_liblockfile='yes'
240 fi
241 if test "x$with_liblockfile" = xyes; then
242 AC_CHECK_LIB(lockfile, maillock, has_lockfile=yes, AC_MSG_ERROR("no liblockfile"))
243 LOCKFILE_LIBS='-llockfile'
244 AC_DEFINE(USE_LIBLOCKFILE, 1, [If liblockfile is to be used])
245 else
246 LOCKFILE_LIBS=''
247 fi
248 AC_SUBST(LOCKFILE_LIBS)
249 AC_SUBST(USE_LIBLOCKFILE)
251 dnl log and spool directories
252 AC_ARG_WITH(logdir,
253 [ --with-logdir=DIR set log directory [/var/masqmail]],
254 ,
255 with_logdir='/var/log/masqmail/'
256 )
257 AC_SUBST(with_logdir)
259 AC_ARG_WITH(spooldir,
260 [ --with-spooldir=DIR set spool directory [/var/spool/masqmail]],
261 ,
262 with_spooldir='/var/spool/masqmail/'
263 )
264 AC_SUBST(with_spooldir)
266 dnl configuration file
267 AC_ARG_WITH(confdir,
268 [ --with-confdir directory for configuration [/etc/masqmail]],
269 ,
270 with_confdir='/etc/masqmail'
271 )
272 AC_DEFINE_UNQUOTED(CONF_DIR, "${with_confdir}", [The configuration file location])
273 AC_SUBST(with_confdir)
275 test "x$prefix" = xNONE && prefix="$ac_default_prefix"
277 dnl well, /me/ thought that autoconf should make things _easy_ ... -- oku
278 dnl I needed the two `eval's to get the variable expanded in all cases -- meillo
279 dnl this is just horrible! -- meillo
280 AC_DEFINE_UNQUOTED(DATA_DIR, "`eval eval echo $datadir`/masqmail", [The data directory])
282 dnl gymnastics to get the correct path where masqmail should be installed
283 dnl we need this to call ourselves in failmsg.c
284 if test "x${exec_prefix}" != 'xNONE'; then
285 AC_DEFINE_UNQUOTED(SBINDIR, "${exec_prefix}/sbin", [The sbin directory])
286 else
287 if test "x${prefix}" != 'xNONE'; then
288 AC_DEFINE_UNQUOTED(SBINDIR, "${prefix}/sbin")
289 else
290 AC_DEFINE_UNQUOTED(SBINDIR, "/usr/sbin")
291 fi
292 fi
294 AC_OUTPUT(Makefile \
295 src/Makefile \
296 src/base64/Makefile \
297 src/md5/Makefile \
298 src/libident/Makefile \
299 man/Makefile
300 )