blob: 19b7c061f9565eb601ce22462bbb709ea4265c11 [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
Manuel Pégourié-Gonnard6b368922018-02-20 12:02:07 +010084if [ -n "${OPENSSL_NEXT+set}" ]; then
85 print_version "$OPENSSL_NEXT" "version" "openssl next version not found!"
86 echo
87fi
88
Andres AG31f9b5b2016-10-04 17:14:38 +010089: ${GNUTLS_CLI:=gnutls-cli}
90print_version "$GNUTLS_CLI" "--version" "gnuTLS client not found!" "head -n 1"
Janos Follathb72c6782016-07-19 14:54:17 +010091echo
Janos Follathb72c6782016-07-19 14:54:17 +010092
Andres AG31f9b5b2016-10-04 17:14:38 +010093: ${GNUTLS_SERV:=gnutls-serv}
94print_version "$GNUTLS_SERV" "--version" "gnuTLS server not found!" "head -n 1"
Janos Follathb72c6782016-07-19 14:54:17 +010095echo
Andres AG7a63eaf2016-09-05 12:24:47 +010096
97if [ -n "${GNUTLS_LEGACY_CLI+set}" ]; then
Andres AG31f9b5b2016-10-04 17:14:38 +010098 print_version "$GNUTLS_LEGACY_CLI" "--version" \
99 "gnuTLS client legacy version not found!" \
100 "head -n 1"
Andres AG7a63eaf2016-09-05 12:24:47 +0100101 echo
Andres AG7a63eaf2016-09-05 12:24:47 +0100102fi
103
104if [ -n "${GNUTLS_LEGACY_SERV+set}" ]; then
Andres AG31f9b5b2016-10-04 17:14:38 +0100105 print_version "$GNUTLS_LEGACY_SERV" "--version" \
106 "gnuTLS server legacy version not found!" \
107 "head -n 1"
Andres AG7a63eaf2016-09-05 12:24:47 +0100108 echo
Janos Follathb72c6782016-07-19 14:54:17 +0100109fi
110
Andres AG7a63eaf2016-09-05 12:24:47 +0100111if `hash dpkg > /dev/null 2>&1`; then
Simon Butcher40122e02016-09-09 15:30:29 +0100112 echo "* asan:"
Janos Follathb72c6782016-07-19 14:54:17 +0100113 dpkg -s libasan2 2> /dev/null | grep -i version
114 dpkg -s libasan1 2> /dev/null | grep -i version
115 dpkg -s libasan0 2> /dev/null | grep -i version
116else
Simon Butcher40122e02016-09-09 15:30:29 +0100117 echo "* No dpkg present: can't determine asan version!"
Janos Follathb72c6782016-07-19 14:54:17 +0100118fi
Janos Follathb72c6782016-07-19 14:54:17 +0100119echo