1#!/bin/sh
2#
3# 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
16#   - version of armcc, clang, gcc-arm and gcc compilers
17#   - version of libc, clang, asan and valgrind if installed
18#   - version of gnuTLS and OpenSSL
19
20echo
21echo "* Operating system and architecture:"
22uname -a
23
24echo
25if `hash armcc > /dev/null 2>&1`; then
26    echo "* armcc:"
27    armcc --vsn | head -n 2
28else
29    echo "* armcc not found!"
30fi
31
32echo
33if `hash arm-none-eabi-gcc > /dev/null 2>&1`; then
34    echo "* gcc-arm:"
35    arm-none-eabi-gcc --version | head -n 1
36else
37    echo "* gcc-arm not found!"
38fi
39
40echo
41if `hash gcc > /dev/null 2>&1`; then
42    echo "* gcc:"
43    gcc --version | head -n 1
44else
45    echo "* gcc not found!"
46fi
47
48echo
49if `hash clang > /dev/null 2>&1`; then
50    echo "* clang:"
51    clang --version | head -n 2
52    clang -v 2>&1 | grep Selected
53else
54    echo "* clang not found!"
55fi
56
57echo
58if `hash ldd > /dev/null 2>&1`; then
59    echo "* libc:"
60    ldd --version | head -n 1
61else
62    echo "* No ldd present: can't determine libc version!"
63fi
64
65echo
66if `hash valgrind > /dev/null 2>&1`; then
67    echo "* valgrind:"
68    valgrind --version
69else
70    echo "* valgrind not found!"
71fi
72
73echo
74if `hash openssl > /dev/null 2>&1`; then
75    echo "* openssl:"
76    openssl version
77else
78    echo "* openssl not found!"
79fi
80
81if [ -n "${OPENSSL+set}" ]; then
82    echo
83    if `hash "$OPENSSL" > /dev/null 2>&1`; then
84        echo "* $OPENSSL at environment variable 'OPENSSL':"
85        $OPENSSL version
86    else
87        echo "* $OPENSSL at environment variable 'OPENSSL' not found!"
88    fi
89fi
90
91if [ -n "${OPENSSL_LEGACY+set}" ]; then
92    echo
93    if `hash "$OPENSSL_LEGACY" > /dev/null 2>&1`; then
94        echo "* $OPENSSL_LEGACY at environment variable 'OPENSSL_LEGACY':"
95        $OPENSSL_LEGACY version
96    else
97        echo "* $OPENSSL_LEGACY at environment variable 'OPENSSL_LEGACY' not found!"
98    fi
99fi
100
101echo
102if `hash gnutls-cli > /dev/null 2>&1`; then
103    echo "* gnuTLS client:"
104    gnutls-cli --version | head -n 1
105else
106    echo "* gnuTLS client not found!"
107fi
108
109echo
110if `hash gnutls-serv > /dev/null 2>&1`; then
111    echo "* gnuTLS server:"
112    gnutls-serv --version | head -n 1
113else
114    echo "* gnuTLS server not found!"
115fi
116
117if [ -n "${GNUTLS_CLI+set}" ]; then
118    echo
119    if `hash "$GNUTLS_CLI" > /dev/null 2>&1`; then
120        echo "* $GNUTLS_CLI at environment variable 'GNUTLS_CLI':"
121        $GNUTLS_CLI --version | head -n 1
122    else
123        echo "* $GNUTLS_CLI at environment variable 'GNUTLS_CLI' not found!"
124    fi
125fi
126
127if [ -n "${GNUTLS_SERV+set}" ]; then
128    echo
129    if `hash "$GNUTLS_SERV" > /dev/null 2>&1`; then
130        echo "* $GNUTLS_SERV at environment variable 'GNUTLS_SERV':"
131        $GNUTLS_SERV --version | head -n 1
132    else
133        echo "* $GNUTLS_SERV at environment variable 'GNUTLS_SERV' not found!"
134    fi
135fi
136
137if [ -n "${GNUTLS_LEGACY_CLI+set}" ]; then
138    echo
139    if `hash "$GNUTLS_LEGACY_CLI" > /dev/null 2>&1`; then
140        echo "* $GNUTLS_LEGACY_CLI at environment variable 'GNUTLS_LEGACY_CLI':"
141        $GNUTLS_LEGACY_CLI --version | head -n 1
142    else
143        echo "* $GNUTLS_LEGACY_CLI at environment variable 'GNUTLS_LEGACY_CLI' not found!"
144    fi
145fi
146
147if [ -n "${GNUTLS_LEGACY_SERV+set}" ]; then
148    echo
149    if `hash "$GNUTLS_LEGACY_SERV" > /dev/null 2>&1`; then
150        echo "* $GNUTLS_LEGACY_SERV at environment variable 'GNUTLS_LEGACY_SERV':"
151        $GNUTLS_LEGACY_SERV --version | head -n 1
152    else
153        echo "* $GNUTLS_LEGACY_SERV at environment variable 'GNUTLS_LEGACY_SERV' not found!"
154    fi
155fi
156
157echo
158if `hash dpkg > /dev/null 2>&1`; then
159    echo "* asan:"
160    dpkg -s libasan2 2> /dev/null | grep -i version
161    dpkg -s libasan1 2> /dev/null | grep -i version
162    dpkg -s libasan0 2> /dev/null | grep -i version
163else
164    echo "* No dpkg present: can't determine asan version!"
165fi
166
167echo
168
169