Quotes around otherwise ambiguous (underline containing) name
[geos.git] / configure.ac
blob37122a3dd05b0a5541ba6c634ecd9a4e0f07bd2b
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.13.0
16 dnl -- Version info for the CAPI
17 CAPI_INTERFACE_CURRENT=12
18 CAPI_INTERFACE_REVISION=0
19 CAPI_INTERFACE_AGE=11
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=7
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 AC_CONFIG_HEADERS([include/config.h] [include/geos/platform.h])
40 AC_PROG_CC
42 dnl use libtool ----------------------------------------------------------
43 AC_LIBTOOL_DLOPEN
44 AC_LIBTOOL_WIN32_DLL
45 AC_PROG_LIBTOOL
47 dnl check for programs ----------------------------------------------------
48 AC_PROG_CXX
49 AC_ISC_POSIX
50 AC_PROG_INSTALL
51 AC_PROG_MAKE_SET
53 dnl function checks ------------------------------------------------------
54 AC_FUNC_CLOSEDIR_VOID
55 AC_FUNC_MEMCMP
56 AC_FUNC_STRFTIME
57 AC_FUNC_VPRINTF
58 AC_FUNC_ALLOCA
59 AC_HEADER_DIRENT
60 AC_HEADER_STDC
61 AC_CHECK_HEADERS([memory.h])
62 AC_CHECK_HEADERS([unistd.h])
63 AC_CHECK_HEADERS([ieeefp.h])
64 AC_CHECK_HEADERS([sys/file.h])
65 AC_CHECK_HEADERS([sys/time.h])
66 AC_CHECK_FUNCS([strchr memcpy gettimeofday])
67 AC_HEADER_STAT
68 AC_STRUCT_TM
69 AC_TYPE_SIZE_T
70 AC_C_CONST
72 dnl --------------------------------------------------------------------
73 dnl - Check for inline and cassert settings
74 dnl --------------------------------------------------------------------
77 AC_ARG_ENABLE([inline], [  --disable-inline    Disable inlining],
78         [case "${enableval}" in
79                 yes) enable_inline=true ;;
80                 no)  enable_inline=false ;;
81                 *) AC_MSG_ERROR(bad value ${enableval} for --enable-inline);;
82         esac],
83         [enable_inline=true]
86 AC_ARG_ENABLE([cassert], [  --disable-cassert   Disable assertion checking],
87         [case "${enableval}" in
88                 yes) enable_cassert=true ;;
89                 no)  enable_cassert=false ;;
90                 *) AC_MSG_ERROR(bad value ${enableval} for --enable-cassert);;
91         esac],
92         [enable_cassert=true]
95 AC_ARG_ENABLE([glibcxx-debug], [  --enable-glibcxx-debug    Enable libstdc++ debug mode],
96         [case "${enableval}" in
97                 yes) enable_glibcxx_debug=true ;;
98                 no)  enable_glibcxx_debug=false ;;
99                 *) AC_MSG_ERROR(bad value ${enableval} for --enable-glibcxx-debug);;
100         esac],
101         [enable_glibcxx_debug=false]
105 AC_MSG_CHECKING([if requested to force inline functions])
106 INLINE_FLAGS=
107 AC_SUBST(INLINE_FLAGS)
108 if test x"$enable_inline" = xtrue; then
109         INLINE_FLAGS="-DGEOS_INLINE"
110         AM_CXXFLAGS="$AM_CXXFLAGS $INLINE_FLAGS"
111     AC_MSG_RESULT([yes])
112 else
113     AC_MSG_RESULT([no])
116 AC_MSG_CHECKING([if requested to enable assert macros])
117 if test x"$enable_cassert" = xfalse; then
118         AM_CXXFLAGS="$AM_CXXFLAGS -DNDEBUG"
119     AC_MSG_RESULT([no])
120 else
121     AC_MSG_RESULT([yes])
124 AC_MSG_CHECKING([if requested libstdc++ debug mode])
125 if test x"$enable_glibcxx_debug" = xtrue; then
126     AM_CXXFLAGS="$AM_CXXFLAGS -D_GLIBCXX_DEBUG=1 -D_GLIBCXX_DEBUG_PEDANTIC=1"
127     AC_MSG_RESULT([yes])
128 else
129     AC_MSG_RESULT([no])
132 dnl --------------------------------------------------------------------
133 dnl - Append default C++ and C flags
134 dnl --------------------------------------------------------------------
136 dnl In order for AC_LIBTOOL_COMPILER_OPTION to use
137 dnl the C compiler we need the hack below.
138 dnl It is likely a bug in the libtool macro file to
139 dnl require AC_LIBTOOL_LANG_CXX_CONFIG in *addition*
140 dnl to AC_LANG(CXX) or AC_LANG_PUSH(CXX)/AC_LANG_POP()
142 AC_LIBTOOL_LANG_CXX_CONFIG
144 # Set default AM_CXXFLAGS and AM_CFLAGS
145 # -pedantic: ISO does not support long long
146 # we add -Wno-long-long to avoid those messages
147 WARNFLAGS=""
148 AC_LIBTOOL_COMPILER_OPTION([if $compiler supports -pedantic], [dummy_cv_pedantic], [-pedantic], [], [WARNFLAGS="$WARNFLAGS -pedantic"], [])
149 AC_LIBTOOL_COMPILER_OPTION([if $compiler supports -Wall], [dummy_cv_wall], [-Wall], [], [WARNFLAGS="$WARNFLAGS -Wall"], [])
150 AC_LIBTOOL_COMPILER_OPTION([if $compiler supports -ansi], [dummy_cv_ansi], [-ansi], [], [WARNFLAGS="$WARNFLAGS -ansi"], [])
151 AC_LIBTOOL_COMPILER_OPTION([if $compiler supports -Wno-long-long], [dummy_cv_no_long_long], [-Wno-long-long], [], [WARNFLAGS="$WARNFLAGS -Wno-long-long"], [])
153 # To make numerical computation more stable, we use --ffloat-store
154 NUMERICFLAGS=""
155 AC_LIBTOOL_COMPILER_OPTION([if $compiler supports -ffloat-store], [dummy_cv_ffloat_store], [-ffloat-store], [], [NUMERICFLAGS="$NUMERICFLAGS -ffloat-store"], [])
157 DEFAULTFLAGS="${WARNFLAGS} ${NUMERICFLAGS}"
159 AM_CXXFLAGS="${AM_CXXFLAGS} ${DEFAULTFLAGS}"
160 AM_CFLAGS="${AM_CFLAGS} ${DEFAULTFLAGS}"
161 AC_SUBST(AM_CXXFLAGS)
162 AC_SUBST(AM_CFLAGS)
164 dnl --------------------------------------------------------------------
165 dnl - Look for finite and/or isfinite macros/functions
166 dnl --------------------------------------------------------------------
168 dnl These two tests need the math library or they won't link
169 dnl on OpenBSD, even if the functions exist.
170 save_LIBS=$LIBS
171 LIBS="$LIBS -lm"
172 AC_CACHE_CHECK([for finite], ac_cv_finite,
173  [AC_TRY_LINK([#include <math.h>],
174  [double x; int y; y = finite(x);],
175  ac_cv_finite=yes,
176  ac_cv_finite=no
178 if test x"$ac_cv_finite" = x"yes"; then
179   AC_DEFINE(HAVE_FINITE, [1], [Has finite])
182 AC_CACHE_CHECK([for isfinite], ac_cv_isfinite,
183  [AC_TRY_LINK([#include <math.h>],
184  [double x; int y; y = isfinite(x);],
185  ac_cv_isfinite=yes,
186  ac_cv_isfinite=no
188 if test x"$ac_cv_isfinite" = x"yes"; then
189   AC_DEFINE(HAVE_ISFINITE, [1], [Has isfinite])
192 dnl --------------------------------------------------------------------
193 dnl Test for presence of isnan function when using C++ and <cmath>
194 dnl This is for a particular bug in OS/X where <cmath> drops the definition
195 dnl of isnan().
197 AC_LANG_PUSH([C++])
198 AC_CACHE_CHECK([for isnan], ac_cv_isnan,
199  [AC_TRY_LINK([#include <cmath>],
200  [double x; int y; y = std::isnan(x);],
201  ac_cv_isnan=yes,
202  ac_cv_isnan=no
204 if test x"$ac_cv_isnan" = x"yes"; then
205   AC_DEFINE(HAVE_ISNAN, [1], [Has isnan])
207 AC_LANG_POP([C++])
209 dnl --------------------------------------------------------------------
211 LIBS=$save_LIBS
213 dnl --------------------------------------------------------------------
214 dnl - Look for a 64bit integer (do after CFLAGS is set)
215 dnl --------------------------------------------------------------------
217 dnl Find a working 64bit integer
218 PGAC_TYPE_64BIT_INT([int64_t])
219 if test x"$HAVE_INT64_T_64" = x"no" ; then
220   PGAC_TYPE_64BIT_INT([long long int])
221   if test x"$HAVE_LONG_LONG_INT_64" = x"no" ; then
222     PGAC_TYPE_64BIT_INT([long int])
223     if test x"$HAVE_LONG_INT_64" = x"no" ; then
224       AC_MSG_WARN([Could not find a working 64bit int type, you may experience weird bugs (undefined behaviour)]);
225     fi
226   fi
231 dnl --------------------------------------------------------------------
232 dnl - check whether python is required for the build
233 dnl --------------------------------------------------------------------
235 AC_ARG_ENABLE([python], [  --enable-python    Enable build of python module],
236         [case "${enableval}" in
237                 yes) use_python=true ;;
238                 no)  use_python=false ;;
239                 *) AC_MSG_ERROR(bad value ${enableval} for --enable-python) ;;
240         esac],
241         [use_python=false]
245 dnl --------------------------------------------------------------------
246 dnl - check whether ruby is required for the build
247 dnl --------------------------------------------------------------------
249 AC_ARG_ENABLE([ruby], [  --enable-ruby    Enable build of ruby module],
250         [case "${enableval}" in
251                 yes) use_ruby=true ;;
252                 no)  use_ruby=false ;;
253                 *) AC_MSG_ERROR(bad value ${enableval} for --enable-ruby) ;;
254         esac],
255         [use_ruby=false]
258 dnl --------------------------------------------------------------------
259 dnl - check for swig if python or ruby are enabled
260 dnl --------------------------------------------------------------------
262 use_swig=false
263 if test x"$use_python" = xtrue ||
264    test x"$use_ruby" = xtrue; then
265   AC_PROG_SWIG(1.3.28)
266   if test x"$SWIG" != "x"; then
267     SWIG_ENABLE_CXX
268     AC_SUBST(SWIG)
269     use_swig=true
270   else
271     use_python=false
272     use_ruby=false
273   fi
275 AM_CONDITIONAL(ENABLE_SWIG, [ test x"$use_swig" = xtrue ])
278 dnl --------------------------------------------------------------------
279 dnl - check for python if enabled
280 dnl --------------------------------------------------------------------
282 if test x"$use_python" = xtrue; then
283         dnl Check for Python
284   AM_PATH_PYTHON
285   SWIG_PYTHON
287         if test x"$PYTHON" = "x"; then
288                 use_python=false
289         fi
291         AC_SUBST(PYTHON)
292         AC_SUBST(SWIG_PYTHON_CPPFLAGS)
293         AC_SUBST(SWIG_PYTHON_OPT)
295 AM_CONDITIONAL(ENABLE_PYTHON, [test x"$use_python" = xtrue])
298 dnl --------------------------------------------------------------------
299 dnl - check for ruby if enabled
300 dnl --------------------------------------------------------------------
302 if test x"$use_ruby" = xtrue; then
303         dnl Check for Ruby
304         AC_RUBY_DEVEL
306         if test x"$RUBY" = x; then
307                 use_ruby=false
308         fi
311 AM_CONDITIONAL(ENABLE_RUBY, [ test x"$use_ruby" = xtrue ])
313 dnl --------------------------------------------------------------------
314 dnl - do operating-system specific things
315 dnl --------------------------------------------------------------------
317 AC_MSG_CHECKING([OS-specific settings])
319 case "${host_os}" in
320         *darwin*)
321                 AC_MSG_RESULT([${host_os}])
322                 AC_MSG_CHECKING([for OS/X version])
323                 kernel=`uname -r`
325                 # "Darwin 9.6.0" is Mac OSX 10.5.6
326                 # "Darwin 10.x" would presumably be Mac OS X 10.6.x
327                 case "${kernel}" in
328                         8.*)
329                                 AC_MSG_RESULT([Mac OS X 10.4 Tiger])
330                                 ;;
331                         9.*)
332                                 AC_MSG_RESULT([Mac OS X 10.5 Leopard])
333                                 ;;
334                         10.*)
335 dnl                             AM_CXXFLAGS="$AM_CXXFLAGS -Wnon-virtual-dtor -Woverloaded-virtual"
336                                 AC_MSG_RESULT([Mac OS X 10.6 Snow Leopard])
337                                 ;;
338                         *)
339                                 AC_MSG_RESULT([Mac OS X (Darwin ${kernel} kernel)])
340                                 ;;
341                 esac
342                 ;;
343 esac
345 dnl --------------------------------------------------------------------
346 dnl - check for boost
347 dnl --------------------------------------------------------------------
349 dnl -- AX_BOOST(1.32)
350 dnl -- if test "x$ax_cv_boost_unit_test_framework" = "xyes"; then
351 dnl --  use_boost_utf=yes
352 dnl -- else
353 dnl --  use_boost_utf=no
354 dnl -- fi
355 dnl -- AM_CONDITIONAL(ENABLE_BOOST_UTF, [test "x$use_boost_utf" = "xyes"])
357 dnl things to substitute in output ----------------------------------------
358 AC_SUBST(VERSION)
359 AC_SUBST(VERSION_MAJOR)
360 AC_SUBST(VERSION_MINOR)
361 AC_SUBST(VERSION_PATCH)
362 AC_SUBST(INTERFACE_CURRENT)
363 AC_SUBST(INTERFACE_REVISION)
364 AC_SUBST(INTERFACE_AGE)
365 AC_SUBST(JTS_PORT)
366 AC_SUBST(CAPI_VERSION)
367 AC_SUBST(CAPI_VERSION_MAJOR)
368 AC_SUBST(CAPI_VERSION_MINOR)
369 AC_SUBST(CAPI_VERSION_PATCH)
370 AC_SUBST(CAPI_INTERFACE_CURRENT)
371 AC_SUBST(CAPI_INTERFACE_REVISION)
372 AC_SUBST(CAPI_INTERFACE_AGE)
374 dnl output stuff ----------------------------------------------------------
376 AC_OUTPUT([
377         Makefile
378         capi/Makefile
379         capi/geos_c.h
380         doc/Doxyfile
381         doc/Makefile
382         macros/Makefile
383         src/Makefile
384         src/algorithm/Makefile
385         src/algorithm/locate/Makefile
386         src/algorithm/distance/Makefile
387         src/geom/Makefile
388         src/geom/prep/Makefile
389         src/geom/util/Makefile
390         src/geomgraph/Makefile
391         src/geomgraph/index/Makefile
392         include/Makefile
393         include/geos/Makefile
394         include/geos/algorithm/Makefile
395         include/geos/algorithm/locate/Makefile
396         include/geos/algorithm/distance/Makefile
397         include/geos/geom/Makefile
398         include/geos/geom/prep/Makefile
399         include/geos/geom/util/Makefile
400         include/geos/geomgraph/Makefile
401         include/geos/geomgraph/index/Makefile
402         include/geos/index/Makefile
403         include/geos/index/bintree/Makefile
404         include/geos/index/chain/Makefile
405         include/geos/index/intervalrtree/Makefile
406         include/geos/index/quadtree/Makefile
407         include/geos/index/strtree/Makefile
408         include/geos/index/sweepline/Makefile
409         include/geos/io/Makefile
410         include/geos/linearref/Makefile
411         include/geos/noding/Makefile
412         include/geos/noding/snapround/Makefile
413         include/geos/operation/Makefile
414         include/geos/operation/buffer/Makefile
415         include/geos/operation/distance/Makefile
416         include/geos/operation/intersection/Makefile
417         include/geos/operation/linemerge/Makefile
418         include/geos/operation/overlay/Makefile
419         include/geos/operation/overlay/snap/Makefile
420         include/geos/operation/polygonize/Makefile
421         include/geos/operation/predicate/Makefile
422         include/geos/operation/relate/Makefile
423         include/geos/operation/sharedpaths/Makefile
424         include/geos/operation/union/Makefile
425         include/geos/operation/valid/Makefile
426         include/geos/planargraph/Makefile
427         include/geos/planargraph/algorithm/Makefile
428         include/geos/precision/Makefile
429         include/geos/simplify/Makefile
430         include/geos/triangulate/Makefile
431         include/geos/triangulate/quadedge/Makefile
432         include/geos/util/Makefile
433         include/geos/version.h
434         src/index/Makefile
435         src/index/bintree/Makefile
436         src/index/chain/Makefile
437         src/index/intervalrtree/Makefile
438         src/index/quadtree/Makefile
439         src/index/strtree/Makefile
440         src/index/sweepline/Makefile
441         src/io/Makefile
442         src/linearref/Makefile
443         src/noding/Makefile
444         src/noding/snapround/Makefile
445         src/operation/Makefile
446         src/operation/buffer/Makefile
447         src/operation/distance/Makefile
448         src/operation/intersection/Makefile
449         src/operation/linemerge/Makefile
450         src/operation/overlay/Makefile
451         src/operation/polygonize/Makefile
452         src/operation/predicate/Makefile
453         src/operation/relate/Makefile
454         src/operation/sharedpaths/Makefile
455         src/operation/union/Makefile
456         src/operation/valid/Makefile
457         src/planargraph/Makefile
458         src/precision/Makefile
459         src/simplify/Makefile
460         src/triangulate/Makefile
461         src/triangulate/quadedge/Makefile
462         src/util/Makefile
463         swig/geos.i
464         swig/Makefile
465         swig/python/Makefile
466         swig/python/tests/Makefile
467         swig/ruby/Makefile
468         swig/ruby/test/Makefile
469         tests/Makefile
470         tests/bigtest/Makefile
471         tests/unit/Makefile
472         tests/perf/Makefile
473         tests/perf/operation/Makefile
474         tests/perf/operation/buffer/Makefile
475         tests/perf/operation/predicate/Makefile
476         tests/perf/capi/Makefile
477         tests/xmltester/Makefile
478         tests/geostest/Makefile
479         tests/thread/Makefile
480         tools/Makefile
481         tools/geos-config
482         ])
484 dnl -- echo "---------------------------------------"
485 dnl -- echo "Boost UTF: $use_boost_utf"
486 echo "Swig: $use_swig"
487 echo "Python bindings: $use_python"
488 echo "Ruby bindings: $use_ruby"
490 dnl -- echo "---------------------------------------"