From 48ca867eea9cc29efdc82fdd52d495ab231c2198 Mon Sep 17 00:00:00 2001
From: Han-Wen Nienhuys <hanwen@xs4all.nl>
Date: Thu, 1 Jun 2006 00:08:29 +0000
Subject: [PATCH] robuster version detection.

---
 ChangeLog           |  2 +-
 stepmake/aclocal.m4 | 12 +++---------
 2 files changed, 4 insertions(+), 10 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 41cd8012c4..c172852516 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,6 @@
 2006-06-01  Han-Wen Nienhuys  <hanwen@lilypond.org>
 
-	* stepmake/aclocal.m4: revert version detection.
+	* stepmake/aclocal.m4: robuster version detection.
 
 	* buildscripts/output-distance.py
 	(ComparisonData.create_html_result_page): copy only if file
diff --git a/stepmake/aclocal.m4 b/stepmake/aclocal.m4
index 73cb599d53..c3d41f6128 100644
--- a/stepmake/aclocal.m4
+++ b/stepmake/aclocal.m4
@@ -26,18 +26,12 @@ AC_DEFUN(STEPMAKE_GET_VERSION, [
     ## -V: Workaround for python
 
     changequote(<<, >>)#dnl
-    ## Assume and hunt for dotted version multiplet.
-    ## use eval trickery, because we cannot use multi-level $() instead of ``
-    ## for compatibility reasons.
-    ## FIXME: what systems still do not have $() in /bin/sh?
+
+    ## grab the first version number in  --version output.
     eval _ver=\"\`("$1" --version || "$1" -V) 2>&1 | grep '[0-9]\.[0-9]' \
         | head -n 1 \
-	| sed -e 's/.*[^-.0-9]\([0-9][0-9]*\.[0-9][.0-9]*\).*/\1/' \
-          -e 's/^[^.0-9]*//' -e 's/[^.0-9]*$//'\`\"
+	| tr ' ' '\n' | grep '[0-9]\.[0-9]' | head -n 1 | sed 's/\([0-9.]*\).*/\1/g'\`\"
 
-## apparently breaks on darwin,  
-#	        | sed -e 's/\([0-9][0-9]*\.[0-9][.0-9]*\).*/\1/' \
-#	  -e 's/\([^0-9]*\|^\) //' -e 's/[^0-9]*$//'\`\"
     if test -z "$_ver"; then
         ## If empty, try date [fontforge]
         eval _ver=\"\`("$1" --version || "$1" -V) 2>&1 | grep '[0-9]\{6,8\}' \
-- 
2.39.5