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