output_env.sh 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  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. if [ "${RUN_ARMCC:-1}" -ne 0 ]; then
  43. : "${ARMC5_CC:=armcc}"
  44. print_version "$ARMC5_CC" "--vsn" "armcc not found!" "head -n 2"
  45. echo
  46. : "${ARMC6_CC:=armclang}"
  47. print_version "$ARMC6_CC" "--vsn" "armclang not found!" "head -n 2"
  48. echo
  49. fi
  50. print_version "arm-none-eabi-gcc" "--version" "gcc-arm not found!" "head -n 1"
  51. echo
  52. print_version "gcc" "--version" "gcc not found!" "head -n 1"
  53. echo
  54. print_version "clang" "--version" "clang not found" "head -n 2"
  55. echo
  56. print_version "ldd" "--version" \
  57. "No ldd present: can't determine libc version!" \
  58. "head -n 1"
  59. echo
  60. print_version "valgrind" "--version" "valgrind not found!"
  61. echo
  62. : ${OPENSSL:=openssl}
  63. print_version "$OPENSSL" "version" "openssl not found!"
  64. echo
  65. if [ -n "${OPENSSL_LEGACY+set}" ]; then
  66. print_version "$OPENSSL_LEGACY" "version" "openssl legacy version not found!"
  67. echo
  68. fi
  69. if [ -n "${OPENSSL_NEXT+set}" ]; then
  70. print_version "$OPENSSL_NEXT" "version" "openssl next version not found!"
  71. echo
  72. fi
  73. : ${GNUTLS_CLI:=gnutls-cli}
  74. print_version "$GNUTLS_CLI" "--version" "gnuTLS client not found!" "head -n 1"
  75. echo
  76. : ${GNUTLS_SERV:=gnutls-serv}
  77. print_version "$GNUTLS_SERV" "--version" "gnuTLS server not found!" "head -n 1"
  78. echo
  79. if [ -n "${GNUTLS_LEGACY_CLI+set}" ]; then
  80. print_version "$GNUTLS_LEGACY_CLI" "--version" \
  81. "gnuTLS client legacy version not found!" \
  82. "head -n 1"
  83. echo
  84. fi
  85. if [ -n "${GNUTLS_LEGACY_SERV+set}" ]; then
  86. print_version "$GNUTLS_LEGACY_SERV" "--version" \
  87. "gnuTLS server legacy version not found!" \
  88. "head -n 1"
  89. echo
  90. fi
  91. if `hash dpkg > /dev/null 2>&1`; then
  92. echo "* asan:"
  93. dpkg -s libasan2 2> /dev/null | grep -i version
  94. dpkg -s libasan1 2> /dev/null | grep -i version
  95. dpkg -s libasan0 2> /dev/null | grep -i version
  96. else
  97. echo "* No dpkg present: can't determine asan version!"
  98. fi
  99. echo