masqmail-0.2

view configure.ac @ 177:ffb5dc53a9d8

Added tag 0.2.28 for changeset 3dc9bf11858c
author meillo@marmaro.de
date Fri, 23 Jul 2010 10:36:35 +0200
parents 52c82d755215
children 100a5d7e196a
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.28, 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 need_md5='yes'
154 fi
156 dnl auth support (default is to not use it)
157 AC_ARG_ENABLE(auth,
158 [ --enable-auth enable AUTH (RFC 2554) client support],
159 if test "x$enable_auth" != 'xno'; then
160 auth_enabled='yes'
161 fi,
162 )
163 if test "x$auth_enabled" = xyes; then
164 AC_DEFINE(ENABLE_AUTH, 1, [If AUTH is enabled])
165 BASE64_LIBS='base64/libbase64.a'
166 need_md5='yes'
167 fi
168 AC_SUBST(BASE64_LIBS)
170 dnl maildir support (default is to not use it)
171 AC_ARG_ENABLE(maildir,
172 [ --enable-maildir enable qmail style maildir support],
173 if test "x$enable_maildir" != 'xno'; then
174 maildir_enabled='yes'
175 fi,
176 )
177 if test "x$maildir_enabled" = xyes; then
178 AC_DEFINE(ENABLE_MAILDIR, 1, [If Maildirs are enabled])
179 fi
181 dnl libcrypto
182 AC_ARG_WITH(libcrypto,
183 [ --with-libcrypto use libcrypto],
184 )
185 if test "x$with_libcrypto" != 'xyes'; then
186 with_libcrypto='no'
187 fi
189 if test "x$need_md5" = 'xyes'; then
190 dnl check whether we have md5 in libcrypto if md5 needed and we shall link with libcrypto
191 if test "x$with_libcrypto" = "xyes"; then
192 AC_CHECK_LIB(crypto, MD5, has_crypto='yes', AC_MSG_ERROR('no libcrypto'))
193 if test "x$has_crypto" = 'xyes'; then
194 AC_DEFINE(USE_LIB_CRYPTO, 1, [If libcrypto is available])
195 MD5_LIBS='-lcrypto'
196 fi
197 else
198 MD5_LIBS='md5/libmd5.a'
199 fi
200 fi
201 AC_SUBST(MD5_LIBS)
203 dnl ident support (default is to not use it)
204 IDENT_LIBS=''
205 AC_ARG_ENABLE(ident,
206 [ --enable-ident enable ident (RFC 1413) support],
207 if test "x$enable_ident" != 'xno'; then
208 ident_enabled='yes'
209 fi,
210 )
211 AC_SUBST(has_ident)
212 if test "x$ident_enabled" = xyes; then
213 AC_DEFINE(ENABLE_IDENT, 1, [If ident is enabled])
214 AC_CHECK_LIB(ident, ident_id, IDENT_LIBS='-lident', IDENT_LIBS='libident/libident.a')
215 fi
216 AC_SUBST(IDENT_LIBS)
218 dnl mserver support (default is to not use it)
219 AC_ARG_ENABLE(mserver,
220 [ --enable-mserver enable mserver support],
221 if test "x$enable_mserver" != 'xno'; then
222 mserver_enabled='yes'
223 fi,
224 )
225 if test "x$mserver_enabled" = xyes; then
226 AC_DEFINE(ENABLE_MSERVER, 1, [If mserver support is enabled])
227 fi
229 dnl liblockfile
230 AC_ARG_WITH(liblockfile,
231 [ --with-liblockfile use liblock (for Debian)],
232 )
233 if test "x$with_liblockfile" = 'xno'; then
234 with_liblockfile=''
235 fi
236 if test "x$with_liblockfile" != 'x'; then
237 with_liblockfile='yes'
238 fi
239 if test "x$with_liblockfile" = xyes; then
240 AC_CHECK_LIB(lockfile, maillock, has_lockfile=yes, AC_MSG_ERROR("no liblockfile"))
241 LOCKFILE_LIBS='-llockfile'
242 AC_DEFINE(USE_LIBLOCKFILE, 1, [If liblockfile is to be used])
243 else
244 LOCKFILE_LIBS=''
245 fi
246 AC_SUBST(LOCKFILE_LIBS)
247 AC_SUBST(USE_LIBLOCKFILE)
249 dnl log and spool directories
250 AC_ARG_WITH(logdir,
251 [ --with-logdir=DIR set log directory [/var/masqmail]],
252 ,
253 with_logdir='/var/log/masqmail/'
254 )
255 AC_SUBST(with_logdir)
257 AC_ARG_WITH(spooldir,
258 [ --with-spooldir=DIR set spool directory [/var/spool/masqmail]],
259 ,
260 with_spooldir='/var/spool/masqmail/'
261 )
262 AC_SUBST(with_spooldir)
264 dnl configuration file
265 AC_ARG_WITH(confdir,
266 [ --with-confdir directory for configuration [/etc/masqmail]],
267 ,
268 with_confdir='/etc/masqmail'
269 )
270 AC_DEFINE_UNQUOTED(CONF_DIR, "${with_confdir}", [The configuration file location])
271 AC_SUBST(with_confdir)
273 test "x$prefix" = xNONE && prefix="$ac_default_prefix"
275 dnl well, /me/ thought that autoconf should make things _easy_ ... -- oku
276 dnl I needed the two `eval's to get the variable expanded in all cases -- meillo
277 dnl this is just horrible! -- meillo
278 AC_DEFINE_UNQUOTED(DATA_DIR, "`eval eval echo $datadir`/masqmail", [The data directory])
280 dnl gymnastics to get the correct path where masqmail should be installed
281 dnl we need this to call ourselves in failmsg.c
282 if test "x${exec_prefix}" != 'xNONE'; then
283 AC_DEFINE_UNQUOTED(SBINDIR, "${exec_prefix}/sbin", [The sbin directory])
284 else
285 if test "x${prefix}" != 'xNONE'; then
286 AC_DEFINE_UNQUOTED(SBINDIR, "${prefix}/sbin")
287 else
288 AC_DEFINE_UNQUOTED(SBINDIR, "/usr/sbin")
289 fi
290 fi
292 AC_OUTPUT(Makefile \
293 src/Makefile \
294 src/base64/Makefile \
295 src/md5/Makefile \
296 src/libident/Makefile \
297 man/Makefile
298 )