std.Build.Step.ConfigHeader: Add support for Autoconf-style @FOO@
variables
#22794
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.
Autoconf configuration header templates often use
#undef
directives as substitution hooks, which we already support viaConfigHeader.Style.autoconf
. However, many projects, particularly those using Gnulib, additionally rely on@FOO@
-style output variables for header configuration. While some of these cases can be handled usingStyle.cmake
, this fails when the template happens to contain strings like${FOO}
.For example, the Gnulib header template
lib/unistd.in.h
uses@FOO@
-style substitutions, but also happens to contain the string${LOGNAME-$USER}
in a code comment. This is misinterpreted as a substitution hook byStyle.cmake
. Attempting to work around this by adding a value like.{ @."LOGNAME-$USER" = ... }
toConfigHeader
fails becauseStyle.cmake
rejects the invalid$
character in the variable name.To resolve this issue, this pull request adds a new
Style.autoconf_at
specifically for@FOO@
-style substitutions as used by Autoconf. Additionally,Style.autoconf
is renamed toStyle.autoconf_undef
for clarity. The newStyle.autoconf_at
is similar toStyle.cmake
, but does not perform${}
or#cmakedefine
substitutions, enabling the correct configuration of headers like the one described above.