aboutsummaryrefslogtreecommitdiffstats
path: root/configure.in
blob: 0b7c32169da57782c28ae442713865e344e87c37 (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
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
dnl Process this file with autoconf to produce a configure script.
AC_PREREQ(2.2)
AC_INIT(entities.c)
AM_CONFIG_HEADER(config.h)
AC_CANONICAL_HOST

LIBXML_MAJOR_VERSION=2
LIBXML_MINOR_VERSION=2
LIBXML_MICRO_VERSION=6
LIBXML_VERSION=$LIBXML_MAJOR_VERSION.$LIBXML_MINOR_VERSION.$LIBXML_MICRO_VERSION
LIBXML_VERSION_INFO=`expr $LIBXML_MAJOR_VERSION + $LIBXML_MINOR_VERSION`:$LIBXML_MICRO_VERSION:$LIBXML_MINOR_VERSION

LIBXML_VERSION_NUMBER=`expr $LIBXML_MAJOR_VERSION \* 10000 + $LIBXML_MINOR_VERSION \* 100 + $LIBXML_MICRO_VERSION`

AC_SUBST(LIBXML_MAJOR_VERSION)
AC_SUBST(LIBXML_MINOR_VERSION)
AC_SUBST(LIBXML_MICRO_VERSION)
AC_SUBST(LIBXML_VERSION)
AC_SUBST(LIBXML_VERSION_INFO)
AC_SUBST(LIBXML_VERSION_NUMBER)

VERSION=${LIBXML_VERSION}

AM_INIT_AUTOMAKE(libxml2, $VERSION)

AC_ARG_WITH(html-dir, [  --with-html-dir=PATH path to installed docs ])

dnl Checks for programs.
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_CPP
AC_PATH_PROG(RM, rm, /bin/rm)
AC_PATH_PROG(MV, mv, /bin/mv)
AC_PATH_PROG(TAR, tar, /bin/tar)

dnl Make sure we have an ANSI compiler
AM_C_PROTOTYPES
test "x$U" != "x" && AC_MSG_ERROR(Compiler not ANSI compliant)

AM_PROG_LIBTOOL

AM_MAINTAINER_MODE

dnl Checks for zlib library.
_cppflags="${CPPFLAGS}"
_ldflags="${LDFLAGS}"

AC_ARG_WITH(zlib,
[  --with-zlib[=DIR]       use libz in DIR],[
  if test "$withval" != "no" -a "$withval" != "yes"; then
    Z_DIR=$withval
    CPPFLAGS="${CPPFLAGS} -I$withval/include"
    LDFLAGS="${LDFLAGS} -L$withval/lib"
  fi
])

AC_CHECK_HEADERS(zlib.h,
    AC_CHECK_LIB(z, gzread,[
	AC_DEFINE(HAVE_LIBZ)
        if test "x${Z_DIR}" != "x"; then
            Z_CFLAGS="-I${Z_DIR}/include"
            Z_LIBS="-L${Z_DIR}/lib -lz"
        else
            Z_LIBS="-lz"
        fi]))
AC_SUBST(Z_CFLAGS)
AC_SUBST(Z_LIBS)

CPPFLAGS=${_cppflags}
LDFLAGS=${_ldflags}

dnl Checks for header files.
AC_HEADER_DIRENT
AC_HEADER_STDC
AC_CHECK_HEADERS(fcntl.h unistd.h ctype.h dirent.h errno.h malloc.h)
AC_CHECK_HEADERS(stdarg.h sys/stat.h sys/types.h time.h)
AC_CHECK_HEADERS(ieeefp.h nan.h math.h fp_class.h float.h)
AC_CHECK_HEADERS(stdlib.h sys/socket.h netinet/in.h arpa/inet.h)
AC_CHECK_HEADERS(netdb.h sys/time.h sys/select.h sys/mman.h)

dnl Specific dir for HTML output ?
if test "x$with_html_dir" = "x" ; then
  HTML_DIR='${datadir}/gtk-doc/html'
else
  HTML_DIR=$with_html_dir
fi

AC_SUBST(HTML_DIR)

AC_ARG_ENABLE(corba,
[  --enable-corba           Add Corba support (default)])

dnl
dnl Corba is enabled by default
dnl
if test "$enable_corba" = "no" ; then
   CORBA_CFLAGS="-DWITHOUT_CORBA"
fi
AC_SUBST(CORBA_CFLAGS)

dnl Checks for library functions.
AC_FUNC_STRFTIME
AC_CHECK_FUNCS(strdup strndup strerror snprintf)
AC_CHECK_FUNCS(finite isnand fp_class class fpclass)
AC_CHECK_FUNCS(strftime localtime)

dnl Checks for inet libraries:
AC_CHECK_FUNC(gethostent, , AC_CHECK_LIB(nsl, gethostent))
AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
AC_CHECK_FUNC(connect, , AC_CHECK_LIB(inet, connect))

dnl Determine what socket length (socklen_t) data type is
AC_MSG_CHECKING([for type of socket length (socklen_t)])
AC_TRY_COMPILE2([
#include <stddef.h>
#include <sys/types.h>
#include <sys/socket.h>],[
(void)getsockopt (1, 1, 1, NULL, (socklen_t *)NULL)],[
  AC_MSG_RESULT(socklen_t *)
  SOCKLEN_T=socklen_t],[
  AC_TRY_COMPILE2([
#include <stddef.h>
#include <sys/types.h>
#include <sys/socket.h>],[
(void)getsockopt (1, 1, 1, NULL, (size_t *)NULL)],[
    AC_MSG_RESULT(size_t *)
    SOCKLEN_T=size_t],[
    AC_TRY_COMPILE2([
#include <stddef.h>
#include <sys/types.h>
#include <sys/socket.h>],[
(void)getsockopt (1, 1, 1, NULL, (int *)NULL)],[
      AC_MSG_RESULT(int *)
      SOCKLEN_T=int],[
      AC_MSG_WARN(could not determine)])])])
AC_DEFINE_UNQUOTED(SOCKLEN_T, $SOCKLEN_T)

dnl Checks for isnan in libm if not in libc
AC_CHECK_FUNC(isnan, , AC_CHECK_LIB(m, isnan,
  [M_LIBS="-lm"; AC_DEFINE(HAVE_ISNAN)]))

AC_CHECK_FUNC(isinf, , AC_CHECK_LIB(m, isinf,
  [M_LIBS="-lm"; AC_DEFINE(HAVE_ISINF)]))

XML_LIBDIR='-L${libdir}'
XML_INCLUDEDIR='-I${includedir}/libxml -I${includedir}'
XML_LIBS="-lxml $Z_LIBS $M_LIBS $LIBS"

dnl
dnl Extra flags
dnl
XML_CFLAGS=""

dnl
dnl Workaround for HP native compiler
dnl http://bugs.gnome.org/db/31/3163.html
dnl
if test "${GCC}" != "yes" ; then
    case "${host}" in
          *-*-hpux* )
	       CFLAGS="${CFLAGS} -Wp,-H30000"
	       ;;
    esac
