dnl ******************************************* dnl *** Initialize automake and set version *** dnl ******************************************* AC_PREREQ(2.53) AC_INIT(libsoup, 2.1.0) AC_CONFIG_SRCDIR(libsoup-2.2.pc.in) AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION) AM_CONFIG_HEADER(config.h) AM_MAINTAINER_MODE AC_PROG_MAKE_SET SOUP_API_VERSION=2.2 AC_SUBST(SOUP_API_VERSION) # Increment on interface addition. Reset on removal. SOUP_AGE=0 # Increment on interface add, remove, or change. SOUP_CURRENT=0 # Increment on source change. Reset when CURRENT changes. SOUP_REVISION=0 AC_SUBST(SOUP_CURRENT) AC_SUBST(SOUP_REVISION) AC_SUBST(SOUP_AGE) 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 *** dnl *********************** AM_PATH_GLIB_2_0(2.0.0,,,gobject) dnl ********************************* dnl *** Networking library checks *** dnl ********************************* AC_CHECK_HEADERS(sys/sockio.h sys/poll.h sys/param.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, 1, [Define if you have a glibc-style gethostbyname_r()]) 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, 1, [Define if you have a Solaris-style gethostbyname_r()]) 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, 1, [Define if you have an HP-UX-style gethostbyname_r()]) HAVE_GETHOSTBYNAME_R=yes ] )] )] )]) # If we don't have gethostbyname_r, we'll use Glib mutexes, but give a warning if test -z "$HAVE_GETHOSTBYNAME_R"; then AC_DEFINE(HAVE_GETHOSTBYNAME_R_GLIB_MUTEX, 1, [Define if you have no gethostbyname_r()]) 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 AC_CACHE_CHECK(IPv6 support, soup_cv_ipv6, [ AC_EGREP_HEADER(sockaddr_in6, netinet/in.h, soup_cv_ipv6=yes, soup_cv_ipv6=no) ]) case $soup_cv_ipv6 in yes) AC_DEFINE(HAVE_IPV6, 1, [Define if you have support for IPv6 sockets]) ;; esac dnl ********************************** dnl *** SSL Library check (GnuTLS) *** dnl ********************************** AC_ARG_ENABLE(ssl, [ --enable-ssl Turn on Secure Sockets Layer support [default=yes]],, enable_ssl=yes) AC_ARG_ENABLE(ssl-link-static, [ --enable-static-ssl Link with SSL library statically [default=no]], [enable_static_ssl=yes]) case $enable_ssl in yes) AC_PATH_PROG(LIBGNUTLS_CONFIG, libgnutls-config, no) case $LIBGNUTLS_CONFIG in no) AC_MSG_WARN(Disabling SSL support) enable_ssl=no break 2 ;; esac GNUTLS_CFLAGS=`$LIBGNUTLS_CONFIG --cflags | sed -e 's:-I/usr/include::'` GNUTLS_LIBS=`$LIBGNUTLS_CONFIG --libs | sed -e 's:-L/usr/lib *::'` save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $GNUTLS_CFLAGS" AC_CHECK_HEADERS(gnutls/gnutls.h,, [AC_MSG_WARN(Disabling SSL support) enable_ssl=no break]) CPPFLAGS="$save_CPPFLAGS" case $enable_static_ssl in yes) gnutls_libdir=`$LIBGNUTLS_CONFIG --exec-prefix`/lib GNUTLS_LIBS="$gnutls_libdir/libgnutls.a $gnutls_libdir/libgcrypt.a" ;; esac AC_DEFINE(HAVE_SSL, 1, [Defined if you have SSL support]) ;; esac AC_SUBST(GNUTLS_CFLAGS) AC_SUBST(GNUTLS_LIBS) 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 *** 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 (FIXME!) CFLAGS="$CFLAGS -D_REENTRANT" dnl ************************* dnl *** Output Everything *** dnl ************************* AC_OUTPUT([ libsoup-2.2.pc Makefile libsoup/Makefile tests/Makefile ]) echo " Configuration: Source code location: ${srcdir} Compiler: ${CC} Build flags: ${CFLAGS} ${SOUP_DEBUG_FLAGS} SSL support: ${enable_ssl} "