summaryrefslogtreecommitdiff
path: root/configure.in
blob: 400e22f7a6f53bc3c3e4f67ad375992babb82f77 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
dnl *******************************************
dnl *** Initialize automake and set version ***
dnl *******************************************

AC_PREREQ(2.53)
AC_INIT(libsoup, 2.25.5)
AC_CONFIG_SRCDIR(libsoup-2.4.pc.in)
AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)

AM_CONFIG_HEADER(config.h)
AM_MAINTAINER_MODE
AC_PROG_MAKE_SET

SOUP_API_VERSION=2.4
AC_SUBST(SOUP_API_VERSION)

# Increment on interface addition. Reset on removal.
SOUP_AGE=2

# Increment on interface add, remove, or change.
SOUP_CURRENT=3

# Increment on source change. Reset when CURRENT changes.
SOUP_REVISION=0

AC_SUBST(SOUP_CURRENT)
AC_SUBST(SOUP_REVISION)
AC_SUBST(SOUP_AGE)

dnl ***************************
dnl *** Set debugging flags ***
dnl ***************************

debug_default=minimum

# Declare --enable-* args and collect ac_help strings
AC_ARG_ENABLE(debug, 
	      AS_HELP_STRING([--enable-debug=[no/minimum/yes]],
			     [turn on debugging (default=$debug_default)]),,
	      enable_debug=$debug_default)

# Set the debug flags
if test "x$enable_debug" = "xyes"; then
	test "$cflags_set" = set || CFLAGS="$CFLAGS -g"
	SOUP_DEBUG_FLAGS="-DG_ENABLE_DEBUG"
else
	if test "x$enable_debug" = "xno"; then
		SOUP_DEBUG_FLAGS="-DG_DISABLE_ASSERT -DG_DISABLE_CHECKS"
	fi
fi

AC_SUBST(SOUP_DEBUG_FLAGS)

# Set the maintainer flags
if test "x$enable_maintainer_mode" = "xyes"; then
	SOUP_MAINTAINER_FLAGS="-DG_DISABLE_DEPRECATED"
	AC_SUBST(SOUP_MAINTAINER_FLAGS)
fi

dnl ***************************
dnl *** Checks for programs ***
dnl ***************************

AC_PROG_CC
AM_PROG_CC_STDC
AC_PROG_INSTALL

# Set STDC_HEADERS
AC_HEADER_STDC

# Initialize libtool
AC_LIBTOOL_WIN32_DLL
AM_PROG_LIBTOOL

# This isn't a program, but it doesn't fit anywhere else...
AC_FUNC_ALLOCA

dnl ***********************
dnl *** Checks for glib ***
dnl ***********************

AM_PATH_GLIB_2_0(2.15.3,,,gobject gthread gio)
if test "$GLIB_LIBS" = ""; then
   AC_MSG_ERROR(GLIB 2.15.3 or later is required to build libsoup)
fi
GLIB_CFLAGS="$GLIB_CFLAGS -DG_DISABLE_SINGLE_INCLUDES"

PKG_CHECK_MODULES(XML, libxml-2.0)
AC_SUBST(XML_CFLAGS)
AC_SUBST(XML_LIBS)

dnl ***********************
dnl *** Check for Win32 ***
dnl ***********************

AC_MSG_CHECKING([for Win32])
case "$host" in
  *-*-mingw*)
    os_win32=yes
    # Don't do this yet, as we want to support Windows 2000 which
    # doesn't have these.
    # AC_CACHE_VAL(ac_cv_func_getaddrinfo, [ac_cv_func_getaddrinfo=yes])
    # AC_CACHE_VAL(ac_cv_func_getnameinfo, [ac_cv_func_getnameinfo=yes])
    # AC_CACHE_VAL(ac_cv_func_inet_pton, [ac_cv_func_inet_pton=yes])
    # AC_CACHE_VAL(ac_cv_func_inet_ntop, [ac_cv_func_inet_ntop=yes])
    # AC_CACHE_VAL(soup_cv_ipv6, [soup_cv_ipv6=yes])
    ;;
  *)
    os_win32=no
    ;;
