Enable SSLv2 testing if OPENSSL_CMD is set
diff --git a/tests/compat.sh b/tests/compat.sh
index e29d29f..8a4a9bf 100755
--- a/tests/compat.sh
+++ b/tests/compat.sh
@@ -5,16 +5,15 @@
 # Check each common ciphersuite, with each version, both ways (client/server),
 # with and without client authentication.
 
+set -u
+
 # test if those two are set in the environment before assigning defaults
-if [ -n "$GNUTLS_CLI" -a -n "$GNUTLS_SERV" ]; then
+if [ -n "${GNUTLS_CLI:-}" -a -n "${GNUTLS_SERV:-}" ]; then
     GNUTLS_AVAILABLE=1
 else
     GNUTLS_AVAILABLE=0
 fi
 
-# catch undefined variables from now on
-set -u
-
 # initialise counters
 let "tests = 0"
 let "failed = 0"
diff --git a/tests/ssl-opt.sh b/tests/ssl-opt.sh
index 60efe8d..2a297bd 100755
--- a/tests/ssl-opt.sh
+++ b/tests/ssl-opt.sh
@@ -10,6 +10,14 @@
 
 set -u
 
+# test if it is defined from the environment before assining default
+# if yes, assume it means it's a build with all the options we need (SSLv2)
+if [ -n "${OPENSSL_CMD:-}" ]; then
+    OPENSSL_OK=1
+else
+    OPENSSL_OK=0
+fi
+
 # default values, can be overriden by the environment
 : ${P_SRV:=../programs/ssl/ssl_server2}
 : ${P_CLI:=../programs/ssl/ssl_client2}
@@ -23,7 +31,11 @@
 
 MEMCHECK=0
 FILTER='.*'
-EXCLUDE='SSLv2' # disabled by default, needs OpenSSL compiled with SSLv2
+if [ "$OPENSSL_OK" -gt 0 ]; then
+    EXCLUDE='^$'
+else
+    EXCLUDE='SSLv2'
+fi
 
 print_usage() {
     echo "Usage: $0 [options]"
@@ -245,6 +257,8 @@
 # MAIN
 #
 
+get_options "$@"
+
 # sanity checks, avoid an avalanche of errors
 if [ ! -x "$P_SRV" ]; then
     echo "Command '$P_SRV' is not an executable file"
@@ -259,8 +273,6 @@
     exit 1
 fi
 
-get_options "$@"
-
 killall -q openssl ssl_server ssl_server2
 trap cleanup INT TERM HUP