Commit ad6954a0cbc0c1d5980cb7c04c8844186a021f48

suzuki toshiya 2010-02-13T02:25:04

Improve autotool version checking to work with beta releases.

diff --git a/ChangeLog b/ChangeLog
index bb9d8dc..8dedf91 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2010-02-12  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
 
+	Improve autotool version checking to work with beta releases.
+
+	* autogen.sh (check_tool_version): Improve the extraction of version
+	number from "tool --version" output. Some beta releases of autotools
+	have extra strings before version number.
+
+2010-02-12  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
 	Fix overallocating bug in FT_Outline_New_Internal().
 
 	* src/base/ftoutln.c (FT_Outline_New_Internal): The length of
diff --git a/autogen.sh b/autogen.sh
index 16c335f..60ed3ba 100644
--- a/autogen.sh
+++ b/autogen.sh
@@ -95,10 +95,11 @@ compare_to_minimum_version ()
 check_tool_version ()
 {
   field=$5
+  # assume the output of "[TOOL] --version" is "toolname (GNU toolname foo bar) version"
   if test "$field"x = x; then
-    field=4  # default to 4 for all GNU autotools
+    field=3  # default to 3 for all GNU autotools, after filtering enclosed string
   fi
-  version=`$1 --version | head -1 | cut -d ' ' -f $field`
+  version=`$1 --version | head -1 | sed 's/([^)]*)/()/g' | cut -d ' ' -f $field`
   version_check=`compare_to_minimum_version $version $4`
   if test "$version_check"x = 0x; then
     echo "ERROR: Your version of the \`$2' tool is too old."