This is the mail archive of the libstdc++@sourceware.cygnus.com 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]

(patch) autoconf wide character support


Here's a first cut at checking whether code specialized for wchar_t
should be emitted or not. It's very simple minded -- if WEOF exists in
wchar.h, then yes; else no. We can always add more checks later on.

Need to rebuild config.h.in, configure after applying the patch:
  
   $ autoheader
   $ autoconf

Tue Nov 23 15:29:35 CST 1999  Mumit Khan  <khan@xraylith.wisc.edu>

	* configure.in: Check for wide character support.
	* bits/c++config.h.in (_GLIBC_USE_WCHAR_T): Move from here ...
	* acconfig.h (_GLIBC_USE_WCHAR_T): to here.
	* bits/string.tcc (wstring::_S_find): Guard wchar_t specialization.

Index: configure.in
===================================================================
RCS file: /cvs/libstdc++/libstdc++/configure.in,v
retrieving revision 1.32
diff -u -3 -p -r1.32 configure.in
--- configure.in	1999/11/22 20:03:05	1.32
+++ configure.in	1999/11/23 21:22:39
@@ -140,6 +140,22 @@ AC_LC_MESSAGES
 
 GLIBCPP_CHECK_FLOAT_COMPLEX_SUPPORT
 
+# Test wchar.h for WEOF, which is what we use to determine whether
+# to specialize for wchar_t or not. 
+AC_MSG_CHECKING([for wide character support])
+AC_TRY_COMPILE([
+  #include <wchar.h>
+  #include <stddef.h>], 
+[wint_t i = WEOF;], 
+has_weof=yes, has_weof=no)
+if test $has_weof = "yes"; then
+  AC_DEFINE(_GLIBCPP_USE_WCHAR_T)
+  AC_MSG_RESULT(ok)
+else
+  AC_MSG_RESULT("incomplete. Not specializing for wchar_t")
+fi
+
+
 AC_OUTPUT([bits/c++config.h Makefile math/Makefile string/Makefile libio/Makefile src/Makefile])
 
 # Generate bits/c++config.h
Index: bits/c++config.h.in
===================================================================
RCS file: /cvs/libstdc++/libstdc++/bits/c++config.h.in,v
retrieving revision 1.3
diff -u -3 -p -r1.3 c++config.h.in
--- bits/c++config.h.in	1999/09/09 04:40:34	1.3
+++ bits/c++config.h.in	1999/11/23 21:22:39
@@ -55,9 +55,6 @@
 // To enable older, ARM-style iostreams and other anachronisms use this.
 //#define _GLIBCPP_DEPRICATED 1
 
-// Implies that code specialized for wchar_t should be used.
-#define _GLIBCPP_USE_WCHAR_T 1
-
 // Implies that long long should be used.
 // On __linux__ systesms, it may be necessary to define __USE_GNU
 // and _GNU_SOURCE. This is required for limits.h to define
Index: acconfig.h
===================================================================
RCS file: /cvs/libstdc++/libstdc++/acconfig.h,v
retrieving revision 1.9
diff -u -3 -p -r1.9 acconfig.h
--- acconfig.h	1999/11/22 20:03:05	1.9
+++ acconfig.h	1999/11/23 21:22:38
@@ -21,6 +21,9 @@
 // instantitate numeric_limits<wchar_t>
 #undef _GLIBCPP_HAS_WCHAR_MIN_MAX
 
+// Define if code specialized for wchar_t should be used.
+#undef _GLIBCPP_USE_WCHAR_T
+
 // Define if <cctype> uses the _ISBit macro to define what constitutes
 // a space, punct, etc. Usually, this involved _ISspace, etc macros.
 #undef _GLIBCPP_USE_CTYPE_ISBIT
Index: bits/string.tcc
===================================================================
RCS file: /cvs/libstdc++/libstdc++/bits/string.tcc,v
retrieving revision 1.54
diff -u -3 -p -r1.54 string.tcc
--- bits/string.tcc	1999/07/23 09:27:42	1.54
+++ bits/string.tcc	1999/11/23 21:22:39
@@ -508,10 +508,12 @@ namespace std
     const char* 
     string::_S_find(const char* __beg, const char* __end, char __c);
 
+#ifdef _GLIBCPP_USE_WCHAR_T 
   // Specialization for wchar_t.
   template<>
     const wchar_t* 
     wstring::_S_find(const wchar_t* __beg, const wchar_t* __end, wchar_t __c);
+#endif
 
   template<typename _CharT, typename _Traits, typename _Alloc>
     basic_string<_CharT, _Traits, _Alloc>::size_type

Regards,
Mumit -- khan@xraylith.wisc.edu


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