This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Default libstdc++ --enable-clocale configuration patch
- From: "Joseph S. Myers" <joseph at codesourcery dot com>
- To: gcc-patches at gcc dot gnu dot org, libstdc++ at gcc dot gnu dot org
- Date: Wed, 19 May 2010 00:16:16 +0000 (UTC)
- Subject: Default libstdc++ --enable-clocale configuration patch
libstdc++-v3 has a configure test to determine whether to default to
--enable-clocale=gnu or --enable-clocale=generic on GNU/Linux
systems. This does an execution-time test for bugs in early glibc 2.2
releases.
glibc 2.2 is now very old and those bugs are unlikely to be
encountered when building GCC. The test has more practical problems
on systems with more recent glibc where the bugs are not present:
* It relies on the presence of a de_DE locale and so may cause the
"generic" model to be used unnecessarily when that locale is not
installed.
* The cross-compilation fallback is to use the "generic" model.
Using the "generic" model is ABI-incompatible with the "gnu" model
that is the expected default on GNU/Linux (as indicated by the
checked-in ABI baselines, for example), and making it easy for an
ABI-incompatible library to be built unnecessarily without
specifically requesting it is a bad idea.
Bugs in glibc 2.2 seem of little relevance to normal modern GCC
configuration. So this patch removes the AC_TRY_RUN test, making the
compile-time test stricter (glibc 2.3 or later, disallowing uClibc
which also defines __GLIBC__) to ensure the "gnu" model won't be used
on known-buggy libc versions.
The XML documentation is updated in this patch. configure would be
regenerated in a commit of this patch, but I don't know how to
regenerate the HTML documentation generated from the XML (I couldn't
find relevant makefile rules to rebuild those checked-in files).
prerequisites.xml looks more generally very out-of-date, talking about
GCC 3.x (surely current libstdc++-v3 can't be built with anything
other than the GCC version it comes with or at least a very recent
GCC).
Bootstrapped with no regressions on x86_64-unknown-linux-gnu (a system
without the de_DE locale installed, formerly using "generic", now
using "gnu"). OK to commit?
2010-05-17 Joseph Myers <joseph@codesourcery.com>
* acinclude.m4 (GLIBCXX_ENABLE_CLOCALE): Use GNU locale model for
glibc 2.3 and later, but not uClibc, without an execution test.
* configure: Regenerate.
* doc/xml/manual/configure.xml, doc/xml/manual/prerequisites.xml:
Update.
Index: doc/xml/manual/configure.xml
===================================================================
--- doc/xml/manual/configure.xml (revision 159480)
+++ doc/xml/manual/configure.xml (working copy)
@@ -113,8 +113,7 @@
<para>If not explicitly specified, the configure proccess tries
to guess the most suitable package from the choices above. The
default is 'generic'. On glibc-based systems of sufficient
- vintage (2.2.5 and newer) and capability (with installed DE and
- FR locale data), 'gnu' is automatically selected. This option
+ vintage (2.3 and newer), 'gnu' is automatically selected. This option
can change the library ABI.
</para>
</listitem></varlistentry>
Index: doc/xml/manual/prerequisites.xml
===================================================================
--- doc/xml/manual/prerequisites.xml (revision 159480)
+++ doc/xml/manual/prerequisites.xml (working copy)
@@ -58,19 +58,11 @@
<para>
If gcc 3.1.0 or later on is being used on linux, an attempt
will be made to use "C" library functionality necessary for
- C++ named locale support. For gcc 3.2.1 and later, this
- means that glibc 2.2.5 or later is required and the "C"
- library de_DE locale information must be installed.
+ C++ named locale support. For gcc 4.6.0 and later, this
+ means that glibc 2.3 or later is required.
</para>
<para>
- Note however that the sanity checks involving the de_DE
- locale are skipped when an explicit --enable-clocale=gnu
- configure option is used: only the basic checks are carried
- out, defending against misconfigurations.
- </para>
-
- <para>
If the 'gnu' locale model is being used, the following
locales are used and tested in the libstdc++ testsuites.
The first column is the name of the locale, the second is
Index: acinclude.m4
===================================================================
--- acinclude.m4 (revision 159480)
+++ acinclude.m4 (working copy)
@@ -1740,41 +1740,11 @@
if test $enable_clocale_flag = gnu; then
AC_EGREP_CPP([_GLIBCXX_ok], [
#include <features.h>
- #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)
+ #if (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3)) && !defined(__UCLIBC__)
_GLIBCXX_ok
#endif
], enable_clocale_flag=gnu, enable_clocale_flag=generic)
- if test $enable_clocale = auto; then
- # Test for bugs early in glibc-2.2.x series
- AC_TRY_RUN([
- #define _GNU_SOURCE 1
- #include <locale.h>
- #include <string.h>
- #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
- extern __typeof(newlocale) __newlocale;
- extern __typeof(duplocale) __duplocale;
- extern __typeof(strcoll_l) __strcoll_l;
- #endif
- int main()
- {
- const char __one[] = "Äuglein Augmen";
- const char __two[] = "Äuglein";
- int i;
- int j;
- __locale_t loc;
- __locale_t loc_dup;
- loc = __newlocale(1 << LC_ALL, "de_DE", 0);
- loc_dup = __duplocale(loc);
- i = __strcoll_l(__one, __two, loc);
- j = __strcoll_l(__one, __two, loc_dup);
- return 0;
- }
- ],
- [enable_clocale_flag=gnu],[enable_clocale_flag=generic],
- [enable_clocale_flag=generic])
- fi
-
# Set it to scream when it hurts.
ac_save_CFLAGS="$CFLAGS"
CFLAGS="-Wimplicit-function-declaration -Werror"
--
Joseph S. Myers
joseph@codesourcery.com