1 dnl *******************************************
2 dnl *** Initialize automake and set version ***
3 dnl *******************************************
5 AC_INIT(src/soup-core/soup.h)
11 AC_SUBST(SOUP_CURRENT)
12 AC_SUBST(SOUP_REVISION)
15 AM_CONFIG_HEADER(config.h)
16 AM_INIT_AUTOMAKE(soup, 0.2.1)
21 dnl ***************************
22 dnl *** Set debugging flags ***
23 dnl ***************************
25 # Figure out debugging default, prior to $ac_help setup
26 if test `expr $SOUP_REVISION \% 2` = 1 ; then
32 # Declare --enable-* args and collect ac_help strings
34 [ --enable-debug=[no/minimum/yes] turn on debugging [default=$debug_default]],,
35 enable_debug=$debug_default)
38 if test "x$enable_debug" = "xyes"; then
39 test "$cflags_set" = set || CFLAGS="$CFLAGS -g"
40 SOUP_DEBUG_FLAGS="-DG_ENABLE_DEBUG"
42 if test "x$enable_debug" = "xno"; then
43 SOUP_DEBUG_FLAGS="-DG_DISABLE_ASSERT -DG_DISABLE_CHECKS"
47 AC_SUBST(SOUP_DEBUG_FLAGS)
50 dnl ***************************
51 dnl *** Checks for programs ***
52 dnl ***************************
65 dnl ***************************
66 dnl *** Checks for glib 1.2 ***
67 dnl ***************************
70 AC_MSG_ERROR([Cannot find GLIB: Is glib-config in path?]))
72 GLIB_CFLAGS=`glib-config --cflags glib`
73 GLIB_LIBS=`glib-config --libs glib`
79 dnl ******************************
80 dnl *** Checks for gnome-xml 1 ***
81 dnl ******************************
83 AC_PATH_PROG(XML_CONFIG,xml-config,no)
84 if test x$XML_CONFIG = xno; then
85 AC_MSG_ERROR([Cannot find LIBXML: Is xml-config in path?])
87 XML_CFLAGS=`xml-config --cflags`
88 XML_LIBS=`xml-config --libs`
94 dnl ***********************
95 dnl *** Checks for popt ***
96 dnl ***********************
98 save_CPPFLAGS=$CPPFLAGS
103 AC_CHECK_LIB(popt, poptGetContext,, AC_MSG_ERROR([popt is required]))
104 AC_CHECK_HEADERS(popt.h,, AC_MSG_ERROR([popt.h is required]))
106 POPT_CFLAGS=$CPPFLAGS
109 AC_SUBST(POPT_CFLAGS)
112 CPPFLAGS=$save_CPPFLAGS
116 dnl **********************************************
117 dnl *** Variable substitution for soup*Conf.sh ***
118 dnl **********************************************
121 SOUP_LIBDIR='-L${libdir}'
122 SOUP_INCLUDEDIR=" -I${includedir} $GLIB_CFLAGS $XML_CFLAGS"
123 SOUP_LIBS="-lsoup $GLIB_LIBS $XML_LIBS"
125 AC_SUBST(SOUP_LIBDIR)
126 AC_SUBST(SOUP_INCLUDEDIR)
129 ### soup-apacheConf.sh
130 SOUP_APACHE_LIBDIR='-L${libdir}'
131 SOUP_APACHE_INCLUDEDIR="$SOUP_INCLUDEDIR $APACHE_CFLAGS"
132 SOUP_APACHE_LIBS="$SOUP_LIBS -lsoup-apache $APACHE_LIBS"
134 AC_SUBST(SOUP_APACHE_LIBDIR)
135 AC_SUBST(SOUP_APACHE_INCLUDEDIR)
136 AC_SUBST(SOUP_APACHE_LIBS)
139 SOUP_WSDL_LIBDIR='-L${libdir}'
140 SOUP_WSDL_INCLUDEDIR=" -I${includedir} $GLIB_CFLAGS $XML_CFLAGS"
141 SOUP_WSDL_LIBS="-lwsdl $GLIB_LIBS $XML_LIBS"
143 AC_SUBST(SOUP_WSDL_LIBDIR)
144 AC_SUBST(SOUP_WSDL_INCLUDEDIR)
145 AC_SUBST(SOUP_WSDL_LIBS)
148 dnl *********************************
149 dnl *** Networking library checks ***
150 dnl *********************************
152 AC_CHECK_HEADERS(netinet/in.h netinet/tcp.h)
153 AC_CHECK_HEADERS(sys/sockio.h sys/poll.h sys/param.h)
155 AC_CHECK_LIB(nsl, main)
156 AC_CHECK_LIB(resolv, main)
158 ### Check if we have gethostbyname_r (if so, assume gethostbyaddr_r).
159 AC_CHECK_FUNC(gethostbyname_r,
161 dnl First check for the glibc variant of gethostbyname_r
163 AC_MSG_CHECKING(for glibc gethostbyname_r)
164 AC_TRY_LINK([ #include <netdb.h>],[
165 struct hostent result_buf;
167 struct hostent* result;
170 gethostbyname_r("localhost", &result_buf, buf, sizeof(buf),
174 dnl Have glibc gethostbyname_r
177 AC_DEFINE(HAVE_GETHOSTBYNAME_R_GLIBC)
178 HAVE_GETHOSTBYNAME_R=yes
182 dnl If we don't have glibc gethostbyname_r, check
183 dnl for Solaris/Irix gethostbyname_r
186 AC_MSG_CHECKING(for Solaris/Irix gethostbyname_r)
187 AC_TRY_LINK([ #include <netdb.h>],[
188 struct hostent result;
192 gethostbyname_r("localhost", &result, buf, sizeof(buf), &h_errnop);
196 dnl Have Solaris/Irix gethostbyname_r
199 AC_DEFINE(HAVE_GETHOSTBYNAME_R_SOLARIS)
200 HAVE_GETHOSTBYNAME_R=yes
203 dnl If don't have Solaris/Irix gethostbyname_r, check
204 dnl for HP-UX gethostbyname_r
207 AC_MSG_CHECKING(for HP-UX gethostbyname_r)
208 AC_TRY_LINK([ #include <netdb.h>],[
209 struct hostent result;
211 gethostbyname_r("localhost", &result, buf);
214 dnl Have HP-UX gethostbyname_r
217 AC_DEFINE(HAVE_GETHOSTBYNAME_R_HPUX)
218 HAVE_GETHOSTBYNAME_R=yes
225 ### If we don't have gethostbyname_r, try to use Glib mutexes
226 if test -z "$HAVE_GETHOSTBYNAME_R"; then
228 AC_DEFINE(HAVE_GETHOSTBYNAME_R_GLIB_MUTEX), [
229 AC_MSG_WARN(You have neither Glib threads nor the function
230 gethostbyname_r. This means that calls to
231 gethostbyname (called by the Soup address
232 functions) will not be thread safe so could
233 malfunction in programs that use threads.)
238 dnl ****************************************************
239 dnl *** SSL Library checks (Mozilla NSS, or OpenSSL) ***
240 dnl ****************************************************
243 [ --enable-ssl Turn on Secure Sockets Layer support [default=yes]],,
246 AC_ARG_WITH(nspr-includes,
247 [ --with-nspr-includes Specify location of Netscape Portable Runtime headers],
248 [nspr_inc_prefix=-I$withval])
250 AC_ARG_WITH(nspr-libs,
251 [ --with-nspr-libs Specify location of Netscape Portable Runtime libs],[nspr_prefix=-L$withval])
253 AC_ARG_WITH(nss-includes,
254 [ --with-nss-includes Specify location of NSS header files],
255 [nss_inc_prefix=-I$withval])
257 AC_ARG_WITH(nss-libs,
258 [ --with-nss-libs Specify location of NSS libs],
259 [nss_prefix=-L$withval])
262 AC_ARG_WITH(openssl-includes,
263 [ --with-openssl-includes Specify location of OpenSSL header files],
264 [openssl_inc_prefix=-I$withval])
266 AC_ARG_WITH(openssl-libs,
267 [ --with-openssl-libs Specify location of OpenSSL libs],
268 [openssl_prefix=-L$withval],
269 [openssl_prefix=-L/usr/lib])
274 if test "x$enable_ssl" = xyes; then
275 save_CPPFLAGS=$CPPFLAGS
276 CPPFLAGS="$openssl_inc_prefix"
277 AC_CHECK_HEADERS(openssl/ssl.h openssl/err.h,
278 [OPENSSL_CFLAGS="$CPPFLAGS"
279 OPENSSL_LIBS="$openssl_prefix -lssl -lcrypto"
280 enable_openssl="yes"],
285 AC_SUBST(OPENSSL_CFLAGS)
286 AC_SUBST(OPENSSL_LIBS)
287 CPPFLAGS=$save_CPPFLAGS
289 save_CPPFLAGS=$CPPFLAGS
290 CPPFLAGS="$nspr_inc_prefix $nss_inc_prefix"
291 AC_CHECK_HEADERS(prthread.h security/ssl.h security/pk11func.h,
292 [NSS_CFLAGS="$CPPFLAGS"
293 NSS_LIBS="-lpthread $nspr_prefix -lnspr4 $nss_prefix -lnss3 -lssl3"
301 CPPFLAGS=$save_CPPFLAGS
305 dnl *************************
306 dnl *** Checks for Apache ***
307 dnl *************************
311 AC_PATH_PROG(APXS,apxs,no)
312 if test x$APXS != xno; then
313 APACHE_CFLAGS="-I`apxs -q INCLUDEDIR CFLAGS`"
314 APACHE_LIBS=`apxs -q LDFLAGS_SHLIB LIBS_SHLIB`
316 save_CPPFLAGS=$CPPFLAGS
317 CPPFLAGS=$APACHE_CFLAGS
318 AC_CHECK_HEADERS(httpd.h http_config.h http_core.h http_log.h http_main.h http_protocol.h,
319 [enable_apache="yes"],
322 CPPFLAGS=$save_CPPFLAGS
324 AC_SUBST(APACHE_CFLAGS)
325 AC_SUBST(APACHE_LIBS)
329 dnl *********************************************
330 dnl *** Checks for gtk-doc (lifted from glib) ***
331 dnl *********************************************
333 AC_ARG_WITH(html-dir, [ --with-html-dir=PATH path to installed docs ])
335 if test "x$with_html_dir" = "x" ; then
336 HTML_DIR='${datadir}/gtk-doc/html'
338 HTML_DIR=$with_html_dir
343 AC_CHECK_PROG(GTKDOC, gtkdoc-mkdb, true, false)
344 AM_CONDITIONAL(HAVE_GTK_DOC, $GTKDOC)
345 AC_SUBST(HAVE_GTK_DOC)
347 AC_CHECK_PROG(DB2HTML, db2html, true, false)
348 AM_CONDITIONAL(HAVE_DOCBOOK, $DB2HTML)
350 dnl Let people disable the gtk-doc stuff.
351 AC_ARG_ENABLE(gtk-doc, [ --enable-gtk-doc Use gtk-doc to build documentation [default=auto]], enable_gtk_doc="$enableval", enable_gtk_doc=auto)
353 if test x$enable_gtk_doc = xauto ; then
354 if test x$GTKDOC = xtrue ; then
361 dnl NOTE: We need to use a separate automake conditional for this
362 dnl to make this work with the tarballs.
363 AM_CONDITIONAL(ENABLE_GTK_DOC, test x$enable_gtk_doc = xyes)
366 dnl *******************************************************
367 dnl *** Type alignment test (based on the one in ORBit) ***
368 dnl *******************************************************
370 AC_DEFUN(AC_CHECK_ALIGNOF,
371 [changequote(<<, >>)dnl
372 dnl The name to #define.
373 define(<<AC_TYPE_NAME>>, translit(alignof_$1, [a-z *], [A-Z_P]))dnl
374 dnl The cache variable name.
375 define(<<AC_CV_NAME>>, translit(ac_cv_alignof_$1, [ *], [_p]))dnl
377 AC_MSG_CHECKING(alignment of $1)
378 align_save_libs="$LIBS"
379 LIBS="$GLIB_LIBS $LIBS"
380 AC_CACHE_VAL(AC_CV_NAME,
384 typedef struct {char s1;} gstruct;
385 struct test {char s1; $1 s2;};
388 FILE *f=fopen("conftestval", "w");
390 fprintf(f, "%d\n", &(((struct test*)0)->s2));
392 }], AC_CV_NAME=`cat conftestval`, AC_CV_NAME=0, AC_CV_NAME=0)])dnl
393 AC_MSG_RESULT($AC_CV_NAME)
394 LIBS="$align_save_libs"
395 AC_DEFINE_UNQUOTED(AC_TYPE_NAME, $AC_CV_NAME)
396 undefine([AC_TYPE_NAME])dnl
397 undefine([AC_CV_NAME])dnl
400 orig_CPPFLAGS=$CPPFLAGS
401 CPPFLAGS=$GLIB_CFLAGS
402 AC_CHECK_ALIGNOF(gboolean)
403 AC_CHECK_ALIGNOF(gchar)
404 AC_CHECK_ALIGNOF(guchar)
405 AC_CHECK_ALIGNOF(gint)
406 AC_CHECK_ALIGNOF(guint)
407 AC_CHECK_ALIGNOF(gshort)
408 AC_CHECK_ALIGNOF(gushort)
409 AC_CHECK_ALIGNOF(glong)
410 AC_CHECK_ALIGNOF(gulong)
411 AC_CHECK_ALIGNOF(gint8)
412 AC_CHECK_ALIGNOF(guint8)
413 AC_CHECK_ALIGNOF(gint16)
414 AC_CHECK_ALIGNOF(guint16)
415 AC_CHECK_ALIGNOF(gint32)
416 AC_CHECK_ALIGNOF(guint32)
417 AC_CHECK_ALIGNOF(gfloat)
418 AC_CHECK_ALIGNOF(gdouble)
419 AC_CHECK_ALIGNOF(gpointer)
420 AC_CHECK_ALIGNOF(gstruct)
421 CPPFLAGS=$orig_CPPFLAGS
424 dnl *************************************
425 dnl *** Warnings to show if using GCC ***
426 dnl *************************************
428 AC_ARG_ENABLE(more-warnings,
429 [ --enable-more-warnings Maximum compiler warnings],
430 set_more_warnings="$enableval",
431 set_more_warnings=yes)
433 if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then
435 -Wall -Wstrict-prototypes -Wmissing-declarations -Wmissing-prototypes \
436 -Wnested-externs -Wpointer-arith"
438 # -Wredundant-decls warns about libxml headers
439 # -Wwrite-strings warns when defining GDebugKey structs (solved by
440 # casting the strings in wsdl-trace.c and leaving out -Wcast-qual)
441 WSDL_CFLAGS="-Werror -W -Wundef -Wshadow -Wbad-function-cast -Wcast-align -Wwrite-strings -Wconversion -Waggregate-return -Wmissing-noreturn"
444 AC_SUBST(WSDL_CFLAGS)
446 # Use reentrant functions
447 CFLAGS="$CFLAGS -D_REENTRANT"
450 dnl *************************
451 dnl *** Output Everything ***
452 dnl *************************
461 docs/reference/Makefile
463 src/soup-core/Makefile
464 src/soup-wsdl/Makefile
465 src/soup-wsdl-runtime/Makefile
473 Source code location: ${srcdir}
475 Build flags: ${CFLAGS} ${SOUP_DEBUG_FLAGS}
477 OpenSSL support: ${enable_openssl}
478 Mozilla NSS support: ${enable_nss}
480 Apache module support: ${enable_apache}