1 dnl *******************************************
2 dnl *** Initialize automake and set version ***
3 dnl *******************************************
5 AC_INIT(libsoup/soup.h)
7 AM_INIT_AUTOMAKE(libsoup, 1.99.14)
8 AM_CONFIG_HEADER(config.h)
12 # Increment on interface addition. Reset on removal.
15 # Increment on interface add, remove, or change.
18 # Increment on source change. Reset when CURRENT changes.
21 AC_SUBST(SOUP_CURRENT)
22 AC_SUBST(SOUP_REVISION)
25 dnl ***************************
26 dnl *** Set debugging flags ***
27 dnl ***************************
31 # Declare --enable-* args and collect ac_help strings
33 [ --enable-debug=[no/minimum/yes] turn on debugging [default=$debug_default]],,
34 enable_debug=$debug_default)
37 if test "x$enable_debug" = "xyes"; then
38 test "$cflags_set" = set || CFLAGS="$CFLAGS -g"
39 SOUP_DEBUG_FLAGS="-DG_ENABLE_DEBUG"
41 if test "x$enable_debug" = "xno"; then
42 SOUP_DEBUG_FLAGS="-DG_DISABLE_ASSERT -DG_DISABLE_CHECKS"
46 AC_SUBST(SOUP_DEBUG_FLAGS)
49 dnl ***************************
50 dnl *** Checks for programs ***
51 dnl ***************************
63 # This isn't a program, but it doesn't fit anywhere else...
66 dnl ***********************
67 dnl *** Checks for glib ***
68 dnl ***********************
70 PKG_CHECK_MODULES(GLIB, glib-2.0)
74 dnl *********************************
75 dnl *** Networking library checks ***
76 dnl *********************************
78 AC_CHECK_HEADERS(sys/sockio.h sys/poll.h sys/param.h)
79 AC_CHECK_HEADERS(sys/ioctl.h sys/filio.h)
81 AC_CHECK_FUNC(socket, , AC_CHECK_LIB(socket, socket))
82 AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(nsl, gethostbyname))
84 AC_CHECK_FUNCS(inet_pton inet_aton)
86 ### Check if we have gethostbyname_r (if so, assume gethostbyaddr_r).
87 AC_CHECK_FUNC(gethostbyname_r,
89 dnl First check for the glibc variant of gethostbyname_r
91 AC_MSG_CHECKING(for glibc gethostbyname_r)
92 AC_TRY_LINK([ #include <netdb.h>],[
93 struct hostent result_buf;
95 struct hostent* result;
98 gethostbyname_r("localhost", &result_buf, buf, sizeof(buf),
102 dnl Have glibc gethostbyname_r
105 AC_DEFINE(HAVE_GETHOSTBYNAME_R_GLIBC, 1,
106 [Define if you have a glibc-style gethostbyname_r()])
107 HAVE_GETHOSTBYNAME_R=yes
111 dnl If we don't have glibc gethostbyname_r, check
112 dnl for Solaris/Irix gethostbyname_r
115 AC_MSG_CHECKING(for Solaris/Irix gethostbyname_r)
116 AC_TRY_LINK([ #include <netdb.h>],[
117 struct hostent result;
121 gethostbyname_r("localhost", &result, buf, sizeof(buf), &h_errnop);
125 dnl Have Solaris/Irix gethostbyname_r
128 AC_DEFINE(HAVE_GETHOSTBYNAME_R_SOLARIS, 1,
129 [Define if you have a Solaris-style gethostbyname_r()])
130 HAVE_GETHOSTBYNAME_R=yes
133 dnl If don't have Solaris/Irix gethostbyname_r, check
134 dnl for HP-UX gethostbyname_r
137 AC_MSG_CHECKING(for HP-UX gethostbyname_r)
138 AC_TRY_LINK([ #include <netdb.h>],[
139 struct hostent result;
141 gethostbyname_r("localhost", &result, buf);
144 dnl Have HP-UX gethostbyname_r
147 AC_DEFINE(HAVE_GETHOSTBYNAME_R_HPUX, 1,
148 [Define if you have an HP-UX-style gethostbyname_r()])
149 HAVE_GETHOSTBYNAME_R=yes
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.])
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)
170 case $soup_cv_ipv6 in
172 AC_DEFINE(HAVE_IPV6, 1, [Define if you have support for IPv6 sockets])
176 dnl ************************************************************
177 dnl *** SSL Library checks (GnuTLS, Mozilla NSS, or OpenSSL) ***
178 dnl ************************************************************
181 [ --enable-ssl Turn on Secure Sockets Layer support [default=yes]],,
184 AC_ARG_WITH(nspr-includes,
185 [ --with-nspr-includes Specify location of Netscape Portable Runtime headers],
186 [nspr_inc_prefix=-I$withval])
188 AC_ARG_WITH(nspr-libs,
189 [ --with-nspr-libs Specify location of Netscape Portable Runtime libs],
190 [nspr_prefix=$withval],
191 [nspr_prefix=$libdir])
193 AC_ARG_WITH(nss-includes,
194 [ --with-nss-includes Specify location of NSS header files],
195 [nss_inc_prefix=-I$withval])
197 AC_ARG_WITH(nss-libs,
198 [ --with-nss-libs Specify location of NSS libs],
199 [nss_prefix=$withval],
200 [nss_prefix=$libdir])
203 AC_ARG_WITH(openssl-includes,
204 [ --with-openssl-includes Specify location of OpenSSL header files],
205 [openssl_inc_prefix=-I$withval])
207 AC_ARG_WITH(openssl-libs,
208 [ --with-openssl-libs Specify location of OpenSSL libs],
209 [openssl_prefix=$withval],
210 [openssl_prefix=$libdir])
212 AC_ARG_WITH(gnutls-includes,
213 [ --with-gnutls-includes Specify location of GnuTLS header files],
214 [gnutls_inc_prefix=-I$withval])
216 AC_ARG_WITH(gnutls-libs,
217 [ --with-gnutls-libs Specify location of GnuTLS libs],
218 [gnutls_prefix=$withval],
219 [gnutls_prefix=$libdir])
222 ### Allow for a custom SSL proxy name
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])
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)
235 ### Try to link statically with the SSL library
237 AC_ARG_ENABLE(ssl-link-static,
238 [ --enable-static-ssl Link with SSL library statically [default=no]],
239 [enable_static_ssl=yes])
245 if test "x$enable_ssl" = xyes; then
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])
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"
261 GNUTLS_LIBS="-L$gnutls_prefix -lgnutls -lgcrypt"
263 GNUTLS_CFLAGS=$CPPFLAGS
264 AC_DEFINE(HAVE_GNUTLS, 1,
265 [Defined if you are using GnuTLS for SSL support])
272 AC_SUBST(GNUTLS_CFLAGS)
273 AC_SUBST(GNUTLS_LIBS)
274 CPPFLAGS=$save_CPPFLAGS
276 AM_CONDITIONAL(BUILD_PROXY, false)
279 ### Check for OpenSSL
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])
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"
293 OPENSSL_LIBS="-L$openssl_prefix -lssl -lcrypto $DL_LDFLAGS"
295 OPENSSL_CFLAGS=$CPPFLAGS
296 AC_DEFINE(HAVE_OPENSSL, 1,
297 [Defined if you are using OpenSSL for SSL support])
299 AM_CONDITIONAL(BUILD_PROXY, true)
305 AC_SUBST(OPENSSL_CFLAGS)
306 AC_SUBST(OPENSSL_LIBS)
307 CPPFLAGS=$save_CPPFLAGS
311 ### Check for Mozilla NSS
313 if test "x$found_ssl" != "xyes"; then
314 save_CPPFLAGS=$CPPFLAGS
315 CPPFLAGS="$CPPFLAGS $nspr_inc_prefix $nss_inc_prefix"
316 AC_CHECK_HEADERS(nss.h ssl.h pk11func.h,
318 [enable_nss="no"; break])
320 if test "x$enable_nss" = xyes; then
321 if test "x$enable_static_ssl" = "xyes"; then
322 NSS_LIBS="-lpthread $nspr_prefix/libnspr4.a $nspr_prefix/libplc4.a $nspr_prefix/libplds4.a $nss_prefix/libnssb.a"
324 NSS_LIBS="-lpthread -L$nspr_prefix -lnspr4 -lplc4 -lplds4 $nss_prefix -lnss3 -lssl3"
327 AC_DEFINE(HAVE_NSS, 1,
328 [Defined if you are using Mozilla NSS for SSL support])
337 CPPFLAGS=$save_CPPFLAGS
342 dnl *********************************************
343 dnl *** Checks for gtk-doc (lifted from glib) ***
344 dnl *********************************************
346 AC_ARG_WITH(html-dir, [ --with-html-dir=PATH Path to installed docs ])
348 if test "x$with_html_dir" = "x" ; then
349 HTML_DIR='${datadir}/gtk-doc/html'
351 HTML_DIR=$with_html_dir
356 AC_CHECK_PROG(GTKDOC, gtkdoc-mkdb, true, false)
357 AM_CONDITIONAL(HAVE_GTK_DOC, $GTKDOC)
358 AC_SUBST(HAVE_GTK_DOC)
360 AC_CHECK_PROG(DB2HTML, db2html, true, false)
361 AM_CONDITIONAL(HAVE_DOCBOOK, $DB2HTML)
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",
369 if test x$enable_gtk_doc = xauto ; then
370 if test x$GTKDOC = xtrue ; then
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)
382 dnl *************************************
383 dnl *** Warnings to show if using GCC ***
384 dnl *************************************
386 AC_ARG_ENABLE(more-warnings,
387 [ --disable-more-warnings Inhibit compiler warnings],
388 set_more_warnings=no)
390 if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then
392 -Wall -Wstrict-prototypes -Wmissing-declarations \
393 -Wmissing-prototypes -Wnested-externs -Wpointer-arith"
396 # Use reentrant functions
397 CFLAGS="$CFLAGS -D_REENTRANT"
399 dnl *****************************
400 dnl *** link proxy statically ***
401 dnl *****************************
402 AC_ARG_ENABLE(static-proxy,
403 [ --enable-static-proxy Build ${SSL_PROXY_NAME} statically ])
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/"`
418 AC_SUBST(LINK_STATIC)
419 AC_SUBST(LINK_DYNAMIC)
421 dnl *************************
422 dnl *** Output Everything ***
423 dnl *************************
436 Source code location: ${srcdir}
438 Build flags: ${CFLAGS} ${SOUP_DEBUG_FLAGS}
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 Mozilla NSS support: ${enable_nss}