Add script to print build environment info. (#539)

* Add script to print build environment info.

The new script is also included in:
- all.sh
- basic-build-test.sh

* Tidy up environment reporting script.

Changes include:
- making the echo calls portable
- removing unnecessary brackets
- using more efficient checks for the existance of commands
- correcting typos and copyright year

* Update references to output_env.sh
diff --git a/scripts/output_env.sh b/scripts/output_env.sh
new file mode 100755
index 0000000..0b7c153
--- /dev/null
+++ b/scripts/output_env.sh
@@ -0,0 +1,109 @@
+#!/bin/sh
+#
+# output_env.sh
+#
+# This file is part of mbed TLS (https://tls.mbed.org)
+#
+# Copyright (c) 2016, ARM Limited, All Rights Reserved
+#
+# Purpose
+#
+# To print out all the relevant information about the development environment.
+#
+# This includes:
+#   - architecture of the system
+#   - type and version of the operating system
+#   - version of armcc, gcc-arm and gcc compilers
+#   - version of libc, clang, asan and valgrind
+#   - version of gnuTLS and OpenSSL
+
+echo
+echo "1) Operating system and architecture:"
+uname -a
+
+echo
+if `hash armcc` > /dev/null; then
+    echo "2) armcc:"
+    armcc --vsn | head -n 2
+else
+    echo "2) armcc not found!"
+fi
+
+echo
+if `hash arm-none-eabi-gcc` > /dev/null; then
+    echo
+    echo "3) gcc-arm:"
+    arm-none-eabi-gcc --version | head -n 1
+else
+    echo
+    echo "3) gcc-arm not found!"
+fi
+
+echo
+if `hash gcc` > /dev/null; then
+    echo "4) gcc:"
+    gcc --version | head -n 1
+else
+    echo "4) gcc not found!"
+fi
+
+echo
+if `hash clang` > /dev/null; then
+    echo "5) clang:"
+    clang --version | head -n 2
+    clang -v 2>&1 | grep Selected
+else
+    echo "5) clang not found!"
+fi
+
+echo
+if `hash ldd` > /dev/null; then
+    echo "6) libc:"
+    ldd --version | head -n 1
+else
+    echo "6) No ldd present: can't determine libc version!"
+fi
+
+echo
+if `hash valgrind` > /dev/null; then
+    echo "7) valgrind:"
+    valgrind --version
+else
+    echo "7) valgrind not found!"
+fi
+
+echo
+if `hash openssl` > /dev/null; then
+    echo "8) openssl:"
+    openssl version
+else
+    echo "8) openssl not found!"
+fi
+
+echo
+if `hash gnutls-cli` > /dev/null; then
+    echo "9) gnuTLS client:"
+    gnutls-cli --version | head -n 1
+else
+    echo "9) gnuTLS client not found!"
+fi
+
+echo
+if `hash gnutls-serv` > /dev/null; then
+    echo "10) gnuTLS server:"
+    gnutls-serv --version | head -n 1
+else
+    echo "10) gnuTLS server not found!"
+fi
+
+echo
+if `hash dpkg` > /dev/null; then
+    echo "11) asan:"
+    dpkg -s libasan2 2> /dev/null | grep -i version
+    dpkg -s libasan1 2> /dev/null | grep -i version
+    dpkg -s libasan0 2> /dev/null | grep -i version
+else
+    echo "11) No dpkg present: can't determine asan version!"
+fi
+
+echo
diff --git a/tests/scripts/all.sh b/tests/scripts/all.sh
index a2b0995..5c18f4d 100755
--- a/tests/scripts/all.sh
+++ b/tests/scripts/all.sh
@@ -121,6 +121,9 @@
 #
 # Indicative running times are given for reference.
 
+msg "info: output_env.sh"
+scripts/output_env.sh
+
 msg "test: recursion.pl" # < 1s
 tests/scripts/recursion.pl library/*.c
 
diff --git a/tests/scripts/basic-build-test.sh b/tests/scripts/basic-build-test.sh
index 9fab396..9b8bd3c 100755
--- a/tests/scripts/basic-build-test.sh
+++ b/tests/scripts/basic-build-test.sh
@@ -39,6 +39,10 @@
 CONFIG_H='include/mbedtls/config.h'
 CONFIG_BAK="$CONFIG_H.bak"
 
+# Step 0 - print build environment info
+scripts/output_env.sh
+echo
+
 # Step 1 - Make and instrumented build for code coverage
 export CFLAGS=' --coverage -g3 -O0 '
 make clean