fi
case ${host} in
    *-*-solaris*)
        XML_LIBDIR="${XML_LIBDIR} -R${libdir}"
        ;;
esac



dnl
dnl Use buffers for content
dnl

AC_ARG_WITH(buffers, [  --with-buffers          Use buffers for node content])
if test "$with_buffers" = "yes" ; then
    CFLAGS="${CFLAGS} -DXML_USE_BUFFER_CONTENT"
    XML_CFLAGS="${XML_CFLAGS}  -DXML_USE_BUFFER_CONTENT"
fi

dnl
dnl Tester makes use of readline if present
dnl
_cppflags="${CPPFLAGS}"
_ldflags="${LDFLAGS}"

AC_ARG_WITH(readline,
[  --with-readline=DIR     use readline in DIR],[
  if test "$withval" != "no" -a "$withval" != "yes"; then
    RDL_DIR=$withval
    CPPFLAGS="${CPPFLAGS} -I$withval/include"
    LDFLAGS="${LDFLAGS} -L$withval/lib"
  fi
])

dnl check for terminal library. this is a very cool solution
dnl from octave's configure.in
unset tcap
for termlib in ncurses curses termcap terminfo termlib; do
    AC_CHECK_LIB(${termlib}, tputs, [tcap="-l$termlib"])
    test -n "$tcap" && break
done

AC_CHECK_HEADER(readline/history.h,
    AC_CHECK_LIB(history, append_history,[
       RDL_LIBS="-lhistory"
       AC_DEFINE(HAVE_LIBHISTORY)]))
AC_CHECK_HEADER(readline/readline.h,
    AC_CHECK_LIB(readline, readline,[
       RDL_LIBS="-lreadline $RDL_LIBS $tcap"
       AC_DEFINE(HAVE_LIBREADLINE)], , $tcap))
if test -n "$RDL_DIR" -a -n "$RDL_LIBS"; then
    CPPFLAGS="$CPPFLAGS -I${RDL_DIR}/include"
    RDL_LIBS="-L${RDL_DIR}/lib $RDL_LIBS"
else
    CPPFLAGS=${_cppflags}
fi
LDFLAGS=${_ldflags}

AC_SUBST(RDL_LIBS)

dnl
dnl Aloow to disable various pieces
dnl

