Welcome! Log In Create A New Profile

Advanced

[PATCH] Configure: build C++ test module using C++ compiler

Piotr Sikora via nginx-devel
May 02, 2024 05:36PM
# HG changeset patch
# User Piotr Sikora <piotr@aviatrix.com>
# Date 1714589815 0
# Wed May 01 18:56:55 2024 +0000
# Node ID 787e1adea9aa7f681884657f119e864af0be3e0d
# Parent 49dce50fad40bf09db81ca2a35983ecd7b740e43
Configure: build C++ test module using C++ compiler.

This fixes build when using C compiler that doesn't support C++.

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

diff -r 49dce50fad40 -r 787e1adea9aa auto/cc/conf
--- a/auto/cc/conf Tue Apr 16 18:29:59 2024 +0400
+++ b/auto/cc/conf Wed May 01 18:56:55 2024 +0000
@@ -142,6 +142,7 @@
fi

CFLAGS="$CFLAGS $NGX_CC_OPT"
+CXXFLAGS="$CXXFLAGS $NGX_CXX_OPT"
NGX_TEST_LD_OPT="$NGX_LD_OPT"

if [ "$NGX_PLATFORM" != win32 ]; then
diff -r 49dce50fad40 -r 787e1adea9aa auto/make
--- a/auto/make Tue Apr 16 18:29:59 2024 +0400
+++ b/auto/make Wed May 01 18:56:55 2024 +0000
@@ -23,6 +23,8 @@

CC = $CC
CFLAGS = $CFLAGS
+CXX = $CXX
+CXXFLAGS = $CXXFLAGS
CPP = $CPP
LINK = $LINK

@@ -384,22 +386,36 @@
if test -n "$MISC_SRCS"; then

ngx_cc="\$(CC) $ngx_compile_opt \$(CFLAGS) $ngx_use_pch \$(ALL_INCS)"
+ ngx_cxx="\$(CXX) $ngx_compile_opt \$(CXXFLAGS) $ngx_use_pch \$(ALL_INCS)"

- for ngx_src in $MISC_SRCS
+ for ngx_source in $MISC_SRCS
do
- ngx_src=`echo $ngx_src | sed -e "s/\//$ngx_regex_dirsep/g"`
+ ngx_src=`echo $ngx_source | sed -e "s/\//$ngx_regex_dirsep/g"`
ngx_obj=`echo $ngx_src \
| sed -e "s#^\(.*\.\)cpp\\$#$ngx_objs_dir\1$ngx_objext#g" \
-e "s#^\(.*\.\)cc\\$#$ngx_objs_dir\1$ngx_objext#g" \
-e "s#^\(.*\.\)c\\$#$ngx_objs_dir\1$ngx_objext#g" \
-e "s#^\(.*\.\)S\\$#$ngx_objs_dir\1$ngx_objext#g"`

- cat << END >> $NGX_MAKEFILE
+ if [ $ngx_source = src/misc/ngx_cpp_test_module.cpp ]; then
+
+ cat << END >> $NGX_MAKEFILE
+
+$ngx_obj: \$(CORE_DEPS) $ngx_cont$ngx_src
+ $ngx_cxx$ngx_tab$ngx_objout$ngx_obj$ngx_tab$ngx_src$NGX_AUX
+
+END
+
+ else
+
+ cat << END >> $NGX_MAKEFILE

$ngx_obj: \$(CORE_DEPS) $ngx_cont$ngx_src
$ngx_cc$ngx_tab$ngx_objout$ngx_obj$ngx_tab$ngx_src$NGX_AUX

END
+
+ fi
done

fi
diff -r 49dce50fad40 -r 787e1adea9aa auto/options
--- a/auto/options Tue Apr 16 18:29:59 2024 +0400
+++ b/auto/options Wed May 01 18:56:55 2024 +0000
@@ -18,11 +18,13 @@
NGX_BUILD=

CC=${CC:-cc}
+CXX=${CXX:-c++}
CPP=
NGX_OBJS=objs

NGX_DEBUG=NO
NGX_CC_OPT=
+NGX_CXX_OPT=
NGX_LD_OPT=
CPU=NO

@@ -358,8 +360,10 @@
--with-compat) NGX_COMPAT=YES ;;

--with-cc=*) CC="$value" ;;
+ --with-cxx=*) CXX="$value" ;;
--with-cpp=*) CPP="$value" ;;
--with-cc-opt=*) NGX_CC_OPT="$value" ;;
+ --with-cxx-opt=*) NGX_CXX_OPT="$value" ;;
--with-ld-opt=*) NGX_LD_OPT="$value" ;;
--with-cpu-opt=*) CPU="$value" ;;
--with-debug) NGX_DEBUG=YES ;;
@@ -578,8 +582,10 @@
--with-compat dynamic modules compatibility

--with-cc=PATH set C compiler pathname
+ --with-cxx=PATH set C++ compiler pathname
--with-cpp=PATH set C preprocessor pathname
--with-cc-opt=OPTIONS set additional C compiler options
+ --with-cxx-opt=OPTIONS set additional C++ compiler options
--with-ld-opt=OPTIONS set additional linker options
--with-cpu-opt=CPU build for the specified CPU, valid values:
pentium, pentiumpro, pentium3, pentium4,
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
https://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[PATCH] Configure: build C++ test module using C++ compiler

Piotr Sikora via nginx-devel 275 May 02, 2024 05:36PM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 218
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready