masqmail

view configure.ac @ 203:45acc5727493

removed --with-glib-static configure option linking glib statically is interesting if no other program uses it on today's systems glib is widely used if one cares on linking statically, he can link everything statically the special case for glib will not get special care anymore
author meillo@marmaro.de
date Fri, 16 Jul 2010 14:48:17 +0200
parents bd9704417d49
children 5745edd5b769
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 dnl # use the next line to use glib-1.2
21 dnl PKG_CHECK_MODULES(GLIB, glib)
23 AC_SUBST(GLIB_LIBS)
24 AC_SUBST(GLIB_CFLAGS)
26 dnl resolver support (default is use it)
27 AC_ARG_ENABLE(resolver,
28 [ --disable-resolver disable resolver support],
29 if test "$enable_resolver" != 'no'; then
30 resolver_enabled='yes'
31 fi,
32 resolver_enabled='yes'
33 )
35 if test "$resolver_enabled" = yes; then
36 AC_DEFINE(ENABLE_RESOLVER, 1, [If the resolver is to be used])
37 dnl checks necessary for libc5:
38 dnl if there is res_search in libc, it is probably libc5
39 dnl if not, it is probably libc6 and we need libresolv
40 AC_CHECK_LIB(c, res_search, need_resolv=no, need_resolv=yes)
41 if test "$need_resolv" = yes; then
42 AC_CHECK_LIB(resolv, res_search,
43 has_resolv=yes; RESOLV_LIBS="-lresolv",
44 has_resolv=no)
45 if test "$has_resolv" = no; then
46 saved_LIBS="$LIBS"
47 LIBS="$LIBS -lresolv"
48 AC_MSG_CHECKING(for res_search in -lresolv)
49 AC_TRY_LINK([#include <resolv.h>],
50 [res_search (0, 0, 0, 0, 0);],
51 RESOLV_LIBS="-lresolv"; has_resolv=yes; AC_MSG_RESULT(yes),
52 AC_MSG_RESULT(no));
53 LIBS="$saved_LIBS"
54 fi
55 if test "$has_resolv" = no; then
56 AC_MSG_ERROR("no libresolv")
57 RESOLV_LIBS=''
58 fi
59 fi
60 else
61 RESOLV_LIBS=''
62 fi
63 AC_SUBST(RESOLV_LIBS)
65 dnl if there is no getline, we define it using getdelim in src/masqmail.h
66 AC_CHECK_FUNCS(getline)
68 dnl if there is no fdatasync, we define it to fsync in src/masqmail.h
69 AC_CHECK_FUNCS(fdatasync)
71 dnl Checks for header files.
72 AC_HEADER_STDC
73 AC_CHECK_HEADERS(fcntl.h sys/time.h syslog.h unistd.h)
75 dnl Checks for typedefs, structures, and compiler characteristics.
76 AC_C_CONST
77 AC_TYPE_PID_T
78 AC_TYPE_SIZE_T
79 AC_HEADER_TIME
80 AC_STRUCT_TM
82 dnl Checks for library functions.
83 AC_FUNC_FNMATCH
84 AC_TYPE_SIGNAL
85 AC_FUNC_STRFTIME
86 AC_FUNC_VPRINTF
87 AC_CHECK_FUNCS(select socket strerror strstr)
89 dnl user and group configuration
90 AC_ARG_WITH(user,
91 [ --with-user=USER set user [mail]],
92 )
93 if test "x$with_user" = 'x'; then
94 with_user='mail'
95 fi
97 AC_ARG_WITH(group,
98 [ --with-group=GROUP set group [trusted]],
99 )
100 if test "x$with_group" = 'x'; then
101 with_group='trusted'
102 fi
104 dnl debugging support (default is use it)
105 AC_ARG_ENABLE(debug,
106 [ --disable-debug disable debugging],
107 if test "x$enable_debug" != 'xno'; then
108 debug_enabled='yes'
109 fi,
110 debug_enabled='yes'
111 )
112 if test "x$debug_enabled" = xyes; then
113 AC_DEFINE(ENABLE_DEBUG, 1, [If debugging is enabled])
114 fi
116 AC_DEFINE_UNQUOTED(DEF_MAIL_USER, "${with_user}", [The mail user])
117 AC_SUBST(with_user)
118 AC_DEFINE_UNQUOTED(DEF_MAIL_GROUP, "${with_group}", [The mail group])
119 AC_SUBST(with_group)
121 dnl optional features
122 MD5_LIBS=''
123 BASE64_LIBS=''
125 dnl smtp server support (default is use it)
126 AC_ARG_ENABLE(smtp_server,
127 [ --disable-smtp-server disable smtp server support],
128 if test "x$enable_smtp_server" != 'xno'; then
129 smtp_server_enabled='yes'
130 fi,
131 smtp_server_enabled='yes'
132 )
133 if test "x$smtp_server_enabled" = xyes; then
134 AC_DEFINE(ENABLE_SMTP_SERVER, 1, [If the SMTP server is enabled])
135 fi
137 dnl auth support (default is to not use it)
138 AC_ARG_ENABLE(auth,
139 [ --enable-auth enable AUTH (RFC 2554) client support],
140 if test "x$enable_auth" != 'xno'; then
141 auth_enabled='yes'
142 fi,
143 )
144 if test "x$auth_enabled" = xyes; then
145 AC_DEFINE(ENABLE_AUTH, 1, [If AUTH is enabled])
146 BASE64_LIBS='base64/libbase64.a'
147 # MD5_LIBS='md5/libmd5c.a'
148 need_md5='yes'
149 fi
150 AC_SUBST(BASE64_LIBS)
152 dnl maildir support (default is to not use it)
153 AC_ARG_ENABLE(maildir,
154 [ --enable-maildir enable qmail style maildir support],
155 if test "x$enable_maildir" != 'xno'; then
156 maildir_enabled='yes'
157 fi,
158 )
159 if test "x$maildir_enabled" = xyes; then
160 AC_DEFINE(ENABLE_MAILDIR, 1, [If Maildirs are enabled])
161 fi
163 dnl libcrypto
164 AC_ARG_WITH(libcrypto,
165 [ --with-libcrypto use libcrypto],
166 )
167 if test "x$with_libcrypto" != 'xyes'; then
168 with_libcrypto='no'
169 fi
171 if test "x$need_md5" = 'xyes'; then
172 dnl check whether we have md5 in libcrypto if md5 needed and we shall link with libcrypto
173 if test "x$with_libcrypto" = "xyes"; then
174 AC_CHECK_LIB(crypto, MD5, has_crypto='yes', AC_MSG_ERROR('no libcrypto'))
175 if test "x$has_crypto" = 'xyes'; then
176 AC_DEFINE(USE_LIB_CRYPTO, 1, [If libcrypto is available])
177 MD5_LIBS='-lcrypto'
178 fi
179 else
180 MD5_LIBS='md5/libmd5c.a'
181 fi
182 fi
183 AC_SUBST(MD5_LIBS)
185 dnl ident support (default is to not use it)
186 IDENT_LIBS=''
187 AC_ARG_ENABLE(ident,
188 [ --enable-ident enable ident (RFC 1413) support],
189 if test "x$enable_ident" != 'xno'; then
190 ident_enabled='yes'
191 fi,
192 )
193 AC_SUBST(has_ident)
194 if test "x$ident_enabled" = xyes; then
195 AC_DEFINE(ENABLE_IDENT, 1, [If ident is enabled])
196 AC_CHECK_LIB(ident, ident_id, IDENT_LIBS='-lident', IDENT_LIBS='libident/libident.a')
197 fi
198 AC_SUBST(IDENT_LIBS)
200 dnl liblockfile
201 AC_ARG_WITH(liblockfile,
202 [ --with-liblockfile use liblock (for Debian)],
203 )
204 if test "x$with_liblockfile" = 'xno'; then
205 with_liblockfile=''
206 fi
207 if test "x$with_liblockfile" != 'x'; then
208 with_liblockfile='yes'
209 fi
210 if test "x$with_liblockfile" = xyes; then
211 AC_CHECK_LIB(lockfile, maillock, has_lockfile=yes, AC_MSG_ERROR("no liblockfile"))
212 LOCKFILE_LIBS='-llockfile'
213 AC_DEFINE(USE_LIBLOCKFILE, 1, [If liblockfile is to be used])
214 else
215 LOCKFILE_LIBS=''
216 fi
217 AC_SUBST(LOCKFILE_LIBS)
218 AC_SUBST(USE_LIBLOCKFILE)
220 dnl log and spool directories
221 AC_ARG_WITH(logdir,
222 [ --with-logdir=DIR set log directory [/var/log/masqmail]],
223 ,
224 with_logdir='/var/log/masqmail/'
225 )
226 AC_DEFINE_UNQUOTED(LOG_DIR, "${with_logdir}", [The log directory])
227 AC_SUBST(with_logdir)
229 AC_ARG_WITH(spooldir,
230 [ --with-spooldir=DIR set spool directory [/var/spool/masqmail]],
231 ,
232 with_spooldir='/var/spool/masqmail/'
233 )
234 AC_DEFINE_UNQUOTED(SPOOL_DIR, "${with_spooldir}", [The spool directory])
235 AC_SUBST(with_spooldir)
237 dnl configuration file
238 AC_ARG_WITH(confdir,
239 [ --with-confdir directory for configuration [/etc/masqmail]],
240 ,
241 with_confdir='/etc/masqmail'
242 )
243 AC_DEFINE_UNQUOTED(CONF_DIR, "${with_confdir}", [The configuration file location])
244 AC_SUBST(with_confdir)
246 test "x$prefix" = xNONE && prefix="$ac_default_prefix"
248 dnl well, /me/ thought that autoconf should make things _easy_ ... -- oku
249 dnl I needed the two `eval's to get the variable expanded in all cases -- meillo
250 dnl this is just horrible! -- meillo
251 AC_DEFINE_UNQUOTED(DATA_DIR, "`eval eval echo $datadir`/masqmail", [The data directory])
253 dnl gymnastics to get the correct path where masqmail should be installed
254 dnl we need this to call ourselves in failmsg.c
255 if test "x${exec_prefix}" != 'xNONE'; then
256 AC_DEFINE_UNQUOTED(SBINDIR, "${exec_prefix}/sbin", [The sbin directory])
257 else
258 if test "x${prefix}" != 'xNONE'; then
259 AC_DEFINE_UNQUOTED(SBINDIR, "${prefix}/sbin")
260 else
261 AC_DEFINE_UNQUOTED(SBINDIR, "/usr/sbin")
262 fi
263 fi
265 AC_OUTPUT(Makefile \
266 src/Makefile \
267 src/base64/Makefile \
268 src/md5/Makefile \
269 src/libident/Makefile \
270 man/Makefile
271 )