workaround for wslpath from wsl < 2.4.5 not preserving trailing slash

since b8e6595d47 the UCRTSDKDIR was
converted to the native (windows-style) path in the test block already
while previously it was converted as part of the post-AC_CONFIG_FILES
script that mass-converts paths when creating config_host.mk
With the conversion to unix path in wsl < 2.4.5 dropping the trailing
slash from the path, configure then fails with "Could not figure out
what C++ library this is" since it just appends the include path
assuming the trailing slash to be present, resulting in
-IC:/PROGRA~2/WI3CF2~1/10Include/10.0.26100.0/ucrt
                         ^ missing path delimiter here
ultimately failing to include necessary headers and thus failing the
check.

So explicitly check whether the unix-path (that preserves the slash) has
a trailing slash and if so make sure it is also added to the native path
if necessary.

Change-Id: I0ff4e2007af48fc09db4b8a80413dc87f849537a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205440
Tested-by: Jenkins
Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
This commit is contained in:
Christian Lohmaier
2026-05-22 14:51:19 +02:00
parent 523e6ac418
commit 4863d6b259
+13
View File
@@ -223,6 +223,19 @@ PathFormat()
formatted_path_unix=$(wslpath -u "$(cd /mnt/c; cmd.exe /c $shortpath_cmd "$formatted_path" | tr -d '\r')")
# WSL can't run Windows binaries from Windows pathnames so we need a separate return value in Unix format
formatted_path=$(wslpath -m "$formatted_path_unix")
# workaround for wsl < 2.4.5 not preserving the trailing slash, use case statement since
# ${VARIABLE: -1} / using offsets is not in POSIX sh
case "$formatted_path_unix" in
*/)
case "$formatted_path" in
*/)
;;
*)
formatted_path="$formatted_path/"
;;
esac
;;
esac
elif test "$build_os" = "cygwin"; then
# while for cygwin there's no difference between the different realms during configure and
# during the build, AC_PATH_PROG still only accepts a path starting with / as valid, so also