blob: 90e09715a76865b2e5daee643bb35e4e6aa95213 [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 Veillard393df012001-04-22 20:11:18 +00009LIBXML_MICRO_VERSION=7
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 Veillard27b55282001-04-11 12:22:25 +000076AC_CHECK_HEADERS(stdarg.h sys/stat.h sys/types.h time.h ansidecl.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 Veillard92ad2102001-03-27 12:47:33 +0000103AC_CHECK_FUNCS(strdup strndup strerror)
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
Daniel Veillard92ad2102001-03-27 12:47:33 +0000108dnl Checking the standard string functions availability
109AC_CHECK_FUNCS(printf sprintf fprintf snprintf vfprintf vsprintf vsnprintf sscanf,,
110 NEED_TRIO=1)
111
Daniel Veillard7f7d1111999-09-22 09:46:25 +0000112dnl Checks for inet libraries:
Daniel Veillard71b656e2000-01-05 14:46:17 +0000113AC_CHECK_FUNC(gethostent, , AC_CHECK_LIB(nsl, gethostent))
114AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
115AC_CHECK_FUNC(connect, , AC_CHECK_LIB(inet, connect))
Daniel Veillardb05deb71999-08-10 19:04:08 +0000116
Daniel Veillardb0426ca2000-10-11 23:39:43 +0000117dnl Determine what socket length (socklen_t) data type is
118AC_MSG_CHECKING([for type of socket length (socklen_t)])
119AC_TRY_COMPILE2([
120#include <stddef.h>
121#include <sys/types.h>
122#include <sys/socket.h>],[
123(void)getsockopt (1, 1, 1, NULL, (socklen_t *)NULL)],[
124 AC_MSG_RESULT(socklen_t *)
125 SOCKLEN_T=socklen_t],[
126 AC_TRY_COMPILE2([
127#include <stddef.h>
128#include <sys/types.h>
129#include <sys/socket.h>],[
130(void)getsockopt (1, 1, 1, NULL, (size_t *)NULL)],[
131 AC_MSG_RESULT(size_t *)
132 SOCKLEN_T=size_t],[
133 AC_TRY_COMPILE2([
134#include <stddef.h>
135#include <sys/types.h>
136#include <sys/socket.h>],[
137(void)getsockopt (1, 1, 1, NULL, (int *)NULL)],[
138 AC_MSG_RESULT(int *)
139 SOCKLEN_T=int],[
140 AC_MSG_WARN(could not determine)])])])
141AC_DEFINE_UNQUOTED(SOCKLEN_T, $SOCKLEN_T)
142
Daniel Veillardb05deb71999-08-10 19:04:08 +0000143dnl Checks for isnan in libm if not in libc
Daniel Veillard71b656e2000-01-05 14:46:17 +0000144AC_CHECK_FUNC(isnan, , AC_CHECK_LIB(m, isnan,
Bjorn Reesee1dc0112001-03-03 12:09:03 +0000145 [AC_DEFINE(HAVE_ISNAN)]))
Daniel Veillardb05deb71999-08-10 19:04:08 +0000146
Daniel Veillard760f4422001-02-15 14:59:48 +0000147AC_CHECK_FUNC(isinf, AC_DEFINE(HAVE_ISINF) , AC_CHECK_LIB(m, isinf,
Bjorn Reesee1dc0112001-03-03 12:09:03 +0000148 [AC_DEFINE(HAVE_ISINF)]))
Daniel Veillardb05deb71999-08-10 19:04:08 +0000149
150XML_LIBDIR='-L${libdir}'
Daniel Veillarde8282ed2000-10-10 23:01:31 +0000151XML_INCLUDEDIR='-I${includedir}/libxml -I${includedir}'
Bjorn Reesee1dc0112001-03-03 12:09:03 +0000152XML_LIBS="-lxml2 $Z_LIBS -lm $LIBS"
Daniel Veillardb05deb71999-08-10 19:04:08 +0000153
Daniel Veillardd7e200c1999-11-15 17:53:11 +0000154dnl
Daniel Veillardf5c2c871999-12-01 09:51:45 +0000155dnl Extra flags
156dnl
157XML_CFLAGS=""
158
159dnl
Daniel Veillardb45c43b2001-04-28 17:02:11 +0000160dnl Workaround for native compilers
161dnl HP : http://bugs.gnome.org/db/31/3163.html
162dnl DEC : Enable NaN/Inf
Daniel Veillardd7e200c1999-11-15 17:53:11 +0000163dnl
Daniel Veillard03109292000-08-14 14:58:22 +0000164if test "${GCC}" != "yes" ; then
Daniel Veillardd7e200c1999-11-15 17:53:11 +0000165 case "${host}" in
166 *-*-hpux* )
Daniel Veillard03109292000-08-14 14:58:22 +0000167 CFLAGS="${CFLAGS} -Wp,-H30000"
Daniel Veillardd7e200c1999-11-15 17:53:11 +0000168 ;;
Daniel Veillardb45c43b2001-04-28 17:02:11 +0000169 *-dec-osf* )
170 CFLAGS="${CFLAGS} -ieee"
171 ;;
Daniel Veillardd7e200c1999-11-15 17:53:11 +0000172 esac
Daniel Veillardd574f782001-03-14 19:40:17 +0000173else
174 CFLAGS="${CFLAGS} -Wall"
Daniel Veillardd7e200c1999-11-15 17:53:11 +0000175fi
Daniel Veillardb0426ca2000-10-11 23:39:43 +0000176case ${host} in
177 *-*-solaris*)
Daniel Veillardd2ade932000-09-30 14:39:55 +0000178 XML_LIBDIR="${XML_LIBDIR} -R${libdir}"
179 ;;
180esac
181
Daniel Veillardf5c2c871999-12-01 09:51:45 +0000182
Daniel Veillardb0426ca2000-10-11 23:39:43 +0000183
Daniel Veillardf5c2c871999-12-01 09:51:45 +0000184dnl
185dnl Use buffers for content
186dnl
187
188AC_ARG_WITH(buffers, [ --with-buffers Use buffers for node content])
189if test "$with_buffers" = "yes" ; then
190 CFLAGS="${CFLAGS} -DXML_USE_BUFFER_CONTENT"
191 XML_CFLAGS="${XML_CFLAGS} -DXML_USE_BUFFER_CONTENT"
192fi
193
Daniel Veillard437b87b2000-01-03 17:30:46 +0000194dnl
195dnl Tester makes use of readline if present
196dnl
Daniel Veillard03109292000-08-14 14:58:22 +0000197_cppflags="${CPPFLAGS}"
198_ldflags="${LDFLAGS}"
Daniel Veillard437b87b2000-01-03 17:30:46 +0000199
Daniel Veillard03109292000-08-14 14:58:22 +0000200AC_ARG_WITH(readline,
201[ --with-readline=DIR use readline in DIR],[
202 if test "$withval" != "no" -a "$withval" != "yes"; then
203 RDL_DIR=$withval
204 CPPFLAGS="${CPPFLAGS} -I$withval/include"
205 LDFLAGS="${LDFLAGS} -L$withval/lib"
206 fi
207])
208
209dnl check for terminal library. this is a very cool solution
210dnl from octave's configure.in
211unset tcap
212for termlib in ncurses curses termcap terminfo termlib; do
213 AC_CHECK_LIB(${termlib}, tputs, [tcap="-l$termlib"])
214 test -n "$tcap" && break
215done
216
217AC_CHECK_HEADER(readline/history.h,
218 AC_CHECK_LIB(history, append_history,[
219 RDL_LIBS="-lhistory"
220 AC_DEFINE(HAVE_LIBHISTORY)]))
221AC_CHECK_HEADER(readline/readline.h,
222 AC_CHECK_LIB(readline, readline,[
223 RDL_LIBS="-lreadline $RDL_LIBS $tcap"
224 AC_DEFINE(HAVE_LIBREADLINE)], , $tcap))
225if test -n "$RDL_DIR" -a -n "$RDL_LIBS"; then
226 CPPFLAGS="$CPPFLAGS -I${RDL_DIR}/include"
227 RDL_LIBS="-L${RDL_DIR}/lib $RDL_LIBS"
228else
229 CPPFLAGS=${_cppflags}
230fi
231LDFLAGS=${_ldflags}
232
233AC_SUBST(RDL_LIBS)
Daniel Veillard361d8452000-04-03 19:48:13 +0000234
235dnl
Daniel Veillardf6eea272001-01-18 12:17:12 +0000236dnl specific tests to setup DV's devel environment with debug etc ...
237dnl
238if test "${LOGNAME}" = "veillard" -a "`pwd`" = "/u/veillard/XML" ; then
239 if test "${with_mem_debug}" = "" ; then
240 with_mem_debug="yes"
241 fi
Daniel Veillardeae522a2001-04-23 13:41:34 +0000242 if test "${with_docbook}" = "" ; then
243 with_docbook="yes"
244 fi
Daniel Veillardf6eea272001-01-18 12:17:12 +0000245 if test "${with_xptr}" = "" ; then
246 with_xptr="yes"
247 fi
Daniel Veillardc86a4fa2001-03-26 16:28:29 +0000248 CFLAGS="-Wall -g -O -pedantic -W -Wunused -Wimplicit -Wreturn-type -Wswitch -Wcomment -Wtrigraphs -Wformat -Wchar-subscripts -Wuninitialized -Wparentheses -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline "
249dnl -Wcast-qual -ansi
Daniel Veillardf6eea272001-01-18 12:17:12 +0000250fi
Daniel Veillard92ad2102001-03-27 12:47:33 +0000251
252dnl
253dnl Check for trio string functions
254dnl
255
256if test "${NEED_TRIO}" = "1" ; then
257 echo Adding trio library for string functions
258 WITH_TRIO=1
259else
260 WITH_TRIO=0
261fi
262AC_SUBST(WITH_TRIO)
263
Daniel Veillardf6eea272001-01-18 12:17:12 +0000264dnl
Daniel Veillard361d8452000-04-03 19:48:13 +0000265dnl Aloow to disable various pieces
266dnl
267
268AC_ARG_WITH(ftp, [ --with-ftp Add the FTP support (on)])
269if test "$with_ftp" = "no" ; then
270 echo Disabling FTP support
271 WITH_FTP=0
272 FTP_OBJ=
273else
274 WITH_FTP=1
275 FTP_OBJ=nanoftp.o
276fi
277AC_SUBST(WITH_FTP)
278AC_SUBST(FTP_OBJ)
279
280AC_ARG_WITH(http, [ --with-http Add the HTTP support (on)])
281if test "$with_http" = "no" ; then
282 echo Disabling HTTP support
283 WITH_HTTP=0
284 HTTP_OBJ=
285else
286 WITH_HTTP=1
287 HTTP_OBJ=nanohttp.o
288fi
289AC_SUBST(WITH_HTTP)
290AC_SUBST(HTTP_OBJ)
291
292AC_ARG_WITH(html, [ --with-html Add the HTML support (on)])
293if test "$with_html" = "no" ; then
294 echo Disabling HTML support
295 WITH_HTML=0
296 HTML_OBJ=
297else
298 WITH_HTML=1
299 HTML_OBJ="HTMLparser.o HTMLtree.o"
300fi
301AC_SUBST(WITH_HTML)
302AC_SUBST(HTML_OBJ)
303
Daniel Veillardeae522a2001-04-23 13:41:34 +0000304AC_ARG_WITH(docbook, [ --with-docbook Add Docbook SGML support (off)])
305if test "$with_docbook" = "yes" ; then
306 echo Enabling Docbook support
307 WITH_DOCB=1
308 DOCB_OBJ="DOCBparser.o"
309else
310 WITH_DOCB=0
311 DOCB_OBJ=
312fi
313AC_SUBST(WITH_DOCB)
314AC_SUBST(DOCB_OBJ)
315
316
Daniel Veillard361d8452000-04-03 19:48:13 +0000317AC_ARG_WITH(xpath, [ --with-xpath Add the XPATH support (on)])
318if test "$with_xpath" = "no" ; then
319 echo Disabling XPATH support
Daniel Veillard52afe802000-10-22 16:56:02 +0000320 with_xptr="no"
Daniel Veillard361d8452000-04-03 19:48:13 +0000321 WITH_XPATH=0
322 XPATH_OBJ=
323else
324 WITH_XPATH=1
325 XPATH_OBJ=xpath.o
326fi
327AC_SUBST(WITH_XPATH)
328AC_SUBST(XPATH_OBJ)
329
Daniel Veillardc8df0aa2000-10-10 23:50:30 +0000330AC_ARG_WITH(xptr, [ --with-xptr Add the XPointer support (on)])
331if test "$with_xptr" = "no" ; then
332 echo Disabling XPointer support
333 WITH_XPTR=0
334 XPTR_OBJ=
335else
336 WITH_XPTR=1
337 XPTR_OBJ=xpointer.o
338fi
339AC_SUBST(WITH_XPTR)
340AC_SUBST(XPTR_OBJ)
341
Daniel Veillard9e8bfae2000-11-06 16:43:11 +0000342AC_ARG_WITH(xinclude, [ --with-xinclude Add the XInclude support (on)])
343if test "$with_xinclude" = "no" ; then
344 echo Disabling XInclude support
345 WITH_XINCLUDE=0
346 XINCLUDE_OBJ=
347 with_xinclude="no"
348else
349 WITH_XINCLUDE=1
350 XINCLUDE_OBJ=xinclude.o
351fi
352AC_SUBST(WITH_XINCLUDE)
353AC_SUBST(XINCLUDE_OBJ)
354
Daniel Veillard496a1cf2000-05-03 14:20:55 +0000355AC_ARG_WITH(iconv, [ --with-iconv Add the ICONV support (on)])
356if test "$with_iconv" = "no" ; then
357 echo Disabling ICONV support
358 WITH_ICONV=0
Daniel Veillardd574f782001-03-14 19:40:17 +0000359else
360 AC_CHECK_HEADER(iconv.h,
361 AC_CHECK_FUNC(iconv, , AC_CHECK_LIB(iconv, iconv)))
Daniel Veillard496a1cf2000-05-03 14:20:55 +0000362 if test "$have_iconv" != "" ; then
363 echo Iconv support not found
364 WITH_ICONV=0
365 else
366 WITH_ICONV=1
367 fi
368fi
369AC_SUBST(WITH_ICONV)
370
Daniel Veillard361d8452000-04-03 19:48:13 +0000371AC_ARG_WITH(debug, [ --with-debug Add the debugging module (on)])
372if test "$with_debug" = "no" ; then
373 echo Disabling DEBUG support
374 WITH_DEBUG=0
375 DEBUG_OBJ=
376else
377 WITH_DEBUG=1
378 DEBUG_OBJ=debugXML.o
379fi
380AC_SUBST(WITH_DEBUG)
381AC_SUBST(DEBUG_OBJ)
382
383AC_ARG_WITH(mem_debug, [ --with-mem-debug Add the memory debugging module (off)])
384if test "$with_mem_debug" = "yes" ; then
385 echo Enabling memory debug support
386 WITH_MEM_DEBUG=1
387else
388 WITH_MEM_DEBUG=0
389fi
390AC_SUBST(WITH_MEM_DEBUG)
391
Daniel Veillardd7e200c1999-11-15 17:53:11 +0000392AC_SUBST(CFLAGS)
Daniel Veillardf5c2c871999-12-01 09:51:45 +0000393AC_SUBST(XML_CFLAGS)
Daniel Veillardd7e200c1999-11-15 17:53:11 +0000394
Daniel Veillardb05deb71999-08-10 19:04:08 +0000395AC_SUBST(XML_LIBDIR)
396AC_SUBST(XML_LIBS)
397AC_SUBST(XML_INCLUDEDIR)
398AC_SUBST(HTML_DIR)
399AC_SUBST(HAVE_ISNAN)
400AC_SUBST(HAVE_ISINF)
401
Daniel Veillardb05deb71999-08-10 19:04:08 +0000402AC_SUBST(M_LIBS)
Daniel Veillard437b87b2000-01-03 17:30:46 +0000403AC_SUBST(RDL_LIBS)
Daniel Veillard361d8452000-04-03 19:48:13 +0000404
Owen Taylor3473f882001-02-23 17:55:21 +0000405dnl
406dnl create the libxml and include links needed to get dependencies right
407dnl
408if test ! -d $srcdir/include/libxml
409then
410 if test ! -d $srcdir/include
411 then
412 rm -f $srcdir/include
413 mkdir $srcdir/include
414 fi
415 rm -f $srcdir/libxml
416 (cd $srcdir/include ; ln -s .. libxml)
417fi
418if test ! -r $srcdir/libxml
419then
420 (cd $srcdir ; ln -s include/libxml libxml)
421fi
422if test ! -r include/libxml
423then
424 if test ! -d include
425 then
426 rm -f include
427 mkdir include
428 fi
429 (cd include ; ln -s ../libxml libxml)
430fi
431if test ! -r libxml
432then
433 rm -rf libxml
434 ln -s $srcdir/include/libxml libxml
435fi
436
437AC_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 +0000438