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