This is the mail archive of the newlib@sourceware.org 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 <pdupreez@gmail.com>
---
 newlib/acinclude.m4                | 6 ++++--
 newlib/configure.in                | 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 configure.in files.
 
-AC_DEFUN([DEF_NEWLIB_VERSION],
-m4_define([NEWLIB_VERSION],[2.3.0]))
+AC_DEFUN([DEF_NEWLIB_MAJOR_VERSION],m4_define([NEWLIB_MAJOR_VERSION],[2]))
+AC_DEFUN([DEF_NEWLIB_MINOR_VERSION],m4_define([NEWLIB_MINOR_VERSION],[3]))
+AC_DEFUN([DEF_NEWLIB_PATCHLEVEL_VERSION],m4_define([NEWLIB_PATCHLEVEL_VERSION],[0]))
+AC_DEFUN([DEF_NEWLIB_VERSION],m4_define([NEWLIB_VERSION],[NEWLIB_MAJOR_VERSION.NEWLIB_MINOR_VERSION.NEWLIB_PATCHLEVEL_VERSION]))
 
 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/configure.in b/newlib/configure.in
index 9465787..77ede3d 100644
--- a/newlib/configure.in
+++ b/newlib/configure.in
@@ -385,6 +385,9 @@ AC_DEFINE_UNQUOTED(_ICONV_ENABLE_EXTERNAL_CCS)
 fi
 
 AC_DEFINE_UNQUOTED(_NEWLIB_VERSION,"NEWLIB_VERSION")
+AC_DEFINE_UNQUOTED(__NEWLIB__,NEWLIB_MAJOR_VERSION)
+AC_DEFINE_UNQUOTED(__NEWLIB_MINOR__,NEWLIB_MINOR_VERSION)
+AC_DEFINE_UNQUOTED(__NEWLIB_PATCHLEVEL__,NEWLIB_PATCHLEVEL_VERSION)
 
 if test "${multilib}" = "yes"; then
   multilib_arg="--enable-multilib"
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" {
 #endif
 
-/* 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_VERSION
+#undef __NEWLIB__
+#undef __NEWLIB_MINOR__
+#undef __NEWLIB_PATCHLEVEL__
 
 /* C99 formats support (such as %a, %zu, ...) in IO functions like
  * printf/scanf enabled */
-- 
2.7.0.rc3


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