Commit 8631c1b8 authored by John Koleszar's avatar John Koleszar

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
parent 51fe9168
......@@ -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
......
......@@ -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 "$@" <<EOF
int x;
EOF
;;
*) check_cxx "$@" <<EOF
int x;
EOF
;;
esac
}
check_add_cflags() {
check_cflags "$@" && add_cflags "$@"
check_cxxflags "$@" && add_cxxflags_only "$@"
check_cflags "$@" && add_cflags_only "$@"
}
check_add_asflags() {
......@@ -367,7 +402,9 @@ true
write_common_target_config_mk() {
local CC=${CC}
local CXX=${CXX}
enabled ccache && CC="ccache ${CC}"
enabled ccache && CXX="ccache ${CXX}"
print_webm_license $1 "##" ""
cat >> $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}
;;
......
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment