1 dnl *******************************************
2 dnl *** Initialize automake and set version ***
3 dnl *******************************************
6 AC_INIT([libsoup],[2.33.6],[http://bugzilla.gnome.org/enter_bug.cgi?product=libsoup])
7 AC_CONFIG_SRCDIR([libsoup-2.4.pc.in])
8 AC_CONFIG_MACRO_DIR([m4])
10 AM_INIT_AUTOMAKE([foreign 1.9])
11 m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])],)
16 AC_SUBST(SOUP_API_VERSION)
18 # Increment on interface addition. Reset on removal.
21 # Increment on interface add, remove, or change.
24 # Increment on source change. Reset when CURRENT changes.
27 AC_SUBST(SOUP_CURRENT)
28 AC_SUBST(SOUP_REVISION)
31 dnl ***************************
32 dnl *** Set debugging flags ***
33 dnl ***************************
37 # Declare --enable-* args and collect ac_help strings
39 AS_HELP_STRING([--enable-debug=[no/minimum/yes]],
40 [turn on debugging (default=$debug_default)]),,
41 enable_debug=$debug_default)
44 if test "x$enable_debug" = "xyes"; then
45 test "$cflags_set" = set || CFLAGS="$CFLAGS -g"
46 SOUP_DEBUG_FLAGS="-DG_ENABLE_DEBUG"
48 if test "x$enable_debug" = "xno"; then
49 SOUP_DEBUG_FLAGS="-DG_DISABLE_ASSERT -DG_DISABLE_CHECKS"
53 AC_SUBST(SOUP_DEBUG_FLAGS)
55 # Set the maintainer flags
57 SOUP_MAINTAINER_FLAGS="-DG_DISABLE_DEPRECATED"
59 AC_SUBST(SOUP_MAINTAINER_FLAGS)
61 dnl ***************************
62 dnl *** Checks for programs ***
63 dnl ***************************
71 dnl ***********************
72 dnl *** Checks for glib ***
73 dnl ***********************
75 AM_PATH_GLIB_2_0(2.27.5,,,gobject gthread gio)
76 if test "$GLIB_LIBS" = ""; then
77 AC_MSG_ERROR(GLIB 2.27.5 or later is required to build libsoup)
79 GLIB_CFLAGS="$GLIB_CFLAGS -DG_DISABLE_SINGLE_INCLUDES"
81 PKG_CHECK_MODULES(XML, libxml-2.0)
85 dnl ***********************
86 dnl *** Check for Win32 ***
87 dnl ***********************
89 AC_MSG_CHECKING([for Win32])
93 CFLAGS="$CFLAGS -D_REENTRANT"
99 AC_MSG_RESULT([$os_win32])
100 AM_CONDITIONAL(OS_WIN32, [test $os_win32 = yes])
102 dnl *******************
103 dnl *** Misc checks ***
104 dnl *******************
105 AC_CHECK_FUNCS(gmtime_r)
107 AC_CHECK_FUNC(socket, , AC_CHECK_LIB(socket, socket))
109 dnl *********************
110 dnl *** GNOME support ***
111 dnl *********************
112 AC_MSG_CHECKING(whether to build libsoup-gnome)
114 AS_HELP_STRING([--without-gnome], [Do not build libsoup-gnome]),
115 :, [if test $os_win32 = yes; then with_gnome=no; else with_gnome=yes; fi])
116 AC_MSG_RESULT($with_gnome)
118 if test $with_gnome != no; then
119 PKG_CHECK_MODULES(GNOME_KEYRING, gnome-keyring-1, :,
121 [Could not find gnome-keyring devel files.
122 Configure with --without-gnome if you wish to build only libsoup
123 without GNOME-specific features.]))
125 AC_SUBST(GNOME_KEYRING_CFLAGS)
126 AC_SUBST(GNOME_KEYRING_LIBS)
128 AM_CONDITIONAL(BUILD_LIBSOUP_GNOME, test $with_gnome != no)
130 if test $with_gnome != no; then
131 AC_DEFINE(HAVE_GNOME, 1, [Defined if GNOME support is enabled])
133 PKG_CHECK_MODULES(LIBPROXY, libproxy-1.0, :, [AC_MSG_ERROR(dnl
134 [Could not find libproxy:
138 This is required for GNOME proxy support.
140 Pass "--without-gnome" to configure if you want to build libsoup
141 without GNOME support.])])
143 AC_MSG_CHECKING(libproxy version)
144 libproxy_version=`$PKG_CONFIG --modversion libproxy-1.0`
145 case $libproxy_version in
147 AC_MSG_RESULT([$libproxy_version, using workarounds...])
148 AC_DEFINE(HAVE_LIBPROXY_WITH_NON_THREAD_SAFE_GNOME_MODULE, 1, [Defined if libproxy is old and has a non-thread-safe gnome module])
151 AC_MSG_RESULT([$libproxy_version, ok])
155 PKG_CHECK_MODULES(GCONF, gconf-2.0, , [AC_MSG_ERROR(dnl
156 [Could not find GConf:
160 This is required for GNOME proxy support.
162 Pass "--without-gnome" to configure if you want to build libsoup
163 without GNOME support.])])
165 PKG_CHECK_MODULES(SQLITE, sqlite3, :, [AC_MSG_ERROR(dnl
166 [Could not find sqlite3 devel files:
170 Pass "--without-gnome" to configure if you want to build libsoup
171 without GNOME support.])])
174 AC_SUBST(GCONF_CFLAGS)
176 AC_SUBST(LIBPROXY_CFLAGS)
177 AC_SUBST(LIBPROXY_LIBS)
178 AC_SUBST(SQLITE_CFLAGS)
179 AC_SUBST(SQLITE_LIBS)
185 GTK_DOC_CHECK([1.10])
187 dnl *****************************
188 dnl *** gobject-introspection ***
189 dnl *****************************
190 GOBJECT_INTROSPECTION_CHECK([0.9.5])
192 dnl *************************************
193 dnl *** Warnings to show if using GCC ***
194 dnl *************************************
196 AC_ARG_ENABLE(more-warnings,
197 AS_HELP_STRING([--disable-more-warnings], [Inhibit compiler warnings]),
198 set_more_warnings=no)
200 if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then
202 -Wall -Wstrict-prototypes -Wmissing-declarations \
203 -Wmissing-prototypes -Wnested-externs -Wpointer-arith \
204 -Wdeclaration-after-statement -Wformat=2 -Winit-self \
205 -Waggregate-return -Wmissing-format-attribute"
207 for option in -Wmissing-include-dirs -Wundef; do
208 SAVE_CFLAGS="$CFLAGS"
209 CFLAGS="$CFLAGS $option"
210 AC_MSG_CHECKING([whether gcc understands $option])
211 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [])],
214 AC_MSG_RESULT($has_option)
215 if test $has_option = no; then
216 CFLAGS="$SAVE_CFLAGS"
221 AC_MSG_CHECKING([for glib-networking (glib TLS implementation)])
222 save_CFLAGS="$CFLAGS"
224 CFLAGS="$CFLAGS $GLIB_CFLAGS"
225 LIBS="$LIBS $GLIB_LIBS"
226 AC_RUN_IFELSE([AC_LANG_PROGRAM([#include <gio/gio.h>],
227 [g_type_init (); return !g_tls_backend_supports_tls (g_tls_backend_get_default ());])],
228 [have_glib_networking=yes],
229 [have_glib_networking=no],
230 [have_glib_networking="unknown (cross-compiling)"])
231 CFLAGS="$save_CFLAGS"
233 AC_MSG_RESULT($have_glib_networking)
235 AC_ARG_ENABLE(tls-check,
236 AS_HELP_STRING([--disable-tls-check], [Don't error out if glib-networking is unavailable]))
237 if test "$enable_tls_check" != "no" -a "$have_glib_networking" = "no"; then
238 AC_MSG_ERROR([libsoup requires glib-networking for TLS support.
240 If you are building a package, you can pass --disable-tls-check to
241 allow building libsoup anyway (since glib-networking is not actually
242 required at compile time), but you should be sure to add a runtime
246 dnl ******************************
247 dnl *** Stuff for regression tests
248 dnl ******************************
249 AC_MSG_NOTICE([checking for programs needed for regression tests])
250 MISSING_REGRESSION_TEST_PACKAGES=""
252 if test "$have_glib_networking" = "no"; then
253 MISSING_REGRESSION_TEST_PACKAGES="$MISSING_REGRESSION_TEST_PACKAGES glib-networking"
256 AC_ARG_WITH(apache-httpd,
257 AS_HELP_STRING([--with-apache-httpd], [Path to apache httpd (for tests)]),
258 APACHE_HTTPD="$withval",
259 [AC_PATH_PROGS(APACHE_HTTPD, httpd2 httpd apache2 apache, no, ${PATH}:/usr/sbin)])
260 if test "$APACHE_HTTPD" != "no"; then
261 AC_MSG_CHECKING([Apache version])
262 apache_version=`$APACHE_HTTPD -v 2>/dev/null | sed -ne 's/Server version: Apache\///p'`
263 case $apache_version in
265 AC_MSG_RESULT([$apache_version (ok)])
268 AC_MSG_RESULT([$apache_version (ignoring)])
273 AC_SUBST(APACHE_HTTPD)
274 AC_DEFINE_UNQUOTED(APACHE_HTTPD, "$APACHE_HTTPD", [Apache httpd])
276 if test "$APACHE_HTTPD" != "no"; then
277 AC_MSG_CHECKING([for Apache module directory])
278 AC_ARG_WITH(apache-module-dir,
279 AS_HELP_STRING([--with-apache-module-dir], [Apache modules dirs (for tests)]),
280 apache_module_dirs="$withval",
281 [apache_prefix=`dirname \`dirname $APACHE_HTTPD\``
282 mpm=`$APACHE_HTTPD -V | sed -ne 's/^Server MPM: */-/p' | tr 'A-Z' 'a-z'`
283 # This only works with bash, but should fail harmlessly in sh
284 apache_module_dirs=`echo $apache_prefix/lib{64,}/{apache,apache2,http,http2,httpd}{$mpm,}{/modules,}`])
285 for dir in $apache_module_dirs; do
286 if test -f $dir/mod_auth_digest.so; then
287 APACHE_MODULE_DIR="$dir"
289 if test -f $dir/mod_ssl.so; then
290 APACHE_SSL_MODULE_DIR="$dir"
291 IF_HAVE_APACHE_SSL=""
293 if test -f $dir/mod_php5.so; then
294 APACHE_PHP_MODULE_DIR="$dir"
295 APACHE_PHP_MODULE=mod_php5.so
297 if test -f $dir/libphp5.so; then
298 APACHE_PHP_MODULE_DIR="$dir"
299 APACHE_PHP_MODULE=libphp5.so
302 AC_MSG_RESULT($APACHE_MODULE_DIR)
303 AC_SUBST(APACHE_MODULE_DIR)
304 AC_SUBST(APACHE_SSL_MODULE_DIR)
305 AC_SUBST(APACHE_PHP_MODULE_DIR)
306 AC_SUBST(APACHE_PHP_MODULE)
309 if test "$APACHE_HTTPD" != "no" -a -n "$APACHE_MODULE_DIR" -a -n "$APACHE_SSL_MODULE_DIR"; then
310 AC_DEFINE(HAVE_APACHE, 1, [Whether or not apache can be used for tests])
312 if test -z "$APACHE_PHP_MODULE_DIR"; then
313 MISSING_REGRESSION_TEST_PACKAGES="$MISSING_REGRESSION_TEST_PACKAGES mod_php5"
317 if test "$APACHE_HTTPD" = "no" -o -z "$APACHE_MODULE_DIR"; then
318 MISSING_REGRESSION_TEST_PACKAGES="$MISSING_REGRESSION_TEST_PACKAGES apache"
320 MISSING_REGRESSION_TEST_PACKAGES="$MISSING_REGRESSION_TEST_PACKAGES mod_ssl"
323 AM_CONDITIONAL(HAVE_APACHE, test $have_apache = 1)
325 if test "$have_apache" = 1; then
326 AC_CHECK_PROGS(PHP, php php5)
328 AC_MSG_CHECKING([for Apache PHP module])
329 if test -f $APACHE_PHP_MODULE_DIR/$APACHE_PHP_MODULE; then
335 MISSING_REGRESSION_TEST_PACKAGES="$MISSING_REGRESSION_TEST_PACKAGES php5"
337 AC_MSG_RESULT($have_php)
339 if test "$have_php" = yes; then
340 AC_MSG_CHECKING([for xmlrpc-epi-php])
341 if $PHP --rf xmlrpc_server_create | grep -q "does not exist"; then
342 have_xmlrpc_epi_php=no
343 MISSING_REGRESSION_TEST_PACKAGES="$MISSING_REGRESSION_TEST_PACKAGES php-xmlrpc"
345 have_xmlrpc_epi_php=yes
347 AC_MSG_RESULT($have_xmlrpc_epi_php)
351 AC_SUBST(IF_HAVE_PHP)
352 AM_CONDITIONAL(HAVE_XMLRPC_EPI_PHP, test "$have_xmlrpc_epi_php" = yes)
354 AC_PATH_PROG(CURL, curl, no)
355 if test "$CURL" != no; then
356 AC_DEFINE(HAVE_CURL, 1, [Whether or not curl can be used for tests])
358 MISSING_REGRESSION_TEST_PACKAGES="$MISSING_REGRESSION_TEST_PACKAGES curl"
360 AM_CONDITIONAL(HAVE_CURL, test "$CURL" != no)
362 AC_SUBST(MISSING_REGRESSION_TEST_PACKAGES)
363 AM_CONDITIONAL(MISSING_REGRESSION_TEST_PACKAGES, test -n "$MISSING_REGRESSION_TEST_PACKAGES")
365 dnl *************************
366 dnl *** Output Everything ***
367 dnl *************************
369 AC_CONFIG_HEADERS([config.h])
379 docs/reference/Makefile
383 if test -n "$MISSING_REGRESSION_TEST_PACKAGES"; then
385 echo Some regression tests will not be run due to missing packages:
386 echo $MISSING_REGRESSION_TEST_PACKAGES