From 147ca8ced23268b6d94dcaeb2df7690b7ed20541 Mon Sep 17 00:00:00 2001 From: Mark Pizzolato Date: Wed, 13 Mar 2013 14:42:54 -0700 Subject: [PATCH] Exclude LTO from gcc builds when compiler isn't known to support it. --- makefile | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/makefile b/makefile index 2dbede89..17208fa3 100644 --- a/makefile +++ b/makefile @@ -111,12 +111,6 @@ ifeq ($(WIN32),) #*nix Environments (&& cygwin) LIBPATH += /usr/X11/lib OS_LDFLAGS += -L/usr/X11/lib endif - # OSX's XCode gcc doesn't support LTO, but gcc built to explicitly enable it will work - ifneq (,$(GCC_VERSION)) - ifeq (,$(shell $(GCC) -v /dev/null 2>&1 | grep '\-\-enable-lto')) - LTO_EXCLUDE_VERSIONS += $(GCC_VERSION) - endif - endif else ifeq (Linux,$(OSTYPE)) LIBPATH := $(sort $(foreach lib,$(shell /sbin/ldconfig -p | grep ' => /' | sed 's/^.* => //'),$(dir $(lib)))) @@ -170,6 +164,14 @@ ifeq ($(WIN32),) #*nix Environments (&& cygwin) endif endif endif + # Some gcc versions don't support LTO, so only use LTO when the compiler is known to support it + ifeq (,$(NO_LTO)) + ifneq (,$(GCC_VERSION)) + ifeq (,$(shell $(GCC) -v /dev/null 2>&1 | grep '\-\-enable-lto')) + LTO_EXCLUDE_VERSIONS += $(GCC_VERSION) + endif + endif + endif endif $(info lib paths are: $(LIBPATH)) find_lib = $(strip $(firstword $(foreach dir,$(strip $(LIBPATH)),$(wildcard $(dir)/lib$(1).$(LIBEXT)))))