changeset 9316:b40149d062cb

Win32: checking for system PCRE, zlib, and OpenSSL libs. Checking for system libs on Windows is beneficial when compiling in MSYS2 environments with GCC or Clang, as most libraries are readily available.
author Maxim Dounin <mdounin@mdounin.ru>
date Wed, 07 Aug 2024 03:58:50 +0300
parents d286426eab1a
children 314be1eba450
files auto/lib/openssl/conf auto/lib/pcre/conf auto/lib/zlib/conf
diffstat 3 files changed, 91 insertions(+), 98 deletions(-) [+]
line wrap: on
line diff
--- a/auto/lib/openssl/conf
+++ b/auto/lib/openssl/conf
@@ -55,96 +55,94 @@ if [ $OPENSSL != NONE ]; then
 
 else
 
-    if [ "$NGX_PLATFORM" != win32 ]; then
-
-        OPENSSL=NO
+    OPENSSL=NO
 
-        ngx_feature="OpenSSL library"
-        ngx_feature_name="NGX_OPENSSL"
-        ngx_feature_run=no
-        ngx_feature_incs="#include <openssl/ssl.h>"
-        ngx_feature_path=
-        ngx_feature_libs="-lssl -lcrypto $NGX_LIBDL $NGX_LIBPTHREAD"
-        ngx_feature_test="SSL_CTX_set_options(NULL, 0)"
-        . auto/feature
+    ngx_feature="OpenSSL library"
+    ngx_feature_name="NGX_OPENSSL"
+    ngx_feature_run=no
+    ngx_feature_incs="#include <openssl/ssl.h>"
+    ngx_feature_path=
+    ngx_feature_libs="-lssl -lcrypto $NGX_LIBDL $NGX_LIBPTHREAD"
+    ngx_feature_test="SSL_CTX_set_options(NULL, 0)"
+    . auto/feature
 
-        if [ $ngx_found = no ]; then
+    if [ $ngx_found = no ]; then
+
+        # FreeBSD port
+
+        ngx_feature="OpenSSL library in /usr/local/"
+        ngx_feature_path="/usr/local/include"
 
-            # FreeBSD port
+        if [ $NGX_RPATH = YES ]; then
+            ngx_feature_libs="-R/usr/local/lib -L/usr/local/lib -lssl -lcrypto"
+        else
+            ngx_feature_libs="-L/usr/local/lib -lssl -lcrypto"
+        fi
 
-            ngx_feature="OpenSSL library in /usr/local/"
-            ngx_feature_path="/usr/local/include"
+        ngx_feature_libs="$ngx_feature_libs $NGX_LIBDL $NGX_LIBPTHREAD"
+
+        . auto/feature
+    fi
 
-            if [ $NGX_RPATH = YES ]; then
-                ngx_feature_libs="-R/usr/local/lib -L/usr/local/lib -lssl -lcrypto"
-            else
-                ngx_feature_libs="-L/usr/local/lib -lssl -lcrypto"
-            fi
+    if [ $ngx_found = no ]; then
+
+        # NetBSD port
 
-            ngx_feature_libs="$ngx_feature_libs $NGX_LIBDL $NGX_LIBPTHREAD"
+        ngx_feature="OpenSSL library in /usr/pkg/"
+        ngx_feature_path="/usr/pkg/include"
 
-            . auto/feature
+        if [ $NGX_RPATH = YES ]; then
+            ngx_feature_libs="-R/usr/pkg/lib -L/usr/pkg/lib -lssl -lcrypto"
+        else
+            ngx_feature_libs="-L/usr/pkg/lib -lssl -lcrypto"
         fi
 
-        if [ $ngx_found = no ]; then
+        ngx_feature_libs="$ngx_feature_libs $NGX_LIBDL $NGX_LIBPTHREAD"
+
+        . auto/feature
+    fi
+
+    if [ $ngx_found = no ]; then
+
+        # MacPorts
 
-            # NetBSD port
+        ngx_feature="OpenSSL library in /opt/local/"
+        ngx_feature_path="/opt/local/include"
+
+        if [ $NGX_RPATH = YES ]; then
+            ngx_feature_libs="-R/opt/local/lib -L/opt/local/lib -lssl -lcrypto"
+        else
+            ngx_feature_libs="-L/opt/local/lib -lssl -lcrypto"
+        fi
+
+        ngx_feature_libs="$ngx_feature_libs $NGX_LIBDL $NGX_LIBPTHREAD"
 
-            ngx_feature="OpenSSL library in /usr/pkg/"
-            ngx_feature_path="/usr/pkg/include"
+        . auto/feature
+    fi
+
+    if [ $ngx_found = yes ]; then
+        have=NGX_SSL . auto/have
+        CORE_INCS="$CORE_INCS $ngx_feature_path"
+        CORE_LIBS="$CORE_LIBS $ngx_feature_libs"
+        OPENSSL=YES
+
+        if [ $USE_OPENSSL_QUIC = YES ]; then
 
