diff options
author | Jakub Jelinek <jakub@redhat.com> | 2011-02-16 14:54:30 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2011-02-16 14:54:30 +0100 |
commit | d2995f218548fb6e506348377bf150c69dd231a6 (patch) | |
tree | f3947cffa865d6825f1d64a027010b829f2e6182 /libquadmath/configure.ac | |
parent | 5037599a7442f3b528905f13221c8affa5a9f20e (diff) |
quadmath-printf.c: Also check __GLIBC__ when checking whether workarounds for printf hook handling...
* printf/quadmath-printf.c: Also check __GLIBC__ when checking
whether workarounds for printf hook handling should be added.
* configure.ac: Check for locale.h too.
(USE_LOCALE_SUPPORT): Remove check.
(USE_NL_LANGINFO, USE_NL_LANGINFO_WC, USE_LOCALECONV): New checks.
(USE_I18_NUMBER_H): Check also for _NL_CTYPE_MB_CUR_MAX.
* printf/printf_fphex.c (__quadmath_printf_fphex): Use nl_langinfo
or localeconv for narrow version and nl_langinfo if USE_NL_LANGINFO_WC
for wide version.
* printf/quadmath-printf.h: Include locale.h if HAVE_LOCALE_H.
* printf/printf_fp.c (USE_I18N_NUMBER_H): Don't define to 0.
(__quadmath_printf_fp): Use nl_langinfo or localeconv for narrow
version and nl_langinfo if USE_NL_LANGINFO_WC for wide version.
Guard nl_langinfo (_NL_CTYPE_MB_CUR_MAX) use with
USE_I18N_NUMBER_H #ifdef.
* configure: Regenerated.
* config.h.in: Regenerated.
From-SVN: r170211
Diffstat (limited to 'libquadmath/configure.ac')
-rw-r--r-- | libquadmath/configure.ac | 43 |
1 files changed, 36 insertions, 7 deletions
diff --git a/libquadmath/configure.ac b/libquadmath/configure.ac index 04a6e4a3076..0cd675fb2fc 100644 --- a/libquadmath/configure.ac +++ b/libquadmath/configure.ac @@ -112,7 +112,7 @@ esac AC_SUBST(toolexecdir) AC_SUBST(toolexeclibdir) -AC_CHECK_HEADERS(fenv.h langinfo.h wchar.h wctype.h limits.h ctype.h printf.h errno.h) +AC_CHECK_HEADERS(fenv.h langinfo.h locale.h wchar.h wctype.h limits.h ctype.h printf.h errno.h) # If available, sqrtl and cbrtl speed up the calculation - # but they are not required @@ -251,7 +251,7 @@ fi # Check for whether locale support for quadmath_snprintf or Q printf hooks # should be provided. -AC_MSG_CHECKING([whether locale support for quadmath_snprintf should be added]) +AC_MSG_CHECKING([whether nl_langinfo should be used]) AC_TRY_COMPILE([#include <langinfo.h>],[ const char *s; s = nl_langinfo (DECIMAL_POINT); @@ -260,17 +260,45 @@ s = nl_langinfo (GROUPING); s = nl_langinfo (MON_GROUPING); s = nl_langinfo (THOUSANDS_SEP); s = nl_langinfo (MON_THOUSANDS_SEP); +(void) s; +], +[quadmath_use_nl_langinfo=yes],[quadmath_use_nl_langinfo=no]) +AC_MSG_RESULT($quadmath_use_nl_langinfo) +if test x$quadmath_use_nl_langinfo = xyes; then + AC_DEFINE([USE_NL_LANGINFO],[1],[whether nl_langinfo should be used]) +fi + +AC_MSG_CHECKING([whether nl_langinfo should be used for wide char locale info]) +AC_TRY_COMPILE([#include <langinfo.h>],[ +const char *s; s = nl_langinfo (_NL_NUMERIC_DECIMAL_POINT_WC); s = nl_langinfo (_NL_MONETARY_DECIMAL_POINT_WC); s = nl_langinfo (_NL_NUMERIC_THOUSANDS_SEP_WC); s = nl_langinfo (_NL_MONETARY_THOUSANDS_SEP_WC); -s = nl_langinfo (_NL_CTYPE_MB_CUR_MAX); (void) s; ], -[quadmath_use_locale_support=yes],[quadmath_use_locale_support=no]) -AC_MSG_RESULT($quadmath_use_locale_support) -if test x$quadmath_use_locale_support = xyes; then - AC_DEFINE([USE_LOCALE_SUPPORT],[1],[whether nl_langinfo is sufficiently supported]) +[quadmath_use_nl_langinfo_wc=yes],[quadmath_use_nl_langinfo_wc=no]) +AC_MSG_RESULT($quadmath_use_nl_langinfo_wc) +if test x$quadmath_use_nl_langinfo_wc = xyes; then + AC_DEFINE([USE_NL_LANGINFO_WC],[1],[whether nl_langinfo should be used for wide char locale info]) +fi + +AC_MSG_CHECKING([whether localeconv should be used]) +AC_TRY_COMPILE([#include <locale.h>],[ +const struct lconv *l = localeconv (); +const char *s; +s = l->decimal_point; +s = l->mon_decimal_point; +s = l->grouping; +s = l->mon_grouping; +s = l->thousands_sep; +s = l->mon_thousands_sep; +(void) s; +], +[quadmath_use_localeconv=yes],[quadmath_use_localeconv=no]) +AC_MSG_RESULT($quadmath_use_localeconv) +if test x$quadmath_use_localeconv = xyes; then + AC_DEFINE([USE_LOCALECONV],[1],[whether localeconv should be used]) fi # Check for whether i18n number rewriting support for quadmath_snprintf @@ -290,6 +318,7 @@ memset (&state, '\0', sizeof (state)); wcrtomb (decimal, wdecimal, &state); s = nl_langinfo (_NL_CTYPE_OUTDIGIT0_MB); s = nl_langinfo (_NL_CTYPE_OUTDIGIT0_WC); +s = nl_langinfo (_NL_CTYPE_MB_CUR_MAX); (void) s; ], [quadmath_use_i18n_number_h=yes],[quadmath_use_i18n_number_h=no]) |