[FFmpeg-devel] [PATCH] configure: use pkg-config to check for libopenjpeg

Johannes Nixdorf mixi at shadowice.org
Sat Dec 22 11:47:37 CET 2012


On Sat, Dec 22, 2012 at 03:33:37AM +0100, Michael Niedermayer wrote:
> I think a solution similar to what is done for ioctl_meteor.h
> would be more robust unless i miss something

That sounds like a better approach. Here is the patch doing it that way.

-------------- next part --------------
>From 9ff88c35546429b0efab488a83131944bd4ccc7b Mon Sep 17 00:00:00 2001
From: Johannes Nixdorf <mixi at exherbo.org>
Date: Sun, 16 Dec 2012 16:02:08 +0100
Subject: [PATCH] configure: consider using /usr/include/openjpeg-1.5 when
 searching for openjpeg

Beginning with version 1.5.1 openjpeg defaults to install its headers to
/usr/include/openjpeg-${major}.${minor} instead of /usr/include without
providing a compatibility symlink making the old test fail.
---
 configure                   | 5 ++++-
 libavcodec/libopenjpegdec.c | 7 ++++++-
 libavcodec/libopenjpegenc.c | 7 ++++++-
 3 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/configure b/configure
index da6e511..b90ae6e 100755
--- a/configure
+++ b/configure
@@ -1406,6 +1406,7 @@ HAVE_LIST="
     mprotect
     msvcrt
     nanosleep
+    openjpeg_1_5_openjpeg_h
     PeekNamedPipe
     perl
     pod2man
@@ -3843,7 +3844,9 @@ enabled libnut     && require  libnut libnut.h nut_demuxer_init -lnut
 enabled libopencore_amrnb  && require libopencore_amrnb opencore-amrnb/interf_dec.h Decoder_Interface_init -lopencore-amrnb
 enabled libopencore_amrwb  && require libopencore_amrwb opencore-amrwb/dec_if.h D_IF_init -lopencore-amrwb
 enabled libopencv  && require_pkg_config opencv opencv/cxcore.h cvCreateImageHeader
-enabled libopenjpeg && require libopenjpeg openjpeg.h opj_version -lopenjpeg
+enabled libopenjpeg && { check_lib openjpeg-1.5/openjpeg.h opj_version -lopenjpeg ||
+                         check_lib openjpeg.h opj_version -lopenjpeg ||
+                         die "ERROR: libopenjpeg not found"; }
 enabled libopus    && require_pkg_config opus opus_multistream.h opus_multistream_decoder_create
 enabled libpulse && require_pkg_config libpulse-simple pulse/simple.h pa_simple_new
 enabled librtmp    && require_pkg_config librtmp librtmp/rtmp.h RTMP_Socket
diff --git a/libavcodec/libopenjpegdec.c b/libavcodec/libopenjpegdec.c
index 826a16f..eeb3dd6 100644
--- a/libavcodec/libopenjpegdec.c
+++ b/libavcodec/libopenjpegdec.c
@@ -25,7 +25,6 @@
  */
 
 #define  OPJ_STATIC
-#include <openjpeg.h>
 
 #include "libavutil/common.h"
 #include "libavutil/intreadwrite.h"
@@ -35,6 +34,12 @@
 #include "avcodec.h"
 #include "thread.h"
 
+#if HAVE_OPENJPEG_1_5_OPENJPEG_H
+# include <openjpeg-1.5/openjpeg.h>
+#else
+# include <openjpeg.h>
+#endif
+
 #define JP2_SIG_TYPE    0x6A502020
 #define JP2_SIG_VALUE   0x0D0A870A
 
diff --git a/libavcodec/libopenjpegenc.c b/libavcodec/libopenjpegenc.c
index b87d4d4..13e8ef9 100644
--- a/libavcodec/libopenjpegenc.c
+++ b/libavcodec/libopenjpegenc.c
@@ -25,7 +25,6 @@
  */
 
 #define  OPJ_STATIC
-#include <openjpeg.h>
 
 #include "libavutil/avassert.h"
 #include "libavutil/common.h"
@@ -35,6 +34,12 @@
 #include "avcodec.h"
 #include "internal.h"
 
+#if HAVE_OPENJPEG_1_5_OPENJPEG_H
+# include <openjpeg-1.5/openjpeg.h>
+#else
+# include <openjpeg.h>
+#endif
+
 typedef struct {
     AVClass *avclass;
     opj_image_t *image;
-- 
1.8.0.1



More information about the ffmpeg-devel mailing list