-            if [ $NGX_RPATH = YES ]; then
-                ngx_feature_libs="-R/usr/pkg/lib -L/usr/pkg/lib -lssl -lcrypto"
-            else
-                ngx_feature_libs="-L/usr/pkg/lib -lssl -lcrypto"
+            ngx_feature="OpenSSL QUIC support"
+            ngx_feature_name="NGX_QUIC"
+            ngx_feature_test="SSL_set_quic_method(NULL, NULL)"
+            . auto/feature
+
+            if [ $ngx_found = no ]; then
+                have=NGX_QUIC_OPENSSL_COMPAT . auto/have
+
+                ngx_feature="OpenSSL QUIC compatibility"
+                ngx_feature_test="SSL_CTX_add_custom_ext(NULL, 0, 0,
+                                             NULL, NULL, NULL, NULL, NULL)"
+                . auto/feature
             fi
 
-            ngx_feature_libs="$ngx_feature_libs $NGX_LIBDL $NGX_LIBPTHREAD"
-
-            . auto/feature
-        fi
-
-        if [ $ngx_found = no ]; then
-
-            # MacPorts
-
-            ngx_feature="OpenSSL library in /opt/local/"
-            ngx_feature_path="/opt/local/include"
-
-            if [ $NGX_RPATH = YES ]; then
-                ngx_feature_libs="-R/opt/local/lib -L/opt/local/lib -lssl -lcrypto"
-            else
-                ngx_feature_libs="-L/opt/local/lib -lssl -lcrypto"
-            fi
-
-            ngx_feature_libs="$ngx_feature_libs $NGX_LIBDL $NGX_LIBPTHREAD"
-
-            . auto/feature
-        fi
-
-        if [ $ngx_found = yes ]; then
-            have=NGX_SSL . auto/have
-            CORE_INCS="$CORE_INCS $ngx_feature_path"
-            CORE_LIBS="$CORE_LIBS $ngx_feature_libs"
-            OPENSSL=YES
-
-            if [ $USE_OPENSSL_QUIC = YES ]; then
-
-                ngx_feature="OpenSSL QUIC support"
-                ngx_feature_name="NGX_QUIC"
-                ngx_feature_test="SSL_set_quic_method(NULL, NULL)"
-                . auto/feature
-
-                if [ $ngx_found = no ]; then
-                    have=NGX_QUIC_OPENSSL_COMPAT . auto/have
-
-                    ngx_feature="OpenSSL QUIC compatibility"
-                    ngx_feature_test="SSL_CTX_add_custom_ext(NULL, 0, 0,
-                                                 NULL, NULL, NULL, NULL, NULL)"
-                    . auto/feature
-                fi
-
-                if [ $ngx_found = no ]; then
+            if [ $ngx_found = no ]; then
 cat << END
 
 $0: error: certain modules require OpenSSL QUIC support.
@@ -153,8 +151,7 @@ QUIC support into the system, or build t
 statically from the source with nginx by using --with-openssl=<path> option.
 
 END
-                        exit 1
-                fi
+                exit 1
             fi
         fi
     fi
--- a/auto/lib/pcre/conf
+++ b/auto/lib/pcre/conf
@@ -68,11 +68,9 @@ if [ $PCRE != NONE ]; then
 
 else
 
-    if [ "$NGX_PLATFORM" != win32 ]; then
-        PCRE=NO
-    fi
+    PCRE=NO
 
-    if [ $PCRE = NO -a $PCRE2 != DISABLED ]; then
+    if [ $PCRE2 != DISABLED ]; then
 
         ngx_feature="PCRE2 library"
         ngx_feature_name="NGX_PCRE2"
--- a/auto/lib/zlib/conf
+++ b/auto/lib/zlib/conf
@@ -42,26 +42,24 @@ if [ $ZLIB != NONE ]; then
 
 else
 
-    if [ "$NGX_PLATFORM" != win32 ]; then
-        ZLIB=NO
+    ZLIB=NO
 
-        # FreeBSD, Solaris, Linux
+    # FreeBSD, Solaris, Linux
 
-        ngx_feature="zlib library"
-        ngx_feature_name="NGX_ZLIB"
-        ngx_feature_run=no
-        ngx_feature_incs="#include <zlib.h>"
-        ngx_feature_path=
-        ngx_feature_libs="-lz"
-        ngx_feature_test="z_stream z; deflate(&z, Z_NO_FLUSH)"
-        . auto/feature
+    ngx_feature="zlib library"
+    ngx_feature_name="NGX_ZLIB"
+    ngx_feature_run=no
+    ngx_feature_incs="#include <zlib.h>"
+    ngx_feature_path=
+    ngx_feature_libs="-lz"
+    ngx_feature_test="z_stream z; deflate(&z, Z_NO_FLUSH)"
+    . auto/feature
 
 
-        if [ $ngx_found = yes ]; then
-            CORE_LIBS="$CORE_LIBS $ngx_feature_libs"
-            ZLIB=YES
-            ngx_found=no
-        fi
+    if [ $ngx_found = yes ]; then
+        CORE_LIBS="$CORE_LIBS $ngx_feature_libs"
+        ZLIB=YES
+        ngx_found=no
     fi
 
     if [ $ZLIB != YES ]; then