From 82fdf6f3161f27993d04ca05c37555e4730fda62 Mon Sep 17 00:00:00 2001 From: ruki Date: Fri, 20 Mar 2026 00:50:42 +0800 Subject: fix configure --- .github/workflows/macos.yml | 1 + configure | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 57feb362f..0d4b9a96c 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -25,6 +25,7 @@ jobs: # WyriHaximus/github-action-get-previous-tag@master need it fetch-depth: 0 submodules: true + - name: Prepare local xmake run: cp -rf . ../xmake-source - uses: xmake-io/github-action-setup-xmake@v1 diff --git a/configure b/configure index d5bcbf5a0..0aea7f15b 100755 --- a/configure +++ b/configure @@ -3753,6 +3753,20 @@ _check_cxsnippets() { if test_nz "${CPPFLAGS}"; then compflags="${compflags} ${CPPFLAGS}" fi + # add -isysroot and -target on macOS to ensure system SDK headers are used for option checking + if is_plat "macosx"; then + _os_iorunv "xcrun" "-sdk" "macosx" "--show-sdk-path"; local _sdkdir="${_ret}" + if test_nz "${_sdkdir}"; then + compflags="-isysroot ${_sdkdir} ${compflags}" + path_basename "${_sdkdir}"; local _basename="${_ret}" + if test_nz "${_basename}" && string_startswith "${_basename}" "MacOSX"; then + string_replace "${_basename}" "MacOSX" ""; local _target_minver="${_ret}" + if test_nz "${_target_minver}"; then + compflags="-target ${_target_arch}-apple-macos${_target_minver} ${compflags}" + fi + fi + fi + fi _toolchain_compcmd "${sourcekind}" "${objectfile}" "${sourcefile}" "${compflags}"; local compcmd="${_ret}" if ${xmake_sh_diagnosis}; then print "> ${compcmd}" -- cgit v1.3.1