Bug 697821 - Disable libtheora assembly on XCode 4.2. r=khuey
authorRalph Giles <giles@mozilla.com>
Tue, 08 Nov 2011 00:57:00 -0500
changeset 79990 c6d7a275acaa30f84a442431fbbf4ad102f8f297
parent 79989 bcf9c9ec97a04c122d9156483f8f8300e1bf8364
child 79991 095a745d1e72b7bf3869c3162b1593aea91ff9e8
push idunknown
push userunknown
push dateunknown
reviewerskhuey
bugs697821, 627981
milestone10.0a1
Bug 697821 - Disable libtheora assembly on XCode 4.2. r=khuey The version of llvm-gcc included with Apple's XCode 4.2 toolchain can't compile the inline assembly in the libtheora library. This is a regression from the 4.1 release. Check for this version and disable assembly if found. Also update the check for clang < v2.9 from bug 627981, which had similar problems, to set the same flag.
config/autoconf.mk.in
configure.in
media/libtheora/lib/Makefile.in
--- a/config/autoconf.mk.in
+++ b/config/autoconf.mk.in
@@ -148,16 +148,17 @@ MOZ_URL_CLASSIFIER = @MOZ_URL_CLASSIFIER
 MOZ_ZIPWRITER = @MOZ_ZIPWRITER@
 MOZ_OGG = @MOZ_OGG@
 MOZ_RAW = @MOZ_RAW@
 MOZ_SYDNEYAUDIO = @MOZ_SYDNEYAUDIO@
 MOZ_WAVE = @MOZ_WAVE@
 MOZ_MEDIA = @MOZ_MEDIA@
 MOZ_VORBIS = @MOZ_VORBIS@
 MOZ_TREMOR = @MOZ_TREMOR@
+MOZ_NO_THEORA_ASM = @MOZ_NO_THEORA_ASM@
 MOZ_WEBM = @MOZ_WEBM@
 MOZ_VP8_ERROR_CONCEALMENT = @MOZ_VP8_ERROR_CONCEALMENT@
 MOZ_VP8_ENCODER = @MOZ_VP8_ENCODER@
 VPX_AS = @VPX_AS@
 VPX_ASFLAGS = @VPX_ASFLAGS@
 VPX_DASH_C_FLAG = @VPX_DASH_C_FLAG@
 VPX_AS_CONVERSION = @VPX_AS_CONVERSION@
 VPX_ASM_SUFFIX = @VPX_ASM_SUFFIX@
@@ -369,17 +370,16 @@ CXX		    = @CXX@
 
 CC_VERSION	= @CC_VERSION@
 CXX_VERSION	= @CXX_VERSION@
 
 GNU_AS		= @GNU_AS@
 GNU_LD		= @GNU_LD@
 GNU_CC		= @GNU_CC@
 GNU_CXX		= @GNU_CXX@
-HAVE_OLD_CLANG	= @HAVE_OLD_CLANG@
 INTEL_CC	= @INTEL_CC@
 INTEL_CXX	= @INTEL_CXX@
 
 STL_FLAGS		= @STL_FLAGS@
 WRAP_STL_INCLUDES	= @WRAP_STL_INCLUDES@
 MOZ_MSVC_STL_WRAP__Throw= @MOZ_MSVC_STL_WRAP__Throw@
 MOZ_MSVC_STL_WRAP__RAISE= @MOZ_MSVC_STL_WRAP__RAISE@
 
--- a/configure.in
+++ b/configure.in
@@ -1187,34 +1187,49 @@ tools are selected during the Xcode/Deve
   fi
 fi
 
 fi # COMPILE_ENVIRONMENT
 
 dnl clang prior to 2.9 (including Xcode 4) does not support all the
 dnl constructs required by the libtheora inline asm. This is used to
 dnl detect and disable it
+AC_MSG_CHECKING([whether the C compiler is clang older than version 2.9])
 AC_LANG_SAVE
 AC_LANG_C
 AC_TRY_COMPILE([
 #if defined(__clang__)
 # if __clang_major__<2 || (__clang_major__==2 && __clang_minor__<9)
 #  error "clang older than 2.9 detected"
 # endif
 #endif
                ],
                [],
-               result="yes",
-               result="no")
-if test "$result" = "no"; then
-    AC_DEFINE(HAVE_OLD_CLANG)
-    HAVE_OLD_CLANG=1
-fi
+               result="no",
+               result="yes")
 AC_LANG_RESTORE
-AC_SUBST(HAVE_OLD_CLANG)
+AC_MSG_RESULT([$result])
+if test "$result" = "yes"; then
+  MOZ_NO_THEORA_ASM=1
+fi
+dnl XCode 4.2 also shipped an llvm-gcc which couldn't compile
+dnl the libtheora inline asm.
+AC_MSG_CHECKING([bad gcc versions])
+if `$CC --version | grep -q "Apple Inc. build 5658"`; then
+  AC_MSG_RESULT([Apple build 5658])
+  MOZ_NO_THEORA_ASM=1
+else
+  AC_MSG_RESULT([we're ok])
+fi
+
+AC_SUBST(MOZ_NO_THEORA_ASM)
+
+if test "x$MOZ_NO_THEORA_ASM" = x1; then
+  AC_MSG_WARN([Disabling libtheora inline assembly])
+fi
 
 if test -n "$MAKE"; then
   if test `echo $MAKE | grep -c make.py` != 1; then
      NOT_PYMAKE=$MAKE
   fi
 fi
 
 case "$host_os" in
--- a/media/libtheora/lib/Makefile.in
+++ b/media/libtheora/lib/Makefile.in
@@ -45,23 +45,25 @@ LIBRARY_NAME     = theora
 FORCE_STATIC_LIB = 1
 
 # The encoder is currently not included.
 DEFINES += -DTHEORA_DISABLE_ENCODE
 
 ifeq ($(findstring 86,$(OS_TEST)), 86)
 ifneq ($(OS_ARCH),SunOS)
 ifneq ($(OS_ARCH)$(OS_TEST),WINNTx86_64)
+ifndef MOZ_NO_THEORA_ASM
 DEFINES += -DOC_X86_ASM
 ifeq (64,$(findstring 64,$(OS_TEST)))
 DEFINES += -DOC_X86_64_ASM
 endif
 endif
 endif
 endif
+endif
 
 VPATH := $(srcdir)
 
 CSRCS = \
   apiwrapper.c \
   bitpack.c \
   decapiwrapper.c \
   decinfo.c \
@@ -85,17 +87,17 @@ CSRCS += \
   mmxidct.c \
   mmxfrag.c \
   mmxstate.c \
   x86state.c \
   x86cpu.c \
   $(NULL)
 endif
 else
-ifndef HAVE_OLD_CLANG
+ifndef MOZ_NO_THEORA_ASM
 VPATH += $(srcdir)/x86
 
 CSRCS += \
   mmxidct.c \
   mmxfrag.c \
   mmxstate.c \
   sse2idct.c \
   x86state.c \