Skip to content

Commit cf0bcf9

Browse files
committed
fix check option in configure
1 parent d0138aa commit cf0bcf9

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

configure

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3753,6 +3753,20 @@ _check_cxsnippets() {
37533753
if test_nz "${CPPFLAGS}"; then
37543754
compflags="${compflags} ${CPPFLAGS}"
37553755
fi
3756+
# add -isysroot and -target on macOS to ensure system SDK headers are used for option checking
3757+
if is_plat "macosx"; then
3758+
_os_iorunv "xcrun" "-sdk" "macosx" "--show-sdk-path"; local _sdkdir="${_ret}"
3759+
if test_nz "${_sdkdir}"; then
3760+
compflags="-isysroot ${_sdkdir} ${compflags}"
3761+
path_basename "${_sdkdir}"; local _basename="${_ret}"
3762+
if test_nz "${_basename}" && string_startswith "${_basename}" "MacOSX"; then
3763+
string_replace "${_basename}" "MacOSX" ""; local _target_minver="${_ret}"
3764+
if test_nz "${_target_minver}"; then
3765+
compflags="-target ${_target_arch}-apple-macos${_target_minver} ${compflags}"
3766+
fi
3767+
fi
3768+
fi
3769+
fi
37563770
_toolchain_compcmd "${sourcekind}" "${objectfile}" "${sourcefile}" "${compflags}"; local compcmd="${_ret}"
37573771
if ${xmake_sh_diagnosis}; then
37583772
print "> ${compcmd}"

0 commit comments

Comments
 (0)