@@ -44,18 +44,23 @@ else:
4444 config.substitutions.insert(0, (' %target-abi' , ' SYSV' ))
4545 config.substitutions.insert(0, (' %target-swift-flags' , ' ' ))
4646
47- # target_sdk_libcxx_path is empty when targeting non-Darwin platforms
48- config.target_libcxx_path = config.target_sdk_libcxx_path
49-
5047if get_target_os() in [' linux-gnu' ]:
51- for p in [' /usr/include/c++/v1' , ' /usr/local/include/c++/v1' ]:
52- if os.path.exists(p) or os.path.exists(p):
53- config.available_features.add(' system_wide_libcxx' )
54- config.target_libcxx_path = p
48+ if os.path.exists(' /usr/include/c++/v1' ) or os.path.exists(' /usr/local/include/c++/v1' ):
49+ config.available_features.add(' system_wide_libcxx' )
5550
56- if config.target_libcxx_path != ' ' :
51+ if config.target_sdk_libcxx_path != ' ' :
5752 if os.path.exists(os.path.join(config.target_sdk_libcxx_path, " span" )):
5853 config.available_features.add(' std_span' )
54+ elif get_target_os() in [' linux-gnu' ]:
55+ for p in [' /usr/include/c++/' , ' /usr/local/include/c++/' ]:
56+ if not os.path.isdir(p):
57+ continue
58+ for subdir in os.listdir(p):
59+ if not subdir.isdigit():
60+ # skip paths libc++ paths like /usr/include/c++/v1, we want libstdc++ paths only (like /usr/include/c++/13)
61+ continue
62+ if os.path.exists(os.path.join(p, subdir, " span" )):
63+ config.available_features.add(' std_span' )
5964elif get_target_os() in [' windows-msvc' ]:
6065 # We don't test on any versions of MSVC without std::span support.
6166 # FIXME: figure out where to do lookup for C++ stdlib headers on Windows - we'll probably need it eventually
0 commit comments