This is the mail archive of the mailing list for the newlib project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Automated the generation of the __NEWLIB__, __NEWLIB_MINOR__ and __NEWLIB_PATCHLEVEL__ macros.

Currently, the newlib version information needs to be setnewlib/acinclude.m4
in two places:
 - newlib/acinclude.m4
 - newlib/libc/include/sys/features.h

This patch moves the definition of the __NEWLIB__ and __NEWLIB_MINOR__
macros from newlib/libc/include/sys/features.h, to the generated
newlib/newlib.h file. Additionally, the __NEWLIB_PATCHLEVEL__ macro
was created, for completeness. This is in line with what gcc does
for its versioning macros.

Signed-off-by: Pieter du Preez <>
 newlib/acinclude.m4                | 6 ++++--
 newlib/                | 3 +++
 newlib/libc/include/sys/features.h | 6 ------
 newlib/newlib.hin                  | 3 +++
 4 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/newlib/acinclude.m4 b/newlib/acinclude.m4
index 9fefa32..a35264e 100644
--- a/newlib/acinclude.m4
+++ b/newlib/acinclude.m4
@@ -1,8 +1,10 @@
 dnl This provides configure definitions used by all the newlib
 dnl files.
 dnl Basic newlib configury.  This calls basic introductory stuff,
 dnl including AM_INIT_AUTOMAKE and AC_CANONICAL_HOST.  It also runs
diff --git a/newlib/ b/newlib/
index 9465787..77ede3d 100644
--- a/newlib/
+++ b/newlib/
 if test "${multilib}" = "yes"; then
diff --git a/newlib/libc/include/sys/features.h b/newlib/libc/include/sys/features.h
index 4ad7fbd..9298cb1 100644
--- a/newlib/libc/include/sys/features.h
+++ b/newlib/libc/include/sys/features.h
@@ -25,12 +25,6 @@
 extern "C" {
-/* Macros to determine that newlib is being used.  Put in this header to 
- * be similar to where glibc stores its version of these macros.
- */
-#define __NEWLIB__  		2
-#define __NEWLIB_MINOR__  	2
 /* Macro to test version of GCC.  Returns 0 for non-GCC or too old GCC. */
 #ifndef __GNUC_PREREQ
 # if defined __GNUC__ && defined __GNUC_MINOR__
diff --git a/newlib/newlib.hin b/newlib/newlib.hin
index eadafc8..ffd0538 100644
--- a/newlib/newlib.hin
+++ b/newlib/newlib.hin
@@ -11,6 +11,9 @@
 /* Newlib version */
+#undef __NEWLIB__
+#undef __NEWLIB_MINOR__
 /* C99 formats support (such as %a, %zu, ...) in IO functions like
  * printf/scanf enabled */

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]