capi2032: Link directly to libcapi20.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2021-10-29 09:36:16 +02:00
parent 1dd462b62c
commit eab0f52e9b
6 changed files with 31 additions and 214 deletions

45
configure vendored
View File

@ -14613,14 +14613,14 @@ done
if test "$ac_cv_header_capi20_h" = "yes" -a "$ac_cv_header_linux_capi_h" = "yes"
then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for -lcapi20" >&5
$as_echo_n "checking for -lcapi20... " >&6; }
if ${ac_cv_lib_soname_capi20+:} false; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for capi20_register in -lcapi20" >&5
$as_echo_n "checking for capi20_register in -lcapi20... " >&6; }
if ${ac_cv_lib_capi20_capi20_register+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_soname_save_LIBS=$LIBS
ac_check_lib_save_LIBS=$LIBS
LIBS="-lcapi20 $CAPI20_LIBS $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
@ -14639,47 +14639,34 @@ return capi20_register ();
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
case "$LIBEXT" in
dll) ac_cv_lib_soname_capi20=`$ac_cv_path_LDD conftest.exe | grep "capi20" | sed -e "s/dll.*/dll/"';2,$d'` ;;
dylib) ac_cv_lib_soname_capi20=`$OTOOL -L conftest$ac_exeext | grep "libcapi20\\.[0-9A-Za-z.]*dylib" | sed -e "s/^.*\/\(libcapi20\.[0-9A-Za-z.]*dylib\).*$/\1/"';2,$d'` ;;
*) ac_cv_lib_soname_capi20=`$READELF -d conftest$ac_exeext | grep "NEEDED.*libcapi20\\.$LIBEXT" | sed -e "s/^.*\\[\\(libcapi20\\.$LIBEXT[^ ]*\\)\\].*$/\1/"';2,$d'`
if ${ac_cv_lib_soname_capi20:+false} :; then :
ac_cv_lib_soname_capi20=`$LDD conftest$ac_exeext | grep "libcapi20\\.$LIBEXT" | sed -e "s/^.*\(libcapi20\.$LIBEXT[^ ]*\).*$/\1/"';2,$d'`
fi ;;
esac
ac_cv_lib_capi20_capi20_register=yes
else
ac_cv_lib_soname_capi20=
ac_cv_lib_capi20_capi20_register=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_soname_save_LIBS
LIBS=$ac_check_lib_save_LIBS
fi
if ${ac_cv_lib_soname_capi20:+false} :; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
$as_echo "not found" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_capi20_capi20_register" >&5
$as_echo "$ac_cv_lib_capi20_capi20_register" >&6; }
if test "x$ac_cv_lib_capi20_capi20_register" = xyes; then :
:
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_soname_capi20" >&5
$as_echo "$ac_cv_lib_soname_capi20" >&6; }
cat >>confdefs.h <<_ACEOF
#define SONAME_LIBCAPI20 "$ac_cv_lib_soname_capi20"
_ACEOF
CAPI20_LIBS=""
fi
fi
CPPFLAGS=$ac_save_CPPFLAGS
fi
if test "x$ac_cv_lib_soname_capi20" = "x"; then :
if test "x$ac_cv_lib_capi20_capi20_register" = "x"; then :
case "x$with_capi" in
x) as_fn_append wine_notices "|libcapi20 ${notice_platform}development files not found, ISDN won't be supported." ;;
xno) ;;
*) as_fn_error $? "libcapi20 ${notice_platform}development files not found, ISDN won't be supported.
This is an error since --with-capi was requested." "$LINENO" 5 ;;
esac
enable_capi2032=${enable_capi2032:-no}
fi
if test "x$with_cups" != "xno"

View File

