blob: d46349afd3239e5972c530a22fe35fc0e6238043 [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#
Janos Follathb72c6782016-07-19 14:54:17 +01005# Copyright (c) 2016, ARM Limited, All Rights Reserved
Bence Szépkúti4e9f7122020-06-05 13:02:18 +02006# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
7#
8# This file is provided under the Apache License 2.0, or the
9# GNU General Public License v2.0 or later.
10#
11# **********
12# Apache License 2.0:
Bence Szépkúti09b4f192020-05-26 01:54:15 +020013#
14# Licensed under the Apache License, Version 2.0 (the "License"); you may
15# not use this file except in compliance with the License.
16# You may obtain a copy of the License at
17#
18# http://www.apache.org/licenses/LICENSE-2.0
19#
20# Unless required by applicable law or agreed to in writing, software
21# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
22# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23# See the License for the specific language governing permissions and
24# limitations under the License.
25#
Bence Szépkúti4e9f7122020-06-05 13:02:18 +020026# **********
27#
28# **********
29# GNU General Public License v2.0 or later:
30#
31# This program is free software; you can redistribute it and/or modify
32# it under the terms of the GNU General Public License as published by
33# the Free Software Foundation; either version 2 of the License, or
34# (at your option) any later version.
35#
36# This program is distributed in the hope that it will be useful,
37# but WITHOUT ANY WARRANTY; without even the implied warranty of
38# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
39# GNU General Public License for more details.
40#
41# You should have received a copy of the GNU General Public License along
42# with this program; if not, write to the Free Software Foundation, Inc.,
43# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
44#
45# **********
46#
Bence Szépkúti09b4f192020-05-26 01:54:15 +020047# This file is part of Mbed TLS (https://tls.mbed.org)
Janos Follathb72c6782016-07-19 14:54:17 +010048#
49# Purpose
50#
51# To print out all the relevant information about the development environment.
52#
53# This includes:
54# - architecture of the system
55# - type and version of the operating system
Ronald Crona960dc92020-05-25 13:11:32 +020056# - version of make and cmake
Simon Butcher3ac07672016-09-04 14:28:44 +030057# - version of armcc, clang, gcc-arm and gcc compilers
58# - version of libc, clang, asan and valgrind if installed
Janos Follathb72c6782016-07-19 14:54:17 +010059# - version of gnuTLS and OpenSSL
60
Andres AG31f9b5b2016-10-04 17:14:38 +010061print_version()
62{
63 BIN="$1"
64 shift
65 ARGS="$1"
66 shift
Simon Butcher82770412020-03-05 15:18:53 +000067 VARIANT="$1"
Andres AG31f9b5b2016-10-04 17:14:38 +010068 shift
Andres AG7a63eaf2016-09-05 12:24:47 +010069
Simon Butcherd40e6032020-02-27 12:58:27 +000070 if [ -n "$VARIANT" ]; then
Simon Butcher870ee822020-02-26 15:29:40 +000071 VARIANT=" ($VARIANT)"
72 fi
73
Simon Butcherd40e6032020-02-27 12:58:27 +000074 if ! type "$BIN" > /dev/null 2>&1; then
Simon Butcher870ee822020-02-26 15:29:40 +000075 echo " * ${BIN##*/}$VARIANT: Not found."
Andres AG31f9b5b2016-10-04 17:14:38 +010076 return 0
Andres AG87bb5772016-09-27 15:05:15 +010077 fi
Andres AG87bb5772016-09-27 15:05:15 +010078
Andres AG31f9b5b2016-10-04 17:14:38 +010079 BIN=`which "$BIN"`
80 VERSION_STR=`$BIN $ARGS 2>&1`
Janos Follathb72c6782016-07-19 14:54:17 +010081
Andres AG31f9b5b2016-10-04 17:14:38 +010082 # Apply all filters
83 while [ $# -gt 0 ]; do
84 FILTER="$1"
85 shift
86 VERSION_STR=`echo "$VERSION_STR" | $FILTER`
87 done
88
Simon Butcher82770412020-03-05 15:18:53 +000089 if [ -z "$VERSION_STR" ]; then
90 VERSION_STR="Version could not be determined."
91 fi
92
Simon Butcher870ee822020-02-26 15:29:40 +000093 echo " * ${BIN##*/}$VARIANT: ${BIN} : ${VERSION_STR} "
Andres AG31f9b5b2016-10-04 17:14:38 +010094}
95
Simon Butcherd40e6032020-02-27 12:58:27 +000096echo "** Platform:"
97echo
98
99if [ `uname -s` = "Linux" ]; then
Simon Butcher870ee822020-02-26 15:29:40 +0000100 echo "Linux variant"
101 lsb_release -d -c
102else
103 echo "Unknown Unix variant"
104fi
105
Janos Follathb72c6782016-07-19 14:54:17 +0100106echo
Janos Follathb72c6782016-07-19 14:54:17 +0100107
Simon Butcher870ee822020-02-26 15:29:40 +0000108print_version "uname" "-a" ""
Simon Butcher82770412020-03-05 15:18:53 +0000109
Simon Butcherd40e6032020-02-27 12:58:27 +0000110echo
111echo
112echo "** Tool Versions:"
113echo
Simon Butcher870ee822020-02-26 15:29:40 +0000114
Ronald Crona960dc92020-05-25 13:11:32 +0200115print_version "make" "--version" "" "head -n 1"
116echo
117
118print_version "cmake" "--version" "" "head -n 1"
119echo
120
Gilles Peskine53038eb2018-03-21 08:35:07 +0100121if [ "${RUN_ARMCC:-1}" -ne 0 ]; then
122 : "${ARMC5_CC:=armcc}"
Simon Butcher870ee822020-02-26 15:29:40 +0000123 print_version "$ARMC5_CC" "--vsn" "" "head -n 2"
Gilles Peskine53038eb2018-03-21 08:35:07 +0100124 echo
Janos Follathb72c6782016-07-19 14:54:17 +0100125
Gilles Peskine53038eb2018-03-21 08:35:07 +0100126 : "${ARMC6_CC:=armclang}"
Simon Butcher870ee822020-02-26 15:29:40 +0000127 print_version "$ARMC6_CC" "--vsn" "" "head -n 2"
Gilles Peskine53038eb2018-03-21 08:35:07 +0100128 echo
129fi
Janos Follathb72c6782016-07-19 14:54:17 +0100130
Simon Butcher870ee822020-02-26 15:29:40 +0000131print_version "arm-none-eabi-gcc" "--version" "" "head -n 1"
Janos Follathb72c6782016-07-19 14:54:17 +0100132echo
Janos Follathb72c6782016-07-19 14:54:17 +0100133
Simon Butcher870ee822020-02-26 15:29:40 +0000134print_version "gcc" "--version" "" "head -n 1"
Janos Follathb72c6782016-07-19 14:54:17 +0100135echo
Janos Follathb72c6782016-07-19 14:54:17 +0100136
Simon Butcher870ee822020-02-26 15:29:40 +0000137print_version "clang" "--version" "" "head -n 2"
Janos Follathb72c6782016-07-19 14:54:17 +0100138echo
Andres AG7a63eaf2016-09-05 12:24:47 +0100139
Simon Butcher870ee822020-02-26 15:29:40 +0000140print_version "ldd" "--version" "" "head -n 1"
Andres AG31f9b5b2016-10-04 17:14:38 +0100141echo
142
Simon Butcher870ee822020-02-26 15:29:40 +0000143print_version "valgrind" "--version" ""
144echo
145
146print_version "gdb" "--version" "" "head -n 1"
Andres AG31f9b5b2016-10-04 17:14:38 +0100147echo
148
Simon Butcher82770412020-03-05 15:18:53 +0000149print_version "perl" "--version" "" "head -n 2" "grep ."
150echo
151
152print_version "python" "--version" "" "head -n 1"
153echo
154
Ronald Cron6872e172020-05-25 13:55:21 +0200155print_version "python3" "--version" "" "head -n 1"
156echo
157
Simon Butcher8eb64e62020-03-06 14:50:49 +0000158print_version "pylint3" "--version" "" "sed /^.*config/d" "grep pylint"
Simon Butcher82770412020-03-05 15:18:53 +0000159echo
160
Andres AG31f9b5b2016-10-04 17:14:38 +0100161: ${OPENSSL:=openssl}
Simon Butcher870ee822020-02-26 15:29:40 +0000162print_version "$OPENSSL" "version" "default"
Andres AG31f9b5b2016-10-04 17:14:38 +0100163echo
Andres AG7a63eaf2016-09-05 12:24:47 +0100164
165if [ -n "${OPENSSL_LEGACY+set}" ]; then
Simon Butcher870ee822020-02-26 15:29:40 +0000166 print_version "$OPENSSL_LEGACY" "version" "legacy"
167else
168 echo " * openssl (legacy): Not configured."
Janos Follathb72c6782016-07-19 14:54:17 +0100169fi
Simon Butcher870ee822020-02-26 15:29:40 +0000170echo
Janos Follathb72c6782016-07-19 14:54:17 +0100171
Andres AG31f9b5b2016-10-04 17:14:38 +0100172: ${GNUTLS_CLI:=gnutls-cli}
Simon Butcher870ee822020-02-26 15:29:40 +0000173print_version "$GNUTLS_CLI" "--version" "default" "head -n 1"
Janos Follathb72c6782016-07-19 14:54:17 +0100174echo
Janos Follathb72c6782016-07-19 14:54:17 +0100175
Andres AG31f9b5b2016-10-04 17:14:38 +0100176: ${GNUTLS_SERV:=gnutls-serv}
Simon Butcher870ee822020-02-26 15:29:40 +0000177print_version "$GNUTLS_SERV" "--version" "default" "head -n 1"
Janos Follathb72c6782016-07-19 14:54:17 +0100178echo
Andres AG7a63eaf2016-09-05 12:24:47 +0100179
180if [ -n "${GNUTLS_LEGACY_CLI+set}" ]; then
Simon Butcher870ee822020-02-26 15:29:40 +0000181 print_version "$GNUTLS_LEGACY_CLI" "--version" "legacy" "head -n 1"
182else
183 echo " * gnutls-cli (legacy): Not configured."
Andres AG7a63eaf2016-09-05 12:24:47 +0100184fi
Simon Butcher870ee822020-02-26 15:29:40 +0000185echo
Andres AG7a63eaf2016-09-05 12:24:47 +0100186
187if [ -n "${GNUTLS_LEGACY_SERV+set}" ]; then
Simon Butcher870ee822020-02-26 15:29:40 +0000188 print_version "$GNUTLS_LEGACY_SERV" "--version" "legacy" "head -n 1"
189else
190 echo " * gnutls-serv (legacy): Not configured."
Janos Follathb72c6782016-07-19 14:54:17 +0100191fi
Simon Butcher870ee822020-02-26 15:29:40 +0000192echo
Janos Follathb72c6782016-07-19 14:54:17 +0100193
Simon Butcher870ee822020-02-26 15:29:40 +0000194echo " * Installed asan versions:"
Simon Butcherd40e6032020-02-27 12:58:27 +0000195if type dpkg-query >/dev/null 2>/dev/null; then
196 if ! dpkg-query -f '${Status} ${Package}: ${Version}\n' -W 'libasan*' |
197 awk '$3 == "installed" && $4 !~ /-/ {print $4, $5}' |
198 grep .
199 then
200 echo " No asan versions installed."
201 fi
Janos Follathb72c6782016-07-19 14:54:17 +0100202else
Simon Butcherd40e6032020-02-27 12:58:27 +0000203 echo " Unable to determine the asan version without dpkg."
Janos Follathb72c6782016-07-19 14:54:17 +0100204fi
Janos Follathb72c6782016-07-19 14:54:17 +0100205echo