odbc32: Don't load libodbc.so dynamically.

Implementations are guarded by native function pointer checks but all functions
have been present in libodbc for a very long time, so it doesn't appear to be
needed anymore.

The loading code checks the LIB_ODBC_DRIVER_MANAGER environment variable to
allow the user to override the system version of the library. This can be
achieved by other means, if it's still needed.
This commit is contained in:
Hans Leidekker 2024-05-10 11:26:53 +02:00 committed by Alexandre Julliard
parent d206e3ab33
commit af3a8fa27b
7 changed files with 360 additions and 813 deletions

158
configure vendored
View file

@ -700,6 +700,8 @@ DBUS_LIBS
DBUS_CFLAGS
INOTIFY_LIBS
INOTIFY_CFLAGS
ODBC_LIBS
ODBC_CFLAGS
PCSCLITE_LIBS
PCAP_LIBS
WAYLAND_EGL_LIBS
@ -945,6 +947,7 @@ with_inotify
with_krb5
with_mingw
with_netapi
with_odbc
with_opencl
with_opengl
with_osmesa
@ -1811,6 +1814,8 @@ EGL_CFLAGS
EGL_LIBS
WAYLAND_EGL_CFLAGS
WAYLAND_EGL_LIBS
ODBC_CFLAGS
ODBC_LIBS
INOTIFY_CFLAGS
INOTIFY_LIBS
DBUS_CFLAGS
@ -2508,6 +2513,7 @@ Optional Packages:
--without-krb5 do not use krb5 (Kerberos)
--without-mingw do not use the MinGW cross-compiler
--without-netapi do not use the Samba NetAPI library
--without-odbc do not use the ODBC library
--without-opencl do not use OpenCL
--without-opengl do not use OpenGL
--without-osmesa do not use the OSMesa library
@ -2643,6 +2649,8 @@ Some influential environment variables:
C compiler flags for wayland-egl, overriding pkg-config
WAYLAND_EGL_LIBS
Linker flags for wayland-egl, overriding pkg-config
ODBC_CFLAGS C compiler flags for odbc, overriding pkg-config
ODBC_LIBS Linker flags for odbc, overriding pkg-config
INOTIFY_CFLAGS
C compiler flags for libinotify, overriding pkg-config
INOTIFY_LIBS
@ -4369,6 +4377,13 @@ then :
fi
# Check whether --with-odbc was given.
if test ${with_odbc+y}
then :
withval=$with_odbc;
fi
# Check whether --with-opencl was given.
if test ${with_opencl+y}
then :
@ -16599,6 +16614,91 @@ esac
enable_winscard=${enable_winscard:-no}
fi
if test "x$with_odbc" != "xno"
then
rm -f conftest.err
if ${ODBC_CFLAGS:+false} :
then :
if test ${PKG_CONFIG+y}
then :
ODBC_CFLAGS=`$PKG_CONFIG --cflags odbc 2>conftest.err`
fi
fi
if ${ODBC_LIBS:+false} :
then :
if test ${PKG_CONFIG+y}
then :
ODBC_LIBS=`$PKG_CONFIG --libs odbc 2>/dev/null`
fi
fi
ODBC_LIBS=${ODBC_LIBS:-"-lodbc"}
printf "%s\n" "$as_me:${as_lineno-$LINENO}: odbc cflags: $ODBC_CFLAGS" >&5
printf "%s\n" "$as_me:${as_lineno-$LINENO}: odbc libs: $ODBC_LIBS" >&5
if test -s conftest.err; then
printf %s "$as_me:${as_lineno-$LINENO}: odbc errors: " >&5
cat conftest.err >&5
fi
rm -f conftest.err
ac_save_CPPFLAGS=$CPPFLAGS
CPPFLAGS="$CPPFLAGS $ODBC_CFLAGS"
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for SQLConnect in -lodbc" >&5
printf %s "checking for SQLConnect in -lodbc... " >&6; }
if test ${ac_cv_lib_odbc_SQLConnect+y}
then :
printf %s "(cached) " >&6
else $as_nop
ac_check_lib_save_LIBS=$LIBS
LIBS="-lodbc $ODBC_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. */
char SQLConnect ();
int
main (void)
{
return SQLConnect ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"
then :
ac_cv_lib_odbc_SQLConnect=yes
else $as_nop
ac_cv_lib_odbc_SQLConnect=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_odbc_SQLConnect" >&5
printf "%s\n" "$ac_cv_lib_odbc_SQLConnect" >&6; }
if test "x$ac_cv_lib_odbc_SQLConnect" = xyes
then :
:
else $as_nop
ODBC_LIBS=""
fi
CPPFLAGS=$ac_save_CPPFLAGS
fi
if test "x$ODBC_LIBS" = x
then :
case "x$with_odbc" in
x) as_fn_append wine_notices "|libodbc not found, ODBC won't be supported." ;;
xno) ;;
*) as_fn_error $? "libodbc not found, ODBC won't be supported.
This is an error since --with-odbc was requested." "$LINENO" 5 ;;
esac
enable_odbc32=${enable_odbc32:-no}
fi
if test "x$with_inotify" != "xno"
then
rm -f conftest.err
@ -18926,62 +19026,6 @@ printf "%s\n" "#define HAVE_LIBPROCSTAT 1" >>confdefs.h
fi
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for -lodbc" >&5
printf %s "checking for -lodbc... " >&6; }
if test ${ac_cv_lib_soname_odbc+y}
then :
printf %s "(cached) " >&6
else $as_nop
ac_check_soname_save_LIBS=$LIBS
LIBS="-lodbc $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. */
char SQLConnect ();
int
main (void)
{
return SQLConnect ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"
then :
case "$LIBEXT" in
dll) ac_cv_lib_soname_odbc=`$ac_cv_path_LDD conftest.exe | grep "odbc" | sed -e "s/dll.*/dll/"';2,$d'` ;;
dylib) ac_cv_lib_soname_odbc=`$OTOOL -L conftest$ac_exeext | grep "libodbc\\.[0-9A-Za-z.]*dylib" | sed -e "s/^.*\/\(libodbc\.[0-9A-Za-z.]*dylib\).*$/\1/"';2,$d'` ;;
*) ac_cv_lib_soname_odbc=`$READELF -d conftest$ac_exeext | grep "NEEDED.*libodbc\\.$LIBEXT" | sed -e "s/^.*\\[\\(libodbc\\.$LIBEXT[^ ]*\\)\\].*$/\1/"';2,$d'`
if ${ac_cv_lib_soname_odbc:+false} :
then :
ac_cv_lib_soname_odbc=`$LDD conftest$ac_exeext | grep "libodbc\\.$LIBEXT" | sed -e "s/^.*\(libodbc\.$LIBEXT[^ ]*\).*$/\1/"';2,$d'`
fi ;;
esac
else $as_nop
ac_cv_lib_soname_odbc=
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_soname_save_LIBS
fi
if ${ac_cv_lib_soname_odbc:+false} :
then :
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: not found" >&5
printf "%s\n" "not found" >&6; }
printf "%s\n" "#define SONAME_LIBODBC \"libodbc.$LIBEXT\"" >>confdefs.h
else $as_nop
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_soname_odbc" >&5
printf "%s\n" "$ac_cv_lib_soname_odbc" >&6; }
printf "%s\n" "#define SONAME_LIBODBC \"$ac_cv_lib_soname_odbc\"" >>confdefs.h
fi
if test "x$with_netapi" != "xno"
@ -24067,6 +24111,8 @@ WAYLAND_EGL_CFLAGS = $WAYLAND_EGL_CFLAGS
WAYLAND_EGL_LIBS = $WAYLAND_EGL_LIBS
PCAP_LIBS = $PCAP_LIBS
PCSCLITE_LIBS = $PCSCLITE_LIBS
ODBC_CFLAGS = $ODBC_CFLAGS
ODBC_LIBS = $ODBC_LIBS
INOTIFY_CFLAGS = $INOTIFY_CFLAGS
INOTIFY_LIBS = $INOTIFY_LIBS
DBUS_CFLAGS = $DBUS_CFLAGS

