[FFmpeg-devel] [PATCH] configure: fix detection of libopenjpeg
Andreas Cadhalpun
andreas.cadhalpun at googlemail.com
Tue Oct 11 21:37:35 EEST 2016
Use check_lib2 to test the header together with the function. This is
necessary, because '-DOPJ_STATIC' changes what the included header does.
Also add '-DOPJ_STATIC' to CFLAGS, so that it isn't necessary to
hardcode this in libavcodec/libopenjpeg{dec,enc}.c.
Finally, check for non-static libopenjpeg, too.
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com>
---
configure | 9 ++++++---
libavcodec/libopenjpegdec.c | 2 --
libavcodec/libopenjpegenc.c | 2 --
3 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/configure b/configure
index 8fc71fb..ff743cb 100755
--- a/configure
+++ b/configure
@@ -5710,9 +5710,12 @@ enabled libopencv && { check_header opencv2/core/core_c.h &&
require opencv opencv2/core/core_c.h cvCreateImageHeader -lopencv_core -lopencv_imgproc; } ||
require_pkg_config opencv opencv/cxcore.h cvCreateImageHeader; }
enabled libopenh264 && require_pkg_config openh264 wels/codec_api.h WelsGetCodecVersion
-enabled libopenjpeg && { check_lib openjpeg-2.1/openjpeg.h opj_version -lopenjp2 -DOPJ_STATIC ||
- check_lib openjpeg-2.0/openjpeg.h opj_version -lopenjp2 -DOPJ_STATIC ||
- check_lib openjpeg-1.5/openjpeg.h opj_version -lopenjpeg -DOPJ_STATIC ||
+enabled libopenjpeg && { { check_lib2 openjpeg-2.1/openjpeg.h opj_version -lopenjp2 -DOPJ_STATIC && add_cflags -DOPJ_STATIC; } ||
+ check_lib2 openjpeg-2.1/openjpeg.h opj_version -lopenjp2 ||
+ { check_lib openjpeg-2.0/openjpeg.h opj_version -lopenjp2 -DOPJ_STATIC && add_cflags -DOPJ_STATIC; } ||
+ check_lib2 openjpeg-2.0/openjpeg.h opj_version -lopenjp2 ||
+ { check_lib openjpeg-1.5/openjpeg.h opj_version -lopenjpeg -DOPJ_STATIC && add_cflags -DOPJ_STATIC; } ||
+ check_lib2 openjpeg-1.5/openjpeg.h opj_version -lopenjpeg ||
check_lib openjpeg.h opj_version -lopenjpeg -DOPJ_STATIC ||
die "ERROR: libopenjpeg not found"; }
enabled libopenmpt && require_pkg_config "libopenmpt >= 0.2.6557" libopenmpt/libopenmpt.h openmpt_module_create
diff --git a/libavcodec/libopenjpegdec.c b/libavcodec/libopenjpegdec.c
index 65167e6..b4ce834 100644
--- a/libavcodec/libopenjpegdec.c
+++ b/libavcodec/libopenjpegdec.c
@@ -24,8 +24,6 @@
* JPEG 2000 decoder using libopenjpeg
*/
-#define OPJ_STATIC
-
#include "libavutil/common.h"
#include "libavutil/imgutils.h"
#include "libavutil/intreadwrite.h"
diff --git a/libavcodec/libopenjpegenc.c b/libavcodec/libopenjpegenc.c
index 1443551..5042507 100644
--- a/libavcodec/libopenjpegenc.c
+++ b/libavcodec/libopenjpegenc.c
@@ -24,8 +24,6 @@
* JPEG 2000 encoder using libopenjpeg
*/
-#define OPJ_STATIC
-
#include "libavutil/avassert.h"
#include "libavutil/common.h"
#include "libavutil/imgutils.h"
--
2.9.3
More information about the ffmpeg-devel
mailing list