[Flang-RT] Environment introspection for quadmath.h #130411
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When compiling Flang-RT with Clang, query Clang for the GCC installation it uses. If found, create
quadmath_wrapper.h
that points to thequadmath.h
of that GCC installation.quadmath.h
is only available when compiling with gcc, and Clang has no equivalent even though gcc's version compiles fine with Clang (at least up to and including gcc 13). It is still available in gcc's installation resource dir (in constrast to a system-wide directory such as/usr/include
or/usr/local/include
) and therefore not available to any compiler other than the gcc of that installation. quadmath may also be a different OS package than gcc itself, so it is not necessarily presesent.Clang actually already appropriates a GCC installation for its libraries such that
libquadmath.a
is already found, but it does not do so for the include paths. Because adding that directory to the header search path may have wide-reaching consquences, we create only a wrapper header that points to the realquadmath.h
in the same GCC installation that Clang uses.