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; }
fi
SANEINCL=""
if test "$sane_devel" != "no"
then
SANEINCL="`$sane_devel --cflags`"
ac_sane_incl="`$sane_devel --cflags`"
ac_save_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $SANEINCL"
CPPFLAGS="$CPPFLAGS $ac_sane_incl"
if test "${ac_cv_header_sane_sane_h+set}" = set; then
{ echo "$as_me:$LINENO: checking for sane/sane.h" >&5
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; }
fi
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
#define HAVE_SANE 1
/* 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
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
......@@ -15470,84 +15540,6 @@ _ACEOF
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"
dnl **** Check for SANE ****
AC_CHECK_PROG(sane_devel,sane-config,sane-config,no)
AC_SUBST(SANEINCL,"")
if test "$sane_devel" != "no"
then
SANEINCL="`$sane_devel --cflags`"
ac_sane_incl="`$sane_devel --cflags`"
ac_save_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $SANEINCL"
CPPFLAGS="$CPPFLAGS $ac_sane_incl"
AC_CHECK_HEADER(sane/sane.h,
[AC_DEFINE(HAVE_SANE, 1, [Define if we have SANE development environment])],
[SANEINCL=""])
[WINE_CHECK_SONAME(sane,sane_init,[AC_SUBST(SANEINCL,"$ac_sane_incl")])])
CPPFLAGS="$ac_save_CPPFLAGS"
fi
......@@ -1123,7 +1121,6 @@ WINE_CHECK_SONAME(fontconfig,FcInit)
WINE_CHECK_SONAME(ssl,SSL_library_init)
WINE_CHECK_SONAME(crypto,BIO_new_socket)
WINE_CHECK_SONAME(jpeg,jpeg_start_decompress)
WINE_CHECK_SONAME(sane,sane_init)
dnl **** Check for functions ****
......
......@@ -485,7 +485,7 @@ TW_UINT16 SANE_SetupFileXfer2Set (pTW_IDENTITY pOrigin,
TW_UINT16 SANE_SetupMemXferGet (pTW_IDENTITY pOrigin,
TW_MEMREF pData)
{
#ifndef HAVE_SANE
#ifndef SONAME_LIBSANE
return TWRC_FAILURE;
#else
pTW_SETUPMEMXFER pSetupMemXfer = (pTW_SETUPMEMXFER)pData;
......@@ -573,7 +573,7 @@ TW_UINT16 SANE_EnableDSUserInterface (pTW_IDENTITY pOrigin,
{
activeDS.pendingEvent.TWMessage = MSG_CLOSEDSREQ;
}
#ifdef HAVE_SANE
#ifdef SONAME_LIBSANE
else
{
psane_get_parameters (activeDS.deviceHandle, &activeDS.sane_param);
......
......@@ -80,7 +80,7 @@ TW_UINT16 SANE_ImageFileXferGet (pTW_IDENTITY pOrigin,
TW_UINT16 SANE_ImageInfoGet (pTW_IDENTITY pOrigin,
TW_MEMREF pData)
{
#ifndef HAVE_SANE
#ifndef SONAME_LIBSANE
return TWRC_FAILURE;
#else
TW_UINT16 twRC = TWRC_SUCCESS;
......@@ -186,7 +186,7 @@ TW_UINT16 SANE_ImageLayoutSet (pTW_IDENTITY pOrigin,
TW_UINT16 SANE_ImageMemXferGet (pTW_IDENTITY pOrigin,
TW_MEMREF pData)
{
#ifndef HAVE_SANE
#ifndef SONAME_LIBSANE
return TWRC_FAILURE;
#else
TW_UINT16 twRC = TWRC_SUCCESS;
......@@ -321,7 +321,7 @@ TW_UINT16 SANE_ImageMemXferGet (pTW_IDENTITY pOrigin,
TW_UINT16 SANE_ImageNativeXferGet (pTW_IDENTITY pOrigin,
TW_MEMREF pData)
{
#ifndef HAVE_SANE
#ifndef SONAME_LIBSANE
return TWRC_FAILURE;
#else
TW_UINT16 twRC = TWRC_SUCCESS;
......
......@@ -23,7 +23,7 @@
# error You must include config.h first
#endif
#ifdef HAVE_SANE
#ifdef SONAME_LIBSANE
# include <sane/sane.h>
#define MAKE_FUNCPTR(f) typeof(f) * p##f;
......@@ -63,7 +63,7 @@ struct tagActiveDS
TW_UINT16 twCC; /* condition code */
HWND hwndOwner; /* window handle of the app */
HWND progressWnd; /* window handle of the scanning window */
#ifdef HAVE_SANE
#ifdef SONAME_LIBSANE
SANE_Handle deviceHandle; /* device handle */
SANE_Parameters sane_param; /* parameters about the image
transferred */
......
......@@ -35,10 +35,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(twain);
HINSTANCE SANE_instance;
#ifdef HAVE_SANE
#ifndef SONAME_LIBSANE
#define SONAME_LIBSANE "libsane" SONAME_EXT
#endif
#ifdef SONAME_LIBSANE
static void *libsane_handle;
......@@ -85,7 +82,7 @@ static void *open_libsane(void)
return h;
}
#endif /* HAVE_SANE */
#endif /* SONAME_LIBSANE */
BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
......@@ -94,7 +91,7 @@ BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
switch (fdwReason)
{
case DLL_PROCESS_ATTACH: {
#ifdef HAVE_SANE
#ifdef SONAME_LIBSANE
SANE_Status status;
SANE_Int version_code;
......@@ -109,7 +106,7 @@ BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
break;
}
case DLL_PROCESS_DETACH:
#ifdef HAVE_SANE
#ifdef SONAME_LIBSANE
TRACE("calling sane_exit()\n");
psane_exit ();
......@@ -123,7 +120,7 @@ BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
return TRUE;
}
#ifdef HAVE_SANE
#ifdef SONAME_LIBSANE
static TW_UINT16 SANE_GetIdentity( pTW_IDENTITY, pTW_IDENTITY);
static TW_UINT16 SANE_OpenDS( pTW_IDENTITY, pTW_IDENTITY);
#endif
......@@ -142,19 +139,19 @@ static TW_UINT16 SANE_SourceControlHandler (
switch (MSG)
{
case MSG_CLOSEDS:
#ifdef HAVE_SANE
#ifdef SONAME_LIBSANE
psane_close (activeDS.deviceHandle);
#endif
break;
case MSG_OPENDS:
#ifdef HAVE_SANE
#ifdef SONAME_LIBSANE
twRC = SANE_OpenDS( pOrigin, (pTW_IDENTITY)pData);
#else
twRC = TWRC_FAILURE;
#endif
break;
case MSG_GET:
#ifdef HAVE_SANE
#ifdef SONAME_LIBSANE
twRC = SANE_GetIdentity( pOrigin, (pTW_IDENTITY)pData);
#else
twRC = TWRC_FAILURE;
......@@ -566,7 +563,7 @@ DS_Entry ( pTW_IDENTITY pOrigin,
return twRC;
}
#ifdef HAVE_SANE
#ifdef SONAME_LIBSANE
/* Sane returns device names that are longer than the 32 bytes allowed
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
......
......@@ -37,7 +37,7 @@
#include "wine/debug.h"
#include "resource.h"
#ifdef HAVE_SANE
#ifdef SONAME_LIBSANE
WINE_DEFAULT_DEBUG_CHANNEL(twain);
......@@ -1056,11 +1056,11 @@ HWND ScanningDialogBox(HWND dialog, LONG progress)
return dialog;
}
#else /* HAVE_SANE */
#else /* SONAME_LIBSANE */
BOOL DoScannerUI(void)
{
return FALSE;
}
#endif /* HAVE_SANE */
#endif /* SONAME_LIBSANE */
......@@ -549,9 +549,6 @@
/* Define to 1 if you have the `rfork' function. */
#undef HAVE_RFORK
/* Define if we have SANE development environment */
#undef HAVE_SANE
/* Define to 1 if you have the <sched.h> header file. */
#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