Bug 983953 - Don't try to use vpx_mem if --with-system-libvpx doesn't provide. r=glandium, a=lsblakk
authorJan Beich <jbeich@tormail.org>
Tue, 22 Apr 2014 08:44:04 -0400
changeset 192090 cf2301f85796d9a76b41a02bfbeaa67661bc2dcf
parent 192089 a2a4ac12c65c15a186179c219a7b12da4162d558
child 192091 973dc530a2fac0989decb387cbb0a3e3071bfbd5
push id3503
push userraliiev@mozilla.com
push dateMon, 28 Apr 2014 18:51:11 +0000
treeherdermozilla-beta@c95ac01e332e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersglandium, lsblakk
bugs983953
milestone30.0a2
Bug 983953 - Don't try to use vpx_mem if --with-system-libvpx doesn't provide. r=glandium, a=lsblakk
config/system-headers
configure.in
xpcom/build/nsXPComInit.cpp
--- a/config/system-headers
+++ b/config/system-headers
@@ -1098,23 +1098,25 @@ pixman.h
 shareuiinterface.h
 #endif
 #if MOZ_NATIVE_LIBVPX==1
 vpx/vpx_codec.h
 vpx/vpx_decoder.h
 vpx/vpx_encoder.h
 vpx/vp8cx.h
 vpx/vp8dx.h
+vpx_mem/vpx_mem.h
 #endif
 #ifdef GKMEDIAS_SHARED_LIBRARY
 vpx/vpx_codec.h
 vpx/vpx_decoder.h
 vpx/vpx_encoder.h
 vpx/vp8cx.h
 vpx/vp8dx.h
+vpx_mem/vpx_mem.h
 vorbis/codec.h
 theora/theoradec.h
 tremor/ivorbiscodec.h
 ogg/ogg.h
 ogg/os_types.h
 nestegg/nestegg.h
 cubeb/cubeb.h
 #endif
--- a/configure.in
+++ b/configure.in
@@ -5336,31 +5336,43 @@ MOZ_LIBVPX_CFLAGS=
 MOZ_LIBVPX_LIBS=
 
 if test -n "$MOZ_VPX"; then
     AC_DEFINE(MOZ_VPX)
     if test -n "$MOZ_VPX_ERROR_CONCEALMENT" ; then
         AC_DEFINE(MOZ_VPX_ERROR_CONCEALMENT)
     fi
 
+    _SAVE_CFLAGS=$CFLAGS
+    _SAVE_LIBS=$LIBS
     if test -n "$MOZ_NATIVE_LIBVPX"; then
         dnl ============================
         dnl === libvpx Version check ===
         dnl ============================
         dnl Check to see if we have a system libvpx package.
         PKG_CHECK_MODULES(MOZ_LIBVPX, vpx >= 1.3.0)
 
+        CFLAGS="$CFLAGS $MOZ_LIBVPX_CFLAGS"
+        LIBS="$LIBS $MOZ_LIBVPX_LIBS"
+
         MOZ_CHECK_HEADER([vpx/vpx_decoder.h], [],
          [AC_MSG_ERROR([Couldn't find vpx/vpx_decoder.h which is required for build with system libvpx. Use --without-system-libvpx to build with in-tree libvpx.])])
 
-        _SAVE_LIBS=$LIBS
         AC_CHECK_LIB(vpx, vpx_codec_dec_init_ver, [],
          [AC_MSG_ERROR([--with-system-libvpx requested but symbol vpx_codec_dec_init_ver not found])])
-        LIBS=$_SAVE_LIBS
-    fi
+
+        MOZ_CHECK_HEADER([vpx_mem/vpx_mem.h],
+         [AC_CHECK_FUNC(vpx_mem_set_functions)])
+        if test "$ac_cv_header_vpx_mem_vpx_mem_h" = no -o \
+                "$ac_cv_func_vpx_mem_set_functions" = no; then
+            AC_DEFINE(MOZ_VPX_NO_MEM_REPORTING)
+        fi
+    fi
+    CFLAGS=$_SAVE_CFLAGS
+    LIBS=$_SAVE_LIBS
 fi
 
 AC_SUBST(MOZ_NATIVE_LIBVPX)
 AC_SUBST(MOZ_LIBVPX_CFLAGS)
 AC_SUBST(MOZ_LIBVPX_LIBS)
 
 if test "$MOZ_WEBM"; then
     if test "$MOZ_SAMPLE_TYPE_FLOAT32"; then
--- a/xpcom/build/nsXPComInit.cpp
+++ b/xpcom/build/nsXPComInit.cpp
@@ -124,17 +124,17 @@ extern nsresult nsStringInputStreamConst
 #include "mozilla/ClearOnShutdown.h"
 #include "mozilla/SystemMemoryReporter.h"
 
 #ifdef MOZ_VISUAL_EVENT_TRACER
 #include "mozilla/VisualEventTracer.h"
 #endif
 
 #include "ogg/ogg.h"
-#ifdef MOZ_VPX
+#if defined(MOZ_VPX) && !defined(MOZ_VPX_NO_MEM_REPORTING)
 #include "vpx_mem/vpx_mem.h"
 #endif
 
 #include "GeckoProfiler.h"
 
 #include "jsapi.h"
 
 using namespace mozilla;
@@ -565,17 +565,17 @@ NS_InitXPCOM2(nsIServiceManager* *result
     mozilla::SetICUMemoryFunctions();
 
     // Do the same for libogg.
     ogg_set_mem_functions(OggReporter::CountingMalloc,
                           OggReporter::CountingCalloc,
                           OggReporter::CountingRealloc,
                           OggReporter::CountingFree);
 
-#ifdef MOZ_VPX
+#if defined(MOZ_VPX) && !defined(MOZ_VPX_NO_MEM_REPORTING)
     // And for VPX.
     vpx_mem_set_functions(VPXReporter::CountingMalloc,
                           VPXReporter::CountingCalloc,
                           VPXReporter::CountingRealloc,
                           VPXReporter::CountingFree,
                           memcpy,
                           memset,
                           memmove);