This is an automated email from the ASF dual-hosted git repository.

jimjag pushed a commit to branch msys2-dev-prototype
in repository https://gitbox.apache.org/repos/asf/openoffice.git


The following commit(s) were added to refs/heads/msys2-dev-prototype by this 
push:
     new 49c2cd0cbf Give the ATL probe the include set ATL is actually written 
against
49c2cd0cbf is described below

commit 49c2cd0cbfa22632c688c8eb6dbdd1ed3b71a902
Author: Jim Jagielski <[email protected]>
AuthorDate: Tue Aug 11 13:54:49 2026 -0400

    Give the ATL probe the include set ATL is actually written against
    
    Its SAL annotations come from the SDK's sal.h, which mingw's cut-down copy 
does
    not define, so atlmfc/include alone could only ever fail.  Putting MSVC's 
CRT
    headers and the SDK's ucrt/shared/um on the path is what plan B2 proposes, 
and
    therefore the configuration whose outcome means something.
    
    Also find a JDK installed off the MSYS2 PATH, which is where a native 
installer
    leaves one and is no obstacle to --with-jdk-home.
---
 msys2-probe.sh | 57 ++++++++++++++++++++++++++++++++++++++++++++++++---------
 1 file changed, 48 insertions(+), 9 deletions(-)

diff --git a/msys2-probe.sh b/msys2-probe.sh
index 891f4a8c7f..2350a1c1a8 100755
--- a/msys2-probe.sh
+++ b/msys2-probe.sh
@@ -453,18 +453,41 @@ struct Probe { CComPtr<IUnknown> p; CComBSTR s; };'
     # libc++ before ATL is reached -- which tells us nothing about ATL itself.
     atl_try() { printf '%s\n' "$ATL_SRC" | CPATH="$ATL_CPATH" try_compile "$1" 
cxx "$2" compile; }
 
-    if atl_try atl "-fms-extensions -fms-compatibility"; then
-        pass "ATL compiles under clang" "the plan's Phase 3 estimate holds"
-    elif atl_try atl_nocompat "-fms-extensions"; then
+    # ATL is written against the whole MSVC/SDK header universe, not just
+    # atlmfc/include: its SAL annotations (_Ret_opt_) live in the SDK's sal.h,
+    # which mingw's cut-down copy does not define.  Assemble that include set 
--
+    # a response file because these paths contain spaces.  This is what plan B2
+    # actually proposes, so it is the configuration worth measuring.
+    ATL_RSP="$TMP/atl_sdk.rsp"
+    : > "$ATL_RSP"
+    add_isystem() { [ -d "$1" ] && printf -- '-isystem "%s"\n' \
+        "$(cygpath -m "$1" 2>/dev/null || echo "$1")" >> "$ATL_RSP"; return 0; 
}
+
+    add_isystem "${ATL_DIR%/atlmfc/include}/include"
+    SDK_INC=""
+    for d in /c/Program\ Files\ \(x86\)/Windows\ Kits/10/Include/* \
+             /c/Program\ Files/Windows\ Kits/10/Include/* ; do
+        [ -d "$d/um" ] && SDK_INC="$d"
+    done
+    for sub in ucrt shared um winrt; do add_isystem "$SDK_INC/$sub"; done
+    ATL_RSP_ARG="@$(cygpath -m "$ATL_RSP" 2>/dev/null || echo "$ATL_RSP")"
+    info "MSVC/SDK include set" "${SDK_INC:-<no Windows SDK Include dir 
found>}"
+
+    if atl_try atl_sdk "-fms-extensions -fms-compatibility $ATL_RSP_ARG"; then
+        pass "ATL compiles under clang" \
+             "with the MSVC/SDK include set; atls.lib linkage is still open 
(plan B2)"
+    elif atl_try atl_sdk_nocompat "-fms-extensions $ATL_RSP_ARG"; then
         pass "ATL compiles under clang" \
-             "only without -fms-compatibility, which the mingw header set 
rejects"
+             "with the MSVC/SDK include set, without -fms-compatibility"
+    elif atl_try atl "-fms-extensions -fms-compatibility"; then
+        pass "ATL compiles under clang" "atlmfc/include alone sufficed"
     else
         fail "ATL does not compile under clang" \
              "reinstates the de-ATL port; re-estimate Phase 3 at 6-10 weeks" 
HIGH
-        head2 "with -fms-compatibility"
-        show_log atl
-        head2 "with -fms-extensions alone"
-        show_log atl_nocompat
+        head2 "MSVC/SDK include set, with -fms-compatibility"
+        show_log atl_sdk
+        head2 "MSVC/SDK include set, with -fms-extensions alone"
+        show_log atl_sdk_nocompat
     fi
 fi
 
@@ -513,7 +536,23 @@ if command -v javac >/dev/null 2>&1; then
     pass "javac" "$(javac -version 2>&1 | head -1)"
     info "JAVA_HOME" "${JAVA_HOME:-<unset>}"
 else
-    warn "javac not found" "install a native Windows JDK; MSYS2 ships none"
+    # A native JDK off the MSYS2 PATH is the normal case, and no obstacle:
+    # configure takes --with-jdk-home rather than requiring javac on PATH.
+    JDK=""
+    for cand in "${JAVA_HOME:-}" \
+        /c/Program\ Files/OpenLogic/* \
+        /c/Program\ Files/Eclipse\ Adoptium/* \
+        /c/Program\ Files/Java/* \
+        /c/Program\ Files/Microsoft/jdk* ; do
+        if [ -n "$cand" ] && [ -x "$cand/bin/javac.exe" ]; then JDK="$cand"; 
break; fi
+    done
+    if [ -n "$JDK" ]; then
+        pass "JDK found off PATH" \
+             "--with-jdk-home=$(cygpath -m "$JDK" 2>/dev/null || echo "$JDK")"
+        info "javac version" "$("$JDK/bin/javac.exe" -version 2>&1 | head -1)"
+    else
+        warn "javac not found" "install a native Windows JDK; MSYS2 ships none"
+    fi
 fi
 
 # ------------------------------------------------------- system-lib packages 
--

Reply via email to