From 515e47279f7cf694407dd6a141e90aa00d169748 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sun, 18 Oct 2020 23:05:38 +0200 Subject: [PATCH] wchar: Fix configure test result on some versions of AIX. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Reported by Clément Chigot in . * m4/wchar_h.m4 (gl_WCHAR_H_INLINE_OK): Execute the test only on glibc systems. --- ChangeLog | 8 ++++++++ m4/wchar_h.m4 | 57 ++++++++++++++++++++++++++++----------------------- 2 files changed, 39 insertions(+), 26 deletions(-) diff --git a/ChangeLog b/ChangeLog index f6705c65e2..78c1ba431b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2020-10-18 Bruno Haible + + wchar: Fix configure test result on some versions of AIX. + Reported by Clément Chigot in + . + * m4/wchar_h.m4 (gl_WCHAR_H_INLINE_OK): Execute the test only on glibc + systems. + 2020-10-18 Bruno Haible time: Fix warning about asctime when asctime is not used. diff --git a/m4/wchar_h.m4 b/m4/wchar_h.m4 index 6c4e8a6c4a..08b7c86849 100644 --- a/m4/wchar_h.m4 +++ b/m4/wchar_h.m4 @@ -7,7 +7,7 @@ dnl with or without modifications, as long as this notice is preserved. dnl Written by Eric Blake. -# wchar_h.m4 serial 46 +# wchar_h.m4 serial 47 AC_DEFUN([gl_WCHAR_H], [ @@ -70,11 +70,14 @@ AC_DEFUN([gl_WCHAR_H_INLINE_OK], dnl and . In summary, dnl glibc version 2.5 or older, together with gcc version 4.3 or newer and dnl the option -std=c99 or -std=gnu99, leads to a broken . + AC_REQUIRE([AC_CANONICAL_HOST]) AC_CACHE_CHECK([whether uses 'inline' correctly], [gl_cv_header_wchar_h_correct_inline], [gl_cv_header_wchar_h_correct_inline=yes - AC_LANG_CONFTEST([ - AC_LANG_SOURCE([[#define wcstod renamed_wcstod + case "$host_os" in + *-gnu* | gnu*) + AC_LANG_CONFTEST([ + AC_LANG_SOURCE([[#define wcstod renamed_wcstod /* Tru64 with Desktop Toolkit C has a bug: must be included before . BSD/OS 4.0.1 has a bug: , and must be @@ -86,17 +89,17 @@ AC_DEFUN([gl_WCHAR_H_INLINE_OK], extern int zero (void); int main () { return zero(); } ]])]) - dnl Do not rename the object file from conftest.$ac_objext to - dnl conftest1.$ac_objext, as this will cause the link to fail on - dnl z/OS when using the XPLINK object format (due to duplicate - dnl CSECT names). Instead, temporarily redefine $ac_compile so - dnl that the object file has the latter name from the start. - save_ac_compile="$ac_compile" - ac_compile=`echo "$save_ac_compile" | sed s/conftest/conftest1/` - if echo '#include "conftest.c"' >conftest1.c && - AC_TRY_EVAL([ac_compile]); then - AC_LANG_CONFTEST([ - AC_LANG_SOURCE([[#define wcstod renamed_wcstod + dnl Do not rename the object file from conftest.$ac_objext to + dnl conftest1.$ac_objext, as this will cause the link to fail on + dnl z/OS when using the XPLINK object format (due to duplicate + dnl CSECT names). Instead, temporarily redefine $ac_compile so + dnl that the object file has the latter name from the start. + save_ac_compile="$ac_compile" + ac_compile=`echo "$save_ac_compile" | sed s/conftest/conftest1/` + if echo '#include "conftest.c"' >conftest1.c \ + && AC_TRY_EVAL([ac_compile]); then + AC_LANG_CONFTEST([ + AC_LANG_SOURCE([[#define wcstod renamed_wcstod /* Tru64 with Desktop Toolkit C has a bug: must be included before . BSD/OS 4.0.1 has a bug: , and must be @@ -107,19 +110,21 @@ int main () { return zero(); } #include int zero (void) { return 0; } ]])]) - dnl See note above about renaming object files. - ac_compile=`echo "$save_ac_compile" | sed s/conftest/conftest2/` - if echo '#include "conftest.c"' >conftest2.c && - AC_TRY_EVAL([ac_compile]); then - if $CC -o conftest$ac_exeext $CFLAGS $LDFLAGS conftest1.$ac_objext conftest2.$ac_objext $LIBS >&AS_MESSAGE_LOG_FD 2>&1; then - : - else - gl_cv_header_wchar_h_correct_inline=no + dnl See note above about renaming object files. + ac_compile=`echo "$save_ac_compile" | sed s/conftest/conftest2/` + if echo '#include "conftest.c"' >conftest2.c \ + && AC_TRY_EVAL([ac_compile]); then + if $CC -o conftest$ac_exeext $CFLAGS $LDFLAGS conftest1.$ac_objext conftest2.$ac_objext $LIBS >&AS_MESSAGE_LOG_FD 2>&1; then + : + else + gl_cv_header_wchar_h_correct_inline=no + fi + fi fi - fi - fi - ac_compile="$save_ac_compile" - rm -f conftest[12].c conftest[12].$ac_objext conftest$ac_exeext + ac_compile="$save_ac_compile" + rm -f conftest[12].c conftest[12].$ac_objext conftest$ac_exeext + ;; + esac ]) if test $gl_cv_header_wchar_h_correct_inline = no; then AC_MSG_ERROR([ cannot be used with this compiler ($CC $CFLAGS $CPPFLAGS). -- 2.39.5