+2007-05-28 Benjamin Kosnik <bkoz@redhat.com>
+
+ PR libstdc++/31717
+ * acinclude.m4 (GLIBCXX_ENABLE_CLOCALE): Re-organize. Sanity check
+ gnu locale model requests to make sure it will work for the requested
+ target. Add checks for strxfrm_l, strerror_l when in gnu locale,
+ and strerror_r everywhere.
+ * aclocal.m4: Regenerated.
+ * configure: Regenerated.
+ * config.h.in: Regenerated.
+
2007-05-27 Paolo Carlini <pcarlini@suse.de>
* include/tr1/boost_shared_ptr.h
dnl Default is generic.
dnl
AC_DEFUN([GLIBCXX_ENABLE_CLOCALE], [
- AC_MSG_CHECKING([for C locale to use])
GLIBCXX_ENABLE(clocale,auto,[@<:@=MODEL@:>@],
[use MODEL for target locale package],
[permit generic|gnu|ieee_1003.1-2001|yes|no|auto])
+
+ # Deal with gettext issues. Default to not using it (=no) until we detect
+ # support for it later. Let the user turn it off via --e/d, but let that
+ # default to on for easier handling.
+ USE_NLS=no
+ AC_ARG_ENABLE(nls,
+ AC_HELP_STRING([--enable-nls],[use Native Language Support (default)]),
+ [],
+ [enable_nls=yes])
- # If they didn't use this option switch, or if they specified --enable
- # with no specific model, we'll have to look for one. If they
- # specified --disable (???), do likewise.
+ # Either a known packaage, or "auto"
if test $enable_clocale = no || test $enable_clocale = yes; then
enable_clocale=auto
fi
-
- # Either a known package, or "auto"
enable_clocale_flag=$enable_clocale
- # Probe for locale support if no specific model is specified.
+ # Probe for locale model to use if none specified.
# Default to "generic".
if test $enable_clocale_flag = auto; then
case ${target_os} in
linux* | gnu* | kfreebsd*-gnu | knetbsd*-gnu)
- AC_EGREP_CPP([_GLIBCXX_ok], [
- #include <features.h>
- #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)
- _GLIBCXX_ok
- #endif
- ], enable_clocale_flag=gnu, enable_clocale_flag=generic)
-
- # Test for bugs early in glibc-2.2.x series
- if test $enable_clocale_flag = gnu; then
- 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
-
- # ... at some point put __strxfrm_l tests in as well.
+ enable_clocale_flag=gnu
;;
darwin* | freebsd*)
enable_clocale_flag=darwin
esac
fi
- # Deal with gettext issues. Default to not using it (=no) until we detect
- # support for it later. Let the user turn it off via --e/d, but let that
- # default to on for easier handling.
- USE_NLS=no
- AC_ARG_ENABLE(nls,
- AC_HELP_STRING([--enable-nls],[use Native Language Support (default)]),
- [],
- [enable_nls=yes])
+ # Sanity check model, and test for special functionality.
+ if test $enable_clocale_flag = gnu; then
+ AC_EGREP_CPP([_GLIBCXX_ok], [
+ #include <features.h>
+ #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)
+ _GLIBCXX_ok
+ #endif
+ ], enable_clocale_flag=gnu, enable_clocale_flag=generic)
+
+ # 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])
+
+ # Set it to scream when it hurts.
+ ac_save_CFLAGS="$CFLAGS"
+ CFLAGS="-Wimplicit-function-declaration -Werror"
+
+ # Use strxfrm_l if available.
+ AC_TRY_COMPILE([#define _GNU_SOURCE 1
+ #include <string.h>
+ #include <locale.h>],
+ [char s[128]; __locale_t loc; strxfrm_l(s, "C", 5, loc);],
+ AC_DEFINE(HAVE_STRXFRM_L, 1,
+ [Define if strxfrm_l is available in <string.h>.]),)
+
+ # Use strerror_l if available.
+ AC_TRY_COMPILE([#define _GNU_SOURCE 1
+ #include <string.h>
+ #include <locale.h>],
+ [__locale_t loc; strerror_l(5, loc);],
+ AC_DEFINE(HAVE_STRERROR_L, 1,
+ [Define if strerror_l is available in <string.h>.]),)
+
+ CFLAGS="$ac_save_CFLAGS"
+ fi
+
+ # Perhaps use strerror_r if available, and strerror_l isn't.
+ ac_save_CFLAGS="$CFLAGS"
+ CFLAGS="-Wimplicit-function-declaration -Werror"
+ AC_TRY_COMPILE([#define _GNU_SOURCE 1
+ #include <string.h>
+ #include <locale.h>],
+ [char s[128]; strerror_r(5, s, 128);],
+ AC_DEFINE(HAVE_STRERROR_R, 1,
+ [Define if strerror_r is available in <string.h>.]),)
+ CFLAGS="$ac_save_CFLAGS"
# Set configure bits for specified locale package
+ AC_MSG_CHECKING([for C locale to use])
case ${enable_clocale_flag} in
generic)
AC_MSG_RESULT(generic)
# before this can be enabled.
hardcode_into_libs=yes
+ # find out which ABI we are using
+ libsuff=
+ case "$host_cpu" in
+ x86_64*|s390x*|powerpc64*)
+ echo '[#]line __oline__ "configure"' > conftest.$ac_ext
+ if AC_TRY_EVAL(ac_compile); then
+ case `/usr/bin/file conftest.$ac_objext` in
+ *64-bit*)
+ libsuff=64
+ sys_lib_search_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/local/lib${libsuff}"
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+ esac
+
# Append ld.so.conf contents to the search path
if test -f /etc/ld.so.conf; then
- lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
- sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
+ lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
+ sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff} $lt_ld_extra"
fi
# We used to test for /lib/ld.so.1 and disable shared libraries on
# Is the compiler the GNU C compiler?
with_gcc=$_LT_AC_TAGVAR(GCC, $1)
+gcc_dir=\`gcc -print-file-name=. | $SED 's,/\.$,,'\`
+gcc_ver=\`gcc -dumpversion\`
+
# An ERE matcher.
EGREP=$lt_EGREP
# Dependencies to place before the objects being linked to create a
# shared library.
-predep_objects=$lt_[]_LT_AC_TAGVAR(predep_objects, $1)
+predep_objects=\`echo $lt_[]_LT_AC_TAGVAR(predep_objects, $1) | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\`
# Dependencies to place after the objects being linked to create a
# shared library.
-postdep_objects=$lt_[]_LT_AC_TAGVAR(postdep_objects, $1)
+postdep_objects=\`echo $lt_[]_LT_AC_TAGVAR(postdep_objects, $1) | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\`
# Dependencies to place before the objects being linked to create a
# shared library.
# The library search path used internally by the compiler when linking
# a shared library.
-compiler_lib_search_path=$lt_[]_LT_AC_TAGVAR(compiler_lib_search_path, $1)
+compiler_lib_search_path=\`echo $lt_[]_LT_AC_TAGVAR(compiler_lib_search_path, $1) | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\`
# Method to check whether dependent libraries are shared objects.
deplibs_check_method=$lt_deplibs_check_method
link_all_deplibs=$_LT_AC_TAGVAR(link_all_deplibs, $1)
# Compile-time system search path for libraries
-sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
+sys_lib_search_path_spec=\`echo $lt_sys_lib_search_path_spec | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\`
# Run-time system search path for libraries
sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
done
done
done
+IFS=$as_save_IFS
lt_ac_max=0
lt_ac_count=0
# Add /usr/xpg4/bin/sed as it is typically found on Solaris
done
])
SED=$lt_cv_path_SED
+AC_SUBST([SED])
AC_MSG_RESULT([$SED])
])
/* Define to 1 if you have the `cosl' function. */
#undef HAVE_COSL
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#undef HAVE_DLFCN_H
+
/* Define to 1 if you have the <endian.h> header file. */
#undef HAVE_ENDIAN_H
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
+/* Define if strerror_l is available in <string.h>. */
+#undef HAVE_STRERROR_L
+
+/* Define if strerror_r is available in <string.h>. */
+#undef HAVE_STRERROR_R
+
/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
/* Define to 1 if you have the `strtold' function. */
#undef HAVE_STRTOLD
+/* Define if strxfrm_l is available in <string.h>. */
+#undef HAVE_STRXFRM_L
+
/* Define to 1 if you have the <sys/filio.h> header file. */
#undef HAVE_SYS_FILIO_H
/* Define as const if the declaration of iconv() needs const. */
#undef ICONV_CONST
+/* Define to the sub-directory in which libtool stores uninstalled libraries.
+ */
+#undef LT_OBJDIR
+
/* Name of package */
#undef PACKAGE
- echo "$as_me:$LINENO: checking for C locale to use" >&5
-echo $ECHO_N "checking for C locale to use... $ECHO_C" >&6
# Check whether --enable-clocale or --disable-clocale was given.
if test "${enable_clocale+set}" = set; then
enableval="$enable_clocale"
fi;
- # If they didn't use this option switch, or if they specified --enable
- # with no specific model, we'll have to look for one. If they
- # specified --disable (???), do likewise.
+ # Deal with gettext issues. Default to not using it (=no) until we detect
+ # support for it later. Let the user turn it off via --e/d, but let that
+ # default to on for easier handling.
+ USE_NLS=no
+ # Check whether --enable-nls or --disable-nls was given.
+if test "${enable_nls+set}" = set; then
+ enableval="$enable_nls"
+
+else
+ enable_nls=yes
+fi;
+
+ # Either a known packaage, or "auto"
if test $enable_clocale = no || test $enable_clocale = yes; then
enable_clocale=auto
fi
-
- # Either a known package, or "auto"
enable_clocale_flag=$enable_clocale
- # Probe for locale support if no specific model is specified.
+ # Probe for locale model to use if none specified.
# Default to "generic".
if test $enable_clocale_flag = auto; then
case ${target_os} in
linux* | gnu* | kfreebsd*-gnu | knetbsd*-gnu)
- cat >conftest.$ac_ext <<_ACEOF
+ enable_clocale_flag=gnu
+ ;;
+ darwin* | freebsd*)
+ enable_clocale_flag=darwin
+ ;;
+ *)
+ enable_clocale_flag=generic
+ ;;
+ esac
+ fi
+
+ # Sanity check model, and test for special functionality.
+ if test $enable_clocale_flag = gnu; then
+ cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
- #include <features.h>
- #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)
- _GLIBCXX_ok
- #endif
+ #include <features.h>
+ #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)
+ _GLIBCXX_ok
+ #endif
_ACEOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
rm -f conftest*
- # Test for bugs early in glibc-2.2.x series
- if test $enable_clocale_flag = gnu; then
- if test "$cross_compiling" = yes; then
+ # Test for bugs early in glibc-2.2.x series
+ if test "$cross_compiling" = yes; then
enable_clocale_flag=generic
else
cat >conftest.$ac_ext <<_ACEOF
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
- #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;
- }
+ #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;
+ }
_ACEOF
rm -f conftest$ac_exeext
fi
rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi
- fi
- # ... at some point put __strxfrm_l tests in as well.
- ;;
- darwin* | freebsd*)
- enable_clocale_flag=darwin
- ;;
- *)
- enable_clocale_flag=generic
- ;;
- esac
+ # Set it to scream when it hurts.
+ ac_save_CFLAGS="$CFLAGS"
+ CFLAGS="-Wimplicit-function-declaration -Werror"
+
+ # Use strxfrm_l if available.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#define _GNU_SOURCE 1
+ #include <string.h>
+ #include <locale.h>
+int
+main ()
+{
+char s[128]; __locale_t loc; strxfrm_l(s, "C", 5, loc);
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_STRXFRM_L 1
+_ACEOF
+
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+ # Use strerror_l if available.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#define _GNU_SOURCE 1
+ #include <string.h>
+ #include <locale.h>
+int
+main ()
+{
+__locale_t loc; strerror_l(5, loc);
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_STRERROR_L 1
+_ACEOF
+
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+ CFLAGS="$ac_save_CFLAGS"
fi
- # Deal with gettext issues. Default to not using it (=no) until we detect
- # support for it later. Let the user turn it off via --e/d, but let that
- # default to on for easier handling.
- USE_NLS=no
- # Check whether --enable-nls or --disable-nls was given.
-if test "${enable_nls+set}" = set; then
- enableval="$enable_nls"
+ # Perhaps use strerror_r if available, and strerror_l isn't.
+ ac_save_CFLAGS="$CFLAGS"
+ CFLAGS="-Wimplicit-function-declaration -Werror"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#define _GNU_SOURCE 1
+ #include <string.h>
+ #include <locale.h>
+int
+main ()
+{
+char s[128]; strerror_r(5, s, 128);
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_STRERROR_R 1
+_ACEOF
else
- enable_nls=yes
-fi;
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ CFLAGS="$ac_save_CFLAGS"
# Set configure bits for specified locale package
+ echo "$as_me:$LINENO: checking for C locale to use" >&5
+echo $ECHO_N "checking for C locale to use... $ECHO_C" >&6
case ${enable_clocale_flag} in
generic)
echo "$as_me:$LINENO: result: generic" >&5
# Fake what AC_TRY_COMPILE does. XXX Look at redoing this new-style.
cat > conftest.$ac_ext << EOF
-#line 16404 "configure"
+#line 16566 "configure"
int main()
{
// NB: _Atomic_word not necessarily int.