blob: 62c5634b4460ff917973947a7765df3988f2b798 [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 Butcher3104eec2020-02-26 15:29:40 +000026 VARIANT=$1
Andres AG31f9b5b2016-10-04 17:14:38 +010027 shift
Andres AG7a63eaf2016-09-05 12:24:47 +010028
Simon Butcher3104eec2020-02-26 15:29:40 +000029 if [ ! -z $VARIANT ]; then
30 VARIANT=" ($VARIANT)"
31 fi
32
Andres AG31f9b5b2016-10-04 17:14:38 +010033 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 Butcher3104eec2020-02-26 15:29:40 +000048 echo " * ${BIN##*/}$VARIANT: ${BIN} : ${VERSION_STR} "
Andres AG31f9b5b2016-10-04 17:14:38 +010049}
50
Simon Butcher3104eec2020-02-26 15:29:40 +000051echo "Platform:\n"
52if `type "lsb_release" > /dev/null 2>&1`; then
53 echo "Linux variant"
54 lsb_release -d -c
55else
56 echo "Unknown Unix variant"
57fi
58
Janos Follathb72c6782016-07-19 14:54:17 +010059echo
Janos Follathb72c6782016-07-19 14:54:17 +010060
Simon Butcher3104eec2020-02-26 15:29:40 +000061print_version "uname" "-a" ""
62echo "\n"
63echo "Tool Versions:\n"
64
Gilles Peskine26232962018-03-21 08:35:07 +010065if [ "${RUN_ARMCC:-1}" -ne 0 ]; then
66 : "${ARMC5_CC:=armcc}"
Simon Butcher3104eec2020-02-26 15:29:40 +000067 print_version "$ARMC5_CC" "--vsn" "" "head -n 2"
Gilles Peskine26232962018-03-21 08:35:07 +010068 echo
Janos Follathb72c6782016-07-19 14:54:17 +010069
Gilles Peskine26232962018-03-21 08:35:07 +010070 : "${ARMC6_CC:=armclang}"
Simon Butcher3104eec2020-02-26 15:29:40 +000071 print_version "$ARMC6_CC" "--vsn" "" "head -n 2"
Gilles Peskine26232962018-03-21 08:35:07 +010072 echo
73fi
Janos Follathb72c6782016-07-19 14:54:17 +010074
Simon Butcher3104eec2020-02-26 15:29:40 +000075print_version "arm-none-eabi-gcc" "--version" "" "head -n 1"
Janos Follathb72c6782016-07-19 14:54:17 +010076echo
Janos Follathb72c6782016-07-19 14:54:17 +010077
Simon Butcher3104eec2020-02-26 15:29:40 +000078print_version "gcc" "--version" "" "head -n 1"
Janos Follathb72c6782016-07-19 14:54:17 +010079echo
Janos Follathb72c6782016-07-19 14:54:17 +010080
Simon Butcher3104eec2020-02-26 15:29:40 +000081print_version "clang" "--version" "" "head -n 2"
Janos Follathb72c6782016-07-19 14:54:17 +010082echo
Andres AG7a63eaf2016-09-05 12:24:47 +010083
Simon Butcher3104eec2020-02-26 15:29:40 +000084print_version "ldd" "--version" "" "head -n 1"
Andres AG31f9b5b2016-10-04 17:14:38 +010085echo
86
Simon Butcher3104eec2020-02-26 15:29:40 +000087print_version "valgrind" "--version" ""
88echo
89
90print_version "gdb" "--version" "" "head -n 1"
Andres AG31f9b5b2016-10-04 17:14:38 +010091echo
92
93: ${OPENSSL:=openssl}
Simon Butcher3104eec2020-02-26 15:29:40 +000094print_version "$OPENSSL" "version" "default"
Andres AG31f9b5b2016-10-04 17:14:38 +010095echo
Andres AG7a63eaf2016-09-05 12:24:47 +010096
97if [ -n "${OPENSSL_LEGACY+set}" ]; then
Simon Butcher3104eec2020-02-26 15:29:40 +000098 print_version "$OPENSSL_LEGACY" "version" "legacy"
99else
100 echo " * openssl (legacy): Not configured."
Janos Follathb72c6782016-07-19 14:54:17 +0100101fi
Simon Butcher3104eec2020-02-26 15:29:40 +0000102echo
Janos Follathb72c6782016-07-19 14:54:17 +0100103
Manuel Pégourié-Gonnard6b368922018-02-20 12:02:07 +0100104if [ -n "${OPENSSL_NEXT+set}" ]; then
Simon Butcher3104eec2020-02-26 15:29:40 +0000105 print_version "$OPENSSL_NEXT" "version" "next"
106else
107 echo " * openssl (next): Not configured."
Manuel Pégourié-Gonnard6b368922018-02-20 12:02:07 +0100108fi
Simon Butcher3104eec2020-02-26 15:29:40 +0000109echo
Manuel Pégourié-Gonnard6b368922018-02-20 12:02:07 +0100110
Andres AG31f9b5b2016-10-04 17:14:38 +0100111: ${GNUTLS_CLI:=gnutls-cli}
Simon Butcher3104eec2020-02-26 15:29:40 +0000112print_version "$GNUTLS_CLI" "--version" "default" "head -n 1"
Janos Follathb72c6782016-07-19 14:54:17 +0100113echo
Janos Follathb72c6782016-07-19 14:54:17 +0100114
Andres AG31f9b5b2016-10-04 17:14:38 +0100115: ${GNUTLS_SERV:=gnutls-serv}
Simon Butcher3104eec2020-02-26 15:29:40 +0000116print_version "$GNUTLS_SERV" "--version" "default" "head -n 1"
Janos Follathb72c6782016-07-19 14:54:17 +0100117echo
Andres AG7a63eaf2016-09-05 12:24:47 +0100118
119if [ -n "${GNUTLS_LEGACY_CLI+set}" ]; then
Simon Butcher3104eec2020-02-26 15:29:40 +0000120 print_version "$GNUTLS_LEGACY_CLI" "--version" "legacy" "head -n 1"
121else
122 echo " * gnutls-cli (legacy): Not configured."
Andres AG7a63eaf2016-09-05 12:24:47 +0100123fi
Simon Butcher3104eec2020-02-26 15:29:40 +0000124echo
Andres AG7a63eaf2016-09-05 12:24:47 +0100125
126if [ -n "${GNUTLS_LEGACY_SERV+set}" ]; then
Simon Butcher3104eec2020-02-26 15:29:40 +0000127 print_version "$GNUTLS_LEGACY_SERV" "--version" "legacy" "head -n 1"
128else
129 echo " * gnutls-serv (legacy): Not configured."
Janos Follathb72c6782016-07-19 14:54:17 +0100130fi
Simon Butcher3104eec2020-02-26 15:29:40 +0000131echo
Janos Follathb72c6782016-07-19 14:54:17 +0100132
Simon Butcher3104eec2020-02-26 15:29:40 +0000133echo " * Installed asan versions:"
134if `hash dpkg > /dev/null 2>&1` && `dpkg --get-selections|grep libasan > /dev/null` ; then
135 dpkg -s libasan5 2> /dev/null | grep -i version
136 dpkg -s libasan4 2> /dev/null | grep -i version
137 dpkg -s libasan3 2> /dev/null | grep -i version
Janos Follathb72c6782016-07-19 14:54:17 +0100138 dpkg -s libasan2 2> /dev/null | grep -i version
139 dpkg -s libasan1 2> /dev/null | grep -i version
140 dpkg -s libasan0 2> /dev/null | grep -i version
141else
Simon Butcher3104eec2020-02-26 15:29:40 +0000142 echo " Either dpkg not present or no asan versions installed."
Janos Follathb72c6782016-07-19 14:54:17 +0100143fi
Janos Follathb72c6782016-07-19 14:54:17 +0100144echo