From 9f57f134c19773d54269b6cb9ee455ff87c2e9e1 Mon Sep 17 00:00:00 2001 From: Luca Barbato Date: Mon, 23 Nov 2015 17:08:49 -0500 Subject: [PATCH] configure: ObjC support Assume that the default C compiler and the default ObjC compiler match (default for OSX). Signed-off-by: Luca Barbato --- Makefile | 7 +++++++ configure | 47 ++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 53 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 2c53a4151d..7b1e55015b 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,7 @@ include config.mak vpath %.c $(SRC_PATH) +vpath %.m $(SRC_PATH) vpath %.h $(SRC_PATH) vpath %.S $(SRC_PATH) vpath %.asm $(SRC_PATH) @@ -26,6 +27,8 @@ IFLAGS := -I. -I$(SRC_PATH) CPPFLAGS := $(IFLAGS) $(CPPFLAGS) CFLAGS += $(ECFLAGS) CCFLAGS = $(CPPFLAGS) $(CFLAGS) +OBJCFLAGS += $(EOBJCFLAGS) +OBJCCFLAGS = $(CPPFLAGS) $(CFLAGS) $(OBJCFLAGS) ASFLAGS := $(CPPFLAGS) $(ASFLAGS) YASMFLAGS += $(IFLAGS:%=%/) -Pconfig.asm HOSTCCFLAGS = $(IFLAGS) $(HOSTCPPFLAGS) $(HOSTCFLAGS) @@ -38,6 +41,7 @@ endef COMPILE_C = $(call COMPILE,CC) COMPILE_S = $(call COMPILE,AS) +COMPILE_M = $(call COMPILE,OBJCC) COMPILE_HOSTC = $(call COMPILE,HOSTCC) %.o: %.c @@ -46,6 +50,9 @@ COMPILE_HOSTC = $(call COMPILE,HOSTCC) %.o: %.S $(COMPILE_S) +%.o: %.m + $(COMPILE_M) + %_host.o: %.c $(COMPILE_HOSTC) diff --git a/configure b/configure index 6640f2f6db..4ad9a2bc0e 100755 --- a/configure +++ b/configure @@ -244,6 +244,7 @@ Toolchain options: --ar=AR use archive tool AR [$ar_default] --as=AS use assembler AS [$as_default] --cc=CC use C compiler CC [$cc_default] + --objcc=OCC use ObjC compiler OCC [$cc_default] --dep-cc=DEPCC use dependency generator DEPCC [$cc_default] --ld=LD use linker LD --pkg-config=PKGCONFIG use pkg-config tool PKGCONFIG [$pkg_config_default] @@ -256,6 +257,7 @@ Toolchain options: --host-libs=HLIBS use libs HLIBS when linking for host --host-os=OS compiler host OS [$target_os] --extra-cflags=ECFLAGS add ECFLAGS to CFLAGS [$CFLAGS] + --extra-objcflags=FLAGS add FLAGS to OBJCFLAGS [$CFLAGS] --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS [$LDFLAGS] --extra-ldexeflags=ELDFLAGS add ELDFLAGS to LDEXEFLAGS [$LDEXEFLAGS] --extra-libs=ELIBS add ELIBS [$ELIBS] @@ -695,6 +697,10 @@ add_asflags(){ append ASFLAGS $($asflags_filter "$@") } +add_objcflags(){ + append OBJCFLAGS $($objcflags_filter "$@") +} + add_ldflags(){ append LDFLAGS $($ldflags_filter "$@") } @@ -749,6 +755,13 @@ check_cc(){ check_cmd $cc $CPPFLAGS $CFLAGS "$@" $CC_C $(cc_o $TMPO) $TMPC } +check_objcc(){ + log check_objcc "$@" + cat > $TMPC + log_file $TMPC + check_cmd $objcc $CPPFLAGS $CFLAGS $OBJCFLAGS "$@" $OBJCC_C $(cc_o $TMPO) $TMPC +} + check_cpp(){ log check_cpp "$@" cat > $TMPC @@ -847,6 +860,19 @@ check_cflags(){ test_cflags "$@" && add_cflags "$@" } +test_objcflags(){ + log test_cflags "$@" + set -- $($cflags_filter "$@") + check_objcc "$@" <