dcc47c68d0d4602823f90d5c3bd3c1c1ee645096
[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=1
9 LIBXSLT_MICRO_VERSION=1
10 PACKAGE=libxslt
11 LIBEXSLT_MAJOR_VERSION=0
12 LIBEXSLT_MINOR_VERSION=8
13 LIBEXSLT_MICRO_VERSION=1
14 LIBXML_REQUIRED_VERSION=2.6.3
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 VERSION=${LIBXSLT_VERSION}
46
47 AM_CONFIG_HEADER(config.h)
48 AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
49 AM_MAINTAINER_MODE
50
51 AC_ARG_WITH(html-dir, [  --with-html-dir=PATH path to installed docs ])
52
53 dnl
54 dnl Specific dir for HTML output ?
55 dnl
56
57 if test "x$with_html_dir" = "x" ; then
58   HTML_DIR='$(prefix)/doc'
59 else
60   HTML_DIR=$with_html_dir
61 fi
62 AC_SUBST(HTML_DIR)
63
64 dnl
65 dnl Check the environment
66 dnl
67
68 AC_ISC_POSIX
69 AC_PROG_CC
70 AC_STDC_HEADERS
71 AC_ARG_PROGRAM
72 AM_PROG_LIBTOOL
73
74 dnl
75 dnl Math detection
76 dnl
77
78 AC_CHECK_HEADERS(sys/types.h sys/time.h stdlib.h unistd.h string.h)
79 AC_CHECK_HEADERS(ieeefp.h nan.h math.h fp_class.h float.h ansidecl.h)
80 AC_CHECK_HEADERS(sys/timeb.h time.h sys/stat.h stdarg.h)
81 AC_CHECK_FUNCS(stat _stat)
82 AC_CHECK_FUNC(isnan, , AC_CHECK_LIB(m, isnan,
83   [M_LIBS="-lm"; AC_DEFINE(HAVE_ISNAN)]))
84
85 AC_CHECK_FUNC(isinf, , AC_CHECK_LIB(m, isinf,
86   [M_LIBS="-lm"; AC_DEFINE(HAVE_ISINF)]))
87
88 AC_CHECK_FUNC(pow, , AC_CHECK_LIB(m, pow,
89   [M_LIBS="-lm"; AC_DEFINE(HAVE_POW)]))
90
91 AC_CHECK_FUNC(floor, , AC_CHECK_LIB(m, floor,
92   [M_LIBS="-lm"; AC_DEFINE(HAVE_FLOOR)]))
93
94 AC_CHECK_FUNC(fabs, , AC_CHECK_LIB(m, fabs,
95   [M_LIBS="-lm"; AC_DEFINE(HAVE_FABS)]))
96 AC_CHECK_FUNCS(gettimeofday)
97 AC_CHECK_FUNCS(mktime localtime asctime time gmtime ftime)
98
99 dnl Checking the standard string functions availability
100 AC_CHECK_FUNCS(printf sprintf fprintf snprintf vfprintf vsprintf vsnprintf sscanf,,
101                NEED_TRIO=1)
102 dnl
103 dnl Check for trio string functions
104 dnl
105
106 if test "${NEED_TRIO}" = "1" ; then
107     echo Reusing trio library for string functions
108     WITH_TRIO=1
109 else    
110     WITH_TRIO=0
111 fi
112 AC_SUBST(WITH_TRIO)
113
114 dnl
115 dnl Perl is just needed for generating some data for XSLtmark
116 dnl
117
118 AC_CHECK_PROG(PERL, perl, perl, false)
119 AM_CONDITIONAL(WITH_PERL, test "$PERL" != "false")
120
121 dnl
122 dnl check for python
123 dnl
124
125 PYTHON=
126 PYTHON_VERSION=
127 PYTHON_INCLUDES=
128 PYTHON_SITE_PACKAGES=
129 pythondir=
130 AC_ARG_WITH(python, [  --with-python[=DIR]    Build Python bindings if found])
131 if test "$with_python" != "no" ; then
132     if test -x "$with_python/bin/python"
133     then
134         echo Found python in $with_python/bin/python
135         PYTHON="$with_python/bin/python"
136     else
137         if test -x "$with_python"
138         then
139             echo Found python in $with_python
140             PYTHON="$with_python"
141         else
142             AC_PATH_PROG(PYTHON, python python2.3 python2.2 python2.1 python2.0 python1.6 python1.5)
143         fi
144     fi
145     if test "$PYTHON" != ""
146     then
147         PYTHON_VERSION=`$PYTHON -c "import sys; print sys.version[[0:3]]"`
148         echo Found Python version $PYTHON_VERSION
149         LIBXML2_PYTHON=`$PYTHON -c "try : import libxml2 ; print 1
150 except: print 0"`
151         if test "$LIBXML2_PYTHON" = "1"
152         then
153             echo Found libxml2-python module
154         else
155             echo Warning: Missing libxml2-python
156         fi
157     fi
158     if test "$PYTHON_VERSION" != ""
159     then
160         if test -r $with_python/include/python$PYTHON_VERSION/Python.h -a \
161            -d $with_python/lib/python$PYTHON_VERSION/site-packages
162         then
163             PYTHON_INCLUDES=$with_python/include/python$PYTHON_VERSION
164             PYTHON_SITE_PACKAGES=$with_python/lib/python$PYTHON_VERSION/site-packages
165         else
166             if test -r $prefix/include/python$PYTHON_VERSION/Python.h
167             then
168                 PYTHON_INCLUDES='$(prefix)/include/python$(PYTHON_VERSION)'
169                 PYTHON_SITE_PACKAGES='$(libdir)/python$(PYTHON_VERSION)/site-packages'
170             else
171                 if test -r /usr/include/python$PYTHON_VERSION/Python.h
172                 then
173                     PYTHON_INCLUDES=/usr/include/python$PYTHON_VERSION
174                     PYTHON_SITE_PACKAGES='$(libdir)/python$(PYTHON_VERSION)/site-packages'
175                 else
176                     echo could not find python$PYTHON_VERSION/Python.h
177                 fi
178             fi
179             if ! test -d "$PYTHON_SITE_PACKAGES"
180             then
181                     PYTHON_SITE_PACKAGES=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_python_lib()"`
182             fi
183         fi
184     fi
185     if test "$with_python" != ""
186     then
187         pythondir='$(PYTHON_SITE_PACKAGES)'
188     else
189         pythondir='$(libdir)/python${PYTHON_VERSION}/site-packages'
190     fi
191 fi
192 AM_CONDITIONAL(WITH_PYTHON, test "$PYTHON_INCLUDES" != "")
193 if test "$PYTHON_INCLUDES" != ""
194 then
195     PYTHON_SUBDIR=python
196 else
197     PYTHON_SUBDIR=
198 fi
199 AC_SUBST(pythondir)
200 AC_SUBST(PYTHON_SUBDIR)
201
202 dnl
203 dnl Debug for DV (-Wunreachable-code)
204 dnl
205 if [[ "${LOGNAME}" = "veillard" -a "`pwd`" = "/u/veillard/XSLT" ]] || \
206    [[ "${LOGNAME}" = "bill" -a "`pwd`" = "/home/bill/gnomecvs/libxslt" ]]
207    then
208     if test "${with_mem_debug}" = "" ; then
209         with_mem_debug="yes"
210     fi
211     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 "
212     STATIC_BINARIES="-static"
213 else
214     STATIC_BINARIES=
215 fi
216 AC_SUBST(STATIC_BINARIES)
217
218 AC_ARG_WITH(debug, [  --with-debug            Add the debugging code (on)])
219 if test "$with_debug" = "no" ; then
220     echo Disabling debug support
221     WITH_XSLT_DEBUG=0
222 else    
223     WITH_XSLT_DEBUG=1
224 fi
225 AC_SUBST(WITH_XSLT_DEBUG)
226
227 AC_ARG_WITH(mem_debug, [  --with-mem-debug        Add the memory debugging module (off)])
228 if test "$with_mem_debug" = "yes" ; then
229     echo Enabling memory debug support
230     WITH_MEM_DEBUG=1
231 else    
232     WITH_MEM_DEBUG=0
233 fi
234 AC_SUBST(WITH_MEM_DEBUG)
235
236 dnl 
237 dnl Is debugger support requested
238 dnl
239 AC_ARG_WITH(with_debugger, [  --with-debugger        Add the debugging support (on)])
240 if test "$with_debugger" = "no" ; then
241     echo Disabling debugger
242     WITH_DEBUGGER=0
243 else
244     echo Enabling debugger
245     WITH_DEBUGGER=1
246     AC_DEFINE(WITH_DEBUGGER)
247 fi
248 AC_SUBST(WITH_DEBUGGER)
249
250 dnl
251 dnl The following new parameters were added to offer
252 dnl the ability to specify the location of the libxml
253 dnl library during linking and compilation.
254 dnl
255 dnl original work - Mathieu Lacage 30/03/2000
256 dnl some tweaking - David Härdeman 30/10/2001
257 dnl
258
259 LIBXML_CONFIG_PREFIX=""
260 LIBXML_SRC=""
261
262 AC_ARG_WITH(libxml-prefix,
263         [  --with-libxml-prefix=[PFX]           Specify location of libxml config],
264         LIBXML_CONFIG_PREFIX=$withval
265 )
266         
267 AC_ARG_WITH(libxml-include-prefix,
268         [  --with-libxml-include-prefix=[PFX]   Specify location of libxml headers],
269         LIBXML_CFLAGS="-I$withval"
270 )
271
272 AC_ARG_WITH(libxml-libs-prefix,
273         [  --with-libxml-libs-prefix=[PFX]      Specify location of libxml libs],
274         LIBXML_LIBS="-L$withval"
275 )
276
277 AC_ARG_WITH(libxml-src,
278         [  --with-libxml-src=[DIR]              For libxml thats not installed yet (sets all three above)],
279         LIBXML_SRC="$withval"
280 )
281 AC_SUBST(LIBXML_SRC)
282
283 dnl
284 dnl where is xml2-config
285 dnl
286
287 AC_SUBST(LIBXML_REQUIRED_VERSION)
288 AC_MSG_CHECKING(for libxml libraries >= $LIBXML_REQUIRED_VERSION) 
289 if test "x$LIBXML_CONFIG_PREFIX" != "x"
290 then
291         XML_CONFIG=${LIBXML_CONFIG_PREFIX}/bin/xml2-config
292 else
293         XML_CONFIG=xml2-config
294 fi
295
296 dnl
297 dnl imported from libxml2, c.f. #77827 
298 dnl
299 if test "${GCC}" != "yes" ; then
300     case "${host}" in
301           *-*-hpux* )
302                CFLAGS="${CFLAGS} -Wp,-H30000"
303                ;;
304           *-dec-osf* )
305                CFLAGS="${CFLAGS} -ieee"
306                ;;
307     esac
308 else
309     CFLAGS="${CFLAGS} -Wall"
310     case "${host}" in
311           alpha*-*-linux* )
312                CFLAGS="${CFLAGS} -mieee"
313                ;;
314           alpha*-*-osf* )
315                CFLAGS="${CFLAGS} -mieee"
316                ;;
317     esac
318 fi
319
320 dnl
321 dnl Override other variables if LIBXML_SRC is set
322 dnl
323
324 if test "x$LIBXML_SRC" != "x"
325 then
326         CWD=`pwd`
327         if cd $LIBXML_SRC
328         then
329                 SRC_DIR=`pwd`
330                 XML_CONFIG=${SRC_DIR}/xml2-config
331                 LIBXML_CFLAGS="-I${SRC_DIR}/include"
332                 LIBXML_LIBS="-L${SRC_DIR}"
333                 cd $CWD
334         else
335                 AC_MSG_ERROR([libxml source dir not found (${LIBXML_SRC}), typo?])
336         fi
337 fi
338
339 dnl
340 dnl make sure xml2-config is executable,
341 dnl test version and init our variables
342 dnl
343
344 AC_DEFUN(VERSION_TO_NUMBER,
345 [`$1 | sed -e 's/libxml //' | awk 'BEGIN { FS = "."; } { printf "%d", ([$]1 * 1000 + [$]2) * 1000 + [$]3;}'`])
346 if ${XML_CONFIG} --libs print > /dev/null 2>&1
347 then
348         XMLVERS=`$XML_CONFIG --version`
349         if test VERSION_TO_NUMBER(echo $XMLVERS) -ge VERSION_TO_NUMBER(echo $LIBXML_REQUIRED_VERSION)
350         then
351                 LIBXML_LIBS="$LIBXML_LIBS `$XML_CONFIG --libs`"
352                 LIBXML_CFLAGS="$LIBXML_CFLAGS `$XML_CONFIG --cflags`"
353                 AC_MSG_RESULT($XMLVERS found)
354         else
355                 AC_MSG_ERROR(Version $XMLVERS found. You need at least libxml2 $LIBXML_REQUIRED_VERSION for this version of libxslt)
356         fi
357 else
358         AC_MSG_ERROR([Could not find libxml2 anywhere, check ftp://xmlsoft.org/.])
359 fi
360
361
362 AC_SUBST(CFLAGS)
363 AC_SUBST(CPPFLAGS)
364 AC_SUBST(LDFLAGS)
365
366 dnl
367 dnl In build tree I use a static version with memory debug enabled
368 dnl
369 if test "${LOGNAME}" = "veillard" -a "`pwd`" = "/u/veillard/XSLT" ; then
370     LIBXML_LIBS="../../XML/.libs/libxml2.a -lpthread -lz"
371     DV_LINK="1"
372     XSLTPROCDV="xsltproc.dv"
373     INSTALLED_XSLT_LIB=""
374    # PYTHONSODV="libxsltmod.so.dv"
375 fi
376
377 WIN32_EXTRA_LIBADD=
378 WIN32_EXTRA_LDFLAGS=
379 case "$host" in
380  *-*-mingw*)
381  WIN32_EXTRA_LIBADD="-lwsock32"
382  WIN32_EXTRA_LDFLAGS="-no-undefined"
383  AC_DEFINE([_WINSOCKAPI_],1,[Using the Win32 Socket implementation])
384  AC_DEFINE([snprintf],[_snprintf],[Win32 Std C name mangling work-around])
385  AC_DEFINE([vsnprintf],[_vsnprintf],[Win32 Std C name mangling work-around])
386  ;;
387 esac
388 AC_SUBST(WIN32_EXTRA_LIBADD)
389 AC_SUBST(WIN32_EXTRA_LDFLAGS)
390
391
392 AC_SUBST(XSLTPROCDV)
393 AC_SUBST(PYTHONSODV)
394 AC_SUBST(XML_CONFIG)
395 AC_SUBST(LIBXML_LIBS)
396 AC_SUBST(LIBXML_CFLAGS)
397 AC_SUBST(PYTHON)
398 AC_SUBST(PYTHON_VERSION)
399 AC_SUBST(PYTHON_INCLUDES)
400 AC_SUBST(PYTHON_SITE_PACKAGES)
401
402 XSLT_LIBDIR='-L${libdir}'
403 XSLT_INCLUDEDIR='-I${includedir}'
404 XSLT_LIBS="-lxslt $LIBXML_LIBS $M_LIBS"
405 AC_SUBST(XSLT_LIBDIR)
406 AC_SUBST(XSLT_INCLUDEDIR)
407 AC_SUBST(XSLT_LIBS)
408
409 EXSLT_LIBDIR='-L${libdir}'
410 EXSLT_INCLUDEDIR='-I${includedir}'
411 EXSLT_LIBS="-lexslt $XSLT_LIBS"
412 AC_SUBST(EXSLT_LIBDIR)
413 AC_SUBST(EXSLT_INCLUDEDIR)
414 AC_SUBST(EXSLT_LIBS)
415
416 EXTRA_LIBS="$LIBXML_LIBS $M_LIBS"
417 AC_SUBST(EXTRA_LIBS)
418
419 AC_SUBST(M_LIBS)
420
421 dnl for the spec file
422 RELDATE=`date +'%a %b %e %Y'`
423 AC_SUBST(RELDATE)
424
425 ( cd $srcdir
426 rm -f COPYING.LIB COPYING
427 $LN_S Copyright COPYING
428 )
429
430
431 AC_OUTPUT([
432 Makefile
433 libxslt.pc
434 libexslt.pc
435 libxslt/Makefile
436 libxslt/xsltconfig.h
437 libxslt/xsltwin32config.h
438 libexslt/Makefile
439 libexslt/exsltconfig.h
440 xsltproc/Makefile
441 python/Makefile
442 python/tests/Makefile
443 tests/Makefile
444 tests/docs/Makefile
445 tests/REC1/Makefile
446 tests/REC2/Makefile
447 tests/REC/Makefile
448 tests/general/Makefile
449 tests/reports/Makefile
450 tests/extensions/Makefile
451 tests/namespaces/Makefile
452 tests/keys/Makefile
453 tests/numbers/Makefile
454 tests/documents/Makefile
455 tests/xmlspec/Makefile
456 tests/multiple/Makefile
457 tests/XSLTMark/Makefile
458 tests/docbook/Makefile
459 tests/exslt/Makefile
460 tests/exslt/common/Makefile
461 tests/exslt/functions/Makefile
462 tests/exslt/math/Makefile
463 tests/exslt/sets/Makefile
464 tests/exslt/strings/Makefile
465 tests/exslt/date/Makefile
466 doc/Makefile
467 xslt-config
468 libxslt.spec
469 ])