X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=m4%2Fmbrtowc.m4;h=bcd52061b0896132f5911a1c2be4ed1f9c40724b;hb=438d74b6b96ac7ccce6791556fe5e27f0e8f7ed8;hp=ace698003522790d374375c6b4b5f09259de8489;hpb=0f0ea3372a02465fd5bfedea064d53bc3af1de6e;p=pspp diff --git a/m4/mbrtowc.m4 b/m4/mbrtowc.m4 index ace6980035..bcd52061b0 100644 --- a/m4/mbrtowc.m4 +++ b/m4/mbrtowc.m4 @@ -1,5 +1,6 @@ -# mbrtowc.m4 serial 14 -dnl Copyright (C) 2001-2002, 2004-2005, 2008, 2009 Free Software Foundation, Inc. +# mbrtowc.m4 serial 20 +dnl Copyright (C) 2001-2002, 2004-2005, 2008-2010 Free Software Foundation, +dnl 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. @@ -10,38 +11,39 @@ AC_DEFUN([gl_FUNC_MBRTOWC], AC_REQUIRE([AC_TYPE_MBSTATE_T]) gl_MBSTATE_T_BROKEN - if test $REPLACE_MBSTATE_T = 1; then - REPLACE_MBRTOWC=1 - fi + AC_CHECK_FUNCS_ONCE([mbrtowc]) if test $ac_cv_func_mbrtowc = no; then HAVE_MBRTOWC=0 - fi - if test $HAVE_MBRTOWC != 0 && test $REPLACE_MBRTOWC != 1; then - gl_MBRTOWC_NULL_ARG - gl_MBRTOWC_RETVAL - gl_MBRTOWC_NUL_RETVAL - case "$gl_cv_func_mbrtowc_null_arg" in - *yes) ;; - *) AC_DEFINE([MBRTOWC_NULL_ARG_BUG], [1], - [Define if the mbrtowc function has the NULL string argument bug.]) - REPLACE_MBRTOWC=1 - ;; - esac - case "$gl_cv_func_mbrtowc_retval" in - *yes) ;; - *) AC_DEFINE([MBRTOWC_RETVAL_BUG], [1], - [Define if the mbrtowc function returns a wrong return value.]) - REPLACE_MBRTOWC=1 - ;; - esac - case "$gl_cv_func_mbrtowc_nul_retval" in - *yes) ;; - *) AC_DEFINE([MBRTOWC_NUL_RETVAL_BUG], [1], - [Define if the mbrtowc function does not return 0 for a NUL character.]) - REPLACE_MBRTOWC=1 - ;; - esac + else + if test $REPLACE_MBSTATE_T = 1; then + REPLACE_MBRTOWC=1 + else + gl_MBRTOWC_NULL_ARG + gl_MBRTOWC_RETVAL + gl_MBRTOWC_NUL_RETVAL + case "$gl_cv_func_mbrtowc_null_arg" in + *yes) ;; + *) AC_DEFINE([MBRTOWC_NULL_ARG_BUG], [1], + [Define if the mbrtowc function has the NULL string argument bug.]) + REPLACE_MBRTOWC=1 + ;; + esac + case "$gl_cv_func_mbrtowc_retval" in + *yes) ;; + *) AC_DEFINE([MBRTOWC_RETVAL_BUG], [1], + [Define if the mbrtowc function returns a wrong return value.]) + REPLACE_MBRTOWC=1 + ;; + esac + case "$gl_cv_func_mbrtowc_nul_retval" in + *yes) ;; + *) AC_DEFINE([MBRTOWC_NUL_RETVAL_BUG], [1], + [Define if the mbrtowc function does not return 0 for a NUL character.]) + REPLACE_MBRTOWC=1 + ;; + esac + fi fi if test $HAVE_MBRTOWC = 0 || test $REPLACE_MBRTOWC = 1; then gl_REPLACE_WCHAR_H @@ -99,16 +101,24 @@ AC_DEFUN([gl_MBRTOWC_INCOMPLETE_STATE], dnl is present. changequote(,)dnl case "$host_os" in - # Guess no on AIX and OSF/1. - osf*) gl_cv_func_mbrtowc_incomplete_state="guessing no" ;; - # Guess yes otherwise. - *) gl_cv_func_mbrtowc_incomplete_state="guessing yes" ;; + # Guess no on AIX and OSF/1. + aix* | osf*) gl_cv_func_mbrtowc_incomplete_state="guessing no" ;; + # Guess yes otherwise. + *) gl_cv_func_mbrtowc_incomplete_state="guessing yes" ;; esac changequote([,])dnl if test $LOCALE_JA != none; then - AC_TRY_RUN([ + AC_RUN_IFELSE( + [AC_LANG_SOURCE([[ #include #include +/* Tru64 with Desktop Toolkit C has a bug: must be included before + . + BSD/OS 4.0.1 has a bug: , and must be + included before . */ +#include +#include +#include #include int main () { @@ -124,10 +134,10 @@ int main () return 1; } return 0; -}], +}]])], [gl_cv_func_mbrtowc_incomplete_state=yes], [gl_cv_func_mbrtowc_incomplete_state=no], - []) + [:]) fi ]) ]) @@ -154,9 +164,18 @@ changequote(,)dnl esac changequote([,])dnl if test $LOCALE_ZH_CN != none; then - AC_TRY_RUN([ + AC_RUN_IFELSE( + [AC_LANG_SOURCE([[ #include +#include #include +/* Tru64 with Desktop Toolkit C has a bug: must be included before + . + BSD/OS 4.0.1 has a bug: , and must be + included before . */ +#include +#include +#include #include int main () { @@ -175,10 +194,10 @@ int main () return 1; } return 0; -}], +}]])], [gl_cv_func_mbrtowc_sanitycheck=yes], [gl_cv_func_mbrtowc_sanitycheck=no], - []) + [:]) fi ]) ]) @@ -205,9 +224,17 @@ changequote(,)dnl esac changequote([,])dnl if test $LOCALE_FR_UTF8 != none; then - AC_TRY_RUN([ + AC_RUN_IFELSE( + [AC_LANG_SOURCE([[ #include #include +/* Tru64 with Desktop Toolkit C has a bug: must be included before + . + BSD/OS 4.0.1 has a bug: , and must be + included before . */ +#include +#include +#include #include int main () { @@ -225,7 +252,10 @@ int main () return 1; } return 0; -}], [gl_cv_func_mbrtowc_null_arg=yes], [gl_cv_func_mbrtowc_null_arg=no], []) +}]])], + [gl_cv_func_mbrtowc_null_arg=yes], + [gl_cv_func_mbrtowc_null_arg=no], + [:]) fi ]) ]) @@ -255,12 +285,21 @@ changequote(,)dnl esac changequote([,])dnl if test $LOCALE_FR_UTF8 != none || test $LOCALE_JA != none; then - AC_TRY_RUN([ + AC_RUN_IFELSE( + [AC_LANG_SOURCE([[ #include #include +/* Tru64 with Desktop Toolkit C has a bug: must be included before + . + BSD/OS 4.0.1 has a bug: , and must be + included before . */ +#include +#include +#include #include int main () { + int result = 0; /* This fails on Solaris. */ if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) { @@ -273,7 +312,7 @@ int main () { input[1] = '\0'; if (mbrtowc (&wc, input + 2, 5, &state) != 1) - return 1; + result |= 1; } } /* This fails on HP-UX 11.11. */ @@ -288,14 +327,14 @@ int main () { input[1] = '\0'; if (mbrtowc (&wc, input + 2, 5, &state) != 2) - return 1; + result |= 2; } } - return 0; -}], + return result; +}]])], [gl_cv_func_mbrtowc_retval=yes], [gl_cv_func_mbrtowc_retval=no], - []) + [:]) fi ]) ]) @@ -315,20 +354,28 @@ AC_DEFUN([gl_MBRTOWC_NUL_RETVAL], dnl is present. changequote(,)dnl case "$host_os" in - # Guess no on Solaris 9. - solaris2.9) gl_cv_func_mbrtowc_nul_retval="guessing no" ;; - # Guess yes otherwise. - *) gl_cv_func_mbrtowc_nul_retval="guessing yes" ;; + # Guess no on Solaris 8 and 9. + solaris2.[89]) gl_cv_func_mbrtowc_nul_retval="guessing no" ;; + # Guess yes otherwise. + *) gl_cv_func_mbrtowc_nul_retval="guessing yes" ;; esac changequote([,])dnl if test $LOCALE_ZH_CN != none; then - AC_TRY_RUN([ + AC_RUN_IFELSE( + [AC_LANG_SOURCE([[ #include #include +/* Tru64 with Desktop Toolkit C has a bug: must be included before + . + BSD/OS 4.0.1 has a bug: , and must be + included before . */ +#include +#include +#include #include int main () { - /* This fails on Solaris 9. */ + /* This fails on Solaris 8 and 9. */ if (setlocale (LC_ALL, "$LOCALE_ZH_CN") != NULL) { mbstate_t state; @@ -339,10 +386,10 @@ int main () return 1; } return 0; -}], +}]])], [gl_cv_func_mbrtowc_nul_retval=yes], [gl_cv_func_mbrtowc_nul_retval=no], - []) + [:]) fi ]) ]) @@ -355,10 +402,8 @@ AC_DEFUN([gl_PREREQ_MBRTOWC], [ dnl From Paul Eggert -dnl This override of an autoconf macro can be removed when autoconf 2.60 or -dnl newer can be assumed everywhere. +dnl This is an override of an autoconf macro. -m4_if(m4_version_compare(m4_defn([m4_PACKAGE_VERSION]),[2.60]),[-1],[ AC_DEFUN([AC_FUNC_MBRTOWC], [ dnl Same as AC_FUNC_MBRTOWC in autoconf-2.60. @@ -366,7 +411,14 @@ AC_DEFUN([AC_FUNC_MBRTOWC], gl_cv_func_mbrtowc, [AC_LINK_IFELSE( [AC_LANG_PROGRAM( - [[#include ]], + [[/* Tru64 with Desktop Toolkit C has a bug: must be + included before . + BSD/OS 4.0.1 has a bug: , and + must be included before . */ + #include + #include + #include + #include ]], [[wchar_t wc; char const s[] = ""; size_t n = 1; @@ -379,4 +431,3 @@ AC_DEFUN([AC_FUNC_MBRTOWC], [Define to 1 if mbrtowc and mbstate_t are properly declared.]) fi ]) -])