From 1506b0cfd5708c81fe286549d63843c5030c0e8a Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Fri, 9 Mar 2007 08:33:34 +0000 Subject: Improve the checking of sed by adding some common GNU sed installation names (gsed/gnused), checking for a basic OS X sed feature in command line option handling, checking the actual result of the sed run against the expected result, and placing common code for the check under toolchain/dependencies/. (Heikki Lindholm) --- toolchain/dependencies/check-host-sed.sh | 38 ++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100755 toolchain/dependencies/check-host-sed.sh (limited to 'toolchain/dependencies/check-host-sed.sh') diff --git a/toolchain/dependencies/check-host-sed.sh b/toolchain/dependencies/check-host-sed.sh new file mode 100755 index 000000000..ba99a4258 --- /dev/null +++ b/toolchain/dependencies/check-host-sed.sh @@ -0,0 +1,38 @@ +SEDLIST="/usr/bin/sed /bin/sed sed gnused gsed" + +DIFF=$(which diff) +if ! test -x "$DIFF" ; then + /bin/echo -e "\n\ntesting for sed needs 'diff' on your build machine\n"; + exit 1; +fi; + +for SED in $SEDLIST +do + if ! test -x $SED ; then + SED=$(which $SED) + if ! test -x "$SED" > /dev/null ; then + SED="" + continue + fi + fi + + echo "HELLO" > .sedtest + echo "GOODBYE" > .sedtest-correct + $SED -i -e "s/HELLO/GOODBYE/" .sedtest >/dev/null 2>&1 + + if test $? != 0 ; then + SED="" + elif test -e ".sedtest-e" ; then + rm -f ".sedtest-e" + SED="" + elif ! $DIFF ".sedtest" ".sedtest-correct" > /dev/null ; then + echo "diff failed" + SED="" + fi + + rm -f .sedtest .sedtest-correct + if [ ! -z "$SED" ] ; then + break + fi +done +echo $SED -- cgit v1.2.3