summaryrefslogtreecommitdiff
path: root/configure.in
blob: 508f9182892d1db598f1e2bff2926f11a0477def (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
# ****************************************
# Initialize automake and set version

AC_INIT(src/soup-core/soup.h)

SOUP_CURRENT=2
SOUP_REVISION=0
SOUP_AGE=0

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

AM_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE(soup, 0.2.1)
AM_MAINTAINER_MODE


# ****************************************
# Set debugging flags

# Figure out debugging default, prior to $ac_help setup
if test `expr $SOUP_REVISION \% 2` = 1 ; then
	debug_default=yes
else
	debug_default=minimum
fi

# Declare --enable-* args and collect ac_help strings
AC_ARG_ENABLE(debug, 
	      [  --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)


# ****************************************
# Check for programs

AC_PROG_CC
AM_PROG_CC_STDC
AC_PROG_INSTALL

# Set STDC_HEADERS
AC_HEADER_STDC

# Initialize libtool
AM_PROG_LIBTOOL


# ****************************************
# Check for libraries

# Need GLIB
AM_PATH_GLIB(1.2.0,,
             AC_MSG_ERROR([Cannot find GLIB: Is glib-config in path?]))

GLIB_CFLAGS=`glib-config --cflags glib`
GLIB_LIBS=`glib-config --libs glib`

AC_SUBST(GLIB_CFLAGS)
AC_SUBST(GLIB_LIBS)


# Need GNET
AM_PATH_GNET(1.0.4,,
             AC_MSG_ERROR([Cannot find GNET: Is gnet-config in path?]))

GNET_CFLAGS=`gnet-config --cflags gnet`
GNET_LIBS=`gnet-config --libs gnet`

AC_SUBST(GNET_CFLAGS)
AC_SUBST(GNET_LIBS)


# Need gnome-xml 1
AC_PATH_PROG(XML_CONFIG,xml-config,no)
if test x$XML_CONFIG = xno; then
	AC_MSG_ERROR([Cannot find LIBXML: Is xml-config in path?])
fi
XML_CFLAGS=`xml-config --cflags`
XML_LIBS=`xml-config --libs`

AC_SUBST(XML_CFLAGS)
AC_SUBST(XML_LIBS)


# Need popt
save_CPPFLAGS=$CPPFLAGS
save_LIBS=$LIBS
CPPFLAGS=
LIBS=

AC_CHECK_LIB(popt, poptGetContext,, AC_MSG_ERROR([popt is required]))
AC_CHECK_HEADERS(popt.h,, AC_MSG_ERROR([popt.h is required]))

POPT_CFLAGS=$CPPFLAGS
POPT_LIBS=$LIBS

AC_SUBST(POPT_CFLAGS)
AC_SUBST(POPT_LIBS)

CPPFLAGS=$save_CPPFLAGS
LIBS=$save_LIBS

# For proper var substitution in soupConf.sh
SOUP_LIBDIR='-L${libdir}'
SOUP_INCLUDEDIR=" -I${includedir} $GNET_CFLAGS $XML_CFLAGS"
SOUP_LIBS="-lsoup $GNET_LIBS $XML_LIBS"
AC_SUBST(SOUP_LIBDIR)
AC_SUBST(SOUP_INCLUDEDIR)
AC_SUBST(SOUP_LIBS)

# Need in.h and tcp.h for setting of TCP_NODELAY
AC_CHECK_HEADERS(netinet/in.h netinet/tcp.h)


AC_ARG_ENABLE(ssl, 
	      [  --enable-ssl            Turn on Secure Sockets Layer support [default=yes]],,
	      enable_ssl=yes)

AC_ARG_WITH(nspr-includes,
	    [  --with-nspr-includes     Specify location of Netscape Portable Runtime headers],
	    [nspr_inc_prefix=-I$withval])

AC_ARG_WITH(nspr-libs,
	    [  --with-nspr-libs         Specify location of Netscape Portable Runtime libs],[nspr_prefix=-L$withval])

AC_ARG_WITH(nss-includes,
	    [  --with-nss-includes      Specify location of NSS header files],
	    [nss_inc_prefix=-I$withval])

AC_ARG_WITH(nss-libs,
	    [  --with-nss-libs          Specify location of NSS libs],
	    [nss_prefix=-L$withval])


AC_ARG_WITH(openssl-includes,
	    [  --with-openssl-includes  Specify location of OpenSSL header files],
	    [openssl_inc_prefix=-I$withval])

AC_ARG_WITH(openssl-libs,
	    [  --with-openssl-libs      Specify location of OpenSSL libs],
	    [openssl_prefix=-L$withval])

enable_openssl="no"
enable_nss="no"

if test "x$enable_ssl" = xyes; then
	save_CPPFLAGS=$CPPFLAGS
	CPPFLAGS="$openssl_inc_prefix"
	AC_CHECK_HEADERS(openssl/ssl.h openssl/err.h,
			 [OPENSSL_CFLAGS="$CPPFLAGS" 
			  OPENSSL_LIBS="$openssl_prefix -lssl -lcrypto"
			  enable_openssl="yes"],
			 [OPENSSL_CFLAGS="" 
			  OPENSSL_LIBS="" 
			  enable_openssl="no"
			  break])
	AC_SUBST(OPENSSL_CFLAGS)
	AC_SUBST(OPENSSL_LIBS)
	CPPFLAGS=$save_CPPFLAGS

	save_CPPFLAGS=$CPPFLAGS
	CPPFLAGS="$nspr_inc_prefix $nss_inc_prefix"
	AC_CHECK_HEADERS(prthread.h security/ssl.h security/pk11func.h,
			 [NSS_CFLAGS="$CPPFLAGS" 
			  NSS_LIBS="$nspr_prefix -lnspr4 $nss_prefix -lnss3"
			  enable_nss="yes"],
			 [NSS_CFLAGS="" 
			  NSS_LIBS="" 
			  enable_nss="no"
			  break])
	AC_SUBST(NSS_CFLAGS)
	AC_SUBST(NSS_LIBS)
	CPPFLAGS=$save_CPPFLAGS
fi


AC_PATH_PROG(APXS,apxs,no)
if test x$APXS != xno; then
	APACHE_CFLAGS="-I`apxs -q INCLUDEDIR`"
	APACHE_LIBS=`apxs -q LDFLAGS_SHLIB LIBS_SHLIB`

	save_CPPFLAGS=$CPPFLAGS
	CPPFLAGS=$APACHE_CFLAGS
	AC_CHECK_HEADERS(httpd.h http_config.h http_core.h http_log.h http_main.h http_protocol.h,
			  [enable_apache="yes"],
			  [enable_apache="no"
			   break])
	CPPFLAGS=$save_CPPFLAGS

	AC_SUBST(APACHE_CFLAGS)
	AC_SUBST(APACHE_LIBS)
fi


AC_ARG_ENABLE(more-warnings,
	      [  --enable-more-warnings  Maximum compiler warnings],
	      set_more_warnings="$enableval",
	      set_more_warnings=yes)

if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then
	CFLAGS="$CFLAGS \
	-Wall -Wstrict-prototypes -Wmissing-declarations -Wmissing-prototypes \
	-Wnested-externs -Wpointer-arith"
	WSDL_CFLAGS="-Werror"
fi

AC_SUBST(WSDL_CFLAGS)

# Use reentrant functions
CFLAGS="$CFLAGS -D_REENTRANT"


#	doc/Makefile

AC_OUTPUT([
	soup-config
	soup.pc
	soup.spec
	Makefile
	src/Makefile
	src/soup-core/Makefile
	src/soup-wsdl/Makefile
	tests/Makefile
	],
	[chmod +x soup-config soupConf.sh])

echo "

Configuration:

  Source code location:		${srcdir}
  Compiler:			${CC}
  Build flags:			${CFLAGS} ${SOUP_DEBUG_FLAGS}

  OpenSSL support:		${enable_openssl}
  Mozilla NSS support:		${enable_nss}

  Apache module support:	${enable_apache}

"