1 dnl Process this file with autoconf to produce a configure script.
3 dnl See xapian-core's HACKING document for details of the reasons for required
7 AC_INIT([xapian-bindings], [1.3.2], [http://xapian.org/bugs])
9 dnl See xapian-core's HACKING document for details of the reasons for required
11 AM_INIT_AUTOMAKE([1.12.2 parallel-tests -Wportability subdir-objects tar-ustar no-dist-gzip dist-xz])
12 AC_CONFIG_SRCDIR([xapian-headers.i])
14 AC_CONFIG_HEADERS([config.h])
16 AC_CONFIG_MACRO_DIR([m4])
18 dnl Mac OS X needs MACOSX_DEPLOYMENT_TARGET set to 10.3 (or higher) to
19 dnl successfully link the SWIG generated modules. The link always fails on
20 dnl earlier versions of Mac OS X (10.1.4 and 10.2.8 tested), and these versions
21 dnl are long obsolete now, so we just ensure that MACOSX_DEPLOYMENT_TARGET is
22 dnl set to at least 10.3.
24 dnl NB we must do this *BEFORE* LT_INIT since that is what checks
25 dnl MACOSX_DEPLOYMENT_TARGET.
27 OVERRIDE_MACOSX_DEPLOYMENT_TARGET=
29 *86*-darwin8*|*-darwin[[91]]*)
30 dnl On 10.5 or later, and 10.4 on x86, the deployment target defaults to the
31 dnl OS version, so we don't need to override on these.
34 case $MACOSX_DEPLOYMENT_TARGET in
36 OVERRIDE_MACOSX_DEPLOYMENT_TARGET=10.3 ;;
38 AC_MSG_WARN([Overriding MACOSX_DEPLOYMENT_TARGET from $MACOSX_DEPLOYMENT_TARGET to 10.3])
39 OVERRIDE_MACOSX_DEPLOYMENT_TARGET=10.3 ;;
43 AM_CONDITIONAL(OVERRIDE_MACOSX_DEPLOYMENT_TARGET, test -n "$OVERRIDE_MACOSX_DEPLOYMENT_TARGET")
44 AC_SUBST(OVERRIDE_MACOSX_DEPLOYMENT_TARGET)
45 if test -n "$OVERRIDE_MACOSX_DEPLOYMENT_TARGET" ; then
46 MACOSX_DEPLOYMENT_TARGET=$OVERRIDE_MACOSX_DEPLOYMENT_TARGET
49 dnl Use libtool to manage our libraries, but don't build static libraries as
50 dnl the bindings only have a use for dynamic ones.
52 LT_INIT([disable-static])
54 dnl -no-undefined causes problems on Mac OS X with at least some
55 dnl MACOSX_DEPLOYMENT_TARGET settings, so only pass -no-undefined on
56 dnl platforms where it is required in order to link a shared library at
57 dnl all (Windows is the main one).
59 if test unsupported = "$allow_undefined_flag" ; then
60 NO_UNDEFINED=-no-undefined
62 AC_SUBST(NO_UNDEFINED)
64 dnl Checks for programs.
67 # Checked: freebsd8.0 openbsd4.6 solaris2.9 solaris2.10
69 linux* | k*bsd*-gnu | freebsd* | openbsd* | solaris*)
70 dnl Vanilla libtool sets this to "unknown" which it then handles as "yes".
71 link_all_deplibs_CXX=no
77 dnl Extract search path from ldconfig which is more reliable than the way
78 dnl vanilla libtool extracts them from ld.so.conf.
79 d=`/sbin/ldconfig -N -X -v 2>&AS_MESSAGE_LOG_FD|$SED 's,^\(/.*\):\( (.*)\)\?$,\1,p;d'|tr '\n' ' '`
80 test -z "$d" || sys_lib_dlsearch_path_spec=$d
84 dnl Run tests using the C++ compiler.
87 dnl Probe for any options needed to enable C++11 support.
88 AX_CXX_COMPILE_STDCXX_11
90 dnl Check for xapian-core.
91 XO_LIB_XAPIAN([], [], [xapian-config])
99 dnl If we're building against an uninstalled xapian-core, xapian-config
100 dnl --libs will give an error.
101 if $XAPIAN_CONFIG --libs >/dev/null 2>/dev/null ; then
105 dnl $XAPIAN_LIBS may have some options first, so grab the last argument,
106 dnl which should be the .la file.
111 dnl Make sure the path is absolute.
112 case $INTREE_DYLD_PATH in
114 *) INTREE_DYLD_PATH=`pwd`/$INTREE_DYLD_PATH ;;
116 dnl Add .libs or equivalent.
117 INTREE_DYLD_PATH=`echo "$INTREE_DYLD_PATH"|sed 's,\(.*/\).*,\1,'`$lt_cv_objdir
118 AC_SUBST([INTREE_DYLD_PATH])
122 AM_CONDITIONAL(NEED_JNILIB_EXT, test yes = "$NEED_JNILIB_EXT")
123 AM_CONDITIONAL(NEED_INTREE_DYLD, test yes = "$NEED_INTREE_DYLD")
125 dnl We want XAPIAN_CXXFLAGS to be used for configure tests, so add it to
126 dnl CXXFLAGS for the duration of configure.
127 save_CXXFLAGS=$CXXFLAGS
128 CXXFLAGS="$CXXFLAGS $XAPIAN_CXXFLAGS"
130 dnl COMPAT_VERSION is the version of xapian-core that "matches" our version.
131 dnl We allow for bindings being version 0.8.5.1 while xapian-core is 0.8.5.
132 dnl COMPAT_VERSION also ignores any _git123 suffix which snapshots will have.
133 COMPAT_VERSION=[`echo "$PACKAGE_VERSION"|sed 's/^\([0-9]*\.[0-9]*\.[0-9]*\).*/\1/'`]
134 AC_SUBST(COMPAT_VERSION)
136 dnl VERSION_NO_SNAPSHOT simply has any _git123 suffix removed.
137 VERSION_NO_SNAPSHOT=[`echo "$PACKAGE_VERSION"|sed 's/_.*$//'`]
138 AC_SUBST(VERSION_NO_SNAPSHOT)
140 dnl We only need to set docdir for compatibility with autoconf < 2.60 - this
141 dnl code can be removed once we move to requiring autoconf 2.60 or newer.
142 test -n "$docdir" || docdir='${datadir}/doc/${PACKAGE_TARNAME}'
145 AC_ARG_ENABLE(visibility,
146 [AS_HELP_STRING([--disable-visibility], [disable use of GCC visibility])],
147 [case ${enableval} in
149 *) AC_MSG_ERROR([bad value ${enableval} for --disable-visibility]) ;;
152 dnl Only probe for SWIG and enable SWIG rules in makefiles if
153 dnl configure --enable-maintainer-mode is used.
156 AC_ARG_ENABLE(documentation,
157 [AS_HELP_STRING([--enable-documentation], [enable make rules to rebuild documentation [default=maintainer-mode]])],
158 [case ${enableval} in
160 *) AC_MSG_ERROR([bad value ${enableval} for --enable-documentation]) ;;
162 test -z "$enable_documentation" && enable_documentation=$USE_MAINTAINER_MODE
163 AM_CONDITIONAL(DOCUMENTATION_RULES, test x"$enable_documentation" = xyes)
164 AM_CONDITIONAL(MAINTAINER_NO_DOCS, test x"$USE_MAINTAINER_MODE$enable_documentation" = xyesno)
166 if test yes = "$enable_documentation" ; then
167 dnl Check for rst2html. (Needed to make HTML from reStructuredText format)
168 dnl Also look for rst2html.py, which archlinux reportedly installs it as.
169 AC_PATH_PROGS(RST2HTML, [rst2html rst2html.py], [])
170 test -z "$RST2HTML" && AC_MSG_ERROR([rst2html is required to build documentation (try package python-docutils)])
173 if test x$USE_MAINTAINER_MODE = xyes; then
174 dnl Check for swig - this does most of the work for the bindings.
175 dnl AC_PATH_PROGS only honours an already set SWIG if it's a full
176 dnl path. Listing it in the "to be searched" list like this allows
177 dnl ./configure SWIG=myswig to work.
178 swigoverridden=${SWIG+yes}
179 AC_PATH_PROGS(SWIG, ["${SWIG-swig}"], [])
180 AC_ARG_VAR(SWIG, [SWIG interface generator (only needed by Xapian developers)])
181 if test -z "$SWIG" ; then
182 AC_MSG_ERROR([Can't find SWIG utility])
184 dnl Check for new enough SWIG.
186 dnl 3.0.3 fixes some problems with subclassing wrapped Xapian classes in PHP.
187 v=`$SWIG -version 2>&1|sed 's/^SWIG Version \([[0-9\.]]*\).*/\1/p;d'`
189 [[012].*|3.0.[012]|""])
190 msg="SWIG >= 3.0.3 (commit e12322d) required (you have ${v:-an unknown version})"
191 if test -n "$swigoverridden" ; then
192 dnl If SWIG was explicitly set, make this a warning only.
198 SWIG_FLAGS=`$XAPIAN_CONFIG --swigflags`
202 for a in $SWIG_FLAGS ; do
205 d=`echo "x$a"|sed 's/^x-I//'`
206 dnl Quote each entry in XAPIAN_HEADER_DIRS with "".
207 XAPIAN_HEADER_DIRS=$XAPIAN_HEADER_DIRS' "'$d'"'
208 for f in "$d/"*.h "$d/xapian/*.h" ; do
209 if test -f "$f" ; then
210 XAPIAN_HEADERS="$XAPIAN_HEADERS $f"
216 AC_SUBST([XAPIAN_HEADER_DIRS])
217 AC_SUBST([XAPIAN_HEADERS])
219 dnl Need perl in maintainer mode to generate the except.i file for python.
220 AC_PATH_PROGS(PERL, ["${PERL-perl}"], [])
221 test -z "$PERL" && AC_MSG_ERROR([perl is required in maintainer mode])
222 dnl Need doxygen in maintainer mode to convert C++ doxygen comments to Python
224 AC_PATH_PROG(DOXYGEN, doxygen, [])
225 test -z "$DOXYGEN" && AC_MSG_ERROR([doxygen is required to build documentation])
229 AC_HELP_STRING([--with-python], [enable Python 2 bindings]),
234 AC_HELP_STRING([--with-python3], [enable Python 3 bindings]),
239 AC_HELP_STRING([--with-php], [enable PHP bindings]),
244 AC_HELP_STRING([--with-ruby], [enable Ruby bindings]),
249 AC_HELP_STRING([--with-tcl], [enable Tcl bindings]),
254 AC_HELP_STRING([--with-csharp], [enable CSharp bindings]),
259 AC_HELP_STRING([--with-java], [enable Java bindings]),
264 AC_HELP_STRING([--with-perl], [enable Perl bindings]),
269 AC_HELP_STRING([--with-lua], [enable Lua bindings]),
273 case $with_python$with_python3$with_php$with_ruby$with_tcl$with_csharp$with_java$with_perl$with_lua in
275 dnl Default unspecified values to no.
276 test -z "$with_python" && with_python=no
277 test -z "$with_python3" && with_python3=no
278 test -z "$with_php" && with_php=no
279 test -z "$with_tcl" && with_tcl=no
280 test -z "$with_csharp" && with_csharp=no
281 test -z "$with_java" && with_java=no
282 test -z "$with_ruby" && with_ruby=no
283 test -z "$with_perl" && with_perl=no
284 test -z "$with_lua" && with_lua=no
290 if test no != "$with_python" ; then
291 dnl For backward compatibility:
292 : ${PYTHON2="$PYTHON"}
293 : ${PYTHON2_INC="$PYTHON_INC"}
294 : ${PYTHON2_LIB="$PYTHON_LIB"}
295 : ${PYTHON2_LIBS="$PYTHON_LIBS"}
296 : ${PYTHON2_SO="$PYTHON_SO"}
297 dnl See comment for AC_PATH_PROGS(SWIG, ...).
298 if test -n "$PYTHON2" ; then
299 AC_PATH_PROGS(PYTHON2, ["$PYTHON2"], [])
301 AC_PATH_PROGS(PYTHON2, [python2 python], [])
303 AC_ARG_VAR(PYTHON2, [Python 2 interpreter])
304 if test -n "$PYTHON2" ; then
305 dnl Require Python 2.4 or newer. Older versions are essentially
306 dnl unsupported upstream.
307 AC_MSG_CHECKING([$PYTHON2 version])
308 version=`$PYTHON2 -c 'import sys;print("%d.%d" % sys.version_info[[:2]])' 2>/dev/null`
310 [2.[4-9]*|2.[12][0-9][0-9]*])
311 AC_MSG_RESULT([$version])
314 AC_MSG_RESULT([$version (too new - use --with-python3 for Python 3 support)])
315 if test yes = "$with_python" ; then
316 AC_MSG_ERROR([Use --with-python3 for Python 3 support ($PYTHON2 is $version)])
321 AC_MSG_RESULT([$version (too old)])
322 if test yes = "$with_python" ; then
323 AC_MSG_ERROR([Only Python 2.4 or newer is supported ($PYTHON2 is $version)])
328 if test -n "$PYTHON2" ; then
329 if $PYTHON2 -c 'import distutils.sysconfig' 2>/dev/null ; then
330 PYTHON2_INC=`$PYTHON2 -c 'import os,distutils.sysconfig;print(distutils.sysconfig.get_python_inc().replace(os.sep,"/"))'`
331 AC_SUBST(PYTHON2_INC)
333 if test yes = "$with_python" ; then
334 AC_MSG_ERROR([Couldn't import Python module distutils.sysconfig - you probably need to install a python-dev or python-devel package])
336 AC_MSG_WARN([Couldn't import Python module distutils.sysconfig - you probably don't have a python-dev or python-devel package installed])
341 if test -n "$PYTHON2" ; then
342 dnl Check that Python.h is there, which is a good way to check that
343 dnl the appropriate python-dev package has been installed.
344 AC_MSG_CHECKING([for $PYTHON2_INC/Python.h])
345 if test -f "$PYTHON2_INC/Python.h" ; then
347 AC_MSG_CHECKING([for directory to install python2 bindings in])
348 if test -z "$PYTHON2_LIB" ; then
349 PYTHON2_LIB=`$PYTHON2 -c 'import os,distutils.sysconfig;print(distutils.sysconfig.get_python_lib(1).replace(os.sep,"/"))'`
351 AC_MSG_RESULT([$PYTHON2_LIB])
352 AC_ARG_VAR(PYTHON2_LIB, [Directory to install python2 bindings in])
354 AC_MSG_CHECKING([for python2 libraries to link against])
357 PYTHON2_LIBS=`$PYTHON2 -c 'import os,sys;print("-L"+os.path.join(sys.prefix,"libs").replace(os.sep,"/")+" -lpython"+sys.version[[:3]].replace(".",""))'` ;;
359 PYTHON2_LIBS=`$PYTHON2 -c 'import os,sys;print("-L"+os.path.join(sys.path[[3]],"config")+" -lpython"+sys.version[[:3]])'` ;;
363 AC_SUBST(PYTHON2_LIBS)
364 AC_MSG_RESULT([$PYTHON2_LIBS])
366 AC_MSG_CHECKING([for python2 module extension])
367 dnl Usually ".so", but for example, Mac OS X uses ".dylib".
368 PYTHON2_SO=`$PYTHON2 -c 'import distutils.sysconfig;print(distutils.sysconfig.get_config_vars("SO")[[0]])'`
370 AC_MSG_RESULT([$PYTHON2_SO])
371 BINDINGS="$BINDINGS python"
373 AC_MSG_RESULT([no (install python-dev or python-devel package or similar)])
374 if test yes = "$with_python" ; then
375 AC_MSG_ERROR([Python.h not found])
382 if test no != "$with_python3" ; then
383 dnl See comment for AC_PATH_PROGS(SWIG, ...).
384 if test -n "$PYTHON3" ; then
385 AC_PATH_PROGS(PYTHON3, ["$PYTHON3"], [])
387 AC_PATH_PROGS(PYTHON3, [python3 python], [])
389 AC_ARG_VAR(PYTHON3, [Python 3 interpreter])
390 if test -n "$PYTHON3" ; then
391 dnl Require Python 3.2 or newer, as that's the oldest version we can
392 dnl easily test with. If anyone's keen to support older versions, please
393 dnl test and send in any patches needed to get it to work.
394 AC_MSG_CHECKING([$PYTHON3 version])
395 version=`$PYTHON3 -c 'import sys;print("%d.%d" % sys.version_info[[:2]])' 2>/dev/null`
397 [3.[2-9]*|3.[12][0-9][0-9]*|[4-9].*])
398 AC_MSG_RESULT([$version])
401 AC_MSG_RESULT([$version (too old)])
402 if test yes = "$with_python3" ; then
403 AC_MSG_ERROR([Only Python 3.2 or newer is supported ($python3 is $version)])
408 if test -n "$PYTHON3" ; then
409 if $PYTHON3 -c 'import distutils.sysconfig' 2>/dev/null ; then
410 PYTHON3_INC=`$PYTHON3 -c 'import os,distutils.sysconfig;print(distutils.sysconfig.get_python_inc().replace(os.sep,"/"))'`
411 AC_SUBST(PYTHON3_INC)
413 if test yes = "$with_python3" ; then
414 AC_MSG_ERROR([Couldn't import Python module distutils.sysconfig - you probably need to install a python3-dev or python3-devel package])
416 AC_MSG_WARN([Couldn't import Python module distutils.sysconfig - you probably don't have a python3-dev or python3-devel package installed])
421 if test -n "$PYTHON3" ; then
422 dnl Check that Python.h is there, which is a good way to check that
423 dnl the appropriate python3-dev package has been installed.
424 AC_MSG_CHECKING([for $PYTHON3_INC/Python.h])
425 if test -f "$PYTHON3_INC/Python.h" ; then
427 AC_MSG_CHECKING([for directory to install python3 bindings in])
428 if test -z "$PYTHON3_LIB" ; then
429 PYTHON3_LIB=`$PYTHON3 -c 'import os,distutils.sysconfig;print(distutils.sysconfig.get_python_lib(1).replace(os.sep,"/"))'`
431 AC_MSG_RESULT([$PYTHON3_LIB])
432 AC_ARG_VAR(PYTHON3_LIB, [Directory to install python3 bindings in])
434 AC_MSG_CHECKING([for python3 libraries to link against])
437 PYTHON3_LIBS=`$PYTHON3 -c 'import os,sys;print("-L"+os.path.join(sys.prefix,"libs").replace(os.sep,"/")+" -lpython"+sys.version[[:3]].replace(".",""))'` ;;
439 PYTHON3_LIBS=`$PYTHON3 -c 'import os,sys;print("-L"+os.path.join(sys.path[[3]],"config")+" -lpython"+sys.version[[:3]])'` ;;
443 AC_SUBST(PYTHON3_LIBS)
444 AC_MSG_RESULT([$PYTHON3_LIBS])
446 AC_MSG_CHECKING([for python3 module extension])
447 dnl Usually ".so", but for example, Mac OS X uses ".dylib".
448 PYTHON3_SO=`$PYTHON3 -c 'import distutils.sysconfig;print(distutils.sysconfig.get_config_vars("SO")[[0]])'`
450 AC_MSG_RESULT([$PYTHON3_SO])
452 AC_MSG_CHECKING([for tag for cached compiled scripts])
453 PYTHON3_CACHE_TAG=`$PYTHON3 -c 'import imp;print(imp.get_tag())'`
454 AC_SUBST(PYTHON3_CACHE_TAG)
455 AC_MSG_RESULT([$PYTHON3_CACHE_TAG])
457 BINDINGS="$BINDINGS python3"
459 AC_MSG_RESULT([no (install python3-dev or python3-devel package or similar)])
460 if test yes = "$with_python3" ; then
461 AC_MSG_ERROR([Python.h not found])
468 if test x$USE_MAINTAINER_MODE = xyes; then
469 dnl Need python in maintainer mode to run doxy2swig.py.
470 dnl Either Python 2 or 3 is OK for this.
471 if test -n "$PYTHON2" ; then
473 elif test -n "$PYTHON3" ; then
476 AC_PATH_PROGS(PYTHON, [python2 python python3], [])
478 test -z "$PYTHON" && AC_MSG_ERROR([python is required in maintainer mode])
481 dnl If we're building documentation for either python version,
482 dnl we need sphinx-build
483 case $enable_documentation$BINDINGS in
485 AC_PATH_PROG(SPHINX_BUILD, sphinx-build, [])
486 test -z "$SPHINX_BUILD" && AC_MSG_ERROR([sphinx-build is required to build python documentation (try packages python-sphinx and python3-sphinx)])
490 if test no != "$with_php" ; then
491 dnl See comment for AC_PATH_PROGS(SWIG, ...).
492 AC_PATH_PROGS(PHP_CONFIG, ["${PHP_CONFIG-php-config}"], [])
493 AC_ARG_VAR(PHP_CONFIG, [php-config utility])
494 AC_ARG_VAR(PHP, [php interpreter (optional - only needed to run PHP testsuite with)])
495 if test -n "$PHP_CONFIG" ; then
496 AC_MSG_CHECKING([$PHP_CONFIG version])
497 version=`$PHP_CONFIG --version 2>/dev/null`
500 AC_MSG_RESULT([$version (not supported, need PHP >= 5.2)])
501 if test yes = "$with_php" ; then
502 AC_MSG_ERROR([Only PHP >= 5.2 is supported ($PHP_CONFIG reports version $version)])
507 AC_MSG_RESULT([$version])
508 PHP_MAJOR_VERSION=`echo "$version"|cut -d. -f1`
511 AC_SUBST(PHP_MAJOR_VERSION)
513 if test no != "$with_php" ; then
514 AC_MSG_CHECKING([for PHP extension directory])
515 if test -z "$PHP_EXTENSION_DIR" ; then
516 PHP_EXTENSION_DIR=`$PHP_CONFIG --extension-dir`
518 AC_MSG_RESULT([$PHP_EXTENSION_DIR])
519 AC_ARG_VAR(PHP_EXTENSION_DIR, [Directory to install PHP extensions in])
522 if test no != "$with_php" ; then
523 PHP_INC=`$PHP_CONFIG --includes`
525 save_CPPFLAGS=$CPPFLAGS
526 CPPFLAGS="$CPPFLAGS $PHP_INC"
527 dnl One of SGI's SuSE boxes has php-config but no headers.
528 AC_CHECK_HEADER(zend.h, [], [
529 if test yes = "$with_php" ; then
530 AC_MSG_ERROR(['$PHP_CONFIG --includes' reports '$PHP_INC' but zend.h can't be included from there])
533 CPPFLAGS=$save_CPPFLAGS
536 if test no != "$with_php" ; then
537 if test x"$PHP" = x ; then
538 AC_MSG_CHECKING([for PHP interpreter])
539 dnl PHP5's php-config supports --php-binary, so just use that.
540 PHP=`$PHP_CONFIG --php-binary 2>/dev/null`
541 if test x"$PHP" != x ; then
542 if $PHP -r 'exit(0);' 2> /dev/null ; then
543 AC_MSG_RESULT([$PHP])
545 AC_MSG_RESULT([no ($PHP does not work)])
549 AC_MSG_RESULT([not found])
552 AC_PATH_PROGS(PHP, ["$PHP"], [])
554 if test x"$PHP" = x ; then
555 AC_MSG_WARN([No PHP interpreter found - PHP bindings tests will be skipped])
556 dnl The skiptest script just returns exit code 77.
557 PHP='$(top_srcdir)/skiptest'
559 AC_MSG_CHECKING([for PHP path separator])
560 PHP_PATH_SEPARATOR=`$PHP -r 'echo PATH_SEPARATOR;'`
561 AC_SUBST([PHP_PATH_SEPARATOR])
562 AC_MSG_RESULT([$PHP_PATH_SEPARATOR])
567 dnl This is a bit of an informed guess, pending more information from
568 dnl someone who actually has mingw and wants to build the PHP bindings
570 PHP_LIBS="-L`$PHP_CONFIG --prefix` -lphp${PHP_MAJOR_VERSION}ts" ;;
572 PHP_LIBS="-lphp${PHP_MAJOR_VERSION}lib" ;;
577 BINDINGS="$BINDINGS php"
582 if test no != "$with_tcl" ; then
583 dnl The documented minimum requirement is Tcl 8.5. Older versions may work,
584 dnl but we don't test with them regularly, and they are no longer supported
585 dnl upstream. Also ::tcl::pckconfig was added in Tcl 8.5, which makes the
586 dnl tests below simpler and more reliable.
588 dnl If you really want to build with an older version, run configure with
589 dnl a lower tcl_min and specify at least TCL_INC explicitly:
591 dnl ./configure tcl_min=8.4 TCL_INC=/usr/include/tcl8.4
593 dnl We definitely need at least Tcl 8.1 for TCL_STUBS.
595 AC_PATH_PROGS(TCLSH, ["${TCLSH-tclsh}"], [])
596 AC_ARG_VAR(TCLSH, [Tcl interpreter])
597 if test -n "$TCLSH" ; then
598 AC_MSG_CHECKING([$TCLSH version])
599 if echo 'if {$tcl_version < '"$tcl_min"' } { exit 1 }'|$TCLSH 2> /dev/null ; then
600 tcl_version=`echo 'puts "$tcl_version"'|$TCLSH`
601 AC_MSG_RESULT([$tcl_version])
603 AC_ARG_VAR(TCL_LIB, [Directory to install Tcl files into])
604 if test -z "$TCL_LIB" ; then
605 [TCL_LIB=`echo 'foreach d $tcl_pkgPath {if {![regexp {/share(/|$)} $d]} {break}};puts $d'|$TCLSH`]
609 AC_ARG_VAR([TCL_INC], [Directory to include for Tcl headers])
610 if test -z "$TCL_INC" ; then
611 dnl ::tcl::pkgconfig was added in Tcl 8.5.
612 [TCL_INC=`echo 'puts [::tcl::pkgconfig get includedir,runtime]'|$TCLSH 2> /dev/null`]
615 dnl Check that the headers are there (the tcl8.N-dev package
616 dnl may not be installed).
618 AC_MSG_CHECKING([for tcl.h from Tcl $tcl_version])
619 if test x"$TCL_INC" != x && test -f "$TCL_INC/tcl.h" ; then
620 tcl_hdr_version=`awk '($1 == "#define" && $2 == "TCL_VERSION") {print $3}' "$TCL_INC/tcl.h"|sed 's/"//g'`
621 if test x"$tcl_hdr_version" = x"$tcl_version" ; then
622 AC_MSG_RESULT([$TCL_INC/tcl.h])
623 BINDINGS="$BINDINGS tcl8"
624 if test x"$TCL_INC" != x"/usr/include" ; then
625 TCL_CPPFLAGS="-I$TCL_INC"
628 AC_MSG_RESULT([not found])
629 if test yes = "$with_tcl" ; then
630 AC_MSG_ERROR([Found tcl.h from version $tcl_hdr_version, not $tcl_version - specify TCL_INC on configure command line])
635 AC_MSG_RESULT([not found])
636 if test yes = "$with_tcl" ; then
637 AC_MSG_ERROR([Can't find tcl.h])
642 if test -n "$TCLSH" ; then
643 dnl Cygwin needs to link with -ltcl8.5 or similar.
647 AC_CHECK_LIB([tcl$tcl_version], [Tcl_Init],
648 [TCL_LIBS="-ltcl$tcl_version"],
649 [AC_MSG_ERROR([libtcl$tcl_version not found])])
652 dnl ::tcl::pkgconfig was added in Tcl 8.5, but prior to 8.6 it isn't
653 dnl necessary to link against -ltclstub anyway.
654 [TCLCONFIG_SH=`echo 'puts [file join [::tcl::pkgconfig get libdir,runtime] tclConfig.sh]'|$TCLSH 2> /dev/null`]
655 if test -n "$TCLCONFIG_SH" && test -r "$TCLCONFIG_SH" ; then
656 eval "`sed 's/^TCL_STUB_LIB_SPEC=/TCL_LIBS=/p;d' $TCLCONFIG_SH`"
658 TCL_CPPFLAGS="$TCL_CPPFLAGS -DUSE_TCL_STUBS" ;;
662 AC_SUBST(TCL_CPPFLAGS)
665 AC_MSG_RESULT([< $tcl_min (too old)])
666 if test yes = "$with_tcl" ; then
667 AC_MSG_ERROR([$TCLSH too old (Tcl $tcl_min or newer required)])
671 if test yes = "$with_tcl" ; then
672 AC_MSG_ERROR([tclsh not found])
677 if test no != "$with_csharp" ; then
679 AC_ARG_VAR(CSC, [CSharp compiler command])
680 if test -n "$CSC" ; then
681 AC_PATH_PROGS(CSC, ["$CSC"], [])
683 if test -z "$CSC" ; then
684 dnl First we try cli-csc and mono-csc, which are used by Debian and Ubuntu
685 dnl as "alternatives" which can be mapped to the CSharp compiler the admin
687 AC_PATH_PROGS(CSC, [cli-csc mono-csc], [])
688 if test -z "$CSC" ; then
689 dnl mcs is the Mono CSharp compiler, which is a unified compiler
690 dnl available from Mono 2.11 (and also the compiler in Mono 1.0, but
691 dnl that's no longer relevant).
692 AC_PATH_PROGS(CSC, [mcs], [])
693 if test -n "$CSC" ; then
694 dnl There are other tools called mcs (such as /usr/bin/mcs on Tru64),
695 dnl so we check that the mcs we found understands --version which is
696 dnl sufficient to distinguish mono's mcs from the Tru64 one.
697 AC_MSG_CHECKING([whether $CSC is from GNU Mono])
698 if (exec >&5 2>&5;$CSC --version </dev/null;exit $?) ; then
703 csc_note="$csc_note (found different mcs program)"
707 if test -z "$CSC" ; then
708 dnl gmcs, smcs, and dmcs are versions of the Mono CSharp compiler
709 dnl targeting various runtime versions, deprecated in favour of mcs
710 dnl (checked for above) as of Mono 2.11.
712 dnl cscc is the Portable.NET CSharp compiler.
713 AC_PATH_PROGS(CSC, [dmcs smcs gmcs cscc], [])
715 if test -z "$CSC" ; then
716 dnl csc is the Microsoft CSharp compiler.
717 AC_PATH_PROGS(CSC, [csc], [])
718 if test -n "$CSC" ; then
719 dnl Chicken (the Scheme-to-C compiler) includes a tool called csc so we
720 dnl check if the output from "csc -version" includes the word chicken
721 dnl which is sufficient to distinguish Chicken's csc from Microsoft's
723 AC_MSG_CHECKING([whether $CSC is for CSharp])
724 if $CSC -version 2>/dev/null|grep chicken > /dev/null ; then
727 csc_note="$csc_note (found Chicken csc program)"
735 if test -n "$CSC" ; then
736 AC_ARG_VAR(GACUTIL, [gacutil utility to use for CSharp bindings])
737 if test -n "$GACUTIL" ; then
738 AC_PATH_PROGS(GACUTIL, ["$GACUTIL"], [])
740 if test -z "$GACUTIL" ; then
741 AC_PATH_PROGS(GACUTIL, [cli-gacutil gacutil ilgac], [])
744 AC_ARG_VAR(SN, [sn utility to use for CSharp bindings])
745 if test -n "$SN" ; then
746 AC_PATH_PROGS(SN, ["$SN"], [])
748 if test -z "$SN" ; then
749 AC_PATH_PROGS(SN, [cli-sn sn], [])
751 if test -z "$SN" ; then
753 dnl Portable.net doesn't support strong naming yet and ilgac doesn't
754 dnl require assemblies to be strong named before adding them to the GAC.
755 *ilgac*) SN=/bin/true ;;
758 if test -n "$GACUTIL" -a -n "$SN" ; then
759 AC_MSG_CHECKING([whether the CSharp compiler works])
760 [echo 'class conftest { public static void Main() { System.Console.WriteLine("OK"); } }' > conftest.cs]
761 if (exec >&5 2>&5;$CSC /out:conftest.exe conftest.cs;exit $?) ; then
763 AC_MSG_CHECKING([whether CSharp programs can just be run])
764 if test OK = "`./conftest.exe 2> /dev/null`" ; then
769 AC_PATH_PROGS(CLI, ["${CLI-cli}"], [])
770 if test -z "$CLI" ; then
771 AC_PATH_PROGS(CLI, [mono ilrun], [])
773 AC_ARG_VAR(CLI, [CSharp bytecode interpreter (optional - only needed to run CSharp testsuite with)])
774 if test -n "$CLI" ; then
775 AC_MSG_CHECKING([whether $CLI can run CSharp programs])
776 if test OK = "`$CLI ./conftest.exe 2> /dev/null`" ; then
780 AC_MSG_RESULT([no - CSharp tests will be skipped])
781 RUN_CSHARP='\$(top_srcdir)/skiptest'
784 AC_MSG_RESULT([not found - CSharp tests will be skipped])
785 RUN_CSHARP='\$(top_srcdir)/skiptest'
790 AC_MSG_CHECKING([for extra flags for $GACUTIL])
791 GACUTIL_FLAGS='/package $(ASSEMBLY) /gacdir $(libdir) /root $(DESTDIR)$(libdir)'
795 dnl Microsoft's gacutil accepts fewer options than Mono's
796 $GACUTIL /\?|grep '\<Mono\>' >/dev/null || GACUTIL_FLAGS=
799 AC_SUBST([GACUTIL_FLAGS])
800 if test -z "$GACUTIL_FLAGS" ; then
803 AC_MSG_RESULT([$GACUTIL_FLAGS])
806 BINDINGS="$BINDINGS csharp"
809 if test yes = "$with_csharp" ; then
810 AC_MSG_ERROR([CSharp compiler $CSC doesn't work])
814 if test yes = "$with_csharp" ; then
815 if test -z "$GACUTIL" ; then
816 AC_MSG_ERROR([Mono gacutil not found])
817 elif test -z "$SN" ; then
818 AC_MSG_ERROR([Mono sn not found])
823 if test yes = "$with_csharp" ; then
824 AC_MSG_ERROR([CSharp compiler not found$csc_note])
830 if test no != "$with_java" ; then
831 AC_PATH_PROGS(JAVA, ["${JAVA-java}"], [],
832 [${JAVA_HOME+$JAVA_HOME/bin:}${JDK_HOME+$JDK_HOME/bin:}$PATH])
833 AC_PATH_PROGS(JAVAC, ["${JAVAC-javac}"], [],
834 [${JAVA_HOME+$JAVA_HOME/bin:}${JDK_HOME+$JDK_HOME/bin:}$PATH])
835 AC_PATH_PROGS(JAR, ["${JAR-jar}"], [],
836 [${JAVA_HOME+$JAVA_HOME/bin:}${JDK_HOME+$JDK_HOME/bin:}$PATH])
837 AC_ARG_VAR(JAVA, [Java interpreter command])
838 AC_ARG_VAR(JAVAC, [Java compiler command])
839 AC_ARG_VAR(JAR, [java jar utility])
840 AC_ARG_VAR(JAVA_HOME, [Pathname of the directory where the JDK is installed])
841 AC_ARG_VAR(JDK_HOME, [Pathname of the directory where the JDK is installed])
842 AC_ARG_VAR(JNI_INCLUDE_DIR, [Pathname of the directory where jni.h is installed])
843 if test -n "$JAVA" -a -n "$JAVAC" -a -n "$JAR" ; then
845 dnl The JNI library *requires* "Java 2", which is 1.2 or better.
847 dnl So checking for jni.h presumably implicitly checks we have "Java 2".
848 dnl Note: jni.h #defines JNI_VERSION_1_[1246] (but not 3 or 5 it seems).
849 dnl So we could check for one of these if we want to check for a particular
852 AC_CHECK_HEADER([jni.h], [java_ok=yes], [
853 dnl We need to look for jni.h in /usr/lib/jvm/java-gcj/include on some
854 dnl Debian and Ubuntu boxes at least. And on Mac OS X, jni.h lives
855 dnl in /System/Library/Frameworks/JavaVM.framework/Headers.
856 SAVE_CPPFLAGS=$CPPFLAGS
858 dnl Avoid endlessly traversing if there's a symlink loop.
859 for count in 1 2 3 4 5 6 7 8 9 ; do
860 r=`readlink "$real_javac"`
861 test -n "$r" || break
864 dnl Translate ".../bin/javac" to ".../include".
865 [rel_jnidir=`echo "$real_javac"|sed 's!/[^/]*/[^/]*$!/include!'`]
868 ${JAVA_HOME+"$JAVA_HOME/include"} \
869 ${JDK_HOME+"$JDK_HOME/include"} \
871 /System/Library/Frameworks/JavaVM.framework/Headers ; do
872 CPPFLAGS="$SAVE_CPPFLAGS -I$jnidir"
873 AC_MSG_CHECKING([for jni.h in $jnidir])
874 if test -f "$jnidir/jni.h" ; then
875 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <jni.h>]])], [java_ok=yes])
876 if test yes = $java_ok ; then
878 JAVA_CPPFLAGS=-I$jnidir
882 dnl Sun's JDK requires the user to pass an extra -I for a
883 dnl subdirectory named after the host_os. Sadly we seem to
884 dnl need to hardcode a list of the platform names.
890 jni_host_os=solaris ;;
894 if test -n "$jni_host_os" ; then
895 CPPFLAGS="$CPPFLAGS -I$jnidir/$jni_host_os"
896 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <jni.h>]])], [java_ok=yes])
897 if test yes = $java_ok ; then
898 AC_MSG_RESULT([yes, requires additional -I$jnidir/$jni_host_os])
899 JAVA_CPPFLAGS="-I$jnidir -I$jnidir/$jni_host_os"
903 AC_MSG_RESULT([found, but not usable])
905 CPPFLAGS="$SAVE_CPPFLAGS -I$jnidir"
910 CPPFLAGS=$SAVE_CPPFLAGS
911 test noyes = $java_ok$with_java && AC_MSG_ERROR([jni.h not found])
913 AC_SUBST(JAVA_CPPFLAGS)
914 if test yes = $java_ok ; then
915 AC_MSG_CHECKING([for Java path separator])
916 [echo 'public class conftest { public static void main(String[] args) { System.out.println(System.getProperty("path.separator")); } }' > conftest.java]
917 if (exec >&5 2>&5;$JAVAC conftest.java;exit $?) ; then
918 JAVA_PATHSEP=`$JAVA conftest 2>&5`
919 AC_SUBST(JAVA_PATHSEP)
920 if test -n "$JAVA_PATHSEP" ; then
921 AC_MSG_RESULT($JAVA_PATHSEP)
922 BINDINGS="$BINDINGS java"
924 AC_MSG_RESULT([failed to run test program])
928 AC_MSG_RESULT([failed to compile test program])
931 if test no = "$java_ok" ; then
932 test yes = "$with_java" && AC_MSG_ERROR([Couldn't compile and run a simple Java test program])
936 if test yes = "$with_java" ; then
937 if test -z "$JAVA" ; then
938 AC_MSG_ERROR([java not found])
939 elif test -z "$JAVAC" ; then
940 AC_MSG_ERROR([javac not found])
941 elif test -z "$JAR" ; then
942 AC_MSG_ERROR([jar not found])
948 if test no != "$with_ruby" ; then
949 dnl See comment for AC_PATH_PROGS(SWIG, ...).
950 if test -n "$RUBY" ; then
951 AC_PATH_PROGS(RUBY, ["$RUBY"], [])
953 AC_PATH_PROGS(RUBY, [ruby], [])
955 AC_ARG_VAR(RUBY, [Ruby interpreter])
956 if test -n "$RUBY" ; then
957 dnl Require Ruby 1.8 or newer. Paul says:
958 dnl I'm using 1.8.4. I imagine anything in the 1.8.x series will be fine,
959 dnl not sure about 1.6 but hardly anyone uses <1.8.
961 dnl Brief testing with Ruby 1.6.8 show the bindings probably work there,
962 dnl but smoketest.rb doesn't because the test/unit module isn't available.
963 AC_MSG_CHECKING([$RUBY version])
964 dnl RUBY_VERSION works with 1.6. Once we've checked we have at least 1.8
965 dnl we can safely use RbConfig below (RbConfig requires Ruby 1.8; Config
966 dnl gives a deprecation warning with Ruby 1.9.3).
967 version=`$RUBY -e 'print RUBY_VERSION' 2>/dev/null`
970 AC_MSG_RESULT([\$RUBY -e 'print RUBY_VERSION' didn't work])
971 if test yes = "$with_ruby" ; then
972 AC_MSG_ERROR([Working Ruby interpreter not found])
976 [0.*|1.[0-7]|1.[0-7].*])
977 AC_MSG_RESULT([$version (too old)])
978 if test yes = "$with_ruby" ; then
979 AC_MSG_ERROR([Only Ruby 1.8 or newer is supported ($RUBY is $version)])
984 if test -n "$RUBY" ; then
985 AC_MSG_RESULT([$version])
986 AC_ARG_VAR(RUBY_INC, [Directory where ruby.h can be found])
987 if test -z "$RUBY_INC" ; then
988 dnl Ruby 1.9 added rubyhdrdir; for older Ruby we use archdir.
989 [RUBY_INC=`$RUBY -rrbconfig -e 'print RbConfig::CONFIG["rubyhdrdir"] || RbConfig::CONFIG["archdir"]'`]
992 dnl Check that ruby.h is there, which is a good way to check that
993 dnl the appropriate ruby-dev package has been installed.
994 AC_MSG_CHECKING([for $RUBY_INC/ruby.h])
995 if test -f "$RUBY_INC/ruby.h" ; then
998 AC_MSG_CHECKING([for ruby/io.h])
1000 if test -f "$RUBY_INC/ruby/io.h" ; then
1003 dnl In a VPATH build, the ruby subdirectory won't exist the first
1007 dnl Newer Ruby has ruby/io.h - older has rubyio.h. Ruby doesn't
1008 dnl seem to provide any way to generate code which works with
1009 dnl both (and even the version number isn't a discriminator as
1010 dnl Debian etch has 1.9 without ruby/io.h). The SWIG version
1011 dnl we're currently using assumes rubyio.h exists and luckily
1012 dnl it includes it with "", so we can just drop a rubyio.h
1013 dnl wrapper alongside ruby/xapian_wrap.cc.
1014 echo '#include <ruby/io.h>' > ruby/rubyio.h
1019 AC_ARG_VAR(RUBY_INC_ARCH, [Directory where ruby/config.h can be found (needed from Ruby 1.9)])
1020 if test -z "$RUBY_INC_ARCH" ; then
1021 dnl Ruby 2.0 and later Ruby 1.9 have rubyarchhdrdir; for early 1.9,
1022 dnl use rubyhdrdir+"/"+arch.
1023 [RUBY_INC_ARCH=`$RUBY -rrbconfig -e 'd = RbConfig::CONFIG["rubyhdrdir"]; print RbConfig::CONFIG["rubyarchhdrdir"] || (d ? d + "/" + RbConfig::CONFIG["arch"] : "")'`]
1024 dnl Ruby 1.8 has no rubyhdrdir, so set RUBY_INC_ARCH=RUBY_INC.
1025 test x"$RUBY_INC_ARCH" != x || RUBY_INC_ARCH=$RUBY_INC
1027 AC_SUBST(RUBY_INC_ARCH)
1029 AC_ARG_VAR(RUBY_LIB, [Directory to install ruby files into])
1030 if test -z "$RUBY_LIB" ; then
1031 [RUBY_LIB=`$RUBY -rrbconfig -e 'print RbConfig::CONFIG["sitelibdir"]'`]
1035 AC_ARG_VAR(RUBY_LIB_ARCH, [Directory to install ruby binary modules into])
1036 if test -z "$RUBY_LIB_ARCH" ; then
1037 [RUBY_LIB_ARCH=`$RUBY -rrbconfig -e 'print RbConfig::CONFIG["sitearchdir"]'`]
1039 AC_SUBST(RUBY_LIB_ARCH)
1042 if test unsupported = "$allow_undefined_flag" ; then
1043 dnl For Microsoft Windows and a few other platforms.
1044 [RUBY_LIBS=`$RUBY -rrbconfig -e 'print RbConfig::CONFIG["LIBRUBYARG"]'`]
1048 if test yes = "$enable_documentation" ; then
1049 if test -n "$RDOC" ; then
1050 AC_PATH_PROGS(RDOC, ["$RDOC"], [])
1052 dnl Try replace the *last* 'ruby' with 'rdoc'.
1053 rdoc_best_guess=`echo "$RUBY"|sed 's,\(.*\)ruby,\1rdoc,'`
1054 AC_PATH_PROGS(RDOC, ["$rdoc_best_guess"], [])
1055 if test -z "$RDOC"; then
1056 AC_PATH_PROGS(RDOC, [rdoc1.8 rdoc], [])
1057 test -n "$RDOC" || RDOC="$MISSING rdoc"
1062 BINDINGS="$BINDINGS ruby"
1064 AC_MSG_RESULT([no (install ruby-dev or ruby-devel package or similar)])
1065 if test yes = "$with_ruby" ; then
1066 AC_MSG_ERROR([ruby.h not found])
1069 RUBY_DLEXT=`$RUBY -rrbconfig -e 'print RbConfig::CONFIG[["DLEXT"]]'`
1070 AC_SUBST(RUBY_DLEXT)
1075 if test no != "$with_perl" ; then
1076 AC_PATH_PROGS(PERL, ["${PERL-perl}"], [])
1077 AC_ARG_VAR(PERL, [perl interpreter])
1078 if test -n "$PERL" ; then
1079 AC_PATH_PROGS(PROVE, ["${PROVE-prove}"], [])
1080 AC_ARG_VAR(PROVE, [Perl Test::Harness test runner])
1081 if test x"$PROVE" = x ; then
1082 AC_MSG_WARN([Perl 'prove' tool not found - Perl bindings tests will be skipped])
1083 dnl The skiptest script just returns exit code 77.
1084 PROVE='$(top_srcdir)/skiptest'
1087 if test -z "$PERL_INC" ; then
1088 PERL_INC=`$PERL -MConfig -e 'print $Config{archlibexp}, "/CORE"'`
1092 AC_ARG_VAR(PERL_ARCH, [Directory to install architecture-dependent perl files into])
1093 if test -z "$PERL_ARCH" ; then
1094 PERL_ARCH=`$PERL -MConfig -e 'print $Config{installsitearch}'`
1098 AC_ARG_VAR(PERL_LIB, [Directory to install architecture-independent perl files into])
1099 if test -z "$PERL_LIB" ; then
1100 PERL_LIB=`$PERL -MConfig -e 'print $Config{installsitelib}'`
1104 AC_ARG_VAR(PERL_SO, [Extension for compiled Perl modules])
1105 if test -z "$PERL_SO" ; then
1106 PERL_SO=`$PERL -MConfig -e 'print ".", $Config{dlext}'`
1110 if test -z "$PERL_XAPIAN_VERSION" ; then
1111 dnl snapshot versions look like 1.2.3_git123 or 1.2.3_svn14971
1112 case $PACKAGE_VERSION in
1114 PERL_XAPIAN_VERSION=`echo "$PACKAGE_VERSION"|sed 's/_git/./'` ;;
1116 PERL_XAPIAN_VERSION=`echo "$PACKAGE_VERSION"|sed 's/_svn/./'` ;;
1118 PERL_XAPIAN_VERSION=$PACKAGE_VERSION.0 ;;
1121 AC_SUBST(PERL_XAPIAN_VERSION)
1123 BINDINGS="$BINDINGS perl"
1125 if test yes = "$with_perl" ; then
1126 AC_MSG_ERROR([perl not found])
1131 if test no != "$with_lua" ; then
1132 AC_PATH_PROGS(LUA, ["${LUA-lua}"], [])
1133 AC_ARG_VAR(LUA, [lua interpreter])
1134 if test -n "$LUA" ; then
1135 dnl We need Lua 5.1 or later.
1136 AC_MSG_CHECKING([$LUA version])
1137 lua_version=`$LUA -e 'print(_VERSION)' | cut -f 2 -d ' '`
1139 case $lua_version in
1140 [[01234]].*|5.0|5.0.*)
1141 AC_MSG_RESULT([$lua_version < 5.1 (too old)])
1142 if test yes = "$with_lua" ; then
1143 AC_MSG_ERROR([$LUA too old (Lua 5.1 or newer required)])
1148 AC_MSG_RESULT([\$LUA -e 'print(_VERSION)' | cut -f 2 -d ' ' didn't work])
1150 if test yes = "$with_lua" ; then
1151 AC_MSG_ERROR([Working Lua interpreter not found])
1157 if test -n "$LUA" ; then
1158 AC_MSG_RESULT([$lua_version])
1160 AC_ARG_VAR([LUA_LIB], [Directory to install compiled Lua modules into])
1161 AC_ARG_VAR([LUA_SO], [Extension for compiled Lua modules (e.g. LUA_SO=.so)])
1162 AC_MSG_CHECKING([for directory to install compiled Lua modules into])
1163 if test -z "$LUA_LIB" -o -z "$LUA_SO" ; then
1164 lua_cpath=`$LUA -e 'require("package") print(package.cpath)'`
1165 dnl Look for the first absolute path in lua_cpath which has leaf
1166 dnl "?.<ext>" and put the directory part into lua_lib and <ext> into
1167 dnl lua_so. If LUA_SO was specified by the user, only consider
1168 dnl entries where <ext> matches LUA_SO.
1173 [lua_so_pat='[a-zA-Z][a-zA-Z]*'] ;;
1175 dnl If LUA_SO has a leading '.', remove it.
1176 lua_so_pat=`AS_ECHO("$LUA_SO")|sed 's/^\.//'` ;;
1178 dnl If LUA_SO was specified without a leading '.', add one to the
1179 dnl value substituted into Makefile.in.
1184 while test x"$lua_cpath" != x ; do
1185 [lua_lib=`expr X"$lua_cpath" : X'\([^;]*\)'`]
1186 lua_so=.`expr X"$lua_lib" : X'/.*/?\.\('"$lua_so_pat"'\)$'`
1189 dnl If someone has foolishly put ?.lua in cpath, ignore them.
1193 lua_lib=`expr X"$lua_lib" : X'\(/.*\)/?\.'"$lua_so_pat"'$'`
1196 [lua_cpath=`expr X"$lua_cpath" : X'[^;]*;*\(.*\)'`]
1198 test -n "$LUA_LIB" || LUA_LIB=$lua_lib
1199 test -n "$LUA_SO" || LUA_SO=$lua_so
1201 if test -z "$LUA_LIB"; then
1202 AC_MSG_RESULT([not found])
1204 AC_MSG_RESULT([$LUA_LIB])
1208 AC_MSG_CHECKING([for extension to use for compiled Lua modules])
1209 if test -z "$LUA_SO"; then
1210 AC_MSG_RESULT([not found])
1212 AC_MSG_RESULT([$LUA_SO])
1216 AC_MSG_CHECKING([for Lua header files])
1217 AC_ARG_VAR([LUA_INC], [Directory to include for lua headers])
1218 if test -z "$LUA_INC" ; then
1219 dirs="/usr/include/lua$lua_version /usr/local/include/lua$lua_version"
1221 if test -r "$i/lua.h"; then
1228 if test -z "$LUA_INC" ; then
1229 AC_MSG_RESULT([not found])
1231 AC_MSG_RESULT([$LUA_INC])
1232 BINDINGS="$BINDINGS lua"
1233 LUA_CPPFLAGS="-I$LUA_INC"
1235 AC_SUBST([LUA_CPPFLAGS])
1238 if test yes = "$with_lua" ; then
1239 AC_MSG_ERROR([lua not found])
1247 *python*) dnl Matches python and/or python3
1248 dnl C++11 has thread_local
1249 dnl GCC and some others have __thread
1250 dnl MSVC and some others have __declspec(thread)
1251 AC_MSG_CHECKING([for thread-local storage qualifier])
1252 AC_ARG_VAR([THREAD_LOCAL], [thread-local storage qualifier])
1253 if test -z "$THREAD_LOCAL" ; then
1254 for t in thread_local __thread '__declspec(thread)' ; do
1255 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[static $t void * p;]])],
1256 [THREAD_LOCAL=$t; break])
1259 if test -z "$THREAD_LOCAL" ; then
1260 AC_MSG_RESULT([unknown, disabling thread-local support])
1262 AC_MSG_RESULT([$THREAD_LOCAL])
1263 AC_DEFINE_UNQUOTED([THREAD_LOCAL], [$THREAD_LOCAL], [Thread local storage qualifier (undefined if no TLS)])
1268 dnl Set flags to control warnings (enable more, or disable annoying ones)
1269 dnl and other compiler specific flags.
1271 if test yes = "$GXX" ; then
1272 dnl Python itself is compiled with -fno-strict-aliasing, and it appears
1273 dnl it's safest to follow this lead when compiling the SWIG generated
1274 dnl interface code. E.g.:
1275 dnl http://article.gmane.org/gmane.comp.gcc.devel/74692
1276 dnl The code SWIG generates for other languages seems to have similar
1277 dnl issues too, so just turn this on for all of them.
1279 dnl There's no need to check -fno-strict-aliasing is supported as it works
1280 dnl with GCC 2.95 and we don't support anything older.
1281 SWIG_CXXFLAGS="-fno-strict-aliasing"
1283 dnl We need to explicitly link against -lstdc++ on OpenBSD (discovered
1284 dnl on OpenBSD 3.7 with GCC 3.3.5 but this appears to be due to a
1285 dnl deliberate decision on the part of OpenBSD developers). Luckily
1286 dnl we can just always specify -lstdc++ explicitly if GCC is the
1287 dnl compiler and libtool will eliminate the duplicate on other
1289 XAPIAN_LIBS="$XAPIAN_LIBS -lstdc++"
1291 dnl Intel's C++ compiler is identified as "GXX" by autoconf's test - check
1292 dnl which we actually have.
1294 [#ifdef __INTEL_COMPILER
1299 dnl Intel's compiler:
1301 dnl -w1 stops the avalanche of uninteresting "remark" messages.
1302 dnl -wd... disables warnings which don't have good code workarounds.
1304 dnl Swig generated code gives lots of unused and uninitialized warnings.
1305 dnl They're non-harmful, so suppress them.
1306 SWIG_CXXFLAGS="$SWIG_CXXFLAGS -Wall -w1 -wd177,1572"
1311 dnl Swig generated code gives lots of unused and uninitialized warnings.
1312 dnl They're non-harmful, so suppress them.
1313 SWIG_CXXFLAGS="$SWIG_CXXFLAGS -fshow-column -Wall -Wno-unused -Wno-uninitialized"
1316 if test no != "$enable_visibility"; then
1317 dnl GCC doesn't support symbol visibility on all platforms (e.g. it isn't
1319 AC_MSG_CHECKING([if $CXX -fvisibility=hidden works])
1320 if echo 'int bar() __attribute__((visibility("default"))); int foo() {return 42;}'|$CXX -Werror -fvisibility=hidden -c -oconftest.o -xc++ - >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD ; then
1321 AC_MSG_RESULT([yes])
1322 SWIG_CXXFLAGS="$SWIG_CXXFLAGS -fvisibility=hidden"
1328 AC_SUBST(SWIG_CXXFLAGS)
1330 dnl Restore CXXFLAGS to those the user specified or autoconf defaulted to.
1331 CXXFLAGS=$save_CXXFLAGS
1333 dnl Required for auto regeneration to work in a combined maintainer-mode tree.
1334 : ${AUTOM4TE=autom4te}
1335 AC_SUBST([AUTOM4TE])
1337 AC_CONFIG_FILES([Makefile
1340 python/Makefile python/docs/conf.py python/version.i
1341 python3/Makefile python3/docs/conf.py python3/version.i
1344 tcl8/Makefile tcl8/pkgIndex.tcl
1345 csharp/Makefile csharp/AssemblyInfo.cs
1347 perl/Makefile perl/util.i
1349 xapian-bindings.spec
1354 if test -z "$BINDINGS" ; then
1355 echo "*** Not found the required tools for building bindings for any"
1356 echo "*** supported language!"
1358 echo "*** You may need to install -dev or -devel packages for the languages"
1359 echo "*** you want to build bindings for."
1361 echo "*** For details of how to point configure at tools not on PATH, see:"
1362 echo "*** ./configure --help"
1364 echo "*** Building bindings for languages:" $BINDINGS
1367 if test "$COMPAT_VERSION" != "$XAPIAN_VERSION" ; then
1368 release_series=[`echo "$COMPAT_VERSION"|sed 's/[0-9][0-9]*$//'`]
1369 case $XAPIAN_VERSION in
1370 $release_series*) ;;
1372 AC_MSG_ERROR([Xapian library is version ${XAPIAN_VERSION-<0.8.2} which is from a different release series to bindings $PACKAGE_VERSION, so they aren't compatible.])
1375 dnl 0.8.2 was the first version which set XAPIAN_VERSION
1376 AC_MSG_WARN([Xapian library is version ${XAPIAN_VERSION-<0.8.2} but the bindings are version $PACKAGE_VERSION - we strongly recommend using matching versions.])