blob: e9ad8c5d7a16cfc41f81afe46f28876a15076581 [file] [log] [blame]
Andres AG31f9b5b2016-10-04 17:14:38 +01001#! /usr/bin/env sh
2
Janos Follathb72c6782016-07-19 14:54:17 +01003# output_env.sh
4#
5# This file is part of mbed TLS (https://tls.mbed.org)
6#
7# Copyright (c) 2016, ARM Limited, All Rights Reserved
8#
9# Purpose
10#
11# To print out all the relevant information about the development environment.
12#
13# This includes:
14# - architecture of the system
15# - type and version of the operating system
Simon Butcher3ac07672016-09-04 14:28:44 +030016# - version of armcc, clang, gcc-arm and gcc compilers
17# - version of libc, clang, asan and valgrind if installed
Janos Follathb72c6782016-07-19 14:54:17 +010018# - version of gnuTLS and OpenSSL
19
Andres AG31f9b5b2016-10-04 17:14:38 +010020print_version()
21{
22 BIN="$1"
23 shift
24 ARGS="$1"
25 shift
26 FAIL_MSG="$1"
27 shift
Andres AG7a63eaf2016-09-05 12:24:47 +010028
Andres AG31f9b5b2016-10-04 17:14:38 +010029 if ! `type "$BIN" > /dev/null 2>&1`; then
30 echo "* $FAIL_MSG"
31 return 0
Andres AG87bb5772016-09-27 15:05:15 +010032 fi
Andres AG87bb5772016-09-27 15:05:15 +010033
Andres AG31f9b5b2016-10-04 17:14:38 +010034 BIN=`which "$BIN"`
35 VERSION_STR=`$BIN $ARGS 2>&1`
Janos Follathb72c6782016-07-19 14:54:17 +010036
Andres AG31f9b5b2016-10-04 17:14:38 +010037 # Apply all filters
38 while [ $# -gt 0 ]; do
39 FILTER="$1"
40 shift
41 VERSION_STR=`echo "$VERSION_STR" | $FILTER`
42 done
43
44 echo "* ${BIN##*/}: $BIN: $VERSION_STR"
45}
46
47print_version "uname" "-a" ""
Janos Follathb72c6782016-07-19 14:54:17 +010048echo
Janos Follathb72c6782016-07-19 14:54:17 +010049
Gilles Peskine53038eb2018-03-21 08:35:07 +010050if [ "${RUN_ARMCC:-1}" -ne 0 ]; then
51 : "${ARMC5_CC:=armcc}"
52 print_version "$ARMC5_CC" "--vsn" "armcc not found!" "head -n 2"
53 echo
Janos Follathb72c6782016-07-19 14:54:17 +010054
Gilles Peskine53038eb2018-03-21 08:35:07 +010055 : "${ARMC6_CC:=armclang}"
56 print_version "$ARMC6_CC" "--vsn" "armclang not found!" "head -n 2"
57 echo
58fi
Janos Follathb72c6782016-07-19 14:54:17 +010059
Andres AG31f9b5b2016-10-04 17:14:38 +010060print_version "arm-none-eabi-gcc" "--version" "gcc-arm not found!" "head -n 1"
Janos Follathb72c6782016-07-19 14:54:17 +010061echo
Janos Follathb72c6782016-07-19 14:54:17 +010062
Andres AG31f9b5b2016-10-04 17:14:38 +010063print_version "gcc" "--version" "gcc not found!" "head -n 1"
Janos Follathb72c6782016-07-19 14:54:17 +010064echo
Janos Follathb72c6782016-07-19 14:54:17 +010065
Andres AG31f9b5b2016-10-04 17:14:38 +010066print_version "clang" "--version" "clang not found" "head -n 2"
Janos Follathb72c6782016-07-19 14:54:17 +010067echo
Andres AG7a63eaf2016-09-05 12:24:47 +010068
Andres AG31f9b5b2016-10-04 17:14:38 +010069print_version "ldd" "--version" \
70 "No ldd present: can't determine libc version!" \
71 "head -n 1"
72echo
73
74print_version "valgrind" "--version" "valgrind not found!"
75echo
76
77: ${OPENSSL:=openssl}
78print_version "$OPENSSL" "version" "openssl not found!"
79echo
Andres AG7a63eaf2016-09-05 12:24:47 +010080
81if [ -n "${OPENSSL_LEGACY+set}" ]; then
Andres AG31f9b5b2016-10-04 17:14:38 +010082 print_version "$OPENSSL_LEGACY" "version" "openssl legacy version not found!"
Andres AG7a63eaf2016-09-05 12:24:47 +010083 echo
Janos Follathb72c6782016-07-19 14:54:17 +010084fi
85
Andres AG31f9b5b2016-10-04 17:14:38 +010086: ${GNUTLS_CLI:=gnutls-cli}
87print_version "$GNUTLS_CLI" "--version" "gnuTLS client not found!" "head -n 1"
Janos Follathb72c6782016-07-19 14:54:17 +010088echo
Janos Follathb72c6782016-07-19 14:54:17 +010089
Andres AG31f9b5b2016-10-04 17:14:38 +010090: ${GNUTLS_SERV:=gnutls-serv}
91print_version "$GNUTLS_SERV" "--version" "gnuTLS server not found!" "head -n 1"
Janos Follathb72c6782016-07-19 14:54:17 +010092echo
Andres AG7a63eaf2016-09-05 12:24:47 +010093
94if [ -n "${GNUTLS_LEGACY_CLI+set}" ]; then
Andres AG31f9b5b2016-10-04 17:14:38 +010095 print_version "$GNUTLS_LEGACY_CLI" "--version" \
96 "gnuTLS client legacy version not found!" \
97 "head -n 1"
Andres AG7a63eaf2016-09-05 12:24:47 +010098 echo
Andres AG7a63eaf2016-09-05 12:24:47 +010099fi
100
101if [ -n "${GNUTLS_LEGACY_SERV+set}" ]; then
Andres AG31f9b5b2016-10-04 17:14:38 +0100102 print_version "$GNUTLS_LEGACY_SERV" "--version" \
103 "gnuTLS server legacy version not found!" \
104 "head -n 1"
Andres AG7a63eaf2016-09-05 12:24:47 +0100105 echo
Janos Follathb72c6782016-07-19 14:54:17 +0100106fi
107
Andres AG7a63eaf2016-09-05 12:24:47 +0100108if `hash dpkg > /dev/null 2>&1`; then
Simon Butcher40122e02016-09-09 15:30:29 +0100109 echo "* asan:"
Janos Follathb72c6782016-07-19 14:54:17 +0100110 dpkg -s libasan2 2> /dev/null | grep -i version
111 dpkg -s libasan1 2> /dev/null | grep -i version
112 dpkg -s libasan0 2> /dev/null | grep -i version
113else
Simon Butcher40122e02016-09-09 15:30:29 +0100114 echo "* No dpkg present: can't determine asan version!"
Janos Follathb72c6782016-07-19 14:54:17 +0100115fi
Janos Follathb72c6782016-07-19 14:54:17 +0100116echo