X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=m4%2Fduplocale.m4;h=9ef894c9c8e432f932b6717262bb364e00ea5853;hb=5191b3546cfb6c163228c23f214e325ddf60d46f;hp=91a8ffd90c689bbcb133dcc555df2086c968ad3d;hpb=b2e2010c7c902235b5efb5bd3c6529f61b093aa4;p=gnulib.git diff --git a/m4/duplocale.m4 b/m4/duplocale.m4 index 91a8ffd90..9ef894c9c 100644 --- a/m4/duplocale.m4 +++ b/m4/duplocale.m4 @@ -1,5 +1,5 @@ -# duplocale.m4 serial 1 -dnl Copyright (C) 2009, 2010 Free Software Foundation, Inc. +# duplocale.m4 serial 7 +dnl Copyright (C) 2009-2013 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -12,40 +12,52 @@ AC_DEFUN([gl_FUNC_DUPLOCALE], if test $ac_cv_func_duplocale = yes; then dnl Check against glibc bug where duplocale crashes. dnl See . + dnl Also, on AIX 7.1, duplocale(LC_GLOBAL_LOCALE) returns (locale_t)0 with + dnl errno set to EINVAL. AC_REQUIRE([gl_LOCALE_H]) AC_CACHE_CHECK([whether duplocale(LC_GLOBAL_LOCALE) works], [gl_cv_func_duplocale_works], - [AC_TRY_RUN([ + [AC_RUN_IFELSE( + [AC_LANG_SOURCE([[ #include #if HAVE_XLOCALE_H # include #endif int main () { - (void) duplocale (LC_GLOBAL_LOCALE); + if (duplocale (LC_GLOBAL_LOCALE) == (locale_t)0) + return 1; return 0; -}], [gl_cv_func_duplocale_works=yes], [gl_cv_func_duplocale_works=no], - [dnl Guess it works except on glibc < 2.12. - AC_EGREP_CPP([Unlucky GNU user], [ +}]])], + [gl_cv_func_duplocale_works=yes], + [gl_cv_func_duplocale_works=no], + [dnl Guess it works except on glibc < 2.12, uClibc, and AIX. + case "$host_os" in + aix*) gl_cv_func_duplocale_works="guessing no";; + *-gnu*) + AC_EGREP_CPP([Unlucky], [ #include #ifdef __GNU_LIBRARY__ #if (__GLIBC__ == 2 && __GLIBC_MINOR__ < 12) Unlucky GNU user #endif #endif - ], - [gl_cv_func_duplocale_works="guessing no"], - [gl_cv_func_duplocale_works="guessing yes"]) +#ifdef __UCLIBC__ + Unlucky user +#endif + ], + [gl_cv_func_duplocale_works="guessing no"], + [gl_cv_func_duplocale_works="guessing yes"]) + ;; + *) gl_cv_func_duplocale_works="guessing yes";; + esac ]) ]) case "$gl_cv_func_duplocale_works" in *no) REPLACE_DUPLOCALE=1 ;; esac - fi - if test $REPLACE_DUPLOCALE = 1; then - gl_REPLACE_LOCALE_H - AC_LIBOBJ([duplocale]) - gl_PREREQ_DUPLOCALE + else + HAVE_DUPLOCALE=0 fi ])