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