remove gmodule dependency. Fix OPENSSL_LIBS and NSS_LIBS to include the
[platform/upstream/libsoup.git] / configure.in
1 # Process this file with autoconf to produce a configure script.
2
3 # Require autoconf 2.12
4 AC_PREREQ(2.12)
5
6 # Initialize autoconf
7 AC_INIT(configure.in)
8
9 AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)
10 SOUP_MAJOR_VERSION=0
11 SOUP_MINOR_VERSION=1
12 SOUP_MICRO_VERSION=9
13 SOUP_INTERFACE_AGE=0
14 SOUP_BINARY_AGE=0
15 SOUP_VERSION=$SOUP_MAJOR_VERSION.$SOUP_MINOR_VERSION.$SOUP_MICRO_VERSION
16 AC_SUBST(SOUP_MAJOR_VERSION)
17 AC_SUBST(SOUP_MINOR_VERSION)
18 AC_SUBST(SOUP_MICRO_VERSION)
19 AC_SUBST(SOUP_VERSION)
20 AC_DIVERT_POP()
21
22 LT_RELEASE=$SOUP_VERSION
23 LT_CURRENT=$SOUP_MINOR_VERSION
24 LT_REVISION=$SOUP_MICRO_VERSION
25 LT_AGE=$SOUP_MINOR_VERSION
26 AC_SUBST(LT_RELEASE)
27 AC_SUBST(LT_CURRENT)
28 AC_SUBST(LT_REVISION)
29 AC_SUBST(LT_AGE)
30
31 VERSION=$SOUP_VERSION
32 PACKAGE=soup
33
34 # Specify a configuration file
35 AM_CONFIG_HEADER(config.h)
36
37 # Initialize automake
38 AM_INIT_AUTOMAKE($PACKAGE, $VERSION, no-define)
39
40 # Initialize maintainer mode
41 AM_MAINTAINER_MODE
42
43
44 # ****************************************
45 # Set debugging flags
46
47 # Figure out debugging default, prior to $ac_help setup
48 AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)dnl
49 if test `expr $SOUP_MINOR_VERSION \% 2` = 1 ; then
50         debug_default=yes
51 else
52         debug_default=minimum
53 fi
54 AC_DIVERT_POP()
55
56 # Declare --enable-* args and collect ac_help strings
57 AC_ARG_ENABLE(debug, [  --enable-debug=[no/minimum/yes] turn on debugging [default=$debug_default]],,enable_debug=$debug_default)
58
59 # Set the debug flags
60 AC_MSG_CHECKING(for --enable-debug)
61 if test "x$enable_debug" = "xyes"; then
62   test "$cflags_set" = set || CFLAGS="$CFLAGS -g"
63   SOUP_DEBUG_FLAGS="-DG_ENABLE_DEBUG"
64   AC_MSG_RESULT(yes)
65 else
66   if test "x$enable_debug" = "xno"; then
67     SOUP_DEBUG_FLAGS="-DG_DISABLE_ASSERT -DG_DISABLE_CHECKS"
68     AC_MSG_RESULT(no)
69   fi
70 fi
71
72 AC_SUBST(SOUP_DEBUG_FLAGS)
73
74
75 # ****************************************
76 # Check for programs
77
78 AC_PROG_CC
79 AM_PROG_CC_STDC
80 AC_PROG_INSTALL
81
82 # Use an many warnings as possible
83 changequote(,)
84 if test "x$GCC" = "xyes"; then
85   case " $CFLAGS " in
86   *[\ \ ]-Wall[\ \      ]*) ;;
87   *) CFLAGS="$CFLAGS -Wall" ;;
88   esac
89
90   if test "x$enable_ansi" = "xyes"; then
91     case " $CFLAGS " in
92     *[\ \       ]-ansi[\ \      ]*) ;;
93     *) CFLAGS="$CFLAGS -ansi" ;;
94     esac
95
96     case " $CFLAGS " in
97     *[\ \       ]-pedantic[\ \  ]*) ;;
98     *) CFLAGS="$CFLAGS -pedantic" ;;
99     esac
100   fi
101 fi
102 changequote([,])
103
104 # Use reentrant functions
105 CFLAGS="$CFLAGS -D_REENTRANT"
106
107 # Set STDC_HEADERS
108 AC_HEADER_STDC
109
110 # Initialize libtool
111 AM_PROG_LIBTOOL
112
113
114 # ****************************************
115 # Check for libraries
116
117 # Need GLIB
118 AM_PATH_GLIB(1.2.0,,
119              AC_MSG_ERROR([Cannot find GLIB: Is glib-config in path?]))
120
121 GLIB_CFLAGS=`glib-config --cflags glib`
122 GLIB_LIBS=`glib-config --libs glib`
123
124 AC_SUBST(GLIB_CFLAGS)
125 AC_SUBST(GLIB_LIBS)
126
127
128 # Need GNET
129 AM_PATH_GNET(1.0.4,,
130              AC_MSG_ERROR([Cannot find GNET: Is gnet-config in path?]))
131
132 GNET_CFLAGS=`gnet-config --cflags gnet`
133 GNET_LIBS=`gnet-config --libs gnet`
134
135 AC_SUBST(GNET_CFLAGS)
136 AC_SUBST(GNET_LIBS)
137
138
139 # Need gnome-xml 1
140 AC_PATH_PROG(XML_CONFIG,xml-config,no)
141 if test x$XML_CONFIG = xno; then
142         AC_MSG_ERROR([Cannot find LIBXML: Is xml-config in path?])
143 fi
144 XML_CFLAGS=`xml-config --cflags`
145 XML_LIBS=`xml-config --libs`
146
147 AC_SUBST(XML_CFLAGS)
148 AC_SUBST(XML_LIBS)
149
150
151 # Need popt
152 save_CPPFLAGS=$CPPFLAGS
153 save_LIBS=$LIBS
154 CPPFLAGS=
155 LIBS=
156
157 AC_CHECK_LIB(popt, poptGetContext,, AC_MSG_ERROR([popt is required]))
158 AC_CHECK_HEADERS(popt.h,, AC_MSG_ERROR([popt.h is required]))
159
160 POPT_CFLAGS=$CPPFLAGS
161 POPT_LIBS=$LIBS
162
163 AC_SUBST(POPT_CFLAGS)
164 AC_SUBST(POPT_LIBS)
165
166 CPPFLAGS=$save_CPPFLAGS
167 LIBS=$save_LIBS
168
169
170 # Need in.h and tcp.h for setting of TCP_NODELAY
171 AC_CHECK_HEADERS(netinet/in.h netinet/tcp.h)
172
173
174 # Check for OpenSSL
175 AC_ARG_ENABLE(ssl, 
176 [  --enable-ssl             turn on Secure Sockets Layer support [default=yes]
177                            ([=no] will override --with-ssl)],,enable_ssl=yes)
178
179 AC_ARG_WITH(nspr-includes,
180 [  --with-nspr-includes     Specify location of Netscape Portable Runtime headers],[
181 nspr_inc_prefix=-I$withval
182 ])
183
184 AC_ARG_WITH(nspr-libs,
185 [  --with-nspr-libs         Specify location of Netscape Portable Runtime libs],[
186 nspr_prefix=-L$withval
187 ])
188
189 AC_ARG_WITH(nss-includes,
190 [  --with-nss-includes      Specify location of NSS header files],[
191 nss_inc_prefix=-I$withval
192 ])
193
194 AC_ARG_WITH(nss-libs,
195 [  --with-nss-libs          Specify location of NSS libs],[
196 nss_prefix=-L$withval
197 ])
198
199
200 AC_ARG_WITH(openssl-includes,
201 [  --with-openssl-includes  Specify location of OpenSSL header files],[
202 openssl_inc_prefix=-I$withval
203 ])
204
205 AC_ARG_WITH(openssl-libs,
206 [  --with-openssl-libs      Specify location of OpenSSL libs],[
207 openssl_prefix=-L$withval
208 ])
209
210 if test "x$enable_ssl" = xyes; then
211         save_CPPFLAGS=$CPPFLAGS
212         CPPFLAGS="$openssl_inc_prefix"
213         AC_CHECK_HEADERS(openssl/ssl.h openssl/err.h,
214                          [OPENSSL_CFLAGS="$CPPFLAGS" 
215                           OPENSSL_LIBS="$openssl_prefix -lssl -lcrypto"],
216                          [OPENSSL_CFLAGS="" OPENSSL_LIBS=""; break;])
217         AC_SUBST(OPENSSL_CFLAGS)
218         AC_SUBST(OPENSSL_LIBS)
219         CPPFLAGS=$save_CPPFLAGS
220
221         save_CPPFLAGS=$CPPFLAGS
222         CPPFLAGS="$nspr_inc_prefix $nss_inc_prefix"
223         AC_CHECK_HEADERS(prthread.h security/ssl.h security/pk11func.h,
224                          [NSS_CFLAGS="$CPPFLAGS" 
225                           NSS_LIBS="$nspr_prefix -lnspr4 $nss_prefix -lnss3"],
226                          [NSS_CFLAGS="" NSS_LIBS=""; break;])
227         AC_SUBST(NSS_CFLAGS)
228         AC_SUBST(NSS_LIBS)
229         CPPFLAGS=$save_CPPFLAGS
230 fi
231
232 # Set PACKAGE_SOURCE_DIR in config.h.
233 packagesrcdir=`cd $srcdir && pwd`
234 AC_DEFINE_UNQUOTED(PACKAGE_SOURCE_DIR, "${packagesrcdir}")
235
236 # If gcc is the compiler, compile with lots of warnings
237 if test "x$GCC" = "xyes"; then
238         CFLAGS="$CFLAGS -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations "
239         WSDL_CFLAGS="-Werror"
240 fi
241
242 AC_SUBST(WSDL_CFLAGS)
243
244 #       doc/Makefile
245
246 AC_OUTPUT([
247         soup-config
248         soup.pc
249         soup.spec
250         soupConf.sh
251         Makefile
252         src/Makefile
253         src/soup-core/Makefile
254         src/soup-wsdl/Makefile
255         tests/Makefile
256         ],
257         [chmod +x soup-config])