Geometry->{pointOnSurface,centroid}
[geos.git] / configure.in
blob2b4d40d9fb92270832ae14636a0aa0141689fcdb
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.10.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_CONFIG_HEADER([include/config.h])
40 AM_CONFIG_HEADER([include/geos/platform.h])
41 AC_PROG_CC
43 dnl use libtool ----------------------------------------------------------
44 AC_LIBTOOL_DLOPEN
45 AC_LIBTOOL_WIN32_DLL
46 AC_PROG_LIBTOOL
48 dnl check for programs ----------------------------------------------------
49 AC_PROG_CXX
50 AC_ISC_POSIX
51 AC_PROG_INSTALL
52 AC_PROG_MAKE_SET
54 dnl function checks ------------------------------------------------------
55 AC_FUNC_CLOSEDIR_VOID
56 AC_FUNC_MEMCMP
57 AC_FUNC_STRFTIME
58 AC_FUNC_VPRINTF
59 AC_FUNC_ALLOCA
60 AC_HEADER_DIRENT
61 AC_HEADER_STDC
62 AC_CHECK_HEADERS([memory.h])
63 AC_CHECK_HEADERS([unistd.h])
64 AC_CHECK_HEADERS([ieeefp.h])
65 AC_CHECK_HEADERS([sys/file.h])
66 AC_CHECK_HEADERS([sys/time.h])
67 AC_CHECK_FUNCS([strchr memcpy gettimeofday])
68 AC_HEADER_STAT
69 AC_STRUCT_TM
70 AC_TYPE_SIZE_T
71 AC_C_CONST
73 dnl --------------------------------------------------------------------
74 dnl - Check for inline and cassert settings
75 dnl --------------------------------------------------------------------
78 AC_ARG_ENABLE([inline], [  --disable-inline    Disable inlining],
79         [case "${enableval}" in
80                 yes) enable_inline=true ;;
81                 no)  enable_inline=false ;;
82                 *) AC_MSG_ERROR(bad value ${enableval} for --enable-inline);;
83         esac],
84         [enable_inline=true]
87 AC_ARG_ENABLE([cassert], [  --disable-cassert   Disable assertion checking],
88         [case "${enableval}" in
89                 yes) enable_cassert=true ;;
90                 no)  enable_cassert=false ;;
91                 *) AC_MSG_ERROR(bad value ${enableval} for --enable-cassert);;
92         esac],
93         [enable_cassert=true]
96 INLINE_FLAGS=
97 AC_SUBST(INLINE_FLAGS)
98 if test x"$enable_inline" = xtrue; then
99         INLINE_FLAGS="-DGEOS_INLINE"
100         AM_CXXFLAGS="$AM_CXXFLAGS $INLINE_FLAGS"
103 if test x"$enable_cassert" = xfalse; then
104         AM_CXXFLAGS="$AM_CXXFLAGS -DNDEBUG"
107 dnl --------------------------------------------------------------------
108 dnl - Append default C++ and C flags 
109 dnl --------------------------------------------------------------------
111 dnl In order for AC_LIBTOOL_COMPILER_OPTION to use
112 dnl the C compiler we need the hack below.
113 dnl It is likely a bug in the libtool macro file to
114 dnl require AC_LIBTOOL_LANG_CXX_CONFIG in *addition*
115 dnl to AC_LANG(CXX) or AC_LANG_PUSH(CXX)/AC_LANG_POP()
116 dnl 
117 AC_LIBTOOL_LANG_CXX_CONFIG
119 # Set default AM_CXXFLAGS and AM_CFLAGS 
120 # -pedantic: ISO does not support long long
121 # we add -Wno-long-long to avoid those messages
122 WARNFLAGS=""
123 AC_LIBTOOL_COMPILER_OPTION([if $compiler supports -pedantic], [dummy_cv_pedantic], [-pedantic], [], [WARNFLAGS="$WARNFLAGS -pedantic"], [])
124 AC_LIBTOOL_COMPILER_OPTION([if $compiler supports -Wall], [dummy_cv_wall], [-Wall], [], [WARNFLAGS="$WARNFLAGS -Wall"], [])
125 AC_LIBTOOL_COMPILER_OPTION([if $compiler supports -ansi], [dummy_cv_ansi], [-ansi], [], [WARNFLAGS="$WARNFLAGS -ansi"], [])
126 AC_LIBTOOL_COMPILER_OPTION([if $compiler supports -Wno-long-long], [dummy_cv_no_long_long], [-Wno-long-long], [], [WARNFLAGS="$WARNFLAGS -Wno-long-long"], [])
128 # To make numerical computation more stable, we use --ffloat-store
129 NUMERICFLAGS=""
130 AC_LIBTOOL_COMPILER_OPTION([if $compiler supports -ffloat-store], [dummy_cv_ffloat_store], [-ffloat-store], [], [NUMERICFLAGS="$NUMERICFLAGS -ffloat-store"], [])
132 DEFAULTFLAGS="${WARNFLAGS} ${NUMERICFLAGS}"
134 AM_CXXFLAGS="${AM_CXXFLAGS} ${DEFAULTFLAGS}"
135 AM_CFLAGS="${AM_CFLAGS} ${DEFAULTFLAGS}"
136 AC_SUBST(AM_CXXFLAGS)
137 AC_SUBST(AM_CFLAGS)
139 dnl --------------------------------------------------------------------
140 dnl - Look for finite and/or isfinite macros/functions
141 dnl --------------------------------------------------------------------
143 dnl These two tests need the math library or they won't link
144 dnl on OpenBSD, even if the functions exist.
145 save_LIBS=$LIBS
146 LIBS="$LIBS -lm"
147 AC_CACHE_CHECK([for finite], ac_cv_finite,
148  [AC_TRY_LINK([#include <math.h>],
149  [double x; int y; y = finite(x);],
150  ac_cv_finite=yes,
151  ac_cv_finite=no
153 if test x"$ac_cv_finite" = x"yes"; then
154   AC_DEFINE(HAVE_FINITE, [1], [Has finite])
157 AC_CACHE_CHECK([for isfinite], ac_cv_isfinite,
158  [AC_TRY_LINK([#include <math.h>],
159  [double x; int y; y = isfinite(x);],
160  ac_cv_isfinite=yes,
161  ac_cv_isfinite=no
163 if test x"$ac_cv_isfinite" = x"yes"; then
164   AC_DEFINE(HAVE_ISFINITE, [1], [Has isfinite])
167 dnl --------------------------------------------------------------------
168 dnl Test for presence of isnan function when using C++ and <cmath>
169 dnl This is for a particular bug in OS/X where <cmath> drops the definition
170 dnl of isnan().
172 AC_LANG_PUSH([C++])
173 AC_CACHE_CHECK([for isnan], ac_cv_isnan,
174  [AC_TRY_LINK([#include <cmath>],
175  [double x; int y; y = isnan(x);],
176  ac_cv_isnan=yes,
177  ac_cv_isnan=no
179 if test x"$ac_cv_isnan" = x"yes"; then
180   AC_DEFINE(HAVE_ISNAN, [1], [Has isnan])
182 AC_LANG_POP([C++])
184 dnl --------------------------------------------------------------------
186 LIBS=$save_LIBS
188 dnl --------------------------------------------------------------------
189 dnl - Look for a 64bit integer (do after CFLAGS is set)
190 dnl --------------------------------------------------------------------
192 dnl Find a working 64bit integer
193 PGAC_TYPE_64BIT_INT([int64_t])
194 if test x"$HAVE_INT64_T_64" = x"no" ; then
195   PGAC_TYPE_64BIT_INT([long int])
196   if test x"$HAVE_LONG_INT_64" = x"no" ; then
197     PGAC_TYPE_64BIT_INT([long long int])
198     if test x"$HAVE_LONG_LONG_INT_64" = x"no" ; then
199       AC_MSG_WARN([Could not find a working 64bit int type, you may experience weird bugs (undefined behaviour)]);
200     fi
201   fi
206 dnl --------------------------------------------------------------------
207 dnl - check whether python is required for the build
208 dnl --------------------------------------------------------------------
210 AC_ARG_ENABLE([python], [  --enable-python    Enable build of python module],
211         [case "${enableval}" in
212                 yes) use_python=true ;;
213                 no)  use_python=false ;;
214                 *) AC_MSG_ERROR(bad value ${enableval} for --enable-python) ;;
215         esac],
216         [use_python=false]
220 dnl --------------------------------------------------------------------
221 dnl - check whether ruby is required for the build
222 dnl --------------------------------------------------------------------
224 AC_ARG_ENABLE([ruby], [  --enable-ruby    Enable build of ruby module],
225         [case "${enableval}" in
226                 yes) use_ruby=true ;;
227                 no)  use_ruby=false ;;
228                 *) AC_MSG_ERROR(bad value ${enableval} for --enable-ruby) ;;
229         esac],
230         [use_ruby=false]
233 dnl --------------------------------------------------------------------
234 dnl - check whether php is required for the build
235 dnl --------------------------------------------------------------------
237 AC_ARG_ENABLE([php], [  --enable-php    Enable build of php module],
238         [case "${enableval}" in
239                 yes) use_php=true ;;
240                 no)  use_php=false ;;
241                 *) AC_MSG_ERROR(bad value ${enableval} for --enable-php) ;;
242         esac],
243         [use_php=false]
247 dnl --------------------------------------------------------------------
248 dnl - check for swig if python, ruby or php are enabled
249 dnl --------------------------------------------------------------------
251 use_swig=false
252 if test x"$use_python" = xtrue ||
253    test x"$use_ruby" = xtrue; then
254         AC_PROG_SWIG(1.3.28)
255         if test x"$SWIG" != "x"; then
256             SWIG_ENABLE_CXX     
257             AC_SUBST(SWIG)           
259             use_swig=true 
260         fi
262 AM_CONDITIONAL(ENABLE_SWIG, [ test x"$use_swig" = xtrue ])
265 dnl --------------------------------------------------------------------
266 dnl - check for python if enabled
267 dnl --------------------------------------------------------------------
269 if test x"$use_python" = xtrue; then
270         dnl Check for Python 
271         AM_PATH_PYTHON  
272         SWIG_PYTHON
274         if test x"$PYTHON" = "x"; then
275                 use_python=false
276         fi
277         
278         AC_SUBST(PYTHON)
279         AC_SUBST(SWIG_PYTHON_CPPFLAGS)
280         AC_SUBST(SWIG_PYTHON_OPT)
282 AM_CONDITIONAL(ENABLE_PYTHON, [test x"$use_python" = xtrue])
285 dnl --------------------------------------------------------------------
286 dnl - check for ruby if enabled
287 dnl --------------------------------------------------------------------
289 if test x"$use_ruby" = xtrue; then
290         dnl Check for Ruby 
291         AC_RUBY_DEVEL
293         if test x"$RUBY" = x; then
294                 use_ruby=false
295         fi
298 AM_CONDITIONAL(ENABLE_RUBY, [ test x"$use_ruby" = xtrue ])
300 dnl --------------------------------------------------------------------
301 dnl - check for php if enabled
302 dnl --------------------------------------------------------------------
304 if test x"$use_php" = xtrue; then
305         dnl Check for PHP 
306         AC_PATH_PROG(PHP_CONFIG, php-config)
308         if test x"$PHP_CONFIG" = x; then
309                 AC_MSG_WARN([php-config not found, php support disabled])
310                 use_php=false
311         else
313                 dnl TODO: check for version, we want PHP5 dev files
315                 AC_PATH_PROG(PHP, php) dnl for unit testing
316                 AC_PATH_PROG(PHPUNIT, phpunit) dnl for unit testing
318                 if test x"$PHP" != x -a x"$PHPUNIT" != x; then
319                         can_test_php=true
320                 else
321                         AC_MSG_WARN([php or phpunit not found, php binding tests disabled])
322                         can_test_php=false
323                 fi
325         fi
329 AM_CONDITIONAL(ENABLE_PHP, [ test x"$use_php" = xtrue ])
330 AM_CONDITIONAL(ENABLE_PHP_TESTS, [ test x"$can_test_php" = xtrue ])
333 dnl --------------------------------------------------------------------
334 dnl - do operating-system specific things
335 dnl --------------------------------------------------------------------
337 AC_MSG_CHECKING([OS-specific settings])
339 case "${host_os}" in
340         *darwin*)
341                 AC_MSG_RESULT([${host_os}])
342                 AC_MSG_CHECKING([for OS/X version])
343                 kernel=`uname -r`
345                 # "Darwin 9.6.0" is Mac OSX 10.5.6
346                 # "Darwin 10.x" would presumably be Mac OS X 10.6.x
347                 case "${kernel}" in
348                         8.*)
349                                 AC_MSG_RESULT([Mac OS X 10.4 Tiger])
350                                 ;;
351                         9.*)
352                                 AC_MSG_RESULT([Mac OS X 10.5 Leopard])
353                                 ;;
354                         10.*)
355 dnl                             AM_CXXFLAGS="$AM_CXXFLAGS -Wnon-virtual-dtor -Woverloaded-virtual"
356                                 AC_MSG_RESULT([Mac OS X 10.6 Snow Leopard])
357                                 ;;
358                         *)
359                                 AC_MSG_RESULT([Mac OS X (Darwin ${kernel} kernel)])
360                                 ;;
361                 esac
362                 ;;
363 esac
365 dnl --------------------------------------------------------------------
366 dnl - check for boost 
367 dnl --------------------------------------------------------------------
369 dnl -- AX_BOOST(1.32)
370 dnl -- if test "x$ax_cv_boost_unit_test_framework" = "xyes"; then
371 dnl --  use_boost_utf=yes
372 dnl -- else
373 dnl --  use_boost_utf=no
374 dnl -- fi
375 dnl -- AM_CONDITIONAL(ENABLE_BOOST_UTF, [test "x$use_boost_utf" = "xyes"])
377 dnl things to substitute in output ----------------------------------------
378 AC_SUBST(VERSION)
379 AC_SUBST(VERSION_MAJOR)
380 AC_SUBST(VERSION_MINOR)
381 AC_SUBST(VERSION_PATCH)
382 AC_SUBST(INTERFACE_CURRENT)
383 AC_SUBST(INTERFACE_REVISION)
384 AC_SUBST(INTERFACE_AGE)
385 AC_SUBST(JTS_PORT)
386 AC_SUBST(CAPI_VERSION)
387 AC_SUBST(CAPI_VERSION_MAJOR)
388 AC_SUBST(CAPI_VERSION_MINOR)
389 AC_SUBST(CAPI_VERSION_PATCH)
390 AC_SUBST(CAPI_INTERFACE_CURRENT)
391 AC_SUBST(CAPI_INTERFACE_REVISION)
392 AC_SUBST(CAPI_INTERFACE_AGE)
394 dnl output stuff ----------------------------------------------------------
396 AC_OUTPUT([
397         Makefile 
398         build/Makefile
399         build/msvc80/Makefile
400         build/msvc80/geos_c_dll/Makefile
401         build/msvc80/geos_lib/Makefile
402         build/msvc80/geos_python/Makefile
403         build/msvc80/geos_ruby/Makefile
404         build/msvc80/geos_unit/Makefile
405         build/msvc80/geos_xmltester/Makefile
406         build/msvc90/Makefile
407         build/msvc90/geos_c_dll/Makefile
408         build/msvc90/geos_lib/Makefile
409         build/msvc90/geos_python/Makefile
410         build/msvc90/geos_ruby/Makefile
411         build/msvc90/geos_unit/Makefile
412         build/msvc90/geos_xmltester/Makefile
413         build/msvc10/Makefile
414         build/msvc10/geos_c_dll/Makefile
415         build/msvc10/geos_lib/Makefile
416         build/msvc10/geos_unit/Makefile
417         build/msvc10/geos_xmltester/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/union/Makefile
463         include/geos/operation/valid/Makefile
464         include/geos/planargraph/Makefile
465         include/geos/planargraph/algorithm/Makefile
466         include/geos/precision/Makefile
467         include/geos/simplify/Makefile
468         include/geos/util/Makefile
469         include/geos/version.h
470         src/index/Makefile
471         src/index/bintree/Makefile
472         src/index/chain/Makefile
473         src/index/intervalrtree/Makefile
474         src/index/quadtree/Makefile
475         src/index/strtree/Makefile
476         src/index/sweepline/Makefile
477         src/io/Makefile
478         src/linearref/Makefile
479         src/noding/Makefile
480         src/noding/snapround/Makefile
481         src/operation/Makefile
482         src/operation/buffer/Makefile
483         src/operation/distance/Makefile
484         src/operation/linemerge/Makefile
485         src/operation/overlay/Makefile
486         src/operation/polygonize/Makefile
487         src/operation/predicate/Makefile
488         src/operation/relate/Makefile
489         src/operation/union/Makefile
490         src/operation/valid/Makefile
491         src/planargraph/Makefile
492         src/precision/Makefile
493         src/simplify/Makefile
494         src/util/Makefile
495         swig/geos.i
496         swig/Makefile
497         swig/python/Makefile
498         swig/python/tests/Makefile
499         swig/ruby/Makefile
500         swig/ruby/test/Makefile
501         php/Makefile
502         php/test/Makefile
503         tests/Makefile
504         tests/bigtest/Makefile
505         tests/unit/Makefile
506         tests/perf/Makefile
507         tests/perf/operation/Makefile
508         tests/perf/operation/buffer/Makefile
509         tests/xmltester/Makefile
510         tests/geostest/Makefile
511         tests/thread/Makefile
512         tools/Makefile
513         tools/geos-config
514         ])
516 dnl -- echo "---------------------------------------"
517 dnl -- echo "Boost UTF: $use_boost_utf"
518 echo "Swig: $use_swig"
519 echo "Python: $use_python"
520 echo "Ruby: $use_ruby"
521 echo "PHP: $use_php"
522 dnl -- echo "---------------------------------------"