[PATCH] Configure: test --with-cc-opt options

Piotr Sikora piotr.sikora at frickle.com
Thu May 2 21:32:58 UTC 2024


# HG changeset patch
# User Piotr Sikora <piotr at aviatrix.com>
# Date 1714589524 0
#      Wed May 01 18:52:04 2024 +0000
# Node ID 0d5498e86bf8a7f119ed83dbc0789be37d728334
# Parent  49dce50fad40bf09db81ca2a35983ecd7b740e43
Configure: test --with-cc-opt options.

Previously, invalid C compiler options would fail with an
unrelated error much later in the ./configure tests.

This matches the existing test for --with-ld-opt options.

Signed-off-by: Piotr Sikora <piotr at aviatrix.com>

diff -r 49dce50fad40 -r 0d5498e86bf8 auto/cc/conf
--- a/auto/cc/conf	Tue Apr 16 18:29:59 2024 +0400
+++ b/auto/cc/conf	Wed May 01 18:52:04 2024 +0000
@@ -142,6 +142,29 @@
 fi
 
 CFLAGS="$CFLAGS $NGX_CC_OPT"
+
+if [ "$NGX_PLATFORM" != win32 ]; then
+
+    if test -n "$NGX_CC_OPT"; then
+        ngx_feature=--with-cc-opt=\"$NGX_CC_OPT\"
+        ngx_feature_name=
+        ngx_feature_run=no
+        ngx_feature_incs=
+        ngx_feature_path=
+        ngx_feature_libs=
+        ngx_feature_test=
+        . auto/feature
+
+        if [ $ngx_found = no ]; then
+            echo
+            echo $0: error: the invalid value in --with-cc-opt=\"$NGX_CC_OPT\"
+            echo
+            exit 1
+        fi
+    fi
+
+fi
+
 NGX_TEST_LD_OPT="$NGX_LD_OPT"
 
 if [ "$NGX_PLATFORM" != win32 ]; then


More information about the nginx-devel mailing list