$OpenBSD: patch-stepmake_aclocal_m4,v 1.3 2010/01/01 11:00:49 kili Exp $

# Fix a GNUism (\| in BREs) in the version check.
# Don't overflow our ksh with too large version numbers (like in
# fontforge).

--- stepmake/aclocal.m4.orig	Tue Dec 15 19:58:57 2009
+++ stepmake/aclocal.m4	Thu Dec 31 09:02:24 2009
@@ -32,9 +32,13 @@ AC_DEFUN(STEPMAKE_GET_VERSION, [
     ## for compatibility reasons.
     
     ## grab the first version number in  --version output.
-    eval _ver=\"\`("$1" --version || "$1" -V) 2>&1 | grep '\(^\| \)[0-9][0-9]*\.[0-9]' \
-        | head -n 1 \
-	| tr ' ' '\n' | sed 's/\([0-9][0-9]*\.[0-9][0-9.]*\).*/\1/g' | grep '\(^\| \)[0-9][0-9]*\.[0-9]' | head -n 1\`\"
+    eval _ver=\"\`("$1" --version || "$1" -V) 2>&1 |
+		grep -E '(^| )[0-9][0-9]*\.[0-9]' |
+		head -n 1 |
+		tr ' ' '\n' |
+		sed 's/\([0-9][0-9]*\.[0-9][0-9.]*\).*/\1/g' |
+		grep -E '(^| )[0-9][0-9]*\.[0-9]' |
+		head -n 1\`\"
 
     if test -z "$_ver"; then
         ## If empty, try date [fontforge]
@@ -49,12 +53,9 @@ AC_DEFUN(STEPMAKE_GET_VERSION, [
 # Calculate simplistic numeric version from version string ($1)
 # As yet, we have no need for something more elaborate.
 AC_DEFUN(STEPMAKE_NUMERIC_VERSION, [
-    echo "$1" | awk -F. '
-    {
-      if ([$]3) {three = [$]3}
-      else {three = 0}
-    }
-    {printf "%.0f\n", [$]1*1000000 + [$]2*1000 + three}'
+	echo "$1" | awk -F. '
+	  NF==1 {print; next}
+	  {printf "%.0f\n", [$]1*1000000 + [$]2*1000 + [$]3}'
 ])
 
 
