On IRIX 6.5, with cc, I'm seeing a compilation error: cc -n32 -DHAVE_CONFIG_H -I. -I.. -DGNULIB_STRICT_CHECKING=1 -I/u/guest/bruno/prefix-n32-cc/include -g -c -o wcsdup.o wcsdup.c cc-1119 cc: ERROR File = wcsdup-impl.h, Line = 24 The "return" expression type differs from the function return type.
return wmemcpy (copy, s, n); ^ 1 error detected in the compilation of "wcsdup.c". gmake[4]: *** [Makefile:3494: wcsdup.o] Error 2 The cause is that the test program in wmemcpy.m4 is only compiled, not linked; this succeeds even without a wmemcpy() function being declared. Thus, HAVE_WMEMCPY gets the value 1, and gnulib's wchar.h replacement does not declare 'wmemcpy'. Then wcsdup.c fails to compile. This patch fixes it. 2020-05-29 Bruno Haible <br...@clisp.org> wmemchr, wmemcmp, wmemcpy, wmemmove, wmemset: Fix autoconf test. * m4/wmemchr.m4 (gl_FUNC_WMEMCHR): Link, not only compile, the test program. * m4/wmemcmp.m4 (gl_FUNC_WMEMCMP): Likewise. * m4/wmemcpy.m4 (gl_FUNC_WMEMCPY): Likewise. * m4/wmemmove.m4 (gl_FUNC_WMEMMOVE): Likewise. * m4/wmemset.m4 (gl_FUNC_WMEMSET): Likewise. diff --git a/m4/wmemchr.m4 b/m4/wmemchr.m4 index b8bbf07..62bd89c 100644 --- a/m4/wmemchr.m4 +++ b/m4/wmemchr.m4 @@ -1,4 +1,4 @@ -# wmemchr.m4 serial 3 +# wmemchr.m4 serial 4 dnl Copyright (C) 2011-2020 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -10,7 +10,7 @@ AC_DEFUN([gl_FUNC_WMEMCHR], dnl We cannot use AC_CHECK_FUNCS here, because the MSVC 9 header files dnl provide this function as an inline function definition. AC_CACHE_CHECK([for wmemchr], [gl_cv_func_wmemchr], - [AC_COMPILE_IFELSE( + [AC_LINK_IFELSE( [AC_LANG_PROGRAM([[ /* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before <wchar.h>. diff --git a/m4/wmemcmp.m4 b/m4/wmemcmp.m4 index 4584d1f..701e73f 100644 --- a/m4/wmemcmp.m4 +++ b/m4/wmemcmp.m4 @@ -1,4 +1,4 @@ -# wmemcmp.m4 serial 3 +# wmemcmp.m4 serial 4 dnl Copyright (C) 2011-2020 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -10,7 +10,7 @@ AC_DEFUN([gl_FUNC_WMEMCMP], dnl We cannot use AC_CHECK_FUNCS here, because the MSVC 9 header files dnl provide this function as an inline function definition. AC_CACHE_CHECK([for wmemcmp], [gl_cv_func_wmemcmp], - [AC_COMPILE_IFELSE( + [AC_LINK_IFELSE( [AC_LANG_PROGRAM([[ /* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before <wchar.h>. diff --git a/m4/wmemcpy.m4 b/m4/wmemcpy.m4 index 3309248..c9d749d 100644 --- a/m4/wmemcpy.m4 +++ b/m4/wmemcpy.m4 @@ -1,4 +1,4 @@ -# wmemcpy.m4 serial 3 +# wmemcpy.m4 serial 4 dnl Copyright (C) 2011-2020 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -10,7 +10,7 @@ AC_DEFUN([gl_FUNC_WMEMCPY], dnl We cannot use AC_CHECK_FUNCS here, because the MSVC 9 header files dnl provide this function as an inline function definition. AC_CACHE_CHECK([for wmemcpy], [gl_cv_func_wmemcpy], - [AC_COMPILE_IFELSE( + [AC_LINK_IFELSE( [AC_LANG_PROGRAM([[ /* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before <wchar.h>. diff --git a/m4/wmemmove.m4 b/m4/wmemmove.m4 index 61598e4..adbc12d 100644 --- a/m4/wmemmove.m4 +++ b/m4/wmemmove.m4 @@ -1,4 +1,4 @@ -# wmemmove.m4 serial 3 +# wmemmove.m4 serial 4 dnl Copyright (C) 2011-2020 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -10,7 +10,7 @@ AC_DEFUN([gl_FUNC_WMEMMOVE], dnl We cannot use AC_CHECK_FUNCS here, because the MSVC 9 header files dnl provide this function as an inline function definition. AC_CACHE_CHECK([for wmemmove], [gl_cv_func_wmemmove], - [AC_COMPILE_IFELSE( + [AC_LINK_IFELSE( [AC_LANG_PROGRAM([[ /* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before <wchar.h>. diff --git a/m4/wmemset.m4 b/m4/wmemset.m4 index e6aa3fb..0148ea3 100644 --- a/m4/wmemset.m4 +++ b/m4/wmemset.m4 @@ -1,4 +1,4 @@ -# wmemset.m4 serial 3 +# wmemset.m4 serial 4 dnl Copyright (C) 2011-2020 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -10,7 +10,7 @@ AC_DEFUN([gl_FUNC_WMEMSET], dnl We cannot use AC_CHECK_FUNCS here, because the MSVC 9 header files dnl provide this function as an inline function definition. AC_CACHE_CHECK([for wmemset], [gl_cv_func_wmemset], - [AC_COMPILE_IFELSE( + [AC_LINK_IFELSE( [AC_LANG_PROGRAM([[ /* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before <wchar.h>.