From: John Koleszar Date: Tue, 22 May 2012 17:37:20 +0000 (-0700) Subject: configure: initial support for CXX, CXXFLAGS variables X-Git-Tag: v1.2.0~195^2~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8631c1b8a21f2bc0c5a814d125a2e2eea2d2bf86;p=platform%2Fupstream%2Flibvpx.git configure: initial support for CXX, CXXFLAGS variables Use CXX rather than assuming g++ to invoke the compiler. Also introduce separate CXXFLAGS, as certain CFLAGS we enable by default cause warnings with g++. Change-Id: Ia2f40ef27c93e45c971d070cc58bdcde9da2ac7c --- diff --git a/build/make/Makefile b/build/make/Makefile index b6cf320..26ca0be 100644 --- a/build/make/Makefile +++ b/build/make/Makefile @@ -66,6 +66,7 @@ endif BUILD_ROOT?=. VPATH=$(SRC_PATH_BARE) CFLAGS+=-I$(BUILD_PFX)$(BUILD_ROOT) -I$(SRC_PATH) +CXXFLAGS+=-I$(BUILD_PFX)$(BUILD_ROOT) -I$(SRC_PATH) ASFLAGS+=-I$(BUILD_PFX)$(BUILD_ROOT)/ -I$(SRC_PATH)/ DIST_DIR?=dist HOSTCC?=gcc @@ -111,11 +112,11 @@ $(BUILD_PFX)%.c.o: %.c $(BUILD_PFX)%.cc.d: %.cc $(if $(quiet),@echo " [DEP] $@") $(qexec)mkdir -p $(dir $@) - $(qexec)g++ $(INTERNAL_CFLAGS) $(CFLAGS) -M $< | $(fmt_deps) > $@ + $(qexec)$(CXX) $(INTERNAL_CFLAGS) $(CXXFLAGS) -M $< | $(fmt_deps) > $@ $(BUILD_PFX)%.cc.o: %.cc $(if $(quiet),@echo " [CXX] $@") - $(qexec)g++ $(INTERNAL_CFLAGS) $(CFLAGS) -c -o $@ $< + $(qexec)$(CXX) $(INTERNAL_CFLAGS) $(CXXFLAGS) -c -o $@ $< $(BUILD_PFX)%.asm.d: %.asm $(if $(quiet),@echo " [DEP] $@") @@ -213,7 +214,7 @@ define linkerxx_template $(1): $(filter-out -%,$(2)) $(1): $(if $(quiet),@echo " [LD] $$@") - $(qexec)g++ $$(strip $$(INTERNAL_LDFLAGS) $$(LDFLAGS) -o $$@ $(2) $(3) $$(extralibs)) + $(qexec)$$(CXX) $$(strip $$(INTERNAL_LDFLAGS) $$(LDFLAGS) -o $$@ $(2) $(3) $$(extralibs)) endef # make-3.80 has a bug with expanding large input strings to the eval function, # which was triggered in some cases by the following component of diff --git a/build/make/configure.sh b/build/make/configure.sh index 3118c0a..11ebdf0 100755 --- a/build/make/configure.sh +++ b/build/make/configure.sh @@ -166,6 +166,17 @@ is_in(){ add_cflags() { CFLAGS="${CFLAGS} $@" + CXXFLAGS="${CXXFLAGS} $@" +} + + +add_cflags_only() { + CFLAGS="${CFLAGS} $@" +} + + +add_cxxflags_only() { + CXXFLAGS="${CXXFLAGS} $@" } @@ -277,6 +288,13 @@ check_cc() { check_cmd ${CC} ${CFLAGS} "$@" -c -o ${TMP_O} ${TMP_C} } +check_cxx() { + log check_cxx "$@" + cat >${TMP_C} + log_file ${TMP_C} + check_cmd ${CXX} ${CXXFLAGS} "$@" -c -o ${TMP_O} ${TMP_C} +} + check_cpp() { log check_cpp "$@" cat > ${TMP_C} @@ -310,8 +328,25 @@ int x; EOF } +check_cxxflags() { + log check_cxxflags "$@" + + # Catch CFLAGS that trigger CXX warnings + case "$CXX" in + *g++*) check_cxx -Werror "$@" <> $1 << EOF @@ -379,6 +416,7 @@ TOOLCHAIN=${toolchain} ASM_CONVERSION=${asm_conversion_cmd:-${source_path}/build/make/ads2gas.pl} CC=${CC} +CXX=${CXX} AR=${AR} LD=${LD} AS=${AS} @@ -386,6 +424,7 @@ STRIP=${STRIP} NM=${NM} CFLAGS = ${CFLAGS} +CXXFLAGS = ${CXXFLAGS} ARFLAGS = -rus\$(if \$(quiet),c,v) LDFLAGS = ${LDFLAGS} ASFLAGS = ${ASFLAGS} @@ -538,6 +577,7 @@ post_process_cmdline() { setup_gnu_toolchain() { CC=${CC:-${CROSS}gcc} + CXX=${CXX:-${CROSS}g++} AR=${AR:-${CROSS}ar} LD=${LD:-${CROSS}${link_with_cc:-ld}} AS=${AS:-${CROSS}as} @@ -792,6 +832,7 @@ process_common_toolchain() { -name "arm-linux-androideabi-gcc*" -print -quit` TOOLCHAIN_PATH=${COMPILER_LOCATION%/*}/arm-linux-androideabi- CC=${TOOLCHAIN_PATH}gcc + CXX=${TOOLCHAIN_PATH}g++ AR=${TOOLCHAIN_PATH}ar LD=${TOOLCHAIN_PATH}gcc AS=${TOOLCHAIN_PATH}as @@ -827,6 +868,7 @@ process_common_toolchain() { SDK_PATH=${sdk_path} fi TOOLCHAIN_PATH=${SDK_PATH}/usr/bin + CXX=${TOOLCHAIN_PATH}/g++ CC=${TOOLCHAIN_PATH}/gcc AR=${TOOLCHAIN_PATH}/ar LD=${TOOLCHAIN_PATH}/arm-apple-darwin10-llvm-gcc-4.2 @@ -938,6 +980,7 @@ process_common_toolchain() { ;; solaris*) CC=${CC:-${CROSS}gcc} + CXX=${CXX:-${CROSS}g++} LD=${LD:-${CROSS}gcc} CROSS=${CROSS:-g} ;; diff --git a/libs.mk b/libs.mk index f241d07..f256649 100644 --- a/libs.mk +++ b/libs.mk @@ -397,8 +397,8 @@ else include $(SRC_PATH_BARE)/third_party/googletest/gtest.mk GTEST_SRCS := $(addprefix third_party/googletest/src/,$(call enabled,GTEST_SRCS)) GTEST_OBJS=$(call objs,$(GTEST_SRCS)) -$(GTEST_OBJS) $(GTEST_OBJS:.o=.d): CFLAGS += -I$(SRC_PATH_BARE)/third_party/googletest/src -$(GTEST_OBJS) $(GTEST_OBJS:.o=.d): CFLAGS += -I$(SRC_PATH_BARE)/third_party/googletest/src/include +$(GTEST_OBJS) $(GTEST_OBJS:.o=.d): CXXFLAGS += -I$(SRC_PATH_BARE)/third_party/googletest/src +$(GTEST_OBJS) $(GTEST_OBJS:.o=.d): CXXFLAGS += -I$(SRC_PATH_BARE)/third_party/googletest/src/include OBJS-$(BUILD_LIBVPX) += $(GTEST_OBJS) LIBS-$(BUILD_LIBVPX) += $(BUILD_PFX)libgtest.a $(BUILD_PFX)libgtest_g.a $(BUILD_PFX)libgtest_g.a: $(GTEST_OBJS)