modify configure so that template/.similar entries can be
authorTom Lane
Mon, 23 Nov 1998 04:40:58 +0000 (04:40 +0000)
committerTom Lane
Mon, 23 Nov 1998 04:40:58 +0000 (04:40 +0000)
selected when they match a prefix of the  value.  The previous method,
which stripped all version data from  and then tried to match that
against .similar entries, was entirely useless when .similar contained
several entries for different version numbers of a single OS name.

src/configure
src/configure.in
src/template/.similar

index 44dc1e3bc20f239b3605cf8f84f2512ee257def0..e8d8157142239f11ec3a3b2e7f15ef60347cb835 100755 (executable)
@@ -680,26 +680,44 @@ else
 fi
 
 
-
 echo $ac_n "checking setting template to""... $ac_c" 1>&6
-echo "configure:686: checking setting template to" >&5
+echo "configure:685: checking setting template to" >&5
 # Check whether --with-template or --without-template was given.
 if test "${with_template+set}" = set; then
   withval="$with_template"
     TEMPLATE=$withval 
 else
-    
-       GUESS=`grep "^$host=" template/.similar | sed 's/.*=//' | tail -1`
-       if test "$GUESS"
-       then TEMPLATE="$GUESS"
-       else
-           host_no_ver=`echo "$host" | sed 's/[0-9.]*$//'`
-           GUESS=`grep "^$host_no_ver" template/.similar | sed 's/.*=//' | tail -1`
-           if test "$GUESS"
-           then    TEMPLATE="$GUESS"
-           else    TEMPLATE=`uname -s | tr A-Z a-z` 
-           fi
-       fi
+  
+# First, try for a template exactly matching $host
+if test -f "template/$host"
+then TEMPLATE="$host"
+else
+    # Next try for an exact match to a .similar entry.
+    # There shouldn't be multiple matches, but take the last if there are.
+    GUESS=`grep "^$host=" template/.similar | sed 's/^.*=//' | tail -1`
+    if test "$GUESS"
+    then TEMPLATE="$GUESS"
+    else
+   # Next look for a .similar entry that is a prefix of $host.
+   # If there are multiple matches, take the last one.
+   exec 4