From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1521) id 253453870C26; Tue, 28 Nov 2023 17:51:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 253453870C26 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1701193894; bh=Ys85sG2bNcSyzkCZ7MJRjfa/sfTDd2Z9daFvOEggX9A=; h=From:To:Subject:Date:From; b=B6S7wFcEaF6Lz8gEmzOg9wBfdNaadO9SBJh/szFccg90hhYqPKjEbkNV6CwLrfEsS QhU5Qe/KWrfc38XnjIiGIhehzhArgZsWUeSaWfRSvJwDGnmPbBT4hePTC7GzGg9m0v kBDJcrl9s9HOKR9v1XUNq3G3jb4CqBv5X8ZF4x/A= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Michael Frysinger To: newlib-cvs@sourceware.org Subject: [newlib-cygwin/main] newlib: filter out versions from newlib.h to simplify autoreconf X-Act-Checkin: newlib-cygwin X-Git-Author: Mike Frysinger X-Git-Refname: refs/heads/main X-Git-Oldrev: 65831f88d6c4cd943969b5ee531bc6162c7b0f60 X-Git-Newrev: dab15f6740ff73e8b17b7ddddcbb678895a916a2 Message-Id: <20231128175134.253453870C26@sourceware.org> Date: Tue, 28 Nov 2023 17:51:34 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dnewlib-cygwin.git;h=3Ddab15f6740f= f73e8b17b7ddddcbb678895a916a2 commit dab15f6740ff73e8b17b7ddddcbb678895a916a2 Author: Mike Frysinger Date: Sun Oct 15 15:14:13 2023 +0545 newlib: filter out versions from newlib.h to simplify autoreconf =20 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. =20 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. =20 This simplifies the autoreconf step in exchange for a slightly more complicated configure+sed step, but seems worth the trade-off. Diff: --- newlib/configure | 2 +- newlib/configure.ac | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/newlib/configure b/newlib/configure index 0585e0ee8..b21d9bf45 100755 --- a/newlib/configure +++ b/newlib/configure @@ -9269,7 +9269,7 @@ $as_echo "$as_me: executing $ac_file commands" >&6;} =20 =20 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' newl= ib.h && rm -f newlib.h.tmp ;; "default-1":C) # Only add multilib support code if we just rebuilt the top-level # Makefile. diff --git a/newlib/configure.ac b/newlib/configure.ac index 94242c082..55e5a9446 100644 --- a/newlib/configure.ac +++ b/newlib/configure.ac @@ -8,8 +8,11 @@ dnl Since we can't control what defines autoheader picks u= p (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 w= ant 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 '/_NEW= LIB_VERSION|__NEWLIB_(MINOR|PATCHLEVEL)__|__NEWLIB__/d' newlib.h && rm -f n= ewlib.h.tmp]) AH_TOP([/* NB: The contents are filtered before being installed. */ =20 #ifndef __NEWLIB_H__