From ec4c3c4317f8d0574aaaabc09a2eb0d72ee3475d Mon Sep 17 00:00:00 2001 From: Tormod Volden Date: Sun, 4 Sep 2022 18:36:57 +0200 Subject: windows: Only link with --add-stdcall-alias if supported by linker E.g. the LLVM LLD doesn't support this option. Closes #1192 References #944 Signed-off-by: Tormod Volden --- configure.ac | 14 +++++++++++++- libusb/version_nano.h | 2 +- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 0f3d79e..d5b50ab 100644 --- a/configure.ac +++ b/configure.ac @@ -224,7 +224,7 @@ sunos) windows) AC_CHECK_TYPES([struct timespec], [], [], [[#include ]]) AC_DEFINE([_WIN32_WINNT], [_WIN32_WINNT_VISTA], [Define to the oldest supported Windows version.]) - LT_LDFLAGS="${LT_LDFLAGS} -avoid-version -Wl,--add-stdcall-alias" + LT_LDFLAGS="${LT_LDFLAGS} -avoid-version" ;; emscripten) AC_SUBST(EXEEXT, [.html]) @@ -402,6 +402,18 @@ if test "x$backend" = xwindows; then CFLAGS="${saved_CFLAGS}" fi +dnl Some linkers do not support the '--add-stdcall-alias' option so check for it here +if test "x$backend" = xwindows; then + saved_CFLAGS="${CFLAGS}" + CFLAGS="-Wl,--add-stdcall-alias" + AC_MSG_CHECKING([if linker supports --add-stdcall-alias]) + AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], + [AC_MSG_RESULT([yes]) + LT_LDFLAGS="${LT_LDFLAGS} -Wl,--add-stdcall-alias"], + [AC_MSG_RESULT([no])]) + CFLAGS="${saved_CFLAGS}" +fi + SHARED_CFLAGS="-Wall -Wextra -Wshadow -Wunused -Wwrite-strings -Werror=format-security -Werror=implicit-function-declaration -Werror=implicit-int -Werror=init-self -Werror=missing-prototypes -Werror=strict-prototypes -Werror=undef -Werror=uninitialized" AM_CPPFLAGS="${EXTRA_CPPFLAGS}" diff --git a/libusb/version_nano.h b/libusb/version_nano.h index a346258..cf38400 100644 --- a/libusb/version_nano.h +++ b/libusb/version_nano.h @@ -1 +1 @@ -#define LIBUSB_NANO 11780 +#define LIBUSB_NANO 11781 -- cgit v1.2.1