Bug 646254 - configure should error out if yasm version is too low to assemble libjpeg-turbo. r=khuey
authorJustin Lebar <justin.lebar@gmail.com>
Tue, 29 Mar 2011 21:47:51 -0400
changeset 64427 76c3ea5e679aedded70deb3f2aa4a4e08b39d29a
parent 64426 7f1ecc7f86e882b85dda3c86c1f25a976afd8191
child 64428 6c1a5f4eb350482df6078c06df088c46480b9bae
push idunknown
push userunknown
push dateunknown
reviewerskhuey
bugs646254
milestone2.2a1pre
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 646254 - configure should error out if yasm version is too low to assemble libjpeg-turbo. r=khuey Will generate an error if yasm is not at least 1.1.0 unless --disable-libjepg-turbo is passed to configure.
configure.in
--- a/configure.in
+++ b/configure.in
@@ -4966,16 +4966,17 @@ MOZ_MEDIA=
 MOZ_WEBM=1
 VPX_AS=
 VPX_ASFLAGS=
 VPX_AS_DASH_C_FLAG=
 VPX_AS_CONVERSION=
 VPX_ASM_SUFFIX=
 VPX_X86_ASM=
 VPX_ARM_ASM=
+MOZ_LIBJPEG_TURBO=1
 LIBJPEG_TURBO_AS=
 LIBJPEG_TURBO_ASFLAGS=
 LIBJPEG_TURBO_X86_ASM=
 LIBJPEG_TURBO_X64_ASM=
 MOZ_PANGO=1
 MOZ_PERMISSIONS=1
 MOZ_PLACES=1
 MOZ_PLUGINS=1
@@ -6444,28 +6445,27 @@ if test -z "$MOZ_CRASHREPORTER_ENABLE_PE
    MOZ_CRASHREPORTER_ENABLE_PERCENT=100
 fi
 AC_DEFINE_UNQUOTED(MOZ_CRASHREPORTER_ENABLE_PERCENT, $MOZ_CRASHREPORTER_ENABLE_PERCENT)
 
 dnl ========================================================
 dnl = libjpeg-turbo configuration
 dnl ========================================================
 
+MOZ_ARG_DISABLE_BOOL(libjpeg_turbo,
+[ --disable-libjpeg-turbo  Disable optimized jpeg decoding routines],
+    MOZ_LIBJPEG_TURBO=,
+    MOZ_LIBJPEG_TURBO=1)
+
 dnl Detect if we can use yasm to compile libjpeg-turbo's optimized assembly
 dnl files.
-AC_MSG_CHECKING([for YASM assembler])
-AC_CHECK_PROGS(LIBJPEG_TURBO_AS, yasm, "")
-
-dnl XXX jlebar -- need a yasm version check here.
-
-if test -n "LIBJPEG_TURBO_AS"; then
-
-  LIBJPEG_TURBO_AS="yasm"
-
-  dnl We have YASM; see if we support it on this platform.
+
+if test -n "$MOZ_LIBJPEG_TURBO"; then
+
+  dnl Do we support libjpeg-turbo on this platform?
   case "$OS_ARCH:$OS_TEST" in
   Linux:x86|Linux:i?86)
     LIBJPEG_TURBO_ASFLAGS="-f elf32 -rnasm -pnasm -DPIC -DELF"
     LIBJPEG_TURBO_X86_ASM=1
   ;;
   Linux:x86_64)
     LIBJPEG_TURBO_ASFLAGS="-f elf64 -rnasm -pnasm -D__x86_64__ -DPIC -DELF"
     LIBJPEG_TURBO_X64_ASM=1
@@ -6491,24 +6491,43 @@ if test -n "LIBJPEG_TURBO_AS"; then
     LIBJPEG_TURBO_X86_ASM=1
   ;;
   WINNT:x86_64)
     LIBJPEG_TURBO_ASFLAGS="-f win64 -rnasm -pnasm -D__x86_64__ -DPIC -DWIN64"
     LIBJPEG_TURBO_X64_ASM=1
   ;;
   esac
 
-fi # end have YASM
+fi
+
+dnl If we're on a system which supports libjpeg-turbo's asm routines and
+dnl --disable-libjpeg-turbo wasn't passed, check for yasm, and error out if it
+dnl doesn't exist or we have too old of a version.
+if test -n "$LIBJPEG_TURBO_X86_ASM" -o -n "$LIBJPEG_TURBO_X64_ASM" ; then
+    AC_MSG_CHECKING([for YASM assembler])
+    AC_CHECK_PROGS(LIBJPEG_TURBO_AS, yasm, "")
+
+    if test -z "$LIBJPEG_TURBO_AS" ; then
+        AC_MSG_ERROR([yasm is required to build with libjpeg-turbo's optimized JPEG decoding routines, but you do not appear to have yasm installed.  Either install it or configure with --disable-libjpeg-turbo to use the pure C JPEG decoder.  See https://developer.mozilla.org/en/YASM for more details.])
+    fi
+
+    dnl Check for yasm 1.1 or greater.
+    if test "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
+        AC_MSG_ERROR([yasm 1.1 or greater is required to build with libjpeg-turbo's optimized JPEG decoding routines, but you appear to have version $_YASM_MAJOR_VERSION.$_YASM_MINOR_VERSION.  Upgrade to the newest version or configure with --disable-libjpeg-turbo to use the pure C JPEG decoder.  See https://developer.mozilla.org/en/YASM for more details.])
+    fi
+fi
 
 if test -n "$LIBJPEG_TURBO_X86_ASM"; then
-  AC_DEFINE(LIBJPEG_TURBO_X86_ASM)
+    AC_DEFINE(LIBJPEG_TURBO_X86_ASM)
 elif test -n "$LIBJPEG_TURBO_X64_ASM"; then
-  AC_DEFINE(LIBJPEG_TURBO_X64_ASM)
-else
-  AC_MSG_WARN([No assembler or assembly support for libjpeg-turbo.  Using unoptimized C routines.])
+    AC_DEFINE(LIBJPEG_TURBO_X64_ASM)
+elif test -n "$MOZ_LIBJPEG_TURBO"; then
+    dnl Warn if we're not building the optimized routines, even though the user
+    dnl didn't specify --disable-libjpeg-turbo.
+    AC_MSG_WARN([No assembler or assembly support for libjpeg-turbo.  Using unoptimized C routines.])
 fi
 
 dnl ========================================================
 dnl = Enable compilation of specific extension modules
 dnl ========================================================
 
 MOZ_ARG_ENABLE_STRING(extensions,
 [  --enable-extensions     Enable extensions],