esac
AC_MSG_RESULT([$os_win32])
AM_CONDITIONAL(OS_WIN32, [test $os_win32 = yes])

dnl *******************
dnl *** Misc checks ***
dnl *******************
AC_CHECK_FUNCS(gmtime_r)
AC_CHECK_FUNCS(mmap)

dnl *********************************
dnl *** Networking library checks ***
dnl *********************************

AC_CHECK_FUNC(socket, , AC_CHECK_LIB(socket, socket))
AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(nsl, gethostbyname))

AC_CHECK_FUNCS(inet_pton inet_ntop inet_aton getaddrinfo getnameinfo)

AC_CACHE_CHECK(IPv6 support, soup_cv_ipv6, [
	AC_EGREP_HEADER(sockaddr_in6, netinet/in.h, soup_cv_ipv6=yes, soup_cv_ipv6=no)
])
case $soup_cv_ipv6 in
yes)
	AC_DEFINE(HAVE_IPV6, 1, [Define if you have support for IPv6 sockets])
	;;
esac

dnl **********************************
dnl *** SSL Library check (GnuTLS) ***
dnl **********************************

dnl Allow autogening even without AM_PATH_LIBGCRYPT available
m4_ifdef([AM_PATH_LIBGCRYPT],,[m4_define(AM_PATH_LIBGCRYPT,)])
AC_ARG_ENABLE(ssl, 
	      AS_HELP_STRING([--enable-ssl], [Turn on Secure Sockets Layer support (default=yes)]),,
	      enable_ssl=auto)

if test "$enable_ssl" != "no"; then
	PKG_CHECK_MODULES(LIBGNUTLS, gnutls,
		[AM_PATH_LIBGCRYPT([], have_ssl=yes, have_ssl=no)], have_ssl=no)
	if test "$have_ssl" = "yes"; then
		AC_DEFINE(HAVE_SSL, 1, [Defined if you have SSL support])
		SSL_REQUIREMENT="gnutls"
	else
		if test "$enable_ssl" = "auto"; then
			AC_MSG_WARN(Disabling SSL support);
			enable_ssl=no;
		else
			AC_MSG_ERROR(Could not configure SSL support);
		fi
	fi
fi

AC_SUBST(LIBGNUTLS_CFLAGS)
AC_SUBST(LIBGNUTLS_LIBS)
AC_SUBST(SSL_REQUIREMENT)

dnl This is not supposed to be conditional, but...
AM_CONDITIONAL(HAVE_SSL, test $enable_ssl != no)


dnl *********************
dnl *** GNOME support ***
dnl *********************
AC_MSG_CHECKING(whether to build libsoup-gnome)
AC_ARG_WITH(gnome,
	    AS_HELP_STRING([--without-gnome], [Do not build libsoup-gnome]),
	    :, [if test $os_win32 = yes; then with_gnome=no; else with_gnome=yes; fi])
AC_MSG_RESULT($with_gnome)

AM_CONDITIONAL(BUILD_LIBSOUP_GNOME, test $with_gnome != no)

if test $with_gnome != no; then
	AC_DEFINE(HAVE_GNOME, 1, [Defined if GNOME support is enabled])

	PKG_CHECK_MODULES(LIBPROXY, libproxy-1.0,
			  :, [AC_MSG_ERROR(dnl
[Could not find libproxy:

$LIBPROXY_PKG_ERRORS

libproxy is now a dependency of GNOME, and is required for proxy
support in libsoup.

Pass "--without-gnome" to configure if you want to build libsoup
without GNOME support.])])

	PKG_CHECK_MODULES(SQLITE, sqlite3, :, [AC_MSG_ERROR(dnl
[Could not find sqlite3 devel files:

$SQLITE_PKG_ERRORS

Pass "--without-gnome" to configure if you want to build libsoup
without GNOME support.])])
fi
AC_SUBST(HAVE_GNOME)
AC_SUBST(LIBPROXY_CFLAGS)
AC_SUBST(LIBPROXY_LIBS)
AC_SUBST(SQLITE_CFLAGS)
AC_SUBST(SQLITE_LIBS)


