[vlc-devel] [PATCH] contrib: fix the FPU detection for cross-compiles

Edward Wang edward.c.wang at compdigitec.com
Fri Dec 21 12:54:14 CET 2012


Previously, FPU detction was done before the variables for compiling (CC, CFLAGS, etc) were set. This broke on cross-compiles, because it was trying to use the default $(CC) to do the checks.

By doing the FPU detection after setting all the variables, FPU detection for cross-compiles works spectacularly.
---
 contrib/src/main.mak |   23 +++++++++++++----------
 1 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/contrib/src/main.mak b/contrib/src/main.mak
index fc7b877..e8ad7e5 100644
--- a/contrib/src/main.mak
+++ b/contrib/src/main.mak
@@ -36,16 +36,7 @@ ifneq ($(HOST),$(BUILD))
 HAVE_CROSS_COMPILE = 1
 endif
 ARCH := $(shell $(SRC)/get-arch.sh $(HOST))
-ifneq ($(findstring $(ARCH),i386 sparc sparc64 ppc ppc64 x86_64),)
-# This should be consistent with include/vlc_cpu.h
-HAVE_FPU = 1
-else ifneq ($(findstring $(ARCH),arm),)
-ifneq ($(call cppcheck, __VFP_FP__)),)
-ifeq ($(call cppcheck, __SOFTFP__),)
-HAVE_FPU = 1
-endif
-endif
-endif
+
 ifeq ($(ARCH)-$(HAVE_WIN32),x86_64-1)
 HAVE_WIN64 := 1
 endif
@@ -171,6 +162,18 @@ EXTRA_LDFLAGS += -L$(PREFIX)/lib
 LDFLAGS := $(LDFLAGS) $(EXTRA_LDFLAGS)
 # Do not export those! Use HOSTVARS.
 
+# Do the FPU detection, after we have figured out our compilers and flags.
+ifneq ($(findstring $(ARCH),i386 sparc sparc64 ppc ppc64 x86_64),)
+# This should be consistent with include/vlc_cpu.h
+HAVE_FPU = 1
+else ifneq ($(findstring $(ARCH),arm),)
+ifneq ($(call cppcheck, __VFP_FP__)),)
+ifeq ($(call cppcheck, __SOFTFP__),)
+HAVE_FPU = 1
+endif
+endif
+endif
+
 ACLOCAL_AMFLAGS += -I$(PREFIX)/share/aclocal
 export ACLOCAL_AMFLAGS
 
-- 
1.7.5.4




More information about the vlc-devel mailing list