From 87d533f7af3c59c9ddcf30d8c2ff7cec40d5a73f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sl=C3=A1vek=20Banko?= Date: Wed, 8 Oct 2014 15:29:02 +0200 Subject: Add support for lcms2 --- libkdcraw/configure.in.in | 53 +++++++++++++++++++----------- libkdcraw/dcraw/dcraw.c | 5 ++- libkdcraw/libraw/internal/dcraw_fileio.cpp | 2 ++ libkdcraw/libraw/internal/defines.h | 3 +- 4 files changed, 42 insertions(+), 21 deletions(-) diff --git a/libkdcraw/configure.in.in b/libkdcraw/configure.in.in index 4fb215f..5d16b42 100644 --- a/libkdcraw/configure.in.in +++ b/libkdcraw/configure.in.in @@ -19,30 +19,31 @@ AM_PROG_CC_C_O # ----------------------------------------------------------------- have_lcms_header='no' -KDE_CHECK_HEADER(lcms/lcms.h,have_lcms_header='yes',,) -if test "$have_lcms_header" = 'yes' -then - AC_DEFINE(LCMS_HEADER, , [The correct header]) +KDE_CHECK_HEADER(lcms2.h,have_lcms2_header='yes',,) +if test "$have_lcms2_header" = 'yes'; then + AC_DEFINE(LCMS_HEADER, , [LCMS header]) else # Alternative! Debian does it this way... KDE_CHECK_HEADER(lcms.h,have_lcms_header='yes',,) - if test "$have_lcms_header" = 'yes' - then - AC_DEFINE(LCMS_HEADER, , [The correct header]) + if test "$have_lcms_header" = 'yes'; then + AC_DEFINE(LCMS_HEADER, , [LCMS header]) + else + KDE_CHECK_HEADER(lcms/lcms.h,have_lcms_header='yes',,) + if test "$have_lcms_header" = 'yes'; then + AC_DEFINE(LCMS_HEADER, , [LCMS header]) + fi fi fi LCMS_LIBS='' have_lcms='no' -if test "$have_lcms_header" = 'yes' -then - saved_cflags="$CFLAGS" - saved_ldflags="$LDFLAGS" - saved_libs=$LIBS - LIBS="$LIBS -llcms" - CFLAGS="$CFLAGS $all_includes -I/usr/include/tqt" - LDFLAGS="$LDFLAGS $all_libraries" - +saved_libs=$LIBS +saved_cflags="$CFLAGS" +saved_ldflags="$LDFLAGS" +CFLAGS="$CFLAGS $all_includes -I/usr/include/tqt" +LDFLAGS="$LDFLAGS $all_libraries" +if test "$have_lcms2_header" = 'yes'; then + LIBS="$LIBS -llcms2" AC_TRY_LINK([ #define inline __inline /* gcc is in ansi mode */ #include LCMS_HEADER @@ -51,12 +52,26 @@ choke! #endif ], [ cmsOpenProfileFromFile("foo", "r"); +], + [LCMS_LIBS='-llcms2'; have_lcms='yes']) +else + if test "$have_lcms_header" = 'yes'; then + LIBS="$LIBS -llcms" + AC_TRY_LINK([ +#define inline __inline /* gcc is in ansi mode */ +#include LCMS_HEADER +#if LCMS_VERSION < 112 +choke! +#endif +], [ +cmsOpenProfileFromFile("foo", "r"); ], [LCMS_LIBS='-llcms'; have_lcms='yes']) - LIBS=$saved_libs - CFLAGS=$saved_cflags - LDFLAGS=$saved_ldflags + fi fi +LIBS=$saved_libs +CFLAGS=$saved_cflags +LDFLAGS=$saved_ldflags if test -z "$LCMS_LIBS"; then DO_NOT_COMPILE="$DO_NOT_COMPILE libkdcraw" diff --git a/libkdcraw/dcraw/dcraw.c b/libkdcraw/dcraw/dcraw.c index fdca9da..2b55333 100644 --- a/libkdcraw/dcraw/dcraw.c +++ b/libkdcraw/dcraw/dcraw.c @@ -43,11 +43,12 @@ NO_JPEG disables decoding of compressed Kodak DC120 files. NO_LCMS disables the "-p" option. */ +#include "config.h" #ifndef NO_JPEG #include #endif #ifndef NO_LCMS -#include +#include LCMS_HEADER #endif #ifdef LOCALEDIR #include @@ -7671,7 +7672,9 @@ void CLASS apply_profile (char *input, char *output) FILE *fp; unsigned size; +#if LCMS_VERSION < 2000 cmsErrorAction (LCMS_ERROR_SHOW); +#endif if (strcmp (input, "embed")) hInProfile = cmsOpenProfileFromFile (input, "r"); else if (profile_length) { diff --git a/libkdcraw/libraw/internal/dcraw_fileio.cpp b/libkdcraw/libraw/internal/dcraw_fileio.cpp index 926009a..3dc44ec 100644 --- a/libkdcraw/libraw/internal/dcraw_fileio.cpp +++ b/libkdcraw/libraw/internal/dcraw_fileio.cpp @@ -133,7 +133,9 @@ void CLASS apply_profile (char *input, char *output) FILE *fp; unsigned size; +#if LCMS_VERSION < 2000 cmsErrorAction (LCMS_ERROR_SHOW); +#endif if (strcmp (input, "embed")) hInProfile = cmsOpenProfileFromFile (input, "r"); else if (profile_length) { diff --git a/libkdcraw/libraw/internal/defines.h b/libkdcraw/libraw/internal/defines.h index ca5038e..462874a 100644 --- a/libkdcraw/libraw/internal/defines.h +++ b/libkdcraw/libraw/internal/defines.h @@ -29,11 +29,12 @@ NO_JPEG disables decoding of compressed Kodak DC120 files. NO_LCMS disables the "-p" option. */ +#include "config.h" #ifndef NO_JPEG #include #endif #ifndef NO_LCMS -#include +#include LCMS_HEADER #endif #ifdef LOCALEDIR #include -- cgit v1.2.1