Commit 8f70855f authored by Alexandre Julliard's avatar Alexandre Julliard

gphoto2.ds: Use the bundled libjpeg and build with msvcrt.

parent bbfbfd08
......@@ -637,8 +637,6 @@ VKD3D_CFLAGS
NETAPI_LIBS
NETAPI_CFLAGS
PROCSTAT_LIBS
JPEG_LIBS
JPEG_CFLAGS
GSSAPI_LIBS
GSSAPI_CFLAGS
KRB5_LIBS
......@@ -867,7 +865,6 @@ with_gssapi
with_gstreamer
with_hal
with_inotify
with_jpeg
with_krb5
with_ldap
with_mingw
......@@ -1990,8 +1987,6 @@ KRB5_CFLAGS
KRB5_LIBS
GSSAPI_CFLAGS
GSSAPI_LIBS
JPEG_CFLAGS
JPEG_LIBS
NETAPI_CFLAGS
NETAPI_LIBS
VKD3D_CFLAGS
......@@ -2658,7 +2653,6 @@ Optional Packages:
--without-gstreamer do not use GStreamer (codecs support)
--without-hal do not use HAL (dynamic device support)
--without-inotify do not use inotify (filesystem change notifications)
--without-jpeg do not use JPEG
--without-krb5 do not use krb5 (Kerberos)
--without-ldap do not use LDAP
--without-mingw do not use the MinGW cross-compiler
......@@ -2814,8 +2808,6 @@ Some influential environment variables:
GSSAPI_CFLAGS
C compiler flags for krb5-gssapi, overriding pkg-config
GSSAPI_LIBS Linker flags for krb5-gssapi, overriding pkg-config
JPEG_CFLAGS C compiler flags for libjpeg, overriding pkg-config
JPEG_LIBS Linker flags for libjpeg, overriding pkg-config
NETAPI_CFLAGS
C compiler flags for netapi, overriding pkg-config
NETAPI_LIBS Linker flags for netapi, overriding pkg-config
......@@ -4098,12 +4090,6 @@ if test "${with_inotify+set}" = set; then :
fi
# Check whether --with-jpeg was given.
if test "${with_jpeg+set}" = set; then :
withval=$with_jpeg;
fi
# Check whether --with-krb5 was given.
if test "${with_krb5+set}" = set; then :
withval=$with_krb5;
......@@ -15116,110 +15102,6 @@ esac
fi
if test "x$with_jpeg" != "xno"
then
if ${JPEG_CFLAGS:+false} :; then :
if ${PKG_CONFIG+:} false; then :
JPEG_CFLAGS=`$PKG_CONFIG --cflags libjpeg 2>/dev/null`
fi
fi
if ${JPEG_LIBS:+false} :; then :
if ${PKG_CONFIG+:} false; then :
JPEG_LIBS=`$PKG_CONFIG --libs libjpeg 2>/dev/null`
fi
fi
$as_echo "$as_me:${as_lineno-$LINENO}: libjpeg cflags: $JPEG_CFLAGS" >&5
$as_echo "$as_me:${as_lineno-$LINENO}: libjpeg libs: $JPEG_LIBS" >&5
ac_save_CPPFLAGS=$CPPFLAGS
CPPFLAGS="$CPPFLAGS $JPEG_CFLAGS"
for ac_header in jpeglib.h
do :
ac_fn_c_check_header_mongrel "$LINENO" "jpeglib.h" "ac_cv_header_jpeglib_h" "$ac_includes_default"
if test "x$ac_cv_header_jpeglib_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_JPEGLIB_H 1
_ACEOF
fi
done
if test "$ac_cv_header_jpeglib_h" = "yes"
then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for -ljpeg" >&5
$as_echo_n "checking for -ljpeg... " >&6; }
if ${ac_cv_lib_soname_jpeg+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_soname_save_LIBS=$LIBS
LIBS="-ljpeg $JPEG_LIBS $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 jpeg_start_decompress ();
int
main ()
{
return jpeg_start_decompress ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
case "$LIBEXT" in
dll) ac_cv_lib_soname_jpeg=`$ac_cv_path_LDD conftest.exe | grep "jpeg" | sed -e "s/dll.*/dll/"';2,$d'` ;;
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=`$READELF -d conftest$ac_exeext | grep "NEEDED.*libjpeg\\.$LIBEXT" | sed -e "s/^.*\\[\\(libjpeg\\.$LIBEXT[^ ]*\\)\\].*$/\1/"';2,$d'`
if ${ac_cv_lib_soname_jpeg:+false} :; then :
ac_cv_lib_soname_jpeg=`$LDD conftest$ac_exeext | grep "libjpeg\\.$LIBEXT" | sed -e "s/^.*\(libjpeg\.$LIBEXT[^ ]*\).*$/\1/"';2,$d'`
fi ;;
esac
else
ac_cv_lib_soname_jpeg=
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_soname_save_LIBS
fi
if ${ac_cv_lib_soname_jpeg:+false} :; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
$as_echo "not found" >&6; }
JPEG_CFLAGS=""
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_soname_jpeg" >&5
$as_echo "$ac_cv_lib_soname_jpeg" >&6; }
cat >>confdefs.h <<_ACEOF
#define SONAME_LIBJPEG "$ac_cv_lib_soname_jpeg"
_ACEOF
fi
else
JPEG_CFLAGS=""
fi
CPPFLAGS=$ac_save_CPPFLAGS
fi
if test "x$ac_cv_lib_soname_jpeg" = "x"; then :
case "x$with_jpeg" in
x) as_fn_append wine_warnings "|libjpeg ${notice_platform}development files not found, gphoto2 won't be supported." ;;
xno) ;;
*) as_fn_error $? "libjpeg ${notice_platform}development files not found, gphoto2 won't be supported.
This is an error since --with-jpeg was requested." "$LINENO" 5 ;;
esac
enable_gphoto2_ds=${enable_gphoto2_ds:-no}
fi
if test "$ac_cv_header_AL_al_h" = "yes"
then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for -lopenal" >&5
......@@ -18604,8 +18486,6 @@ KRB5_CFLAGS = $KRB5_CFLAGS
KRB5_LIBS = $KRB5_LIBS
GSSAPI_CFLAGS = $GSSAPI_CFLAGS
GSSAPI_LIBS = $GSSAPI_LIBS
JPEG_CFLAGS = $JPEG_CFLAGS
JPEG_LIBS = $JPEG_LIBS
PROCSTAT_LIBS = $PROCSTAT_LIBS
NETAPI_CFLAGS = $NETAPI_CFLAGS
NETAPI_LIBS = $NETAPI_LIBS
......
......@@ -54,7 +54,6 @@ AC_ARG_WITH(gssapi, AS_HELP_STRING([--without-gssapi],[do not use GSSAPI (Ker
AC_ARG_WITH(gstreamer, AS_HELP_STRING([--without-gstreamer],[do not use GStreamer (codecs support)]))
AC_ARG_WITH(hal, AS_HELP_STRING([--without-hal],[do not use HAL (dynamic device support)]))
AC_ARG_WITH(inotify, AS_HELP_STRING([--without-inotify],[do not use inotify (filesystem change notifications)]))
AC_ARG_WITH(jpeg, AS_HELP_STRING([--without-jpeg],[do not use JPEG]))
AC_ARG_WITH(krb5, AS_HELP_STRING([--without-krb5],[do not use krb5 (Kerberos)]))
AC_ARG_WITH(ldap, AS_HELP_STRING([--without-ldap],[do not use LDAP]),
[if test "x$withval" = "xno"; then ac_cv_header_ldap_h=no; ac_cv_header_lber_h=no; fi])
......@@ -1686,22 +1685,6 @@ fi
WINE_NOTICE_WITH(gssapi,[test "x$ac_cv_lib_soname_gssapi_krb5" = "x"],
[libgssapi_krb5 ${notice_platform}development files not found (or too old), no Kerberos SSP support.])
dnl **** Check for libjpeg ****
if test "x$with_jpeg" != "xno"
then
WINE_PACKAGE_FLAGS(JPEG,[libjpeg],,,,
[AC_CHECK_HEADERS([jpeglib.h])
if test "$ac_cv_header_jpeglib_h" = "yes"
then
WINE_CHECK_SONAME(jpeg,jpeg_start_decompress,,[JPEG_CFLAGS=""],[$JPEG_LIBS])
else
JPEG_CFLAGS=""
fi])
fi
WINE_WARNING_WITH(jpeg,[test "x$ac_cv_lib_soname_jpeg" = "x"],
[libjpeg ${notice_platform}development files not found, gphoto2 won't be supported.],
[enable_gphoto2_ds])
dnl **** Check for OpenAL 1.1 ****
if test "$ac_cv_header_AL_al_h" = "yes"
then
......
MODULE = gphoto2.ds
UNIXLIB = gphoto2.so
IMPORTS = comctl32 user32 gdi32 advapi32
IMPORTS = $(JPEG_PE_LIBS) comctl32 user32 gdi32 advapi32
EXTRALIBS = $(GPHOTO2_LIBS) $(GPHOTO2_PORT_LIBS)
EXTRAINCL = $(GPHOTO2_CFLAGS) $(GPHOTO2_PORT_CFLAGS) $(JPEG_CFLAGS)
EXTRADLLFLAGS = -mcygwin
EXTRAINCL = $(GPHOTO2_CFLAGS) $(GPHOTO2_PORT_CFLAGS) $(JPEG_PE_CFLAGS)
C_SRCS = \
capability.c \
......
......@@ -17,8 +17,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "config.h"
#include <stdarg.h>
#include "gphoto2_i.h"
......
......@@ -18,11 +18,9 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "config.h"
#include "wine/port.h"
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include "gphoto2_i.h"
#include "wingdi.h"
......@@ -32,40 +30,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(twain);
static void *libjpeg_handle;
#define MAKE_FUNCPTR(f) static typeof(f) * p##f
MAKE_FUNCPTR(jpeg_std_error);
MAKE_FUNCPTR(jpeg_CreateDecompress);
MAKE_FUNCPTR(jpeg_read_header);
MAKE_FUNCPTR(jpeg_start_decompress);
MAKE_FUNCPTR(jpeg_read_scanlines);
MAKE_FUNCPTR(jpeg_finish_decompress);
MAKE_FUNCPTR(jpeg_destroy_decompress);
#undef MAKE_FUNCPTR
static void *load_libjpeg(void)
{
if((libjpeg_handle = dlopen(SONAME_LIBJPEG, RTLD_NOW)) != NULL) {
#define LOAD_FUNCPTR(f) \
if((p##f = dlsym(libjpeg_handle, #f)) == NULL) { \
libjpeg_handle = NULL; \
return NULL; \
}
LOAD_FUNCPTR(jpeg_std_error);
LOAD_FUNCPTR(jpeg_CreateDecompress);
LOAD_FUNCPTR(jpeg_read_header);
LOAD_FUNCPTR(jpeg_start_decompress);
LOAD_FUNCPTR(jpeg_read_scanlines);
LOAD_FUNCPTR(jpeg_finish_decompress);
LOAD_FUNCPTR(jpeg_destroy_decompress);
#undef LOAD_FUNCPTR
}
return libjpeg_handle;
}
/* for the jpeg decompressor source manager. */
static void _jpeg_init_source(j_decompress_ptr cinfo) { }
......@@ -145,7 +109,6 @@ TW_UINT16 GPHOTO2_ImageFileXferGet (pTW_IDENTITY pOrigin,
}
static TW_UINT16 _get_image_and_startup_jpeg(void) {
#ifdef SONAME_LIBJPEG
unsigned int i;
int ret;
struct open_file_params open_params;
......@@ -154,13 +117,6 @@ static TW_UINT16 _get_image_and_startup_jpeg(void) {
if (activeDS.file_handle) /* Already loaded. */
return TWRC_SUCCESS;
if(!libjpeg_handle) {
if(!load_libjpeg()) {
FIXME("Failed reading JPEG because unable to find %s\n", SONAME_LIBJPEG);
return TWRC_FAILURE;
}
}
for (i = 0; i < activeDS.file_count; i++)
{
if (activeDS.download_flags[i])
......@@ -206,14 +162,14 @@ static TW_UINT16 _get_image_and_startup_jpeg(void) {
activeDS.xjsm.resync_to_restart = _jpeg_resync_to_restart;
activeDS.xjsm.term_source = _jpeg_term_source;
activeDS.jd.err = pjpeg_std_error(&activeDS.jerr);
activeDS.jd.err = jpeg_std_error(&activeDS.jerr);
/* jpeg_create_decompress is a macro that expands to jpeg_CreateDecompress - see jpeglib.h
* jpeg_create_decompress(&jd); */
pjpeg_CreateDecompress(&activeDS.jd, JPEG_LIB_VERSION, sizeof(struct jpeg_decompress_struct));
jpeg_CreateDecompress(&activeDS.jd, JPEG_LIB_VERSION, sizeof(struct jpeg_decompress_struct));
activeDS.jd.src = &activeDS.xjsm;
ret=pjpeg_read_header(&activeDS.jd,TRUE);
ret=jpeg_read_header(&activeDS.jd,TRUE);
activeDS.jd.out_color_space = JCS_RGB;
pjpeg_start_decompress(&activeDS.jd);
jpeg_start_decompress(&activeDS.jd);
if (ret != JPEG_HEADER_OK) {
ERR("Jpeg image in stream has bad format, read header returned %d.\n",ret);
close_current_file();
......@@ -348,7 +304,7 @@ TW_UINT16 GPHOTO2_ImageMemXferGet (pTW_IDENTITY pOrigin,
((pImageMemXfer->Memory.Length - curoff) > activeDS.jd.output_width*activeDS.jd.output_components)
) {
JSAMPROW row = buffer+curoff;
int x = pjpeg_read_scanlines(&activeDS.jd,&row,1);
int x = jpeg_read_scanlines(&activeDS.jd,&row,1);
if (x != 1) {
FIXME("failed to read current scanline?\n");
break;
......@@ -365,8 +321,8 @@ TW_UINT16 GPHOTO2_ImageMemXferGet (pTW_IDENTITY pOrigin,
TransferringDialogBox(activeDS.progressWnd,0);
if (activeDS.jd.output_scanline == activeDS.jd.output_height) {
pjpeg_finish_decompress(&activeDS.jd);
pjpeg_destroy_decompress(&activeDS.jd);
jpeg_finish_decompress(&activeDS.jd);
jpeg_destroy_decompress(&activeDS.jd);
close_current_file();
TRACE("xfer is done!\n");
......@@ -440,7 +396,7 @@ TW_UINT16 GPHOTO2_ImageNativeXferGet (pTW_IDENTITY pOrigin,
oldsamprow = samprow;
while ( activeDS.jd.output_scanline<activeDS.jd.output_height ) {
unsigned int i;
int x = pjpeg_read_scanlines(&activeDS.jd,&samprow,1);
int x = jpeg_read_scanlines(&activeDS.jd,&samprow,1);
if (x != 1) {
FIXME("failed to read current scanline?\n");
break;
......@@ -556,7 +512,6 @@ TW_UINT16 GPHOTO2_RGBResponseSet (pTW_IDENTITY pOrigin,
TW_UINT16
_get_gphoto2_file_as_DIB( unsigned int idx, BOOL preview, HWND hwnd, HBITMAP *hDIB )
{
#ifdef SONAME_LIBJPEG
unsigned char *filedata;
int ret;
struct jpeg_source_mgr xjsm;
......@@ -570,13 +525,6 @@ _get_gphoto2_file_as_DIB( unsigned int idx, BOOL preview, HWND hwnd, HBITMAP *hD
void *file_handle;
unsigned int filesize;
if(!libjpeg_handle) {
if(!load_libjpeg()) {
FIXME("Failed reading JPEG because unable to find %s\n", SONAME_LIBJPEG);
return TWRC_FAILURE;
}
}
open_params.idx = idx;
open_params.preview = preview;
open_params.handle = &file_handle;
......@@ -613,14 +561,14 @@ _get_gphoto2_file_as_DIB( unsigned int idx, BOOL preview, HWND hwnd, HBITMAP *hD
xjsm.resync_to_restart = _jpeg_resync_to_restart;
xjsm.term_source = _jpeg_term_source;
jd.err = pjpeg_std_error(&jerr);
jd.err = jpeg_std_error(&jerr);
/* jpeg_create_decompress is a macro that expands to jpeg_CreateDecompress - see jpeglib.h
* jpeg_create_decompress(&jd); */
pjpeg_CreateDecompress(&jd, JPEG_LIB_VERSION, sizeof(struct jpeg_decompress_struct));
jpeg_CreateDecompress(&jd, JPEG_LIB_VERSION, sizeof(struct jpeg_decompress_struct));
jd.src = &xjsm;
ret=pjpeg_read_header(&jd,TRUE);
ret=jpeg_read_header(&jd,TRUE);
jd.out_color_space = JCS_RGB;
pjpeg_start_decompress(&jd);
jpeg_start_decompress(&jd);
if (ret != JPEG_HEADER_OK) {
ERR("Jpeg image in stream has bad format, read header returned %d.\n",ret);
close_file( file_handle );
......@@ -651,7 +599,7 @@ _get_gphoto2_file_as_DIB( unsigned int idx, BOOL preview, HWND hwnd, HBITMAP *hD
oldsamprow = samprow;
while ( jd.output_scanline<jd.output_height ) {
unsigned int i;
int x = pjpeg_read_scanlines(&jd,&samprow,1);
int x = jpeg_read_scanlines(&jd,&samprow,1);
if (x != 1) {
FIXME("failed to read current scanline?\n");
break;
......
......@@ -20,27 +20,13 @@
#ifndef _TWAIN32_H
#define _TWAIN32_H
#ifndef __WINE_CONFIG_H
# error You must include config.h first
#endif
#include <stdio.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
# define UINT16 JPEG_UINT16
# undef FAR
# undef HAVE_STDLIB_H
# include <jpeglib.h>
# undef HAVE_STDLIB_H
# define HAVE_STDLIB_H 1
# undef UINT8
# undef UINT16
#endif
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
#include <setjmp.h>
#include <basetsd.h>
#include <jpeglib.h>
#include "windef.h"
#include "winbase.h"
......@@ -72,11 +58,9 @@ struct tagActiveDS
void *file_handle;
unsigned char *file_data;
unsigned int file_size;
#ifdef SONAME_LIBJPEG
struct jpeg_source_mgr xjsm;
struct jpeg_decompress_struct jd;
struct jpeg_error_mgr jerr;
#endif
};
extern struct tagActiveDS activeDS DECLSPEC_HIDDEN;
......
......@@ -19,13 +19,9 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "config.h"
#include <stdarg.h>
#include <stdio.h>
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#include <stdlib.h>
#include "gphoto2_i.h"
......@@ -507,8 +503,7 @@ static TW_UINT16 GPHOTO2_OpenDS( pTW_IDENTITY pOrigin, pTW_IDENTITY self )
if (GPHOTO2_dsmentry == NULL)
{
static const WCHAR twain32W[] = {'t','w','a','i','n','_','3','2',0};
HMODULE moddsm = GetModuleHandleW(twain32W);
HMODULE moddsm = GetModuleHandleW(L"twain_32");
if (moddsm)
GPHOTO2_dsmentry = (void*)GetProcAddress(moddsm, "DSM_Entry");
......
......@@ -18,8 +18,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "config.h"
#include <stdlib.h>
#include <stdarg.h>
#include <stdio.h>
......
......@@ -152,9 +152,6 @@
/* Define to 1 if you have the `isnan' function. */
#undef HAVE_ISNAN
/* Define to 1 if you have the <jpeglib.h> header file. */
#undef HAVE_JPEGLIB_H
/* Define to 1 if you have the `kqueue' function. */
#undef HAVE_KQUEUE
......@@ -913,9 +910,6 @@
/* Define to the soname of the libhal library. */
#undef SONAME_LIBHAL
/* Define to the soname of the libjpeg library. */
#undef SONAME_LIBJPEG
/* Define to the soname of the libkrb5 library. */
#undef SONAME_LIBKRB5
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment