Install BufferInputLineSimplifier.h header (#548)
[geos.git] / configure.in
blobdbc72524690755525a68ac6ee8ee2a1ace03dc69
1 dnl
2 dnl configure.in - autoconf input template to produce ./configure script
3 dnl
4 dnl version 2.52 is required for Cygwin libtool support
5 AC_PREREQ([2.52])
7 dnl local vars to hold user's preferences --------------------------------
8 AC_INIT([include/geos.h])
9 AC_CANONICAL_SYSTEM
11 AC_CONFIG_MACRO_DIR([macros])
13 dnl -- JTS_PORT: the version of JTS this release is bound to
14 JTS_PORT=1.12.0
16 dnl -- Version info for the CAPI
17 CAPI_INTERFACE_CURRENT=9
18 CAPI_INTERFACE_REVISION=0
19 CAPI_INTERFACE_AGE=8
21 dnl
22 dnl -- Release versions / C++ library SONAME will use these
23 dnl -- encoding ABI break at every release
24 dnl
25 VERSION_MAJOR=3
26 VERSION_MINOR=4
27 VERSION_PATCH=0dev
28 VERSION="$VERSION_MAJOR.$VERSION_MINOR.$VERSION_PATCH"
30 dnl CAPI_VERSION_MAJOR=$(($CAPI_INTERFACE_CURRENT-$CAPI_INTERFACE_AGE))
31 dnl the following should be more portable
32 CAPI_VERSION_MAJOR=`expr $CAPI_INTERFACE_CURRENT - $CAPI_INTERFACE_AGE`
33 CAPI_VERSION_MINOR=$CAPI_INTERFACE_AGE
34 CAPI_VERSION_PATCH=$CAPI_INTERFACE_REVISION
35 CAPI_VERSION="$CAPI_VERSION_MAJOR.$CAPI_VERSION_MINOR.$CAPI_VERSION_PATCH"
37 AM_INIT_AUTOMAKE([geos], [$VERSION], [no-define])
38 AM_MAINTAINER_MODE
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 AC_ARG_ENABLE([glibcxx-debug], [  --enable-glibcxx-debug    Enable libstdc++ debug mode],
97         [case "${enableval}" in
98                 yes) enable_glibcxx_debug=true ;;
99                 no)  enable_glibcxx_debug=false ;;
100                 *) AC_MSG_ERROR(bad value ${enableval} for --enable-glibcxx-debug);;
101         esac],
102         [enable_glibcxx_debug=false]
106 AC_MSG_CHECKING([if requested to force inline functions])
107 INLINE_FLAGS=
108 AC_SUBST(INLINE_FLAGS)
109 if test x"$enable_inline" = xtrue; then
110         INLINE_FLAGS="-DGEOS_INLINE"
111         AM_CXXFLAGS="$AM_CXXFLAGS $INLINE_FLAGS"
112     AC_MSG_RESULT([yes])
113 else
114     AC_MSG_RESULT([no])
117 AC_MSG_CHECKING([if requested to enable assert macros])
118 if test x"$enable_cassert" = xfalse; then
119         AM_CXXFLAGS="$AM_CXXFLAGS -DNDEBUG"
120     AC_MSG_RESULT([no])
121 else
122     AC_MSG_RESULT([yes])
125 AC_MSG_CHECKING([if requested libstdc++ debug mode])
126 if test x"$enable_glibcxx_debug" = xtrue; then
127     AM_CXXFLAGS="$AM_CXXFLAGS -D_GLIBCXX_DEBUG=1 -D_GLIBCXX_DEBUG_PEDANTIC=1"
128     AC_MSG_RESULT([yes])
129 else
130     AC_MSG_RESULT([no])
133 dnl --------------------------------------------------------------------
134 dnl - Append default C++ and C flags 
135 dnl --------------------------------------------------------------------
137 dnl In order for AC_LIBTOOL_COMPILER_OPTION to use
138 dnl the C compiler we need the hack below.
139 dnl It is likely a bug in the libtool macro file to
140 dnl require AC_LIBTOOL_LANG_CXX_CONFIG in *addition*
141 dnl to AC_LANG(CXX) or AC_LANG_PUSH(CXX)/AC_LANG_POP()
142 dnl 
143 AC_LIBTOOL_LANG_CXX_CONFIG
145 # Set default AM_CXXFLAGS and AM_CFLAGS 
146 # -pedantic: ISO does not support long long
147 # we add -Wno-long-long to avoid those messages
148 WARNFLAGS=""
149 AC_LIBTOOL_COMPILER_OPTION([if $compiler supports -pedantic], [dummy_cv_pedantic], [-pedantic], [], [WARNFLAGS="$WARNFLAGS -pedantic"], [])
150 AC_LIBTOOL_COMPILER_OPTION([if $compiler supports -Wall], [dummy_cv_wall], [-Wall], [], [WARNFLAGS="$WARNFLAGS -Wall"], [])
151 AC_LIBTOOL_COMPILER_OPTION([if $compiler supports -ansi], [dummy_cv_ansi], [-ansi], [], [WARNFLAGS="$WARNFLAGS -ansi"], [])
152 AC_LIBTOOL_COMPILER_OPTION([if $compiler supports -Wno-long-long], [dummy_cv_no_long_long], [-Wno-long-long], [], [WARNFLAGS="$WARNFLAGS -Wno-long-long"], [])
154 # To make numerical computation more stable, we use --ffloat-store
155 NUMERICFLAGS=""
156 AC_LIBTOOL_COMPILER_OPTION([if $compiler supports -ffloat-store], [dummy_cv_ffloat_store], [-ffloat-store], [], [NUMERICFLAGS="$NUMERICFLAGS -ffloat-store"], [])
158 DEFAULTFLAGS="${WARNFLAGS} ${NUMERICFLAGS}"
160 AM_CXXFLAGS="${AM_CXXFLAGS} ${DEFAULTFLAGS}"
161 AM_CFLAGS="${AM_CFLAGS} ${DEFAULTFLAGS}"
162 AC_SUBST(AM_CXXFLAGS)
163 AC_SUBST(AM_CFLAGS)
165 dnl --------------------------------------------------------------------
166 dnl - Look for finite and/or isfinite macros/functions
167 dnl --------------------------------------------------------------------
169 dnl These two tests need the math library or they won't link
170 dnl on OpenBSD, even if the functions exist.
171 save_LIBS=$LIBS
172 LIBS="$LIBS -lm"
173 AC_CACHE_CHECK([for finite], ac_cv_finite,
174  [AC_TRY_LINK([#include <math.h>],
175  [double x; int y; y = finite(x);],
176  ac_cv_finite=yes,
177  ac_cv_finite=no
179 if test x"$ac_cv_finite" = x"yes"; then
180   AC_DEFINE(HAVE_FINITE, [1], [Has finite])
183 AC_CACHE_CHECK([for isfinite], ac_cv_isfinite,
184  [AC_TRY_LINK([#include <math.h>],
185  [double x; int y; y = isfinite(x);],
186  ac_cv_isfinite=yes,
187  ac_cv_isfinite=no
189 if test x"$ac_cv_isfinite" = x"yes"; then
190   AC_DEFINE(HAVE_ISFINITE, [1], [Has isfinite])
193 dnl --------------------------------------------------------------------
194 dnl Test for presence of isnan function when using C++ and <cmath>
195 dnl This is for a particular bug in OS/X where <cmath> drops the definition
196 dnl of isnan().
198 AC_LANG_PUSH([C++])
199 AC_CACHE_CHECK([for isnan], ac_cv_isnan,
200  [AC_TRY_LINK([#include <cmath>],
201  [double x; int y; y = isnan(x);],
202  ac_cv_isnan=yes,
203  ac_cv_isnan=no
205 if test x"$ac_cv_isnan" = x"yes"; then
206   AC_DEFINE(HAVE_ISNAN, [1], [Has isnan])
208 AC_LANG_POP([C++])
210 dnl --------------------------------------------------------------------
212 LIBS=$save_LIBS
214 dnl --------------------------------------------------------------------
215 dnl - Look for a 64bit integer (do after CFLAGS is set)
216 dnl --------------------------------------------------------------------
218 dnl Find a working 64bit integer
219 PGAC_TYPE_64BIT_INT([int64_t])
220 if test x"$HAVE_INT64_T_64" = x"no" ; then
221   PGAC_TYPE_64BIT_INT([long int])
222   if test x"$HAVE_LONG_INT_64" = x"no" ; then
223     PGAC_TYPE_64BIT_INT([long long int])
224     if test x"$HAVE_LONG_LONG_INT_64" = x"no" ; then
225       AC_MSG_WARN([Could not find a working 64bit int type, you may experience weird bugs (undefined behaviour)]);
226     fi
227   fi
232 dnl --------------------------------------------------------------------
233 dnl - check whether python is required for the build
234 dnl --------------------------------------------------------------------
236 AC_ARG_ENABLE([python], [  --enable-python    Enable build of python module],
237         [case "${enableval}" in
238                 yes) use_python=true ;;
239                 no)  use_python=false ;;
240                 *) AC_MSG_ERROR(bad value ${enableval} for --enable-python) ;;
241         esac],
242         [use_python=false]
246 dnl --------------------------------------------------------------------
247 dnl - check whether ruby is required for the build
248 dnl --------------------------------------------------------------------
250 AC_ARG_ENABLE([ruby], [  --enable-ruby    Enable build of ruby module],
251         [case "${enableval}" in
252                 yes) use_ruby=true ;;
253                 no)  use_ruby=false ;;
254                 *) AC_MSG_ERROR(bad value ${enableval} for --enable-ruby) ;;
255         esac],
256         [use_ruby=false]
259 dnl --------------------------------------------------------------------
260 dnl - check whether php is required for the build
261 dnl --------------------------------------------------------------------
263 AC_ARG_ENABLE([php], [  --enable-php    Enable build of php module],
264         [case "${enableval}" in
265                 yes) use_php=true ;;
266                 no)  use_php=false ;;
267                 *) AC_MSG_ERROR(bad value ${enableval} for --enable-php) ;;
268         esac],
269         [use_php=false]
273 dnl --------------------------------------------------------------------
274 dnl - check for swig if python, ruby or php are enabled
275 dnl --------------------------------------------------------------------
277 use_swig=false
278 if test x"$use_python" = xtrue ||
279    test x"$use_ruby" = xtrue; then
280         AC_PROG_SWIG(1.3.28)
281         if test x"$SWIG" != "x"; then
282             SWIG_ENABLE_CXX     
283             AC_SUBST(SWIG)           
285             use_swig=true 
286         fi
288 AM_CONDITIONAL(ENABLE_SWIG, [ test x"$use_swig" = xtrue ])
291 dnl --------------------------------------------------------------------
292 dnl - check for python if enabled
293 dnl --------------------------------------------------------------------
295 if test x"$use_python" = xtrue; then
296         dnl Check for Python 
297         AM_PATH_PYTHON  
298         SWIG_PYTHON
300         if test x"$PYTHON" = "x"; then
301                 use_python=false
302         fi
303         
304         AC_SUBST(PYTHON)
305         AC_SUBST(SWIG_PYTHON_CPPFLAGS)
306         AC_SUBST(SWIG_PYTHON_OPT)
308 AM_CONDITIONAL(ENABLE_PYTHON, [test x"$use_python" = xtrue])
311 dnl --------------------------------------------------------------------
312 dnl - check for ruby if enabled
313 dnl --------------------------------------------------------------------
315 if test x"$use_ruby" = xtrue; then
316         dnl Check for Ruby 
317         AC_RUBY_DEVEL
319         if test x"$RUBY" = x; then
320                 use_ruby=false
321         fi
324 AM_CONDITIONAL(ENABLE_RUBY, [ test x"$use_ruby" = xtrue ])
326 dnl --------------------------------------------------------------------
327 dnl - check for php if enabled
328 dnl --------------------------------------------------------------------
330 if test x"$use_php" = xtrue; then
331         dnl Check for PHP 
332         AC_PATH_PROG(PHP_CONFIG, php-config)
334         if test x"$PHP_CONFIG" = x; then
335                 AC_MSG_WARN([php-config not found, php support disabled])
336                 use_php=false
337         else
339                 dnl TODO: check for version, we want PHP5 dev files
341                 AC_PATH_PROG(PHP, php) dnl for unit testing
342                 AC_PATH_PROG(PHPUNIT, phpunit) dnl for unit testing
343         fi
347 AM_CONDITIONAL(ENABLE_PHP, [ test x"$use_php" = xtrue ])
348 AM_CONDITIONAL(HAVE_PHP, [ test x"$PHP" != x ])
349 AM_CONDITIONAL(HAVE_PHP_UNIT, [ test x"$PHPUNIT" != x ])
352 dnl --------------------------------------------------------------------
353 dnl - do operating-system specific things
354 dnl --------------------------------------------------------------------
356 AC_MSG_CHECKING([OS-specific settings])
358 case "${host_os}" in
359         *darwin*)
360                 AC_MSG_RESULT([${host_os}])
361                 AC_MSG_CHECKING([for OS/X version])
362                 kernel=`uname -r`
364                 # "Darwin 9.6.0" is Mac OSX 10.5.6
365                 # "Darwin 10.x" would presumably be Mac OS X 10.6.x
366                 case "${kernel}" in
367                         8.*)
368                                 AC_MSG_RESULT([Mac OS X 10.4 Tiger])
369                                 ;;
370                         9.*)
371                                 AC_MSG_RESULT([Mac OS X 10.5 Leopard])
372                                 ;;
373                         10.*)
374 dnl                             AM_CXXFLAGS="$AM_CXXFLAGS -Wnon-virtual-dtor -Woverloaded-virtual"
375                                 AC_MSG_RESULT([Mac OS X 10.6 Snow Leopard])
376                                 ;;
377                         *)
378                                 AC_MSG_RESULT([Mac OS X (Darwin ${kernel} kernel)])
379                                 ;;
380                 esac
381                 ;;
382 esac
384 dnl --------------------------------------------------------------------
385 dnl - check for boost 
386 dnl --------------------------------------------------------------------
388 dnl -- AX_BOOST(1.32)
389 dnl -- if test "x$ax_cv_boost_unit_test_framework" = "xyes"; then
390 dnl --  use_boost_utf=yes
391 dnl -- else
392 dnl --  use_boost_utf=no
393 dnl -- fi
394 dnl -- AM_CONDITIONAL(ENABLE_BOOST_UTF, [test "x$use_boost_utf" = "xyes"])
396 dnl things to substitute in output ----------------------------------------
397 AC_SUBST(VERSION)
398 AC_SUBST(VERSION_MAJOR)
399 AC_SUBST(VERSION_MINOR)
400 AC_SUBST(VERSION_PATCH)
401 AC_SUBST(INTERFACE_CURRENT)
402 AC_SUBST(INTERFACE_REVISION)
403 AC_SUBST(INTERFACE_AGE)
404 AC_SUBST(JTS_PORT)
405 AC_SUBST(CAPI_VERSION)
406 AC_SUBST(CAPI_VERSION_MAJOR)
407 AC_SUBST(CAPI_VERSION_MINOR)
408 AC_SUBST(CAPI_VERSION_PATCH)
409 AC_SUBST(CAPI_INTERFACE_CURRENT)
410 AC_SUBST(CAPI_INTERFACE_REVISION)
411 AC_SUBST(CAPI_INTERFACE_AGE)
413 dnl output stuff ----------------------------------------------------------
415 AC_OUTPUT([
416         Makefile 
417         capi/Makefile
418         capi/geos_c.h
419         doc/Doxyfile
420         doc/Makefile
421         macros/Makefile
422         src/Makefile 
423         src/algorithm/Makefile
424         src/algorithm/locate/Makefile
425         src/algorithm/distance/Makefile
426         src/geom/Makefile
427         src/geom/prep/Makefile
428         src/geom/util/Makefile
429         src/geomgraph/Makefile
430         src/geomgraph/index/Makefile
431         include/Makefile
432         include/geos/Makefile
433         include/geos/algorithm/Makefile
434         include/geos/algorithm/locate/Makefile
435         include/geos/algorithm/distance/Makefile
436         include/geos/geom/Makefile
437         include/geos/geom/prep/Makefile
438         include/geos/geom/util/Makefile
439         include/geos/geomgraph/Makefile
440         include/geos/geomgraph/index/Makefile
441         include/geos/index/Makefile
442         include/geos/index/bintree/Makefile
443         include/geos/index/chain/Makefile
444         include/geos/index/intervalrtree/Makefile
445         include/geos/index/quadtree/Makefile
446         include/geos/index/strtree/Makefile
447         include/geos/index/sweepline/Makefile
448         include/geos/io/Makefile
449         include/geos/linearref/Makefile
450         include/geos/noding/Makefile
451         include/geos/noding/snapround/Makefile
452         include/geos/operation/Makefile
453         include/geos/operation/buffer/Makefile
454         include/geos/operation/distance/Makefile
455         include/geos/operation/linemerge/Makefile
456         include/geos/operation/overlay/Makefile
457         include/geos/operation/overlay/snap/Makefile
458         include/geos/operation/polygonize/Makefile
459         include/geos/operation/predicate/Makefile
460         include/geos/operation/relate/Makefile
461         include/geos/operation/sharedpaths/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/sharedpaths/Makefile
490         src/operation/union/Makefile
491         src/operation/valid/Makefile
492         src/planargraph/Makefile
493         src/precision/Makefile
494         src/simplify/Makefile
495         src/util/Makefile
496         swig/geos.i
497         swig/Makefile
498         swig/python/Makefile
499         swig/python/tests/Makefile
500         swig/ruby/Makefile
501         swig/ruby/test/Makefile
502         php/Makefile
503         php/test/Makefile
504         tests/Makefile
505         tests/bigtest/Makefile
506         tests/unit/Makefile
507         tests/perf/Makefile
508         tests/perf/operation/Makefile
509         tests/perf/operation/buffer/Makefile
510         tests/perf/operation/predicate/Makefile
511         tests/perf/capi/Makefile
512         tests/xmltester/Makefile
513         tests/geostest/Makefile
514         tests/thread/Makefile
515         tools/Makefile
516         tools/geos-config
517         ])
519 dnl -- echo "---------------------------------------"
520 dnl -- echo "Boost UTF: $use_boost_utf"
521 echo "Swig: $use_swig"
522 echo "Python bindings: $use_python"
523 echo "Ruby bindings: $use_ruby"
525 echo "PHP bindings: $use_php"
526 if test x"$use_php" = xtrue; then
527  echo " PHP: $PHP"
528  echo " PHPUNIT: $PHPUNIT"
529  if test x"$PHP" = x -o x"$PHPUNIT" = x; then
530    AC_MSG_WARN([PHP Unit testing disabled (missing PHP or PHPUNIT)])
531  fi
534 dnl -- echo "---------------------------------------"