From d0fddf4f684569172457eb904c001f1d71dfbb2c Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Mon, 2 Jul 2007 19:53:14 +0200 Subject: [PATCH] configure: Make the libjpeg soname check depend on the header check. --- configure | 160 +++++++++++++++++++++++--------------------- configure.ac | 7 +- dlls/gphoto2.ds/ds_image.c | 4 -- dlls/gphoto2.ds/gphoto2_i.h | 9 +-- dlls/oleaut32/olepicture.c | 11 ++- 5 files changed, 95 insertions(+), 96 deletions(-) diff --git a/configure b/configure index 97208d28ec5..f25fbe6b00a 100755 --- a/configure +++ b/configure @@ -13988,6 +13988,88 @@ fi fi +if test "$ac_cv_header_jpeglib_h" = "yes" +then + { echo "$as_me:$LINENO: checking for -ljpeg" >&5 +echo $ECHO_N "checking for -ljpeg... $ECHO_C" >&6; } +if test "${ac_cv_lib_soname_jpeg+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_soname_save_LIBS=$LIBS +LIBS="-ljpeg $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 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 jpeg_start_decompress (); +int +main () +{ +return jpeg_start_decompress (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + case "$LIBEXT" in + dll) ;; + dylib) ac_cv_lib_soname_jpeg=`otool -L conftest$ac_exeext | grep "libjpeg\\.[0-9A-Za-z.]*dylib" | sed -e "s/^.*\/\(libjpeg\.[0-9A-Za-z.]*dylib\).*$/\1/"';2,$d'` ;; + *) ac_cv_lib_soname_jpeg=`$ac_cv_path_LDD conftest$ac_exeext | grep "libjpeg\\.$LIBEXT" | sed -e "s/^.*\(libjpeg\.$LIBEXT[^ ]*\).*$/\1/"';2,$d'` ;; + esac +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext + LIBS=$ac_check_soname_save_LIBS +fi +if test "x$ac_cv_lib_soname_jpeg" = "x"; then + { echo "$as_me:$LINENO: result: not found" >&5 +echo "${ECHO_T}not found" >&6; } + +else + { echo "$as_me:$LINENO: result: $ac_cv_lib_soname_jpeg" >&5 +echo "${ECHO_T}$ac_cv_lib_soname_jpeg" >&6; } + +cat >>confdefs.h <<_ACEOF +#define SONAME_LIBJPEG "$ac_cv_lib_soname_jpeg" +_ACEOF + + +fi + +fi + EXTRACFLAGS="" @@ -15478,84 +15560,6 @@ _ACEOF fi -{ echo "$as_me:$LINENO: checking for -ljpeg" >&5 -echo $ECHO_N "checking for -ljpeg... $ECHO_C" >&6; } -if test "${ac_cv_lib_soname_jpeg+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_soname_save_LIBS=$LIBS -LIBS="-ljpeg $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 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 jpeg_start_decompress (); -int -main () -{ -return jpeg_start_decompress (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - case "$LIBEXT" in - dll) ;; - dylib) ac_cv_lib_soname_jpeg=`otool -L conftest$ac_exeext | grep "libjpeg\\.[0-9A-Za-z.]*dylib" | sed -e "s/^.*\/\(libjpeg\.[0-9A-Za-z.]*dylib\).*$/\1/"';2,$d'` ;; - *) ac_cv_lib_soname_jpeg=`$ac_cv_path_LDD conftest$ac_exeext | grep "libjpeg\\.$LIBEXT" | sed -e "s/^.*\(libjpeg\.$LIBEXT[^ ]*\).*$/\1/"';2,$d'` ;; - esac -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - -fi - -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext - LIBS=$ac_check_soname_save_LIBS -fi -if test "x$ac_cv_lib_soname_jpeg" = "x"; then - { echo "$as_me:$LINENO: result: not found" >&5 -echo "${ECHO_T}not found" >&6; } - -else - { echo "$as_me:$LINENO: result: $ac_cv_lib_soname_jpeg" >&5 -echo "${ECHO_T}$ac_cv_lib_soname_jpeg" >&6; } - -cat >>confdefs.h <<_ACEOF -#define SONAME_LIBJPEG "$ac_cv_lib_soname_jpeg" -_ACEOF - - -fi - diff --git a/configure.ac b/configure.ac index bd64583de9b..d4e4f12e2e4 100644 --- a/configure.ac +++ b/configure.ac @@ -992,6 +992,12 @@ then WINE_CHECK_SONAME(crypto,BIO_new_socket) fi +dnl **** Check for libjpeg **** +if test "$ac_cv_header_jpeglib_h" = "yes" +then + WINE_CHECK_SONAME(jpeg,jpeg_start_decompress) +fi + dnl **** Check for gcc specific options **** AC_SUBST(EXTRACFLAGS,"") @@ -1140,7 +1146,6 @@ WINE_CHECK_SONAME(Xcursor,XcursorImageLoadCursor,,,[$X_LIBS -lX11 $X_EXTRA_LIBS] WINE_CHECK_SONAME(freetype,FT_Init_FreeType,,,[$X_LIBS]) WINE_CHECK_SONAME(GL,glXQueryExtension,,,[$X_LIBS $X_EXTRA_LIBS]) WINE_CHECK_SONAME(txc_dxtn,fetch_2d_texel_rgba_dxt1) -WINE_CHECK_SONAME(jpeg,jpeg_start_decompress) dnl **** Check for functions **** diff --git a/dlls/gphoto2.ds/ds_image.c b/dlls/gphoto2.ds/ds_image.c index e59c9783d37..41968134925 100644 --- a/dlls/gphoto2.ds/ds_image.c +++ b/dlls/gphoto2.ds/ds_image.c @@ -47,10 +47,6 @@ MAKE_FUNCPTR(jpeg_finish_decompress); MAKE_FUNCPTR(jpeg_destroy_decompress); #undef MAKE_FUNCPTR -#ifndef SONAME_LIBJPEG -#define SONAME_LIBJPEG "libjpeg" SONAME_EXT -#endif - static void *load_libjpeg(void) { if((libjpeg_handle = wine_dlopen(SONAME_LIBJPEG, RTLD_NOW, NULL, 0)) != NULL) { diff --git a/dlls/gphoto2.ds/gphoto2_i.h b/dlls/gphoto2.ds/gphoto2_i.h index 7167171a3db..265da491ed5 100644 --- a/dlls/gphoto2.ds/gphoto2_i.h +++ b/dlls/gphoto2.ds/gphoto2_i.h @@ -24,7 +24,7 @@ # error You must include config.h first #endif -#if defined(HAVE_GPHOTO2) && !defined(HAVE_JPEGLIB_H) +#if defined(HAVE_GPHOTO2) && !defined(SONAME_LIBJPEG) # warning "gphoto2 support in twain needs jpeg development headers" # undef HAVE_GPHOTO2 #endif @@ -38,7 +38,7 @@ #include -#ifdef HAVE_JPEGLIB_H +#ifdef SONAME_LIBJPEG /* This is a hack, so jpeglib.h does not redefine INT32 and the like*/ # define XMD_H # define UINT8 JPEG_UINT8 @@ -46,9 +46,6 @@ # undef FAR # include # undef UINT16 -# ifndef SONAME_LIBJPEG -# define SONAME_LIBJPEG "libjpeg" SONAME_EXT -# endif #endif #include @@ -96,7 +93,7 @@ struct tagActiveDS #ifdef HAVE_GPHOTO2 CameraFile *file; #endif -#ifdef HAVE_JPEGLIB_H +#ifdef SONAME_LIBJPEG struct jpeg_source_mgr xjsm; struct jpeg_decompress_struct jd; struct jpeg_error_mgr jerr; diff --git a/dlls/oleaut32/olepicture.c b/dlls/oleaut32/olepicture.c index c2f32e4ea90..3fb561154d0 100644 --- a/dlls/oleaut32/olepicture.c +++ b/dlls/oleaut32/olepicture.c @@ -67,7 +67,7 @@ #include "wine/wingdi16.h" -#ifdef HAVE_JPEGLIB_H +#ifdef SONAME_LIBJPEG /* This is a hack, so jpeglib.h does not redefine INT32 and the like*/ #define XMD_H #define UINT8 JPEG_UINT8 @@ -77,9 +77,6 @@ # include #undef jpeg_boolean #undef UINT16 -#ifndef SONAME_LIBJPEG -#define SONAME_LIBJPEG "libjpeg" SONAME_EXT -#endif #endif #include "ungif.h" @@ -937,7 +934,7 @@ static HRESULT WINAPI OLEPictureImpl_IsDirty( return E_NOTIMPL; } -#ifdef HAVE_JPEGLIB_H +#ifdef SONAME_LIBJPEG static void *libjpeg_handle; #define MAKE_FUNCPTR(f) static typeof(f) * p##f @@ -991,7 +988,7 @@ static boolean _jpeg_resync_to_restart(j_decompress_ptr cinfo, int desired) { return FALSE; } static void _jpeg_term_source(j_decompress_ptr cinfo) { } -#endif /* HAVE_JPEGLIB_H */ +#endif /* SONAME_LIBJPEG */ struct gifdata { unsigned char *data; @@ -1210,7 +1207,7 @@ static HRESULT OLEPictureImpl_LoadGif(OLEPictureImpl *This, BYTE *xbuf, ULONG xr static HRESULT OLEPictureImpl_LoadJpeg(OLEPictureImpl *This, BYTE *xbuf, ULONG xread) { -#ifdef HAVE_JPEGLIB_H +#ifdef SONAME_LIBJPEG struct jpeg_decompress_struct jd; struct jpeg_error_mgr jerr; int ret; -- 2.11.4.GIT