preparing 1.0.14 updated rebuilt implemented the IN_LIBXSLT and
[platform/upstream/libxslt.git] / configure.in
1 AC_INIT(libxslt/xslt.c)
2
3 dnl
4 dnl libxslt is the main part of the package
5 dnl libexslt is an extension
6 dnl
7 LIBXSLT_MAJOR_VERSION=1
8 LIBXSLT_MINOR_VERSION=0
9 LIBXSLT_MICRO_VERSION=14
10 PACKAGE=libxslt
11 LIBEXSLT_MAJOR_VERSION=0
12 LIBEXSLT_MINOR_VERSION=7
13 LIBEXSLT_MICRO_VERSION=5
14 LIBXML_REQUIRED_VERSION=2.4.17
15
16
17 LIBXSLT_VERSION=$LIBXSLT_MAJOR_VERSION.$LIBXSLT_MINOR_VERSION.$LIBXSLT_MICRO_VERSION
18 LIBXSLT_VERSION_INFO=`expr $LIBXSLT_MAJOR_VERSION + $LIBXSLT_MINOR_VERSION`:$LIBXSLT_MICRO_VERSION:$LIBXSLT_MINOR_VERSION
19
20 LIBXSLT_VERSION_NUMBER=`expr $LIBXSLT_MAJOR_VERSION \* 10000 + $LIBXSLT_MINOR_VERSION \* 100 + $LIBXSLT_MICRO_VERSION`
21
22 AC_SUBST(LIBXSLT_MAJOR_VERSION)
23 AC_SUBST(LIBXSLT_MINOR_VERSION)
24 AC_SUBST(LIBXSLT_MICRO_VERSION)
25 AC_SUBST(LIBXSLT_VERSION)
26 AC_SUBST(LIBXSLT_VERSION_INFO)
27 AC_SUBST(LIBXSLT_VERSION_NUMBER)
28
29 dnl
30 dnl libexslt is an extension library
31 dnl
32
33 LIBEXSLT_VERSION=$LIBEXSLT_MAJOR_VERSION.$LIBEXSLT_MINOR_VERSION.$LIBEXSLT_MICRO_VERSION
34 LIBEXSLT_VERSION_INFO=`expr $LIBEXSLT_MAJOR_VERSION + $LIBEXSLT_MINOR_VERSION`:$LIBEXSLT_MICRO_VERSION:$LIBEXSLT_MINOR_VERSION
35
36 LIBEXSLT_VERSION_NUMBER=`expr $LIBEXSLT_MAJOR_VERSION \* 10000 + $LIBEXSLT_MINOR_VERSION \* 100 + $LIBEXSLT_MICRO_VERSION`
37
38 AC_SUBST(LIBEXSLT_MAJOR_VERSION)
39 AC_SUBST(LIBEXSLT_MINOR_VERSION)
40 AC_SUBST(LIBEXSLT_MICRO_VERSION)
41 AC_SUBST(LIBEXSLT_VERSION)
42 AC_SUBST(LIBEXSLT_VERSION_INFO)
43 AC_SUBST(LIBEXSLT_VERSION_NUMBER)
44
45 dnl
46 dnl libxsltbreakpoint is a compatibility obsoleted library
47 dnl it's blocked at 1.0.8 and should be removed in default build in the
48 dnl future
49 dnl
50
51 LIBXSLTBREAK_MAJOR_VERSION=1
52 LIBXSLTBREAK_MINOR_VERSION=0
53 LIBXSLTBREAK_MICRO_VERSION=8
54
55 LIBXSLTBREAK_VERSION=$LIBXSLTBREAK_MAJOR_VERSION.$LIBXSLTBREAK_MINOR_VERSION.$LIBXSLTBREAK_MICRO_VERSION
56 LIBXSLTBREAK_VERSION_INFO=`expr $LIBXSLTBREAK_MAJOR_VERSION + $LIBXSLTBREAK_MINOR_VERSION`:$LIBXSLTBREAK_MICRO_VERSION:$LIBXSLTBREAK_MINOR_VERSION
57
58 LIBXSLTBREAK_VERSION_NUMBER=`expr $LIBXSLTBREAK_MAJOR_VERSION \* 10000 + $LIBXSLTBREAK_MINOR_VERSION \* 100 + $LIBXSLTBREAK_MICRO_VERSION`
59
60 AC_SUBST(LIBXSLTBREAK_MAJOR_VERSION)
61 AC_SUBST(LIBXSLTBREAK_MINOR_VERSION)
62 AC_SUBST(LIBXSLTBREAK_MICRO_VERSION)
63 AC_SUBST(LIBXSLTBREAK_VERSION)
64 AC_SUBST(LIBXSLTBREAK_VERSION_INFO)
65 AC_SUBST(LIBXSLTBREAK_VERSION_NUMBER)
66
67
68
69
70 VERSION=${LIBXSLT_VERSION}
71
72 AM_CONFIG_HEADER(config.h)
73 AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
74 AM_MAINTAINER_MODE
75
76 AC_ARG_WITH(html-dir, [  --with-html-dir=PATH path to installed docs ])
77
78 dnl
79 dnl Specific dir for HTML output ?
80 dnl
81
82 if test "x$with_html_dir" = "x" ; then
83   HTML_DIR='$(prefix)/doc'
84 else
85   HTML_DIR=$with_html_dir
86 fi
87 AC_SUBST(HTML_DIR)
88
89 dnl
90 dnl Check the environment
91 dnl
92
93 AC_ISC_POSIX
94 AC_PROG_CC
95 AC_STDC_HEADERS
96 AC_ARG_PROGRAM
97 AM_PROG_LIBTOOL
98
99 dnl
100 dnl Math detection
101 dnl
102
103 AC_CHECK_HEADERS(sys/types.h sys/time.h stdlib.h unistd.h string.h)
104 AC_CHECK_HEADERS(ieeefp.h nan.h math.h fp_class.h float.h ansidecl.h)
105 AC_CHECK_HEADERS(sys/timeb.h time.h sys/stat.h stdarg.h)
106 AC_CHECK_FUNCS(stat _stat)
107 AC_CHECK_FUNC(isnan, , AC_CHECK_LIB(m, isnan,
108   [M_LIBS="-lm"; AC_DEFINE(HAVE_ISNAN)]))
109
110 AC_CHECK_FUNC(isinf, , AC_CHECK_LIB(m, isinf,
111   [M_LIBS="-lm"; AC_DEFINE(HAVE_ISINF)]))
112
113 AC_CHECK_FUNC(pow, , AC_CHECK_LIB(m, pow,
114   [M_LIBS="-lm"; AC_DEFINE(HAVE_POW)]))
115
116 AC_CHECK_FUNC(floor, , AC_CHECK_LIB(m, floor,
117   [M_LIBS="-lm"; AC_DEFINE(HAVE_FLOOR)]))
118
119 AC_CHECK_FUNC(fabs, , AC_CHECK_LIB(m, fabs,
120   [M_LIBS="-lm"; AC_DEFINE(HAVE_FABS)]))
121 AC_CHECK_FUNCS(gettimeofday)
122 AC_CHECK_FUNCS(mktime localtime asctime time gmtime ftime)
123
124 dnl
125 dnl Perl is just needed for generating some data for XSLtmark
126 dnl
127
128 AC_CHECK_PROG(PERL, perl, perl, false)
129 AM_CONDITIONAL(WITH_PERL, test "$PERL" != "false")
130
131 dnl
132 dnl check for python
133 dnl
134
135 PYTHON=
136 PYTHON_VERSION=
137 PYTHON_INCLUDES=
138 PYTHON_SITE_PACKAGES=
139 AC_ARG_WITH(python, [  --with-python[=DIR]    Build Python bindings if found])
140 if test "$with_python" != "no" ; then
141     if test -x "$with_python/bin/python"
142     then
143         echo Found python in $with_python/bin/python
144         PYTHON="$with_python/bin/python"
145     else
146         AC_PATH_PROG(PYTHON, python python2.2 python2.1 python2.0 python1.6 python1.5)
147     fi
148     if test "$PYTHON" != ""
149     then
150         PYTHON_VERSION=`$PYTHON -c "import sys; print sys.version[[0:3]]"`
151         echo Found Python version $PYTHON_VERSION
152         LIBXML2_PYTHON=`python -c "try : import libxml2 ; print 1
153 except: print 0"`
154         if test "$LIBXML2_PYTHON" = "1"
155         then
156             echo Found libxml2-python module
157         else
158             echo Missing libxml2-python
159         fi
160     fi
161     if test "$PYTHON_VERSION" != "" -a "$LIBXML2_PYTHON" = "1"
162     then
163         if test -r $with_python/include/python$PYTHON_VERSION/Python.h -a \
164            -d $with_python/lib/python$PYTHON_VERSION/site-packages
165         then
166             PYTHON_INCLUDES=$with_python/include/python$PYTHON_VERSION
167             PYTHON_SITE_PACKAGES=$with_python/lib/python$PYTHON_VERSION/site-packages
168         else
169             if test -r $prefix/include/python$PYTHON_VERSION/Python.h
170             then
171                 PYTHON_INCLUDES='$(prefix)/include/python$(PYTHON_VERSION)'
172                 PYTHON_SITE_PACKAGES='$(prefix)/lib/python$(PYTHON_VERSION)/site-packages'
173             else
174                 if test -r /usr/include/python$PYTHON_VERSION/Python.h
175                 then
176                     PYTHON_INCLUDES=/usr/include/python$PYTHON_VERSION
177                     PYTHON_SITE_PACKAGES='$(prefix)/lib/python$(PYTHON_VERSION)/site-packages'
178                 else
179                     echo could not find python$PYTHON_VERSION/Python.h
180                 fi
181             fi
182         fi
183     fi
184 fi
185 AM_CONDITIONAL(WITH_PYTHON, test "$PYTHON_INCLUDES" != "")
186
187 dnl
188 dnl Debug for DV (-Wunreachable-code)
189 dnl
190 if test "${LOGNAME}" = "veillard" -a "`pwd`" = "/u/veillard/XSLT" ; then
191     if test "${with_mem_debug}" = "" ; then
192         with_mem_debug="yes"
193     fi
194     CFLAGS="-Wall -g -O -ansi -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 "
195 fi
196
197 AC_ARG_WITH(debug, [  --with-debug            Add the debugging code (on)])
198 if test "$with_debug" = "no" ; then
199     echo Disabling debug support
200     WITH_XSLT_DEBUG=0
201 else    
202     WITH_XSLT_DEBUG=1
203 fi
204 AC_SUBST(WITH_XSLT_DEBUG)
205
206 AC_ARG_WITH(mem_debug, [  --with-mem-debug        Add the memory debugging module (off)])
207 if test "$with_mem_debug" = "yes" ; then
208     echo Enabling memory debug support
209     WITH_MEM_DEBUG=1
210 else    
211     WITH_MEM_DEBUG=0
212 fi
213 AC_SUBST(WITH_MEM_DEBUG)
214
215 dnl 
216 dnl Is debugger support requested
217 dnl
218 AC_ARG_WITH(with_debugger, [  --with-debugger        Add the debugging support (on)])
219 if test "$with_debugger" = "no" ; then
220     echo Disabling debugger
221     WITH_DEBUGGER=0
222 else
223     echo Enabling debugger
224     WITH_DEBUGGER=1
225     AC_DEFINE(WITH_DEBUGGER)
226 fi
227 AM_CONDITIONAL(WITH_DEBUGGER, test "${WITH_DEBUGGER}" = "1")
228 AC_SUBST(WITH_DEBUGGER)
229
230 dnl
231 dnl The following new parameters were added to offer
232 dnl the ability to specify the location of the libxml
233 dnl library during linking and compilation.
234 dnl
235 dnl original work - Mathieu Lacage 30/03/2000
236 dnl some tweaking - David Härdeman 30/10/2001
237 dnl
238
239 LIBXML_CONFIG_PREFIX=""
240 LIBXML_SRC=""
241
242 AC_ARG_WITH(libxml-prefix,
243         [  --with-libxml-prefix=[PFX]           Specify location of libxml config],
244         LIBXML_CONFIG_PREFIX=$withval
245 )
246         
247 AC_ARG_WITH(libxml-include-prefix,
248         [  --with-libxml-include-prefix=[PFX]   Specify location of libxml headers],
249         LIBXML_CFLAGS="-I$withval"
250 )
251
252 AC_ARG_WITH(libxml-libs-prefix,
253         [  --with-libxml-libs-prefix=[PFX]      Specify location of libxml libs],
254         LIBXML_LIBS="-L$withval"
255 )
256
257 AC_ARG_WITH(libxml-src,
258         [  --with-libxml-src=[DIR]              For libxml thats not installed yet (sets all three above)],
259         LIBXML_SRC="$withval"
260 )
261
262 dnl
263 dnl where is xml2-config
264 dnl
265
266 AC_SUBST(LIBXML_REQUIRED_VERSION)
267 AC_MSG_CHECKING(for libxml libraries >= $LIBXML_REQUIRED_VERSION) 
268 if test "x$LIBXML_CONFIG_PREFIX" != "x"
269 then
270         XML_CONFIG=${LIBXML_CONFIG_PREFIX}/bin/xml2-config
271 else
272         XML_CONFIG=xml2-config
273 fi
274
275 dnl
276 dnl Override other variables if LIBXML_SRC is set
277 dnl
278
279 if test "x$LIBXML_SRC" != "x"
280 then
281         CWD=`pwd`
282         if cd $LIBXML_SRC
283         then
284                 SRC_DIR=`pwd`
285                 XML_CONFIG=${SRC_DIR}/xml2-config
286                 LIBXML_CFLAGS="-I${SRC_DIR}/include"
287                 LIBXML_LIBS="-L${SRC_DIR}"
288                 cd $CWD
289         else
290                 AC_MSG_ERROR([libxml source dir not found (${LIBXML_SRC}), typo?])
291         fi
292 fi
293
294 dnl
295 dnl make sure xml2-config is executable,
296 dnl test version and init our variables
297 dnl
298
299 AC_DEFUN(VERSION_TO_NUMBER,
300 [`$1 | sed -e 's/libxml //' | awk 'BEGIN { FS = "."; } { printf "%d", ([$]1 * 1000 + [$]2) * 1000 + [$]3;}'`])
301 if ${XML_CONFIG} --libs print > /dev/null 2>&1
302 then
303         XMLVERS=`$XML_CONFIG --version`
304         if test VERSION_TO_NUMBER(echo $XMLVERS) -ge VERSION_TO_NUMBER(echo $LIBXML_REQUIRED_VERSION)
305         then
306                 LIBXML_LIBS="$LIBXML_LIBS `$XML_CONFIG --libs`"
307                 LIBXML_CFLAGS="$LIBXML_CFLAGS `$XML_CONFIG --cflags`"
308                 AC_MSG_RESULT($XMLVERS found)
309         else
310                 AC_MSG_ERROR(Version $XMLVERS found. You need at least libxml2 $LIBXML_REQUIRED_VERSION for this version of libxslt)
311         fi
312 else
313         AC_MSG_ERROR([Could not find libxml2 anywhere, check ftp://xmlsoft.org/.])
314 fi
315
316
317 AC_SUBST(CFLAGS)
318 AC_SUBST(CPPFLAGS)
319 AC_SUBST(LDFLAGS)
320
321 #
322 # Some fun with prelinking :-(
323 # try to check if there is already an installed shared lib of the same level
324 #
325 INSTALLED_XSLT_LIB=""
326 if test -d $prefix
327 then
328     shared_xslt_lib="$prefix/lib/libxslt.so.$LIBXSLT_MAJOR_VERSION"
329     shared_xslt_la="$prefix/lib/libxslt.la"
330     if test -f $shared_xslt_lib -a -f $shared_xslt_la
331     then
332         INSTALLED_XSLT_LIB="-L$libdir -lxslt"
333     fi
334 fi
335 AC_SUBST(INSTALLED_XSLT_LIB)
336
337 dnl
338 dnl In build tree I use a static version with memory debug enabled
339 dnl
340 if test "${LOGNAME}" = "veillard" -a "`pwd`" = "/u/veillard/XSLT" ; then
341     LIBXML_LIBS="../../XML/.libs/libxml2.a -lz"
342     DV_LINK="1"
343     XSLTPROCDV="xsltproc.dv"
344    # PYTHONSODV="libxsltmod.so.dv"
345 fi
346
347 AC_SUBST(XSLTPROCDV)
348 AC_SUBST(PYTHONSODV)
349 AC_SUBST(XML_CONFIG)
350 AC_SUBST(LIBXML_LIBS)
351 AC_SUBST(LIBXML_CFLAGS)
352 AC_SUBST(PYTHON)
353 AC_SUBST(PYTHON_VERSION)
354 AC_SUBST(PYTHON_INCLUDES)
355 AC_SUBST(PYTHON_SITE_PACKAGES)
356
357 XSLT_LIBDIR='-L${libdir}'
358
359 case ${host} in
360     *-*-solaris*)
361         XSLT_LIBDIR="${XSLT_LIBDIR} -R${libdir}"
362         ;;
363 esac
364
365 XSLT_INCLUDEDIR='-I${includedir}'
366 XSLT_LIBS="-lxslt $LIBXML_LIBS $M_LIBS"
367 EXTRA_LIBS="$LIBXML_LIBS $M_LIBS"
368
369 AC_SUBST(XSLT_LIBDIR)
370 AC_SUBST(XSLT_INCLUDEDIR)
371 AC_SUBST(EXTRA_LIBS)
372 AC_SUBST(M_LIBS)
373 AC_SUBST(XSLT_LIBS)
374
375 rm -f rm COPYING.LIB COPYING
376 ln -s Copyright COPYING
377
378
379 AC_OUTPUT([
380 Makefile
381 libxslt.pc
382 libxslt/Makefile
383 libxslt/xsltconfig.h
384 libxslt/xsltwin32config.h
385 breakpoint/Makefile
386 libexslt/Makefile
387 libexslt/exsltconfig.h
388 xsltproc/Makefile
389 python/Makefile
390 python/tests/Makefile
391 tests/Makefile
392 tests/docs/Makefile
393 tests/REC1/Makefile
394 tests/REC2/Makefile
395 tests/REC/Makefile
396 tests/general/Makefile
397 tests/reports/Makefile
398 tests/extensions/Makefile
399 tests/namespaces/Makefile
400 tests/numbers/Makefile
401 tests/documents/Makefile
402 tests/xmlspec/Makefile
403 tests/multiple/Makefile
404 tests/XSLTMark/Makefile
405 tests/docbook/Makefile
406 tests/exslt/Makefile
407 tests/exslt/common/Makefile
408 tests/exslt/functions/Makefile
409 tests/exslt/math/Makefile
410 tests/exslt/sets/Makefile
411 tests/exslt/strings/Makefile
412 tests/exslt/date/Makefile
413 doc/Makefile
414 xslt-config
415 libxslt.spec
416 ])