View file

@ -42,6 +42,7 @@ AC_ARG_WITH(inotify, AS_HELP_STRING([--without-inotify],[do not use inotify (f
AC_ARG_WITH(krb5, AS_HELP_STRING([--without-krb5],[do not use krb5 (Kerberos)]))
AC_ARG_WITH(mingw, AS_HELP_STRING([--without-mingw],[do not use the MinGW cross-compiler]))
AC_ARG_WITH(netapi, AS_HELP_STRING([--without-netapi],[do not use the Samba NetAPI library]))
AC_ARG_WITH(odbc, AS_HELP_STRING([--without-odbc],[do not use the ODBC library]))
AC_ARG_WITH(opencl, AS_HELP_STRING([--without-opencl],[do not use OpenCL]),
[if test "x$withval" = "xno"; then ac_cv_header_CL_cl_h=no; ac_cv_header_OpenCL_opencl_h=no; fi])
AC_ARG_WITH(opengl, AS_HELP_STRING([--without-opengl],[do not use OpenGL]))
@ -1425,6 +1426,16 @@ WINE_NOTICE_WITH(pcsclite,[test "x$PCSCLITE_LIBS" = x],
[libpcsclite not found, smart cards won't be supported.],
[enable_winscard])
dnl **** Check for libodbc ****
if test "x$with_odbc" != "xno"
then
WINE_PACKAGE_FLAGS(ODBC,[odbc],[-lodbc],,,
[AC_CHECK_LIB(odbc,SQLConnect,[:],[ODBC_LIBS=""],[$ODBC_LIBS])])
fi
WINE_NOTICE_WITH(odbc,[test "x$ODBC_LIBS" = x],
[libodbc not found, ODBC won't be supported.],
[enable_odbc32])
dnl **** Check for inotify ****
if test "x$with_inotify" != "xno"
then
@ -1814,9 +1825,6 @@ then
AC_SUBST(PROCSTAT_LIBS,"-lprocstat")])
fi
dnl **** Check for libodbc ****
WINE_CHECK_SONAME(odbc,SQLConnect,,[AC_DEFINE_UNQUOTED(SONAME_LIBODBC,["libodbc.$LIBEXT"])])
dnl **** Check for libnetapi ****
if test "x$with_netapi" != "xno"
then

View file

@ -2,6 +2,7 @@ MODULE = odbc32.dll
UNIXLIB = odbc32.so
IMPORTLIB = odbc32
IMPORTS = advapi32
UNIX_LIBS = $(ODBC_LIBS)
SOURCES = \
proxyodbc.c \

View file

@ -2929,7 +2929,6 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD reason, LPVOID reserved)
case DLL_PROCESS_DETACH:
if (reserved) break;
WINE_UNIX_CALL( process_detach, NULL );
}
return TRUE;

File diff suppressed because it is too large Load diff

View file

@ -34,7 +34,6 @@
enum sql_funcs
{
process_attach,
process_detach,
unix_SQLAllocConnect,
unix_SQLAllocEnv,
unix_SQLAllocHandle,

View file

@ -759,9 +759,6 @@
/* Define to the soname of the libnetapi library. */
#undef SONAME_LIBNETAPI
/* Define to the soname of the libodbc library. */
#undef SONAME_LIBODBC
/* Define to the soname of the libOSMesa library. */
#undef SONAME_LIBOSMESA