From: ro Date: Mon, 3 May 2010 16:40:54 +0000 (+0000) Subject: * ada/acats/run_acats (which): New function. X-Git-Url: http://git.sourceforge.jp/view?a=commitdiff_plain;h=6b98add918ea6c9ecee7d58ead51e6b1157dc290;p=pf3gnuchains%2Fgcc-fork.git * ada/acats/run_acats (which): New function. (host_gnatchop, host_gnatmake): Use it. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@158994 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 019661ec8e0..fb25dc4f110 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2010-05-03 Rainer Orth + + * ada/acats/run_acats (which): New function. + (host_gnatchop, host_gnatmake): Use it. + 2010-05-03 Richard Guenther PR tree-optimization/43971 diff --git a/gcc/testsuite/ada/acats/run_acats b/gcc/testsuite/ada/acats/run_acats index 3c3d89908f6..c389e647422 100755 --- a/gcc/testsuite/ada/acats/run_acats +++ b/gcc/testsuite/ada/acats/run_acats @@ -5,10 +5,25 @@ if [ "$testdir" = "" ]; then exit 1 fi +# Provide which replacement. +# +# type -p is missing from Solaris 2 /bin/sh and /bin/ksh (ksh88), but both +# ksh93 and bash have it. +# type output format differs between ksh88 and ksh93, so avoid it if +# type -p is present. +# Fall back to whence which ksh88 and ksh93 provide, but bash does not. + +which () { + type -p $* 2>/dev/null && return 0 + type $* 2>/dev/null | awk '{print $3}' && return 0 + whence $* 2>/dev/null && return 0 + return 1 +} + # Set up environment to use the Ada compiler from the object tree -host_gnatchop=`type gnatchop | awk '{print $3}'` -host_gnatmake=`type gnatmake | awk '{print $3}'` +host_gnatchop=`which gnatchop` +host_gnatmake=`which gnatmake` ROOT=`${PWDCMD-pwd}` BASE=`cd $ROOT/../../..; ${PWDCMD-pwd}`