cee61fa1d00d2b0c714bc7ac1a7c4dff700d2ae6
[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=29
10 PACKAGE=libxslt
11 LIBEXSLT_MAJOR_VERSION=0
12 LIBEXSLT_MINOR_VERSION=7
13 LIBEXSLT_MICRO_VERSION=19
14 LIBXML_REQUIRED_VERSION=2.5.6
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 Checking the standard string functions availability
125 AC_CHECK_FUNCS(printf sprintf fprintf snprintf vfprintf vsprintf vsnprintf sscanf,,
126                NEED_TRIO=1)
127 dnl
128 dnl Check for trio string functions
129 dnl
130
131 if test "${NEED_TRIO}" = "1" ; then
132     echo Reusing trio library for string functions
133     WITH_TRIO=1
134 else    
135     WITH_TRIO=0
136 fi
137 AC_SUBST(WITH_TRIO)
138
139 dnl
140 dnl Perl is just needed for generating some data for XSLtmark
141 dnl
142
143 AC_CHECK_PROG(PERL, perl, perl, false)
144 AM_CONDITIONAL(WITH_PERL, test "$PERL" != "false")
145
146 dnl
147 dnl check for python
148 dnl
149
150 PYTHON=
151 PYTHON_VERSION=
152 PYTHON_INCLUDES=
153 PYTHON_SITE_PACKAGES=
154 AC_ARG_WITH(python, [  --with-python[=DIR]    Build Python bindings if found])
155 if test "$with_python" != "no" ; then
156     if test -x "$with_python/bin/python"
157     then
158         echo Found python in $with_python/bin/python
159         PYTHON="$with_python/bin/python"
160     else
161         if test -x "$with_python"
162         then
163             echo Found python in $with_python
164             PYTHON="$with_python"
165         else
166             AC_PATH_PROG(PYTHON, python python2.3 python2.2 python2.1 python2.0 python1.6 python1.5)
167         fi
168     fi
169     if test "$PYTHON" != ""
170     then
171         PYTHON_VERSION=`$PYTHON -c "import sys; print sys.version[[0:3]]"`
172         echo Found Python version $PYTHON_VERSION
173         LIBXML2_PYTHON=`python -c "try : import libxml2 ; print 1
174 except: print 0"`
175         if test "$LIBXML2_PYTHON" = "1"
176         then
177             echo Found libxml2-python module
178         else
179             echo Warning: Missing libxml2-python
180         fi
181     fi
182     if test "$PYTHON_VERSION" != ""
183     then
184         if test -r $with_python/include/python$PYTHON_VERSION/Python.h -a \
185            -d $with_python/lib/python$PYTHON_VERSION/site-packages
186         then
187             PYTHON_INCLUDES=$with_python/include/python$PYTHON_VERSION
188             PYTHON_SITE_PACKAGES=$with_python/lib/python$PYTHON_VERSION/site-packages
189         else
190             if test -r $prefix/include/python$PYTHON_VERSION/Python.h
191             then
192                 PYTHON_INCLUDES='$(prefix)/include/python$(PYTHON_VERSION)'
193                 PYTHON_SITE_PACKAGES='$(libdir)/python$(PYTHON_VERSION)/site-packages'
194             else
195                 if test -r /usr/include/python$PYTHON_VERSION/Python.h
196                 then
197                     PYTHON_INCLUDES=/usr/include/python$PYTHON_VERSION
198                     PYTHON_SITE_PACKAGES='$(libdir)/python$(PYTHON_VERSION)/site-packages'
199                 else
200                     echo could not find python$PYTHON_VERSION/Python.h
201                 fi
202             fi
203             if ! test -d "$PYTHON_SITE_PACKAGES"
204             then
205                     PYTHON_SITE_PACKAGES=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_python_lib()"`
206             fi
207         fi
208     fi
209 fi
210 AM_CONDITIONAL(WITH_PYTHON, test "$PYTHON_INCLUDES" != "")
211 if test "$PYTHON_INCLUDES" != ""
212 then
213     PYTHON_SUBDIR=python
214 else
215     PYTHON_SUBDIR=
216 fi
217 AC_SUBST(PYTHON_SUBDIR)
218
219 dnl
220 dnl Debug for DV (-Wunreachable-code)
221 dnl
222 if test "${LOGNAME}" = "veillard" -a "`pwd`" = "/u/veillard/XSLT" ; then
223     if test "${with_mem_debug}" = "" ; then
224         with_mem_debug="yes"
225     fi
226     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 "
227     STATIC_BINARIES="-static"
228 else
229     STATIC_BINARIES=
230 fi
231 AC_SUBST(STATIC_BINARIES)
232
233 AC_ARG_WITH(debug, [  --with-debug            Add the debugging code (on)])
234 if test "$with_debug" = "no" ; then
235     echo Disabling debug support
236     WITH_XSLT_DEBUG=0
237 else    
238     WITH_XSLT_DEBUG=1
239 fi
240 AC_SUBST(WITH_XSLT_DEBUG)
241
242 AC_ARG_WITH(mem_debug, [  --with-mem-debug        Add the memory debugging module (off)])
243 if test "$with_mem_debug" = "yes" ; then
244     echo Enabling memory debug support
245     WITH_MEM_DEBUG=1
246 else    
247     WITH_MEM_DEBUG=0
248 fi
249 AC_SUBST(WITH_MEM_DEBUG)
250
251 dnl 
252 dnl Is debugger support requested
253 dnl
254 AC_ARG_WITH(with_debugger, [  --with-debugger        Add the debugging support (on)])
255 if test "$with_debugger" = "no" ; then
256     echo Disabling debugger
257     WITH_DEBUGGER=0
258 else
259     echo Enabling debugger
260     WITH_DEBUGGER=1
261     AC_DEFINE(WITH_DEBUGGER)
262 fi
263 AM_CONDITIONAL(WITH_DEBUGGER, test "${WITH_DEBUGGER}" = "1")
264 AC_SUBST(WITH_DEBUGGER)
265
266 dnl
267 dnl The following new parameters were added to offer
268 dnl the ability to specify the location of the libxml
269 dnl library during linking and compilation.
270 dnl
271 dnl original work - Mathieu Lacage 30/03/2000
272 dnl some tweaking - David Härdeman 30/10/2001
273 dnl
274
275 LIBXML_CONFIG_PREFIX=""
276 LIBXML_SRC=""
277
278 AC_ARG_WITH(libxml-prefix,
279         [  --with-libxml-prefix=[PFX]           Specify location of libxml config],
280         LIBXML_CONFIG_PREFIX=$withval
281 )
282         
283 AC_ARG_WITH(libxml-include-prefix,
284         [  --with-libxml-include-prefix=[PFX]   Specify location of libxml headers],
285         LIBXML_CFLAGS="-I$withval"
286 )
287
288 AC_ARG_WITH(libxml-libs-prefix,
289         [  --with-libxml-libs-prefix=[PFX]      Specify location of libxml libs],
290         LIBXML_LIBS="-L$withval"
291 )
292
293 AC_ARG_WITH(libxml-src,
294         [  --with-libxml-src=[DIR]              For libxml thats not installed yet (sets all three above)],
295         LIBXML_SRC="$withval"
296 )
297
298 dnl
299 dnl where is xml2-config
300 dnl
301
302 AC_SUBST(LIBXML_REQUIRED_VERSION)
303 AC_MSG_CHECKING(for libxml libraries >= $LIBXML_REQUIRED_VERSION) 
304 if test "x$LIBXML_CONFIG_PREFIX" != "x"
305 then
306         XML_CONFIG=${LIBXML_CONFIG_PREFIX}/bin/xml2-config
307 else
308         XML_CONFIG=xml2-config
309 fi
310
311 dnl
312 dnl imported from libxml2, c.f. #77827 
313 dnl
314 if test "${GCC}" != "yes" ; then
315     case "${host}" in
316           *-*-hpux* )
317                CFLAGS="${CFLAGS} -Wp,-H30000"
318                ;;
319           *-dec-osf* )
320                CFLAGS="${CFLAGS} -ieee"
321                ;;
322     esac
323 else
324     CFLAGS="${CFLAGS} -Wall"
325     case "${host}" in
326           alpha*-*-linux* )
327                CFLAGS="${CFLAGS} -mieee"
328                ;;
329           alpha*-*-osf* )
330                CFLAGS="${CFLAGS} -mieee"
331                ;;
332     esac
333 fi
334
335 dnl
336 dnl Override other variables if LIBXML_SRC is set
337 dnl
338
339 if test "x$LIBXML_SRC" != "x"
340 then
341         CWD=`pwd`
342         if cd $LIBXML_SRC
343         then
344                 SRC_DIR=`pwd`
345                 XML_CONFIG=${SRC_DIR}/xml2-config
346                 LIBXML_CFLAGS="-I${SRC_DIR}/include"
347                 LIBXML_LIBS="-L${SRC_DIR}"
348                 cd $CWD
349         else
350                 AC_MSG_ERROR([libxml source dir not found (${LIBXML_SRC}), typo?])
351         fi
352 fi
353
354 dnl
355 dnl make sure xml2-config is executable,
356 dnl test version and init our variables
357 dnl
358
359 AC_DEFUN(VERSION_TO_NUMBER,
360 [`$1 | sed -e 's/libxml //' | awk 'BEGIN { FS = "."; } { printf "%d", ([$]1 * 1000 + [$]2) * 1000 + [$]3;}'`])
361 if ${XML_CONFIG} --libs print > /dev/null 2>&1
362 then
363         XMLVERS=`$XML_CONFIG --version`
364         if test VERSION_TO_NUMBER(echo $XMLVERS) -ge VERSION_TO_NUMBER(echo $LIBXML_REQUIRED_VERSION)
365         then
366                 LIBXML_LIBS="$LIBXML_LIBS `$XML_CONFIG --libs`"
367                 LIBXML_CFLAGS="$LIBXML_CFLAGS `$XML_CONFIG --cflags`"
368                 AC_MSG_RESULT($XMLVERS found)
369         else
370                 AC_MSG_ERROR(Version $XMLVERS found. You need at least libxml2 $LIBXML_REQUIRED_VERSION for this version of libxslt)
371         fi
372 else
373         AC_MSG_ERROR([Could not find libxml2 anywhere, check ftp://xmlsoft.org/.])
374 fi
375
376
377 AC_SUBST(CFLAGS)
378 AC_SUBST(CPPFLAGS)
379 AC_SUBST(LDFLAGS)
380
381 #
382 # Some fun with prelinking :-(
383 # try to check if there is already an installed shared lib of the same level
384 #
385 INSTALLED_XSLT_LIB=""
386 if test -d $prefix
387 then
388     shared_xslt_lib="$prefix/lib/libxslt.so.$LIBXSLT_MAJOR_VERSION"
389     shared_xslt_la="$prefix/lib/libxslt.la"
390     if test -f $shared_xslt_lib -a -f $shared_xslt_la
391     then
392         INSTALLED_XSLT_LIB="-L$libdir -lxslt"
393     fi
394 fi
395 AC_SUBST(INSTALLED_XSLT_LIB)
396
397 dnl
398 dnl In build tree I use a static version with memory debug enabled
399 dnl
400 if test "${LOGNAME}" = "veillard" -a "`pwd`" = "/u/veillard/XSLT" ; then
401     LIBXML_LIBS="../../XML/.libs/libxml2.a -lpthread -lz"
402     DV_LINK="1"
403     XSLTPROCDV="xsltproc.dv"
404     INSTALLED_XSLT_LIB=""
405    # PYTHONSODV="libxsltmod.so.dv"
406 fi
407
408 AC_SUBST(XSLTPROCDV)
409 AC_SUBST(PYTHONSODV)
410 AC_SUBST(XML_CONFIG)
411 AC_SUBST(LIBXML_LIBS)
412 AC_SUBST(LIBXML_CFLAGS)
413 AC_SUBST(PYTHON)
414 AC_SUBST(PYTHON_VERSION)
415 AC_SUBST(PYTHON_INCLUDES)
416 AC_SUBST(PYTHON_SITE_PACKAGES)
417
418 XSLT_LIBDIR='-L${libdir}'
419
420 XSLT_INCLUDEDIR='-I${includedir}'
421 XSLT_LIBS="-lxslt $LIBXML_LIBS $M_LIBS"
422 EXTRA_LIBS="$LIBXML_LIBS $M_LIBS"
423
424 AC_SUBST(XSLT_LIBDIR)
425 AC_SUBST(XSLT_INCLUDEDIR)
426 AC_SUBST(EXTRA_LIBS)
427 AC_SUBST(M_LIBS)
428 AC_SUBST(XSLT_LIBS)
429
430 dnl for the spec file
431 RELDATE=`date +'%a %b %e %Y'`
432 AC_SUBST(RELDATE)
433
434 rm -f COPYING.LIB COPYING
435 ln -s Copyright COPYING
436
437
438 AC_OUTPUT([
439 Makefile
440 libxslt.pc
441 libxslt/Makefile
442 libxslt/xsltconfig.h
443 libxslt/xsltwin32config.h
444 breakpoint/Makefile
445 libexslt/Makefile
446 libexslt/exsltconfig.h
447 xsltproc/Makefile
448 python/Makefile
449 python/tests/Makefile
450 tests/Makefile
451 tests/docs/Makefile
452 tests/REC1/Makefile
453 tests/REC2/Makefile
454 tests/REC/Makefile
455 tests/general/Makefile
456 tests/reports/Makefile
457 tests/extensions/Makefile
458 tests/namespaces/Makefile
459 tests/keys/Makefile
460 tests/numbers/Makefile
461 tests/documents/Makefile
462 tests/xmlspec/Makefile
463 tests/multiple/Makefile
464 tests/XSLTMark/Makefile
465 tests/docbook/Makefile
466 tests/exslt/Makefile
467 tests/exslt/common/Makefile
468 tests/exslt/functions/Makefile
469 tests/exslt/math/Makefile
470 tests/exslt/sets/Makefile
471 tests/exslt/strings/Makefile
472 tests/exslt/date/Makefile
473 doc/Makefile
474 xslt-config
475 libxslt.spec
476 ])