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 5/5] Add --enable-newlib-global-stdio-streams


Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
---
 newlib/README                    |  6 ++++++
 newlib/configure                 | 24 ++++++++++++++++++++++--
 newlib/configure.in              | 13 +++++++++++++
 newlib/libc/include/sys/config.h |  6 ++++++
 newlib/newlib.hin                |  5 +++++
 5 files changed, 52 insertions(+), 2 deletions(-)

diff --git a/newlib/README b/newlib/README
index ed8fb3540..78f4de846 100644
--- a/newlib/README
+++ b/newlib/README
@@ -297,6 +297,12 @@ One feature can be enabled by specifying `--enable-FEATURE=yes' or
      is not referenced.
      Disabled by default.
 
+`--enable-newlib-global-stdio-streams'
+     Enable to move the stdio stream FILE objects out of struct _reent and make
+     them global.  The stdio stream pointers of struct _reent are initialized
+     to point to the global stdio FILE stream objects.
+     Disabled by default.
+
 `--enable-newlib-reent-small'
      Enable small reentrant struct support.
      Disabled by default.
diff --git a/newlib/configure b/newlib/configure
index de28c25b3..b2f0b3340 100755
--- a/newlib/configure
+++ b/newlib/configure
@@ -795,6 +795,7 @@ enable_newlib_iconv_external_ccs
 enable_newlib_atexit_dynamic_alloc
 enable_newlib_global_atexit
 enable_newlib_reent_small
+enable_newlib_global_stdio_streams
 enable_newlib_fvwrite_in_streamio
 enable_newlib_fseek_optimization
 enable_newlib_wide_orient
@@ -1467,6 +1468,7 @@ Optional Features:
   --disable-newlib-atexit-dynamic-alloc    disable dynamic allocation of atexit entries
   --enable-newlib-global-atexit	enable atexit data structure as global
   --enable-newlib-reent-small   enable small reentrant struct support
+  --enable-newlib-global-stdio-streams   enable global stdio streams
   --disable-newlib-fvwrite-in-streamio    disable iov in streamio
   --disable-newlib-fseek-optimization    disable fseek optimization
   --disable-newlib-wide-orient    Turn off wide orientation in streamio
@@ -2387,6 +2389,17 @@ else
   newlib_reent_small=
 fi
 
+# Check whether --enable-newlib-global-stdio-streams was given.
+if test "${enable_newlib_global_stdio_streams+set}" = set; then :
+  enableval=$enable_newlib_global_stdio_streams; case "${enableval}" in
+  yes) newlib_global_stdio_streams=yes;;
+  no)  newlib_global_stdio_streams=no ;;
+  *)   as_fn_error $? "bad value ${enableval} for newlib-global-stdio-streams option" "$LINENO" 5 ;;
+ esac
+else
+  newlib_global_stdio_streams=
+fi
+
 # Check whether --enable-newlib-fvwrite-in-streamio was given.
 if test "${enable_newlib_fvwrite_in_streamio+set}" = set; then :
   enableval=$enable_newlib_fvwrite_in_streamio; if test "${newlib_fvwrite_in_streamio+set}" != set; then
@@ -11794,7 +11807,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11797 "configure"
+#line 11810 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -11900,7 +11913,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11903 "configure"
+#line 11916 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -12347,6 +12360,13 @@ _ACEOF
 
 fi
 
+if test "${newlib_global_stdio_streams}" = "yes"; then
+cat >>confdefs.h <<_ACEOF
+#define _WANT_REENT_GLOBAL_STDIO_STREAMS 1
+_ACEOF
+
+fi
+
 if test "${newlib_mb}" = "yes"; then
 cat >>confdefs.h <<_ACEOF
 #define _MB_CAPABLE 1
diff --git a/newlib/configure.in b/newlib/configure.in
index 354c07ca5..5b86ee800 100644
--- a/newlib/configure.in
+++ b/newlib/configure.in
@@ -136,6 +136,15 @@ AC_ARG_ENABLE(newlib-reent-small,
   no)  newlib_reent_small=no ;;
   *)   AC_MSG_ERROR(bad value ${enableval} for newlib-reent-small option) ;;
  esac], [newlib_reent_small=])dnl
+
+dnl Support --enable-newlib-global-stdio-streams
+AC_ARG_ENABLE(newlib-global-stdio-streams,
+[  --enable-newlib-global-stdio-streams   enable global stdio streams],
+[case "${enableval}" in
+  yes) newlib_global_stdio_streams=yes;;
+  no)  newlib_global_stdio_streams=no ;;
+  *)   AC_MSG_ERROR(bad value ${enableval} for newlib-global-stdio-streams option) ;;
+ esac], [newlib_global_stdio_streams=])dnl
  
 dnl Support --disable-newlib-fvwrite-in-streamio
 AC_ARG_ENABLE(newlib-fvwrite-in-streamio,
@@ -400,6 +409,10 @@ if test "${newlib_reent_small}" = "yes"; then
 AC_DEFINE_UNQUOTED(_WANT_REENT_SMALL)
 fi
 
+if test "${newlib_global_stdio_streams}" = "yes"; then
+AC_DEFINE_UNQUOTED(_WANT_REENT_GLOBAL_STDIO_STREAMS)
+fi
+
 if test "${newlib_mb}" = "yes"; then
 AC_DEFINE_UNQUOTED(_MB_CAPABLE)
 AC_DEFINE_UNQUOTED(_MB_LEN_MAX,8)
diff --git a/newlib/libc/include/sys/config.h b/newlib/libc/include/sys/config.h
index ae8caff7b..e45aa5417 100644
--- a/newlib/libc/include/sys/config.h
+++ b/newlib/libc/include/sys/config.h
@@ -276,6 +276,12 @@
 #endif
 #endif
 
+#ifdef _WANT_REENT_GLOBAL_STDIO_STREAMS
+#ifndef _REENT_GLOBAL_STDIO_STREAMS
+#define _REENT_GLOBAL_STDIO_STREAMS
+#endif
+#endif
+
 /* If _MB_EXTENDED_CHARSETS_ALL is set, we want all of the extended
    charsets.  The extended charsets add a few functions and a couple
    of tables of a few K each. */
diff --git a/newlib/newlib.hin b/newlib/newlib.hin
index 397bc9b96..45c683187 100644
--- a/newlib/newlib.hin
+++ b/newlib/newlib.hin
@@ -79,6 +79,11 @@
 /* Define if declare atexit data as global.  */
 #undef _REENT_GLOBAL_ATEXIT
 
+/* Define to move the stdio stream FILE objects out of struct _reent and make
+   them global.  The stdio stream pointers of struct _reent are initialized to
+   point to the global stdio FILE stream objects. */
+#undef _WANT_REENT_GLOBAL_STDIO_STREAMS
+
 /* Define if small footprint nano-formatted-IO implementation used.  */
 #undef _NANO_FORMATTED_IO
 
-- 
2.12.3


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