blob: 22bef92b99ee8e9c28f9bbebf1ea46c09cd9742d [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 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 Butcher3104eec2020-02-26 15:29:40 +000048 echo " * ${BIN##*/}$VARIANT: ${BIN} : ${VERSION_STR} "
Andres AG31f9b5b2016-10-04 17:14:38 +010049}
50
Simon Butcher679d2de2020-02-27 12:58:27 +000051echo "** Platform:"
52echo
53
54if [ `uname -s` = "Linux" ]; then
Simon Butcher3104eec2020-02-26 15:29:40 +000055 echo "Linux variant"
56 lsb_release -d -c
57else
58 echo "Unknown Unix variant"
59fi
60
Janos Follathb72c6782016-07-19 14:54:17 +010061echo
Janos Follathb72c6782016-07-19 14:54:17 +010062
Simon Butcher3104eec2020-02-26 15:29:40 +000063print_version "uname" "-a" ""
Simon Butcher679d2de2020-02-27 12:58:27 +000064echo
65echo
66echo "** Tool Versions:"
67echo
Simon Butcher3104eec2020-02-26 15:29:40 +000068
Gilles Peskine26232962018-03-21 08:35:07 +010069if [ "${RUN_ARMCC:-1}" -ne 0 ]; then
70 : "${ARMC5_CC:=armcc}"
Simon Butcher3104eec2020-02-26 15:29:40 +000071 print_version "$ARMC5_CC" "--vsn" "" "head -n 2"
Gilles Peskine26232962018-03-21 08:35:07 +010072 echo
Janos Follathb72c6782016-07-19 14:54:17 +010073
Gilles Peskine26232962018-03-21 08:35:07 +010074 : "${ARMC6_CC:=armclang}"
Simon Butcher3104eec2020-02-26 15:29:40 +000075 print_version "$ARMC6_CC" "--vsn" "" "head -n 2"
Gilles Peskine26232962018-03-21 08:35:07 +010076 echo
77fi
Janos Follathb72c6782016-07-19 14:54:17 +010078
Simon Butcher3104eec2020-02-26 15:29:40 +000079print_version "arm-none-eabi-gcc" "--version" "" "head -n 1"
Janos Follathb72c6782016-07-19 14:54:17 +010080echo
Janos Follathb72c6782016-07-19 14:54:17 +010081
Simon Butcher3104eec2020-02-26 15:29:40 +000082print_version "gcc" "--version" "" "head -n 1"
Janos Follathb72c6782016-07-19 14:54:17 +010083echo
Janos Follathb72c6782016-07-19 14:54:17 +010084
Simon Butcher3104eec2020-02-26 15:29:40 +000085print_version "clang" "--version" "" "head -n 2"
Janos Follathb72c6782016-07-19 14:54:17 +010086echo
Andres AG7a63eaf2016-09-05 12:24:47 +010087
Simon Butcher3104eec2020-02-26 15:29:40 +000088print_version "ldd" "--version" "" "head -n 1"
Andres AG31f9b5b2016-10-04 17:14:38 +010089echo
90
Simon Butcher3104eec2020-02-26 15:29:40 +000091print_version "valgrind" "--version" ""
92echo
93
94print_version "gdb" "--version" "" "head -n 1"
Andres AG31f9b5b2016-10-04 17:14:38 +010095echo
96
97: ${OPENSSL:=openssl}
Simon Butcher3104eec2020-02-26 15:29:40 +000098print_version "$OPENSSL" "version" "default"
Andres AG31f9b5b2016-10-04 17:14:38 +010099echo
Andres AG7a63eaf2016-09-05 12:24:47 +0100100
101if [ -n "${OPENSSL_LEGACY+set}" ]; then
Simon Butcher3104eec2020-02-26 15:29:40 +0000102 print_version "$OPENSSL_LEGACY" "version" "legacy"
103else
104 echo " * openssl (legacy): Not configured."
Janos Follathb72c6782016-07-19 14:54:17 +0100105fi
Simon Butcher3104eec2020-02-26 15:29:40 +0000106echo
Janos Follathb72c6782016-07-19 14:54:17 +0100107
Manuel Pégourié-Gonnard6b368922018-02-20 12:02:07 +0100108if [ -n "${OPENSSL_NEXT+set}" ]; then
Simon Butcher3104eec2020-02-26 15:29:40 +0000109 print_version "$OPENSSL_NEXT" "version" "next"
110else
111 echo " * openssl (next): Not configured."
Manuel Pégourié-Gonnard6b368922018-02-20 12:02:07 +0100112fi
Simon Butcher3104eec2020-02-26 15:29:40 +0000113echo
Manuel Pégourié-Gonnard6b368922018-02-20 12:02:07 +0100114
Andres AG31f9b5b2016-10-04 17:14:38 +0100115: ${GNUTLS_CLI:=gnutls-cli}
Simon Butcher3104eec2020-02-26 15:29:40 +0000116print_version "$GNUTLS_CLI" "--version" "default" "head -n 1"
Janos Follathb72c6782016-07-19 14:54:17 +0100117echo
Janos Follathb72c6782016-07-19 14:54:17 +0100118
Andres AG31f9b5b2016-10-04 17:14:38 +0100119: ${GNUTLS_SERV:=gnutls-serv}
Simon Butcher3104eec2020-02-26 15:29:40 +0000120print_version "$GNUTLS_SERV" "--version" "default" "head -n 1"
Janos Follathb72c6782016-07-19 14:54:17 +0100121echo
Andres AG7a63eaf2016-09-05 12:24:47 +0100122
123if [ -n "${GNUTLS_LEGACY_CLI+set}" ]; then
Simon Butcher3104eec2020-02-26 15:29:40 +0000124 print_version "$GNUTLS_LEGACY_CLI" "--version" "legacy" "head -n 1"
125else
126 echo " * gnutls-cli (legacy): Not configured."
Andres AG7a63eaf2016-09-05 12:24:47 +0100127fi
Simon Butcher3104eec2020-02-26 15:29:40 +0000128echo
Andres AG7a63eaf2016-09-05 12:24:47 +0100129
130if [ -n "${GNUTLS_LEGACY_SERV+set}" ]; then
Simon Butcher3104eec2020-02-26 15:29:40 +0000131 print_version "$GNUTLS_LEGACY_SERV" "--version" "legacy" "head -n 1"
132else
133 echo " * gnutls-serv (legacy): Not configured."
Janos Follathb72c6782016-07-19 14:54:17 +0100134fi
Simon Butcher3104eec2020-02-26 15:29:40 +0000135echo
Janos Follathb72c6782016-07-19 14:54:17 +0100136
Simon Butcher3104eec2020-02-26 15:29:40 +0000137echo " * Installed asan versions:"
Simon Butcher679d2de2020-02-27 12:58:27 +0000138if type dpkg-query >/dev/null 2>/dev/null; then
139 if ! dpkg-query -f '${Status} ${Package}: ${Version}\n' -W 'libasan*' |
140 awk '$3 == "installed" && $4 !~ /-/ {print $4, $5}' |
141 grep .
142 then
143 echo " No asan versions installed."
144 fi
Janos Follathb72c6782016-07-19 14:54:17 +0100145else
Simon Butcher679d2de2020-02-27 12:58:27 +0000146 echo " Unable to determine the asan version without dpkg."
Janos Follathb72c6782016-07-19 14:54:17 +0100147fi
Janos Follathb72c6782016-07-19 14:54:17 +0100148echo