From f808f70c938a5d764e474014b73fdb625c80eaff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sl=C3=A1vek=20Banko?= Date: Fri, 9 Jul 2021 02:07:32 +0200 Subject: Fix check of OpenEXR >= 3.0 library. Add check if OpenEXR needs explicit C++ standard. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Slávek Banko --- configure.ac | 53 ++++++++++++++++++++++++++++++++---------- kernel/kls_openexr/Makefile.am | 4 ++-- 2 files changed, 43 insertions(+), 14 deletions(-) diff --git a/configure.ac b/configure.ac index 6411b9c..43fd881 100644 --- a/configure.ac +++ b/configure.ac @@ -415,7 +415,8 @@ fi # OPENEXR if test $sq_codec_openexr = yes; then -PKG_CHECK_MODULES([OpenEXR], OpenEXR, [ +PKG_CHECK_MODULES([OpenEXR], OpenEXR, + [ SQ_EXR_CFLAGS=$OpenEXR_CFLAGS SQ_EXR_LDFLAGS=$OpenEXR_LIBS @@ -424,25 +425,53 @@ PKG_CHECK_MODULES([OpenEXR], OpenEXR, [ CPPFLAGS="$SQ_EXR_CFLAGS $CPPFLAGS $USE_EXCEPTIONS" LDFLAGS="$LDFLAGS $SQ_EXR_LDFLAGS" + BASE_CPPFLAGS="$CPPFLAGS" AC_LANG_SAVE AC_LANG_CPLUSPLUS - AC_CHECK_HEADERS([OpenEXR/ImfRgbaFile.h], [ - AC_CHECK_LIB([IlmImf], [ImfInputFileName], [ - sq_have_openexr="yes" - AC_SUBST(SQ_EXR_CFLAGS) - AC_SUBST(SQ_EXR_LDFLAGS) - ], [sq_have_openexr="no" missing OpenEXR libopenexr]) - ], - [sq_have_openexr="no" missing OpenEXR libopenexr]) - + AC_CHECK_HEADERS([OpenEXR/ImfRgbaFile.h], + [sq_have_openexr_headers="yes"], + [ + for CXX_STD_TEST in 11 14 17; do + AC_MSG_CHECKING([OpenEXR build with C++$CXX_STD_TEST]) + CPPFLAGS="$BASE_CPPFLAGS -std=c++$CXX_STD_TEST" + $as_unset ac_cv_header_OpenEXR_ImfRgbaFile_h + AC_CHECK_HEADERS([OpenEXR/ImfRgbaFile.h], + [ + sq_have_openexr_headers="yes" + SQ_EXR_CFLAGS+=" -std=c++$CXX_STD_TEST" + ], + [sq_have_openexr="no" missing OpenEXR libopenexr]) + if test x$sq_have_openexr_headers = xyes; then + break + fi + done + ]) + if test x$sq_have_openexr_headers = xyes; then + AC_CHECK_LIB([OpenEXR], [ImfInputFileName], + [ + sq_have_openexr="yes" + AC_SUBST(SQ_EXR_CFLAGS) + AC_SUBST(SQ_EXR_LDFLAGS) + ], + [ + AC_CHECK_LIB([IlmImf], [ImfInputFileName], + [ + sq_have_openexr="yes" + AC_SUBST(SQ_EXR_CFLAGS) + AC_SUBST(SQ_EXR_LDFLAGS) + ], + [sq_have_openexr="no" missing OpenEXR libopenexr]) + ]) + fi + AC_LANG_RESTORE CPPFLAGS=$_cppflags LDFLAGS=$_ldflags - ], - [sq_have_openexr="no" missing OpenEXR libopenexr]) + ], + [sq_have_openexr="no" missing OpenEXR libopenexr]) fi _cppflags=$CPPFLAGS diff --git a/kernel/kls_openexr/Makefile.am b/kernel/kls_openexr/Makefile.am index debce0e..15c16e0 100644 --- a/kernel/kls_openexr/Makefile.am +++ b/kernel/kls_openexr/Makefile.am @@ -1,6 +1,6 @@ -CXXFLAGS = @CXXFLAGS@ -fexceptions +CXXFLAGS = @CXXFLAGS@ -fexceptions @SQ_EXR_CFLAGS@ -INCLUDES = -I../include @SQ_EXR_CFLAGS@ +INCLUDES = -I../include pkglib_LTLIBRARIES = libkls_openexr.la -- cgit v1.2.1