[PATCH 5/8] newlib: move version defines out of the config headers

Mike Frysinger <[email protected]>
Newsgroups gmane.comp.lib.newlib
Message-ID <[email protected]>
This will make it easier to move newlib.h to use autoheader directly.
We only want the newlib version defines in our hand curated version
file, _newlib_version.h, not in the template header, newlib.h, so
using AC_DEFINE doesn't make much sense.
---
 newlib/Makefile.in         |  4 ++++
 newlib/_newlib_version.hin | 16 +++++++++++-----
 newlib/configure           | 16 ++++++----------
 newlib/configure.ac        | 10 ++++++----
 4 files changed, 27 insertions(+), 19 deletions(-)

diff --git a/newlib/_newlib_version.hin b/newlib/_newlib_version.hin
index 03d4e3d471ab..077b81ecf058 100644
--- a/newlib/_newlib_version.hin
+++ b/newlib/_newlib_version.hin
@@ -2,10 +2,16 @@
 #ifndef _NEWLIB_VERSION_H__
 #define _NEWLIB_VERSION_H__ 1
 
-#undef _NEWLIB_VERSION
-#undef __NEWLIB__
-#undef __NEWLIB_MINOR__
-#undef __NEWLIB_PATCHLEVEL__
+/* The newlib version in string format. */
+#define _NEWLIB_VERSION "@NEWLIB_VERSION@"
 
-#endif /* !_NEWLIB_VERSION_H__ */
+/* The newlib major version number. */
+#define __NEWLIB__ @NEWLIB_MAJOR_VERSION@
+
+/* The newlib minor version number. */
+#define __NEWLIB_MINOR__ @NEWLIB_MINOR_VERSION@
 
+/* The newlib patch level. */
+#define __NEWLIB_PATCHLEVEL__ @NEWLIB_PATCHLEVEL_VERSION@
+
+#endif /* !_NEWLIB_VERSION_H__ */
diff --git a/newlib/configure.ac b/newlib/configure.ac
index 01fb2caf1eb4..4942aceae7b1 100644
--- a/newlib/configure.ac
+++ b/newlib/configure.ac
@@ -479,10 +479,12 @@ if test "${newlib_mb}" = "yes"; then
 fi
 AC_DEFINE_UNQUOTED(_MB_LEN_MAX, $_mb_len_max, [Multibyte max length.])
 
-AC_DEFINE(_NEWLIB_VERSION, "NEWLIB_VERSION", [The newlib version in string format.])
-AC_DEFINE(__NEWLIB__, NEWLIB_MAJOR_VERSION, [The newlib major version number.])
-AC_DEFINE(__NEWLIB_MINOR__, NEWLIB_MINOR_VERSION, [The newlib minor version number.])
-AC_DEFINE(__NEWLIB_PATCHLEVEL__, NEWLIB_PATCHLEVEL_VERSION, [The newlib patch level.])
+dnl These are AC_SUBST instead of AC_DEFINE as they're hand maintained in a
+dnl dedicated _newlib_version.h, and we don't want them in newlib.h.
+AC_SUBST([NEWLIB_VERSION])
+AC_SUBST([NEWLIB_MAJOR_VERSION])
+AC_SUBST([NEWLIB_MINOR_VERSION])
+AC_SUBST([NEWLIB_PATCHLEVEL_VERSION])
 
 if test "${multilib}" = "yes"; then
   multilib_arg="--enable-multilib"
-- 
2.33.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.