Update for release
[geos.git] / configure.in
blob34222acc8fef93ef60e064210987f41de43c3054
1 dnl $Id$
2 dnl
3 dnl configure.in - autoconf input template to produce ./configure script
4 dnl
5 dnl version 2.52 is required for Cygwin libtool support
6 AC_PREREQ([2.52])
8 dnl local vars to hold user's preferences --------------------------------
9 AC_INIT([include/geos.h])
10 AC_CANONICAL_SYSTEM
12 AC_CONFIG_MACRO_DIR([macros])
14 dnl -- JTS_PORT: the version of JTS this release is bound to
15 JTS_PORT=1.12.0
17 dnl -- Version info for the CAPI
18 CAPI_INTERFACE_CURRENT=8
19 CAPI_INTERFACE_REVISION=0
20 CAPI_INTERFACE_AGE=7
22 dnl
23 dnl -- Release versions / C++ library SONAME will use these
24 dnl -- encoding ABI break at every release
25 dnl
26 VERSION_MAJOR=3
27 VERSION_MINOR=3
28 VERSION_PATCH=0
29 VERSION="$VERSION_MAJOR.$VERSION_MINOR.$VERSION_PATCH"
31 dnl CAPI_VERSION_MAJOR=$(($CAPI_INTERFACE_CURRENT-$CAPI_INTERFACE_AGE))
32 dnl the following should be more portable
33 CAPI_VERSION_MAJOR=`expr $CAPI_INTERFACE_CURRENT - $CAPI_INTERFACE_AGE`
34 CAPI_VERSION_MINOR=$CAPI_INTERFACE_AGE
35 CAPI_VERSION_PATCH=$CAPI_INTERFACE_REVISION
36 CAPI_VERSION="$CAPI_VERSION_MAJOR.$CAPI_VERSION_MINOR.$CAPI_VERSION_PATCH"
38 AM_INIT_AUTOMAKE([geos], [$VERSION], [no-define])
39 AM_MAINTAINER_MODE
40 AM_CONFIG_HEADER([include/config.h])
41 AM_CONFIG_HEADER([include/geos/platform.h])
42 AC_PROG_CC
44 dnl use libtool ----------------------------------------------------------
45 AC_LIBTOOL_DLOPEN
46 AC_LIBTOOL_WIN32_DLL
47 AC_PROG_LIBTOOL
49 dnl check for programs ----------------------------------------------------
50 AC_PROG_CXX
51 AC_ISC_POSIX
52 AC_PROG_INSTALL
53 AC_PROG_MAKE_SET
55 dnl function checks ------------------------------------------------------
56 AC_FUNC_CLOSEDIR_VOID
57 AC_FUNC_MEMCMP
58 AC_FUNC_STRFTIME
59 AC_FUNC_VPRINTF
60 AC_FUNC_ALLOCA
61 AC_HEADER_DIRENT
62 AC_HEADER_STDC
63 AC_CHECK_HEADERS([memory.h])
64 AC_CHECK_HEADERS([unistd.h])
65 AC_CHECK_HEADERS([ieeefp.h])
66 AC_CHECK_HEADERS([sys/file.h])
67 AC_CHECK_HEADERS([sys/time.h])
68 AC_CHECK_FUNCS([strchr memcpy gettimeofday])
69 AC_HEADER_STAT
70 AC_STRUCT_TM
71 AC_TYPE_SIZE_T
72 AC_C_CONST
74 dnl --------------------------------------------------------------------
75 dnl - Check for inline and cassert settings
76 dnl --------------------------------------------------------------------
79 AC_ARG_ENABLE([inline], [  --disable-inline    Disable inlining],
80         [case "${enableval}" in
81                 yes) enable_inline=true ;;
82                 no)  enable_inline=false ;;
83                 *) AC_MSG_ERROR(bad value ${enableval} for --enable-inline);;
84         esac],
85         [enable_inline=true]
88 AC_ARG_ENABLE([cassert], [  --disable-cassert   Disable assertion checking],
89         [case "${enableval}" in
90                 yes) enable_cassert=true ;;
91                 no)  enable_cassert=false ;;
92                 *) AC_MSG_ERROR(bad value ${enableval} for --enable-cassert);;
93         esac],
94         [enable_cassert=true]
97 AC_ARG_ENABLE([glibcxx-debug], [  --enable-glibcxx-debug    Enable libstdc++ debug mode],
98         [case "${enableval}" in
99                 yes) enable_glibcxx_debug=true ;;
100                 no)  enable_glibcxx_debug=false ;;
101                 *) AC_MSG_ERROR(bad value ${enableval} for --enable-glibcxx-debug);;
102         esac],
103         [enable_glibcxx_debug=false]
107 AC_MSG_CHECKING([if requested to force inline functions])
108 INLINE_FLAGS=
109 AC_SUBST(INLINE_FLAGS)
110 if test x"$enable_inline" = xtrue; then
111         INLINE_FLAGS="-DGEOS_INLINE"
112         AM_CXXFLAGS="$AM_CXXFLAGS $INLINE_FLAGS"
113     AC_MSG_RESULT([yes])
114 else
115     AC_MSG_RESULT([no])
118 AC_MSG_CHECKING([if requested to enable assert macros])
119 if test x"$enable_cassert" = xfalse; then
120         AM_CXXFLAGS="$AM_CXXFLAGS -DNDEBUG"
121     AC_MSG_RESULT([no])
122 else
123     AC_MSG_RESULT([yes])
126 AC_MSG_CHECKING([if requested libstdc++ debug mode])
127 if test x"$enable_glibcxx_debug" = xtrue; then
128     AM_CXXFLAGS="$AM_CXXFLAGS -D_GLIBCXX_DEBUG=1 -D_GLIBCXX_DEBUG_PEDANTIC=1"
129     AC_MSG_RESULT([yes])
130 else
131     AC_MSG_RESULT([no])
134 dnl --------------------------------------------------------------------
135 dnl - Append default C++ and C flags 
136 dnl --------------------------------------------------------------------
138 dnl In order for AC_LIBTOOL_COMPILER_OPTION to use
139 dnl the C compiler we need the hack below.
140 dnl It is likely a bug in the libtool macro file to
141 dnl require AC_LIBTOOL_LANG_CXX_CONFIG in *addition*
142 dnl to AC_LANG(CXX) or AC_LANG_PUSH(CXX)/AC_LANG_POP()
143 dnl 
144 AC_LIBTOOL_LANG_CXX_CONFIG
146 # Set default AM_CXXFLAGS and AM_CFLAGS 
147 # -pedantic: ISO does not support long long
148 # we add -Wno-long-long to avoid those messages
149 WARNFLAGS=""
150 AC_LIBTOOL_COMPILER_OPTION([if $compiler supports -pedantic], [dummy_cv_pedantic], [-pedantic], [], [WARNFLAGS="$WARNFLAGS -pedantic"], [])
151 AC_LIBTOOL_COMPILER_OPTION([if $compiler supports -Wall], [dummy_cv_wall], [-Wall], [], [WARNFLAGS="$WARNFLAGS -Wall"], [])
152 AC_LIBTOOL_COMPILER_OPTION([if $compiler supports -ansi], [dummy_cv_ansi], [-ansi], [], [WARNFLAGS="$WARNFLAGS -ansi"], [])
153 AC_LIBTOOL_COMPILER_OPTION([if $compiler supports -Wno-long-long], [dummy_cv_no_long_long], [-Wno-long-long], [], [WARNFLAGS="$WARNFLAGS -Wno-long-long"], [])
155 # To make numerical computation more stable, we use --ffloat-store
156 NUMERICFLAGS=""
157 AC_LIBTOOL_COMPILER_OPTION([if $compiler supports -ffloat-store], [dummy_cv_ffloat_store], [-ffloat-store], [], [NUMERICFLAGS="$NUMERICFLAGS -ffloat-store"], [])
159 DEFAULTFLAGS="${WARNFLAGS} ${NUMERICFLAGS}"
161 AM_CXXFLAGS="${AM_CXXFLAGS} ${DEFAULTFLAGS}"
162 AM_CFLAGS="${AM_CFLAGS} ${DEFAULTFLAGS}"
163 AC_SUBST(AM_CXXFLAGS)
164 AC_SUBST(AM_CFLAGS)
166 dnl --------------------------------------------------------------------
167 dnl - Look for finite and/or isfinite macros/functions
168 dnl --------------------------------------------------------------------
170 dnl These two tests need the math library or they won't link
171 dnl on OpenBSD, even if the functions exist.
172 save_LIBS=$LIBS
173 LIBS="$LIBS -lm"
174 AC_CACHE_CHECK([for finite], ac_cv_finite,
175  [AC_TRY_LINK([#include <math.h>],
176  [double x; int y; y = finite(x);],
177  ac_cv_finite=yes,
178  ac_cv_finite=no
180 if test x"$ac_cv_finite" = x"yes"; then
181   AC_DEFINE(HAVE_FINITE, [1], [Has finite])
184 AC_CACHE_CHECK([for isfinite], ac_cv_isfinite,
185  [AC_TRY_LINK([#include <math.h>],
186  [double x; int y; y = isfinite(x);],
187  ac_cv_isfinite=yes,
188  ac_cv_isfinite=no
190 if test x"$ac_cv_isfinite" = x"yes"; then
191   AC_DEFINE(HAVE_ISFINITE, [1], [Has isfinite])
194 dnl --------------------------------------------------------------------
195 dnl Test for presence of isnan function when using C++ and <cmath>
196 dnl This is for a particular bug in OS/X where <cmath> drops the definition
197 dnl of isnan().
199 AC_LANG_PUSH([C++])
200 AC_CACHE_CHECK([for isnan], ac_cv_isnan,
201  [AC_TRY_LINK([#include <cmath>],
202  [double x; int y; y = isnan(x);],
203  ac_cv_isnan=yes,
204  ac_cv_isnan=no
206 if test x"$ac_cv_isnan" = x"yes"; then
207   AC_DEFINE(HAVE_ISNAN, [1], [Has isnan])
209 AC_LANG_POP([C++])
211 dnl --------------------------------------------------------------------
213 LIBS=$save_LIBS
215 dnl --------------------------------------------------------------------
216 dnl - Look for a 64bit integer (do after CFLAGS is set)
217 dnl --------------------------------------------------------------------
219 dnl Find a working 64bit integer
220 PGAC_TYPE_64BIT_INT([int64_t])
221 if test x"$HAVE_INT64_T_64" = x"no" ; then
222   PGAC_TYPE_64BIT_INT([long int])
223   if test x"$HAVE_LONG_INT_64" = x"no" ; then
224     PGAC_TYPE_64BIT_INT([long long int])
225     if test x"$HAVE_LONG_LONG_INT_64" = x"no" ; then
226       AC_MSG_WARN([Could not find a working 64bit int type, you may experience weird bugs (undefined behaviour)]);
227     fi
228   fi
233 dnl --------------------------------------------------------------------
234 dnl - check whether python is required for the build
235 dnl --------------------------------------------------------------------
237 AC_ARG_ENABLE([python], [  --enable-python    Enable build of python module],
238         [case "${enableval}" in
239                 yes) use_python=true ;;
240                 no)  use_python=false ;;
241                 *) AC_MSG_ERROR(bad value ${enableval} for --enable-python) ;;
242         esac],
243         [use_python=false]
247 dnl --------------------------------------------------------------------
248 dnl - check whether ruby is required for the build
249 dnl --------------------------------------------------------------------
251 AC_ARG_ENABLE([ruby], [  --enable-ruby    Enable build of ruby module],
252         [case "${enableval}" in
253                 yes) use_ruby=true ;;
254                 no)  use_ruby=false ;;
255                 *) AC_MSG_ERROR(bad value ${enableval} for --enable-ruby) ;;
256         esac],
257         [use_ruby=false]
260 dnl --------------------------------------------------------------------
261 dnl - check whether php is required for the build
262 dnl --------------------------------------------------------------------
264 AC_ARG_ENABLE([php], [  --enable-php    Enable build of php module],
265         [case "${enableval}" in
266                 yes) use_php=true ;;
267                 no)  use_php=false ;;
268                 *) AC_MSG_ERROR(bad value ${enableval} for --enable-php) ;;
269         esac],
270         [use_php=false]
274 dnl --------------------------------------------------------------------
275 dnl - check for swig if python, ruby or php are enabled
276 dnl --------------------------------------------------------------------
278 use_swig=false
279 if test x"$use_python" = xtrue ||
280    test x"$use_ruby" = xtrue; then
281         AC_PROG_SWIG(1.3.28)
282         if test x"$SWIG" != "x"; then
283             SWIG_ENABLE_CXX     
284             AC_SUBST(SWIG)           
286             use_swig=true 
287         fi
289 AM_CONDITIONAL(ENABLE_SWIG, [ test x"$use_swig" = xtrue ])
292 dnl --------------------------------------------------------------------
293 dnl - check for python if enabled
294 dnl --------------------------------------------------------------------
296 if test x"$use_python" = xtrue; then
297         dnl Check for Python 
298         AM_PATH_PYTHON  
299         SWIG_PYTHON
301         if test x"$PYTHON" = "x"; then
302                 use_python=false
303         fi
304         
305         AC_SUBST(PYTHON)
306         AC_SUBST(SWIG_PYTHON_CPPFLAGS)
307         AC_SUBST(SWIG_PYTHON_OPT)
309 AM_CONDITIONAL(ENABLE_PYTHON, [test x"$use_python" = xtrue])
312 dnl --------------------------------------------------------------------
313 dnl - check for ruby if enabled
314 dnl --------------------------------------------------------------------
316 if test x"$use_ruby" = xtrue; then
317         dnl Check for Ruby 
318         AC_RUBY_DEVEL
320         if test x"$RUBY" = x; then
321                 use_ruby=false
322         fi
325 AM_CONDITIONAL(ENABLE_RUBY, [ test x"$use_ruby" = xtrue ])
327 dnl --------------------------------------------------------------------
328 dnl - check for php if enabled
329 dnl --------------------------------------------------------------------
331 if test x"$use_php" = xtrue; then
332         dnl Check for PHP 
333         AC_PATH_PROG(PHP_CONFIG, php-config)
335         if test x"$PHP_CONFIG" = x; then
336                 AC_MSG_WARN([php-config not found, php support disabled])
337                 use_php=false
338         else
340                 dnl TODO: check for version, we want PHP5 dev files
342                 AC_PATH_PROG(PHP, php) dnl for unit testing
343                 AC_PATH_PROG(PHPUNIT, phpunit) dnl for unit testing
344         fi
348 AM_CONDITIONAL(ENABLE_PHP, [ test x"$use_php" = xtrue ])
349 AM_CONDITIONAL(HAVE_PHP, [ test x"$PHP" != x ])
350 AM_CONDITIONAL(HAVE_PHP_UNIT, [ test x"$PHPUNIT" != x ])
353 dnl --------------------------------------------------------------------
354 dnl - do operating-system specific things
355 dnl --------------------------------------------------------------------
357 AC_MSG_CHECKING([OS-specific settings])
359 case "${host_os}" in
360         *darwin*)
361                 AC_MSG_RESULT([${host_os}])
362                 AC_MSG_CHECKING([for OS/X version])
363                 kernel=`uname -r`
365                 # "Darwin 9.6.0" is Mac OSX 10.5.6
366                 # "Darwin 10.x" would presumably be Mac OS X 10.6.x
367                 case "${kernel}" in
368                         8.*)
369                                 AC_MSG_RESULT([Mac OS X 10.4 Tiger])
370                                 ;;
371                         9.*)
372                                 AC_MSG_RESULT([Mac OS X 10.5 Leopard])
373                                 ;;
374                         10.*)
375 dnl                             AM_CXXFLAGS="$AM_CXXFLAGS -Wnon-virtual-dtor -Woverloaded-virtual"
376                                 AC_MSG_RESULT([Mac OS X 10.6 Snow Leopard])
377                                 ;;
378                         *)
379                                 AC_MSG_RESULT([Mac OS X (Darwin ${kernel} kernel)])
380                                 ;;
381                 esac
382                 ;;
383 esac
385 dnl --------------------------------------------------------------------
386 dnl - check for boost 
387 dnl --------------------------------------------------------------------
389 dnl -- AX_BOOST(1.32)
390 dnl -- if test "x$ax_cv_boost_unit_test_framework" = "xyes"; then
391 dnl --  use_boost_utf=yes
392 dnl -- else
393 dnl --  use_boost_utf=no
394 dnl -- fi
395 dnl -- AM_CONDITIONAL(ENABLE_BOOST_UTF, [test "x$use_boost_utf" = "xyes"])
397 dnl things to substitute in output ----------------------------------------
398 AC_SUBST(VERSION)
399 AC_SUBST(VERSION_MAJOR)
400 AC_SUBST(VERSION_MINOR)
401 AC_SUBST(VERSION_PATCH)
402 AC_SUBST(INTERFACE_CURRENT)
403 AC_SUBST(INTERFACE_REVISION)
404 AC_SUBST(INTERFACE_AGE)
405 AC_SUBST(JTS_PORT)
406 AC_SUBST(CAPI_VERSION)
407 AC_SUBST(CAPI_VERSION_MAJOR)
408 AC_SUBST(CAPI_VERSION_MINOR)
409 AC_SUBST(CAPI_VERSION_PATCH)
410 AC_SUBST(CAPI_INTERFACE_CURRENT)
411 AC_SUBST(CAPI_INTERFACE_REVISION)
412 AC_SUBST(CAPI_INTERFACE_AGE)
414 dnl output stuff ----------------------------------------------------------
416 AC_OUTPUT([
417         Makefile 
418         capi/Makefile
419         capi/geos_c.h
420         doc/Doxyfile
421         doc/Makefile
422         macros/Makefile
423         src/Makefile 
424         src/algorithm/Makefile
425         src/algorithm/locate/Makefile
426         src/algorithm/distance/Makefile
427         src/geom/Makefile
428         src/geom/prep/Makefile
429         src/geom/util/Makefile
430         src/geomgraph/Makefile
431         src/geomgraph/index/Makefile
432         include/Makefile
433         include/geos/Makefile
434         include/geos/algorithm/Makefile
435         include/geos/algorithm/locate/Makefile
436         include/geos/algorithm/distance/Makefile
437         include/geos/geom/Makefile
438         include/geos/geom/prep/Makefile
439         include/geos/geom/util/Makefile
440         include/geos/geomgraph/Makefile
441         include/geos/geomgraph/index/Makefile
442         include/geos/index/Makefile
443         include/geos/index/bintree/Makefile
444         include/geos/index/chain/Makefile
445         include/geos/index/intervalrtree/Makefile
446         include/geos/index/quadtree/Makefile
447         include/geos/index/strtree/Makefile
448         include/geos/index/sweepline/Makefile
449         include/geos/io/Makefile
450         include/geos/linearref/Makefile
451         include/geos/noding/Makefile
452         include/geos/noding/snapround/Makefile
453         include/geos/operation/Makefile
454         include/geos/operation/buffer/Makefile
455         include/geos/operation/distance/Makefile
456         include/geos/operation/linemerge/Makefile
457         include/geos/operation/overlay/Makefile
458         include/geos/operation/overlay/snap/Makefile
459         include/geos/operation/polygonize/Makefile
460         include/geos/operation/predicate/Makefile
461         include/geos/operation/relate/Makefile
462         include/geos/operation/sharedpaths/Makefile
463         include/geos/operation/union/Makefile
464         include/geos/operation/valid/Makefile
465         include/geos/planargraph/Makefile
466         include/geos/planargraph/algorithm/Makefile
467         include/geos/precision/Makefile
468         include/geos/simplify/Makefile
469         include/geos/util/Makefile
470         include/geos/version.h
471         src/index/Makefile
472         src/index/bintree/Makefile
473         src/index/chain/Makefile
474         src/index/intervalrtree/Makefile
475         src/index/quadtree/Makefile
476         src/index/strtree/Makefile
477         src/index/sweepline/Makefile
478         src/io/Makefile
479         src/linearref/Makefile
480         src/noding/Makefile
481         src/noding/snapround/Makefile
482         src/operation/Makefile
483         src/operation/buffer/Makefile
484         src/operation/distance/Makefile
485         src/operation/linemerge/Makefile
486         src/operation/overlay/Makefile
487         src/operation/polygonize/Makefile
488         src/operation/predicate/Makefile
489         src/operation/relate/Makefile
490         src/operation/sharedpaths/Makefile
491         src/operation/union/Makefile
492         src/operation/valid/Makefile
493         src/planargraph/Makefile
494         src/precision/Makefile
495         src/simplify/Makefile
496         src/util/Makefile
497         swig/geos.i
498         swig/Makefile
499         swig/python/Makefile
500         swig/python/tests/Makefile
501         swig/ruby/Makefile
502         swig/ruby/test/Makefile
503         php/Makefile
504         php/test/Makefile
505         tests/Makefile
506         tests/bigtest/Makefile
507         tests/unit/Makefile
508         tests/perf/Makefile
509         tests/perf/operation/Makefile
510         tests/perf/operation/buffer/Makefile
511         tests/perf/operation/predicate/Makefile
512         tests/perf/capi/Makefile
513         tests/xmltester/Makefile
514         tests/geostest/Makefile
515         tests/thread/Makefile
516         tools/Makefile
517         tools/geos-config
518         ])
520 dnl -- echo "---------------------------------------"
521 dnl -- echo "Boost UTF: $use_boost_utf"
522 echo "Swig: $use_swig"
523 echo "Python bindings: $use_python"
524 echo "Ruby bindings: $use_ruby"
526 echo "PHP bindings: $use_php"
527 if test x"$use_php" = xtrue; then
528  echo " PHP: $PHP"
529  echo " PHPUNIT: $PHPUNIT"
530  if test x"$PHP" = x -o x"$PHPUNIT" = x; then
531    AC_MSG_WARN([PHP Unit testing disabled (missing PHP or PHPUNIT)])
532  fi
535 dnl -- echo "---------------------------------------"