masqmail
view configure.ac @ 165:f72de1e00fa5
updated and improved INSTALL
author | meillo@marmaro.de |
---|---|
date | Thu, 08 Jul 2010 22:02:22 +0200 |
parents | 3914d7cabfbc |
children | 25b769efafe6 |
line source
1 dnl Process this file with autoconf to produce a configure script.
3 AC_PREREQ(2.59)
4 AC_INIT(masqmail, 0.3.0, 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 )
150 if test "x$pop3_enabled" = xyes; then
151 AC_DEFINE(ENABLE_POP3, 1, [If the POP3 support is enabled])
152 # MD5_LIBS='md5/libmd5c.a'
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 # MD5_LIBS='md5/libmd5c.a'
167 need_md5='yes'
168 fi
169 AC_SUBST(BASE64_LIBS)
171 dnl maildir support (default is to not use it)
172 AC_ARG_ENABLE(maildir,
173 [ --enable-maildir enable qmail style maildir support],
174 if test "x$enable_maildir" != 'xno'; then
175 maildir_enabled='yes'
176 fi,
177 )
178 if test "x$maildir_enabled" = xyes; then
179 AC_DEFINE(ENABLE_MAILDIR, 1, [If Maildirs are enabled])
180 fi
182 dnl libcrypto
183 AC_ARG_WITH(libcrypto,
184 [ --with-libcrypto use libcrypto],
185 )
186 if test "x$with_libcrypto" != 'xyes'; then
187 with_libcrypto='no'
188 fi
190 if test "x$need_md5" = 'xyes'; then
191 dnl check whether we have md5 in libcrypto if md5 needed and we shall link with libcrypto
192 if test "x$with_libcrypto" = "xyes"; then
193 AC_CHECK_LIB(crypto, MD5, has_crypto='yes', AC_MSG_ERROR('no libcrypto'))
194 if test "x$has_crypto" = 'xyes'; then
195 AC_DEFINE(USE_LIB_CRYPTO, 1, [If libcrypto is available])
196 MD5_LIBS='-lcrypto'
197 fi
198 else
199 MD5_LIBS='md5/libmd5c.a'
200 fi
201 fi
202 AC_SUBST(MD5_LIBS)
204 dnl ident support (default is to not use it)
205 IDENT_LIBS=''
206 AC_ARG_ENABLE(ident,
207 [ --enable-ident enable ident (RFC 1413) support],
208 if test "x$enable_ident" != 'xno'; then
209 ident_enabled='yes'
210 fi,
211 )
212 AC_SUBST(has_ident)
213 if test "x$ident_enabled" = xyes; then
214 AC_DEFINE(ENABLE_IDENT, 1, [If ident is enabled])
215 AC_CHECK_LIB(ident, ident_id, IDENT_LIBS='-lident', IDENT_LIBS='libident/libident.a')
216 fi
217 AC_SUBST(IDENT_LIBS)
219 dnl liblockfile
220 AC_ARG_WITH(liblockfile,
221 [ --with-liblockfile use liblock (for Debian)],
222 )
223 if test "x$with_liblockfile" != 'x'; then
224 with_liblockfile='yes'
225 fi
226 if test "x$with_liblockfile" = xyes; then
227 AC_CHECK_LIB(lockfile, maillock, has_lockfile=yes, AC_MSG_ERROR("no liblockfile"))
228 LOCKFILE_LIBS='-llockfile'
229 AC_DEFINE(USE_LIBLOCKFILE, 1, [If liblockfile is to be used])
230 else
231 LOCKFILE_LIBS=''
232 fi
233 AC_SUBST(LOCKFILE_LIBS)
234 AC_SUBST(USE_LIBLOCKFILE)
236 dnl log and spool directories
237 AC_ARG_WITH(logdir,
238 [ --with-logdir=DIR set log directory [/var/log/masqmail]],
239 ,
240 with_logdir='/var/log/masqmail/'
241 )
242 AC_DEFINE_UNQUOTED(LOG_DIR, "${with_logdir}", [The log directory])
243 AC_SUBST(with_logdir)
245 AC_ARG_WITH(spooldir,
246 [ --with-spooldir=DIR set spool directory [/var/spool/masqmail]],
247 ,
248 with_spooldir='/var/spool/masqmail/'
249 )
250 AC_DEFINE_UNQUOTED(SPOOL_DIR, "${with_spooldir}", [The spool directory])
251 AC_SUBST(with_spooldir)
253 dnl configuration file
254 AC_ARG_WITH(confdir,
255 [ --with-confdir directory for configuration [/etc/masqmail]],
256 ,
257 with_confdir='/etc/masqmail'
258 )
259 AC_DEFINE_UNQUOTED(CONF_DIR, "${with_confdir}", [The configuration file location])
260 AC_SUBST(with_confdir)
262 test "x$prefix" = xNONE && prefix="$ac_default_prefix"
264 dnl well, /me/ thought that autoconf should make things _easy_ ... -- oku
265 dnl I needed the two `eval's to get the variable expanded in all cases -- meillo
266 dnl this is just horrible! -- meillo
267 AC_DEFINE_UNQUOTED(DATA_DIR, "`eval eval echo $datadir`/masqmail", [The data directory])
269 dnl gymnastics to get the correct path where masqmail should be installed
270 dnl we need this to call ourselves in failmsg.c
271 if test "x${exec_prefix}" != 'xNONE'; then
272 AC_DEFINE_UNQUOTED(SBINDIR, "${exec_prefix}/sbin", [The sbin directory])
273 else
274 if test "x${prefix}" != 'xNONE'; then
275 AC_DEFINE_UNQUOTED(SBINDIR, "${prefix}/sbin")
276 else
277 AC_DEFINE_UNQUOTED(SBINDIR, "/usr/sbin")
278 fi
279 fi
281 AC_OUTPUT(Makefile \
282 src/Makefile \
283 src/base64/Makefile \
284 src/md5/Makefile \
285 src/libident/Makefile \
286 man/Makefile
287 )