3 dnl GEOS_INIT (MINIMUM_VERSION)
5 dnl Test for GEOS: define HAVE_GEOS, GEOS_LIBS, GEOS_CFLAGS, GEOS_VERSION
7 dnl Call as GEOS_INIT or GEOS_INIT(minimum version) in configure.in. Test
8 dnl HAVE_GEOS (yes|no) afterwards. If yes, all other vars above can be
12 dnl Now, --with-geos takes values: yes or no, or full path to the geos-config
13 dnl utility. Note that the utility can have different name,
14 dnl e.g. geos-config-cvs.
15 dnl Example: --with-geos=/home/foo/usr/bin/geos-config-cvs
17 AC_DEFUN([GEOS_INIT],[
21 AC_SUBST(GEOS_VERSION)
23 if test x"$with_geos" = x"no" ; then
24 AC_MSG_RESULT([GEOS support disabled])
27 elif test x"$with_geos" = x"yes" -o x"$with_geos" = x"" ; then
28 AC_PATH_PROG([GEOS_CONFIG], [geos-config], [no])
30 ac_geos_config=`basename $with_geos`
31 ac_geos_config_dir=`dirname $with_geos`
38 [$ac_geos_config_dir],
43 min_geos_version=ifelse([$1], ,0.0.1,$1)
45 if test "$GEOS_CONFIG" = "no"; then
48 AC_MSG_CHECKING(for GEOS version >= $min_geos_version)
50 geos_major_version=`$GEOS_CONFIG --version | \
51 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
52 geos_minor_version=`$GEOS_CONFIG --version | \
53 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
54 geos_micro_version=`$GEOS_CONFIG --version | \
55 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'`
57 req_major=`echo $min_geos_version | \
58 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
59 req_minor=`echo $min_geos_version | \
60 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
61 req_micro=`echo $min_geos_version | \
62 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'`
65 ac_req_version=`expr $req_major \* 100000 \+ $req_minor \* 100 \+ $req_micro`
66 ac_geos_version=`expr $geos_major_version \* 100000 \+ $geos_minor_version \* 100 \+ $geos_micro_version`
68 if test $ac_req_version -le $ac_geos_version; then
72 if test $version_ok = "no"; then
75 if $GEOS_CONFIG --libs >/dev/null 2>&1; then
78 GEOS_LIBS="`$GEOS_CONFIG --libs`"
79 GEOS_CFLAGS="`$GEOS_CONFIG --cflags`"
80 GEOS_VERSION="`$GEOS_CONFIG --version`"