forked from mcabber/loudmouth
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
327 lines (272 loc) · 8.84 KB
/
configure.ac
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
317
318
319
320
321
322
323
324
325
326
AC_PREREQ(2.60)
AC_INIT([Loudmouth], [1.5.0], [http://loudmouth.lighthouseapp.com/projects/17276-libloudmouth/tickets/new], [loudmouth])
AC_COPYRIGHT([
Copyright (C) 2003-2008 Imendio AB
Copyright (C) 2007 Collabora Ltd
Copyright (C) 2007 Nokia Corporation
])
AC_CONFIG_SRCDIR(loudmouth/loudmouth.h)
AC_CONFIG_HEADERS(config.h)
AC_CONFIG_AUX_DIR(build)
AM_INIT_AUTOMAKE([1.9 dist-bzip2 no-define -Wall])
AM_MAINTAINER_MODE
AC_CANONICAL_HOST
os_win32=no
case "$host_os" in
*mingw32*)
os_win32=yes
esac
if test "$os_win32" = "yes"; then
if test "$enable_static" = "yes" -o "$enable_static" = ""; then
AC_MSG_WARN([Disabling static library build, must build as DLL on Windows.])
enable_static=no
fi
if test "$enable_shared" = "no"; then
AC_MSG_WARN([Enabling shared library build, must build as DLL on Windows.])
fi
enable_shared=yes
CFLAGS="$CFLAGS -mms-bitfields"
LDFLAGS="$LDFLAGS -no-undefined"
fi
AC_PROG_CC
AC_ISC_POSIX
AC_HEADER_STDC
AC_LIBTOOL_WIN32_DLL
AM_PROG_LIBTOOL
m4_include(build/gtkdoc.m4)
m4_include(build/dolt.m4)
LT_CURRENT=1
LT_REVISION=0
LT_AGE=1
AC_SUBST([LT_CURRENT])
AC_SUBST([LT_REVISION])
AC_SUBST([LT_AGE])
AM_PATH_GLIB_2_0
AC_CHECK_HEADERS([arpa/inet.h fcntl.h memory.h netdb.h netinet/in.h netinet/in_systm.h stdlib.h string.h sys/socket.h sys/time.h unistd.h])
AC_CHECK_HEADERS([winsock2.h arpa/nameser_compat.h])
if test "$ac_cv_header_winsock2_h" = "yes"; then
# If we have <winsock2.h>, assume we find the functions
# in -lws2_32 (ws2_32 is winsock v2, wsock32 is v1.1)
LIBS="-lws2_32 -lgdi32 $LIBS"
fi
IDT_COMPILE_WARNINGS
changequote(,)dnl
if test "x$GCC" = "xyes"; then
case " $CFLAGS " in
*[\ \ ]-Wall[\ \ ]*) ;;
*) CFLAGS="$CFLAGS -Wall" ;;
esac
fi
changequote([,])dnl
AC_SUBST(CFLAGS)
AC_SUBST(LDFLAGS)
GLIB2_REQUIRED=2.12.4
GLIB2_TEST_REQUIRED=2.16.0
GNUTLS_REQUIRED=1.4.0
LIBTASN1_REQUIRED=0.2.6
AC_SUBST(GLIB2_REQUIRED)
AC_SUBST(GNUTLS_REQUIRED)
AC_SUBST(LIBTASN1_REQUIRED)
LM_CHECK_TIMEZONE
PKG_CHECK_MODULES(LOUDMOUTH,
glib-2.0 >= $GLIB2_REQUIRED
gobject-2.0 >= $GLIB2_REQUIRED)
PKG_CHECK_MODULES(LOUDMOUTHTEST,
glib-2.0 >= $GLIB2_TEST_REQUIRED,
enable_test=yes, enable_test=no)
if test "$enable_test" = yes; then
TEST_DIRS=tests
else
TEST_DIRS=
fi
AC_SUBST([TEST_DIRS])
PKG_CHECK_MODULES(LIBIDN, libidn, have_idn=yes, have_idn=no)
if test "x$have_idn" = "xyes"; then
AC_DEFINE(HAVE_IDN, 1, [Define if IDN support is included])
fi
dnl Gtk doc
GTK_DOC_CHECK(1.0)
dnl define a MAINT-like variable REBUILD which is set if Perl
dnl and awk are found, so autogenerated sources can be rebuilt
AC_ARG_ENABLE(rebuilds,
AS_HELP_STRING([--enable-rebuilds=@<:@no/yes/auto@:>@],
[Enable source autogeneration rules [[default=yes]]]), ,
enable_rebuilds=yes)
REBUILD=\#
if test "x$enable_rebuilds" = "xyes" && \
test -n "$PERL" && \
$PERL -e 'exit !($] >= 5.002)' > /dev/null 2>&1 && \
test -n "$AWK" ; then
REBUILD=
fi
AC_SUBST(REBUILD)
dnl +--------------------------------------------------------+
dnl | Checking for libnsl and libsocket need on some systems |-
dnl +--------------------------------------------------------+
AC_CHECK_LIB(nsl,gethostbyname)
AC_CHECK_LIB(socket,socket)
AC_CHECK_LIB(resolv,res_query)
dnl +--------------------------------------------------------+
dnl | Checking for SASL GSSAPI support |-
dnl +--------------------------------------------------------+
AC_PATH_PROG(KRB5CONFIG, krb5-config, no)
enable_gssapi=no
if test "x$KRB5CONFIG" != "xno"
then
AC_CHECK_HEADERS([gssapi.h gssapi/gssapi.h])
enable_gssapi=yes
AC_DEFINE(HAVE_GSSAPI, 1, [whether to use GSSAPI support.])
LIBS="$LIBS `$KRB5CONFIG --libs gssapi`"
fi
AM_CONDITIONAL(USE_GSSAPI, test x$enable_gssapi = xyes)
dnl +--------------------------------------------------------+
dnl | Checking for SSL support |-
dnl +--------------------------------------------------------+
AC_ARG_WITH(ssl,
AS_HELP_STRING([--with-ssl=@<:@gnutls|openssl|no@:>@],
[Which SSL implementation to use [[default=gnutls]]]),
ac_ssl=$withval,
ac_ssl=gnutls)
AC_ARG_WITH(openssl-includes,
AC_HELP_STRING([--with-openssl-includes=DIR],[OpenSSL includes]),
[ use_openssl=yes CPPFLAGS="$CPPFLAGS -I$withval" ]
)
AC_ARG_WITH(openssl-libs,
AC_HELP_STRING([--with-openssl-libs=DIR],[OpenSSL libraries]),
[ use_openssl=yes LDFLAGS="$LDFLAGS -L$withval" ]
)
enable_ssl=no
if test "x$ac_ssl" = "xgnutls"; then
dnl Look for GnuTLS
PKG_CHECK_EXISTS([gnutls >= $GNUTLS_REQUIRED], have_libgnutls=yes, have_libgnutls=no)
if test "x$have_libgnutls" = "xyes"; then
PKG_CHECK_MODULES(LIBGNUTLS, [gnutls >= $GNUTLS_REQUIRED])
CFLAGS="$CFLAGS $LIBGNUTLS_CFLAGS"
LIBS="$LIBS $LIBGNUTLS_LIBS"
AC_DEFINE(HAVE_GNUTLS, 1, [whether to use GnuTSL support.])
enable_ssl=GnuTLS
else
AC_MSG_ERROR([GnuTLS was not found, use
--with-ssl=[[no|openssl]] to build without SSL support or
with OpenSSL])
fi
elif test "$ac_ssl" = "openssl"; then
dnl Look for OpenSSL
AC_CHECK_HEADERS([openssl/ssl.h])
OLDLIBS="$LIBS"
AC_CHECK_LIB(crypto,
BIO_f_base64,
[AC_CHECK_LIB(ssl,
SSL_new,
[SSL_LIB="-lssl -lcrypto"
AC_DEFINE(HAVE_OPENSSL,
[],
[Have OpenSSL])],
[have_openssl=no],
[-lcrypto])],
[have_openssl=no],
[])
if test "x$have_openssl" = "xno"; then
AC_MSG_ERROR([OpenSSL was not found, use --with-ssl=[[no|gnutls]] to
build without SSL support or with GnuTLS])
else
LIBS="$OLDLIBS $SSL_LIB"
enable_ssl=OpenSSL
fi
else
echo "Disabling SSL support"
fi
if test x$enable_ssl != xno; then
AC_DEFINE(HAVE_SSL, 1, [whether to use SSL support.])
else
if test x$ac_ssl != xno; then
AC_MSG_ERROR([No SSL implementation was found, if you do not want to build with SSL use --with-ssl=no])
fi
fi
AM_CONDITIONAL(USE_OPENSSL, test x$enable_ssl = xOpenSSL)
AM_CONDITIONAL(USE_GNUTLS, test x$enable_ssl = xGnuTLS)
dnl +-------------------------------------------------------------------+
dnl | Checking for libasyncns |
dnl +-------------------------------------------------------------------+
AC_ARG_WITH(asyncns,
AS_HELP_STRING([--with-asyncns],
[define whether to use libasyncns, @<:@default=no@:>@ (yes/no)]),
ac_asyncns=$withval,
ac_asyncns=no)
enable_asyncns=no
if test x$ac_asyncns != xno; then
PKG_CHECK_MODULES(ASYNCNS, [libasyncns >= 0.3],
[enable_asyncns=yes],
[enable_asyncns=no])
fi
if test "x$enable_asyncns" = "xyes"; then
AC_DEFINE(HAVE_ASYNCNS, 1, [Whether to use libasyncns])
else
echo "Not using asynchronous dns lookups"
fi
AC_SUBST(ASYNCNS_CFLAGS)
AC_SUBST(ASYNCNS_LIBS)
dnl +-------------------------------------------------------------------+
dnl | Checking for Linux TCP/IP stack |
dnl +-------------------------------------------------------------------+
AC_CHECK_DECL(TCP_KEEPCNT, [ac_use_keepalives=yes], [ac_use_keepalives=no], [
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/ip.h>
#include <netinet/tcp.h>
])
use_keepalives=no
if test x$ac_use_keepalives != xno; then
use_keepalives=yes
AC_DEFINE(USE_TCP_KEEPALIVES, 1, [Whether to use Linux TCP keepalives])
fi
dnl +-------------+
dnl | Build Flags |--------------------------------------------
dnl +-------------+
DOC_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $WARN_CFLAGS"
AC_SUBST(DOC_CFLAGS)
AC_SUBST(CFLAGS)
AC_SUBST(CPPFLAGS)
AC_SUBST(LDFLAGS)
dnl -----------------------------------------------------------
dnl +--------------+
dnl | Debug output |-------------------------------------------
dnl +--------------+
AC_ARG_ENABLE(debug,
AS_HELP_STRING([--enable-debug=@<:@no/yes/auto@:>@],
[Enable debugging [[default=yes]]]), ,
enable_debug=yes)
if test x$enable_debug = xno ; then
echo "Debugging disabled"
LOUDMOUTH_CFLAGS="$LOUDMOUTH_CFLAGS -DLM_NO_DEBUG"
else
echo "Debugging enabled"
fi
AC_SUBST(LOUDMOUTH_CFLAGS)
AC_SUBST(LOUDMOUTH_LIBS)
AC_OUTPUT([
Makefile
docs/Makefile
docs/reference/Makefile
loudmouth/Makefile
examples/Makefile
tests/Makefile
tests/parser-tests/Makefile
loudmouth-1.0.pc])
dnl ==========================================================================
echo "
Loudmouth $VERSION
==================
prefix: ${prefix}
compiler: ${CC}
Have IDN support: ${have_idn}
Enable SSL: ${enable_ssl}
Asynchronous DNS: ${enable_asyncns}
Linux TCP keepalives: ${use_keepalives}
Enable Debug: ${enable_debug}
Enable GSSAPI: ${enable_gssapi}
Enable Documentation: ${enable_gtk_doc}
Enable Tests: ${enable_test}
Now type 'make' to build Loudmouth
"