1 dnl *******************************************
2 dnl *** Initialize automake and set version ***
3 dnl *******************************************
5 AC_INIT(libsoup/soup.h)
7 AM_INIT_AUTOMAKE(libsoup, 1.99.12)
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 (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])
213 ### Allow for a custom SSL proxy name
215 SSL_PROXY_NAME=libsoup-ssl-proxy
216 AC_ARG_WITH(ssl-proxy-name,
217 [ --with-ssl-proxy-name Custom name for ssl proxy executable [default=libsoup-ssl-proxy]],
218 [SSL_PROXY_NAME=$withval],
219 [SSL_PROXY_NAME=libsoup-ssl-proxy])
221 AC_DEFINE_UNQUOTED(SSL_PROXY_NAME, "${SSL_PROXY_NAME}",
222 [The name to use for the SSL proxy binary. Defaults to libsoup-ssl-proxy])
223 AC_SUBST(SSL_PROXY_NAME)
226 ### Try to link statically with the SSL library
228 AC_ARG_ENABLE(ssl-link-static,
229 [ --enable-static-ssl Link with SSL library statically [default=no]],
230 [enable_static_ssl=yes])
232 if test "x$enable_ssl" = xyes; then
234 ### Check for OpenSSL
236 save_CPPFLAGS=$CPPFLAGS
237 CPPFLAGS="$CPPFLAGS $openssl_inc_prefix"
238 AC_CHECK_LIB(dl, dlopen, DL_LDFLAGS="-ldl", DL_LDFLAGS="")
239 AC_CHECK_HEADERS(openssl/ssl.h openssl/err.h,
240 [enable_openssl="yes"],
241 [enable_openssl="no"; break])
243 if test "x$enable_openssl" = xyes; then
244 if test "x$enable_static_ssl" = "xyes"; then
245 OPENSSL_LIBS="$openssl_prefix/libssl.a $openssl_prefix/libcrypto.a"
247 OPENSSL_LIBS="-L$openssl_prefix -lssl -lcrypto $DL_LDFLAGS"
249 OPENSSL_CFLAGS=$CPPFLAGS
250 AC_DEFINE(HAVE_OPENSSL, 1,
251 [Defined if you are using OpenSSL for SSL support])
257 AC_SUBST(OPENSSL_CFLAGS)
258 AC_SUBST(OPENSSL_LIBS)
259 CPPFLAGS=$save_CPPFLAGS
262 ### Check for Mozilla NSS
264 save_CPPFLAGS=$CPPFLAGS
265 CPPFLAGS="$CPPFLAGS $nspr_inc_prefix $nss_inc_prefix"
266 AC_CHECK_HEADERS(nss.h ssl.h pk11func.h,
268 [enable_nss="no"; break])
270 if test "x$enable_nss" = xyes; then
271 if test "x$enable_static_ssl" = "xyes"; then
272 NSS_LIBS="-lpthread $nspr_prefix/libnspr4.a $nspr_prefix/libplc4.a $nspr_prefix/libplds4.a $nss_prefix/libnssb.a"
274 NSS_LIBS="-lpthread -L$nspr_prefix -lnspr4 -lplc4 -lplds4 $nss_prefix -lnss3 -lssl3"
277 AC_DEFINE(HAVE_NSS, 1,
278 [Defined if you are using Mozilla NSS for SSL support])
286 CPPFLAGS=$save_CPPFLAGS
290 dnl *********************************************
291 dnl *** Checks for gtk-doc (lifted from glib) ***
292 dnl *********************************************
294 AC_ARG_WITH(html-dir, [ --with-html-dir=PATH Path to installed docs ])
296 if test "x$with_html_dir" = "x" ; then
297 HTML_DIR='${datadir}/gtk-doc/html'
299 HTML_DIR=$with_html_dir
304 AC_CHECK_PROG(GTKDOC, gtkdoc-mkdb, true, false)
305 AM_CONDITIONAL(HAVE_GTK_DOC, $GTKDOC)
306 AC_SUBST(HAVE_GTK_DOC)
308 AC_CHECK_PROG(DB2HTML, db2html, true, false)
309 AM_CONDITIONAL(HAVE_DOCBOOK, $DB2HTML)
311 dnl Let people disable the gtk-doc stuff.
312 AC_ARG_ENABLE(gtk-doc,
313 [ --enable-gtk-doc Use gtk-doc to build documentation [default=auto]],
314 enable_gtk_doc="$enableval",
317 if test x$enable_gtk_doc = xauto ; then
318 if test x$GTKDOC = xtrue ; then
325 dnl NOTE: We need to use a separate automake conditional for this
326 dnl to make this work with the tarballs.
327 AM_CONDITIONAL(ENABLE_GTK_DOC, test x$enable_gtk_doc = xyes)
330 dnl *************************************
331 dnl *** Warnings to show if using GCC ***
332 dnl *************************************
334 AC_ARG_ENABLE(more-warnings,
335 [ --disable-more-warnings Inhibit compiler warnings],
336 set_more_warnings=no)
338 if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then
340 -Wall -Wstrict-prototypes -Wmissing-declarations \
341 -Wmissing-prototypes -Wnested-externs -Wpointer-arith"
344 # Use reentrant functions
345 CFLAGS="$CFLAGS -D_REENTRANT"
347 dnl *****************************
348 dnl *** link proxy statically ***
349 dnl *****************************
350 AC_ARG_ENABLE(static-proxy,
351 [ --enable-static-proxy Build ${SSL_PROXY_NAME} statically ])
353 if test x"$enable_static_proxy" = xyes; then
354 LINK_STATIC="-Wl,-Bstatic"
355 LINK_DYNAMIC="-Wl,-Bdynamic"
356 FORCE_SHLIBS="dl resolv rt nsl"
357 for lib in $FORCE_SHLIBS; do
358 OPENSSL_LIBS=`echo $OPENSSL_LIBS | sed "s/-l$lib/-Wl,-Bdynamic -l$lib -Wl,-Bstatic/"`
359 GMODULE_LIBS=`echo $GMODULE_LIBS | sed "s/-l$lib/-Wl,-Bdynamic -l$lib -Wl,-Bstatic/"`
366 AC_SUBST(LINK_STATIC)
367 AC_SUBST(LINK_DYNAMIC)
369 dnl *************************
370 dnl *** Output Everything ***
371 dnl *************************
384 Source code location: ${srcdir}
386 Build flags: ${CFLAGS} ${SOUP_DEBUG_FLAGS}
388 Static SSL Proxy: ${enable_static_proxy:-no}
389 SSL Proxy Name: ${SSL_PROXY_NAME}
391 OpenSSL support: ${enable_openssl}
392 Mozilla NSS support: ${enable_nss}