From: Jonathan Wakely Date: Fri, 19 Sep 2025 11:11:26 +0000 (+0100) Subject: libstdc++: Remove unwanted PACKAGE macros from c++config.h [PR79147] X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1953939243e1ab8c839c1bcb2a072d1e84627afe;p=thirdparty%2Fgcc.git libstdc++: Remove unwanted PACKAGE macros from c++config.h [PR79147] Autoconf insists on adding macros like PACKAGE_NAME and PACKAGE_BUG_TARNAME to config.h but those are useless for libstdc++ because it's not a complete package, just a sub-directory of gcc, and we never use any of those strings in our sources. Since we include the generated config.h in our installed c++config.h header, those useless macros are exposed to users. We do transform them to use the reserved _GLIBCXX_ prefix, but they're still just useless noise in the installed header. I don't know any way to get autoconf to not add them to config.h but this change comments them out so they're not defined when users include our headers. Although not really important now that the macro isn't being defined, this change also avoids the double substitution for PACKAGE_VERSION which was resulting in _GLIBCXX_PACKAGE__GLIBCXX_VERSION. libstdc++-v3/ChangeLog: PR libstdc++/79147 * include/Makefile.am (c++config.h): Adjust sed command to comment out all PACKAGE_XXX macros and to avoid adjusting PACKAGE_VERSION twice. * include/Makefile.in: Regenerate. --- diff --git a/libstdc++-v3/include/Makefile.am b/libstdc++-v3/include/Makefile.am index 0b0cbe2d3fa..d1e5c3d8491 100644 --- a/libstdc++-v3/include/Makefile.am +++ b/libstdc++-v3/include/Makefile.am @@ -1420,8 +1420,8 @@ ${host_builddir}/c++config.h: ${CONFIG_HEADER} \ -e "$$verbose_assert" \ < ${glibcxx_srcdir}/include/bits/c++config > $@ ;\ sed -e 's/HAVE_/_GLIBCXX_HAVE_/g' \ - -e 's/PACKAGE/_GLIBCXX_PACKAGE/g' \ - -e 's/VERSION/_GLIBCXX_VERSION/g' \ + -e '/PACKAGE/s,^,// ,' \ + -e '/PACKAGE/!s/VERSION/_GLIBCXX_VERSION/g' \ -e 's/WORDS_/_GLIBCXX_WORDS_/g' \ -e 's/LT_OBJDIR/_GLIBCXX_LT_OBJDIR/g' \ -e 's/STDC_HEADERS/_GLIBCXX_STDC_HEADERS/g' \ diff --git a/libstdc++-v3/include/Makefile.in b/libstdc++-v3/include/Makefile.in index e3a6d5f1390..13c0b5b4f83 100644 --- a/libstdc++-v3/include/Makefile.in +++ b/libstdc++-v3/include/Makefile.in @@ -1897,8 +1897,8 @@ ${host_builddir}/c++config.h: ${CONFIG_HEADER} \ -e "$$verbose_assert" \ < ${glibcxx_srcdir}/include/bits/c++config > $@ ;\ sed -e 's/HAVE_/_GLIBCXX_HAVE_/g' \ - -e 's/PACKAGE/_GLIBCXX_PACKAGE/g' \ - -e 's/VERSION/_GLIBCXX_VERSION/g' \ + -e '/PACKAGE/s,^,// ,' \ + -e '/PACKAGE/!s/VERSION/_GLIBCXX_VERSION/g' \ -e 's/WORDS_/_GLIBCXX_WORDS_/g' \ -e 's/LT_OBJDIR/_GLIBCXX_LT_OBJDIR/g' \ -e 's/STDC_HEADERS/_GLIBCXX_STDC_HEADERS/g' \