blob: 1d34709287fd4b796b8b4d3e80881a83ac09372c [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
Ronald Crona960dc92020-05-25 13:11:32 +020016# - version of make and cmake
Simon Butcher3ac07672016-09-04 14:28:44 +030017# - version of armcc, clang, gcc-arm and gcc compilers
18# - version of libc, clang, asan and valgrind if installed
Janos Follathb72c6782016-07-19 14:54:17 +010019# - version of gnuTLS and OpenSSL
20
Andres AG31f9b5b2016-10-04 17:14:38 +010021print_version()
22{
23 BIN="$1"
24 shift
25 ARGS="$1"
26 shift
Simon Butcher82770412020-03-05 15:18:53 +000027 VARIANT="$1"
Andres AG31f9b5b2016-10-04 17:14:38 +010028 shift
Andres AG7a63eaf2016-09-05 12:24:47 +010029
Simon Butcherd40e6032020-02-27 12:58:27 +000030 if [ -n "$VARIANT" ]; then
Simon Butcher870ee822020-02-26 15:29:40 +000031 VARIANT=" ($VARIANT)"
32 fi
33
Simon Butcherd40e6032020-02-27 12:58:27 +000034 if ! type "$BIN" > /dev/null 2>&1; then
Simon Butcher870ee822020-02-26 15:29:40 +000035 echo " * ${BIN##*/}$VARIANT: Not found."
Andres AG31f9b5b2016-10-04 17:14:38 +010036 return 0
Andres AG87bb5772016-09-27 15:05:15 +010037 fi
Andres AG87bb5772016-09-27 15:05:15 +010038
Andres AG31f9b5b2016-10-04 17:14:38 +010039 BIN=`which "$BIN"`
40 VERSION_STR=`$BIN $ARGS 2>&1`
Janos Follathb72c6782016-07-19 14:54:17 +010041
Andres AG31f9b5b2016-10-04 17:14:38 +010042 # Apply all filters
43 while [ $# -gt 0 ]; do
44 FILTER="$1"
45 shift
46 VERSION_STR=`echo "$VERSION_STR" | $FILTER`
47 done
48
Simon Butcher82770412020-03-05 15:18:53 +000049 if [ -z "$VERSION_STR" ]; then
50 VERSION_STR="Version could not be determined."
51 fi
52
Simon Butcher870ee822020-02-26 15:29:40 +000053 echo " * ${BIN##*/}$VARIANT: ${BIN} : ${VERSION_STR} "
Andres AG31f9b5b2016-10-04 17:14:38 +010054}
55
Simon Butcherd40e6032020-02-27 12:58:27 +000056echo "** Platform:"
57echo
58
59if [ `uname -s` = "Linux" ]; then
Simon Butcher870ee822020-02-26 15:29:40 +000060 echo "Linux variant"
61 lsb_release -d -c
62else
63 echo "Unknown Unix variant"
64fi
65
Janos Follathb72c6782016-07-19 14:54:17 +010066echo
Janos Follathb72c6782016-07-19 14:54:17 +010067
Simon Butcher870ee822020-02-26 15:29:40 +000068print_version "uname" "-a" ""
Simon Butcher82770412020-03-05 15:18:53 +000069
Simon Butcherd40e6032020-02-27 12:58:27 +000070echo
71echo
72echo "** Tool Versions:"
73echo
Simon Butcher870ee822020-02-26 15:29:40 +000074
Ronald Crona960dc92020-05-25 13:11:32 +020075print_version "make" "--version" "" "head -n 1"
76echo
77
78print_version "cmake" "--version" "" "head -n 1"
79echo
80
Gilles Peskine53038eb2018-03-21 08:35:07 +010081if [ "${RUN_ARMCC:-1}" -ne 0 ]; then
82 : "${ARMC5_CC:=armcc}"
Simon Butcher870ee822020-02-26 15:29:40 +000083 print_version "$ARMC5_CC" "--vsn" "" "head -n 2"
Gilles Peskine53038eb2018-03-21 08:35:07 +010084 echo
Janos Follathb72c6782016-07-19 14:54:17 +010085
Gilles Peskine53038eb2018-03-21 08:35:07 +010086 : "${ARMC6_CC:=armclang}"
Simon Butcher870ee822020-02-26 15:29:40 +000087 print_version "$ARMC6_CC" "--vsn" "" "head -n 2"
Gilles Peskine53038eb2018-03-21 08:35:07 +010088 echo
89fi
Janos Follathb72c6782016-07-19 14:54:17 +010090
Simon Butcher870ee822020-02-26 15:29:40 +000091print_version "arm-none-eabi-gcc" "--version" "" "head -n 1"
Janos Follathb72c6782016-07-19 14:54:17 +010092echo
Janos Follathb72c6782016-07-19 14:54:17 +010093
Simon Butcher870ee822020-02-26 15:29:40 +000094print_version "gcc" "--version" "" "head -n 1"
Janos Follathb72c6782016-07-19 14:54:17 +010095echo
Janos Follathb72c6782016-07-19 14:54:17 +010096
Simon Butcher870ee822020-02-26 15:29:40 +000097print_version "clang" "--version" "" "head -n 2"
Janos Follathb72c6782016-07-19 14:54:17 +010098echo
Andres AG7a63eaf2016-09-05 12:24:47 +010099
Simon Butcher870ee822020-02-26 15:29:40 +0000100print_version "ldd" "--version" "" "head -n 1"
Andres AG31f9b5b2016-10-04 17:14:38 +0100101echo
102
Simon Butcher870ee822020-02-26 15:29:40 +0000103print_version "valgrind" "--version" ""
104echo
105
106print_version "gdb" "--version" "" "head -n 1"
Andres AG31f9b5b2016-10-04 17:14:38 +0100107echo
108
Simon Butcher82770412020-03-05 15:18:53 +0000109print_version "perl" "--version" "" "head -n 2" "grep ."
110echo
111
112print_version "python" "--version" "" "head -n 1"
113echo
114
Ronald Cron6872e172020-05-25 13:55:21 +0200115print_version "python3" "--version" "" "head -n 1"
116echo
117
Simon Butcher8eb64e62020-03-06 14:50:49 +0000118print_version "pylint3" "--version" "" "sed /^.*config/d" "grep pylint"
Simon Butcher82770412020-03-05 15:18:53 +0000119echo
120
Andres AG31f9b5b2016-10-04 17:14:38 +0100121: ${OPENSSL:=openssl}
Simon Butcher870ee822020-02-26 15:29:40 +0000122print_version "$OPENSSL" "version" "default"
Andres AG31f9b5b2016-10-04 17:14:38 +0100123echo
Andres AG7a63eaf2016-09-05 12:24:47 +0100124
125if [ -n "${OPENSSL_LEGACY+set}" ]; then
Simon Butcher870ee822020-02-26 15:29:40 +0000126 print_version "$OPENSSL_LEGACY" "version" "legacy"
127else
128 echo " * openssl (legacy): Not configured."
Janos Follathb72c6782016-07-19 14:54:17 +0100129fi
Simon Butcher870ee822020-02-26 15:29:40 +0000130echo
Janos Follathb72c6782016-07-19 14:54:17 +0100131
Andres AG31f9b5b2016-10-04 17:14:38 +0100132: ${GNUTLS_CLI:=gnutls-cli}
Simon Butcher870ee822020-02-26 15:29:40 +0000133print_version "$GNUTLS_CLI" "--version" "default" "head -n 1"
Janos Follathb72c6782016-07-19 14:54:17 +0100134echo
Janos Follathb72c6782016-07-19 14:54:17 +0100135
Andres AG31f9b5b2016-10-04 17:14:38 +0100136: ${GNUTLS_SERV:=gnutls-serv}
Simon Butcher870ee822020-02-26 15:29:40 +0000137print_version "$GNUTLS_SERV" "--version" "default" "head -n 1"
Janos Follathb72c6782016-07-19 14:54:17 +0100138echo
Andres AG7a63eaf2016-09-05 12:24:47 +0100139
140if [ -n "${GNUTLS_LEGACY_CLI+set}" ]; then
Simon Butcher870ee822020-02-26 15:29:40 +0000141 print_version "$GNUTLS_LEGACY_CLI" "--version" "legacy" "head -n 1"
142else
143 echo " * gnutls-cli (legacy): Not configured."
Andres AG7a63eaf2016-09-05 12:24:47 +0100144fi
Simon Butcher870ee822020-02-26 15:29:40 +0000145echo
Andres AG7a63eaf2016-09-05 12:24:47 +0100146
147if [ -n "${GNUTLS_LEGACY_SERV+set}" ]; then
Simon Butcher870ee822020-02-26 15:29:40 +0000148 print_version "$GNUTLS_LEGACY_SERV" "--version" "legacy" "head -n 1"
149else
150 echo " * gnutls-serv (legacy): Not configured."
Janos Follathb72c6782016-07-19 14:54:17 +0100151fi
Simon Butcher870ee822020-02-26 15:29:40 +0000152echo
Janos Follathb72c6782016-07-19 14:54:17 +0100153
Simon Butcher870ee822020-02-26 15:29:40 +0000154echo " * Installed asan versions:"
Simon Butcherd40e6032020-02-27 12:58:27 +0000155if type dpkg-query >/dev/null 2>/dev/null; then
156 if ! dpkg-query -f '${Status} ${Package}: ${Version}\n' -W 'libasan*' |
157 awk '$3 == "installed" && $4 !~ /-/ {print $4, $5}' |
158 grep .
159 then
160 echo " No asan versions installed."
161 fi
Janos Follathb72c6782016-07-19 14:54:17 +0100162else
Simon Butcherd40e6032020-02-27 12:58:27 +0000163 echo " Unable to determine the asan version without dpkg."
Janos Follathb72c6782016-07-19 14:54:17 +0100164fi
Janos Follathb72c6782016-07-19 14:54:17 +0100165echo