Skip to content

Commit

Permalink
Support CharLS 2.1 on Debian as well. (OSGeo#3083)
Browse files Browse the repository at this point in the history
Upstream changed the library name without an SONAME bump,
this caused issues and was reverted in Debian, see

 https://bugs.debian.org/971425

The charls Debian package still uses the CharLS library name for 2.1.
  • Loading branch information
sebastic authored and rouault committed Oct 20, 2020
1 parent 2bb876b commit f30e5cb
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 0 deletions.
57 changes: 57 additions & 0 deletions gdal/configure
Original file line number Diff line number Diff line change
Expand Up @@ -30282,6 +30282,63 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
if test "$HAVE_CHARLS" = "yes"; then
LIBS="-lcharls $LIBS"
CHARLS_INC="-DCHARLS_2_1"
else
ac_ext=cpp
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu

{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for JpegLsDecode in -lCharLS" >&5
$as_echo_n "checking for JpegLsDecode in -lCharLS... " >&6; }
if ${ac_cv_lib_CharLS_JpegLsDecode+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lCharLS $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */

/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char JpegLsDecode ();
int
main ()
{
return JpegLsDecode ();
;
return 0;
}
_ACEOF
if ac_fn_cxx_try_link "$LINENO"; then :
ac_cv_lib_CharLS_JpegLsDecode=yes
else
ac_cv_lib_CharLS_JpegLsDecode=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_CharLS_JpegLsDecode" >&5
$as_echo "$ac_cv_lib_CharLS_JpegLsDecode" >&6; }
if test "x$ac_cv_lib_CharLS_JpegLsDecode" = xyes; then :
HAVE_CHARLS=yes
fi

ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu

if test "$HAVE_CHARLS" = "yes"; then
LIBS="-lCharLS $LIBS"
CHARLS_INC="-DCHARLS_2_1"
fi
fi
else
for ac_header in CharLS/interface.h
Expand Down
8 changes: 8 additions & 0 deletions gdal/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -2191,6 +2191,14 @@ if test "$with_charls" = "yes" -o "$with_charls" = "" ; then
if test "$HAVE_CHARLS" = "yes"; then
LIBS="-lcharls $LIBS"
CHARLS_INC="-DCHARLS_2_1"
else
AC_LANG_PUSH([C++])
AC_CHECK_LIB(CharLS,JpegLsDecode,HAVE_CHARLS=yes)
AC_LANG_POP([C++])
if test "$HAVE_CHARLS" = "yes"; then
LIBS="-lCharLS $LIBS"
CHARLS_INC="-DCHARLS_2_1"
fi
fi
else
dnl CharLS 1.x
Expand Down

0 comments on commit f30e5cb

Please sign in to comment.