These two patches improve the detection of preinstalled libraries on native Windows: - by accepting --host=x86_64-windows, - by fixing the detection of static (non-shared) libraries on mingw, - by making it work at all on MSVC.
2026-12-02 Bruno Haible <[email protected]> havelib: Add support for MSVC. * build-aux/config.rpath (MSVC): New variable. (libext): Don't make assumptions about the compiler. (libname_spec): With MSVC, drop the 'lib' prefix. (library_names_spec): Correct value for mingw and value for MSVC. 2026-12-02 Bruno Haible <[email protected]> havelib: Recognize the *-*-windows* config triplets introduced in 2023. * build-aux/config.libpath: Treat windows* as equivalent to mingw*. * build-aux/config.rpath: Likewise.
From 1f4e0c73793dda74491dad753dd85aeb1c876098 Mon Sep 17 00:00:00 2001 From: Bruno Haible <[email protected]> Date: Wed, 2 Dec 2026 22:18:21 +0100 Subject: [PATCH 1/2] havelib: Recognize the *-*-windows* config triplets introduced in 2023. * build-aux/config.libpath: Treat windows* as equivalent to mingw*. * build-aux/config.rpath: Likewise. --- ChangeLog | 6 ++++++ build-aux/config.libpath | 2 +- build-aux/config.rpath | 10 +++++----- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 84a98f0223..58e6bb5878 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2026-12-02 Bruno Haible <[email protected]> + + havelib: Recognize the *-*-windows* config triplets introduced in 2023. + * build-aux/config.libpath: Treat windows* as equivalent to mingw*. + * build-aux/config.rpath: Likewise. + 2026-12-02 Pádraig Brady <[email protected]> mcel: fix missing wchar.h dependency diff --git a/build-aux/config.libpath b/build-aux/config.libpath index 9ec90a7511..9c035541ef 100755 --- a/build-aux/config.libpath +++ b/build-aux/config.libpath @@ -126,7 +126,7 @@ case $host_os in bsdi[45]*) shlibpath_var=LD_LIBRARY_PATH ;; - cygwin* | mingw* | pw32* | cegcc*) + cygwin* | mingw* | windows* | pw32* | cegcc*) # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; diff --git a/build-aux/config.rpath b/build-aux/config.rpath index 1119d6ab38..80940d0c63 100755 --- a/build-aux/config.rpath +++ b/build-aux/config.rpath @@ -124,7 +124,7 @@ else aix*) wl='-Wl,' ;; - mingw* | cygwin* | pw32* | os2* | cegcc*) + cygwin* | mingw* | windows* | pw32* | os2* | cegcc*) ;; hpux9* | hpux10* | hpux11*) wl='-Wl,' @@ -216,7 +216,7 @@ hardcode_direct=no hardcode_minus_L=no case "$host_os" in - cygwin* | mingw* | pw32* | cegcc*) + cygwin* | mingw* | windows* | pw32* | cegcc*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. @@ -265,7 +265,7 @@ if test "$with_gnu_ld" = yes; then ld_shlibs=no fi ;; - cygwin* | mingw* | pw32* | cegcc*) + cygwin* | mingw* | windows* | pw32* | cegcc*) # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. hardcode_libdir_flag_spec='-L$libdir' @@ -415,7 +415,7 @@ else ;; bsdi[45]*) ;; - cygwin* | mingw* | pw32* | cegcc*) + cygwin* | mingw* | windows* | pw32* | cegcc*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is @@ -600,7 +600,7 @@ case "$host_os" in bsdi[45]*) library_names_spec='$libname$shrext' ;; - cygwin* | mingw* | pw32* | cegcc*) + cygwin* | mingw* | windows* | pw32* | cegcc*) shrext=.dll library_names_spec='$libname.dll.a $libname.lib' ;; -- 2.53.0
>From eedf47b2d43288f528db62ccd1cd2ce55eda92d4 Mon Sep 17 00:00:00 2001 From: Bruno Haible <[email protected]> Date: Thu, 3 Dec 2026 00:21:19 +0100 Subject: [PATCH 2/2] havelib: Add support for MSVC. * build-aux/config.rpath (MSVC): New variable. (libext): Don't make assumptions about the compiler. (libname_spec): With MSVC, drop the 'lib' prefix. (library_names_spec): Correct value for mingw and value for MSVC. --- ChangeLog | 8 ++++++++ build-aux/config.rpath | 33 ++++++++++++++++++++++++--------- 2 files changed, 32 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 58e6bb5878..525b650eee 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2026-12-02 Bruno Haible <[email protected]> + + havelib: Add support for MSVC. + * build-aux/config.rpath (MSVC): New variable. + (libext): Don't make assumptions about the compiler. + (libname_spec): With MSVC, drop the 'lib' prefix. + (library_names_spec): Correct value for mingw and value for MSVC. + 2026-12-02 Bruno Haible <[email protected]> havelib: Recognize the *-*-windows* config triplets introduced in 2023. diff --git a/build-aux/config.rpath b/build-aux/config.rpath index 80940d0c63..a3d10d49b9 100755 --- a/build-aux/config.rpath +++ b/build-aux/config.rpath @@ -92,16 +92,28 @@ if test $# -lt 1; then func_fatal_error "too few arguments" fi -# All known linkers require a '.a' archive for static linking (except MSVC, -# which needs '.lib'). -libext=a -shrext=.so - host="$1" host_cpu=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` host_vendor=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` host_os=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +# Test whether the compiler is MSVC (or an MSVC-compatible clang). +MSVC=no +case "$host_os" in + mingw* | windows*) + { echo '#ifdef _MSC_VER'; echo 'msvc'; echo '#endif'; } > conftest.c + if $CC -E conftest.c | grep msvc > /dev/null; then + MSVC=yes + fi + rm -f conftest.c + ;; +esac + +# All known linkers require a '.a' archive for static linking (except MSVC, +# which needs '.lib'). +libext=a +shrext=.so + # Code taken from libtool.m4's _LT_CC_BASENAME. for cc_temp in $CC""; do @@ -416,12 +428,9 @@ else bsdi[45]*) ;; cygwin* | mingw* | windows* | pw32* | cegcc*) - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. hardcode_libdir_flag_spec=' ' - libext=lib ;; darwin* | rhapsody*) hardcode_direct=no @@ -601,8 +610,14 @@ case "$host_os" in library_names_spec='$libname$shrext' ;; cygwin* | mingw* | windows* | pw32* | cegcc*) + if test $MSVC = yes; then + libext=lib + libname_spec='$name' + library_names_spec='$libname.dll.lib $libname.lib' + else + library_names_spec='$libname.dll.a $libname.a' + fi shrext=.dll - library_names_spec='$libname.dll.a $libname.lib' ;; darwin* | rhapsody*) shrext=.dylib -- 2.53.0
