From d3447022e103a340087ecf7893be79a023e0452c Mon Sep 17 00:00:00 2001 From: Hans Leidekker Date: Fri, 15 Jul 2005 10:09:43 +0000 Subject: [PATCH] Link directly to liblcms. Fix typo in test. --- configure | 155 +++++++++++++++++++------------------ configure.ac | 10 ++- dlls/mscms/Makefile.in | 1 + dlls/mscms/icc.c | 4 +- dlls/mscms/lcms_api.h | 47 ----------- dlls/mscms/mscms_main.c | 87 +-------------------- dlls/mscms/profile.c | 4 +- dlls/mscms/tests/profile.c | 2 +- dlls/mscms/transform.c | 4 +- include/config.h.in | 6 +- 10 files changed, 98 insertions(+), 222 deletions(-) delete mode 100644 dlls/mscms/lcms_api.h diff --git a/configure b/configure index 3b2ee76dad5..cc6018c18cf 100755 --- a/configure +++ b/configure @@ -311,7 +311,7 @@ ac_includes_default="\ # include #endif" -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS DLLDEFS build build_cpu build_vendor build_os host host_cpu host_vendor host_os WIN16_FILES WIN16_INSTALL SET_MAKE CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CXX CXXFLAGS ac_ct_CXX CPPBIN ac_ct_CPPBIN TOOLSDIR CPP X_CFLAGS X_PRE_LIBS X_LIBS X_EXTRA_LIBS LEX LEXLIB LEX_OUTPUT_ROOT XLEX BISON AS ac_ct_AS LD ac_ct_LD AR ac_ct_AR RANLIB ac_ct_RANLIB STRIP ac_ct_STRIP WINDRES ac_ct_WINDRES LN_S LN EGREP LDCONFIG INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LINT LINTFLAGS FONTFORGE LIBPTHREAD XLIB XFILES OPENGLFILES GLU32FILES OPENGL_LIBS GLUT_LIBS GLUT32FILES NASLIBS CURSESLIBS sane_devel SANELIBS SANEINCL ICULIBS ft_devel ft_devel2 FREETYPELIBS FREETYPEINCL FONTSSUBDIRS ARTSCCONFIG ARTSLIBS ARTSINCL ALSALIBS AUDIOIOLIBS EXTRACFLAGS DLLEXT DLLFLAGS DLLIBS LDSHARED LDDLLFLAGS LIBEXT IMPLIBEXT DLLTOOL ac_ct_DLLTOOL DLLWRAP ac_ct_DLLWRAP LDEXECFLAGS LDLIBWINEFLAGS COREFOUNDATIONLIB IOKITLIB CROSSTEST CROSSCC CROSSWINDRES LDPATH CRTLIBS SOCKETLIBS WINE_BINARIES MAIN_BINARY LDD ALLOCA LIBOBJS LTLIBOBJS' +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS DLLDEFS build build_cpu build_vendor build_os host host_cpu host_vendor host_os WIN16_FILES WIN16_INSTALL SET_MAKE CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CXX CXXFLAGS ac_ct_CXX CPPBIN ac_ct_CPPBIN TOOLSDIR CPP X_CFLAGS X_PRE_LIBS X_LIBS X_EXTRA_LIBS LEX LEXLIB LEX_OUTPUT_ROOT XLEX BISON AS ac_ct_AS LD ac_ct_LD AR ac_ct_AR RANLIB ac_ct_RANLIB STRIP ac_ct_STRIP WINDRES ac_ct_WINDRES LN_S LN EGREP LDCONFIG INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LINT LINTFLAGS FONTFORGE LIBPTHREAD XLIB XFILES OPENGLFILES GLU32FILES OPENGL_LIBS GLUT_LIBS GLUT32FILES NASLIBS CURSESLIBS sane_devel SANELIBS SANEINCL ICULIBS LCMSLIBS ft_devel ft_devel2 FREETYPELIBS FREETYPEINCL FONTSSUBDIRS ARTSCCONFIG ARTSLIBS ARTSINCL ALSALIBS AUDIOIOLIBS EXTRACFLAGS DLLEXT DLLFLAGS DLLIBS LDSHARED LDDLLFLAGS LIBEXT IMPLIBEXT DLLTOOL ac_ct_DLLTOOL DLLWRAP ac_ct_DLLWRAP LDEXECFLAGS LDLIBWINEFLAGS COREFOUNDATIONLIB IOKITLIB CROSSTEST CROSSCC CROSSWINDRES LDPATH CRTLIBS SOCKETLIBS WINE_BINARIES MAIN_BINARY LDD ALLOCA LIBOBJS LTLIBOBJS' ac_subst_files='MAKE_RULES MAKE_DLL_RULES MAKE_TEST_RULES MAKE_LIB_RULES MAKE_PROG_RULES' # Initialize some variables set by options. @@ -9876,6 +9876,84 @@ rm -f conftest.err conftest.$ac_objext \ LIBS="$saved_libs" fi +LCMSLIBS="" + +if test "$ac_cv_header_lcms_h" = "yes" -o "$ac_cv_header_lcms_lcms_h" = "yes" +then + echo "$as_me:$LINENO: checking for cmsOpenProfileFromFile in -llcms" >&5 +echo $ECHO_N "checking for cmsOpenProfileFromFile in -llcms... $ECHO_C" >&6 +if test "${ac_cv_lib_lcms_cmsOpenProfileFromFile+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-llcms $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char cmsOpenProfileFromFile (); +int +main () +{ +cmsOpenProfileFromFile (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_lcms_cmsOpenProfileFromFile=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_lcms_cmsOpenProfileFromFile=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_lcms_cmsOpenProfileFromFile" >&5 +echo "${ECHO_T}$ac_cv_lib_lcms_cmsOpenProfileFromFile" >&6 +if test $ac_cv_lib_lcms_cmsOpenProfileFromFile = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_LCMS 1 +_ACEOF + + LCMSLIBS="-llcms" +fi + +fi + echo "$as_me:$LINENO: checking for FT_Init_FreeType in -lfreetype" >&5 echo $ECHO_N "checking for FT_Init_FreeType in -lfreetype... $ECHO_C" >&6 if test "${ac_cv_lib_freetype_FT_Init_FreeType+set}" = set; then @@ -15341,80 +15419,6 @@ cat >>confdefs.h <<_ACEOF _ACEOF fi -echo "$as_me:$LINENO: checking for -llcms soname" >&5 -echo $ECHO_N "checking for -llcms soname... $ECHO_C" >&6 -if test "${ac_cv_lib_soname_lcms+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_get_soname_save_LIBS=$LIBS -LIBS="-llcms $LIBS" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char cmsOpenProfileFromFile (); -int -main () -{ -cmsOpenProfileFromFile (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_soname_lcms=`$ac_cv_path_LDD conftest$ac_exeext | grep liblcms\\.$LIBEXT | sed "s/^.*\(liblcms\.$LIBEXT[^ ]*\).*$/\1/"` - if test "x$ac_cv_lib_soname_lcms" = "x" - then - ac_cv_lib_soname_lcms="liblcms.$LIBEXT" - fi -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_soname_lcms="liblcms.$LIBEXT" -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - LIBS=$ac_get_soname_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_soname_lcms" >&5 -echo "${ECHO_T}$ac_cv_lib_soname_lcms" >&6 -if test "x$ac_cv_lib_soname_lcms" != xNONE -then -cat >>confdefs.h <<_ACEOF -#define SONAME_LIBLCMS "$ac_cv_lib_soname_lcms" -_ACEOF -fi - echo "$as_me:$LINENO: checking for -lcapi20 soname" >&5 echo $ECHO_N "checking for -lcapi20 soname... $ECHO_C" >&6 if test "${ac_cv_lib_soname_capi20+set}" = set; then @@ -21010,6 +21014,7 @@ s,@sane_devel@,$sane_devel,;t t s,@SANELIBS@,$SANELIBS,;t t s,@SANEINCL@,$SANEINCL,;t t s,@ICULIBS@,$ICULIBS,;t t +s,@LCMSLIBS@,$LCMSLIBS,;t t s,@ft_devel@,$ft_devel,;t t s,@ft_devel2@,$ft_devel2,;t t s,@FREETYPELIBS@,$FREETYPELIBS,;t t diff --git a/configure.ac b/configure.ac index 93493e1d028..41108dab9c8 100644 --- a/configure.ac +++ b/configure.ac @@ -480,6 +480,15 @@ then LIBS="$saved_libs" fi +dnl **** Check for LittleCMS *** +AC_SUBST(LCMSLIBS,"") +if test "$ac_cv_header_lcms_h" = "yes" -o "$ac_cv_header_lcms_lcms_h" = "yes" +then + AC_CHECK_LIB(lcms, cmsOpenProfileFromFile, + [AC_DEFINE(HAVE_LCMS, 1, [Define if you have the LittleCMS development environment]) + LCMSLIBS="-llcms"]) +fi + dnl **** Check for FreeType 2 **** AC_CHECK_LIB(freetype,FT_Init_FreeType,ft_lib=yes,ft_lib=no,$X_LIBS) if test "$ft_lib" = "no" @@ -1092,7 +1101,6 @@ then WINE_GET_SONAME(jpeg,jpeg_start_decompress) WINE_GET_SONAME(ungif,DGifOpen) WINE_GET_SONAME(gif,DGifOpen) - WINE_GET_SONAME(lcms,cmsOpenProfileFromFile) WINE_GET_SONAME(capi20,capi20_isinstalled) fi diff --git a/dlls/mscms/Makefile.in b/dlls/mscms/Makefile.in index 714f3f7267f..9bec1b2336a 100644 --- a/dlls/mscms/Makefile.in +++ b/dlls/mscms/Makefile.in @@ -5,6 +5,7 @@ VPATH = @srcdir@ MODULE = mscms.dll IMPORTLIB = libmscms.$(IMPLIBEXT) IMPORTS = kernel32 ntdll +EXTRALIBS = @LCMSLIBS@ C_SRCS = \ handle.c \ diff --git a/dlls/mscms/icc.c b/dlls/mscms/icc.c index fcbe8eb2732..fe6f9014aff 100644 --- a/dlls/mscms/icc.c +++ b/dlls/mscms/icc.c @@ -32,9 +32,7 @@ #include "winternl.h" #include "icm.h" -#define LCMS_API_FUNCTION(f) extern typeof(f) * p##f; -#include "lcms_api.h" -#undef LCMS_API_FUNCTION +#include "mscms_priv.h" WINE_DEFAULT_DEBUG_CHANNEL(mscms); diff --git a/dlls/mscms/lcms_api.h b/dlls/mscms/lcms_api.h deleted file mode 100644 index 4f071ba307b..00000000000 --- a/dlls/mscms/lcms_api.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * MSCMS - Color Management System for Wine - * - * Copyright 2004, 2005 Hans Leidekker - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "mscms_priv.h" - -#ifndef LCMS_API_FUNCTION -#error "This file should be included with LCMS_API_FUNCTION defined!" -#endif - -#ifdef HAVE_LCMS_H - -LCMS_API_FUNCTION(cmsCloseProfile) -LCMS_API_FUNCTION(cmsCreate_sRGBProfile) -LCMS_API_FUNCTION(cmsCreateMultiprofileTransform) -LCMS_API_FUNCTION(cmsCreateTransform) -LCMS_API_FUNCTION(cmsDeleteTransform) -LCMS_API_FUNCTION(cmsDoTransform) -LCMS_API_FUNCTION(cmsOpenProfileFromMem) - -#ifndef LCMS_API_NO_REDEFINE -#define cmsCloseProfile pcmsCloseProfile -#define cmsCreate_sRGBProfile pcmsCreate_sRGBProfile -#define cmsCreateMultiprofileTransform pcmsCreateMultiprofileTransform -#define cmsCreateTransform pcmsCreateTransform -#define cmsDeleteTransform pcmsDeleteTransform -#define cmsDoTransform pcmsDoTransform -#define cmsOpenProfileFromMem pcmsOpenProfileFromMem -#endif /* LCMS_API_NO_REDEFINE */ - -#endif /* HAVE_LCMS_H */ diff --git a/dlls/mscms/mscms_main.c b/dlls/mscms/mscms_main.c index c2e460c669c..14a4c03af58 100644 --- a/dlls/mscms/mscms_main.c +++ b/dlls/mscms/mscms_main.c @@ -32,91 +32,8 @@ #include "winuser.h" #include "icm.h" -#define LCMS_API_NO_REDEFINE -#define LCMS_API_FUNCTION(f) typeof(f) * p##f; -#include "lcms_api.h" -#undef LCMS_API_FUNCTION - WINE_DEFAULT_DEBUG_CHANNEL(mscms); -#ifdef HAVE_LCMS_H -#ifndef SONAME_LIBLCMS -#define SONAME_LIBLCMS "liblcms.so" -#endif - -static void *lcmshandle = NULL; -#endif /* HAVE_LCMS_H */ - -static BOOL MSCMS_init_lcms(void) -{ -#ifdef HAVE_LCMS_H - /* dynamically load lcms if not yet loaded */ - if (!lcmshandle) - { - lcmshandle = wine_dlopen( SONAME_LIBLCMS, RTLD_NOW, NULL, 0 ); - - /* We can't really do anything useful without liblcms */ - if (!lcmshandle) - { - WINE_MESSAGE( - "Wine cannot find the LittleCMS library. To enable Wine to use color\n" - "management functions please install a version of LittleCMS greater\n" - "than or equal to 1.13.\n" - "http://www.littlecms.com\n" ); - - return FALSE; - } - } - -#define LOAD_FUNCPTR(f) \ - if ((p##f = wine_dlsym( lcmshandle, #f, NULL, 0 )) == NULL) \ - goto sym_not_found; - - LOAD_FUNCPTR(cmsCloseProfile); - LOAD_FUNCPTR(cmsCreate_sRGBProfile); - LOAD_FUNCPTR(cmsCreateMultiprofileTransform); - LOAD_FUNCPTR(cmsCreateTransform); - LOAD_FUNCPTR(cmsDeleteTransform); - LOAD_FUNCPTR(cmsDoTransform); - LOAD_FUNCPTR(cmsOpenProfileFromMem); - #undef LOAD_FUNCPTR - -return TRUE; - -sym_not_found: - WINE_MESSAGE( - "Wine cannot find certain functions that it needs inside the LittleCMS\n" - "library. To enable Wine to use LittleCMS for color management please\n" - "upgrade liblcms to at least version 1.13.\n" - "http://www.littlecms.com\n" ); - - wine_dlclose( lcmshandle, NULL, 0 ); - lcmshandle = NULL; - - return FALSE; - -#endif /* HAVE_LCMS_H */ - WINE_MESSAGE( - "This version of Wine was compiled without support for color management\n" - "functions. To enable Wine to use LittleCMS for color management please\n" - "install a liblcms development package version 1.13 or higher and rebuild\n" - "Wine.\n" - "http://www.littlecms.com\n" ); - - return FALSE; -} - -static void MSCMS_deinit_lcms(void) -{ -#ifdef HAVE_LCMS_H - if (lcmshandle) - { - wine_dlclose( lcmshandle, NULL, 0 ); - lcmshandle = NULL; - } -#endif /* HAVE_LCMS_H */ -} - BOOL WINAPI DllMain( HINSTANCE hinst, DWORD reason, LPVOID reserved ) { TRACE( "(%p, 0x%08lx, %p)\n", hinst, reason, reserved ); @@ -125,10 +42,8 @@ BOOL WINAPI DllMain( HINSTANCE hinst, DWORD reason, LPVOID reserved ) { case DLL_PROCESS_ATTACH: DisableThreadLibraryCalls( hinst ); - return MSCMS_init_lcms(); - + break; case DLL_PROCESS_DETACH: - MSCMS_deinit_lcms(); break; } return TRUE; diff --git a/dlls/mscms/profile.c b/dlls/mscms/profile.c index adcedd9132b..44cfb7d9de3 100644 --- a/dlls/mscms/profile.c +++ b/dlls/mscms/profile.c @@ -30,9 +30,7 @@ #include "winuser.h" #include "icm.h" -#define LCMS_API_FUNCTION(f) extern typeof(f) * p##f; -#include "lcms_api.h" -#undef LCMS_API_FUNCTION +#include "mscms_priv.h" #define IS_SEPARATOR(ch) ((ch) == '\\' || (ch) == '/') diff --git a/dlls/mscms/tests/profile.c b/dlls/mscms/tests/profile.c index 1ab07c12e40..b4eef19b4ea 100644 --- a/dlls/mscms/tests/profile.c +++ b/dlls/mscms/tests/profile.c @@ -1003,7 +1003,7 @@ START_TEST(profile) WCHAR profilefile1W[MAX_PATH], profilefile2W[MAX_PATH]; WCHAR fileW[MAX_PATH]; - hmscms = GetModuleHandleA( "mscms.dll" ); + hmscms = LoadLibraryA( "mscms.dll" ); if (!hmscms) return; if (!init_function_ptrs()) diff --git a/dlls/mscms/transform.c b/dlls/mscms/transform.c index ab928172f96..9a50f095ea0 100644 --- a/dlls/mscms/transform.c +++ b/dlls/mscms/transform.c @@ -30,9 +30,7 @@ #include "winuser.h" #include "icm.h" -#define LCMS_API_FUNCTION(f) extern typeof(f) * p##f; -#include "lcms_api.h" -#undef LCMS_API_FUNCTION +#include "mscms_priv.h" WINE_DEFAULT_DEBUG_CHANNEL(mscms); diff --git a/include/config.h.in b/include/config.h.in index beccaba7ba5..fa3a4b9f480 100644 --- a/include/config.h.in +++ b/include/config.h.in @@ -245,6 +245,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_JPEGLIB_H +/* Define if you have the LittleCMS development environment */ +#undef HAVE_LCMS + /* Define to 1 if you have the header file. */ #undef HAVE_LCMS_H @@ -896,9 +899,6 @@ /* Define to the soname of the libjpeg library. */ #undef SONAME_LIBJPEG -/* Define to the soname of the liblcms library. */ -#undef SONAME_LIBLCMS - /* Define to the soname of the libncurses library. */ #undef SONAME_LIBNCURSES