blob: 132963c04e63a38a4d62aaeb75115a73ba39a702 [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
Andres AG31f9b5b2016-10-04 17:14:38 +010019print_version()
20{
21 BIN="$1"
22 shift
23 ARGS="$1"
24 shift
25 FAIL_MSG="$1"
26 shift
Andres AG7a63eaf2016-09-05 12:24:47 +010027
Andres AG31f9b5b2016-10-04 17:14:38 +010028 if ! `type "$BIN" > /dev/null 2>&1`; then
29 echo "* $FAIL_MSG"
30 return 0
Andres AG87bb5772016-09-27 15:05:15 +010031 fi
Andres AG87bb5772016-09-27 15:05:15 +010032
Andres AG31f9b5b2016-10-04 17:14:38 +010033 BIN=`which "$BIN"`
34 VERSION_STR=`$BIN $ARGS 2>&1`
Janos Follathb72c6782016-07-19 14:54:17 +010035
Andres AG31f9b5b2016-10-04 17:14:38 +010036 # Apply all filters
37 while [ $# -gt 0 ]; do
38 FILTER="$1"
39 shift
40 VERSION_STR=`echo "$VERSION_STR" | $FILTER`
41 done
42
43 echo "* ${BIN##*/}: $BIN: $VERSION_STR"
44}
45
46print_version "uname" "-a" ""
Janos Follathb72c6782016-07-19 14:54:17 +010047echo
Janos Follathb72c6782016-07-19 14:54:17 +010048
Gilles Peskine26232962018-03-21 08:35:07 +010049if [ "${RUN_ARMCC:-1}" -ne 0 ]; then
50 : "${ARMC5_CC:=armcc}"
51 print_version "$ARMC5_CC" "--vsn" "armcc not found!" "head -n 2"
52 echo
Janos Follathb72c6782016-07-19 14:54:17 +010053
Gilles Peskine26232962018-03-21 08:35:07 +010054 : "${ARMC6_CC:=armclang}"
55 print_version "$ARMC6_CC" "--vsn" "armclang not found!" "head -n 2"
56 echo
57fi
Janos Follathb72c6782016-07-19 14:54:17 +010058
Andres AG31f9b5b2016-10-04 17:14:38 +010059print_version "arm-none-eabi-gcc" "--version" "gcc-arm not found!" "head -n 1"
Janos Follathb72c6782016-07-19 14:54:17 +010060echo
Janos Follathb72c6782016-07-19 14:54:17 +010061
Andres AG31f9b5b2016-10-04 17:14:38 +010062print_version "gcc" "--version" "gcc not found!" "head -n 1"
Janos Follathb72c6782016-07-19 14:54:17 +010063echo
Janos Follathb72c6782016-07-19 14:54:17 +010064
Andres AG31f9b5b2016-10-04 17:14:38 +010065print_version "clang" "--version" "clang not found" "head -n 2"
Janos Follathb72c6782016-07-19 14:54:17 +010066echo
Andres AG7a63eaf2016-09-05 12:24:47 +010067
Andres AG31f9b5b2016-10-04 17:14:38 +010068print_version "ldd" "--version" \
69 "No ldd present: can't determine libc version!" \
70 "head -n 1"
71echo
72
73print_version "valgrind" "--version" "valgrind not found!"
74echo
75
Andres AG7a63eaf2016-09-05 12:24:47 +010076if `hash dpkg > /dev/null 2>&1`; then
Simon Butcher40122e02016-09-09 15:30:29 +010077 echo "* asan:"
Janos Follathb72c6782016-07-19 14:54:17 +010078 dpkg -s libasan2 2> /dev/null | grep -i version
79 dpkg -s libasan1 2> /dev/null | grep -i version
80 dpkg -s libasan0 2> /dev/null | grep -i version
81else
Simon Butcher40122e02016-09-09 15:30:29 +010082 echo "* No dpkg present: can't determine asan version!"
Janos Follathb72c6782016-07-19 14:54:17 +010083fi
Janos Follathb72c6782016-07-19 14:54:17 +010084echo