1 | dnl ******************************************* |
---|
2 | dnl *** Initialize automake and set version *** |
---|
3 | dnl ******************************************* |
---|
4 | |
---|
5 | AC_INIT(libsoup/soup.h) |
---|
6 | |
---|
7 | AM_INIT_AUTOMAKE(libsoup, 1.99.23) |
---|
8 | AM_CONFIG_HEADER(config.h) |
---|
9 | AM_MAINTAINER_MODE |
---|
10 | AC_PROG_MAKE_SET |
---|
11 | |
---|
12 | # Increment on interface addition. Reset on removal. |
---|
13 | SOUP_AGE=0 |
---|
14 | |
---|
15 | # Increment on interface add, remove, or change. |
---|
16 | SOUP_CURRENT=0 |
---|
17 | |
---|
18 | # Increment on source change. Reset when CURRENT changes. |
---|
19 | SOUP_REVISION=0 |
---|
20 | |
---|
21 | AC_SUBST(SOUP_CURRENT) |
---|
22 | AC_SUBST(SOUP_REVISION) |
---|
23 | AC_SUBST(SOUP_AGE) |
---|
24 | |
---|
25 | dnl *************************** |
---|
26 | dnl *** Set debugging flags *** |
---|
27 | dnl *************************** |
---|
28 | |
---|
29 | debug_default=minimum |
---|
30 | |
---|
31 | # Declare --enable-* args and collect ac_help strings |
---|
32 | AC_ARG_ENABLE(debug, |
---|
33 | [ --enable-debug=[no/minimum/yes] turn on debugging [default=$debug_default]],, |
---|
34 | enable_debug=$debug_default) |
---|
35 | |
---|
36 | # Set the debug flags |
---|
37 | if test "x$enable_debug" = "xyes"; then |
---|
38 | test "$cflags_set" = set || CFLAGS="$CFLAGS -g" |
---|
39 | SOUP_DEBUG_FLAGS="-DG_ENABLE_DEBUG" |
---|
40 | else |
---|
41 | if test "x$enable_debug" = "xno"; then |
---|
42 | SOUP_DEBUG_FLAGS="-DG_DISABLE_ASSERT -DG_DISABLE_CHECKS" |
---|
43 | fi |
---|
44 | fi |
---|
45 | |
---|
46 | AC_SUBST(SOUP_DEBUG_FLAGS) |
---|
47 | |
---|
48 | |
---|
49 | dnl *************************** |
---|
50 | dnl *** Checks for programs *** |
---|
51 | dnl *************************** |
---|
52 | |
---|
53 | AC_PROG_CC |
---|
54 | AM_PROG_CC_STDC |
---|
55 | AC_PROG_INSTALL |
---|
56 | |
---|
57 | # Set STDC_HEADERS |
---|
58 | AC_HEADER_STDC |
---|
59 | |
---|
60 | # Initialize libtool |
---|
61 | AM_PROG_LIBTOOL |
---|
62 | |
---|
63 | # This isn't a program, but it doesn't fit anywhere else... |
---|
64 | AC_FUNC_ALLOCA |
---|
65 | |
---|
66 | dnl *********************** |
---|
67 | dnl *** Checks for glib *** |
---|
68 | dnl *********************** |
---|
69 | |
---|
70 | PKG_CHECK_MODULES(GLIB, glib-2.0) |
---|
71 | AC_SUBST(GLIB_CFLAGS) |
---|
72 | AC_SUBST(GLIB_LIBS) |
---|
73 | |
---|
74 | dnl ********************************* |
---|
75 | dnl *** Networking library checks *** |
---|
76 | dnl ********************************* |
---|
77 | |
---|
78 | AC_CHECK_HEADERS(sys/sockio.h sys/poll.h sys/param.h) |
---|
79 | AC_CHECK_HEADERS(sys/ioctl.h sys/filio.h) |
---|
80 | |
---|
81 | AC_CHECK_FUNC(socket, , AC_CHECK_LIB(socket, socket)) |
---|
82 | AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(nsl, gethostbyname)) |
---|
83 | |
---|
84 | AC_CHECK_FUNCS(inet_pton inet_aton) |
---|
85 | |
---|
86 | ### Check if we have gethostbyname_r (if so, assume gethostbyaddr_r). |
---|
87 | AC_CHECK_FUNC(gethostbyname_r, |
---|
88 | [ |
---|
89 | dnl First check for the glibc variant of gethostbyname_r |
---|
90 | |
---|
91 | AC_MSG_CHECKING(for glibc gethostbyname_r) |
---|
92 | AC_TRY_LINK([ #include <netdb.h>],[ |
---|
93 | struct hostent result_buf; |
---|
94 | char buf[1024]; |
---|
95 | struct hostent* result; |
---|
96 | int h_errnop; |
---|
97 | |
---|
98 | gethostbyname_r("localhost", &result_buf, buf, sizeof(buf), |
---|
99 | &result, &h_errnop); |
---|
100 | ], [ |
---|
101 | |
---|
102 | dnl Have glibc gethostbyname_r |
---|
103 | |
---|
104 | AC_MSG_RESULT(yes) |
---|
105 | AC_DEFINE(HAVE_GETHOSTBYNAME_R_GLIBC, 1, |
---|
106 | [Define if you have a glibc-style gethostbyname_r()]) |
---|
107 | HAVE_GETHOSTBYNAME_R=yes |
---|
108 | |
---|
109 | ], [ |
---|
110 | |
---|
111 | dnl If we don't have glibc gethostbyname_r, check |
---|
112 | dnl for Solaris/Irix gethostbyname_r |
---|
113 | |
---|
114 | AC_MSG_RESULT(no) |
---|
115 | AC_MSG_CHECKING(for Solaris/Irix gethostbyname_r) |
---|
116 | AC_TRY_LINK([ #include <netdb.h>],[ |
---|
117 | struct hostent result; |
---|
118 | char buf[1024]; |
---|
119 | int h_errnop; |
---|
120 | |
---|
121 | gethostbyname_r("localhost", &result, buf, sizeof(buf), &h_errnop); |
---|
122 | |
---|
123 | ], [ |
---|
124 | |
---|
125 | dnl Have Solaris/Irix gethostbyname_r |
---|
126 | |
---|
127 | AC_MSG_RESULT(yes) |
---|
128 | AC_DEFINE(HAVE_GETHOSTBYNAME_R_SOLARIS, 1, |
---|
129 | [Define if you have a Solaris-style gethostbyname_r()]) |
---|
130 | HAVE_GETHOSTBYNAME_R=yes |
---|
131 | |
---|
132 | ], [ |
---|
133 | dnl If don't have Solaris/Irix gethostbyname_r, check |
---|
134 | dnl for HP-UX gethostbyname_r |
---|
135 | |
---|
136 | AC_MSG_RESULT(no) |
---|
137 | AC_MSG_CHECKING(for HP-UX gethostbyname_r) |
---|
138 | AC_TRY_LINK([ #include <netdb.h>],[ |
---|
139 | struct hostent result; |
---|
140 | char buf[1024]; |
---|
141 | gethostbyname_r("localhost", &result, buf); |
---|
142 | ], [ |
---|
143 | |
---|
144 | dnl Have HP-UX gethostbyname_r |
---|
145 | |
---|
146 | AC_MSG_RESULT(yes) |
---|
147 | AC_DEFINE(HAVE_GETHOSTBYNAME_R_HPUX, 1, |
---|
148 | [Define if you have an HP-UX-style gethostbyname_r()]) |
---|
149 | HAVE_GETHOSTBYNAME_R=yes |
---|
150 | |
---|
151 | ] |
---|
152 | )] |
---|
153 | )] |
---|
154 | )]) |
---|
155 | |
---|
156 | # If we don't have gethostbyname_r, we'll use Glib mutexes, but give a warning |
---|
157 | if test -z "$HAVE_GETHOSTBYNAME_R"; then |
---|
158 | AC_DEFINE(HAVE_GETHOSTBYNAME_R_GLIB_MUTEX, 1, |
---|
159 | [Define if you have no gethostbyname_r()]) |
---|
160 | AC_MSG_WARN([You have neither Glib threads nor the function |
---|
161 | gethostbyname_r. This means that calls to |
---|
162 | gethostbyname (called by the Soup address |
---|
163 | functions) will not be thread safe so could |
---|
164 | malfunction in programs that use threads.]) |
---|
165 | fi |
---|
166 | |
---|
167 | AC_CACHE_CHECK(IPv6 support, soup_cv_ipv6, [ |
---|
168 | AC_EGREP_HEADER(sockaddr_in6, netinet/in.h, soup_cv_ipv6=yes, soup_cv_ipv6=no) |
---|
169 | ]) |
---|
170 | case $soup_cv_ipv6 in |
---|
171 | yes) |
---|
172 | AC_DEFINE(HAVE_IPV6, 1, [Define if you have support for IPv6 sockets]) |
---|
173 | ;; |
---|
174 | esac |
---|
175 | |
---|
176 | dnl ************************************************************ |
---|
177 | dnl *** SSL Library checks (GnuTLS, Mozilla NSS, or OpenSSL) *** |
---|
178 | dnl ************************************************************ |
---|
179 | |
---|
180 | AC_ARG_ENABLE(ssl, |
---|
181 | [ --enable-ssl Turn on Secure Sockets Layer support [default=yes]],, |
---|
182 | enable_ssl=yes) |
---|
183 | |
---|
184 | dnl NSS AC_ARG_WITH(nspr-includes, |
---|
185 | dnl NSS [ --with-nspr-includes Specify location of Netscape Portable Runtime headers], |
---|
186 | dnl NSS [nspr_inc_prefix=-I$withval]) |
---|
187 | dnl NSS |
---|
188 | dnl NSS AC_ARG_WITH(nspr-libs, |
---|
189 | dnl NSS [ --with-nspr-libs Specify location of Netscape Portable Runtime libs], |
---|
190 | dnl NSS [nspr_prefix=$withval], |
---|
191 | dnl NSS [nspr_prefix=$libdir]) |
---|
192 | dnl NSS |
---|
193 | dnl NSS AC_ARG_WITH(nss-includes, |
---|
194 | dnl NSS [ --with-nss-includes Specify location of NSS header files], |
---|
195 | dnl NSS [nss_inc_prefix=-I$withval]) |
---|
196 | dnl NSS |
---|
197 | dnl NSS AC_ARG_WITH(nss-libs, |
---|
198 | dnl NSS [ --with-nss-libs Specify location of NSS libs], |
---|
199 | dnl NSS [nss_prefix=$withval], |
---|
200 | dnl NSS [nss_prefix=$libdir]) |
---|
201 | |
---|
202 | |
---|
203 | AC_ARG_WITH(openssl-includes, |
---|
204 | [ --with-openssl-includes Specify location of OpenSSL header files], |
---|
205 | [openssl_inc_prefix=-I$withval]) |
---|
206 | |
---|
207 | AC_ARG_WITH(openssl-libs, |
---|
208 | [ --with-openssl-libs Specify location of OpenSSL libs], |
---|
209 | [openssl_prefix=$withval], |
---|
210 | [openssl_prefix=$libdir]) |
---|
211 | |
---|
212 | AC_ARG_WITH(gnutls-includes, |
---|
213 | [ --with-gnutls-includes Specify location of GnuTLS header files], |
---|
214 | [gnutls_inc_prefix=-I$withval]) |
---|
215 | |
---|
216 | AC_ARG_WITH(gnutls-libs, |
---|
217 | [ --with-gnutls-libs Specify location of GnuTLS libs], |
---|
218 | [gnutls_prefix=$withval], |
---|
219 | [gnutls_prefix=$libdir]) |
---|
220 | |
---|
221 | ### |
---|
222 | ### Allow for a custom SSL proxy name |
---|
223 | ### |
---|
224 | SSL_PROXY_NAME=libsoup-ssl-proxy |
---|
225 | AC_ARG_WITH(ssl-proxy-name, |
---|
226 | [ --with-ssl-proxy-name Custom name for ssl proxy executable [default=libsoup-ssl-proxy]], |
---|
227 | [SSL_PROXY_NAME=$withval], |
---|
228 | [SSL_PROXY_NAME=libsoup-ssl-proxy]) |
---|
229 | |
---|
230 | AC_DEFINE_UNQUOTED(SSL_PROXY_NAME, "${SSL_PROXY_NAME}", |
---|
231 | [The name to use for the SSL proxy binary. Defaults to libsoup-ssl-proxy]) |
---|
232 | AC_SUBST(SSL_PROXY_NAME) |
---|
233 | |
---|
234 | ### |
---|
235 | ### Try to link statically with the SSL library |
---|
236 | ### |
---|
237 | AC_ARG_ENABLE(ssl-link-static, |
---|
238 | [ --enable-static-ssl Link with SSL library statically [default=no]], |
---|
239 | [enable_static_ssl=yes]) |
---|
240 | |
---|
241 | enable_gnutls="no" |
---|
242 | enable_openssl="no" |
---|
243 | dnl NSS enable_nss="no" |
---|
244 | |
---|
245 | if test "x$enable_ssl" = xyes; then |
---|
246 | found_ssl= |
---|
247 | |
---|
248 | ### |
---|
249 | ### Check for GnuTLS |
---|
250 | ### |
---|
251 | save_CPPFLAGS=$CPPFLAGS |
---|
252 | CPPFLAGS="$CPPFLAGS $gnutls_inc_prefix" |
---|
253 | AC_CHECK_HEADERS(gnutls/gnutls.h, |
---|
254 | [enable_gnutls="yes"], |
---|
255 | [enable_gnutls="no"; break]) |
---|
256 | |
---|
257 | if test "x$enable_gnutls" = xyes; then |
---|
258 | if test "x$enable_static_ssl" = "xyes"; then |
---|
259 | GNUTLS_LIBS="$gnutls_prefix/libgnutls.a $gnutls_prefix/libgcrypt.a" |
---|
260 | else |
---|
261 | GNUTLS_LIBS="-L$gnutls_prefix -lgnutls -lgcrypt" |
---|
262 | fi |
---|
263 | GNUTLS_CFLAGS=$CPPFLAGS |
---|
264 | AC_DEFINE(HAVE_GNUTLS, 1, |
---|
265 | [Defined if you are using GnuTLS for SSL support]) |
---|
266 | found_ssl=yes |
---|
267 | else |
---|
268 | GNUTLS_LIBS= |
---|
269 | GNUTLS_CFLAGS= |
---|
270 | fi |
---|
271 | |
---|
272 | AC_SUBST(GNUTLS_CFLAGS) |
---|
273 | AC_SUBST(GNUTLS_LIBS) |
---|
274 | CPPFLAGS=$save_CPPFLAGS |
---|
275 | |
---|
276 | AM_CONDITIONAL(BUILD_PROXY, false) |
---|
277 | |
---|
278 | ### |
---|
279 | ### Check for OpenSSL |
---|
280 | ### |
---|
281 | if test "x$found_ssl" != "xyes"; then |
---|
282 | save_CPPFLAGS=$CPPFLAGS |
---|
283 | CPPFLAGS="$CPPFLAGS $openssl_inc_prefix" |
---|
284 | AC_CHECK_LIB(dl, dlopen, DL_LDFLAGS="-ldl", DL_LDFLAGS="") |
---|
285 | AC_CHECK_HEADERS(openssl/ssl.h openssl/err.h, |
---|
286 | [enable_openssl="yes"], |
---|
287 | [enable_openssl="no"; break]) |
---|
288 | |
---|
289 | if test "x$enable_openssl" = xyes; then |
---|
290 | if test "x$enable_static_ssl" = "xyes"; then |
---|
291 | OPENSSL_LIBS="$openssl_prefix/libssl.a $openssl_prefix/libcrypto.a" |
---|
292 | else |
---|
293 | OPENSSL_LIBS="-L$openssl_prefix -lssl -lcrypto $DL_LDFLAGS" |
---|
294 | fi |
---|
295 | OPENSSL_CFLAGS=$CPPFLAGS |
---|
296 | AC_DEFINE(HAVE_OPENSSL, 1, |
---|
297 | [Defined if you are using OpenSSL for SSL support]) |
---|
298 | found_ssl=yes |
---|
299 | AM_CONDITIONAL(BUILD_PROXY, true) |
---|
300 | else |
---|
301 | OPENSSL_LIBS= |
---|
302 | OPENSSL_CFLAGS= |
---|
303 | fi |
---|
304 | |
---|
305 | AC_SUBST(OPENSSL_CFLAGS) |
---|
306 | AC_SUBST(OPENSSL_LIBS) |
---|
307 | CPPFLAGS=$save_CPPFLAGS |
---|
308 | fi |
---|
309 | |
---|
310 | dnl NSS ### |
---|
311 | dnl NSS ### Check for Mozilla NSS |
---|
312 | dnl NSS ### |
---|
313 | dnl NSS if test "x$found_ssl" != "xyes"; then |
---|
314 | dnl NSS save_CPPFLAGS=$CPPFLAGS |
---|
315 | dnl NSS CPPFLAGS="$CPPFLAGS $nspr_inc_prefix $nss_inc_prefix" |
---|
316 | dnl NSS AC_CHECK_HEADERS(nss.h ssl.h pk11func.h, |
---|
317 | dnl NSS [enable_nss="yes"], |
---|
318 | dnl NSS [enable_nss="no"; break]) |
---|
319 | dnl NSS |
---|
320 | dnl NSS if test "x$enable_nss" = xyes; then |
---|
321 | dnl NSS if test "x$enable_static_ssl" = "xyes"; then |
---|
322 | dnl NSS NSS_LIBS="-lpthread $nspr_prefix/libnspr4.a $nspr_prefix/libplc4.a $nspr_prefix/libplds4.a $nss_prefix/libnssb.a" |
---|
323 | dnl NSS else |
---|
324 | dnl NSS NSS_LIBS="-lpthread -L$nspr_prefix -lnspr4 -lplc4 -lplds4 $nss_prefix -lnss3 -lssl3" |
---|
325 | dnl NSS fi |
---|
326 | dnl NSS NSS_CFLAGS=$CPPFLAGS |
---|
327 | dnl NSS AC_DEFINE(HAVE_NSS, 1, |
---|
328 | dnl NSS [Defined if you are using Mozilla NSS for SSL support]) |
---|
329 | dnl NSS found_ssl=yes |
---|
330 | dnl NSS else |
---|
331 | dnl NSS NSS_LIBS= |
---|
332 | dnl NSS NSS_CFLAGS= |
---|
333 | dnl NSS fi |
---|
334 | dnl NSS |
---|
335 | dnl NSS AC_SUBST(NSS_CFLAGS) |
---|
336 | dnl NSS AC_SUBST(NSS_LIBS) |
---|
337 | dnl NSS CPPFLAGS=$save_CPPFLAGS |
---|
338 | dnl NSS fi |
---|
339 | fi |
---|
340 | |
---|
341 | |
---|
342 | dnl ********************************************* |
---|
343 | dnl *** Checks for gtk-doc (lifted from glib) *** |
---|
344 | dnl ********************************************* |
---|
345 | |
---|
346 | AC_ARG_WITH(html-dir, [ --with-html-dir=PATH Path to installed docs ]) |
---|
347 | |
---|
348 | if test "x$with_html_dir" = "x" ; then |
---|
349 | HTML_DIR='${datadir}/gtk-doc/html' |
---|
350 | else |
---|
351 | HTML_DIR=$with_html_dir |
---|
352 | fi |
---|
353 | |
---|
354 | AC_SUBST(HTML_DIR) |
---|
355 | |
---|
356 | AC_CHECK_PROG(GTKDOC, gtkdoc-mkdb, true, false) |
---|
357 | AM_CONDITIONAL(HAVE_GTK_DOC, $GTKDOC) |
---|
358 | AC_SUBST(HAVE_GTK_DOC) |
---|
359 | |
---|
360 | AC_CHECK_PROG(DB2HTML, db2html, true, false) |
---|
361 | AM_CONDITIONAL(HAVE_DOCBOOK, $DB2HTML) |
---|
362 | |
---|
363 | dnl Let people disable the gtk-doc stuff. |
---|
364 | AC_ARG_ENABLE(gtk-doc, |
---|
365 | [ --enable-gtk-doc Use gtk-doc to build documentation [default=auto]], |
---|
366 | enable_gtk_doc="$enableval", |
---|
367 | enable_gtk_doc=auto) |
---|
368 | |
---|
369 | if test x$enable_gtk_doc = xauto ; then |
---|
370 | if test x$GTKDOC = xtrue ; then |
---|
371 | enable_gtk_doc=yes |
---|
372 | else |
---|
373 | enable_gtk_doc=no |
---|
374 | fi |
---|
375 | fi |
---|
376 | |
---|
377 | dnl NOTE: We need to use a separate automake conditional for this |
---|
378 | dnl to make this work with the tarballs. |
---|
379 | AM_CONDITIONAL(ENABLE_GTK_DOC, test x$enable_gtk_doc = xyes) |
---|
380 | |
---|
381 | |
---|
382 | dnl ************************************* |
---|
383 | dnl *** Warnings to show if using GCC *** |
---|
384 | dnl ************************************* |
---|
385 | |
---|
386 | AC_ARG_ENABLE(more-warnings, |
---|
387 | [ --disable-more-warnings Inhibit compiler warnings], |
---|
388 | set_more_warnings=no) |
---|
389 | |
---|
390 | if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then |
---|
391 | CFLAGS="$CFLAGS \ |
---|
392 | -Wall -Wstrict-prototypes -Wmissing-declarations \ |
---|
393 | -Wmissing-prototypes -Wnested-externs -Wpointer-arith" |
---|
394 | fi |
---|
395 | |
---|
396 | # Use reentrant functions |
---|
397 | CFLAGS="$CFLAGS -D_REENTRANT" |
---|
398 | |
---|
399 | dnl ***************************** |
---|
400 | dnl *** link proxy statically *** |
---|
401 | dnl ***************************** |
---|
402 | AC_ARG_ENABLE(static-proxy, |
---|
403 | [ --enable-static-proxy Build ${SSL_PROXY_NAME} statically ]) |
---|
404 | |
---|
405 | if test x"$enable_static_proxy" = xyes; then |
---|
406 | LINK_STATIC="-Wl,-Bstatic" |
---|
407 | LINK_DYNAMIC="-Wl,-Bdynamic" |
---|
408 | FORCE_SHLIBS="dl resolv rt nsl" |
---|
409 | for lib in $FORCE_SHLIBS; do |
---|
410 | OPENSSL_LIBS=`echo $OPENSSL_LIBS | sed "s/-l$lib/-Wl,-Bdynamic -l$lib -Wl,-Bstatic/"` |
---|
411 | GMODULE_LIBS=`echo $GMODULE_LIBS | sed "s/-l$lib/-Wl,-Bdynamic -l$lib -Wl,-Bstatic/"` |
---|
412 | done |
---|
413 | else |
---|
414 | LINK_STATIC= |
---|
415 | LINK_DYNAMIC= |
---|
416 | fi |
---|
417 | |
---|
418 | AC_SUBST(LINK_STATIC) |
---|
419 | AC_SUBST(LINK_DYNAMIC) |
---|
420 | |
---|
421 | dnl ************************* |
---|
422 | dnl *** Output Everything *** |
---|
423 | dnl ************************* |
---|
424 | |
---|
425 | AC_OUTPUT([ |
---|
426 | soup-2.0.pc |
---|
427 | Makefile |
---|
428 | libsoup/Makefile |
---|
429 | tests/Makefile |
---|
430 | ]) |
---|
431 | |
---|
432 | echo " |
---|
433 | |
---|
434 | Configuration: |
---|
435 | |
---|
436 | Source code location: ${srcdir} |
---|
437 | Compiler: ${CC} |
---|
438 | Build flags: ${CFLAGS} ${SOUP_DEBUG_FLAGS} |
---|
439 | |
---|
440 | GnuTLS support: ${enable_gnutls} |
---|
441 | OpenSSL support: ${enable_openssl} |
---|
442 | Static SSL Proxy: ${enable_static_proxy:-no} |
---|
443 | SSL Proxy Name: ${SSL_PROXY_NAME} |
---|
444 | |
---|
445 | |
---|
446 | " |
---|