blob: 1afaac33e4893940820e26ca4a0e9de5cd6f33bb [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
26 FAIL_MSG="$1"
27 shift
Andres AG7a63eaf2016-09-05 12:24:47 +010028
Andres AG31f9b5b2016-10-04 17:14:38 +010029 if ! `type "$BIN" > /dev/null 2>&1`; then
30 echo "* $FAIL_MSG"
31 return 0
Andres AG87bb5772016-09-27 15:05:15 +010032 fi
Andres AG87bb5772016-09-27 15:05:15 +010033
Andres AG31f9b5b2016-10-04 17:14:38 +010034 BIN=`which "$BIN"`
35 VERSION_STR=`$BIN $ARGS 2>&1`
Janos Follathb72c6782016-07-19 14:54:17 +010036
Andres AG31f9b5b2016-10-04 17:14:38 +010037 # Apply all filters
38 while [ $# -gt 0 ]; do
39 FILTER="$1"
40 shift
41 VERSION_STR=`echo "$VERSION_STR" | $FILTER`
42 done
43
44 echo "* ${BIN##*/}: $BIN: $VERSION_STR"
45}
46
47print_version "uname" "-a" ""
Janos Follathb72c6782016-07-19 14:54:17 +010048echo
Janos Follathb72c6782016-07-19 14:54:17 +010049
Andres AG31f9b5b2016-10-04 17:14:38 +010050: ${ARMC5_CC:=armcc}
51print_version "$ARMC5_CC" "--vsn" "armcc not found!" "head -n 2"
Janos Follathb72c6782016-07-19 14:54:17 +010052echo
Janos Follathb72c6782016-07-19 14:54:17 +010053
Andres AG31f9b5b2016-10-04 17:14:38 +010054: ${ARMC6_CC:=armclang}
55print_version "$ARMC6_CC" "--vsn" "armclang not found!" "head -n 2"
Janos Follathb72c6782016-07-19 14:54:17 +010056echo
Janos Follathb72c6782016-07-19 14:54:17 +010057
Andres AG31f9b5b2016-10-04 17:14:38 +010058print_version "arm-none-eabi-gcc" "--version" "gcc-arm not found!" "head -n 1"
Janos Follathb72c6782016-07-19 14:54:17 +010059echo
Janos Follathb72c6782016-07-19 14:54:17 +010060
Andres AG31f9b5b2016-10-04 17:14:38 +010061print_version "gcc" "--version" "gcc not found!" "head -n 1"
Janos Follathb72c6782016-07-19 14:54:17 +010062echo
Janos Follathb72c6782016-07-19 14:54:17 +010063
Andres AG31f9b5b2016-10-04 17:14:38 +010064print_version "clang" "--version" "clang not found" "head -n 2"
Janos Follathb72c6782016-07-19 14:54:17 +010065echo
Andres AG7a63eaf2016-09-05 12:24:47 +010066
Andres AG31f9b5b2016-10-04 17:14:38 +010067print_version "ldd" "--version" \
68 "No ldd present: can't determine libc version!" \
69 "head -n 1"
70echo
71
72print_version "valgrind" "--version" "valgrind not found!"
73echo
74
75: ${OPENSSL:=openssl}
76print_version "$OPENSSL" "version" "openssl not found!"
77echo
Andres AG7a63eaf2016-09-05 12:24:47 +010078
79if [ -n "${OPENSSL_LEGACY+set}" ]; then
Andres AG31f9b5b2016-10-04 17:14:38 +010080 print_version "$OPENSSL_LEGACY" "version" "openssl legacy version not found!"
Andres AG7a63eaf2016-09-05 12:24:47 +010081 echo
Janos Follathb72c6782016-07-19 14:54:17 +010082fi
83
Andres AG31f9b5b2016-10-04 17:14:38 +010084: ${GNUTLS_CLI:=gnutls-cli}
85print_version "$GNUTLS_CLI" "--version" "gnuTLS client not found!" "head -n 1"
Janos Follathb72c6782016-07-19 14:54:17 +010086echo
Janos Follathb72c6782016-07-19 14:54:17 +010087
Andres AG31f9b5b2016-10-04 17:14:38 +010088: ${GNUTLS_SERV:=gnutls-serv}
89print_version "$GNUTLS_SERV" "--version" "gnuTLS server not found!" "head -n 1"
Janos Follathb72c6782016-07-19 14:54:17 +010090echo
Andres AG7a63eaf2016-09-05 12:24:47 +010091
92if [ -n "${GNUTLS_LEGACY_CLI+set}" ]; then
Andres AG31f9b5b2016-10-04 17:14:38 +010093 print_version "$GNUTLS_LEGACY_CLI" "--version" \
94 "gnuTLS client legacy version not found!" \
95 "head -n 1"
Andres AG7a63eaf2016-09-05 12:24:47 +010096 echo
Andres AG7a63eaf2016-09-05 12:24:47 +010097fi
98
99if [ -n "${GNUTLS_LEGACY_SERV+set}" ]; then
Andres AG31f9b5b2016-10-04 17:14:38 +0100100 print_version "$GNUTLS_LEGACY_SERV" "--version" \
101 "gnuTLS server legacy version not found!" \
102 "head -n 1"
Andres AG7a63eaf2016-09-05 12:24:47 +0100103 echo
Janos Follathb72c6782016-07-19 14:54:17 +0100104fi
105
Andres AG7a63eaf2016-09-05 12:24:47 +0100106if `hash dpkg > /dev/null 2>&1`; then
Simon Butcher40122e02016-09-09 15:30:29 +0100107 echo "* asan:"
Janos Follathb72c6782016-07-19 14:54:17 +0100108 dpkg -s libasan2 2> /dev/null | grep -i version
109 dpkg -s libasan1 2> /dev/null | grep -i version
110 dpkg -s libasan0 2> /dev/null | grep -i version
111else
Simon Butcher40122e02016-09-09 15:30:29 +0100112 echo "* No dpkg present: can't determine asan version!"
Janos Follathb72c6782016-07-19 14:54:17 +0100113fi
Janos Follathb72c6782016-07-19 14:54:17 +0100114echo