[Darwin] Fix compiler detection logic
Xcode Apple compiler is following a different print version format and was not
picked up from existing compiler detection regex. Regex was upgraded to fix it.
Furthermore, for Darwin targets linking with BlocksRuntime is not required since
it's built-in for Apple's compiler releases.
@@ -141,12 +141,17 @@ else
# OS Posix
endif
-COMPILER = $(shell $(CC) -v 2>&1 | grep -oE '(gcc|clang) version' | grep -oE '(clang|gcc)' | head -n1)
+COMPILER = $(shell $(CC) -v 2>&1 | \
+ grep -oE '((gcc|clang) version|LLVM version.*clang)' | \
+ grep -oE '(clang|gcc)' | head -n1)
ifeq ($(COMPILER),clang)
ARCH_CFLAGS += -Wno-initializer-overrides -Wno-unknown-warning-option
ARCH_CFLAGS += -fblocks
+
+ ifneq ($(OS),Darwin)
ARCH_LDFLAGS += -lBlocksRuntime
endif
+endif
SRCS := $(COMMON_SRCS) $(ARCH_SRCS)
OBJS := $(SRCS:.c=.o)
