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
|
dnl *******************************************
dnl *** Initialize automake and set version ***
dnl *******************************************
AC_PREREQ(2.53)
AC_INIT(libsoup, 2.2.1)
AC_CONFIG_SRCDIR(libsoup-2.2.pc.in)
AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)
AM_CONFIG_HEADER(config.h)
AM_MAINTAINER_MODE
AC_PROG_MAKE_SET
SOUP_API_VERSION=2.2
AC_SUBST(SOUP_API_VERSION)
# Increment on interface addition. Reset on removal.
SOUP_AGE=0
# Increment on interface add, remove, or change.
SOUP_CURRENT=7
# Increment on source change. Reset when CURRENT changes.
SOUP_REVISION=0
AC_SUBST(SOUP_CURRENT)
AC_SUBST(SOUP_REVISION)
AC_SUBST(SOUP_AGE)
dnl ***************************
dnl *** Set debugging flags ***
dnl ***************************
debug_default=minimum
# Declare --enable-* args and collect ac_help strings
AC_ARG_ENABLE(debug,
[ --enable-debug=[no/minimum/yes] turn on debugging [default=$debug_default]],,
enable_debug=$debug_default)
# Set the debug flags
if test "x$enable_debug" = "xyes"; then
test "$cflags_set" = set || CFLAGS="$CFLAGS -g"
SOUP_DEBUG_FLAGS="-DG_ENABLE_DEBUG"
else
if test "x$enable_debug" = "xno"; then
SOUP_DEBUG_FLAGS="-DG_DISABLE_ASSERT -DG_DISABLE_CHECKS"
fi
fi
AC_SUBST(SOUP_DEBUG_FLAGS)
dnl ***************************
dnl *** Checks for programs ***
dnl ***************************
AC_PROG_CC
AM_PROG_CC_STDC
AC_PROG_INSTALL
# Set STDC_HEADERS
AC_HEADER_STDC
# Initialize libtool
AM_PROG_LIBTOOL
# This isn't a program, but it doesn't fit anywhere else...
AC_FUNC_ALLOCA
dnl ***********************
dnl *** Checks for glib ***
dnl ***********************
AM_PATH_GLIB_2_0(2.0.0,,,gobject gthread)
PKG_CHECK_MODULES(XML, libxml-2.0)
AC_SUBST(XML_CFLAGS)
AC_SUBST(XML_LIBS)
dnl *********************************
dnl *** Networking library checks ***
dnl *********************************
AC_CHECK_FUNC(socket, , AC_CHECK_LIB(socket, socket))
AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(nsl, gethostbyname))
AC_CHECK_FUNCS(inet_pton inet_aton)
### Check if we have gethostbyname_r (if so, assume gethostbyaddr_r).
AC_CHECK_FUNC(gethostbyname_r,
[
dnl First check for the glibc variant of gethostbyname_r
AC_MSG_CHECKING(for glibc gethostbyname_r)
AC_TRY_LINK([ #include <netdb.h>],[
struct hostent result_buf;
char buf[1024];
struct hostent* result;
int h_errnop;
gethostbyname_r("localhost", &result_buf, buf, sizeof(buf),
&result, &h_errnop);
], [
dnl Have glibc gethostbyname_r
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_GETHOSTBYNAME_R_GLIBC, 1,
[Define if you have a glibc-style gethostbyname_r()])
HAVE_GETHOSTBYNAME_R=yes
], [
dnl If we don't have glibc gethostbyname_r, check
dnl for Solaris/Irix gethostbyname_r
AC_MSG_RESULT(no)
AC_MSG_CHECKING(for Solaris/Irix gethostbyname_r)
AC_TRY_LINK([ #include <netdb.h>],[
struct hostent result;
char buf[1024];
int h_errnop;
gethostbyname_r("localhost", &result, buf, sizeof(buf), &h_errnop);
], [
dnl Have Solaris/Irix gethostbyname_r
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_GETHOSTBYNAME_R_SOLARIS, 1,
[Define if you have a Solaris-style gethostbyname_r()])
HAVE_GETHOSTBYNAME_R=yes
], [
dnl If don't have Solaris/Irix gethostbyname_r, check
dnl for HP-UX gethostbyname_r
AC_MSG_RESULT(no)
AC_MSG_CHECKING(for HP-UX gethostbyname_r)
AC_TRY_LINK([ #include <netdb.h>],[
struct hostent result;
char buf[1024];
gethostbyname_r("localhost", &result, buf);
], [
dnl Have HP-UX gethostbyname_r
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_GETHOSTBYNAME_R_HPUX, 1,
[Define if you have an HP-UX-style gethostbyname_r()])
HAVE_GETHOSTBYNAME_R=yes
]
)]
)]
)])
# If we don't have gethostbyname_r, we'll use Glib mutexes, but give a warning
if test -z "$HAVE_GETHOSTBYNAME_R"; then
AC_DEFINE(HAVE_GETHOSTBYNAME_R_GLIB_MUTEX, 1,
[Define if you have no gethostbyname_r()])
AC_MSG_WARN([You have neither Glib threads nor the function
gethostbyname_r. This means that calls to
gethostbyname (called by the Soup address
functions) will not be thread safe so could
malfunction in programs that use threads.])
fi
AC_CACHE_CHECK(IPv6 support, soup_cv_ipv6, [
AC_EGREP_HEADER(sockaddr_in6, netinet/in.h, soup_cv_ipv6=yes, soup_cv_ipv6=no)
])
case $soup_cv_ipv6 in
yes)
AC_DEFINE(HAVE_IPV6, 1, [Define if you have support for IPv6 sockets])
;;
esac
dnl **********************************
dnl *** SSL Library check (GnuTLS) ***
dnl **********************************
AC_ARG_ENABLE(ssl,
[ --enable-ssl Turn on Secure Sockets Layer support [default=yes]],,
enable_ssl=auto)
AC_ARG_ENABLE(ssl-link-static,
[ --enable-static-ssl Link with SSL library statically [default=no]],
[enable_static_ssl=yes])
AC_ARG_ENABLE(libgpg-error,
[ --enable-libgpg-error Work around broken libgcrypt-config scripts],
enable_libgpg_error=yes, enable_libgpg_error=no)
if test "$enable_ssl" != "no"; then
AM_PATH_LIBGNUTLS(1.0.0, have_ssl=yes, have_ssl=no)
if test "$have_ssl" != "yes"; then
if test "$enable_ssl" = "auto"; then
AC_MSG_WARN(Disabling SSL support);
enable_ssl=no;
else
AC_MSG_ERROR(Could not configure SSL support);
fi
fi
fi
LIBGNUTLS_LIBS_STATIC=""
if test "$enable_ssl" != "no"; then
AC_DEFINE(HAVE_SSL, 1, [Defined if you have SSL support])
libgpg_error_libs_static=""
libgpg_error_libs=""
if test "$enable_libgpg_error" = "yes"; then
AM_PATH_GPG_ERROR("0.4")
if test "$GPG_ERROR_LIBS" = ""; then
AC_MSG_ERROR([libgpg-error is needed])
fi
gpg_error_prefix=$($GPG_ERROR_CONFIG --prefix)
libgpg_error_libs_static="$gpg_error_prefix/lib/libgpg-error.a"
libgpg_error_libs="$GPG_ERROR_LIBS"
fi
if test "$enable_static_ssl" = "yes"; then
gnutls_libdir=`$LIBGNUTLS_CONFIG --exec-prefix`/lib
LIBGNUTLS_LIBS=""
LIBGNUTLS_LIBS_STATIC="$gnutls_libdir/libgnutls.a $gnutls_libdir/libgcrypt.a $libgpg_error_libs_static"
fi
fi
AC_SUBST(LIBGNUTLS_CFLAGS)
AC_SUBST(LIBGNUTLS_LIBS)
AC_SUBST(LIBGNUTLS_LIBS_STATIC)
dnl ***************
dnl *** gtk-doc ***
dnl ***************
GTK_DOC_CHECK([1.0])
dnl *************************************
dnl *** Warnings to show if using GCC ***
dnl *************************************
AC_ARG_ENABLE(more-warnings,
[ --disable-more-warnings Inhibit compiler warnings],
set_more_warnings=no)
if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then
CFLAGS="$CFLAGS \
-Wall -Wstrict-prototypes -Wmissing-declarations \
-Wmissing-prototypes -Wnested-externs -Wpointer-arith"
fi
# Use reentrant functions (FIXME!)
CFLAGS="$CFLAGS -D_REENTRANT"
dnl *************************
dnl *** Output Everything ***
dnl *************************
AC_OUTPUT([
libsoup-2.2.pc
Makefile
libsoup/Makefile
tests/Makefile
docs/Makefile
docs/reference/Makefile
])
|