gcc.sh 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #!/bin/sh
  2. ##
  3. ## gcc.sh -- GCC Package Build Utility
  4. ## Copyright (c) 2002 Ralf S. Engelschall <rse@engelschall.com>
  5. ##
  6. check="$1"
  7. shift
  8. case $check in
  9. require-binutils )
  10. # determine whether GNU gcc requires GNU binutils on this platform
  11. require="no"
  12. target="$1"
  13. shift
  14. case $target in
  15. *-linux* )
  16. v=unknown
  17. if [ -f /etc/debian_version ]; then
  18. v=`/usr/bin/dpkg -l binutils | grep binutils | awk '{ print $3; }'`
  19. elif [ -f /etc/redhat-release ]; then
  20. v=`/bin/rpm -q --qf '%{VERSION}' binutils`
  21. elif [ -f /etc/SuSE-release ]; then
  22. v=`/bin/rpm -q --qf '%{VERSION}' binutils`
  23. else
  24. v=`(ld --version | grep 'GNU ld' | sed -e 's;^[^0-9]*\([0-9].[0-9.]*\).*;\1;') 2>/dev/null`
  25. fi
  26. # require GNU binutils >= 2.12
  27. case "$v" in
  28. 2.1[2-9] | 2.1[2-9].* ) ;;
  29. * ) require="yes" ;;
  30. esac
  31. ;;
  32. * )
  33. if [ ".`(ld --version) 2>/dev/null | grep 'GNU ld'`" != . ]; then
  34. v=`(ld --version | grep 'GNU ld' | sed -e 's;^[^0-9]*\([0-9].[0-9.]*\).*;\1;') 2>/dev/null`
  35. # require GNU binutils >= 2.12
  36. case "$v" in
  37. 2.1[2-9] | 2.1[2-9].* ) ;;
  38. * ) require="yes" ;;
  39. esac
  40. fi
  41. ;;
  42. esac
  43. echo "$require" | awk '{ printf("%s", $1); }'
  44. ;;
  45. esac