Bug 741737 - Configure libvpx with pkgconfig. r=khuey, a=npotb
authorMartin Stransky <stransky@redhat.com>
Tue, 17 Apr 2012 19:57:40 -0400
changeset 91882 eee73897136b4fb54a6e1cac13cc9b48e6af6c25
parent 91881 8f52882518b6d8a64294d3f53b85b896419aeb26
child 91883 a0258b6aeed48fad8b137b140a9f1c18b90ea509
push id8446
push userryanvm@gmail.com
push dateTue, 17 Apr 2012 23:58:08 +0000
treeherdermozilla-inbound@eee73897136b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskhuey, npotb
bugs741737
milestone14.0a1
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 741737 - Configure libvpx with pkgconfig. r=khuey, a=npotb
configure.in
--- a/configure.in
+++ b/configure.in
@@ -5586,82 +5586,44 @@ dnl = Disable VP8 decoder support
 dnl ========================================================
 MOZ_ARG_DISABLE_BOOL(webm,
 [  --disable-webm          Disable support for WebM media (VP8 video and Vorbis audio)],
     MOZ_WEBM=,
     MOZ_WEBM=1)
 
 dnl system libvpx Support
 dnl ========================================================
-MOZ_ARG_WITH_STRING(system-libvpx,
-[  --with-system-libvpx=[PFX]
-                          Use system libvpx [installed at prefix PFX]],
-    LIBVPX_DIR=$withval)
-
-MOZ_NATIVE_LIBVPX=
+MOZ_ARG_WITH_BOOL(system-libvpx,
+[  --with-system-libvpx    Use system libvpx (located with pkgconfig)],
+    MOZ_NATIVE_LIBVPX=1)
+
 MOZ_LIBVPX_INCLUDES=
 MOZ_LIBVPX_LIBS=
 
 if test -n "$MOZ_WEBM"; then
     AC_DEFINE(MOZ_WEBM)
     if test -n "$MOZ_VP8_ERROR_CONCEALMENT" ; then
         AC_DEFINE(MOZ_VP8_ERROR_CONCEALMENT)
     fi
     if test -n "$MOZ_VP8_ENCODER" ; then
         AC_DEFINE(MOZ_VP8_ENCODER)
     fi
 
-    if test -n "$LIBVPX_DIR" -a "$LIBVPX_DIR" != no; then
-        _SAVE_CFLAGS=$CFLAGS
-        _SAVE_LDFLAGS=$LDFLAGS
-        _SAVE_LIBS=$LIBS
-        if test "${LIBVPX_DIR}" = "yes"; then
-            LIBVPX_DIR=/usr
-        fi
-        CFLAGS="-I${LIBVPX_DIR}/include $CFLAGS"
-        LDFLAGS="-L${LIBVPX_DIR}/lib $LDFLAGS"
-        MOZ_NATIVE_LIBVPX_DEC_TEST=
-        MOZ_CHECK_HEADER(vpx/vpx_decoder.h,
-            [if test ! -f "${LIBVPX_DIR}/include/vpx/vpx_decoder.h"; then
-             AC_MSG_ERROR([vpx/vpx_decoder.h found, but is not in ${LIBVPX_DIR}/include])
-            fi],
-            AC_MSG_ERROR([--with-system-libvpx requested but vpx/vpx_decoder.h not found]))
-        AC_CHECK_LIB(vpx, vpx_codec_dec_init_ver,
-                     [MOZ_NATIVE_LIBVPX_DEC_TEST=1],
-                     ([--with-system-libvpx requested but symbol vpx_codec_dec_init_ver not found]))
-        if test -n "$MOZ_NATIVE_LIBVPX_DEC_TEST" ; then
-            AC_MSG_CHECKING([for libvpx version >= v1.0.0])
-            dnl We need at least v1.0.0 to fix several crash bugs (for which we
-            dnl had local patches prior to v1.0.0).
-            dnl
-            dnl This is a terrible test for the library version, but we don't
-            dnl have a good one. There is no version number in a public header,
-            dnl and testing the headers still doesn't guarantee we link against
-            dnl the right version. While we could call vpx_codec_version() at
-            dnl run-time, that would break cross-compiling. There are no
-            dnl additional exported decoder symbols between the v1.0.0 release
-            dnl and the v0.9.7 one to check for.
-            AC_TRY_COMPILE([
-                #include <vpx/vpx_decoder.h>
-                #if !defined(VPX_CODEC_USE_INPUT_FRAGMENTS)
-                    #error "test failed."
-                #endif
-                ],
-                [return 0;],
-                [AC_MSG_RESULT([yes])
-                 MOZ_NATIVE_LIBVPX=1
-                 AC_DEFINE(MOZ_NATIVE_LIBVPX)
-                 MOZ_LIBVPX_INCLUDES="-I${LIBVPX_DIR}/include"
-                 MOZ_LIBVPX_LIBS="-L${LIBVPX_DIR}/lib -lvpx"],
-                [AC_MSG_RESULT([no])
-                 AC_MSG_ERROR([--with-system-libvpx requested but it is not v1.0.0 or later])])
-        fi
-        CFLAGS=$_SAVE_CFLAGS
-        LDFLAGS=$_SAVE_LDFLAGS
-        LIBS=$_SAVE_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(LIBVPX, vpx >= 1.0.0)
+
+        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.])])
+
+        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])])
     fi
 fi
 
 AC_SUBST(MOZ_NATIVE_LIBVPX)
 AC_SUBST(MOZ_LIBVPX_INCLUDES)
 AC_SUBST(MOZ_LIBVPX_LIBS)
 
 if test -n "$MOZ_WEBM" -a -z "$MOZ_NATIVE_LIBVPX"; then