do not build OpenSSL with threads, if they are not used
diff --git a/auto/lib/openssl/make b/auto/lib/openssl/make
index 31e15dc..7da0d8d 100644
--- a/auto/lib/openssl/make
+++ b/auto/lib/openssl/make
@@ -8,9 +8,10 @@
     NGX_OPENSSL_CONFIG="./config"
 fi
 
-if test -n "$USE_THREADS"; then
-    NGX_OPENSSL_CONFIG="$NGX_OPENSSL_CONFIG threads"
-fi
+case $USE_THREADS in
+    NO) NGX_OPENSSL_CONFIG="$NGX_OPENSSL_CONFIG no-threads" ;;
+    *)  NGX_OPENSSL_CONFIG="$NGX_OPENSSL_CONFIG threads" ;;
+esac
 
 case "$NGX_PLATFORM" in
     *)