]> granicus.if.org Git - postgis/commitdiff
Fixed a bug in minor version extractor.
authorSandro Santilli <strk@keybit.net>
Fri, 18 Jun 2004 17:11:10 +0000 (17:11 +0000)
committerSandro Santilli <strk@keybit.net>
Fri, 18 Jun 2004 17:11:10 +0000 (17:11 +0000)
Wrapped GEOS_VERSION in an #ifndef block.
More runtime checks.

git-svn-id: http://svn.osgeo.org/postgis/trunk@634 b70326c6-7e19-0410-871a-916f4a2858ee

geos_version.sh

index 730c226f17a6ac653a73e806ab64441a18635fa1..6fa95383dbe631d41a41122477a18c3945832d68 100755 (executable)
@@ -1,20 +1,27 @@
 #!/bin/sh
 
 if [ -z "$1" ]; then
-       echo "Usage `basename $0` <geosdir>" >&2
+       echo "Usage: `basename $0` <geosdir>" >&2
        exit 1
 fi
 
 geos_dir=$1
 version=`${geos_dir}/bin/geos-config --version`
+if [ $? -ne 0 ]; then
+       exit 1
+fi
+
 if [ "$version" = "@GEOS_VERSION@" ]; then
        geos_version=100
+       version="1.0.0"
 else
        major=`echo $version | sed 's/\..*//'`
-       minor=`echo $version | sed 's/.*\.\([^.]*\)\.*/\1/'`
+       minor=`echo $version | sed 's/[^\.]*\.\([^.]*\)\.*/\1/'`
        geos_version=`printf %d%2.2d $major $minor`
 fi
 cat <<EOF
 #define POSTGIS_GEOS_VERSION $geos_version
-#define GEOS_VERSION $version
+#ifndef GEOS_VERSION
+#define GEOS_VERSION "$version"
+#endif
 EOF