Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2022-01-18 04:10:38 +0300
committerMike Frysinger <vapier@gentoo.org>2022-01-20 03:59:16 +0300
commit0a67325726577e189c65e7c190f3f9e0874143a6 (patch)
tree89a129513dbd797f6086a993d36526e0d6487ff9 /newlib/configure.ac
parentb86dc2dab4981ba92d683b866badc0b32be39120 (diff)
newlib: switch newlib.h to autoheader
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.
Diffstat (limited to 'newlib/configure.ac')
-rw-r--r--newlib/configure.ac18
1 files changed, 17 insertions, 1 deletions
diff --git a/newlib/configure.ac b/newlib/configure.ac
index d95000db9..b4d11f5e3 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 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 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(..)