Commit 418e74b5 authored by Alexandre Julliard's avatar Alexandre Julliard

configure: Merge the libsane existence check with the soname check.

parent 3336e9bf
...@@ -11228,13 +11228,11 @@ echo "${ECHO_T}no" >&6; } ...@@ -11228,13 +11228,11 @@ echo "${ECHO_T}no" >&6; }
fi fi
SANEINCL=""
if test "$sane_devel" != "no" if test "$sane_devel" != "no"
then then
SANEINCL="`$sane_devel --cflags`" ac_sane_incl="`$sane_devel --cflags`"
ac_save_CPPFLAGS="$CPPFLAGS" ac_save_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $SANEINCL" CPPFLAGS="$CPPFLAGS $ac_sane_incl"
if test "${ac_cv_header_sane_sane_h+set}" = set; then if test "${ac_cv_header_sane_sane_h+set}" = set; then
{ echo "$as_me:$LINENO: checking for sane/sane.h" >&5 { echo "$as_me:$LINENO: checking for sane/sane.h" >&5
echo $ECHO_N "checking for sane/sane.h... $ECHO_C" >&6; } echo $ECHO_N "checking for sane/sane.h... $ECHO_C" >&6; }
...@@ -11366,13 +11364,85 @@ echo "${ECHO_T}$ac_cv_header_sane_sane_h" >&6; } ...@@ -11366,13 +11364,85 @@ echo "${ECHO_T}$ac_cv_header_sane_sane_h" >&6; }
fi fi
if test $ac_cv_header_sane_sane_h = yes; then if test $ac_cv_header_sane_sane_h = yes; then
{ echo "$as_me:$LINENO: checking for -lsane" >&5
echo $ECHO_N "checking for -lsane... $ECHO_C" >&6; }
if test "${ac_cv_lib_soname_sane+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_check_soname_save_LIBS=$LIBS
LIBS="-lsane $LIBS"
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
cat >>confdefs.h <<\_ACEOF /* Override any GCC internal prototype to avoid an error.
#define HAVE_SANE 1 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 sane_init ();
int
main ()
{
return sane_init ();
;
return 0;
}
_ACEOF _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_sane=`otool -L conftest$ac_exeext | grep "libsane\\.[0-9A-Za-z.]*dylib" | sed -e "s/^.*\/\(libsane\.[0-9A-Za-z.]*dylib\).*$/\1/"';2,$d'` ;;
*) ac_cv_lib_soname_sane=`$ac_cv_path_LDD conftest$ac_exeext | grep "libsane\\.$LIBEXT" | sed -e "s/^.*\(libsane\.$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_sane" = "x"; then
{ echo "$as_me:$LINENO: result: not found" >&5
echo "${ECHO_T}not found" >&6; }
else else
SANEINCL="" { echo "$as_me:$LINENO: result: $ac_cv_lib_soname_sane" >&5
echo "${ECHO_T}$ac_cv_lib_soname_sane" >&6; }
cat >>confdefs.h <<_ACEOF
#define SONAME_LIBSANE "$ac_cv_lib_soname_sane"
_ACEOF
SANEINCL="$ac_sane_incl"
fi
fi fi
...@@ -15470,84 +15540,6 @@ _ACEOF ...@@ -15470,84 +15540,6 @@ _ACEOF
fi fi
{ echo "$as_me:$LINENO: checking for -lsane" >&5
echo $ECHO_N "checking for -lsane... $ECHO_C" >&6; }
if test "${ac_cv_lib_soname_sane+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_check_soname_save_LIBS=$LIBS
LIBS="-lsane $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 sane_init ();
int
main ()
{
return sane_init ();
;
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_sane=`otool -L conftest$ac_exeext | grep "libsane\\.[0-9A-Za-z.]*dylib" | sed -e "s/^.*\/\(libsane\.[0-9A-Za-z.]*dylib\).*$/\1/"';2,$d'` ;;
*) ac_cv_lib_soname_sane=`$ac_cv_path_LDD conftest$ac_exeext | grep "libsane\\.$LIBEXT" | sed -e "s/^.*\(libsane\.$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_sane" = "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_sane" >&5
echo "${ECHO_T}$ac_cv_lib_soname_sane" >&6; }
cat >>confdefs.h <<_ACEOF
#define SONAME_LIBSANE "$ac_cv_lib_soname_sane"
_ACEOF
fi
......
...@@ -699,15 +699,13 @@ LIBS="$ac_save_LIBS" ...@@ -699,15 +699,13 @@ LIBS="$ac_save_LIBS"
dnl **** Check for SANE **** dnl **** Check for SANE ****
AC_CHECK_PROG(sane_devel,sane-config,sane-config,no) AC_CHECK_PROG(sane_devel,sane-config,sane-config,no)
AC_SUBST(SANEINCL,"")
if test "$sane_devel" != "no" if test "$sane_devel" != "no"
then then
SANEINCL="`$sane_devel --cflags`" ac_sane_incl="`$sane_devel --cflags`"
ac_save_CPPFLAGS="$CPPFLAGS" ac_save_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $SANEINCL" CPPFLAGS="$CPPFLAGS $ac_sane_incl"
AC_CHECK_HEADER(sane/sane.h, AC_CHECK_HEADER(sane/sane.h,
[AC_DEFINE(HAVE_SANE, 1, [Define if we have SANE development environment])], [WINE_CHECK_SONAME(sane,sane_init,[AC_SUBST(SANEINCL,"$ac_sane_incl")])])
[SANEINCL=""])
CPPFLAGS="$ac_save_CPPFLAGS" CPPFLAGS="$ac_save_CPPFLAGS"
fi fi
...@@ -1123,7 +1121,6 @@ WINE_CHECK_SONAME(fontconfig,FcInit) ...@@ -1123,7 +1121,6 @@ WINE_CHECK_SONAME(fontconfig,FcInit)
WINE_CHECK_SONAME(ssl,SSL_library_init) WINE_CHECK_SONAME(ssl,SSL_library_init)
WINE_CHECK_SONAME(crypto,BIO_new_socket) WINE_CHECK_SONAME(crypto,BIO_new_socket)
WINE_CHECK_SONAME(jpeg,jpeg_start_decompress) WINE_CHECK_SONAME(jpeg,jpeg_start_decompress)
WINE_CHECK_SONAME(sane,sane_init)
dnl **** Check for functions **** dnl **** Check for functions ****
......
...@@ -485,7 +485,7 @@ TW_UINT16 SANE_SetupFileXfer2Set (pTW_IDENTITY pOrigin, ...@@ -485,7 +485,7 @@ TW_UINT16 SANE_SetupFileXfer2Set (pTW_IDENTITY pOrigin,
TW_UINT16 SANE_SetupMemXferGet (pTW_IDENTITY pOrigin, TW_UINT16 SANE_SetupMemXferGet (pTW_IDENTITY pOrigin,
TW_MEMREF pData) TW_MEMREF pData)
{ {
#ifndef HAVE_SANE #ifndef SONAME_LIBSANE
return TWRC_FAILURE; return TWRC_FAILURE;
#else #else
pTW_SETUPMEMXFER pSetupMemXfer = (pTW_SETUPMEMXFER)pData; pTW_SETUPMEMXFER pSetupMemXfer = (pTW_SETUPMEMXFER)pData;
...@@ -573,7 +573,7 @@ TW_UINT16 SANE_EnableDSUserInterface (pTW_IDENTITY pOrigin, ...@@ -573,7 +573,7 @@ TW_UINT16 SANE_EnableDSUserInterface (pTW_IDENTITY pOrigin,
{ {
activeDS.pendingEvent.TWMessage = MSG_CLOSEDSREQ; activeDS.pendingEvent.TWMessage = MSG_CLOSEDSREQ;
} }
#ifdef HAVE_SANE #ifdef SONAME_LIBSANE
else else
{ {
psane_get_parameters (activeDS.deviceHandle, &activeDS.sane_param); psane_get_parameters (activeDS.deviceHandle, &activeDS.sane_param);
......
...@@ -80,7 +80,7 @@ TW_UINT16 SANE_ImageFileXferGet (pTW_IDENTITY pOrigin, ...@@ -80,7 +80,7 @@ TW_UINT16 SANE_ImageFileXferGet (pTW_IDENTITY pOrigin,
TW_UINT16 SANE_ImageInfoGet (pTW_IDENTITY pOrigin, TW_UINT16 SANE_ImageInfoGet (pTW_IDENTITY pOrigin,
TW_MEMREF pData) TW_MEMREF pData)
{ {
#ifndef HAVE_SANE #ifndef SONAME_LIBSANE
return TWRC_FAILURE; return TWRC_FAILURE;
#else #else
TW_UINT16 twRC = TWRC_SUCCESS; TW_UINT16 twRC = TWRC_SUCCESS;
...@@ -186,7 +186,7 @@ TW_UINT16 SANE_ImageLayoutSet (pTW_IDENTITY pOrigin, ...@@ -186,7 +186,7 @@ TW_UINT16 SANE_ImageLayoutSet (pTW_IDENTITY pOrigin,
TW_UINT16 SANE_ImageMemXferGet (pTW_IDENTITY pOrigin, TW_UINT16 SANE_ImageMemXferGet (pTW_IDENTITY pOrigin,
TW_MEMREF pData) TW_MEMREF pData)
{ {
#ifndef HAVE_SANE #ifndef SONAME_LIBSANE
return TWRC_FAILURE; return TWRC_FAILURE;
#else #else
TW_UINT16 twRC = TWRC_SUCCESS; TW_UINT16 twRC = TWRC_SUCCESS;
...@@ -321,7 +321,7 @@ TW_UINT16 SANE_ImageMemXferGet (pTW_IDENTITY pOrigin, ...@@ -321,7 +321,7 @@ TW_UINT16 SANE_ImageMemXferGet (pTW_IDENTITY pOrigin,
TW_UINT16 SANE_ImageNativeXferGet (pTW_IDENTITY pOrigin, TW_UINT16 SANE_ImageNativeXferGet (pTW_IDENTITY pOrigin,
TW_MEMREF pData) TW_MEMREF pData)
{ {
#ifndef HAVE_SANE #ifndef SONAME_LIBSANE
return TWRC_FAILURE; return TWRC_FAILURE;
#else #else
TW_UINT16 twRC = TWRC_SUCCESS; TW_UINT16 twRC = TWRC_SUCCESS;
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
# error You must include config.h first # error You must include config.h first
#endif #endif
#ifdef HAVE_SANE #ifdef SONAME_LIBSANE
# include <sane/sane.h> # include <sane/sane.h>
#define MAKE_FUNCPTR(f) typeof(f) * p##f; #define MAKE_FUNCPTR(f) typeof(f) * p##f;
...@@ -63,7 +63,7 @@ struct tagActiveDS ...@@ -63,7 +63,7 @@ struct tagActiveDS
TW_UINT16 twCC; /* condition code */ TW_UINT16 twCC; /* condition code */
HWND hwndOwner; /* window handle of the app */ HWND hwndOwner; /* window handle of the app */
HWND progressWnd; /* window handle of the scanning window */ HWND progressWnd; /* window handle of the scanning window */
#ifdef HAVE_SANE #ifdef SONAME_LIBSANE
SANE_Handle deviceHandle; /* device handle */ SANE_Handle deviceHandle; /* device handle */
SANE_Parameters sane_param; /* parameters about the image SANE_Parameters sane_param; /* parameters about the image
transferred */ transferred */
......
...@@ -35,10 +35,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(twain); ...@@ -35,10 +35,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(twain);
HINSTANCE SANE_instance; HINSTANCE SANE_instance;
#ifdef HAVE_SANE #ifdef SONAME_LIBSANE
#ifndef SONAME_LIBSANE
#define SONAME_LIBSANE "libsane" SONAME_EXT
#endif
static void *libsane_handle; static void *libsane_handle;
...@@ -85,7 +82,7 @@ static void *open_libsane(void) ...@@ -85,7 +82,7 @@ static void *open_libsane(void)
return h; return h;
} }
#endif /* HAVE_SANE */ #endif /* SONAME_LIBSANE */
BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{ {
...@@ -94,7 +91,7 @@ BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) ...@@ -94,7 +91,7 @@ BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
switch (fdwReason) switch (fdwReason)
{ {
case DLL_PROCESS_ATTACH: { case DLL_PROCESS_ATTACH: {
#ifdef HAVE_SANE #ifdef SONAME_LIBSANE
SANE_Status status; SANE_Status status;
SANE_Int version_code; SANE_Int version_code;
...@@ -109,7 +106,7 @@ BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) ...@@ -109,7 +106,7 @@ BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
break; break;
} }
case DLL_PROCESS_DETACH: case DLL_PROCESS_DETACH:
#ifdef HAVE_SANE #ifdef SONAME_LIBSANE
TRACE("calling sane_exit()\n"); TRACE("calling sane_exit()\n");
psane_exit (); psane_exit ();
...@@ -123,7 +120,7 @@ BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) ...@@ -123,7 +120,7 @@ BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
return TRUE; return TRUE;
} }
#ifdef HAVE_SANE #ifdef SONAME_LIBSANE
static TW_UINT16 SANE_GetIdentity( pTW_IDENTITY, pTW_IDENTITY); static TW_UINT16 SANE_GetIdentity( pTW_IDENTITY, pTW_IDENTITY);
static TW_UINT16 SANE_OpenDS( pTW_IDENTITY, pTW_IDENTITY); static TW_UINT16 SANE_OpenDS( pTW_IDENTITY, pTW_IDENTITY);
#endif #endif
...@@ -142,19 +139,19 @@ static TW_UINT16 SANE_SourceControlHandler ( ...@@ -142,19 +139,19 @@ static TW_UINT16 SANE_SourceControlHandler (
switch (MSG) switch (MSG)
{ {
case MSG_CLOSEDS: case MSG_CLOSEDS:
#ifdef HAVE_SANE #ifdef SONAME_LIBSANE
psane_close (activeDS.deviceHandle); psane_close (activeDS.deviceHandle);
#endif #endif
break; break;
case MSG_OPENDS: case MSG_OPENDS:
#ifdef HAVE_SANE #ifdef SONAME_LIBSANE
twRC = SANE_OpenDS( pOrigin, (pTW_IDENTITY)pData); twRC = SANE_OpenDS( pOrigin, (pTW_IDENTITY)pData);
#else #else
twRC = TWRC_FAILURE; twRC = TWRC_FAILURE;
#endif #endif
break; break;
case MSG_GET: case MSG_GET:
#ifdef HAVE_SANE #ifdef SONAME_LIBSANE
twRC = SANE_GetIdentity( pOrigin, (pTW_IDENTITY)pData); twRC = SANE_GetIdentity( pOrigin, (pTW_IDENTITY)pData);
#else #else
twRC = TWRC_FAILURE; twRC = TWRC_FAILURE;
...@@ -566,7 +563,7 @@ DS_Entry ( pTW_IDENTITY pOrigin, ...@@ -566,7 +563,7 @@ DS_Entry ( pTW_IDENTITY pOrigin,
return twRC; return twRC;
} }
#ifdef HAVE_SANE #ifdef SONAME_LIBSANE
/* Sane returns device names that are longer than the 32 bytes allowed /* Sane returns device names that are longer than the 32 bytes allowed
by TWAIN. However, it colon separates them, and the last bit is by TWAIN. However, it colon separates them, and the last bit is
the most interesting. So we use the last bit, and add a signature the most interesting. So we use the last bit, and add a signature
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
#include "wine/debug.h" #include "wine/debug.h"
#include "resource.h" #include "resource.h"
#ifdef HAVE_SANE #ifdef SONAME_LIBSANE
WINE_DEFAULT_DEBUG_CHANNEL(twain); WINE_DEFAULT_DEBUG_CHANNEL(twain);
...@@ -1056,11 +1056,11 @@ HWND ScanningDialogBox(HWND dialog, LONG progress) ...@@ -1056,11 +1056,11 @@ HWND ScanningDialogBox(HWND dialog, LONG progress)
return dialog; return dialog;
} }
#else /* HAVE_SANE */ #else /* SONAME_LIBSANE */
BOOL DoScannerUI(void) BOOL DoScannerUI(void)
{ {
return FALSE; return FALSE;
} }
#endif /* HAVE_SANE */ #endif /* SONAME_LIBSANE */
...@@ -549,9 +549,6 @@ ...@@ -549,9 +549,6 @@
/* Define to 1 if you have the `rfork' function. */ /* Define to 1 if you have the `rfork' function. */
#undef HAVE_RFORK #undef HAVE_RFORK
/* Define if we have SANE development environment */
#undef HAVE_SANE
/* Define to 1 if you have the <sched.h> header file. */ /* Define to 1 if you have the <sched.h> header file. */
#undef HAVE_SCHED_H #undef HAVE_SCHED_H
......
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