Add magic flags for OS/X Snow Leopard only. (#299)
[geos.git] / configure.in
blob5e64e5889c6316dc97f75872445c5d45441a4276
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([source/headers/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=7
19 CAPI_INTERFACE_REVISION=0
20 CAPI_INTERFACE_AGE=6
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=2
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([source/headers/config.h])
40 AM_CONFIG_HEADER([source/headers/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         CXXFLAGS="$CXXFLAGS $INLINE_FLAGS"
103 if test x"$enable_cassert" = xfalse; then
104         CXXFLAGS="$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 CXXFLAGS and CFLAGS if not set by the user
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 CXXFLAGS="${CXXFLAGS} ${DEFAULTFLAGS}"
135 CFLAGS="${CFLAGS} ${DEFAULTFLAGS}"
137 dnl --------------------------------------------------------------------
138 dnl - Look for finite and/or isfinite macros/functions
139 dnl --------------------------------------------------------------------
141 dnl These two tests need the math library or they won't link
142 dnl on OpenBSD, even if the functions exist.
143 save_LIBS=$LIBS
144 LIBS="$LIBS -lm"
145 AC_CACHE_CHECK([for finite], ac_cv_finite,
146  [AC_TRY_LINK([#include <math.h>],
147  [double x; int y; y = finite(x);],
148  ac_cv_finite=yes,
149  ac_cv_finite=no
151 if test x"$ac_cv_finite" = x"yes"; then
152   AC_DEFINE(HAVE_FINITE, [1], [Has finite])
155 AC_CACHE_CHECK([for isfinite], ac_cv_isfinite,
156  [AC_TRY_LINK([#include <math.h>],
157  [double x; int y; y = isfinite(x);],
158  ac_cv_isfinite=yes,
159  ac_cv_isfinite=no
161 if test x"$ac_cv_isfinite" = x"yes"; then
162   AC_DEFINE(HAVE_ISFINITE, [1], [Has isfinite])
165 dnl --------------------------------------------------------------------
166 dnl Test for presence of isnan function when using C++ and <cmath>
167 dnl This is for a particular bug in OS/X where <cmath> drops the definition
168 dnl of isnan().
170 AC_LANG_PUSH([C++])
171 AC_CACHE_CHECK([for isnan], ac_cv_isnan,
172  [AC_TRY_LINK([#include <cmath>],
173  [double x; int y; y = isnan(x);],
174  ac_cv_isnan=yes,
175  ac_cv_isnan=no
177 if test x"$ac_cv_isnan" = x"yes"; then
178   AC_DEFINE(HAVE_ISNAN, [1], [Has isnan])
180 AC_LANG_POP([C++])
182 dnl --------------------------------------------------------------------
184 LIBS=$save_LIBS
186 dnl --------------------------------------------------------------------
187 dnl - Look for a 64bit integer (do after CFLAGS is set)
188 dnl --------------------------------------------------------------------
190 dnl Find a working 64bit integer
191 PGAC_TYPE_64BIT_INT([int64_t])
192 if test x"$HAVE_INT64_T_64" = x"no" ; then
193   PGAC_TYPE_64BIT_INT([long int])
194   if test x"$HAVE_LONG_INT_64" = x"no" ; then
195     PGAC_TYPE_64BIT_INT([long long int])
196     if test x"$HAVE_LONG_LONG_INT_64" = x"no" ; then
197       AC_MSG_WARN([Could not find a working 64bit int type, you may experience weird bugs (undefined behaviour)]);
198     fi
199   fi
204 dnl --------------------------------------------------------------------
205 dnl - check whether python is required for the build
206 dnl --------------------------------------------------------------------
208 AC_ARG_ENABLE([python], [  --enable-python    Enable build of python module],
209         [case "${enableval}" in
210                 yes) use_python=true ;;
211                 no)  use_python=false ;;
212                 *) AC_MSG_ERROR(bad value ${enableval} for --enable-python) ;;
213         esac],
214         [use_python=false]
218 dnl --------------------------------------------------------------------
219 dnl - check whether ruby is required for the build
220 dnl --------------------------------------------------------------------
222 AC_ARG_ENABLE([ruby], [  --enable-ruby    Enable build of ruby module],
223         [case "${enableval}" in
224                 yes) use_ruby=true ;;
225                 no)  use_ruby=false ;;
226                 *) AC_MSG_ERROR(bad value ${enableval} for --enable-ruby) ;;
227         esac],
228         [use_ruby=false]
232 dnl --------------------------------------------------------------------
233 dnl - check for swig if python or ruby are enabled
234 dnl --------------------------------------------------------------------
236 use_swig=false
237 if test x"$use_python" = xtrue || test x"$use_ruby" = xtrue; then
238         AC_PROG_SWIG(1.3.28)
239         if test x"$SWIG" != "x"; then
240             SWIG_ENABLE_CXX     
241             AC_SUBST(SWIG)           
243             use_swig=true 
244         fi
246 AM_CONDITIONAL(ENABLE_SWIG, [ test x"$use_swig" = xtrue ])
249 dnl --------------------------------------------------------------------
250 dnl - check for python if enabled
251 dnl --------------------------------------------------------------------
253 if test x"$use_python" = xtrue; then
254         dnl Check for Python 
255         AM_PATH_PYTHON  
256         SWIG_PYTHON
258         if test x"$PYTHON" = "x"; then
259                 use_python=false
260         fi
261         
262         AC_SUBST(PYTHON)
263         AC_SUBST(SWIG_PYTHON_CPPFLAGS)
264         AC_SUBST(SWIG_PYTHON_OPT)
266 AM_CONDITIONAL(ENABLE_PYTHON, [test x"$use_python" = xtrue])
269 dnl --------------------------------------------------------------------
270 dnl - check for ruby if enabled
271 dnl --------------------------------------------------------------------
273 if test x"$use_ruby" = xtrue; then
274         dnl Check for Ruby 
275         AC_RUBY_DEVEL
277         if test x"$RUBY" = x; then
278                 use_ruby=false
279         fi
282 AM_CONDITIONAL(ENABLE_RUBY, [ test x"$use_ruby" = xtrue ])
285 dnl --------------------------------------------------------------------
286 dnl - do operating-system specific things
287 dnl --------------------------------------------------------------------
289 AC_MSG_CHECKING([OS-specific settings])
291 case "${host_os}" in
292         *darwin*)
293                 AC_MSG_RESULT([${host_os}])
294                 AC_MSG_CHECKING([for OS/X version])
295                 kernel=`uname -r`
297                 # "Darwin 9.6.0" is Mac OSX 10.5.6
298                 # "Darwin 10.x" would presumably be Mac OS X 10.6.x
299                 case "${kernel}" in
300                         8.*)
301                                 AC_MSG_RESULT([Mac OS X 10.4 Tiger])
302                                 ;;
303                         9.*)
304                                 AC_MSG_RESULT([Mac OS X 10.5 Leopard])
305                                 ;;
306                         10.*)
307                                 CXXFLAGS="$CXXFLAGS -Wnon-virtual-dtor -Woverloaded-virtual"
308                                 AC_MSG_RESULT([Mac OS X 10.6 Snow Leopard])
309                                 ;;
310                         *)
311                                 AC_MSG_RESULT([Mac OS X (Darwin ${kernel} kernel)])
312                                 ;;
313                 esac
314                 ;;
315 esac
317 dnl --------------------------------------------------------------------
318 dnl - check for boost 
319 dnl --------------------------------------------------------------------
321 dnl -- AX_BOOST(1.32)
322 dnl -- if test "x$ax_cv_boost_unit_test_framework" = "xyes"; then
323 dnl --  use_boost_utf=yes
324 dnl -- else
325 dnl --  use_boost_utf=no
326 dnl -- fi
327 dnl -- AM_CONDITIONAL(ENABLE_BOOST_UTF, [test "x$use_boost_utf" = "xyes"])
329 dnl things to substitute in output ----------------------------------------
330 AC_SUBST(VERSION)
331 AC_SUBST(VERSION_MAJOR)
332 AC_SUBST(VERSION_MINOR)
333 AC_SUBST(VERSION_PATCH)
334 AC_SUBST(INTERFACE_CURRENT)
335 AC_SUBST(INTERFACE_REVISION)
336 AC_SUBST(INTERFACE_AGE)
337 AC_SUBST(JTS_PORT)
338 AC_SUBST(CAPI_VERSION)
339 AC_SUBST(CAPI_VERSION_MAJOR)
340 AC_SUBST(CAPI_VERSION_MINOR)
341 AC_SUBST(CAPI_VERSION_PATCH)
342 AC_SUBST(CAPI_INTERFACE_CURRENT)
343 AC_SUBST(CAPI_INTERFACE_REVISION)
344 AC_SUBST(CAPI_INTERFACE_AGE)
346 dnl output stuff ----------------------------------------------------------
348 AC_OUTPUT([
349         Makefile 
350         build/Makefile
351         build/msvc80/Makefile
352         build/msvc80/geos_c_dll/Makefile
353         build/msvc80/geos_lib/Makefile
354         build/msvc80/geos_python/Makefile
355         build/msvc80/geos_ruby/Makefile
356         build/msvc80/geos_unit/Makefile
357         build/msvc90/Makefile
358         build/msvc90/geos_c_dll/Makefile
359         build/msvc90/geos_lib/Makefile
360         build/msvc90/geos_python/Makefile
361         build/msvc90/geos_ruby/Makefile
362         build/msvc90/geos_unit/Makefile
363         build/msvc90/geos_xmltester/Makefile
364         capi/Makefile
365         capi/geos_c.h
366         doc/Doxyfile
367         doc/Makefile
368         macros/Makefile
369         source/Makefile 
370         source/algorithm/Makefile
371         source/algorithm/locate/Makefile
372         source/algorithm/distance/Makefile
373         source/geom/Makefile
374         source/geom/prep/Makefile
375         source/geom/util/Makefile
376         source/geomgraph/Makefile
377         source/geomgraph/index/Makefile
378         source/headers/Makefile
379         source/headers/geos/Makefile
380         source/headers/geos/algorithm/Makefile
381         source/headers/geos/algorithm/locate/Makefile
382         source/headers/geos/algorithm/distance/Makefile
383         source/headers/geos/geom/Makefile
384         source/headers/geos/geom/prep/Makefile
385         source/headers/geos/geom/util/Makefile
386         source/headers/geos/geomgraph/Makefile
387         source/headers/geos/geomgraph/index/Makefile
388         source/headers/geos/index/Makefile
389         source/headers/geos/index/bintree/Makefile
390         source/headers/geos/index/chain/Makefile
391         source/headers/geos/index/intervalrtree/Makefile
392         source/headers/geos/index/quadtree/Makefile
393         source/headers/geos/index/strtree/Makefile
394         source/headers/geos/index/sweepline/Makefile
395         source/headers/geos/io/Makefile
396         source/headers/geos/linearref/Makefile
397         source/headers/geos/noding/Makefile
398         source/headers/geos/noding/snapround/Makefile
399         source/headers/geos/operation/Makefile
400         source/headers/geos/operation/buffer/Makefile
401         source/headers/geos/operation/distance/Makefile
402         source/headers/geos/operation/linemerge/Makefile
403         source/headers/geos/operation/overlay/Makefile
404         source/headers/geos/operation/overlay/snap/Makefile
405         source/headers/geos/operation/polygonize/Makefile
406         source/headers/geos/operation/predicate/Makefile
407         source/headers/geos/operation/relate/Makefile
408         source/headers/geos/operation/union/Makefile
409         source/headers/geos/operation/valid/Makefile
410         source/headers/geos/planargraph/Makefile
411         source/headers/geos/planargraph/algorithm/Makefile
412         source/headers/geos/precision/Makefile
413         source/headers/geos/simplify/Makefile
414         source/headers/geos/util/Makefile
415         source/headers/geos/version.h
416         source/index/Makefile
417         source/index/bintree/Makefile
418         source/index/chain/Makefile
419         source/index/intervalrtree/Makefile
420         source/index/quadtree/Makefile
421         source/index/strtree/Makefile
422         source/index/sweepline/Makefile
423         source/io/Makefile
424         source/linearref/Makefile
425         source/noding/Makefile
426         source/noding/snapround/Makefile
427         source/operation/Makefile
428         source/operation/buffer/Makefile
429         source/operation/distance/Makefile
430         source/operation/linemerge/Makefile
431         source/operation/overlay/Makefile
432         source/operation/polygonize/Makefile
433         source/operation/predicate/Makefile
434         source/operation/relate/Makefile
435         source/operation/union/Makefile
436         source/operation/valid/Makefile
437         source/planargraph/Makefile
438         source/precision/Makefile
439         source/simplify/Makefile
440         source/util/Makefile
441         swig/geos.i
442         swig/Makefile
443         swig/python/Makefile
444         swig/python/tests/Makefile
445         swig/ruby/Makefile
446         swig/ruby/test/Makefile
447         tests/Makefile
448         tests/bigtest/Makefile
449         tests/unit/Makefile
450         tests/perf/Makefile
451         tests/perf/operation/Makefile
452         tests/perf/operation/buffer/Makefile
453         tests/xmltester/Makefile
454         tools/Makefile
455         tools/geos-config
456         ])
460 dnl -- echo "---------------------------------------"
461 dnl -- echo "Boost UTF: $use_boost_utf"
462 echo "Swig: $use_swig"
463 echo "Python: $use_python"
464 echo "Ruby: $use_ruby"
465 dnl -- echo "---------------------------------------"