[git commit] buildsys: check CXXFLAGS with CXX compiler

Bernhard Reutner-Fischer rep.dot.nop at gmail.com
Sat Mar 5 23:20:12 UTC 2016


commit: https://git.uclibc.org/uClibc++/commit/?id=5e90212ff20010e768023be1438c2257c51b1006
branch: https://git.uclibc.org/uClibc++/commit/?id=refs/heads/master

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop at gmail.com>
---
 Rules.mak | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/Rules.mak b/Rules.mak
index 7b4b993..d87aa36 100644
--- a/Rules.mak
+++ b/Rules.mak
@@ -105,6 +105,9 @@ space:= #
 check_gcc=$(shell \
 	if $(CC) $(1) -S -o /dev/null -xc /dev/null > /dev/null 2>&1; \
 	then echo "$(1)"; else echo "$(2)"; fi)
+check_gxx=$(shell \
+	if $(CXX) $(1) -S -o /dev/null -xc++ /dev/null > /dev/null 2>&1; \
+	then echo "$(1)"; else echo "$(2)"; fi)
 check_as=$(shell \
 	if $(CC) -Wa,$(1) -Wa,-Z -c -o /dev/null -xassembler /dev/null > /dev/null 2>&1; \
 	then echo "-Wa,$(1)"; fi)
@@ -130,6 +133,11 @@ endef
 define check-gcc-var
 $(call check-tool-var,check_gcc,CFLAG,$(1))
 endef
+# Check the C++ compiler to see if it supports <flag>.
+# Export the variable CXXFLAG_<flag> if it does.
+define check-gxx-var
+$(call check-tool-var,check_gxx,CXXFLAG,$(1))
+endef
 # Usage: check-as-var,<flag>
 # Check the assembler to see if it supports <flag>.  Export the
 # variable ASFLAG_<flag> if it does (for invoking the assembler),
@@ -188,7 +196,7 @@ $(eval $(call check-gcc-var,-O2))
 OPTIMIZATION += $(CFLAG_-O2)
 endif
 
-$(eval $(call check-gcc-var,-fvisibility-inlines-hidden))
+$(eval $(call check-gxx-var,-fvisibility-inlines-hidden))
 
 # Add a bunch of extra pedantic annoyingly strict checks
 XWARNINGS=$(call qstrip,$(UCLIBCXX_WARNINGS)) -Wno-trigraphs -pedantic
@@ -196,7 +204,7 @@ CPU_CFLAGS=$(call qstrip,$(CPU_CFLAGS-y))
 
 # Some nice CFLAGS to work with
 GEN_CFLAGS:=-fno-builtin
-CFLAGS:=$(XWARNINGS) $(CPU_CFLAGS) -ansi
+CFLAGS:=$(XWARNINGS) $(CPU_CFLAGS)
 
 LDFLAGS-$(LIBNAME).so:=-Wl,--warn-common -Wl,--warn-once -Wl,-z,combreloc -Wl,-z,defs
 
@@ -219,8 +227,9 @@ ifneq ($(UCLIBCXX_EXCEPTION_SUPPORT),y)
 endif
 
 GEN_CXXFLAGS:=-nostdinc++
-GEN_CXXFLAGS+=$(if $(CFLAG_-fvisibility-inlines-hidden),-DGCC_HASCLASSVISIBILITY)
+GEN_CXXFLAGS+=$(if $(CXXFLAG_-fvisibility-inlines-hidden),-DGCC_HASCLASSVISIBILITY)
 CXXFLAGS:=$(CFLAGS)
+CFLAGS += -ansi
 
 LIBGCC:=$(shell $(CC) -print-libgcc-file-name)
 LIBGCC_DIR:=$(dir $(LIBGCC))


More information about the uClibc-cvs mailing list