@ -1611,11 +1611,12 @@ then
[AC_CHECK_HEADERS([capi20.h linux/capi.h],,,[#define __user])
if test "$ac_cv_header_capi20_h" = "yes" -a "$ac_cv_header_linux_capi_h" = "yes"
then
WINE_CHECK_SONAME(capi20,capi20_register,,,[$CAPI20_LIBS])
AC_CHECK_LIB(capi20,capi20_register,[:],[CAPI20_LIBS=""],[$CAPI20_LIBS])
fi])
fi
WINE_NOTICE_WITH(capi,[test "x$ac_cv_lib_soname_capi20" = "x"],
[libcapi20 ${notice_platform}development files not found, ISDN won't be supported.])
WINE_NOTICE_WITH(capi,[test "x$ac_cv_lib_capi20_capi20_register" = "x"],
[libcapi20 ${notice_platform}development files not found, ISDN won't be supported.],
[enable_capi2032])
dnl **** Check for cups ****
if test "x$with_cups" != "xno"

View File

@ -1,5 +1,6 @@
MODULE = capi2032.dll
IMPORTLIB = capi2032
EXTRALIBS = $(CAPI20_LIBS)
EXTRAINCL = $(CAPI20_CFLAGS)
EXTRADLLFLAGS = -mcygwin

View File

@ -38,169 +38,80 @@
# include <capi20.h>
#endif
#include "wine/debug.h"
#include "cap20wxx.h"
WINE_DEFAULT_DEBUG_CHANNEL(capi);
#ifdef SONAME_LIBCAPI20
static unsigned (*pcapi20_register)(unsigned, unsigned, unsigned, unsigned *) = NULL;
static unsigned (*pcapi20_release)(unsigned) = NULL;
static unsigned (*pcapi20_put_message)(unsigned, unsigned char *) = NULL;
static unsigned (*pcapi20_get_message)(unsigned, unsigned char **) = NULL;
static unsigned (*pcapi20_waitformessage)(unsigned, struct timeval *) = NULL;
static unsigned (*pcapi20_isinstalled)(void) = NULL;
static unsigned (*pcapi20_get_profile)(unsigned, unsigned char *) = NULL;
static unsigned char *(*pcapi20_get_manufacturer)(unsigned, unsigned char *) = NULL;
static unsigned char *(*pcapi20_get_serial_number)(unsigned, unsigned char *) = NULL;
static unsigned char *(*pcapi20_get_version)(unsigned, unsigned char *) = NULL;
static void load_functions(void) {
void *capi_handle = NULL;
if (pcapi20_register) /* loaded already */
return;
capi_handle = dlopen(SONAME_LIBCAPI20, RTLD_NOW);
if(!capi_handle) {
FIXME("Wine cannot find the library %s, capi2032.dll not working.\n", SONAME_LIBCAPI20);
return;
}
#define LOAD_FUNCPTR(f) if((p##f = dlsym(capi_handle, #f)) == NULL){WARN("Can't find symbol %s\n", #f); return;}
LOAD_FUNCPTR(capi20_register);
LOAD_FUNCPTR(capi20_release);
LOAD_FUNCPTR(capi20_put_message);
LOAD_FUNCPTR(capi20_get_message);
LOAD_FUNCPTR(capi20_waitformessage);
LOAD_FUNCPTR(capi20_isinstalled);
LOAD_FUNCPTR(capi20_get_profile);
LOAD_FUNCPTR(capi20_get_manufacturer);
LOAD_FUNCPTR(capi20_get_serial_number);
LOAD_FUNCPTR(capi20_get_version);
#undef LOAD_FUNCPTR
}
#endif
/*===========================================================================*\
\*===========================================================================*/
DWORD WINAPI wrapCAPI_REGISTER (DWORD MessageBufferSize, DWORD maxLogicalConnection, DWORD maxBDataBlocks, DWORD maxBDataLen, DWORD *pApplID) {
#ifdef SONAME_LIBCAPI20
unsigned aid = 0;
DWORD fret;
load_functions();
if (!pcapi20_register)
return 0x1009;
fret = pcapi20_register (maxLogicalConnection, maxBDataBlocks, maxBDataLen, &aid);
fret = capi20_register (maxLogicalConnection, maxBDataBlocks, maxBDataLen, &aid);
*pApplID = aid;
TRACE ( "(%x) -> %x\n", *pApplID, fret);
return fret;
#else
FIXME ( "(), no CAPI4LINUX support compiled into WINE.\n" );
return 0x1009;
#endif
}
/*---------------------------------------------------------------------------*\
\*---------------------------------------------------------------------------*/
DWORD WINAPI wrapCAPI_RELEASE (DWORD ApplID) {
#ifdef SONAME_LIBCAPI20
DWORD fret;
load_functions();
if (!pcapi20_release)
return 0x1109;
fret = pcapi20_release (ApplID);
fret = capi20_release (ApplID);
TRACE ("(%x) -> %x\n", ApplID, fret);
return fret;
#else
return 0x1109;
#endif
}
/*---------------------------------------------------------------------------*\
\*---------------------------------------------------------------------------*/
DWORD WINAPI wrapCAPI_PUT_MESSAGE (DWORD ApplID, PVOID pCAPIMessage) {
#ifdef SONAME_LIBCAPI20
DWORD fret;
load_functions();
if (!pcapi20_put_message)
return 0x1109;
fret = pcapi20_put_message (ApplID, pCAPIMessage);
fret = capi20_put_message (ApplID, pCAPIMessage);
TRACE ("(%x) -> %x\n", ApplID, fret);
return fret;
#else
return 0x1109;
#endif
}
/*---------------------------------------------------------------------------*\
\*---------------------------------------------------------------------------*/
DWORD WINAPI wrapCAPI_GET_MESSAGE (DWORD ApplID, PVOID *ppCAPIMessage) {
#ifdef SONAME_LIBCAPI20
DWORD fret;
load_functions();
if (!pcapi20_get_message)
return 0x1109;
fret = pcapi20_get_message (ApplID, (unsigned char **)ppCAPIMessage);
fret = capi20_get_message (ApplID, (unsigned char **)ppCAPIMessage);
TRACE ("(%x) -> %x\n", ApplID, fret);
return fret;
#else
return 0x1109;
#endif
}
/*---------------------------------------------------------------------------*\
\*---------------------------------------------------------------------------*/
DWORD WINAPI wrapCAPI_WAIT_FOR_SIGNAL (DWORD ApplID) {
#ifdef SONAME_LIBCAPI20
TRACE ("(%x)\n", ApplID);
load_functions();
if (!pcapi20_waitformessage)
return 0x1109;
return pcapi20_waitformessage (ApplID, NULL);
#else
return 0x1109;
#endif
return capi20_waitformessage (ApplID, NULL);
}
/*---------------------------------------------------------------------------*\
\*---------------------------------------------------------------------------*/
DWORD WINAPI wrapCAPI_GET_MANUFACTURER (char *SzBuffer) {
#ifdef SONAME_LIBCAPI20
DWORD fret;
load_functions();
if (!pcapi20_get_manufacturer)
return 0x1109;
fret = (pcapi20_get_manufacturer (0, (unsigned char *) SzBuffer) != 0) ? 0 : 0x1108;
fret = (capi20_get_manufacturer (0, (unsigned char *) SzBuffer) != 0) ? 0 : 0x1108;
if (!strncmp (SzBuffer, "AVM", 3)) {
strcpy (SzBuffer, "AVM-GmbH");
}
TRACE ("(%s) -> %x\n", SzBuffer, fret);
return fret;
#else
return 0x1109;
#endif
}
/*---------------------------------------------------------------------------*\
\*---------------------------------------------------------------------------*/
DWORD WINAPI wrapCAPI_GET_VERSION (DWORD *pCAPIMajor, DWORD *pCAPIMinor, DWORD *pManufacturerMajor, DWORD *pManufacturerMinor) {
#ifdef SONAME_LIBCAPI20
unsigned char version[4 * sizeof (unsigned)];
DWORD fret;
load_functions();
if (!pcapi20_get_version)
return 0x1109;
fret = (pcapi20_get_version (0, version) != 0) ? 0 : 0x1108;
fret = (capi20_get_version (0, version) != 0) ? 0 : 0x1108;
*pCAPIMajor = *(unsigned *)(version + 0 * sizeof (unsigned));
*pCAPIMinor = *(unsigned *)(version + 1 * sizeof (unsigned));
*pManufacturerMajor = *(unsigned *)(version + 2 * sizeof (unsigned));
@ -208,61 +119,36 @@ DWORD WINAPI wrapCAPI_GET_VERSION (DWORD *pCAPIMajor, DWORD *pCAPIMinor, DWORD *
TRACE ("(%x.%x,%x.%x) -> %x\n", *pCAPIMajor, *pCAPIMinor, *pManufacturerMajor,
*pManufacturerMinor, fret);
return fret;
#else
return 0x1109;
#endif
}
/*---------------------------------------------------------------------------*\
\*---------------------------------------------------------------------------*/
DWORD WINAPI wrapCAPI_GET_SERIAL_NUMBER (char *SzBuffer) {
#ifdef SONAME_LIBCAPI20
DWORD fret;
load_functions();
if (!pcapi20_get_serial_number)
return 0x1109;
fret = (pcapi20_get_serial_number (0, (unsigned char*) SzBuffer) != 0) ? 0 : 0x1108;
fret = (capi20_get_serial_number (0, (unsigned char*) SzBuffer) != 0) ? 0 : 0x1108;
TRACE ("(%s) -> %x\n", SzBuffer, fret);
return fret;
#else
return 0x1109;
#endif
}
/*---------------------------------------------------------------------------*\
\*---------------------------------------------------------------------------*/
DWORD WINAPI wrapCAPI_GET_PROFILE (PVOID SzBuffer, DWORD CtlrNr) {
#ifdef SONAME_LIBCAPI20
DWORD fret;
load_functions();
if (!pcapi20_get_profile)
return 0x1109;
fret = pcapi20_get_profile (CtlrNr, SzBuffer);
fret = capi20_get_profile (CtlrNr, SzBuffer);
TRACE ("(%x,%x) -> %x\n", CtlrNr, *(unsigned short *)SzBuffer, fret);
return fret;
#else
return 0x1109;
#endif
}
/*---------------------------------------------------------------------------*\
\*---------------------------------------------------------------------------*/
DWORD WINAPI wrapCAPI_INSTALLED (void) {
#ifdef SONAME_LIBCAPI20
DWORD fret;
load_functions();
if (!pcapi20_isinstalled)
return 0x1109;
fret = pcapi20_isinstalled();
fret = capi20_isinstalled();
TRACE ("() -> %x\n", fret);
return fret;
#else
return 0x1109;
#endif
}
/*---------------------------------------------------------------------------*\

View File

@ -1,55 +0,0 @@
/*
* cap20wxx.c
*
* Copyright 2002-2003 AVM Computersysteme Vertriebs GmbH
*
* 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*
*/
#ifndef _cap20wxx_h
#define _cap20wxx_h
/*---------------------------------------------------------------------------*\
\*---------------------------------------------------------------------------*/
#include <windef.h>
/*---------------------------------------------------------------------------*\
\*---------------------------------------------------------------------------*/
#ifdef __cplusplus
extern "C" {
#endif
/*---------------------------------------------------------------------------*\
\*---------------------------------------------------------------------------*/
DWORD WINAPI wrapCAPI_REGISTER (DWORD MessageBufferSize, DWORD maxLogicalConnection, DWORD maxBDataBlocks, DWORD maxBDataLen, DWORD *pApplID);
DWORD WINAPI wrapCAPI_RELEASE (DWORD ApplID);
DWORD WINAPI wrapCAPI_PUT_MESSAGE (DWORD ApplID, PVOID pCAPIMessage);
DWORD WINAPI wrapCAPI_GET_MESSAGE (DWORD ApplID, PVOID *ppCAPIMessage);
DWORD WINAPI wrapCAPI_WAIT_FOR_SIGNAL (DWORD ApplID);
DWORD WINAPI wrapCAPI_GET_MANUFACTURER (char *SzBuffer);
DWORD WINAPI wrapCAPI_GET_VERSION (DWORD *pCAPIMajor, DWORD *pCAPIMinor, DWORD *pManufacturerMajor, DWORD *pManufacturerMinor);
DWORD WINAPI wrapCAPI_GET_SERIAL_NUMBER (char *SzBuffer);
DWORD WINAPI wrapCAPI_GET_PROFILE (PVOID SzBuffer, DWORD CtrlNr);
DWORD WINAPI wrapCAPI_INSTALLED (void);
DWORD WINAPI wrapCAPI_MANUFACTURER (DWORD Class, DWORD Function, DWORD Ctlr, PVOID pParams, DWORD ParamsLen);
/*---------------------------------------------------------------------------*\
\*---------------------------------------------------------------------------*/
#ifdef __cplusplus
}
#endif
/*---------------------------------------------------------------------------*\
\*---------------------------------------------------------------------------*/
#endif

View File

@ -877,9 +877,6 @@
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* Define to the soname of the libcapi20 library. */
#undef SONAME_LIBCAPI20
/* Define to the soname of the libcups library. */
#undef SONAME_LIBCUPS