-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfigure.in
More file actions
316 lines (289 loc) · 7.97 KB
/
configure.in
File metadata and controls
316 lines (289 loc) · 7.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
dnl Process this file with autoconf to produce a configure script.
AC_PREREQ(2.50)
AC_INIT(givemail, 1.31)
AM_INIT_AUTOMAKE
AM_CONFIG_HEADER(config.h)
AC_PREFIX_DEFAULT(/usr)
dnl Check for programs
AC_ISC_POSIX
AC_PROG_CC
AM_PROG_CC_STDC
AC_HEADER_STDC
AC_PROG_CPP
AC_PROG_CXX
AC_PROG_CXXCPP
AM_PROG_LIBTOOL
dnl gettext support
GETTEXT_PACKAGE=givemail
AC_SUBST(GETTEXT_PACKAGE)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE",
[the gettext domain])
dnl Add the languages which your application supports here.
ALL_LINGUAS=""
#AM_GNU_GETTEXT([external])
AM_GLIB_GNU_GETTEXT
dnl Set PACKAGE_LOCALE_DIR in config.h.
if test "x${prefix}" = "xNONE"; then
AC_DEFINE_UNQUOTED(PACKAGE_LOCALE_DIR, "${ac_default_prefix}/${DATADIRNAME}/locale",
[Define to the location of locale files.])
else
AC_DEFINE_UNQUOTED(PACKAGE_LOCALE_DIR, "${prefix}/${DATADIRNAME}/locale",
[Define to the location of locale files.])
fi
dnl And set PREFIX in config.h.
if test "x${prefix}" = "xNONE"; then
AC_DEFINE_UNQUOTED(PREFIX, "${ac_default_prefix}",
[Define to the package prefix.])
else
AC_DEFINE_UNQUOTED(PREFIX, "${prefix}",
[Define to the package prefix.])
fi
AS_AC_EXPAND(DATADIR, $datadir)
AS_AC_EXPAND(BINDIR, $bindir)
dnl Location of system directories
AS_AC_EXPAND(SYSCONFDIR, $sysconfdir)
AC_DEFINE_UNQUOTED(SYSCONFDIR, "$SYSCONFDIR",
[Define to the system configuration directory.])
AS_AC_EXPAND(LIBDIR, $libdir)
AC_DEFINE_UNQUOTED(LIBDIR, "$LIBDIR",
[Define to the libraries directory.])
dnl DEBUG mode
AC_MSG_CHECKING(whether to enable DEBUG mode)
AC_ARG_ENABLE(debug,
[AS_HELP_STRING([--enable-debug], [enable DEBUG mode [default=no]])],
,[enable_debug=no])
if test "x$enable_debug" = "xyes"; then
if test "x$GCC" = "xyes"; then
CXXFLAGS="$CXXFLAGS -ggdb3 -O0 -DDEBUG"
fi
else
CXXFLAGS="$CXXFLAGS -DNDEBUG"
enable_debug="no"
fi
AC_MSG_RESULT($enable_debug)
dnl getopt.h
AC_CHECK_HEADER(getopt.h)
AC_MSG_CHECKING(for GNU getopt_long)
AC_TRY_LINK([
#include <string.h>
#include <unistd.h>
#define _GNU_SOURCE
#include <getopt.h>
], [
return getopt_long (0, NULL, NULL, NULL, NULL);
],
AC_MSG_RESULT([yes])
AC_DEFINE(HAVE_GETOPT_H,1,
[Define to 1 if you have the <getopt.h> header.])
have_getopt="yes",
AC_MSG_RESULT([no])
have_getopt="no")
dnl libresolv
RESOLV_LIB="-lresolv"
AC_MSG_CHECKING(for libresolv)
if test -f $libdir/libresolv.so; then
AC_MSG_RESULT($libdir/libresolv.so)
else
RESOLV_LIB="$libdir/libresolv.a"
fi
AC_SUBST(RESOLV_LIB)
dnl libsocket
AC_SEARCH_LIBS(socket, socket)
dnl libnsl
AC_SEARCH_LIBS(inet_ntoa, nsl)
dnl OpenSSL
PKG_CHECK_MODULES(OPENSSL, openssl >= 0.9.7)
AC_SUBST(OPENSSL_CFLAGS)
AC_SUBST(OPENSSL_LIBS)
dnl Neon or Curl ?
AC_MSG_CHECKING(which HTTP library to use)
AC_ARG_WITH(http,
[AS_HELP_STRING([--with-http=@<:@neon|curl@:>@], [which HTTP library to use [default=curl]])])
httplibrary=$with_http
if test "x$httplibrary" = "x"; then
httplibrary="curl"
fi
AC_MSG_RESULT($httplibrary)
case "$httplibrary" in
neon)
PKG_CHECK_MODULES(NEON, neon)
HTTP_CFLAGS="-DUSE_NEON $NEON_CFLAGS"
HTTP_LIBS="$NEON_LIBS"
;;
curl)
PKG_CHECK_MODULES(CURL, libcurl)
HTTP_CFLAGS="-DUSE_CURL $CURL_CFLAGS"
HTTP_LIBS="$CURL_LIBS"
;;
esac
AC_SUBST(HTTP_CFLAGS)
AC_SUBST(HTTP_LIBS)
dnl cyrus-sasl
PKG_CHECK_MODULES(SASL, libsasl2)
AC_SUBST(SASL_CFLAGS)
AC_SUBST(SASL_LIBS)
dnl OpenDKIM
PKG_CHECK_MODULES(OPENDKIM, opendkim >= 2.10.0)
AC_SUBST(OPENDKIM_CFLAGS)
AC_SUBST(OPENDKIM_LIBS)
dnl libetpan
AM_CONDITIONAL(USE_LIBETPAN, true)
AC_MSG_CHECKING(whether to enable libetpan support)
AC_ARG_ENABLE(libetpan,
[AS_HELP_STRING([--enable-libetpan], [enable libetpan support [default=no]])],
,[enable_libetpan=no])
AC_MSG_RESULT($enable_libetpan)
if test "x$enable_libetpan" = "xyes"; then
PKG_CHECK_MODULES(LIBETPAN, libetpan)
SMTP_CFLAGS="-DUSE_LIBETPAN"
AC_SUBST(LIBETPAN_CFLAGS)
AC_SUBST(LIBETPAN_LIBS)
else
AM_CONDITIONAL(USE_LIBETPAN, false)
LIBETPAN_CFLAGS=""
LIBETPAN_LIBS=""
fi
dnl libesmtp
AM_CONDITIONAL(USE_LIBESMTP, false)
AC_MSG_CHECKING(whether to enable libesmtp support)
AC_ARG_ENABLE(libesmtp,
[AS_HELP_STRING([--enable-libesmtp], [enable libesmtp support [default=yes]])],
,[enable_libesmtp=yes])
AC_MSG_RESULT($enable_libesmtp)
if test "x$enable_libesmtp" = "xno"; then
LIBESMTP_CFLAGS=""
LIBESMTP_LIBS=""
else
AM_CONDITIONAL(USE_LIBESMTP, true)
AC_MSG_CHECKING(where libesmtp can be found)
AC_ARG_WITH(libesmtp,
[AS_HELP_STRING([--with-libesmtp=/usr/local/libesmtp], [where libesmtp can be found [default=/usr]])])
libesmtpdir=$with_libesmtp
if test "x$libesmtpdir" = "x"; then
libesmtpdir="/usr"
else
CXXFLAGS="$CXXFLAGS -I$libesmtpdir/include"
LIBS="-L$libesmtpdir/lib $LIBS"
fi
AC_MSG_RESULT($libesmtpdir)
AC_SUBST(libesmtpdir)
AC_PATH_PROG(LIBESMTP_CONFIG, libesmtp-config, no, $libesmtpdir/bin:$PATH)
if test "$LIBESMTP_CONFIG" = "no" ; then
AC_MSG_ERROR([Can't find libesmtp-config in $libesmtpdir:$PATH.])
exit 1
fi
SMTP_CFLAGS="-DUSE_LIBESMTP"
LIBESMTP_CFLAGS=`$LIBESMTP_CONFIG --cflags`
LIBESMTP_LIBS=`$LIBESMTP_CONFIG --libs`
fi
dnl smtp
SMTP_CFLAGS="$SMTP_CFLAGS $LIBESMTP_CFLAGS $LIBETPAN_CFLAGS"
SMTP_LIBS="$LIBESMTP_LIBS $LIBETPAN_LIBS"
AC_SUBST(SMTP_CFLAGS)
AC_SUBST(SMTP_LIBS)
dnl libxml2
PKG_CHECK_MODULES(LIBXML, libxml-2.0)
AC_SUBST(LIBXML_CFLAGS)
AC_SUBST(LIBXML_LIBS)
dnl pthreads
pthreadlib=""
AC_SUBST(PTHREAD_LIBS)
AC_MSG_CHECKING(if pthreads is available)
ORIG_LIBS="$LIBS"
for candidatelib in '' '-pthread' '-lc_r' '-lthr'; do
if test -z "$use_posix_mutex" ; then
LIBS="$candidatelib $ORIG_LIBS"
AC_TRY_LINK([#include <pthread.h>],
[pthread_mutex_t lck;
pthread_mutex_init(&lck, 0);
pthread_mutex_lock(&lck);
pthread_mutex_unlock(&lck);
pthread_mutex_destroy(&lck);],
[PTHREAD_LIBS="$candidatelib"
pthreadlib=candidatelib]
)
fi
done
LIBS="$ORIG_LIBS"
if test "$pthreadlib" ; then
if test -z "$PTHREAD_LIBS" ; then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT([yes with $PTHREAD_LIBS])
fi
else
AC_MSG_RESULT(no)
AC_CHECK_LIB(pthreadGCE2, pthread_mutex_lock,
[PTHREAD_CFLAGS="-Ipthread"
PTHREAD_LIBS="-lpthreadGCE2"])
if test -z "$PTHREAD_LIBS" ; then
AC_MSG_ERROR([Can't find pthreads.])
exit 1
fi
fi
dnl MySQL as DB backend ?
AM_CONDITIONAL(USE_DB, false)
AM_CONDITIONAL(USE_MYSQL, false)
AC_MSG_CHECKING(which DB backend to use)
AC_ARG_WITH(db,
[AS_HELP_STRING([--with-db=@<:@none|mysql@:>@], [which DB backend to use [default=mysql]])])
dbbackend=$with_db
if test "x$dbbackend" = "x"; then
dbbackend="mysql"
fi
AC_MSG_RESULT($dbbackend)
case "$dbbackend" in
none)
DB_CFLAGS=""
DB_LIBS=""
;;
mysql)
AC_PATH_PROG(MYSQL_CONFIG, mysql_config, no)
if test "$MYSQL_CONFIG" = "no" ; then
AC_MSG_ERROR([Can't find mysql_config in $PATH.])
exit 1
fi
AM_CONDITIONAL(USE_DB, true)
AM_CONDITIONAL(USE_MYSQL, true)
MYSQL_CFLAGS=`$MYSQL_CONFIG --cflags`
DB_CFLAGS="-DUSE_DB -DUSE_MYSQL $MYSQL_CFLAGS"
DB_LIBS=`$MYSQL_CONFIG --libs`
;;
esac
AC_SUBST(DB_CFLAGS)
AC_SUBST(DB_LIBS)
dnl FastCGI support
AM_CONDITIONAL(HAVE_FASTCGI, false)
FASTCGI_CFLAGS=""
FASTCGI_LIBS=""
AC_MSG_CHECKING(whether to enable FastCGI support)
if test "x$dbbackend" = "xnone" ; then
AC_MSG_RESULT(no)
else
AC_ARG_ENABLE(fastcgi,
[AS_HELP_STRING([--enable-fastcgi], [enable FastCGI support [default=no]])],
,[enable_fastcgi=no])
if test "x$enable_fastcgi" = "xyes"; then
AM_CONDITIONAL(HAVE_FASTCGI, true)
FASTCGI_CFLAGS=""
FASTCGI_LIBS="-lfcgi++ -lfcgi"
else
enable_fastcgi="no"
fi
AC_MSG_RESULT($enable_fastcgi)
fi
AC_SUBST(FASTCGI_CFLAGS)
AC_SUBST(FASTCGI_LIBS)
dnl Check for specific functions
AC_CHECK_FUNCS(gettimeofday)
AC_CHECK_FUNCS(timegm)
AC_CHECK_FUNCS(socketpair)
AC_CHECK_FUNCS(fork)
AC_CHECK_FUNCS(strerror_r)
AC_OUTPUT([
Doxyfile
Makefile
src/Makefile
po/Makefile.in
givemail.spec
])