From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) by sourceware.org (Postfix) with ESMTP id 369B23858030 for ; Tue, 18 Jan 2022 04:48:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 369B23858030 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gentoo.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gentoo.org Received: by smtp.gentoo.org (Postfix, from userid 559) id CE986342D87; Tue, 18 Jan 2022 04:48:51 +0000 (UTC) From: Mike Frysinger To: newlib@sourceware.org Subject: [PATCH 8/8] newlib: switch newlib.h to autoheader Date: Mon, 17 Jan 2022 23:47:41 -0500 Message-Id: <20220118044741.21027-9-vapier@gentoo.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20220118044741.21027-1-vapier@gentoo.org> References: <20220118044741.21027-1-vapier@gentoo.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-11.5 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: newlib@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Newlib mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Jan 2022 04:48:53 -0000 Now that newlib.hin has been brought up to date and all of its defines are produced by configure, we can switch it to using autoheader without manual editing. This relies on a few pieces: * Moving the header & footer into configure.ac via AH_TOP & AH_BOTTOM. * Running a post-process step on newlib.h to delete all the defines we didn't export ourselves. Basically, anything without a _ prefix. This will leave behind some spurious comments in newlib.h related to the defines we filtered out, but should be harmless, so it's probably not worth the effort to construct a more complicated sed expression to also strip those out. --- newlib/Makefile.in | 26 +++++++++---------- newlib/configure | 15 ++++++++--- newlib/configure.ac | 18 ++++++++++++- newlib/newlib.hin | 63 ++++++++++++++++++++++++++++++++++++++++++--- 4 files changed, 100 insertions(+), 22 deletions(-) diff --git a/newlib/configure.ac b/newlib/configure.ac index cb65cdd78778..69b3e827f08e 100644 --- a/newlib/configure.ac +++ b/newlib/configure.ac @@ -3,7 +3,23 @@ dnl Process this file with autoconf to produce a configure script. AC_INIT([newlib],[NEWLIB_VERSION]) AC_CONFIG_SRCDIR([libc]) -AC_CONFIG_HEADERS([_newlib_version.h:_newlib_version.hin newlib.h:newlib.hin]) + +dnl Since we can't control what defines autoheader picks up (various autoconf +dnl macros will add their own), filter out all the ones with 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 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]) +AH_TOP([/* NB: The contents are filtered before being installed. */ + +#ifndef __NEWLIB_H__ +#define __NEWLIB_H__ 1 + +/* Newlib version */ +#include <_newlib_version.h>]) +AH_BOTTOM([#endif /* !__NEWLIB_H__ */]) + +AC_CONFIG_HEADERS([_newlib_version.h:_newlib_version.hin]) dnl Can't be done in NEWLIB_CONFIGURE because that confuses automake. AC_CONFIG_AUX_DIR(..) diff --git a/newlib/newlib.hin b/newlib/newlib.hin index 15543f4030a4..69a7cb7a7480 100644 --- a/newlib/newlib.hin +++ b/newlib/newlib.hin @@ -1,13 +1,68 @@ -/* newlib.hin. Manually edited from the output of autoheader to - remove all PACKAGE_ macros which will collide with any user - package using newlib header files and having its own package name, - version, etc... */ +/* newlib.hin. Generated from configure.ac by autoheader. */ + +/* NB: The contents are filtered before being installed. */ + #ifndef __NEWLIB_H__ #define __NEWLIB_H__ 1 /* Newlib version */ #include <_newlib_version.h> +/* Define to 1 if you have the header file. */ +#undef HAVE_DLFCN_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_INTTYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_UNISTD_H + +/* Define to the sub-directory in which libtool stores uninstalled libraries. + */ +#undef LT_OBJDIR + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the home page for this package. */ +#undef PACKAGE_URL + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + /* If atexit() may dynamically allocate space for cleanup functions. */ #undef _ATEXIT_DYNAMIC_ALLOC -- 2.33.0