1 dnl *******************************************
2 dnl *** Initialize automake and set version ***
3 dnl *******************************************
5 AC_INIT(src/libsoup/soup.h)
7 # Increment on interface addition. Reset on removal.
10 # Increment on interface add, remove, or change.
13 # Increment on source change. Reset when CURRENT changes.
16 AC_SUBST(SOUP_CURRENT)
17 AC_SUBST(SOUP_REVISION)
20 # Update in src/soup-core/soup-private.h for Windows
21 AM_INIT_AUTOMAKE(soup, 0.7.99)
23 AM_CONFIG_HEADER(config.h)
28 dnl ***************************
29 dnl *** Set debugging flags ***
30 dnl ***************************
34 # Declare --enable-* args and collect ac_help strings
36 [ --enable-debug=[no/minimum/yes] turn on debugging [default=$debug_default]],,
37 enable_debug=$debug_default)
40 if test "x$enable_debug" = "xyes"; then
41 test "$cflags_set" = set || CFLAGS="$CFLAGS -g"
42 SOUP_DEBUG_FLAGS="-DG_ENABLE_DEBUG"
44 if test "x$enable_debug" = "xno"; then
45 SOUP_DEBUG_FLAGS="-DG_DISABLE_ASSERT -DG_DISABLE_CHECKS"
49 AC_SUBST(SOUP_DEBUG_FLAGS)
52 dnl ***************************
53 dnl *** Checks for programs ***
54 dnl ***************************
66 # This isn't a program, but it doesn't fit anywhere else...
70 dnl ***************************
71 dnl *** Checks for glib 1.2 ***
72 dnl ***************************
75 AC_MSG_ERROR([Cannot find GLIB: Is glib-config in path?]))
77 GLIB_CFLAGS=`glib-config --cflags glib`
78 GLIB_LIBS=`glib-config --libs glib`
79 GMODULE_LIBS=`glib-config --libs gmodule`
83 AC_SUBST(GMODULE_LIBS)
86 dnl ****************************
87 dnl *** Checks for gnome-xml ***
88 dnl ****************************
92 [ --with-libxml=[1/2] which version of libxml to use [default=$FAVOUR_LIBXML]],,
93 with_libxml=$FAVOUR_LIBXML)
95 if test "x$with_libxml" = "x" -o "$with_libxml" = "yes"; then
96 with_libxml=$FAVOUR_LIBXML
99 if test "$with_libxml" = "1"; then
100 AC_PATH_PROG(XML_CONFIG,xml-config,no)
101 if test x$XML_CONFIG = xno; then
102 AC_MSG_ERROR([Cannot find LIBXML: Is xml-config in path?])
105 XML_MIN_VERSION=1.8.8
107 if test "$with_libxml" = "2"; then
108 AC_PATH_PROG(XML_CONFIG,xml2-config,no)
109 if test x$XML_CONFIG = xno; then
110 AC_MSG_ERROR([Cannot find LIBXML2: Is xml2-config in path?])
113 XML_MIN_VERSION=2.3.10
115 AC_MSG_ERROR(Can't use libxml version $with_libxml)
120 XML_VERSION=`$XML_CONFIG --version`
121 ver=`echo $XML_VERSION | awk -F. '{printf("%d", ($1*1000+$2)*1000+$3);}'`
122 minver=`echo $XML_MIN_VERSION | awk -F. '{printf("%d", ($1*1000+$2)*1000+$3);}'`
123 if test "$minver" -gt "$ver"
125 AC_MSG_ERROR(Found libxml version $XML_VERSION. You need $XML_MIN_VERSION or newer)
128 XML_CFLAGS=`$XML_CONFIG --cflags`
129 XML_LIBS=`$XML_CONFIG --libs`
135 dnl ***********************
136 dnl *** Checks for popt ***
137 dnl ***********************
139 AC_ARG_WITH(popt-includes,
140 [ --with-popt-includes Specify location of popt headers],
141 [popt_inc_prefix=-I$withval])
143 AC_ARG_WITH(popt-libs,
144 [ --with-popt-libs Specify location of popt libs],
145 [popt_prefix=$withval],
146 [popt_prefix=/usr/lib])
148 save_CPPFLAGS=$CPPFLAGS
150 CPPFLAGS="$CPPFLAGS $popt_inc_prefix"
151 LIBS="$LIBS -L$prefix"
155 [POPT_LIBS="$LIBS -lpopt"] ,
156 AC_MSG_ERROR([popt is required]))
157 AC_CHECK_HEADERS(popt.h, [POPT_CFLAGS="$CFLAGS"], AC_MSG_ERROR([popt.h is required]))
159 CPPFLAGS=$save_CPPFLAGS
162 AC_SUBST(POPT_CFLAGS)
166 dnl **********************************************
167 dnl *** Variable substitution for soup*Conf.sh ***
168 dnl **********************************************
171 SOUP_LIBDIR='-L${libdir}'
172 SOUP_INCLUDEDIR=" -I${includedir}/soup $GLIB_CFLAGS $XML_CFLAGS"
173 SOUP_LIBS="-lsoup $GLIB_LIBS $XML_LIBS"
175 AC_SUBST(SOUP_LIBDIR)
176 AC_SUBST(SOUP_INCLUDEDIR)
179 ### soup-apacheConf.sh
180 SOUP_APACHE_LIBDIR='-L${libdir}'
181 SOUP_APACHE_INCLUDEDIR="$SOUP_INCLUDEDIR $APACHE_CFLAGS"
182 SOUP_APACHE_LIBS="$SOUP_LIBS -lsoup-apache $APACHE_LIBS"
184 AC_SUBST(SOUP_APACHE_LIBDIR)
185 AC_SUBST(SOUP_APACHE_INCLUDEDIR)
186 AC_SUBST(SOUP_APACHE_LIBS)
189 SOUP_WSDL_LIBDIR='-L${libdir}'
190 SOUP_WSDL_INCLUDEDIR=" -I${includedir}/soup $GLIB_CFLAGS $XML_CFLAGS"
191 SOUP_WSDL_LIBS="$SOUP_LIBS -lwsdl"
193 AC_SUBST(SOUP_WSDL_LIBDIR)
194 AC_SUBST(SOUP_WSDL_INCLUDEDIR)
195 AC_SUBST(SOUP_WSDL_LIBS)
198 dnl *********************************
199 dnl *** Networking library checks ***
200 dnl *********************************
202 AC_CHECK_HEADERS(unistd.h)
203 AC_CHECK_HEADERS(netinet/in.h netinet/tcp.h)
204 AC_CHECK_HEADERS(sys/socket.h sys/sockio.h sys/poll.h sys/param.h sys/wait.h)
205 AC_CHECK_HEADERS(sys/ioctl.h sys/filio.h)
207 AC_CHECK_FUNC(socket, , AC_CHECK_LIB(socket, socket))
208 AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(nsl, gethostbyname))
210 AC_CHECK_FUNCS(inet_pton inet_aton)
212 ### Check if we have gethostbyname_r (if so, assume gethostbyaddr_r).
213 AC_CHECK_FUNC(gethostbyname_r,
215 dnl First check for the glibc variant of gethostbyname_r
217 AC_MSG_CHECKING(for glibc gethostbyname_r)
218 AC_TRY_LINK([ #include <netdb.h>],[
219 struct hostent result_buf;
221 struct hostent* result;
224 gethostbyname_r("localhost", &result_buf, buf, sizeof(buf),
228 dnl Have glibc gethostbyname_r
231 AC_DEFINE(HAVE_GETHOSTBYNAME_R_GLIBC)
232 HAVE_GETHOSTBYNAME_R=yes
236 dnl If we don't have glibc gethostbyname_r, check
237 dnl for Solaris/Irix gethostbyname_r
240 AC_MSG_CHECKING(for Solaris/Irix gethostbyname_r)
241 AC_TRY_LINK([ #include <netdb.h>],[
242 struct hostent result;
246 gethostbyname_r("localhost", &result, buf, sizeof(buf), &h_errnop);
250 dnl Have Solaris/Irix gethostbyname_r
253 AC_DEFINE(HAVE_GETHOSTBYNAME_R_SOLARIS)
254 HAVE_GETHOSTBYNAME_R=yes
257 dnl If don't have Solaris/Irix gethostbyname_r, check
258 dnl for HP-UX gethostbyname_r
261 AC_MSG_CHECKING(for HP-UX gethostbyname_r)
262 AC_TRY_LINK([ #include <netdb.h>],[
263 struct hostent result;
265 gethostbyname_r("localhost", &result, buf);
268 dnl Have HP-UX gethostbyname_r
271 AC_DEFINE(HAVE_GETHOSTBYNAME_R_HPUX)
272 HAVE_GETHOSTBYNAME_R=yes
279 ### If we don't have gethostbyname_r, try to use Glib mutexes
280 if test -z "$HAVE_GETHOSTBYNAME_R"; then
282 AC_DEFINE(HAVE_GETHOSTBYNAME_R_GLIB_MUTEX), [
283 AC_MSG_WARN(You have neither Glib threads nor the function
284 gethostbyname_r. This means that calls to
285 gethostbyname (called by the Soup address
286 functions) will not be thread safe so could
287 malfunction in programs that use threads.)
292 dnl ****************************************************
293 dnl *** SSL Library checks (Mozilla NSS, or OpenSSL) ***
294 dnl ****************************************************
297 [ --enable-ssl Turn on Secure Sockets Layer support [default=yes]],,
300 AC_ARG_WITH(nspr-includes,
301 [ --with-nspr-includes Specify location of Netscape Portable Runtime headers],
302 [nspr_inc_prefix=-I$withval])
304 AC_ARG_WITH(nspr-libs,
305 [ --with-nspr-libs Specify location of Netscape Portable Runtime libs],
306 [nspr_prefix=$withval],
307 [nspr_prefix=/usr/lib])
309 AC_ARG_WITH(nss-includes,
310 [ --with-nss-includes Specify location of NSS header files],
311 [nss_inc_prefix=-I$withval])
313 AC_ARG_WITH(nss-libs,
314 [ --with-nss-libs Specify location of NSS libs],
315 [nss_prefix=$withval],
316 [nss_prefix=/usr/lib])
319 AC_ARG_WITH(openssl-includes,
320 [ --with-openssl-includes Specify location of OpenSSL header files],
321 [openssl_inc_prefix=-I$withval])
323 AC_ARG_WITH(openssl-libs,
324 [ --with-openssl-libs Specify location of OpenSSL libs],
325 [openssl_prefix=$withval],
326 [openssl_prefix=/usr/lib])
329 ### Allow for a custom SSL proxy name
331 AC_ARG_WITH(ssl-proxy-name,
332 [ --with-ssl-proxy-name Custom name for ssl proxy executable [default=soup-ssl-proxy]],
333 [SSL_PROXY_NAME=$withval],
334 [SSL_PROXY_NAME=soup-ssl-proxy])
336 AC_DEFINE_UNQUOTED(SSL_PROXY_NAME, "${SSL_PROXY_NAME}")
337 AC_SUBST(SSL_PROXY_NAME)
340 ### Try to link statically with the SSL library
342 AC_ARG_ENABLE(ssl-link-static,
343 [ --enable-static-ssl Link with SSL library statically [default=no]],
344 [enable_static_ssl=yes])
346 if test "x$enable_ssl" = xyes; then
348 ### Check for OpenSSL
350 save_CPPFLAGS=$CPPFLAGS
351 CPPFLAGS="$CPPFLAGS $openssl_inc_prefix"
352 AC_CHECK_LIB(dl, dlopen, DL_LDFLAGS="-ldl", DL_LDFLAGS="")
353 AC_CHECK_HEADERS(openssl/ssl.h openssl/err.h,
354 [enable_openssl="yes"],
355 [enable_openssl="no"; break])
357 if test "x$enable_openssl" = xyes; then
358 if test "x$enable_static_ssl" = "xyes"; then
359 OPENSSL_LIBS="$openssl_prefix/libssl.a $openssl_prefix/libcrypto.a"
361 OPENSSL_LIBS="-L$openssl_prefix -lssl -lcrypto $DL_LDFLAGS"
363 OPENSSL_CFLAGS=$CPPFLAGS
364 AC_DEFINE(HAVE_OPENSSL)
370 AC_SUBST(OPENSSL_CFLAGS)
371 AC_SUBST(OPENSSL_LIBS)
372 CPPFLAGS=$save_CPPFLAGS
375 ### Check for Mozilla NSS
377 save_CPPFLAGS=$CPPFLAGS
378 CPPFLAGS="$CPPFLAGS $nspr_inc_prefix $nss_inc_prefix"
379 AC_CHECK_HEADERS(nss.h ssl.h pk11func.h,
381 [enable_nss="no"; break])
383 if test "x$enable_nss" = xyes; then
384 if test "x$enable_static_ssl" = "xyes"; then
385 NSS_LIBS="-lpthread $nspr_prefix/libnspr4.a $nspr_prefix/libplc4.a $nspr_prefix/libplds4.a $nss_prefix/libnssb.a"
387 NSS_LIBS="-lpthread -L$nspr_prefix -lnspr4 -lplc4 -lplds4 $nss_prefix -lnss3 -lssl3"
398 CPPFLAGS=$save_CPPFLAGS
402 dnl *************************
403 dnl *** Checks for Apache ***
404 dnl *************************
408 AC_PATH_PROG(APXS,apxs,no)
409 if test x$APXS != xno; then
410 APACHE_CFLAGS="-I`apxs -q INCLUDEDIR CFLAGS`"
411 APACHE_LIBS=`apxs -q LDFLAGS_SHLIB LIBS_SHLIB`
413 save_CPPFLAGS=$CPPFLAGS
414 CPPFLAGS=$APACHE_CFLAGS
415 AC_CHECK_HEADERS(httpd.h http_config.h http_core.h http_log.h http_main.h http_protocol.h,
416 [enable_apache="yes"],
419 CPPFLAGS=$save_CPPFLAGS
421 AC_SUBST(APACHE_CFLAGS)
422 AC_SUBST(APACHE_LIBS)
426 dnl *********************************************
427 dnl *** Checks for gtk-doc (lifted from glib) ***
428 dnl *********************************************
430 AC_ARG_WITH(html-dir, [ --with-html-dir=PATH Path to installed docs ])
432 if test "x$with_html_dir" = "x" ; then
433 HTML_DIR='${datadir}/gtk-doc/html'
435 HTML_DIR=$with_html_dir
440 AC_CHECK_PROG(GTKDOC, gtkdoc-mkdb, true, false)
441 AM_CONDITIONAL(HAVE_GTK_DOC, $GTKDOC)
442 AC_SUBST(HAVE_GTK_DOC)
444 AC_CHECK_PROG(DB2HTML, db2html, true, false)
445 AM_CONDITIONAL(HAVE_DOCBOOK, $DB2HTML)
447 dnl Let people disable the gtk-doc stuff.
448 AC_ARG_ENABLE(gtk-doc,
449 [ --enable-gtk-doc Use gtk-doc to build documentation [default=auto]],
450 enable_gtk_doc="$enableval",
453 if test x$enable_gtk_doc = xauto ; then
454 if test x$GTKDOC = xtrue ; then
461 dnl NOTE: We need to use a separate automake conditional for this
462 dnl to make this work with the tarballs.
463 AM_CONDITIONAL(ENABLE_GTK_DOC, test x$enable_gtk_doc = xyes)
466 dnl *******************************************************
467 dnl *** Type alignment test (based on the one in ORBit) ***
468 dnl *******************************************************
470 AC_DEFUN(AC_CHECK_ALIGNOF,
471 [changequote(<<, >>)dnl
472 dnl The name to #define.
473 define(<<AC_TYPE_NAME>>, translit(alignof_$1, [a-z *], [A-Z_P]))dnl
474 dnl The cache variable name.
475 define(<<AC_CV_NAME>>, translit(ac_cv_alignof_$1, [ *], [_p]))dnl
477 AC_MSG_CHECKING(alignment of $1)
478 align_save_libs="$LIBS"
479 LIBS="$GLIB_LIBS $LIBS"
480 AC_CACHE_VAL(AC_CV_NAME,
484 typedef struct {char s1;} gstruct;
485 struct test {char s1; $1 s2;};
488 FILE *f=fopen("conftestval", "w");
490 fprintf(f, "%d\n", &(((struct test*)0)->s2));
492 }], AC_CV_NAME=`cat conftestval`, AC_CV_NAME=0, AC_CV_NAME=0)])dnl
493 AC_MSG_RESULT($AC_CV_NAME)
494 LIBS="$align_save_libs"
495 AC_DEFINE_UNQUOTED(AC_TYPE_NAME, $AC_CV_NAME)
496 undefine([AC_TYPE_NAME])dnl
497 undefine([AC_CV_NAME])dnl
500 orig_CPPFLAGS=$CPPFLAGS
501 CPPFLAGS=$GLIB_CFLAGS
502 AC_CHECK_ALIGNOF(gboolean)
503 AC_CHECK_ALIGNOF(gchar)
504 AC_CHECK_ALIGNOF(guchar)
505 AC_CHECK_ALIGNOF(gint)
506 AC_CHECK_ALIGNOF(guint)
507 AC_CHECK_ALIGNOF(gshort)
508 AC_CHECK_ALIGNOF(gushort)
509 AC_CHECK_ALIGNOF(glong)
510 AC_CHECK_ALIGNOF(gulong)
511 AC_CHECK_ALIGNOF(gint8)
512 AC_CHECK_ALIGNOF(guint8)
513 AC_CHECK_ALIGNOF(gint16)
514 AC_CHECK_ALIGNOF(guint16)
515 AC_CHECK_ALIGNOF(gint32)
516 AC_CHECK_ALIGNOF(guint32)
517 AC_CHECK_ALIGNOF(gfloat)
518 AC_CHECK_ALIGNOF(gdouble)
519 AC_CHECK_ALIGNOF(gpointer)
520 AC_CHECK_ALIGNOF(gstruct)
521 CPPFLAGS=$orig_CPPFLAGS
524 dnl *************************************
525 dnl *** Warnings to show if using GCC ***
526 dnl *************************************
528 AC_ARG_ENABLE(more-warnings,
529 [ --disable-more-warnings Inhibit compiler warnings],
530 set_more_warnings=no)
532 if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then
534 -Wall -Wstrict-prototypes -Wmissing-declarations \
535 -Wmissing-prototypes -Wnested-externs -Wpointer-arith"
538 # Use reentrant functions
539 CFLAGS="$CFLAGS -D_REENTRANT"
542 dnl *************************
543 dnl *** Output Everything ***
544 dnl *************************
552 docs/reference/Makefile
555 src/libsoup-apache/Makefile
557 src/soup-httpd/Makefile
558 src/soup-ssl-proxy/Makefile
559 src/soup-wsdl/Makefile
567 Source code location: ${srcdir}
569 Build flags: ${CFLAGS} ${SOUP_DEBUG_FLAGS}
571 OpenSSL support: ${enable_openssl}
572 Mozilla NSS support: ${enable_nss}
574 Apache module support: ${enable_apache}