[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] wchar: avoid a linker error during configure on AIX
From: |
Bruno Haible |
Subject: |
Re: [PATCH] wchar: avoid a linker error during configure on AIX |
Date: |
Sun, 18 Oct 2020 23:06:53 +0200 |
User-agent: |
KMail/5.1.3 (Linux/4.4.0-189-generic; KDE/5.18.0; x86_64; ; ) |
Hi,
CHIGOT, CLEMENT wrote:
> Configure programs aiming to check if wchar.h uses 'inline' correctly
> raises a linker error on AIX because there are redefining wcstod to an
> undeclaration function. However, in the latest AIX version (at least
> 7.1.5 and after 7.2.3), wcstod() is used to declare a static function
> directly in wchar.h. Thus, renamed_wcstod() must be defined.
>
> * m4/wchar_t.m4 (gl_WCHAR_H_INLINE_OK): Add fake definiton of
> renamed_wcstod for AIX.
Thanks for the report.
I can't reproduce the problem on the AIX 7.1 and 7.2 systems I have
access to. Anyway...
Your patch is a workaround to a workaround. Worse, I can't verify that
your patch does not break the original workaround (on glibc systems of
around 2009). Therefore I find it better to just not execute the test
on AIX systems - and just reduce the amount of workarounds, not increase
them.
2020-10-18 Bruno Haible <bruno@clisp.org>
wchar: Fix configure test result on some versions of AIX.
Reported by Clément Chigot <clement.chigot@atos.net> in
<https://lists.gnu.org/archive/html/bug-gnulib/2020-10/msg00115.html>.
* m4/wchar_h.m4 (gl_WCHAR_H_INLINE_OK): Execute the test only on glibc
systems.
(diff -w)
diff --git a/m4/wchar_h.m4 b/m4/wchar_h.m4
index 6c4e8a6..08b7c86 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,9 +70,12 @@ AC_DEFUN([gl_WCHAR_H_INLINE_OK],
dnl and <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=42440>. 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 <wchar.h>.
+ AC_REQUIRE([AC_CANONICAL_HOST])
AC_CACHE_CHECK([whether <wchar.h> uses 'inline' correctly],
[gl_cv_header_wchar_h_correct_inline],
[gl_cv_header_wchar_h_correct_inline=yes
+ case "$host_os" in
+ *-gnu* | gnu*)
AC_LANG_CONFTEST([
AC_LANG_SOURCE([[#define wcstod renamed_wcstod
/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
@@ -93,8 +96,8 @@ int main () { return zero(); }
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
+ 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: <stdio.h> must be included before
@@ -109,8 +112,8 @@ 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 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
@@ -120,6 +123,8 @@ int zero (void) { return 0; }
fi
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([<wchar.h> cannot be used with this compiler ($CC $CFLAGS
$CPPFLAGS).