dnl ***************
dnl *** gtk-doc ***
dnl ***************
GTK_DOC_CHECK([1.0])


dnl *************************************
dnl *** Warnings to show if using GCC ***
dnl *************************************

AC_ARG_ENABLE(more-warnings,
	      AS_HELP_STRING([--disable-more-warnings], [Inhibit compiler warnings]),
	      set_more_warnings=no)

if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then
	CFLAGS="$CFLAGS \
		-Wall -Wstrict-prototypes -Wmissing-declarations \
		-Wmissing-prototypes -Wnested-externs -Wpointer-arith \
		-Wdeclaration-after-statement -Wformat=2 -Winit-self \
		-Wmissing-include-dirs -Wundef -Waggregate-return \
		-Wmissing-format-attribute"
fi

if test "$os_win32" != yes; then
	# Use reentrant functions (FIXME!)
	CFLAGS="$CFLAGS -D_REENTRANT"
fi

dnl ******************************
dnl *** Stuff for regression tests
dnl ******************************
AC_MSG_NOTICE([checking for programs needed for regression tests])
MISSING_REGRESSION_TEST_PACKAGES=""

AC_ARG_WITH(apache-httpd,
	    AS_HELP_STRING([--with-apache-httpd], [Path to apache httpd (for tests)]),
	    APACHE_HTTPD="$withval",
	    [AC_PATH_PROGS(APACHE_HTTPD, httpd2 httpd, no, ${PATH}:/usr/sbin)])
if test "$APACHE_HTTPD" != "no"; then
    AC_MSG_CHECKING([Apache version])
    apache_version=`$APACHE_HTTPD -v 2>/dev/null | sed -ne 's/Server version: Apache\///p'`
    case $apache_version in
    2.2.*)
	AC_MSG_RESULT([$apache_version (ok)])
	;;
    *)
	AC_MSG_RESULT([$apache_version (ignoring)])
	APACHE_HTTPD="no"
	;;
    esac
fi
AC_SUBST(APACHE_HTTPD)
AC_DEFINE_UNQUOTED(APACHE_HTTPD, "$APACHE_HTTPD", [Apache httpd])

if test "$APACHE_HTTPD" != "no"; then
    AC_MSG_CHECKING([for Apache module directory])
    AC_ARG_WITH(apache-module-dir,
		AS_HELP_STRING([--with-apache-module-dir], [Apache modules dirs (for tests)]),
		apache_module_dirs="$withval",
		[apache_prefix=`dirname \`dirname $APACHE_HTTPD\``
		mpm=`$APACHE_HTTPD -V | sed -ne 's/^Server MPM: */-/p' | tr 'A-Z' 'a-z'`
		# This only works with bash, but should fail harmlessly in sh
		apache_module_dirs=`echo $apache_prefix/lib{64,}/{apache,apache2,http,http2,httpd}{$mpm,}{/modules,}`])
    for dir in $apache_module_dirs; do
        if test -f $dir/mod_auth_digest.so; then
	    APACHE_MODULE_DIR="$dir"
        fi
        if test -f $dir/mod_ssl.so; then
	    APACHE_SSL_MODULE_DIR="$dir"
	    IF_HAVE_APACHE_SSL=""
        fi
        if test -f $dir/mod_php5.so; then
	    APACHE_PHP_MODULE_DIR="$dir"
	    APACHE_PHP_MODULE=mod_php5.so
        fi
        if test -f $dir/libphp5.so; then
	    APACHE_PHP_MODULE_DIR="$dir"
	    APACHE_PHP_MODULE=libphp5.so
        fi
    done
    AC_MSG_RESULT($APACHE_MODULE_DIR)
    AC_SUBST(APACHE_MODULE_DIR)
    AC_SUBST(APACHE_SSL_MODULE_DIR)
    AC_SUBST(APACHE_PHP_MODULE_DIR)
    AC_SUBST(APACHE_PHP_MODULE)
