newlib: filter out versions from newlib.h to simplify autoreconf
We've been manually editing newlib.hin after generating it with autoheader to drop the version defines that we keep in the separate _newlib_version.h header. This is confusing for people, and is an easy source of mistakes/errors. Since we're already running sed on newlib.h during configure to filter out defines we don't want to expose, add the version macros there too. This way we don't have to manually edit newlib.hin. This simplifies the autoreconf step in exchange for a slightly more complicated configure+sed step, but seems worth the trade-off.
This commit is contained in:
parent
65831f88d6
commit
dab15f6740
|
@ -9269,7 +9269,7 @@ $as_echo "$as_me: executing $ac_file commands" >&6;}
|
|||
|
||||
|
||||
case $ac_file$ac_mode in
|
||||
"newlib.h":H) sed -i.tmp -e '/^#define [^_]/d' -e '/^\/\* #undef [^_]/d' newlib.h && rm -f newlib.h.tmp ;;
|
||||
"newlib.h":H) sed -i.tmp -E -e '/^#define [^_]/d' -e '/^\/\* #undef [^_]/d' -e '/_NEWLIB_VERSION|__NEWLIB_(MINOR|PATCHLEVEL)__|__NEWLIB__/d' newlib.h && rm -f newlib.h.tmp ;;
|
||||
"default-1":C)
|
||||
# Only add multilib support code if we just rebuilt the top-level
|
||||
# Makefile.
|
||||
|
|
|
@ -8,8 +8,11 @@ dnl Since we can't control what defines autoheader picks up (various autoconf
|
|||
dnl macros will add their own), filter out all the ones w/out a _ prefix. All
|
||||
dnl the ones we want to export use a _ prefix, and all the rest we don't want
|
||||
dnl to export as it'll pollute the namespace of newlib users.
|
||||
dnl We also filter out version defines that we want in _newlib_version.h.
|
||||
dnl NB: newlib.h must be the first AC_CONFIG_HEADERS call for autoheader.
|
||||
AC_CONFIG_HEADERS([newlib.h:newlib.hin], [sed -i.tmp -e '/^#define [^_]/d' -e '/^\/\* #undef [^_]/d' newlib.h && rm -f newlib.h.tmp])
|
||||
AC_CONFIG_HEADERS(
|
||||
[newlib.h:newlib.hin],
|
||||
[sed -i.tmp -E -e '/^#define [^_]/d' -e '/^\/\* #undef [^_]/d' -e '/_NEWLIB_VERSION|__NEWLIB_(MINOR|PATCHLEVEL)__|__NEWLIB__/d' newlib.h && rm -f newlib.h.tmp])
|
||||
AH_TOP([/* NB: The contents are filtered before being installed. */
|
||||
|
||||
#ifndef __NEWLIB_H__
|
||||
|
|
Loading…
Reference in New Issue