blob: 92b2e5ab63b4bea5de0057df74f6cf99fb28dc81 [file] [log] [blame]
Daniel Veillard01791d51998-07-24 19:24:09 +00001dnl Process this file with autoconf to produce a configure script.
2AC_PREREQ(2.2)
Owen Taylor3473f882001-02-23 17:55:21 +00003AC_INIT(entities.c)
Daniel Veillard01791d51998-07-24 19:24:09 +00004AM_CONFIG_HEADER(config.h)
Daniel Veillardd2ade932000-09-30 14:39:55 +00005AC_CANONICAL_HOST
Daniel Veillard14fff061999-06-22 21:49:07 +00006
Daniel Veillardcf461992000-03-14 18:30:20 +00007LIBXML_MAJOR_VERSION=2
Daniel Veillard6a2e4062001-02-08 10:31:33 +00008LIBXML_MINOR_VERSION=3
Daniel Veillarde356c282001-03-10 12:32:04 +00009LIBXML_MICRO_VERSION=4
Daniel Veillard14fff061999-06-22 21:49:07 +000010LIBXML_VERSION=$LIBXML_MAJOR_VERSION.$LIBXML_MINOR_VERSION.$LIBXML_MICRO_VERSION
11LIBXML_VERSION_INFO=`expr $LIBXML_MAJOR_VERSION + $LIBXML_MINOR_VERSION`:$LIBXML_MICRO_VERSION:$LIBXML_MINOR_VERSION
12
Daniel Veillard361d8452000-04-03 19:48:13 +000013LIBXML_VERSION_NUMBER=`expr $LIBXML_MAJOR_VERSION \* 10000 + $LIBXML_MINOR_VERSION \* 100 + $LIBXML_MICRO_VERSION`
14
Daniel Veillard14fff061999-06-22 21:49:07 +000015AC_SUBST(LIBXML_MAJOR_VERSION)
16AC_SUBST(LIBXML_MINOR_VERSION)
17AC_SUBST(LIBXML_MICRO_VERSION)
18AC_SUBST(LIBXML_VERSION)
19AC_SUBST(LIBXML_VERSION_INFO)
Daniel Veillard361d8452000-04-03 19:48:13 +000020AC_SUBST(LIBXML_VERSION_NUMBER)
Daniel Veillard14fff061999-06-22 21:49:07 +000021
Daniel Veillard361d8452000-04-03 19:48:13 +000022VERSION=${LIBXML_VERSION}
Daniel Veillard14fff061999-06-22 21:49:07 +000023
Daniel Veillardedfb29b2000-03-14 19:59:05 +000024AM_INIT_AUTOMAKE(libxml2, $VERSION)
Daniel Veillard1164e751999-02-16 16:29:17 +000025
26AC_ARG_WITH(html-dir, [ --with-html-dir=PATH path to installed docs ])
Daniel Veillard01791d51998-07-24 19:24:09 +000027
28dnl Checks for programs.
29AC_PROG_CC
30AC_PROG_INSTALL
Sebastian Wilhelmia44c8a41998-08-07 08:38:58 +000031AC_PROG_CPP
Daniel Veillard01791d51998-07-24 19:24:09 +000032AC_PATH_PROG(RM, rm, /bin/rm)
33AC_PATH_PROG(MV, mv, /bin/mv)
34AC_PATH_PROG(TAR, tar, /bin/tar)
Daniel Veillard01791d51998-07-24 19:24:09 +000035
Daniel Veillard03109292000-08-14 14:58:22 +000036dnl Make sure we have an ANSI compiler
37AM_C_PROTOTYPES
38test "x$U" != "x" && AC_MSG_ERROR(Compiler not ANSI compliant)
39
Daniel Veillard01791d51998-07-24 19:24:09 +000040AM_PROG_LIBTOOL
41
42AM_MAINTAINER_MODE
43
Daniel Veillard71b656e2000-01-05 14:46:17 +000044dnl Checks for zlib library.
Owen Taylor3473f882001-02-23 17:55:21 +000045_cppflags="${CPPFLAGS}"
46_ldflags="${LDFLAGS}"
Daniel Veillard71b656e2000-01-05 14:46:17 +000047
Owen Taylor3473f882001-02-23 17:55:21 +000048AC_ARG_WITH(zlib,
49[ --with-zlib[=DIR] use libz in DIR],[
50 if test "$withval" != "no" -a "$withval" != "yes"; then
51 Z_DIR=$withval
52 CPPFLAGS="${CPPFLAGS} -I$withval/include"
53 LDFLAGS="${LDFLAGS} -L$withval/lib"
54 fi
55])
56
57AC_CHECK_HEADERS(zlib.h,
58 AC_CHECK_LIB(z, gzread,[
59 AC_DEFINE(HAVE_LIBZ)
60 if test "x${Z_DIR}" != "x"; then
61 Z_CFLAGS="-I${Z_DIR}/include"
62 Z_LIBS="-L${Z_DIR}/lib -lz"
63 else
64 Z_LIBS="-lz"
65 fi]))
66AC_SUBST(Z_CFLAGS)
67AC_SUBST(Z_LIBS)
68
69CPPFLAGS=${_cppflags}
70LDFLAGS=${_ldflags}
Daniel Veillardb05deb71999-08-10 19:04:08 +000071
Daniel Veillard01791d51998-07-24 19:24:09 +000072dnl Checks for header files.
73AC_HEADER_DIRENT
74AC_HEADER_STDC
75AC_CHECK_HEADERS(fcntl.h unistd.h ctype.h dirent.h errno.h malloc.h)
Daniel Veillard71b656e2000-01-05 14:46:17 +000076AC_CHECK_HEADERS(stdarg.h sys/stat.h sys/types.h time.h)
Daniel Veillardb05deb71999-08-10 19:04:08 +000077AC_CHECK_HEADERS(ieeefp.h nan.h math.h fp_class.h float.h)
Daniel Veillard7f7d1111999-09-22 09:46:25 +000078AC_CHECK_HEADERS(stdlib.h sys/socket.h netinet/in.h arpa/inet.h)
Daniel Veillard46e370e2000-07-21 20:32:03 +000079AC_CHECK_HEADERS(netdb.h sys/time.h sys/select.h sys/mman.h)
Daniel Veillard01791d51998-07-24 19:24:09 +000080
Daniel Veillard1164e751999-02-16 16:29:17 +000081dnl Specific dir for HTML output ?
82if test "x$with_html_dir" = "x" ; then
Daniel Veillard0a6c3582001-03-14 19:15:37 +000083 HTML_DIR='$(prefix)/doc'
Daniel Veillard1164e751999-02-16 16:29:17 +000084else
85 HTML_DIR=$with_html_dir
86fi
87
88AC_SUBST(HTML_DIR)
89
Daniel Veillardb0426ca2000-10-11 23:39:43 +000090AC_ARG_ENABLE(corba,
91[ --enable-corba Add Corba support (default)])
Daniel Veillard27fb0751998-10-17 06:47:46 +000092
93dnl
94dnl Corba is enabled by default
95dnl
Daniel Veillardda4d3c41998-11-04 20:07:05 +000096if test "$enable_corba" = "no" ; then
Daniel Veillard27fb0751998-10-17 06:47:46 +000097 CORBA_CFLAGS="-DWITHOUT_CORBA"
98fi
99AC_SUBST(CORBA_CFLAGS)
100
Daniel Veillard01791d51998-07-24 19:24:09 +0000101dnl Checks for library functions.
102AC_FUNC_STRFTIME
Daniel Veillardb05deb71999-08-10 19:04:08 +0000103AC_CHECK_FUNCS(strdup strndup strerror snprintf)
Daniel Veillard71b656e2000-01-05 14:46:17 +0000104AC_CHECK_FUNCS(finite isnand fp_class class fpclass)
Daniel Veillard7f7d1111999-09-22 09:46:25 +0000105AC_CHECK_FUNCS(strftime localtime)
Daniel Veillardf17e09b2001-01-25 13:55:35 +0000106AC_CHECK_FUNCS(stat _stat)
Daniel Veillard7f7d1111999-09-22 09:46:25 +0000107
108dnl Checks for inet libraries:
Daniel Veillard71b656e2000-01-05 14:46:17 +0000109AC_CHECK_FUNC(gethostent, , AC_CHECK_LIB(nsl, gethostent))
110AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
111AC_CHECK_FUNC(connect, , AC_CHECK_LIB(inet, connect))
Daniel Veillardb05deb71999-08-10 19:04:08 +0000112
Daniel Veillardb0426ca2000-10-11 23:39:43 +0000113dnl Determine what socket length (socklen_t) data type is
114AC_MSG_CHECKING([for type of socket length (socklen_t)])
115AC_TRY_COMPILE2([
116#include <stddef.h>
117#include <sys/types.h>
118#include <sys/socket.h>],[
119(void)getsockopt (1, 1, 1, NULL, (socklen_t *)NULL)],[
120 AC_MSG_RESULT(socklen_t *)
121 SOCKLEN_T=socklen_t],[
122 AC_TRY_COMPILE2([
123#include <stddef.h>
124#include <sys/types.h>
125#include <sys/socket.h>],[
126(void)getsockopt (1, 1, 1, NULL, (size_t *)NULL)],[
127 AC_MSG_RESULT(size_t *)
128 SOCKLEN_T=size_t],[
129 AC_TRY_COMPILE2([
130#include <stddef.h>
131#include <sys/types.h>
132#include <sys/socket.h>],[
133(void)getsockopt (1, 1, 1, NULL, (int *)NULL)],[
134 AC_MSG_RESULT(int *)
135 SOCKLEN_T=int],[
136 AC_MSG_WARN(could not determine)])])])
137AC_DEFINE_UNQUOTED(SOCKLEN_T, $SOCKLEN_T)
138
Daniel Veillardb05deb71999-08-10 19:04:08 +0000139dnl Checks for isnan in libm if not in libc
Daniel Veillard71b656e2000-01-05 14:46:17 +0000140AC_CHECK_FUNC(isnan, , AC_CHECK_LIB(m, isnan,
Bjorn Reesee1dc0112001-03-03 12:09:03 +0000141 [AC_DEFINE(HAVE_ISNAN)]))
Daniel Veillardb05deb71999-08-10 19:04:08 +0000142
Daniel Veillard760f4422001-02-15 14:59:48 +0000143AC_CHECK_FUNC(isinf, AC_DEFINE(HAVE_ISINF) , AC_CHECK_LIB(m, isinf,
Bjorn Reesee1dc0112001-03-03 12:09:03 +0000144 [AC_DEFINE(HAVE_ISINF)]))
Daniel Veillardb05deb71999-08-10 19:04:08 +0000145
146XML_LIBDIR='-L${libdir}'
Daniel Veillarde8282ed2000-10-10 23:01:31 +0000147XML_INCLUDEDIR='-I${includedir}/libxml -I${includedir}'
Bjorn Reesee1dc0112001-03-03 12:09:03 +0000148XML_LIBS="-lxml2 $Z_LIBS -lm $LIBS"
Daniel Veillardb05deb71999-08-10 19:04:08 +0000149
Daniel Veillardd7e200c1999-11-15 17:53:11 +0000150dnl
Daniel Veillardf5c2c871999-12-01 09:51:45 +0000151dnl Extra flags
152dnl
153XML_CFLAGS=""
154
155dnl
Daniel Veillard03109292000-08-14 14:58:22 +0000156dnl Workaround for HP native compiler
Daniel Veillardd7e200c1999-11-15 17:53:11 +0000157dnl http://bugs.gnome.org/db/31/3163.html
158dnl
Daniel Veillard03109292000-08-14 14:58:22 +0000159if test "${GCC}" != "yes" ; then
Daniel Veillardd7e200c1999-11-15 17:53:11 +0000160 case "${host}" in
161 *-*-hpux* )
Daniel Veillard03109292000-08-14 14:58:22 +0000162 CFLAGS="${CFLAGS} -Wp,-H30000"
Daniel Veillardd7e200c1999-11-15 17:53:11 +0000163 ;;
164 esac
Daniel Veillardd574f782001-03-14 19:40:17 +0000165else
166 CFLAGS="${CFLAGS} -Wall"
Daniel Veillardd7e200c1999-11-15 17:53:11 +0000167fi
Daniel Veillardb0426ca2000-10-11 23:39:43 +0000168case ${host} in
169 *-*-solaris*)
Daniel Veillardd2ade932000-09-30 14:39:55 +0000170 XML_LIBDIR="${XML_LIBDIR} -R${libdir}"
171 ;;
172esac
173
Daniel Veillardf5c2c871999-12-01 09:51:45 +0000174
Daniel Veillardb0426ca2000-10-11 23:39:43 +0000175
Daniel Veillardf5c2c871999-12-01 09:51:45 +0000176dnl
177dnl Use buffers for content
178dnl
179
180AC_ARG_WITH(buffers, [ --with-buffers Use buffers for node content])
181if test "$with_buffers" = "yes" ; then
182 CFLAGS="${CFLAGS} -DXML_USE_BUFFER_CONTENT"
183 XML_CFLAGS="${XML_CFLAGS} -DXML_USE_BUFFER_CONTENT"
184fi
185
Daniel Veillard437b87b2000-01-03 17:30:46 +0000186dnl
187dnl Tester makes use of readline if present
188dnl
Daniel Veillard03109292000-08-14 14:58:22 +0000189_cppflags="${CPPFLAGS}"
190_ldflags="${LDFLAGS}"
Daniel Veillard437b87b2000-01-03 17:30:46 +0000191
Daniel Veillard03109292000-08-14 14:58:22 +0000192AC_ARG_WITH(readline,
193[ --with-readline=DIR use readline in DIR],[
194 if test "$withval" != "no" -a "$withval" != "yes"; then
195 RDL_DIR=$withval
196 CPPFLAGS="${CPPFLAGS} -I$withval/include"
197 LDFLAGS="${LDFLAGS} -L$withval/lib"
198 fi
199])
200
201dnl check for terminal library. this is a very cool solution
202dnl from octave's configure.in
203unset tcap
204for termlib in ncurses curses termcap terminfo termlib; do
205 AC_CHECK_LIB(${termlib}, tputs, [tcap="-l$termlib"])
206 test -n "$tcap" && break
207done
208
209AC_CHECK_HEADER(readline/history.h,
210 AC_CHECK_LIB(history, append_history,[
211 RDL_LIBS="-lhistory"
212 AC_DEFINE(HAVE_LIBHISTORY)]))
213AC_CHECK_HEADER(readline/readline.h,
214 AC_CHECK_LIB(readline, readline,[
215 RDL_LIBS="-lreadline $RDL_LIBS $tcap"
216 AC_DEFINE(HAVE_LIBREADLINE)], , $tcap))
217if test -n "$RDL_DIR" -a -n "$RDL_LIBS"; then
218 CPPFLAGS="$CPPFLAGS -I${RDL_DIR}/include"
219 RDL_LIBS="-L${RDL_DIR}/lib $RDL_LIBS"
220else
221 CPPFLAGS=${_cppflags}
222fi
223LDFLAGS=${_ldflags}
224
225AC_SUBST(RDL_LIBS)
Daniel Veillard361d8452000-04-03 19:48:13 +0000226
227dnl
Daniel Veillardf6eea272001-01-18 12:17:12 +0000228dnl specific tests to setup DV's devel environment with debug etc ...
229dnl
230if test "${LOGNAME}" = "veillard" -a "`pwd`" = "/u/veillard/XML" ; then
231 if test "${with_mem_debug}" = "" ; then
232 with_mem_debug="yes"
233 fi
234dnl if test "${with_docbook}" = "" ; then
235dnl with_docbook="yes"
236dnl fi
237 if test "${with_xptr}" = "" ; then
238 with_xptr="yes"
239 fi
240 CFLAGS="-Wall -g -pedantic"
241fi
242dnl
Daniel Veillard361d8452000-04-03 19:48:13 +0000243dnl Aloow to disable various pieces
244dnl
245
246AC_ARG_WITH(ftp, [ --with-ftp Add the FTP support (on)])
247if test "$with_ftp" = "no" ; then
248 echo Disabling FTP support
249 WITH_FTP=0
250 FTP_OBJ=
251else
252 WITH_FTP=1
253 FTP_OBJ=nanoftp.o
254fi
255AC_SUBST(WITH_FTP)
256AC_SUBST(FTP_OBJ)
257
258AC_ARG_WITH(http, [ --with-http Add the HTTP support (on)])
259if test "$with_http" = "no" ; then
260 echo Disabling HTTP support
261 WITH_HTTP=0
262 HTTP_OBJ=
263else
264 WITH_HTTP=1
265 HTTP_OBJ=nanohttp.o
266fi
267AC_SUBST(WITH_HTTP)
268AC_SUBST(HTTP_OBJ)
269
270AC_ARG_WITH(html, [ --with-html Add the HTML support (on)])
271if test "$with_html" = "no" ; then
272 echo Disabling HTML support
273 WITH_HTML=0
274 HTML_OBJ=
275else
276 WITH_HTML=1
277 HTML_OBJ="HTMLparser.o HTMLtree.o"
278fi
279AC_SUBST(WITH_HTML)
280AC_SUBST(HTML_OBJ)
281
282AC_ARG_WITH(xpath, [ --with-xpath Add the XPATH support (on)])
283if test "$with_xpath" = "no" ; then
284 echo Disabling XPATH support
Daniel Veillard52afe802000-10-22 16:56:02 +0000285 with_xptr="no"
Daniel Veillard361d8452000-04-03 19:48:13 +0000286 WITH_XPATH=0
287 XPATH_OBJ=
288else
289 WITH_XPATH=1
290 XPATH_OBJ=xpath.o
291fi
292AC_SUBST(WITH_XPATH)
293AC_SUBST(XPATH_OBJ)
294
Daniel Veillardc8df0aa2000-10-10 23:50:30 +0000295AC_ARG_WITH(xptr, [ --with-xptr Add the XPointer support (on)])
296if test "$with_xptr" = "no" ; then
297 echo Disabling XPointer support
298 WITH_XPTR=0
299 XPTR_OBJ=
300else
301 WITH_XPTR=1
302 XPTR_OBJ=xpointer.o
303fi
304AC_SUBST(WITH_XPTR)
305AC_SUBST(XPTR_OBJ)
306
Daniel Veillard9e8bfae2000-11-06 16:43:11 +0000307AC_ARG_WITH(xinclude, [ --with-xinclude Add the XInclude support (on)])
308if test "$with_xinclude" = "no" ; then
309 echo Disabling XInclude support
310 WITH_XINCLUDE=0
311 XINCLUDE_OBJ=
312 with_xinclude="no"
313else
314 WITH_XINCLUDE=1
315 XINCLUDE_OBJ=xinclude.o
316fi
317AC_SUBST(WITH_XINCLUDE)
318AC_SUBST(XINCLUDE_OBJ)
319
Daniel Veillard496a1cf2000-05-03 14:20:55 +0000320AC_ARG_WITH(iconv, [ --with-iconv Add the ICONV support (on)])
321if test "$with_iconv" = "no" ; then
322 echo Disabling ICONV support
323 WITH_ICONV=0
Daniel Veillardd574f782001-03-14 19:40:17 +0000324else
325 AC_CHECK_HEADER(iconv.h,
326 AC_CHECK_FUNC(iconv, , AC_CHECK_LIB(iconv, iconv)))
Daniel Veillard496a1cf2000-05-03 14:20:55 +0000327 if test "$have_iconv" != "" ; then
328 echo Iconv support not found
329 WITH_ICONV=0
330 else
331 WITH_ICONV=1
332 fi
333fi
334AC_SUBST(WITH_ICONV)
335
Daniel Veillard361d8452000-04-03 19:48:13 +0000336AC_ARG_WITH(debug, [ --with-debug Add the debugging module (on)])
337if test "$with_debug" = "no" ; then
338 echo Disabling DEBUG support
339 WITH_DEBUG=0
340 DEBUG_OBJ=
341else
342 WITH_DEBUG=1
343 DEBUG_OBJ=debugXML.o
344fi
345AC_SUBST(WITH_DEBUG)
346AC_SUBST(DEBUG_OBJ)
347
348AC_ARG_WITH(mem_debug, [ --with-mem-debug Add the memory debugging module (off)])
349if test "$with_mem_debug" = "yes" ; then
350 echo Enabling memory debug support
351 WITH_MEM_DEBUG=1
352else
353 WITH_MEM_DEBUG=0
354fi
355AC_SUBST(WITH_MEM_DEBUG)
356
Daniel Veillardd7e200c1999-11-15 17:53:11 +0000357AC_SUBST(CFLAGS)
Daniel Veillardf5c2c871999-12-01 09:51:45 +0000358AC_SUBST(XML_CFLAGS)
Daniel Veillardd7e200c1999-11-15 17:53:11 +0000359
Daniel Veillardb05deb71999-08-10 19:04:08 +0000360AC_SUBST(XML_LIBDIR)
361AC_SUBST(XML_LIBS)
362AC_SUBST(XML_INCLUDEDIR)
363AC_SUBST(HTML_DIR)
364AC_SUBST(HAVE_ISNAN)
365AC_SUBST(HAVE_ISINF)
366
Daniel Veillardb05deb71999-08-10 19:04:08 +0000367AC_SUBST(M_LIBS)
Daniel Veillard437b87b2000-01-03 17:30:46 +0000368AC_SUBST(RDL_LIBS)
Daniel Veillard361d8452000-04-03 19:48:13 +0000369
Owen Taylor3473f882001-02-23 17:55:21 +0000370dnl
371dnl create the libxml and include links needed to get dependencies right
372dnl
373if test ! -d $srcdir/include/libxml
374then
375 if test ! -d $srcdir/include
376 then
377 rm -f $srcdir/include
378 mkdir $srcdir/include
379 fi
380 rm -f $srcdir/libxml
381 (cd $srcdir/include ; ln -s .. libxml)
382fi
383if test ! -r $srcdir/libxml
384then
385 (cd $srcdir ; ln -s include/libxml libxml)
386fi
387if test ! -r include/libxml
388then
389 if test ! -d include
390 then
391 rm -f include
392 mkdir include
393 fi
394 (cd include ; ln -s ../libxml libxml)
395fi
396if test ! -r libxml
397then
398 rm -rf libxml
399 ln -s $srcdir/include/libxml libxml
400fi
401
402AC_OUTPUT(libxml.spec Makefile include/Makefile doc/Makefile example/Makefile libxml/xmlversion.h xml2-config libxml-2.0.pc xml2Conf.sh)
Arturo Espinosa15fe6e71998-09-07 17:27:57 +0000403