properly version the project and give an option to disable more warnings
[platform/upstream/libsoup.git] / configure.in
1 # ****************************************
2 # Initialize automake and set version
3
4 AC_INIT(src/soup-core/soup.h)
5
6 SOUP_CURRENT=0
7 SOUP_REVISION=2
8 SOUP_AGE=0
9
10 AC_SUBST(SOUP_CURRENT)
11 AC_SUBST(SOUP_REVISION)
12 AC_SUBST(SOUP_AGE)
13
14 AM_CONFIG_HEADER(config.h)
15 AM_INIT_AUTOMAKE(soup, $SOUP_CURRENT.$SOUP_REVISION.$SOUP_AGE)
16 AM_MAINTAINER_MODE
17
18
19 # ****************************************
20 # Set debugging flags
21
22 # Figure out debugging default, prior to $ac_help setup
23 if test `expr $SOUP_REVISION \% 2` = 1 ; then
24         debug_default=yes
25 else
26         debug_default=minimum
27 fi
28
29 # Declare --enable-* args and collect ac_help strings
30 AC_ARG_ENABLE(debug, 
31               [  --enable-debug=[no/minimum/yes] turn on debugging [default=$debug_default]],,
32               enable_debug=$debug_default)
33
34 # Set the debug flags
35 AC_MSG_CHECKING(for --enable-debug)
36 if test "x$enable_debug" = "xyes"; then
37         test "$cflags_set" = set || CFLAGS="$CFLAGS -g"
38         SOUP_DEBUG_FLAGS="-DG_ENABLE_DEBUG"
39         AC_MSG_RESULT(yes)
40 else
41         if test "x$enable_debug" = "xno"; then
42                 SOUP_DEBUG_FLAGS="-DG_DISABLE_ASSERT -DG_DISABLE_CHECKS"
43                 AC_MSG_RESULT(no)
44         fi
45 fi
46
47 AC_SUBST(SOUP_DEBUG_FLAGS)
48
49
50 # ****************************************
51 # Check for programs
52
53 AC_PROG_CC
54 AM_PROG_CC_STDC
55 AC_PROG_INSTALL
56
57 # Set STDC_HEADERS
58 AC_HEADER_STDC
59
60 # Initialize libtool
61 AM_PROG_LIBTOOL
62
63
64 # ****************************************
65 # Check for libraries
66
67 # Need GLIB
68 AM_PATH_GLIB(1.2.0,,
69              AC_MSG_ERROR([Cannot find GLIB: Is glib-config in path?]))
70
71 GLIB_CFLAGS=`glib-config --cflags glib`
72 GLIB_LIBS=`glib-config --libs glib`
73
74 AC_SUBST(GLIB_CFLAGS)
75 AC_SUBST(GLIB_LIBS)
76
77
78 # Need GNET
79 AM_PATH_GNET(1.0.4,,
80              AC_MSG_ERROR([Cannot find GNET: Is gnet-config in path?]))
81
82 GNET_CFLAGS=`gnet-config --cflags gnet`
83 GNET_LIBS=`gnet-config --libs gnet`
84
85 AC_SUBST(GNET_CFLAGS)
86 AC_SUBST(GNET_LIBS)
87
88
89 # Need gnome-xml 1
90 AC_PATH_PROG(XML_CONFIG,xml-config,no)
91 if test x$XML_CONFIG = xno; then
92         AC_MSG_ERROR([Cannot find LIBXML: Is xml-config in path?])
93 fi
94 XML_CFLAGS=`xml-config --cflags`
95 XML_LIBS=`xml-config --libs`
96
97 AC_SUBST(XML_CFLAGS)
98 AC_SUBST(XML_LIBS)
99
100
101 # Need popt
102 save_CPPFLAGS=$CPPFLAGS
103 save_LIBS=$LIBS
104 CPPFLAGS=
105 LIBS=
106
107 AC_CHECK_LIB(popt, poptGetContext,, AC_MSG_ERROR([popt is required]))
108 AC_CHECK_HEADERS(popt.h,, AC_MSG_ERROR([popt.h is required]))
109
110 POPT_CFLAGS=$CPPFLAGS
111 POPT_LIBS=$LIBS
112
113 AC_SUBST(POPT_CFLAGS)
114 AC_SUBST(POPT_LIBS)
115
116 CPPFLAGS=$save_CPPFLAGS
117 LIBS=$save_LIBS
118
119
120 # Need in.h and tcp.h for setting of TCP_NODELAY
121 AC_CHECK_HEADERS(netinet/in.h netinet/tcp.h)
122
123
124 AC_ARG_ENABLE(ssl, 
125               [  --enable-ssl            Turn on Secure Sockets Layer support [default=yes]],,
126               enable_ssl=yes)
127
128 AC_ARG_WITH(nspr-includes,
129             [  --with-nspr-includes     Specify location of Netscape Portable Runtime headers],
130             [nspr_inc_prefix=-I$withval])
131
132 AC_ARG_WITH(nspr-libs,
133             [  --with-nspr-libs         Specify location of Netscape Portable Runtime libs],[nspr_prefix=-L$withval])
134
135 AC_ARG_WITH(nss-includes,
136             [  --with-nss-includes      Specify location of NSS header files],
137             [nss_inc_prefix=-I$withval])
138
139 AC_ARG_WITH(nss-libs,
140             [  --with-nss-libs          Specify location of NSS libs],
141             [nss_prefix=-L$withval])
142
143
144 AC_ARG_WITH(openssl-includes,
145             [  --with-openssl-includes  Specify location of OpenSSL header files],
146             [openssl_inc_prefix=-I$withval])
147
148 AC_ARG_WITH(openssl-libs,
149             [  --with-openssl-libs      Specify location of OpenSSL libs],
150             [openssl_prefix=-L$withval])
151
152 enable_openssl="no"
153 enable_nss="no"
154
155 if test "x$enable_ssl" = xyes; then
156         save_CPPFLAGS=$CPPFLAGS
157         CPPFLAGS="$openssl_inc_prefix"
158         AC_CHECK_HEADERS(openssl/ssl.h openssl/err.h,
159                          [OPENSSL_CFLAGS="$CPPFLAGS" 
160                           OPENSSL_LIBS="$openssl_prefix -lssl -lcrypto"
161                           enable_openssl="yes"],
162                          [OPENSSL_CFLAGS="" 
163                           OPENSSL_LIBS="" 
164                           enable_openssl="no"
165                           break])
166         AC_SUBST(OPENSSL_CFLAGS)
167         AC_SUBST(OPENSSL_LIBS)
168         CPPFLAGS=$save_CPPFLAGS
169
170         save_CPPFLAGS=$CPPFLAGS
171         CPPFLAGS="$nspr_inc_prefix $nss_inc_prefix"
172         AC_CHECK_HEADERS(prthread.h security/ssl.h security/pk11func.h,
173                          [NSS_CFLAGS="$CPPFLAGS" 
174                           NSS_LIBS="$nspr_prefix -lnspr4 $nss_prefix -lnss3"
175                           enable_nss="yes"],
176                          [NSS_CFLAGS="" 
177                           NSS_LIBS="" 
178                           enable_nss="no"
179                           break])
180         AC_SUBST(NSS_CFLAGS)
181         AC_SUBST(NSS_LIBS)
182         CPPFLAGS=$save_CPPFLAGS
183 fi
184
185
186 AC_ARG_ENABLE(more-warnings,
187 [  --enable-more-warnings  Maximum compiler warnings],
188 set_more_warnings="$enableval",set_more_warnings=yes)
189
190 if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then
191         CFLAGS="$CFLAGS \
192         -Wall -Wstrict-prototypes -Wmissing-declarations -Wmissing-prototypes \
193         -Wnested-externs -Wpointer-arith -Werror"
194 fi
195
196 # Use reentrant functions
197 CFLAGS="$CFLAGS -D_REENTRANT"
198
199
200 #       doc/Makefile
201
202 AC_OUTPUT([
203         soup-config
204         soup.pc
205         soup.spec
206         soupConf.sh
207         Makefile
208         src/Makefile
209         src/soup-core/Makefile
210         src/soup-wsdl/Makefile
211         tests/Makefile
212         ],
213         [chmod +x soup-config soupConf.sh])
214
215 echo "
216
217 Configuration:
218
219   Source code location:  ${srcdir}
220   Compiler:              ${CC}
221   Build flags:           ${CFLAGS} ${SOUP_DEBUG_FLAGS}
222
223   OpenSSL support:       ${enable_openssl}
224   Mozilla NSS support:   ${enable_nss}
225
226 "