masqmail-0.2

view configure.ac @ 27:3654c502a4df

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