This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ 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]

[v3] glibc2.3, new automake/conf linux patches


This patches allows compilation on newer systems, specifically glibc 2.3.x. 

For some reason, on such newer systems, or ones without autotools
installed, or with newer autotools than can be used installed,
compilation breaks down with:

 libtool: compile: specify a tag with `--tag'

freak-outs in libmath. There are already bits in place to add this,
but apparently only for linking. Compiling needs them as well.

There's probably a better way to fix this, but this seems to be the easiest.

tested on x86/linux --enable-clocale=generic, glibc 2.2.x
tested on x86/linux, glibc 2.2.x
tested on x86/linux, glibc 2.3.x

2002-09-12  Benjamin Kosnik  <bkoz@redhat.com>

	* libmath/Makefile.am (LIBTOOL): Use --tag CC always for this
	directory.
	* libmath/Makefile.in: Regenerate.
	* src/Makefile.am: Tweak comment.
	* src/Makefile.in: Regenerate.

	* config/locale/gnu/c_locale.h: Remove warnings.
	Inject __uselocale into __gnu_cxx.
	* config/locale/generic/c_locale.h: Match.

Index: config/locale/generic/c_locale.h
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/config/locale/generic/c_locale.h,v
retrieving revision 1.2
diff -c -p -r1.2 c_locale.h
*** config/locale/generic/c_locale.h	11 Sep 2002 04:25:41 -0000	1.2
--- config/locale/generic/c_locale.h	12 Sep 2002 23:00:54 -0000
*************** namespace std
*** 44,55 ****
      __convert_from_v(char* __out, const int __size, const char* __fmt,
  		     _Tv __v, const __c_locale&, int __prec = -1)
      {
-       int __ret;
        char* __old = setlocale(LC_ALL, NULL);
        char* __sav = static_cast<char*>(malloc(strlen(__old) + 1));
        if (__sav)
          strcpy(__sav, __old);
        setlocale(LC_ALL, "C");
  #ifdef _GLIBCPP_USE_C99
        if (__prec >= 0)
          __ret = snprintf(__out, __size, __fmt, __prec, __v);
--- 44,56 ----
      __convert_from_v(char* __out, const int __size, const char* __fmt,
  		     _Tv __v, const __c_locale&, int __prec = -1)
      {
        char* __old = setlocale(LC_ALL, NULL);
        char* __sav = static_cast<char*>(malloc(strlen(__old) + 1));
        if (__sav)
          strcpy(__sav, __old);
        setlocale(LC_ALL, "C");
+ 
+       int __ret;
  #ifdef _GLIBCPP_USE_C99
        if (__prec >= 0)
          __ret = snprintf(__out, __size, __fmt, __prec, __v);
Index: config/locale/gnu/c_locale.h
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/config/locale/gnu/c_locale.h,v
retrieving revision 1.2
diff -c -p -r1.2 c_locale.h
*** config/locale/gnu/c_locale.h	11 Sep 2002 04:25:41 -0000	1.2
--- config/locale/gnu/c_locale.h	12 Sep 2002 23:00:55 -0000
***************
*** 40,45 ****
--- 40,52 ----
  
  #define _GLIBCPP_C_LOCALE_GNU 1
  
+ #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
+ namespace __gnu_cxx
+ {
+   extern "C" __typeof(uselocale) __uselocale;
+ }
+ #endif
+ 
  namespace std
  {
    typedef __locale_t		__c_locale;
*************** namespace std
*** 47,58 ****
    template<typename _Tv>
      int
      __convert_from_v(char* __out, const int __size, const char* __fmt,
  		     _Tv __v, const __c_locale& __cloc, int __prec = -1)
      {
!       int __ret;
! #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
!       __c_locale __old = __uselocale(__cloc);
  #else
        char* __old = setlocale(LC_ALL, NULL);
        char* __sav = static_cast<char*>(malloc(strlen(__old) + 1));
        if (__sav)
--- 54,66 ----
    template<typename _Tv>
      int
      __convert_from_v(char* __out, const int __size, const char* __fmt,
+ #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
  		     _Tv __v, const __c_locale& __cloc, int __prec = -1)
      {
!       __c_locale __old = __gnu_cxx::__uselocale(__cloc);
  #else
+ 		     _Tv __v, const __c_locale&, int __prec = -1)
+     {
        char* __old = setlocale(LC_ALL, NULL);
        char* __sav = static_cast<char*>(malloc(strlen(__old) + 1));
        if (__sav)
*************** namespace std
*** 60,65 ****
--- 68,74 ----
        setlocale(LC_ALL, "C");
  #endif
  
+       int __ret;
  #ifdef _GLIBCPP_USE_C99
        if (__prec >= 0)
          __ret = snprintf(__out, __size, __fmt, __prec, __v);
*************** namespace std
*** 73,79 ****
  #endif
  
  #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
!       __uselocale(__old);
  #else
        setlocale(LC_ALL, __sav);
        free(__sav);
--- 82,88 ----
  #endif
  
  #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
!       __gnu_cxx::__uselocale(__old);
  #else
        setlocale(LC_ALL, __sav);
        free(__sav);
Index: libmath/Makefile.am
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/libmath/Makefile.am,v
retrieving revision 1.19
diff -c -p -r1.19 Makefile.am
*** libmath/Makefile.am	23 Mar 2002 03:18:59 -0000	1.19
--- libmath/Makefile.am	12 Sep 2002 23:00:56 -0000
*************** libmath_la_DEPENDENCIES = $(libmath_la_L
*** 34,45 ****
  
  libmath_la_SOURCES = stubs.c
  
- LINK = \
- 	$(LIBTOOL) --tag CC --mode=link "$(CCLD)" \
- 	$(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
- 
  # Use common includes from acinclude.m4/GLIBCPP_EXPORT_INCLUDES
  TOPLEVEL_INCLUDES = @TOPLEVEL_INCLUDES@
  
  INCLUDES = \
  	$(TOPLEVEL_INCLUDES) 
--- 34,44 ----
  
  libmath_la_SOURCES = stubs.c
  
  # Use common includes from acinclude.m4/GLIBCPP_EXPORT_INCLUDES
  TOPLEVEL_INCLUDES = @TOPLEVEL_INCLUDES@
  
  INCLUDES = \
  	$(TOPLEVEL_INCLUDES) 
+ 
+ # Only compiling "C" sources in this directory.
+ LIBTOOL = @LIBTOOL@ --tag CC
Index: src/Makefile.am
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/src/Makefile.am,v
retrieving revision 1.112
diff -c -p -r1.112 Makefile.am
*** src/Makefile.am	11 Sep 2002 03:36:45 -0000	1.112
--- src/Makefile.am	12 Sep 2002 23:00:56 -0000
*************** MAINT_CHARSET = latin1
*** 27,33 ****
  
  mkinstalldirs = $(SHELL) $(toplevel_srcdir)/mkinstalldirs
  
! # Cross compiler and multilib support.
  CXX = @glibcpp_CXX@
  toolexecdir = @glibcpp_toolexecdir@
  toolexeclibdir = @glibcpp_toolexeclibdir@
--- 27,33 ----
  
  mkinstalldirs = $(SHELL) $(toplevel_srcdir)/mkinstalldirs
  
! # Cross compiler support.
  CXX = @glibcpp_CXX@
  toolexecdir = @glibcpp_toolexecdir@
  toolexeclibdir = @glibcpp_toolexeclibdir@


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