Commit 6fef1a26 authored by Tom Lane's avatar Tom Lane

modify configure so that template/.similar entries can be

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.
parent 34680930
This diff is collapsed.
...@@ -78,11 +78,7 @@ else ...@@ -78,11 +78,7 @@ else
ECHO_C='\c' ECHO_C='\c'
fi fi
dnl this part selects the template from the one in the dnl this part selects the template from the ones in the template directory.
dnl template directory.
dnl LOOK FOR EXACT MATCH FIRST,
dnl then try an OS without a version
AC_MSG_CHECKING(setting template to) AC_MSG_CHECKING(setting template to)
AC_ARG_WITH(template, AC_ARG_WITH(template,
...@@ -90,18 +86,37 @@ AC_ARG_WITH(template, ...@@ -90,18 +86,37 @@ AC_ARG_WITH(template,
use operating system template file use operating system template file
see template directory], see template directory],
[ TEMPLATE=$withval ], [ TEMPLATE=$withval ],
[ [
GUESS=`grep "^$host=" template/.similar | sed 's/.*=//' | tail -1` # First, try for a template exactly matching $host
if test "$GUESS" if test -f "template/$host"
then TEMPLATE="$GUESS" then TEMPLATE="$host"
else else
host_no_ver=`echo "$host" | sed 's/[[0-9.]]*$//'` # Next try for an exact match to a .similar entry.
GUESS=`grep "^$host_no_ver" template/.similar | sed 's/.*=//' | tail -1` # There shouldn't be multiple matches, but take the last if there are.
if test "$GUESS" GUESS=`grep "^$host=" template/.similar | sed 's/^.*=//' | tail -1`
then TEMPLATE="$GUESS" if test "$GUESS"
else TEMPLATE=`uname -s | tr A-Z a-z` then TEMPLATE="$GUESS"
fi else
fi # Next look for a .similar entry that is a prefix of $host.
# If there are multiple matches, take the last one.
exec 4<template/.similar
while read LINE <&4
do
SIMHOST=`expr "$LINE" : '\(.*\)='`
MATCH=`expr "$host" : "$SIMHOST"`
if test "$MATCH" != 0
then GUESS=`echo "$LINE" | sed 's/^.*=//'`
fi
done
exec 4<&-
if test "$GUESS"
then TEMPLATE="$GUESS"
else
# Last chance ... maybe uname -s will match an entry.
TEMPLATE=`uname -s | tr A-Z a-z`
fi
fi
fi
]) ])
AC_MSG_RESULT($TEMPLATE) AC_MSG_RESULT($TEMPLATE)
......
alpha-dec-osf=alpha alpha-dec-osf=alpha
alpha-unknown-linux-gnu=linux_alpha alpha-unknown-linux-gnu=linux_alpha
hppa1.1-hp-hpux10.20=hpux_cc hppa1.1-hp-hpux=hpux_cc
hppa1.1-stratus-sysv4=svr4 hppa1.1-stratus-sysv4=svr4
i386-next-nextstep3=nextstep i386-next-nextstep3=nextstep
i386-pc-bsdi2.0=bsdi_2.0 i386-pc-bsdi2.0=bsdi_2.0
i386-pc-bsdi2.1=bsdi_2.1 i386-pc-bsdi2.1=bsdi_2.1
i386-pc-bsdi3.0=bsdi_2.1 i386-pc-bsdi3=bsdi_2.1
i386-pc-bsdi3.1=bsdi_2.1 i386-pc-bsdi4=bsdi_4.0
i386-pc-bsdi4.0=bsdi_4.0
i386-pc-linux-gnu=linux_i386 i386-pc-linux-gnu=linux_i386
i386-pc-solaris2.6=solaris_i386_gcc i386-pc-solaris=solaris_i386_gcc
i386-pc-sunos5=solaris_i386_gcc i386-pc-sunos5=solaris_i386_gcc
i386-unknown-freebsd=freebsd i386-unknown-freebsd=freebsd
i386-unknown-netbsd=netbsd i386-unknown-netbsd=netbsd
...@@ -19,10 +18,9 @@ i586-pc-sco3.2v=sco ...@@ -19,10 +18,9 @@ i586-pc-sco3.2v=sco
i686-pc-linux-gnu=linux_i386 i686-pc-linux-gnu=linux_i386
mips-sgi-irix=irix5 mips-sgi-irix=irix5
powerpc-ibm-aix3.2.5=aix_325 powerpc-ibm-aix3.2.5=aix_325
powerpc-ibm-aix4.1.4.0=aix_41 powerpc-ibm-aix4.1=aix_41
powerpc-ibm-aix4.1.5.0=aix_41 powerpc-ibm-aix4.2=aix_42
powerpc-ibm-aix4.2.1.0=aix_42 powerpc-ibm-aix4.3=aix_42
powerpc-ibm-aix4.3.1.0=aix_42
powerpc-unknown-linux-gnu=linux_ppc powerpc-unknown-linux-gnu=linux_ppc
sparc-sun-solaris=solaris_sparc_gcc sparc-sun-solaris=solaris_sparc_gcc
sparc-sun-sunos4=sunos4_gcc sparc-sun-sunos4=sunos4_gcc
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment