[PATCH] Provide support for CXXFLAGS for c++ modules

Vasily Chekalkin bacek at bacek.com
Sun Nov 15 22:38:41 UTC 2015


# HG changeset patch
# User Vasily Chekalkin <bacek at bacek.com>
# Date 1447626235 -39600
#      Mon Nov 16 09:23:55 2015 +1100
# Node ID 07ad1f9b4307940ecd0b952badba80fab7caba4b
# Parent  ec6b07be88a5108d5b48386e06abe1d1bf975ab3
Provide support for CXXFLAGS for c++ modules.

When you want to implement module in modern C++ (e.g. c++11, etc) you have to
specify --std=c++11 in compiler command line. In this case GCC will complain
about using this flag for non-c++ sources. To avoid unnecessary clutter we
separate CFLAGS and CXXFLAGS.

diff -r ec6b07be88a5 -r 07ad1f9b4307 auto/make
--- a/auto/make Fri Nov 13 20:10:50 2015 +0300
+++ b/auto/make Mon Nov 16 09:23:55 2015 +1100
@@ -22,6 +22,7 @@

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

@@ -410,10 +411,16 @@

         ngx_src=`echo $ngx_src | sed -e "s/\//$ngx_regex_dirsep/g"`

+        # Append CXXFLAGS iff source is c++
+        ngx_cpp=`echo $ngx_src \
+            | sed -e "s#^.*\.cpp\\$# \\$(CXXFLAGS)#" \
+                  -e "s#^.*\.cc\\$# \\$(CXXFLAGS)#" \
+                  -e "s#^$ngx_src\\$##g"`
+
         cat << END                                            >> $NGX_MAKEFILE

 $ngx_obj:      \$(ADDON_DEPS)$ngx_cont$ngx_src
-       $ngx_cc$ngx_tab$ngx_objout$ngx_obj$ngx_tab$ngx_src$NGX_AUX
+       $ngx_cc$ngx_cpp$ngx_tab$ngx_objout$ngx_obj$ngx_tab$ngx_src$NGX_AUX

 END
      done



More information about the nginx-devel mailing list