dnl ******************************************* dnl *** Initialize automake and set version *** dnl ******************************************* AC_INIT(src/libsoup/soup.h) # Increment on interface addition. Reset on removal. SOUP_AGE=1 # Increment on interface add, remove, or change. SOUP_CURRENT=4 # Increment on source change. Reset when CURRENT changes. SOUP_REVISION=0 AC_SUBST(SOUP_CURRENT) AC_SUBST(SOUP_REVISION) AC_SUBST(SOUP_AGE) # Update in src/libsoup/soup-private.h for Windows AM_INIT_AUTOMAKE(soup, 0.7.0) AM_CONFIG_HEADER(config.h) AM_MAINTAINER_MODE AC_PROG_MAKE_SET dnl *************************** dnl *** Set debugging flags *** dnl *************************** debug_default=minimum # Declare --enable-* args and collect ac_help strings AC_ARG_ENABLE(debug, [ --enable-debug=[no/minimum/yes] turn on debugging [default=$debug_default]],, enable_debug=$debug_default) # Set the debug flags if test "x$enable_debug" = "xyes"; then test "$cflags_set" = set || CFLAGS="$CFLAGS -g" SOUP_DEBUG_FLAGS="-DG_ENABLE_DEBUG" else if test "x$enable_debug" = "xno"; then SOUP_DEBUG_FLAGS="-DG_DISABLE_ASSERT -DG_DISABLE_CHECKS" fi fi AC_SUBST(SOUP_DEBUG_FLAGS) dnl *************************** dnl *** Checks for programs *** dnl *************************** AC_PROG_CC AM_PROG_CC_STDC AC_PROG_INSTALL # Set STDC_HEADERS AC_HEADER_STDC # Initialize libtool AM_PROG_LIBTOOL # This isn't a program, but it doesn't fit anywhere else... AC_FUNC_ALLOCA dnl *************************** dnl *** Checks for glib 1.2 *** dnl *************************** AM_PATH_GLIB(1.2.0,, AC_MSG_ERROR([Cannot find GLIB: Is glib-config in path?])) GLIB_CFLAGS=`glib-config --cflags glib` GLIB_LIBS=`glib-config --libs glib` GMODULE_LIBS=`glib-config --libs gmodule` AC_SUBST(GLIB_CFLAGS) AC_SUBST(GLIB_LIBS) AC_SUBST(GMODULE_LIBS) dnl **************************** dnl *** Checks for gnome-xml *** dnl **************************** FAVOUR_LIBXML=1 AC_ARG_WITH(libxml, [ --with-libxml=[1/2] which version of libxml to use [default=$FAVOUR_LIBXML]],, with_libxml=$FAVOUR_LIBXML) if test "x$with_libxml" = "x" -o "$with_libxml" = "yes"; then with_libxml=$FAVOUR_LIBXML fi if test "$with_libxml" = "1"; then AC_PATH_PROG(XML_CONFIG,xml-config,no) if test x$XML_CONFIG = xno; then AC_MSG_ERROR([Cannot find LIBXML: Is xml-config in path?]) fi XML_MIN_VERSION=1.8.8 else if test "$with_libxml" = "2"; then AC_PATH_PROG(XML_CONFIG,xml2-config,no) if test x$XML_CONFIG = xno; then AC_MSG_ERROR([Cannot find LIBXML2: Is xml2-config in path?]) fi XML_MIN_VERSION=2.3.10 else AC_MSG_ERROR(Can't use libxml version $with_libxml) fi fi dnl Check version XML_VERSION=`$XML_CONFIG --version` ver=`echo $XML_VERSION | awk -F. '{printf("%d", ($1*1000+$2)*1000+$3);}'` minver=`echo $XML_MIN_VERSION | awk -F. '{printf("%d", ($1*1000+$2)*1000+$3);}'` if test "$minver" -gt "$ver" then AC_MSG_ERROR(Found libxml version $XML_VERSION. You need $XML_MIN_VERSION or newer) fi XML_CFLAGS=`$XML_CONFIG --cflags` XML_LIBS=`$XML_CONFIG --libs` AC_SUBST(XML_CFLAGS) AC_SUBST(XML_LIBS) dnl *********************** dnl *** Checks for popt *** dnl *********************** AC_ARG_WITH(popt-includes, [ --with-popt-includes Specify location of popt headers], [popt_inc_prefix=-I$withval]) AC_ARG_WITH(popt-libs, [ --with-popt-libs Specify location of popt libs], [popt_prefix=$withval], [popt_prefix=/usr/lib]) save_CPPFLAGS=$CPPFLAGS save_LIBS=$LIBS CPPFLAGS="$CPPFLAGS $popt_inc_prefix" LIBS="$LIBS -L$prefix" AC_CHECK_LIB(popt, poptGetContext, [POPT_LIBS="$LIBS -lpopt"] , AC_MSG_ERROR([popt is required])) AC_CHECK_HEADERS(popt.h, [POPT_CFLAGS="$CFLAGS"], AC_MSG_ERROR([popt.h is required])) CPPFLAGS=$save_CPPFLAGS LIBS=$save_LIBS AC_SUBST(POPT_CFLAGS) AC_SUBST(POPT_LIBS) dnl ********************************************** dnl *** Variable substitution for soup*Conf.sh *** dnl ********************************************** ### soupConf.sh SOUP_LIBDIR='-L${libdir}' SOUP_INCLUDEDIR=" -I${includedir}/soup $GLIB_CFLAGS $XML_CFLAGS" SOUP_LIBS="-lsoup $GLIB_LIBS $XML_LIBS" AC_SUBST(SOUP_LIBDIR) AC_SUBST(SOUP_INCLUDEDIR) AC_SUBST(SOUP_LIBS) ### soup-apacheConf.sh SOUP_APACHE_LIBDIR='-L${libdir}' SOUP_APACHE_INCLUDEDIR="$SOUP_INCLUDEDIR $APACHE_CFLAGS" SOUP_APACHE_LIBS="$SOUP_LIBS -lsoup-apache $APACHE_LIBS" AC_SUBST(SOUP_APACHE_LIBDIR) AC_SUBST(SOUP_APACHE_INCLUDEDIR) AC_SUBST(SOUP_APACHE_LIBS) ### soup-wsdlConf.sh SOUP_WSDL_LIBDIR='-L${libdir}' SOUP_WSDL_INCLUDEDIR=" -I${includedir}/soup $GLIB_CFLAGS $XML_CFLAGS" SOUP_WSDL_LIBS="$SOUP_LIBS -lwsdl" AC_SUBST(SOUP_WSDL_LIBDIR) AC_SUBST(SOUP_WSDL_INCLUDEDIR) AC_SUBST(SOUP_WSDL_LIBS) dnl ********************************* dnl *** Networking library checks *** dnl ********************************* AC_CHECK_HEADERS(unistd.h) AC_CHECK_HEADERS(netinet/in.h netinet/tcp.h) AC_CHECK_HEADERS(sys/socket.h sys/sockio.h sys/poll.h sys/param.h sys/wait.h) AC_CHECK_HEADERS(sys/ioctl.h sys/filio.h) AC_CHECK_FUNC(socket, , AC_CHECK_LIB(socket, socket)) AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(nsl, gethostbyname)) AC_CHECK_FUNCS(inet_pton inet_aton) ### Check if we have gethostbyname_r (if so, assume gethostbyaddr_r). AC_CHECK_FUNC(gethostbyname_r, [ dnl First check for the glibc variant of gethostbyname_r AC_MSG_CHECKING(for glibc gethostbyname_r) AC_TRY_LINK([ #include ],[ struct hostent result_buf; char buf[1024]; struct hostent* result; int h_errnop; gethostbyname_r("localhost", &result_buf, buf, sizeof(buf), &result, &h_errnop); ], [ dnl Have glibc gethostbyname_r AC_MSG_RESULT(yes) AC_DEFINE(HAVE_GETHOSTBYNAME_R_GLIBC) HAVE_GETHOSTBYNAME_R=yes ], [ dnl If we don't have glibc gethostbyname_r, check dnl for Solaris/Irix gethostbyname_r AC_MSG_RESULT(no) AC_MSG_CHECKING(for Solaris/Irix gethostbyname_r) AC_TRY_LINK([ #include ],[ struct hostent result; char buf[1024]; int h_errnop; gethostbyname_r("localhost", &result, buf, sizeof(buf), &h_errnop); ], [ dnl Have Solaris/Irix gethostbyname_r AC_MSG_RESULT(yes) AC_DEFINE(HAVE_GETHOSTBYNAME_R_SOLARIS) HAVE_GETHOSTBYNAME_R=yes ], [ dnl If don't have Solaris/Irix gethostbyname_r, check dnl for HP-UX gethostbyname_r AC_MSG_RESULT(no) AC_MSG_CHECKING(for HP-UX gethostbyname_r) AC_TRY_LINK([ #include ],[ struct hostent result; char buf[1024]; gethostbyname_r("localhost", &result, buf); ], [ dnl Have HP-UX gethostbyname_r AC_MSG_RESULT(yes) AC_DEFINE(HAVE_GETHOSTBYNAME_R_HPUX) HAVE_GETHOSTBYNAME_R=yes ] )] )] )]) ### If we don't have gethostbyname_r, try to use Glib mutexes if test -z "$HAVE_GETHOSTBYNAME_R"; then AM_PATH_GLIB(1.2.0, AC_DEFINE(HAVE_GETHOSTBYNAME_R_GLIB_MUTEX), [ AC_MSG_WARN(You have neither Glib threads nor the function gethostbyname_r. This means that calls to gethostbyname (called by the Soup address functions) will not be thread safe so could malfunction in programs that use threads.) ]) fi dnl **************************************************** dnl *** SSL Library checks (Mozilla NSS, or OpenSSL) *** dnl **************************************************** AC_ARG_ENABLE(ssl, [ --enable-ssl Turn on Secure Sockets Layer support [default=yes]],, enable_ssl=yes) AC_ARG_WITH(nspr-includes, [ --with-nspr-includes Specify location of Netscape Portable Runtime headers], [nspr_inc_prefix=-I$withval]) AC_ARG_WITH(nspr-libs, [ --with-nspr-libs Specify location of Netscape Portable Runtime libs], [nspr_prefix=$withval], [nspr_prefix=/usr/lib]) AC_ARG_WITH(nss-includes, [ --with-nss-includes Specify location of NSS header files], [nss_inc_prefix=-I$withval]) AC_ARG_WITH(nss-libs, [ --with-nss-libs Specify location of NSS libs], [nss_prefix=$withval], [nss_prefix=/usr/lib]) AC_ARG_WITH(openssl-includes, [ --with-openssl-includes Specify location of OpenSSL header files], [openssl_inc_prefix=-I$withval]) AC_ARG_WITH(openssl-libs, [ --with-openssl-libs Specify location of OpenSSL libs], [openssl_prefix=$withval], [openssl_prefix=/usr/lib]) ### ### Allow for a custom SSL proxy name ### AC_ARG_WITH(ssl-proxy-name, [ --with-ssl-proxy-name Custom name for ssl proxy executable [default=soup-ssl-proxy]], [SSL_PROXY_NAME=$withval], [SSL_PROXY_NAME=soup-ssl-proxy]) AC_DEFINE_UNQUOTED(SSL_PROXY_NAME, "${SSL_PROXY_NAME}") AC_SUBST(SSL_PROXY_NAME) ### ### Try to link statically with the SSL library ### AC_ARG_ENABLE(ssl-link-static, [ --enable-static-ssl Link with SSL library statically [default=no]], [enable_static_ssl=yes]) if test "x$enable_ssl" = xyes; then ### ### Check for OpenSSL ### save_CPPFLAGS=$CPPFLAGS CPPFLAGS="$CPPFLAGS $openssl_inc_prefix" AC_CHECK_LIB(dl, dlopen, DL_LDFLAGS="-ldl", DL_LDFLAGS="") AC_CHECK_HEADERS(openssl/ssl.h openssl/err.h, [enable_openssl="yes"], [enable_openssl="no"; break]) if test "x$enable_openssl" = xyes; then if test "x$enable_static_ssl" = "xyes"; then OPENSSL_LIBS="$openssl_prefix/libssl.a $openssl_prefix/libcrypto.a" else OPENSSL_LIBS="-L$openssl_prefix -lssl -lcrypto $DL_LDFLAGS" fi OPENSSL_CFLAGS=$CPPFLAGS AC_DEFINE(HAVE_OPENSSL) else OPENSSL_LIBS= OPENSSL_CFLAGS= fi AC_SUBST(OPENSSL_CFLAGS) AC_SUBST(OPENSSL_LIBS) CPPFLAGS=$save_CPPFLAGS ### ### Check for Mozilla NSS ### save_CPPFLAGS=$CPPFLAGS CPPFLAGS="$CPPFLAGS $nspr_inc_prefix $nss_inc_prefix" AC_CHECK_HEADERS(nss.h ssl.h pk11func.h, [enable_nss="yes"], [enable_nss="no"; break]) if test "x$enable_nss" = xyes; then if test "x$enable_static_ssl" = "xyes"; then NSS_LIBS="-lpthread $nspr_prefix/libnspr4.a $nspr_prefix/libplc4.a $nspr_prefix/libplds4.a $nss_prefix/libnssb.a" else NSS_LIBS="-lpthread -L$nspr_prefix -lnspr4 -lplc4 -lplds4 $nss_prefix -lnss3 -lssl3" fi NSS_CFLAGS=$CPPFLAGS AC_DEFINE(HAVE_NSS) else NSS_LIBS= NSS_CFLAGS= fi AC_SUBST(NSS_CFLAGS) AC_SUBST(NSS_LIBS) CPPFLAGS=$save_CPPFLAGS fi dnl ************************* dnl *** Checks for Apache *** dnl ************************* enable_apache="no" AC_PATH_PROG(APXS,apxs,no) if test x$APXS != xno; then APACHE_CFLAGS="-I`apxs -q INCLUDEDIR CFLAGS`" APACHE_LIBS=`apxs -q LDFLAGS_SHLIB LIBS_SHLIB` save_CPPFLAGS=$CPPFLAGS CPPFLAGS=$APACHE_CFLAGS AC_CHECK_HEADERS(httpd.h http_config.h http_core.h http_log.h http_main.h http_protocol.h, [enable_apache="yes"], [enable_apache="no" break]) CPPFLAGS=$save_CPPFLAGS AC_SUBST(APACHE_CFLAGS) AC_SUBST(APACHE_LIBS) fi dnl ********************************************* dnl *** Checks for gtk-doc (lifted from glib) *** dnl ********************************************* AC_ARG_WITH(html-dir, [ --with-html-dir=PATH Path to installed docs ]) if test "x$with_html_dir" = "x" ; then HTML_DIR='${datadir}/gtk-doc/html' else HTML_DIR=$with_html_dir fi AC_SUBST(HTML_DIR) AC_CHECK_PROG(GTKDOC, gtkdoc-mkdb, true, false) AM_CONDITIONAL(HAVE_GTK_DOC, $GTKDOC) AC_SUBST(HAVE_GTK_DOC) AC_CHECK_PROG(DB2HTML, db2html, true, false) AM_CONDITIONAL(HAVE_DOCBOOK, $DB2HTML) dnl Let people disable the gtk-doc stuff. AC_ARG_ENABLE(gtk-doc, [ --enable-gtk-doc Use gtk-doc to build documentation [default=auto]], enable_gtk_doc="$enableval", enable_gtk_doc=auto) if test x$enable_gtk_doc = xauto ; then if test x$GTKDOC = xtrue ; then enable_gtk_doc=yes else enable_gtk_doc=no fi fi dnl NOTE: We need to use a separate automake conditional for this dnl to make this work with the tarballs. AM_CONDITIONAL(ENABLE_GTK_DOC, test x$enable_gtk_doc = xyes) dnl ******************************************************* dnl *** Type alignment test (based on the one in ORBit) *** dnl ******************************************************* AC_DEFUN(AC_CHECK_ALIGNOF, [changequote(<<, >>)dnl dnl The name to #define. define(<>, translit(alignof_$1, [a-z *], [A-Z_P]))dnl dnl The cache variable name. define(<>, translit(ac_cv_alignof_$1, [ *], [_p]))dnl changequote([, ])dnl AC_MSG_CHECKING(alignment of $1) align_save_libs="$LIBS" LIBS="$GLIB_LIBS $LIBS" AC_CACHE_VAL(AC_CV_NAME, [AC_TRY_RUN([ #include #include typedef struct {char s1;} gstruct; struct test {char s1; $1 s2;}; main() { FILE *f=fopen("conftestval", "w"); if (!f) exit(1); fprintf(f, "%d\n", &(((struct test*)0)->s2)); exit(0); }], AC_CV_NAME=`cat conftestval`, AC_CV_NAME=0, AC_CV_NAME=0)])dnl AC_MSG_RESULT($AC_CV_NAME) LIBS="$align_save_libs" AC_DEFINE_UNQUOTED(AC_TYPE_NAME, $AC_CV_NAME) undefine([AC_TYPE_NAME])dnl undefine([AC_CV_NAME])dnl ]) orig_CPPFLAGS=$CPPFLAGS CPPFLAGS=$GLIB_CFLAGS AC_CHECK_ALIGNOF(gboolean) AC_CHECK_ALIGNOF(gchar) AC_CHECK_ALIGNOF(guchar) AC_CHECK_ALIGNOF(gint) AC_CHECK_ALIGNOF(guint) AC_CHECK_ALIGNOF(gshort) AC_CHECK_ALIGNOF(gushort) AC_CHECK_ALIGNOF(glong) AC_CHECK_ALIGNOF(gulong) AC_CHECK_ALIGNOF(gint8) AC_CHECK_ALIGNOF(guint8) AC_CHECK_ALIGNOF(gint16) AC_CHECK_ALIGNOF(guint16) AC_CHECK_ALIGNOF(gint32) AC_CHECK_ALIGNOF(guint32) AC_CHECK_ALIGNOF(gfloat) AC_CHECK_ALIGNOF(gdouble) AC_CHECK_ALIGNOF(gpointer) AC_CHECK_ALIGNOF(gstruct) CPPFLAGS=$orig_CPPFLAGS dnl ************************************* dnl *** Warnings to show if using GCC *** dnl ************************************* AC_ARG_ENABLE(more-warnings, [ --disable-more-warnings Inhibit compiler warnings], set_more_warnings=no) if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then CFLAGS="$CFLAGS \ -Wall -Wstrict-prototypes -Wmissing-declarations \ -Wmissing-prototypes -Wnested-externs -Wpointer-arith" fi # Use reentrant functions CFLAGS="$CFLAGS -D_REENTRANT" dnl ************************* dnl *** Output Everything *** dnl ************************* AC_OUTPUT([ soup-config soup.pc soup.spec Makefile docs/Makefile docs/reference/Makefile src/Makefile src/libsoup/Makefile src/libsoup-apache/Makefile src/libwsdl/Makefile src/soup-httpd/Makefile src/soup-ssl-proxy/Makefile src/soup-wsdl/Makefile tests/Makefile ]) echo " Configuration: Source code location: ${srcdir} Compiler: ${CC} Build flags: ${CFLAGS} ${SOUP_DEBUG_FLAGS} OpenSSL support: ${enable_openssl} Mozilla NSS support: ${enable_nss} Apache module support: ${enable_apache} "