fi

if test "$APACHE_HTTPD" != "no" -a -n "$APACHE_MODULE_DIR" -a -n "$APACHE_SSL_MODULE_DIR"; then
    AC_DEFINE(HAVE_APACHE, 1, [Whether or not apache can be used for tests])
    have_apache=1
    if test -z "$APACHE_PHP_MODULE_DIR"; then
        MISSING_REGRESSION_TEST_PACKAGES="$MISSING_REGRESSION_TEST_PACKAGES mod_php5"
    fi
else
    have_apache=0
    if test "$APACHE_HTTPD" == "no" -o -z "$APACHE_MODULE_DIR"; then
        MISSING_REGRESSION_TEST_PACKAGES="$MISSING_REGRESSION_TEST_PACKAGES apache"
    else
        MISSING_REGRESSION_TEST_PACKAGES="$MISSING_REGRESSION_TEST_PACKAGES mod_ssl"
    fi
fi
AM_CONDITIONAL(HAVE_APACHE, test $have_apache = 1)

if test "$have_apache" = 1; then
    AC_CHECK_PROGS(PHP, php php5)

    AC_MSG_CHECKING([for Apache PHP module])
    if test -f $APACHE_PHP_MODULE_DIR/$APACHE_PHP_MODULE; then
	have_php=yes
	IF_HAVE_PHP=""
    else
	have_php=no
	IF_HAVE_PHP="#"
	MISSING_REGRESSION_TEST_PACKAGES="$MISSING_REGRESSION_TEST_PACKAGES php5"
    fi
    AC_MSG_RESULT($have_php)

    if test "$have_php" = yes; then
	AC_MSG_CHECKING([for xmlrpc-epi-php])
	if $PHP --rf xmlrpc_server_create | grep -q "does not exist"; then
	    have_xmlrpc_epi_php=no
	    MISSING_REGRESSION_TEST_PACKAGES="$MISSING_REGRESSION_TEST_PACKAGES php-xmlrpc"
	else
	    have_xmlrpc_epi_php=yes
	fi
	AC_MSG_RESULT($have_xmlrpc_epi_php)
    fi
fi

AC_SUBST(IF_HAVE_PHP)
AM_CONDITIONAL(HAVE_XMLRPC_EPI_PHP, test "$have_xmlrpc_epi_php" = yes)

AC_PATH_PROG(CURL, curl, no)
if test "$CURL" != no; then
    AC_DEFINE(HAVE_CURL, 1, [Whether or not curl can be used for tests])
else
    MISSING_REGRESSION_TEST_PACKAGES="$MISSING_REGRESSION_TEST_PACKAGES curl"
fi
AM_CONDITIONAL(HAVE_CURL, test "$CURL" != no)

if test -n "$MISSING_REGRESSION_TEST_PACKAGES"; then
    AC_MSG_NOTICE([Some regression tests will not be run due to missing packages:$MISSING_REGRESSION_TEST_PACKAGES])
fi
AC_SUBST(MISSING_REGRESSION_TEST_PACKAGES)
AM_CONDITIONAL(MISSING_REGRESSION_TEST_PACKAGES, test -n "$MISSING_REGRESSION_TEST_PACKAGES")

dnl *************************
dnl *** Output Everything ***
dnl *************************

AC_OUTPUT([
	libsoup-2.4.pc
	libsoup-gnome-2.4.pc
	Makefile
	libsoup-zip
	libsoup/Makefile
	tests/Makefile
	tests/httpd.conf
	docs/Makefile
	docs/reference/Makefile
	])