Post-branch version bump to 2.35.0
[platform/upstream/libsoup.git] / configure.ac
1 dnl *******************************************
2 dnl *** Initialize automake and set version ***
3 dnl *******************************************
4
5 AC_PREREQ(2.63)
6 AC_INIT([libsoup],[2.35.0],[http://bugzilla.gnome.org/enter_bug.cgi?product=libsoup])
7 AC_CONFIG_SRCDIR([libsoup-2.4.pc.in])
8 AC_CONFIG_MACRO_DIR([m4])
9
10 AM_INIT_AUTOMAKE([foreign 1.9])
11 m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])],)
12
13 AC_PROG_MAKE_SET
14
15 SOUP_API_VERSION=2.4
16 AC_SUBST(SOUP_API_VERSION)
17
18 # Increment on interface addition. Reset on removal.
19 SOUP_AGE=4
20
21 # Increment on interface add, remove, or change.
22 SOUP_CURRENT=5
23
24 # Increment on source change. Reset when CURRENT changes.
25 SOUP_REVISION=0
26
27 AC_SUBST(SOUP_CURRENT)
28 AC_SUBST(SOUP_REVISION)
29 AC_SUBST(SOUP_AGE)
30
31 dnl ***************************
32 dnl *** Set debugging flags ***
33 dnl ***************************
34
35 debug_default=minimum
36
37 # Declare --enable-* args and collect ac_help strings
38 AC_ARG_ENABLE(debug, 
39               AS_HELP_STRING([--enable-debug=[no/minimum/yes]],
40                              [turn on debugging (default=$debug_default)]),,
41               enable_debug=$debug_default)
42
43 # Set the debug flags
44 if test "x$enable_debug" = "xyes"; then
45         test "$cflags_set" = set || CFLAGS="$CFLAGS -g"
46         SOUP_DEBUG_FLAGS="-DG_ENABLE_DEBUG"
47 else
48         if test "x$enable_debug" = "xno"; then
49                 SOUP_DEBUG_FLAGS="-DG_DISABLE_ASSERT -DG_DISABLE_CHECKS"
50         fi
51 fi
52
53 AC_SUBST(SOUP_DEBUG_FLAGS)
54
55 # Set the maintainer flags
56 if test -d .git; then
57         SOUP_MAINTAINER_FLAGS="-DG_DISABLE_DEPRECATED"
58 fi
59 AC_SUBST(SOUP_MAINTAINER_FLAGS)
60
61 dnl ***************************
62 dnl *** Checks for programs ***
63 dnl ***************************
64
65 AC_PROG_CC
66 AC_PROG_INSTALL
67
68 # Initialize libtool
69 LT_INIT([win32-dll])
70
71 dnl ***********************
72 dnl *** Checks for glib ***
73 dnl ***********************
74
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)
78 fi
79 GLIB_CFLAGS="$GLIB_CFLAGS -DG_DISABLE_SINGLE_INCLUDES"
80
81 PKG_CHECK_MODULES(XML, libxml-2.0)
82 AC_SUBST(XML_CFLAGS)
83 AC_SUBST(XML_LIBS)
84
85 dnl ***********************
86 dnl *** Check for Win32 ***
87 dnl ***********************
88
89 AC_MSG_CHECKING([for Win32])
90 case "$host" in
91   *-*-mingw*)
92     os_win32=yes
93     CFLAGS="$CFLAGS -D_REENTRANT"
94     ;;
95   *)
96     os_win32=no
97     ;;
98 esac
99 AC_MSG_RESULT([$os_win32])
100 AM_CONDITIONAL(OS_WIN32, [test $os_win32 = yes])
101
102 dnl *******************
103 dnl *** Misc checks ***
104 dnl *******************
105 AC_CHECK_FUNCS(gmtime_r)
106 AC_CHECK_FUNCS(mmap)
107 AC_CHECK_FUNC(socket, , AC_CHECK_LIB(socket, socket))
108
109 dnl *********************
110 dnl *** GNOME support ***
111 dnl *********************
112 AC_MSG_CHECKING(whether to build libsoup-gnome)
113 AC_ARG_WITH(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)
117
118 if test $with_gnome != no -a $os_win32 != yes; then
119         PKG_CHECK_MODULES(GNOME_KEYRING, gnome-keyring-1, :,
120                           AC_MSG_ERROR(
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.]))
124 fi
125 AC_SUBST(GNOME_KEYRING_CFLAGS)
126 AC_SUBST(GNOME_KEYRING_LIBS)
127
128 AM_CONDITIONAL(BUILD_LIBSOUP_GNOME, test $with_gnome != no)
129
130 if test $with_gnome != no; then
131         AC_DEFINE(HAVE_GNOME, 1, [Defined if GNOME support is enabled])
132
133         PKG_CHECK_MODULES(SQLITE, sqlite3, :, [AC_MSG_ERROR(dnl
134 [Could not find sqlite3 devel files:
135
136 $SQLITE_PKG_ERRORS
137
138 Pass "--without-gnome" to configure if you want to build libsoup
139 without GNOME support.])])
140 fi
141 AC_SUBST(HAVE_GNOME)
142 AC_SUBST(SQLITE_CFLAGS)
143 AC_SUBST(SQLITE_LIBS)
144
145
146 dnl ***************
147 dnl *** gtk-doc ***
148 dnl ***************
149 GTK_DOC_CHECK([1.10])
150
151 dnl *****************************
152 dnl *** gobject-introspection ***
153 dnl *****************************
154 GOBJECT_INTROSPECTION_CHECK([0.9.5])
155
156 dnl *************************************
157 dnl *** Warnings to show if using GCC ***
158 dnl *************************************
159
160 AC_ARG_ENABLE(more-warnings,
161               AS_HELP_STRING([--disable-more-warnings], [Inhibit compiler warnings]),
162               set_more_warnings=no)
163
164 if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then
165         CFLAGS="$CFLAGS \
166                 -Wall -Wstrict-prototypes -Wmissing-declarations \
167                 -Wmissing-prototypes -Wnested-externs -Wpointer-arith \
168                 -Wdeclaration-after-statement -Wformat=2 -Winit-self \
169                 -Waggregate-return -Wmissing-format-attribute"
170
171         for option in -Wmissing-include-dirs -Wundef; do
172                 SAVE_CFLAGS="$CFLAGS"
173                 CFLAGS="$CFLAGS $option"
174                 AC_MSG_CHECKING([whether gcc understands $option])
175                 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [])],
176                                   [has_option=yes],
177                                   [has_option=no])
178                 AC_MSG_RESULT($has_option)
179                 if test $has_option = no; then
180                         CFLAGS="$SAVE_CFLAGS"
181                 fi
182         done
183 fi
184
185 AC_MSG_CHECKING([for glib-networking (glib TLS implementation)])
186 save_CFLAGS="$CFLAGS"
187 save_LIBS="$LIBS"
188 CFLAGS="$CFLAGS $GLIB_CFLAGS"
189 LIBS="$LIBS $GLIB_LIBS"
190 AC_RUN_IFELSE([AC_LANG_PROGRAM([#include <gio/gio.h>],
191                                [g_type_init (); return !g_tls_backend_supports_tls (g_tls_backend_get_default ());])],
192               [have_glib_networking=yes],
193               [have_glib_networking=no],
194               [have_glib_networking="unknown (cross-compiling)"])
195 CFLAGS="$save_CFLAGS"
196 LIBS="$save_LIBS"
197 AC_MSG_RESULT($have_glib_networking)
198
199 AC_ARG_ENABLE(tls-check,
200               AS_HELP_STRING([--disable-tls-check], [Don't error out if glib-networking is unavailable]))
201 if test "$enable_tls_check" != "no" -a "$have_glib_networking" = "no"; then
202         AC_MSG_ERROR([libsoup requires glib-networking for TLS support.
203
204 If you are building a package, you can pass --disable-tls-check to
205 allow building libsoup anyway (since glib-networking is not actually
206 required at compile time), but you should be sure to add a runtime
207 dependency on it.])
208 fi
209
210 dnl ******************************
211 dnl *** Stuff for regression tests
212 dnl ******************************
213 AC_MSG_NOTICE([checking for programs needed for regression tests])
214 MISSING_REGRESSION_TEST_PACKAGES=""
215
216 if test "$have_glib_networking" = "no"; then
217         MISSING_REGRESSION_TEST_PACKAGES="$MISSING_REGRESSION_TEST_PACKAGES glib-networking"
218 fi
219
220 AC_ARG_WITH(apache-httpd,
221             AS_HELP_STRING([--with-apache-httpd], [Path to apache httpd (for tests)]),
222             APACHE_HTTPD="$withval",
223             [AC_PATH_PROGS(APACHE_HTTPD, httpd2 httpd apache2 apache, no, ${PATH}:/usr/sbin)])
224 if test "$APACHE_HTTPD" != "no"; then
225     AC_MSG_CHECKING([Apache version])
226     apache_version=`$APACHE_HTTPD -v 2>/dev/null | sed -ne 's/Server version: Apache\///p'`
227     case $apache_version in
228     2.2.*)
229         AC_MSG_RESULT([$apache_version (ok)])
230         ;;
231     *)
232         AC_MSG_RESULT([$apache_version (ignoring)])
233         APACHE_HTTPD="no"
234         ;;
235     esac
236 fi
237 AC_SUBST(APACHE_HTTPD)
238 AC_DEFINE_UNQUOTED(APACHE_HTTPD, "$APACHE_HTTPD", [Apache httpd])
239
240 if test "$APACHE_HTTPD" != "no"; then
241     AC_MSG_CHECKING([for Apache module directory])
242     AC_ARG_WITH(apache-module-dir,
243                 AS_HELP_STRING([--with-apache-module-dir], [Apache modules dirs (for tests)]),
244                 apache_module_dirs="$withval",
245                 [apache_prefix=`dirname \`dirname $APACHE_HTTPD\``
246                 mpm=`$APACHE_HTTPD -V | sed -ne 's/^Server MPM: */-/p' | tr 'A-Z' 'a-z'`
247                 # This only works with bash, but should fail harmlessly in sh
248                 apache_module_dirs=`echo $apache_prefix/lib{64,}/{apache,apache2,http,http2,httpd}{$mpm,}{/modules,}`])
249     for dir in $apache_module_dirs; do
250         if test -f $dir/mod_auth_digest.so; then
251             APACHE_MODULE_DIR="$dir"
252         fi
253         if test -f $dir/mod_ssl.so; then
254             APACHE_SSL_MODULE_DIR="$dir"
255             IF_HAVE_APACHE_SSL=""
256         fi
257         if test -f $dir/mod_php5.so; then
258             APACHE_PHP_MODULE_DIR="$dir"
259             APACHE_PHP_MODULE=mod_php5.so
260         fi
261         if test -f $dir/libphp5.so; then
262             APACHE_PHP_MODULE_DIR="$dir"
263             APACHE_PHP_MODULE=libphp5.so
264         fi
265     done
266     AC_MSG_RESULT($APACHE_MODULE_DIR)
267     AC_SUBST(APACHE_MODULE_DIR)
268     AC_SUBST(APACHE_SSL_MODULE_DIR)
269     AC_SUBST(APACHE_PHP_MODULE_DIR)
270     AC_SUBST(APACHE_PHP_MODULE)
271 fi
272
273 if test "$APACHE_HTTPD" != "no" -a -n "$APACHE_MODULE_DIR" -a -n "$APACHE_SSL_MODULE_DIR"; then
274     AC_DEFINE(HAVE_APACHE, 1, [Whether or not apache can be used for tests])
275     have_apache=1
276     if test -z "$APACHE_PHP_MODULE_DIR"; then
277         MISSING_REGRESSION_TEST_PACKAGES="$MISSING_REGRESSION_TEST_PACKAGES mod_php5"
278     fi
279 else
280     have_apache=0
281     if test "$APACHE_HTTPD" = "no" -o -z "$APACHE_MODULE_DIR"; then
282         MISSING_REGRESSION_TEST_PACKAGES="$MISSING_REGRESSION_TEST_PACKAGES apache"
283     else
284         MISSING_REGRESSION_TEST_PACKAGES="$MISSING_REGRESSION_TEST_PACKAGES mod_ssl"
285     fi
286 fi
287 AM_CONDITIONAL(HAVE_APACHE, test $have_apache = 1)
288
289 if test "$have_apache" = 1; then
290     AC_CHECK_PROGS(PHP, php php5)
291
292     AC_MSG_CHECKING([for Apache PHP module])
293     if test -f $APACHE_PHP_MODULE_DIR/$APACHE_PHP_MODULE; then
294         have_php=yes
295         IF_HAVE_PHP=""
296     else
297         have_php=no
298         IF_HAVE_PHP="#"
299         MISSING_REGRESSION_TEST_PACKAGES="$MISSING_REGRESSION_TEST_PACKAGES php5"
300     fi
301     AC_MSG_RESULT($have_php)
302
303     if test "$have_php" = yes; then
304         AC_MSG_CHECKING([for xmlrpc-epi-php])
305         if $PHP --rf xmlrpc_server_create | grep -q "does not exist"; then
306             have_xmlrpc_epi_php=no
307             MISSING_REGRESSION_TEST_PACKAGES="$MISSING_REGRESSION_TEST_PACKAGES php-xmlrpc"
308         else
309             have_xmlrpc_epi_php=yes
310         fi
311         AC_MSG_RESULT($have_xmlrpc_epi_php)
312     fi
313 fi
314
315 AC_SUBST(IF_HAVE_PHP)
316 AM_CONDITIONAL(HAVE_XMLRPC_EPI_PHP, test "$have_xmlrpc_epi_php" = yes)
317
318 AC_PATH_PROG(CURL, curl, no)
319 if test "$CURL" != no; then
320     AC_DEFINE(HAVE_CURL, 1, [Whether or not curl can be used for tests])
321 else
322     MISSING_REGRESSION_TEST_PACKAGES="$MISSING_REGRESSION_TEST_PACKAGES curl"
323 fi
324 AM_CONDITIONAL(HAVE_CURL, test "$CURL" != no)
325
326 AC_SUBST(MISSING_REGRESSION_TEST_PACKAGES)
327 AM_CONDITIONAL(MISSING_REGRESSION_TEST_PACKAGES, test -n "$MISSING_REGRESSION_TEST_PACKAGES")
328
329 dnl *************************
330 dnl *** Output Everything ***
331 dnl *************************
332
333 AC_CONFIG_HEADERS([config.h])
334 AC_CONFIG_FILES([
335         libsoup-2.4.pc
336         libsoup-gnome-2.4.pc
337         Makefile
338         libsoup-zip
339         libsoup/Makefile
340         tests/Makefile
341         tests/httpd.conf
342         docs/Makefile
343         docs/reference/Makefile
344         ])
345 AC_OUTPUT
346
347 if test -n "$MISSING_REGRESSION_TEST_PACKAGES"; then
348     echo ""
349     echo Some regression tests will not be run due to missing packages:
350     echo $MISSING_REGRESSION_TEST_PACKAGES
351     echo ""
352 fi