output_env.sh 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. #! /usr/bin/env sh
  2. # output_env.sh
  3. #
  4. # This file is part of mbed TLS (https://tls.mbed.org)
  5. #
  6. # Copyright (c) 2016, ARM Limited, All Rights Reserved
  7. #
  8. # Purpose
  9. #
  10. # To print out all the relevant information about the development environment.
  11. #
  12. # This includes:
  13. # - architecture of the system
  14. # - type and version of the operating system
  15. # - version of armcc, clang, gcc-arm and gcc compilers
  16. # - version of libc, clang, asan and valgrind if installed
  17. # - version of gnuTLS and OpenSSL
  18. print_version()
  19. {
  20. BIN="$1"
  21. shift
  22. ARGS="$1"
  23. shift
  24. FAIL_MSG="$1"
  25. shift
  26. if ! `type "$BIN" > /dev/null 2>&1`; then
  27. echo "* $FAIL_MSG"
  28. return 0
  29. fi
  30. BIN=`which "$BIN"`
  31. VERSION_STR=`$BIN $ARGS 2>&1`
  32. # Apply all filters
  33. while [ $# -gt 0 ]; do
  34. FILTER="$1"
  35. shift
  36. VERSION_STR=`echo "$VERSION_STR" | $FILTER`
  37. done
  38. echo "* ${BIN##*/}: $BIN: $VERSION_STR"
  39. }
  40. print_version "uname" "-a" ""
  41. echo
  42. : ${ARMC5_CC:=armcc}
  43. print_version "$ARMC5_CC" "--vsn" "armcc not found!" "head -n 2"
  44. echo
  45. : ${ARMC6_CC:=armclang}
  46. print_version "$ARMC6_CC" "--vsn" "armclang not found!" "head -n 2"
  47. echo
  48. print_version "arm-none-eabi-gcc" "--version" "gcc-arm not found!" "head -n 1"
  49. echo
  50. print_version "gcc" "--version" "gcc not found!" "head -n 1"
  51. echo
  52. print_version "clang" "--version" "clang not found" "head -n 2"
  53. echo
  54. print_version "ldd" "--version" \
  55. "No ldd present: can't determine libc version!" \
  56. "head -n 1"
  57. echo
  58. print_version "valgrind" "--version" "valgrind not found!"
  59. echo
  60. : ${OPENSSL:=openssl}
  61. print_version "$OPENSSL" "version" "openssl not found!"
  62. echo
  63. if [ -n "${OPENSSL_LEGACY+set}" ]; then
  64. print_version "$OPENSSL_LEGACY" "version" "openssl legacy version not found!"
  65. echo
  66. fi
  67. : ${GNUTLS_CLI:=gnutls-cli}
  68. print_version "$GNUTLS_CLI" "--version" "gnuTLS client not found!" "head -n 1"
  69. echo
  70. : ${GNUTLS_SERV:=gnutls-serv}
  71. print_version "$GNUTLS_SERV" "--version" "gnuTLS server not found!" "head -n 1"
  72. echo
  73. if [ -n "${GNUTLS_LEGACY_CLI+set}" ]; then
  74. print_version "$GNUTLS_LEGACY_CLI" "--version" \
  75. "gnuTLS client legacy version not found!" \
  76. "head -n 1"
  77. echo
  78. fi
  79. if [ -n "${GNUTLS_LEGACY_SERV+set}" ]; then
  80. print_version "$GNUTLS_LEGACY_SERV" "--version" \
  81. "gnuTLS server legacy version not found!" \
  82. "head -n 1"
  83. echo
  84. fi
  85. if `hash dpkg > /dev/null 2>&1`; then
  86. echo "* asan:"
  87. dpkg -s libasan2 2> /dev/null | grep -i version
  88. dpkg -s libasan1 2> /dev/null | grep -i version
  89. dpkg -s libasan0 2> /dev/null | grep -i version
  90. else
  91. echo "* No dpkg present: can't determine asan version!"
  92. fi
  93. echo