1 dnl *******************************************
2 dnl *** Initialize automake and set version ***
3 dnl *******************************************
6 AC_INIT([libsoup],[2.31.2],[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.21.3,,,gobject gthread gio)
76 if test "$GLIB_LIBS" = ""; then
77 AC_MSG_ERROR(GLIB 2.21.3 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 *** SSL Library check (GnuTLS) ***
111 dnl **********************************
114 AS_HELP_STRING([--disable-ssl], [Disable SSL/TLS support (not recommended)]),,
118 if test "$enable_ssl" != "no"; then
119 PKG_CHECK_MODULES(LIBGNUTLS, gnutls >= 2.1.7,
120 [AM_PATH_LIBGCRYPT([], have_ssl=yes, have_ssl=no)], have_ssl=no)
122 if test "$have_ssl" = "yes"; then
123 AC_DEFINE(HAVE_SSL, 1, [Defined if you have SSL support])
124 SSL_REQUIREMENT="gnutls"
126 if test "$enable_ssl" = "no"; then
127 AC_MSG_WARN(Disabling SSL support);
129 AC_MSG_ERROR([Could not configure SSL support.
130 Pass "--disable-ssl" if you really want to build without SSL support]);
134 AC_SUBST(LIBGNUTLS_CFLAGS)
135 AC_SUBST(LIBGNUTLS_LIBS)
136 AC_SUBST(SSL_REQUIREMENT)
138 dnl This is not supposed to be conditional, but...
139 AM_CONDITIONAL(HAVE_SSL, test $enable_ssl != no)
142 dnl *********************
143 dnl *** GNOME support ***
144 dnl *********************
145 AC_MSG_CHECKING(whether to build libsoup-gnome)
147 AS_HELP_STRING([--without-gnome], [Do not build libsoup-gnome]),
148 :, [if test $os_win32 = yes; then with_gnome=no; else with_gnome=yes; fi])
149 AC_MSG_RESULT($with_gnome)
151 if test $with_gnome != no; then
152 PKG_CHECK_MODULES(GNOME_KEYRING, gnome-keyring-1, :,
154 [Could not find gnome-keyring devel files.
155 Configure with --without-gnome if you wish to build only libsoup
156 without GNOME-specific features.]))
158 AC_SUBST(GNOME_KEYRING_CFLAGS)
159 AC_SUBST(GNOME_KEYRING_LIBS)
161 AM_CONDITIONAL(BUILD_LIBSOUP_GNOME, test $with_gnome != no)
163 if test $with_gnome != no; then
164 AC_DEFINE(HAVE_GNOME, 1, [Defined if GNOME support is enabled])
166 PKG_CHECK_MODULES(LIBPROXY, libproxy-1.0, :, [AC_MSG_ERROR(dnl
167 [Could not find libproxy:
171 This is required for GNOME proxy support.
173 Pass "--without-gnome" to configure if you want to build libsoup
174 without GNOME support.])])
176 AC_MSG_CHECKING(libproxy version)
177 libproxy_version=`$PKG_CONFIG --modversion libproxy-1.0`
178 case $libproxy_version in
180 AC_MSG_RESULT([$libproxy_version, using workarounds...])
181 AC_DEFINE(HAVE_LIBPROXY_WITH_NON_THREAD_SAFE_GNOME_MODULE, 1, [Defined if libproxy is old and has a non-thread-safe gnome module])
184 AC_MSG_RESULT([$libproxy_version, ok])
188 PKG_CHECK_MODULES(GCONF, gconf-2.0, , [AC_MSG_ERROR(dnl
189 [Could not find GConf:
193 This is required for GNOME proxy support.
195 Pass "--without-gnome" to configure if you want to build libsoup
196 without GNOME support.])])
198 PKG_CHECK_MODULES(SQLITE, sqlite3, :, [AC_MSG_ERROR(dnl
199 [Could not find sqlite3 devel files:
203 Pass "--without-gnome" to configure if you want to build libsoup
204 without GNOME support.])])
207 AC_SUBST(GCONF_CFLAGS)
209 AC_SUBST(LIBPROXY_CFLAGS)
210 AC_SUBST(LIBPROXY_LIBS)
211 AC_SUBST(SQLITE_CFLAGS)
212 AC_SUBST(SQLITE_LIBS)
218 GTK_DOC_CHECK([1.10])
220 dnl *****************************
221 dnl *** gobject-introspection ***
222 dnl *****************************
223 GOBJECT_INTROSPECTION_CHECK([0.6.7])
225 dnl *************************************
226 dnl *** Warnings to show if using GCC ***
227 dnl *************************************
229 AC_ARG_ENABLE(more-warnings,
230 AS_HELP_STRING([--disable-more-warnings], [Inhibit compiler warnings]),
231 set_more_warnings=no)
233 if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then
235 -Wall -Wstrict-prototypes -Wmissing-declarations \
236 -Wmissing-prototypes -Wnested-externs -Wpointer-arith \
237 -Wdeclaration-after-statement -Wformat=2 -Winit-self \
238 -Waggregate-return -Wmissing-format-attribute"
240 for option in -Wmissing-include-dirs -Wundef; do
241 SAVE_CFLAGS="$CFLAGS"
242 CFLAGS="$CFLAGS $option"
243 AC_MSG_CHECKING([whether gcc understands $option])
244 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [])],
247 AC_MSG_RESULT($has_option)
248 if test $has_option = no; then
249 CFLAGS="$SAVE_CFLAGS"
254 dnl ******************************
255 dnl *** Stuff for regression tests
256 dnl ******************************
257 AC_MSG_NOTICE([checking for programs needed for regression tests])
258 MISSING_REGRESSION_TEST_PACKAGES=""
259 if test $have_ssl = "no"; then
260 MISSING_REGRESSION_TEST_PACKAGES=" gnutls"
263 AC_ARG_WITH(apache-httpd,
264 AS_HELP_STRING([--with-apache-httpd], [Path to apache httpd (for tests)]),
265 APACHE_HTTPD="$withval",
266 [AC_PATH_PROGS(APACHE_HTTPD, httpd2 httpd apache2 apache, no, ${PATH}:/usr/sbin)])
267 if test "$APACHE_HTTPD" != "no"; then
268 AC_MSG_CHECKING([Apache version])
269 apache_version=`$APACHE_HTTPD -v 2>/dev/null | sed -ne 's/Server version: Apache\///p'`
270 case $apache_version in
272 AC_MSG_RESULT([$apache_version (ok)])
275 AC_MSG_RESULT([$apache_version (ignoring)])
280 AC_SUBST(APACHE_HTTPD)
281 AC_DEFINE_UNQUOTED(APACHE_HTTPD, "$APACHE_HTTPD", [Apache httpd])
283 if test "$APACHE_HTTPD" != "no"; then
284 AC_MSG_CHECKING([for Apache module directory])
285 AC_ARG_WITH(apache-module-dir,
286 AS_HELP_STRING([--with-apache-module-dir], [Apache modules dirs (for tests)]),
287 apache_module_dirs="$withval",
288 [apache_prefix=`dirname \`dirname $APACHE_HTTPD\``
289 mpm=`$APACHE_HTTPD -V | sed -ne 's/^Server MPM: */-/p' | tr 'A-Z' 'a-z'`
290 # This only works with bash, but should fail harmlessly in sh
291 apache_module_dirs=`echo $apache_prefix/lib{64,}/{apache,apache2,http,http2,httpd}{$mpm,}{/modules,}`])
292 for dir in $apache_module_dirs; do
293 if test -f $dir/mod_auth_digest.so; then
294 APACHE_MODULE_DIR="$dir"
296 if test -f $dir/mod_ssl.so; then
297 APACHE_SSL_MODULE_DIR="$dir"
298 IF_HAVE_APACHE_SSL=""
300 if test -f $dir/mod_php5.so; then
301 APACHE_PHP_MODULE_DIR="$dir"
302 APACHE_PHP_MODULE=mod_php5.so
304 if test -f $dir/libphp5.so; then
305 APACHE_PHP_MODULE_DIR="$dir"
306 APACHE_PHP_MODULE=libphp5.so
309 AC_MSG_RESULT($APACHE_MODULE_DIR)
310 AC_SUBST(APACHE_MODULE_DIR)
311 AC_SUBST(APACHE_SSL_MODULE_DIR)
312 AC_SUBST(APACHE_PHP_MODULE_DIR)
313 AC_SUBST(APACHE_PHP_MODULE)
316 if test "$APACHE_HTTPD" != "no" -a -n "$APACHE_MODULE_DIR" -a -n "$APACHE_SSL_MODULE_DIR"; then
317 AC_DEFINE(HAVE_APACHE, 1, [Whether or not apache can be used for tests])
319 if test -z "$APACHE_PHP_MODULE_DIR"; then
320 MISSING_REGRESSION_TEST_PACKAGES="$MISSING_REGRESSION_TEST_PACKAGES mod_php5"
324 if test "$APACHE_HTTPD" = "no" -o -z "$APACHE_MODULE_DIR"; then
325 MISSING_REGRESSION_TEST_PACKAGES="$MISSING_REGRESSION_TEST_PACKAGES apache"
327 MISSING_REGRESSION_TEST_PACKAGES="$MISSING_REGRESSION_TEST_PACKAGES mod_ssl"
330 AM_CONDITIONAL(HAVE_APACHE, test $have_apache = 1)
332 if test "$have_apache" = 1; then
333 AC_CHECK_PROGS(PHP, php php5)
335 AC_MSG_CHECKING([for Apache PHP module])
336 if test -f $APACHE_PHP_MODULE_DIR/$APACHE_PHP_MODULE; then
342 MISSING_REGRESSION_TEST_PACKAGES="$MISSING_REGRESSION_TEST_PACKAGES php5"
344 AC_MSG_RESULT($have_php)
346 if test "$have_php" = yes; then
347 AC_MSG_CHECKING([for xmlrpc-epi-php])
348 if $PHP --rf xmlrpc_server_create | grep -q "does not exist"; then
349 have_xmlrpc_epi_php=no
350 MISSING_REGRESSION_TEST_PACKAGES="$MISSING_REGRESSION_TEST_PACKAGES php-xmlrpc"
352 have_xmlrpc_epi_php=yes
354 AC_MSG_RESULT($have_xmlrpc_epi_php)
358 AC_SUBST(IF_HAVE_PHP)
359 AM_CONDITIONAL(HAVE_XMLRPC_EPI_PHP, test "$have_xmlrpc_epi_php" = yes)
361 AC_PATH_PROG(CURL, curl, no)
362 if test "$CURL" != no; then
363 AC_DEFINE(HAVE_CURL, 1, [Whether or not curl can be used for tests])
365 MISSING_REGRESSION_TEST_PACKAGES="$MISSING_REGRESSION_TEST_PACKAGES curl"
367 AM_CONDITIONAL(HAVE_CURL, test "$CURL" != no)
369 if test -n "$MISSING_REGRESSION_TEST_PACKAGES"; then
370 AC_MSG_NOTICE([Some regression tests will not be run due to missing packages:$MISSING_REGRESSION_TEST_PACKAGES])
372 AC_SUBST(MISSING_REGRESSION_TEST_PACKAGES)
373 AM_CONDITIONAL(MISSING_REGRESSION_TEST_PACKAGES, test -n "$MISSING_REGRESSION_TEST_PACKAGES")
375 dnl *************************
376 dnl *** Output Everything ***
377 dnl *************************
379 AC_CONFIG_HEADERS([config.h])
389 docs/reference/Makefile