From 3999390896d27fa8c342c056e90d2c375283d535 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 24 May 2004 23:18:04 +0000 Subject: [PATCH] AC_FUNC_MBRTOWC: Don't assume that a function F exists merely because the compiler and linker let you compile an expression like (F != 0). --- ChangeLog | 8 ++++++++ lib/autoconf/functions.m4 | 6 +++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index ba88bfca..de912a80 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,13 @@ 2004-05-24 Paul Eggert + * lib/autoconf/functions.m4 (AC_FUNC_MBRTOWC): Don't assume that a + function F exists if the compiler and linker let you compile an + expression like (F != 0). Recent versions of GCC optimize away + the reference to F in that case, since every function address must + be nonzero, so the link succeeds even if F does not exist. + Problem reported by Manu in + . + * doc/autoconf.texi (Systemology): Standardize on the spelling of "Unix". Many uses changed. (Limitations of Builtins): Explain better why the ! command isn't diff --git a/lib/autoconf/functions.m4 b/lib/autoconf/functions.m4 index e5a38f52..b752c296 100644 --- a/lib/autoconf/functions.m4 +++ b/lib/autoconf/functions.m4 @@ -889,7 +889,11 @@ AC_DEFUN([AC_FUNC_MBRTOWC], [AC_LINK_IFELSE( [AC_LANG_PROGRAM( [[@%:@include ]], - [[mbstate_t state; return ! (sizeof state && mbrtowc);]])], + [[wchar_t wc; + char const s[] = ""; + size_t n = 1; + mbstate_t state; + return ! (sizeof state && (mbrtowc) (&wc, s, n, &state));]])], ac_cv_func_mbrtowc=yes, ac_cv_func_mbrtowc=no)]) if test $ac_cv_func_mbrtowc = yes; then