config-guess.sh 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #!/bin/sh
  2. #
  3. # Copyright 2004, 2005 Free Software Foundation, Inc.
  4. # Contributed by Ben Elliston <bje@gnu.org>.
  5. #
  6. # This test reads 5-tuples from config-guess.data: the components of
  7. # the simulated uname(1) output and the expected GNU system triplet.
  8. verbose=false
  9. export PATH=`pwd`:$PATH
  10. IFS=" " # tab
  11. run_config_guess ()
  12. {
  13. rc=0
  14. while read machine release system version triplet ; do
  15. sed \
  16. -e "s,@MACHINE@,$machine," \
  17. -e "s,@RELEASE@,$release," \
  18. -e "s,@SYSTEM@,$system," \
  19. -e "s,@VERSION@,$version," < uname.in > uname
  20. chmod +x uname
  21. output=`sh ../config.guess 2>/dev/null`
  22. if test $? != 0 ; then
  23. echo "FAIL: unable to guess $machine:$release:$system:$version"
  24. rc=1
  25. continue
  26. fi
  27. if test $output != $triplet ; then
  28. echo "FAIL: $output (expected $triplet)"
  29. rc=1
  30. continue
  31. fi
  32. $verbose && echo "PASS: $triplet"
  33. done
  34. return $rc
  35. }
  36. sed 's/ */ /g' < config-guess.data | run_config_guess
  37. rc=$?
  38. if test $rc -eq 0 ; then
  39. $verbose || echo "PASS: config.guess checks"
  40. else
  41. test $rc -eq 1 && echo "Unexpected failures."
  42. fi
  43. exit $rc