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

Johannes Nixdorf mixi at shadowice.org
Mon Dec 17 15:20:48 CET 2012

On Sun, Dec 16, 2012 at 10:41:38PM +0000, Carl Eugen Hoyos wrote:
> Afair in the past two different locations were 
> possible depending on the chosen build system.
> (make and cmake installed the headers in different 
> locations.)

I just tested all combinations of version 1.5.0 and 1.5.1 with cmake and
autotools. They all install the header to
/usr/include/openjpeg-${major}.${minor}. 1.5.0 with autotools apparently
still creates a compatibility symlink. This behaviour is removed in
version 1.5.1.

> Ok (I did not know that my symlinks were added 
> by opensuse).

I only checked what openSUSE did with version 1.5.1 in factory.
Apparently the link I mentioned was created by openjpeg for older
versions. The other link (/usr/include/openjpeg) always comes from

> (The bug was that - in the past? - two locations for 
> openjpeg.h were possible with the original source package.)

The bug seems to be fixed and they seem to have decided not to provide

> $ ll /usr/include/openjpeg
> /usr/include/openjpeg -> openjpeg-1.5

Apparently openSUSE provided this link for openjpeg 1.5.0 and stopped
providing it for openjpeg 1.5.1, so I don't think anyone should rely on

> Then please check for /usr/include/openjpeg.h and 
> /usr/include/openjpeg-1.5/openjpeg.h

I'm fine with that solution, but I'm not sure how I need to set the
include path in configure if /usr/include/openjpeg-1.5/openjpeg.h is
found so I don't break any obscure configurations. Is using
add_cflags -I"$sysinclude"/openjpeg-1.5 enough or are there some obscure
cases where other include directories are considered? In case it is
enough the patch is included.

> I would expect that the pkg-config approach will brake some 
> mingw installations that currently work with openjpeg.

They continue to work as the old location is still searched for
compatibility with ancient openjpeg versions.

-------------- next part --------------
>From 03c3048ed598b6308a05032e4d7cf635ea3d171a 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 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/configure b/configure
index a50d073..f4da5bf 100755
--- a/configure
+++ b/configure
@@ -3837,7 +3837,10 @@ 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 &&
+                           add_cflags -I"$sysinclude"/openjpeg-1.5; } ||
+                         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

More information about the ffmpeg-devel mailing list