AC_ARG_WITH(ftp, [  --with-ftp              Add the FTP support (on)])
if test "$with_ftp" = "no" ; then
    echo Disabling FTP support
    WITH_FTP=0
    FTP_OBJ=
else    
    WITH_FTP=1
    FTP_OBJ=nanoftp.o
fi
AC_SUBST(WITH_FTP)
AC_SUBST(FTP_OBJ)

AC_ARG_WITH(http, [  --with-http             Add the HTTP support (on)])
if test "$with_http" = "no" ; then
    echo Disabling HTTP support
    WITH_HTTP=0
    HTTP_OBJ=
else    
    WITH_HTTP=1
    HTTP_OBJ=nanohttp.o
fi
AC_SUBST(WITH_HTTP)
AC_SUBST(HTTP_OBJ)

AC_ARG_WITH(html, [  --with-html             Add the HTML support (on)])
if test "$with_html" = "no" ; then
    echo Disabling HTML support
    WITH_HTML=0
    HTML_OBJ=
else    
    WITH_HTML=1
    HTML_OBJ="HTMLparser.o HTMLtree.o"
fi
AC_SUBST(WITH_HTML)
AC_SUBST(HTML_OBJ)

AC_ARG_WITH(xpath, [  --with-xpath            Add the XPATH support (on)])
if test "$with_xpath" = "no" ; then
    echo Disabling XPATH support
    with_xptr="no"
    WITH_XPATH=0
    XPATH_OBJ=
else    
    WITH_XPATH=1
    XPATH_OBJ=xpath.o
fi
AC_SUBST(WITH_XPATH)
AC_SUBST(XPATH_OBJ)

AC_ARG_WITH(xptr, [  --with-xptr             Add the XPointer support (on)])
if test "$with_xptr" = "no" ; then
    echo Disabling XPointer support
    WITH_XPTR=0
    XPTR_OBJ=
else    
    WITH_XPTR=1
    XPTR_OBJ=xpointer.o
fi
AC_SUBST(WITH_XPTR)
AC_SUBST(XPTR_OBJ)

AC_ARG_WITH(iconv, [  --with-iconv            Add the ICONV support (on)])
if test "$with_iconv" = "no" ; then
    echo Disabling ICONV support
    WITH_ICONV=0
else    
    AC_CHECK_FUNCS(iconv)
    if test "$have_iconv" != "" ; then
        echo Iconv support not found
        WITH_ICONV=0
    else
        WITH_ICONV=1
    fi
fi  
AC_SUBST(WITH_ICONV)

AC_ARG_WITH(debug, [  --with-debug            Add the debugging module (on)])
if test "$with_debug" = "no" ; then
    echo Disabling DEBUG support
    WITH_DEBUG=0
    DEBUG_OBJ=
else    
    WITH_DEBUG=1
    DEBUG_OBJ=debugXML.o
fi
AC_SUBST(WITH_DEBUG)
AC_SUBST(DEBUG_OBJ)

AC_ARG_WITH(mem_debug, [  --with-mem-debug        Add the memory debugging module (off)])
if test "$with_mem_debug" = "yes" ; then
    echo Enabling memory debug support
    WITH_MEM_DEBUG=1
else    
    WITH_MEM_DEBUG=0
fi
AC_SUBST(WITH_MEM_DEBUG)

AC_SUBST(CFLAGS)
AC_SUBST(XML_CFLAGS)

AC_SUBST(XML_LIBDIR)
AC_SUBST(XML_LIBS)
AC_SUBST(XML_INCLUDEDIR)
AC_SUBST(HTML_DIR)
AC_SUBST(HAVE_ISNAN)
AC_SUBST(HAVE_ISINF)

AC_SUBST(M_LIBS)
AC_SUBST(RDL_LIBS)

dnl
dnl create the libxml and include links needed to get dependencies right
dnl
if test ! -d $srcdir/include/libxml
then
    if test ! -d $srcdir/include
    then
        rm -f $srcdir/include
        mkdir $srcdir/include
    fi
    rm -f $srcdir/libxml
    (cd $srcdir/include ; ln -s .. libxml)
fi
if test ! -r $srcdir/libxml
then
    (cd $srcdir ; ln -s include/libxml libxml)
fi
if test ! -r include/libxml
then
    if test ! -d include
    then
        rm -f include
        mkdir include
    fi
    (cd include ; ln -s ../libxml libxml)
fi
if test ! -r libxml
then
    rm -rf libxml
    ln -s $srcdir/include/libxml libxml
fi

AC_OUTPUT(libxml.spec Makefile include/Makefile doc/Makefile example/Makefile libxml/xmlversion.h xml-config libxml-2.0.pc)