blob: 0e06794792336e03ea074803420044a9aef83066 [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
Simon Butcher85c4c862020-03-05 15:18:53 +000026 VARIANT="$1"
Andres AG31f9b5b2016-10-04 17:14:38 +010027 shift
Andres AG7a63eaf2016-09-05 12:24:47 +010028
Simon Butcher679d2de2020-02-27 12:58:27 +000029 if [ -n "$VARIANT" ]; then
Simon Butcher3104eec2020-02-26 15:29:40 +000030 VARIANT=" ($VARIANT)"
31 fi
32
Simon Butcher679d2de2020-02-27 12:58:27 +000033 if ! type "$BIN" > /dev/null 2>&1; then
Simon Butcher3104eec2020-02-26 15:29:40 +000034 echo " * ${BIN##*/}$VARIANT: Not found."
Andres AG31f9b5b2016-10-04 17:14:38 +010035 return 0
Andres AG87bb5772016-09-27 15:05:15 +010036 fi
Andres AG87bb5772016-09-27 15:05:15 +010037
Andres AG31f9b5b2016-10-04 17:14:38 +010038 BIN=`which "$BIN"`
39 VERSION_STR=`$BIN $ARGS 2>&1`
Janos Follathb72c6782016-07-19 14:54:17 +010040
Andres AG31f9b5b2016-10-04 17:14:38 +010041 # Apply all filters
42 while [ $# -gt 0 ]; do
43 FILTER="$1"
44 shift
45 VERSION_STR=`echo "$VERSION_STR" | $FILTER`
46 done
47
Simon Butcher85c4c862020-03-05 15:18:53 +000048 if [ -z "$VERSION_STR" ]; then
49 VERSION_STR="Version could not be determined."
50 fi
51
Simon Butcher3104eec2020-02-26 15:29:40 +000052 echo " * ${BIN##*/}$VARIANT: ${BIN} : ${VERSION_STR} "
Andres AG31f9b5b2016-10-04 17:14:38 +010053}
54
Simon Butcher679d2de2020-02-27 12:58:27 +000055echo "** Platform:"
56echo
57
58if [ `uname -s` = "Linux" ]; then
Simon Butcher3104eec2020-02-26 15:29:40 +000059 echo "Linux variant"
60 lsb_release -d -c
61else
62 echo "Unknown Unix variant"
63fi
64
Janos Follathb72c6782016-07-19 14:54:17 +010065echo
Janos Follathb72c6782016-07-19 14:54:17 +010066
Simon Butcher3104eec2020-02-26 15:29:40 +000067print_version "uname" "-a" ""
Simon Butcher85c4c862020-03-05 15:18:53 +000068
Simon Butcher679d2de2020-02-27 12:58:27 +000069echo
70echo
71echo "** Tool Versions:"
72echo
Simon Butcher3104eec2020-02-26 15:29:40 +000073
Gilles Peskine26232962018-03-21 08:35:07 +010074if [ "${RUN_ARMCC:-1}" -ne 0 ]; then
75 : "${ARMC5_CC:=armcc}"
Simon Butcher3104eec2020-02-26 15:29:40 +000076 print_version "$ARMC5_CC" "--vsn" "" "head -n 2"
Gilles Peskine26232962018-03-21 08:35:07 +010077 echo
Janos Follathb72c6782016-07-19 14:54:17 +010078
Gilles Peskine26232962018-03-21 08:35:07 +010079 : "${ARMC6_CC:=armclang}"
Simon Butcher3104eec2020-02-26 15:29:40 +000080 print_version "$ARMC6_CC" "--vsn" "" "head -n 2"
Gilles Peskine26232962018-03-21 08:35:07 +010081 echo
82fi
Janos Follathb72c6782016-07-19 14:54:17 +010083
Simon Butcher3104eec2020-02-26 15:29:40 +000084print_version "arm-none-eabi-gcc" "--version" "" "head -n 1"
Janos Follathb72c6782016-07-19 14:54:17 +010085echo
Janos Follathb72c6782016-07-19 14:54:17 +010086
Simon Butcher3104eec2020-02-26 15:29:40 +000087print_version "gcc" "--version" "" "head -n 1"
Janos Follathb72c6782016-07-19 14:54:17 +010088echo
Janos Follathb72c6782016-07-19 14:54:17 +010089
Simon Butcher3104eec2020-02-26 15:29:40 +000090print_version "clang" "--version" "" "head -n 2"
Janos Follathb72c6782016-07-19 14:54:17 +010091echo
Andres AG7a63eaf2016-09-05 12:24:47 +010092
Simon Butcher3104eec2020-02-26 15:29:40 +000093print_version "ldd" "--version" "" "head -n 1"
Andres AG31f9b5b2016-10-04 17:14:38 +010094echo
95
Simon Butcher3104eec2020-02-26 15:29:40 +000096print_version "valgrind" "--version" ""
97echo
98
99print_version "gdb" "--version" "" "head -n 1"
Andres AG31f9b5b2016-10-04 17:14:38 +0100100echo
101
Simon Butcher85c4c862020-03-05 15:18:53 +0000102print_version "perl" "--version" "" "head -n 2" "grep ."
103echo
104
105print_version "python" "--version" "" "head -n 1"
106echo
107
Simon Butcherbae73282020-03-06 14:50:49 +0000108print_version "pylint3" "--version" "" "sed /^.*config/d" "grep pylint"
Simon Butcher85c4c862020-03-05 15:18:53 +0000109echo
110
Andres AG31f9b5b2016-10-04 17:14:38 +0100111: ${OPENSSL:=openssl}
Simon Butcher3104eec2020-02-26 15:29:40 +0000112print_version "$OPENSSL" "version" "default"
Andres AG31f9b5b2016-10-04 17:14:38 +0100113echo
Andres AG7a63eaf2016-09-05 12:24:47 +0100114
115if [ -n "${OPENSSL_LEGACY+set}" ]; then
Simon Butcher3104eec2020-02-26 15:29:40 +0000116 print_version "$OPENSSL_LEGACY" "version" "legacy"
117else
118 echo " * openssl (legacy): Not configured."
Janos Follathb72c6782016-07-19 14:54:17 +0100119fi
Simon Butcher3104eec2020-02-26 15:29:40 +0000120echo
Janos Follathb72c6782016-07-19 14:54:17 +0100121
Manuel Pégourié-Gonnard6b368922018-02-20 12:02:07 +0100122if [ -n "${OPENSSL_NEXT+set}" ]; then
Simon Butcher3104eec2020-02-26 15:29:40 +0000123 print_version "$OPENSSL_NEXT" "version" "next"
124else
125 echo " * openssl (next): Not configured."
Manuel Pégourié-Gonnard6b368922018-02-20 12:02:07 +0100126fi
Simon Butcher3104eec2020-02-26 15:29:40 +0000127echo
Manuel Pégourié-Gonnard6b368922018-02-20 12:02:07 +0100128
Andres AG31f9b5b2016-10-04 17:14:38 +0100129: ${GNUTLS_CLI:=gnutls-cli}
Simon Butcher3104eec2020-02-26 15:29:40 +0000130print_version "$GNUTLS_CLI" "--version" "default" "head -n 1"
Janos Follathb72c6782016-07-19 14:54:17 +0100131echo
Janos Follathb72c6782016-07-19 14:54:17 +0100132
Andres AG31f9b5b2016-10-04 17:14:38 +0100133: ${GNUTLS_SERV:=gnutls-serv}
Simon Butcher3104eec2020-02-26 15:29:40 +0000134print_version "$GNUTLS_SERV" "--version" "default" "head -n 1"
Janos Follathb72c6782016-07-19 14:54:17 +0100135echo
Andres AG7a63eaf2016-09-05 12:24:47 +0100136
137if [ -n "${GNUTLS_LEGACY_CLI+set}" ]; then
Simon Butcher3104eec2020-02-26 15:29:40 +0000138 print_version "$GNUTLS_LEGACY_CLI" "--version" "legacy" "head -n 1"
139else
140 echo " * gnutls-cli (legacy): Not configured."
Andres AG7a63eaf2016-09-05 12:24:47 +0100141fi
Simon Butcher3104eec2020-02-26 15:29:40 +0000142echo
Andres AG7a63eaf2016-09-05 12:24:47 +0100143
144if [ -n "${GNUTLS_LEGACY_SERV+set}" ]; then
Simon Butcher3104eec2020-02-26 15:29:40 +0000145 print_version "$GNUTLS_LEGACY_SERV" "--version" "legacy" "head -n 1"
146else
147 echo " * gnutls-serv (legacy): Not configured."
Janos Follathb72c6782016-07-19 14:54:17 +0100148fi
Simon Butcher3104eec2020-02-26 15:29:40 +0000149echo
Janos Follathb72c6782016-07-19 14:54:17 +0100150
Simon Butcher3104eec2020-02-26 15:29:40 +0000151echo " * Installed asan versions:"
Simon Butcher679d2de2020-02-27 12:58:27 +0000152if type dpkg-query >/dev/null 2>/dev/null; then
153 if ! dpkg-query -f '${Status} ${Package}: ${Version}\n' -W 'libasan*' |
154 awk '$3 == "installed" && $4 !~ /-/ {print $4, $5}' |
155 grep .
156 then
157 echo " No asan versions installed."
158 fi
Janos Follathb72c6782016-07-19 14:54:17 +0100159else
Simon Butcher679d2de2020-02-27 12:58:27 +0000160 echo " Unable to determine the asan version without dpkg."
Janos Follathb72c6782016-07-19 14:54:17 +0100161fi
Janos Follathb72c6782016-07-19 14:54:17 +0100162echo