libidn-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[SCM] GNU libidn branch, master, updated. libidn-1-16-17-gf63b796


From: Simon Josefsson
Subject: [SCM] GNU libidn branch, master, updated. libidn-1-16-17-gf63b796
Date: Wed, 03 Feb 2010 08:24:40 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU libidn".

http://git.savannah.gnu.org/cgit/libidn.git/commit/?id=f63b796f48d5367f1e4fa0107d2f645f6351830f

The branch, master has been updated
       via  f63b796f48d5367f1e4fa0107d2f645f6351830f (commit)
       via  e82d2d0a2712613f64379cea689dbb1d15be1210 (commit)
      from  5a3dd331bc3808e5b375bb9fc09d83a2bb5f6ba6 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit f63b796f48d5367f1e4fa0107d2f645f6351830f
Author: Simon Josefsson <address@hidden>
Date:   Wed Feb 3 09:23:47 2010 +0100

    Make sure all symbols are exported.  Add self test to catch regressions.
    
    See <http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=561291> and
    <http://lists.gnu.org/archive/html/help-libidn/2010-02/msg00000.html>
    for background.

commit e82d2d0a2712613f64379cea689dbb1d15be1210
Author: Simon Josefsson <address@hidden>
Date:   Wed Feb 3 08:25:58 2010 +0100

    Update gnulib files.

-----------------------------------------------------------------------

Summary of changes:
 build-aux/gnupload               |    4 +-
 build-aux/link-warning.h         |   45 ------
 gl/Makefile.am                   |   40 +----
 gl/error.h                       |   15 +-
 gl/m4/fcntl_h.m4                 |    8 +-
 gl/m4/gnulib-comp.m4             |    5 +-
 gl/m4/stdlib_h.m4                |   16 ++-
 gl/m4/string_h.m4                |    9 +-
 gl/m4/sys_stat_h.m4              |    7 +-
 gl/m4/unistd_h.m4                |   15 ++-
 gl/m4/wchar.m4                   |   15 ++-
 gl/string.in.h                   |  230 ++++++++++++++----------------
 gl/unistd.in.h                   |  291 +++++++++++++++++++-------------------
 gltests/Makefile.am              |   44 ++----
 gltests/fcntl.in.h               |   31 ++--
 gltests/ignore-value.h           |   37 +++++
 gltests/stdlib.in.h              |  185 ++++++++++++------------
 gltests/sys_stat.in.h            |  100 +++++++-------
 gltests/test-lstat.c             |    3 +-
 gltests/test-symlink.c           |    3 +-
 gltests/wchar.in.h               |   92 ++++++------
 lib/gen-stringprep-tables.pl     |    3 +-
 lib/gl/Makefile.am               |   54 ++++----
 lib/gl/m4/gnulib-comp.m4         |    3 +-
 lib/gl/m4/string_h.m4            |    9 +-
 {gl => lib/gl}/m4/warn-on-use.m4 |    0
 lib/gl/m4/wchar.m4               |   15 ++-
 lib/gl/string.in.h               |  230 ++++++++++++++----------------
 lib/gl/wchar.in.h                |   92 ++++++------
 lib/gltests/Makefile.am          |   47 +++----
 lib/stringprep.h                 |    2 +
 maint.mk                         |   45 ++++++-
 tests/Makefile.am                |    5 +-
 tests/tst_symbols.c              |  123 ++++++++++++++++
 34 files changed, 989 insertions(+), 834 deletions(-)
 delete mode 100644 build-aux/link-warning.h
 create mode 100644 gltests/ignore-value.h
 copy {gl => lib/gl}/m4/warn-on-use.m4 (100%)
 create mode 100644 tests/tst_symbols.c

diff --git a/build-aux/gnupload b/build-aux/gnupload
index bfdad59..6943ca9 100755
--- a/build-aux/gnupload
+++ b/build-aux/gnupload
@@ -1,9 +1,9 @@
 #!/bin/sh
 # Sign files and upload them.
 
-scriptversion=2009-12-21.21; # UTC
+scriptversion=2010-01-27.15; # UTC
 
-# Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation
+# Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software 
Foundation, Inc.
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
diff --git a/build-aux/link-warning.h b/build-aux/link-warning.h
deleted file mode 100644
index 0725e78..0000000
--- a/build-aux/link-warning.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/* A C macro for emitting link time warnings.
-   Copyright (C) 1995, 1997, 2000, 2002-2003, 2007, 2009-2010 Free Software
-   Foundation, Inc.
-
-   This program is free software: you can redistribute it and/or modify it
-   under the terms of the GNU General Public License as published
-   by the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-/* GL_LINK_WARNING("literal string") arranges to emit the literal string as
-   a linker warning on most glibc systems.
-   We use a linker warning rather than a preprocessor warning, because
-   #warning cannot be used inside macros.  */
-#ifndef GL_LINK_WARNING
-  /* This works on platforms with GNU ld and ELF object format.
-     Testing __GLIBC__ is sufficient for asserting that GNU ld is in use.
-     Testing __ELF__ guarantees the ELF object format.
-     Testing __GNUC__ is necessary for the compound expression syntax.  */
-# if defined __GLIBC__ && defined __ELF__ && defined __GNUC__
-#  define GL_LINK_WARNING(message) \
-     GL_LINK_WARNING1 (__FILE__, __LINE__, message)
-#  define GL_LINK_WARNING1(file, line, message) \
-     GL_LINK_WARNING2 (file, line, message)  /* macroexpand file and line */
-#  define GL_LINK_WARNING2(file, line, message) \
-     GL_LINK_WARNING3 (file ":" #line ": warning: " message)
-#  define GL_LINK_WARNING3(message) \
-     ({ static const char warning[sizeof (message)]             \
-          __attribute__ ((__unused__,                           \
-                          __section__ (".gnu.warning"),         \
-                          __aligned__ (1)))                     \
-          = message "\n";                                       \
-        (void)0;                                                \
-     })
-# else
-#  define GL_LINK_WARNING(message) ((void) 0)
-# endif
-#endif
diff --git a/gl/Makefile.am b/gl/Makefile.am
index 0c80c53..3568603 100644
--- a/gl/Makefile.am
+++ b/gl/Makefile.am
@@ -167,30 +167,6 @@ EXTRA_DIST += intprops.h
 
 ## end   gnulib module intprops
 
-## begin gnulib module link-warning
-
-# The BUILT_SOURCES created by this Makefile snippet are not used via #include
-# statements but through direct file reference. Therefore this snippet must be
-# present in all Makefile.am that need it. This is ensured by the applicability
-# 'all' defined above.
-
-BUILT_SOURCES += link-warning.h
-# The link-warning.h that gets inserted into generated .h files is the same as
-# build-aux/link-warning.h, except that it has the copyright header cut off.
-link-warning.h: $(top_srcdir)/build-aux/link-warning.h
-       $(AM_V_GEN)rm -f address@hidden $@ && \
-       sed -n -e '/GL_LINK_WARNING/,$$p' \
-         < $(top_srcdir)/build-aux/link-warning.h \
-         > address@hidden && \
-       mv address@hidden $@
-MOSTLYCLEANFILES += link-warning.h link-warning.h-t
-
-LINK_WARNING_H=link-warning.h
-
-EXTRA_DIST += $(top_srcdir)/build-aux/link-warning.h
-
-## end   gnulib module link-warning
-
 ## begin gnulib module maintainer-makefile
 
 EXTRA_DIST += $(top_srcdir)/maint.mk
@@ -269,7 +245,7 @@ BUILT_SOURCES += string.h
 
 # We need the following in order to create <string.h> when the system
 # doesn't have one that works with the given compiler.
-string.h: string.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
+string.h: string.in.h $(WARN_ON_USE_H) $(ARG_NONNULL_H)
        $(AM_V_GEN)rm -f address@hidden $@ && \
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
          sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
@@ -308,7 +284,8 @@ string.h: string.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
              -e 's|@''GNULIB_STRERROR''@|$(GNULIB_STRERROR)|g' \
              -e 's|@''GNULIB_STRSIGNAL''@|$(GNULIB_STRSIGNAL)|g' \
              -e 's|@''GNULIB_STRVERSCMP''@|$(GNULIB_STRVERSCMP)|g' \
-             -e 's|@''HAVE_MBSLEN''@|$(HAVE_MBSLEN)|g' \
+             < $(srcdir)/string.in.h | \
+         sed -e 's|@''HAVE_MBSLEN''@|$(HAVE_MBSLEN)|g' \
              -e 's|@''HAVE_DECL_MEMMEM''@|$(HAVE_DECL_MEMMEM)|g' \
              -e 's|@''HAVE_MEMPCPY''@|$(HAVE_MEMPCPY)|g' \
              -e 's|@''HAVE_DECL_MEMRCHR''@|$(HAVE_DECL_MEMRCHR)|g' \
@@ -336,8 +313,8 @@ string.h: string.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
              -e 's|@''REPLACE_STRSIGNAL''@|$(REPLACE_STRSIGNAL)|g' \
              -e 's|@''REPLACE_STRTOK_R''@|$(REPLACE_STRTOK_R)|g' \
              -e 's|@''UNDEFINE_STRTOK_R''@|$(UNDEFINE_STRTOK_R)|g' \
-             -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
              -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
+             -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \
              < $(srcdir)/string.in.h; \
        } > address@hidden && \
        mv address@hidden $@
@@ -353,7 +330,7 @@ BUILT_SOURCES += unistd.h
 
 # We need the following in order to create an empty placeholder for
 # <unistd.h> when the system doesn't have one.
-unistd.h: unistd.in.h $(LINK_WARNING_H) $(WARN_ON_USE_H) $(ARG_NONNULL_H)
+unistd.h: unistd.in.h $(WARN_ON_USE_H) $(ARG_NONNULL_H)
        $(AM_V_GEN)rm -f address@hidden $@ && \
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
          sed -e 's|@''HAVE_UNISTD_H''@|$(HAVE_UNISTD_H)|g' \
@@ -398,7 +375,8 @@ unistd.h: unistd.in.h $(LINK_WARNING_H) $(WARN_ON_USE_H) 
$(ARG_NONNULL_H)
              -e 's|@''GNULIB_UNLINKAT''@|$(GNULIB_UNLINKAT)|g' \
              -e 's|@''GNULIB_USLEEP''@|$(GNULIB_USLEEP)|g' \
              -e 's|@''GNULIB_WRITE''@|$(GNULIB_WRITE)|g' \
-             -e 's|@''HAVE_CHOWN''@|$(HAVE_CHOWN)|g' \
+             < $(srcdir)/unistd.in.h | \
+         sed -e 's|@''HAVE_CHOWN''@|$(HAVE_CHOWN)|g' \
              -e 's|@''HAVE_DUP2''@|$(HAVE_DUP2)|g' \
              -e 's|@''HAVE_DUP3''@|$(HAVE_DUP3)|g' \
              -e 's|@''HAVE_EUIDACCESS''@|$(HAVE_EUIDACCESS)|g' \
@@ -453,10 +431,8 @@ unistd.h: unistd.in.h $(LINK_WARNING_H) $(WARN_ON_USE_H) 
$(ARG_NONNULL_H)
              -e 's|@''REPLACE_WRITE''@|$(REPLACE_WRITE)|g' \
              -e 
's|@''UNISTD_H_HAVE_WINSOCK2_H''@|$(UNISTD_H_HAVE_WINSOCK2_H)|g' \
              -e 
's|@''UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS''@|$(UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS)|g'
 \
-             -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
              -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
-             -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
-             < $(srcdir)/unistd.in.h; \
+             -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \
        } > address@hidden && \
        mv address@hidden $@
 MOSTLYCLEANFILES += unistd.h unistd.h-t
diff --git a/gl/error.h b/gl/error.h
index b4ae982..9deef02 100644
--- a/gl/error.h
+++ b/gl/error.h
@@ -20,15 +20,14 @@
 #define _ERROR_H 1
 
 #ifndef __attribute__
-/* This feature is available in gcc versions 2.5 and later.  */
-# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)
-#  define __attribute__(Spec) /* empty */
-# endif
-/* The __-protected variants of `format' and `printf' attributes
-   are accepted by gcc versions 2.6.4 (effectively 2.7) and later.  */
+/* The __attribute__ feature is available in gcc versions 2.5 and later.
+   The __-protected variants of the attributes 'format' and 'printf' are
+   accepted by gcc versions 2.6.4 (effectively 2.7) and later.
+   We enable __attribute__ only if these are supported too, because
+   gnulib and libintl do '#define printf __printf__' when they override
+   the 'printf' function.  */
 # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
-#  define __format__ format
-#  define __printf__ printf
+#  define __attribute__(Spec)   /* empty */
 # endif
 #endif
 
diff --git a/gl/m4/fcntl_h.m4 b/gl/m4/fcntl_h.m4
index 048a9fc..ecd8fa3 100644
--- a/gl/m4/fcntl_h.m4
+++ b/gl/m4/fcntl_h.m4
@@ -1,4 +1,4 @@
-# serial 9
+# serial 10
 # Configure fcntl.h.
 dnl Copyright (C) 2006, 2007, 2009, 2010 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
@@ -12,6 +12,12 @@ AC_DEFUN([gl_FCNTL_H],
   AC_REQUIRE([gl_FCNTL_H_DEFAULTS])
   AC_REQUIRE([gl_FCNTL_O_FLAGS])
   gl_CHECK_NEXT_HEADERS([fcntl.h])
+
+  dnl Check for declarations of anything we want to poison if the
+  dnl corresponding gnulib module is not in use, if it is not common
+  dnl enough to be declared everywhere.
+  gl_WARN_ON_USE_PREPARE([[#include <fcntl.h>
+    ]], [fcntl openat])
 ])
 
 AC_DEFUN([gl_FCNTL_MODULE_INDICATOR],
diff --git a/gl/m4/gnulib-comp.m4 b/gl/m4/gnulib-comp.m4
index 1abc3c6..2ed6237 100644
--- a/gl/m4/gnulib-comp.m4
+++ b/gl/m4/gnulib-comp.m4
@@ -69,6 +69,8 @@ AC_DEFUN([gl_INIT],
        m4_defn([m4_PACKAGE_VERSION])), [1], [],
         [AC_CONFIG_LINKS([$GNUmakefile:$GNUmakefile], [],
        [GNUmakefile=$GNUmakefile])])
+  AC_CONFIG_COMMANDS_PRE([m4_ifdef([AH_HEADER],
+    [AC_SUBST([CONFIG_INCLUDE], m4_defn([AH_HEADER]))])])
   AC_PATH_PROG([PMCCABE], [pmccabe], [false])
   AC_CHECK_DECLS([program_invocation_name], [], [], [#include <errno.h>])
   AC_CHECK_DECLS([program_invocation_short_name], [], [], [#include <errno.h>])
@@ -125,6 +127,7 @@ AC_DEFUN([gl_INIT],
   gl_ENVIRON
   gl_UNISTD_MODULE_INDICATOR([environ])
   gl_FCNTL_H
+  AC_REQUIRE([AC_C_INLINE])
   gl_FUNC_LSTAT
   gl_SYS_STAT_MODULE_INDICATOR([lstat])
   gl_FUNC_MALLOC_POSIX
@@ -253,7 +256,6 @@ AC_DEFUN([gl_FILE_LIST], [
   build-aux/csharpcomp.sh.in
   build-aux/gendocs.sh
   build-aux/gnupload
-  build-aux/link-warning.h
   build-aux/pmccabe.css
   build-aux/pmccabe2html
   build-aux/update-copyright
@@ -370,6 +372,7 @@ AC_DEFUN([gl_FILE_LIST], [
   tests=lib/binary-io.h
   tests=lib/dup2.c
   tests=lib/fcntl.in.h
+  tests=lib/ignore-value.h
   tests=lib/lstat.c
   tests=lib/malloc.c
   tests=lib/malloca.c
diff --git a/gl/m4/stdlib_h.m4 b/gl/m4/stdlib_h.m4
index cf41ec0..0693d1a 100644
--- a/gl/m4/stdlib_h.m4
+++ b/gl/m4/stdlib_h.m4
@@ -1,4 +1,4 @@
-# stdlib_h.m4 serial 21
+# stdlib_h.m4 serial 22
 dnl Copyright (C) 2007-2010 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -22,6 +22,20 @@ AC_DEFUN([gl_STDLIB_H],
       # include <random.h>
       #endif
     ]])
+
+  dnl Check for declarations of anything we want to poison if the
+  dnl corresponding gnulib module is not in use, and which is not
+  dnl guaranteed by C89.
+  gl_WARN_ON_USE_PREPARE([[#include <stdlib.h>
+#if HAVE_SYS_LOADAVG_H
+# include <sys/loadavg.h>
+#endif
+#if HAVE_RANDOM_H
+# include <random.h>
+#endif
+    ]], [atoll canonicalize_file_name getloadavg getsubopt mkdtemp
+    mkostemp mkostemps mkstemp mkstemps random_r initstat_r srandom_r
+    setstate_r realpath rpmatch setenv strtod strtoll strtoull unsetenv])
 ])
 
 AC_DEFUN([gl_STDLIB_MODULE_INDICATOR],
diff --git a/gl/m4/string_h.m4 b/gl/m4/string_h.m4
index f2f64d1..73c6d83 100644
--- a/gl/m4/string_h.m4
+++ b/gl/m4/string_h.m4
@@ -5,7 +5,7 @@
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 10
+# serial 11
 
 # Written by Paul Eggert.
 
@@ -21,6 +21,13 @@ AC_DEFUN([gl_HEADER_STRING_H_BODY],
   AC_REQUIRE([AC_C_RESTRICT])
   AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
   gl_CHECK_NEXT_HEADERS([string.h])
+
+  dnl Check for declarations of anything we want to poison if the
+  dnl corresponding gnulib module is not in use, and which is not
+  dnl guaranteed by C89.
+  gl_WARN_ON_USE_PREPARE([[#include <string.h>
+    ]], [memmem mempcpy memrchr rawmemchr stpcpy stpncpy strchrnul strdup
+    strndup strnlen strpbrk strsep strcasestr strtok_r strsignal strverscmp])
 ])
 
 AC_DEFUN([gl_STRING_MODULE_INDICATOR],
diff --git a/gl/m4/sys_stat_h.m4 b/gl/m4/sys_stat_h.m4
index 4cec9cd..5a113d0 100644
--- a/gl/m4/sys_stat_h.m4
+++ b/gl/m4/sys_stat_h.m4
@@ -1,4 +1,4 @@
-# sys_stat_h.m4 serial 21   -*- Autoconf -*-
+# sys_stat_h.m4 serial 22   -*- Autoconf -*-
 dnl Copyright (C) 2006-2010 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -27,6 +27,11 @@ AC_DEFUN([gl_HEADER_SYS_STAT_H],
     [#include <sys/types.h>
      #include <sys/stat.h>])
 
+  dnl Check for declarations of anything we want to poison if the
+  dnl corresponding gnulib module is not in use.
+  gl_WARN_ON_USE_PREPARE([[#include <sys/stat.h>
+    ]], [fchmodat fstatat futimens lchmod lstat mkdirat mkfifo mkfifoat
+    mknod mknodat stat utimensat])
 ]) # gl_HEADER_SYS_STAT_H
 
 AC_DEFUN([gl_SYS_STAT_MODULE_INDICATOR],
diff --git a/gl/m4/unistd_h.m4 b/gl/m4/unistd_h.m4
index aacec2b..31d31c1 100644
--- a/gl/m4/unistd_h.m4
+++ b/gl/m4/unistd_h.m4
@@ -1,4 +1,4 @@
-# unistd_h.m4 serial 38
+# unistd_h.m4 serial 39
 dnl Copyright (C) 2006-2010 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -26,11 +26,20 @@ AC_DEFUN([gl_UNISTD_H],
   dnl Check for declarations of anything we want to poison if the
   dnl corresponding gnulib module is not in use.
   gl_WARN_ON_USE_PREPARE([[#include <unistd.h>
-/* Some systems declare environ in the wrong header.  */
+/* Some systems declare various items in the wrong headers.  */
 #ifndef __GLIBC__
+# include <fcntl.h>
+# include <stdio.h>
 # include <stdlib.h>
+# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+#  include <io.h>
+# endif
 #endif
-    ]], [environ])
+    ]], [chown dup2 dup3 environ euidaccess faccessat fchdir fchownat
+    fsync ftruncate getcwd getdomainname getdtablesize getgroups
+    gethostname getlogin getlogin_r getpagesize getusershell setusershell
+    endusershell lchown link linkat lseek pipe2 pread readlink readlinkat
+    rmdir sleep symlink symlinkat unlink unlinkat usleep])
 ])
 
 AC_DEFUN([gl_UNISTD_MODULE_INDICATOR],
diff --git a/gl/m4/wchar.m4 b/gl/m4/wchar.m4
index b2055f9..e81485d 100644
--- a/gl/m4/wchar.m4
+++ b/gl/m4/wchar.m4
@@ -7,7 +7,7 @@ dnl with or without modifications, as long as this notice is 
preserved.
 
 dnl Written by Eric Blake.
 
-# wchar.m4 serial 30
+# wchar.m4 serial 31
 
 AC_DEFUN([gl_WCHAR_H],
 [
@@ -33,6 +33,19 @@ AC_DEFUN([gl_WCHAR_H],
     HAVE_WINT_T=0
   fi
   AC_SUBST([HAVE_WINT_T])
+
+  dnl Check for declarations of anything we want to poison if the
+  dnl corresponding gnulib module is not in use.
+  gl_WARN_ON_USE_PREPARE([[
+/* Some systems require additional headers.  */
+#ifndef __GLIBC__
+# include <stddef.h>
+# include <stdio.h>
+# include <time.h>
+#endif
+#include <wchar.h>
+    ]], [btowc wctob mbsinit mbrtowc mbrlen mbsrtowcs mbsnrtowcs wcrtomb
+    wcsrtombs wcsnrtombs wcwidth])
 ])
 
 dnl Check whether <wchar.h> is usable at all.
diff --git a/gl/string.in.h b/gl/string.in.h
index 9d98d1f..8d88bda 100644
--- a/gl/string.in.h
+++ b/gl/string.in.h
@@ -48,10 +48,10 @@
 #endif
 
 
-/* The definition of GL_LINK_WARNING is copied here.  */
-
 /* The definition of _GL_ARG_NONNULL is copied here.  */
 
+/* The definition of _GL_WARN_ON_USE is copied here.  */
+
 
 #ifdef __cplusplus
 extern "C" {
@@ -67,10 +67,9 @@ extern void *memchr (void const *__s, int __c, size_t __n)
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef memchr
-# define memchr(s,c,n) \
-    (GL_LINK_WARNING ("memchr has platform-specific bugs - " \
-                      "use gnulib module memchr for portability" ), \
-     memchr (s, c, n))
+/* Assume memchr is always declared.  */
+_GL_WARN_ON_USE (memchr, "memchr has platform-specific bugs - "
+                 "use gnulib module memchr for portability" );
 #endif
 
 /* Return the first occurrence of NEEDLE in HAYSTACK.  */
@@ -85,11 +84,11 @@ extern void *memmem (void const *__haystack, size_t 
__haystack_len,
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef memmem
-# define memmem(a,al,b,bl) \
-    (GL_LINK_WARNING ("memmem is unportable and often quadratic - " \
-                      "use gnulib module memmem-simple for portability, " \
-                      "and module memmem for speed" ), \
-     memmem (a, al, b, bl))
+# if HAVE_RAW_DECL_MEMMEM
+_GL_WARN_ON_USE (memmem, "memmem is unportable and often quadratic - "
+                 "use gnulib module memmem-simple for portability, "
+                 "and module memmem for speed" );
+# endif
 #endif
 
 /* Copy N bytes of SRC to DEST, return pointer to bytes after the
@@ -102,10 +101,10 @@ extern void *mempcpy (void *restrict __dest, void const 
*restrict __src,
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef mempcpy
-# define mempcpy(a,b,n) \
-    (GL_LINK_WARNING ("mempcpy is unportable - " \
-                      "use gnulib module mempcpy for portability"), \
-     mempcpy (a, b, n))
+# if HAVE_RAW_DECL_MEMPCPY
+_GL_WARN_ON_USE (mempcpy, "mempcpy is unportable - "
+                 "use gnulib module mempcpy for portability");
+# endif
 #endif
 
 /* Search backwards through a block for a byte (specified as an int).  */
@@ -116,10 +115,10 @@ extern void *memrchr (void const *, int, size_t)
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef memrchr
-# define memrchr(a,b,c) \
-    (GL_LINK_WARNING ("memrchr is unportable - " \
-                      "use gnulib module memrchr for portability"), \
-     memrchr (a, b, c))
+# if HAVE_RAW_DECL_MEMRCHR
+_GL_WARN_ON_USE (memrchr, "memrchr is unportable - "
+                 "use gnulib module memrchr for portability");
+# endif
 #endif
 
 /* Find the first occurrence of C in S.  More efficient than
@@ -132,10 +131,10 @@ extern void *rawmemchr (void const *__s, int __c_in)
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef rawmemchr
-# define rawmemchr(a,b) \
-    (GL_LINK_WARNING ("rawmemchr is unportable - " \
-                      "use gnulib module rawmemchr for portability"), \
-     rawmemchr (a, b))
+# if HAVE_RAW_DECL_RAWMEMCHR
+_GL_WARN_ON_USE (rawmemchr, "rawmemchr is unportable - "
+                 "use gnulib module rawmemchr for portability");
+# endif
 #endif
 
 /* Copy SRC to DST, returning the address of the terminating '\0' in DST.  */
@@ -146,10 +145,10 @@ extern char *stpcpy (char *restrict __dst, char const 
*restrict __src)
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef stpcpy
-# define stpcpy(a,b) \
-    (GL_LINK_WARNING ("stpcpy is unportable - " \
-                      "use gnulib module stpcpy for portability"), \
-     stpcpy (a, b))
+# if HAVE_RAW_DECL_STPCPY
+_GL_WARN_ON_USE (stpcpy, "stpcpy is unportable - "
+                 "use gnulib module stpcpy for portability");
+# endif
 #endif
 
 /* Copy no more than N bytes of SRC to DST, returning a pointer past the
@@ -163,21 +162,20 @@ extern char *stpncpy (char *restrict __dst, char const 
*restrict __src,
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef stpncpy
-# define stpncpy(a,b,n) \
-    (GL_LINK_WARNING ("stpncpy is unportable - " \
-                      "use gnulib module stpncpy for portability"), \
-     stpncpy (a, b, n))
+# if HAVE_RAW_DECL_STPNCPY
+_GL_WARN_ON_USE (stpncpy, "stpncpy is unportable - "
+                 "use gnulib module stpncpy for portability");
+# endif
 #endif
 
 #if defined GNULIB_POSIXCHECK
 /* strchr() does not work with multibyte strings if the locale encoding is
    GB18030 and the character to be searched is a digit.  */
 # undef strchr
-# define strchr(s,c) \
-    (GL_LINK_WARNING ("strchr cannot work correctly on character strings " \
-                      "in some multibyte locales - " \
-                      "use mbschr if you care about internationalization"), \
-     strchr (s, c))
+/* Assume strchr is always declared.  */
+_GL_WARN_ON_USE (strchr, "strchr cannot work correctly on character strings "
+                 "in some multibyte locales - "
+                 "use mbschr if you care about internationalization");
 #endif
 
 /* Find the first occurrence of C in S or the final NUL byte.  */
@@ -188,10 +186,10 @@ extern char *strchrnul (char const *__s, int __c_in)
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef strchrnul
-# define strchrnul(a,b) \
-    (GL_LINK_WARNING ("strchrnul is unportable - " \
-                      "use gnulib module strchrnul for portability"), \
-     strchrnul (a, b))
+# if HAVE_RAW_DECL_STRCHRNUL
+_GL_WARN_ON_USE (strchrnul, "strchrnul is unportable - "
+                 "use gnulib module strchrnul for portability");
+# endif
 #endif
 
 /* Duplicate S, returning an identical malloc'd string.  */
@@ -205,10 +203,10 @@ extern char *strdup (char const *__s) _GL_ARG_NONNULL 
((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef strdup
-# define strdup(a) \
-    (GL_LINK_WARNING ("strdup is unportable - " \
-                      "use gnulib module strdup for portability"), \
-     strdup (a))
+# if HAVE_RAW_DECL_STRDUP
+_GL_WARN_ON_USE (strdup, "strdup is unportable - "
+                 "use gnulib module strdup for portability");
+# endif
 #endif
 
 /* Return a newly allocated copy of at most N bytes of STRING.  */
@@ -222,10 +220,10 @@ extern char *strndup (char const *__string, size_t __n) 
_GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef strndup
-# define strndup(a,n) \
-    (GL_LINK_WARNING ("strndup is unportable - " \
-                      "use gnulib module strndup for portability"), \
-     strndup (a, n))
+# if HAVE_RAW_DECL_STRNDUP
+_GL_WARN_ON_USE (strndup, "strndup is unportable - "
+                 "use gnulib module strndup for portability");
+# endif
 #endif
 
 /* Find the length (number of bytes) of STRING, but scan at most
@@ -238,10 +236,10 @@ extern size_t strnlen (char const *__string, size_t 
__maxlen)
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef strnlen
-# define strnlen(a,n) \
-    (GL_LINK_WARNING ("strnlen is unportable - " \
-                      "use gnulib module strnlen for portability"), \
-     strnlen (a, n))
+# if HAVE_RAW_DECL_STRNLEN
+_GL_WARN_ON_USE (strnlen, "strnlen is unportable - "
+                 "use gnulib module strnlen for portability");
+# endif
 #endif
 
 #if defined GNULIB_POSIXCHECK
@@ -250,11 +248,10 @@ extern size_t strnlen (char const *__string, size_t 
__maxlen)
    locale encoding is GB18030 and one of the characters to be searched is a
    digit.  */
 # undef strcspn
-# define strcspn(s,a) \
-    (GL_LINK_WARNING ("strcspn cannot work correctly on character strings " \
-                      "in multibyte locales - " \
-                      "use mbscspn if you care about internationalization"), \
-     strcspn (s, a))
+/* Assume strcspn is always declared.  */
+_GL_WARN_ON_USE (strcspn, "strcspn cannot work correctly on character strings "
+                 "in multibyte locales - "
+                 "use mbscspn if you care about internationalization");
 #endif
 
 /* Find the first occurrence in S of any character in ACCEPT.  */
@@ -269,40 +266,36 @@ extern char *strpbrk (char const *__s, char const 
*__accept)
    locale encoding is GB18030 and one of the characters to be searched is a
    digit.  */
 #  undef strpbrk
-#  define strpbrk(s,a) \
-     (GL_LINK_WARNING ("strpbrk cannot work correctly on character strings " \
-                       "in multibyte locales - " \
-                       "use mbspbrk if you care about internationalization"), \
-      strpbrk (s, a))
+_GL_WARN_ON_USE (strpbrk, "strpbrk cannot work correctly on character strings "
+                 "in multibyte locales - "
+                 "use mbspbrk if you care about internationalization");
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef strpbrk
-# define strpbrk(s,a) \
-    (GL_LINK_WARNING ("strpbrk is unportable - " \
-                      "use gnulib module strpbrk for portability"), \
-     strpbrk (s, a))
+# if HAVE_RAW_DECL_STRPBRK
+_GL_WARN_ON_USE (strpbrk, "strpbrk is unportable - "
+                 "use gnulib module strpbrk for portability");
+# endif
 #endif
 
 #if defined GNULIB_POSIXCHECK
 /* strspn() assumes the second argument is a list of single-byte characters.
    Even in this simple case, it cannot work with multibyte strings.  */
 # undef strspn
-# define strspn(s,a) \
-    (GL_LINK_WARNING ("strspn cannot work correctly on character strings " \
-                      "in multibyte locales - " \
-                      "use mbsspn if you care about internationalization"), \
-     strspn (s, a))
+/* Assume strspn is always declared.  */
+_GL_WARN_ON_USE (strspn, "strspn cannot work correctly on character strings "
+                 "in multibyte locales - "
+                 "use mbsspn if you care about internationalization");
 #endif
 
 #if defined GNULIB_POSIXCHECK
 /* strrchr() does not work with multibyte strings if the locale encoding is
    GB18030 and the character to be searched is a digit.  */
 # undef strrchr
-# define strrchr(s,c) \
-    (GL_LINK_WARNING ("strrchr cannot work correctly on character strings " \
-                      "in some multibyte locales - " \
-                      "use mbsrchr if you care about internationalization"), \
-     strrchr (s, c))
+/* Assume strrchr is always declared.  */
+_GL_WARN_ON_USE (strrchr, "strrchr cannot work correctly on character strings "
+                 "in some multibyte locales - "
+                 "use mbsrchr if you care about internationalization");
 #endif
 
 /* Search the next delimiter (char listed in DELIM) starting at *STRINGP.
@@ -328,18 +321,16 @@ extern char *strsep (char **restrict __stringp, char 
const *restrict __delim)
 # endif
 # if defined GNULIB_POSIXCHECK
 #  undef strsep
-#  define strsep(s,d) \
-     (GL_LINK_WARNING ("strsep cannot work correctly on character strings " \
-                       "in multibyte locales - " \
-                       "use mbssep if you care about internationalization"), \
-      strsep (s, d))
+_GL_WARN_ON_USE (strsep, "strsep cannot work correctly on character strings "
+                 "in multibyte locales - "
+                 "use mbssep if you care about internationalization");
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef strsep
-# define strsep(s,d) \
-    (GL_LINK_WARNING ("strsep is unportable - " \
-                      "use gnulib module strsep for portability"), \
-     strsep (s, d))
+# if HAVE_RAW_DECL_STRSEP
+_GL_WARN_ON_USE (strsep, "strsep is unportable - "
+                 "use gnulib module strsep for portability");
+# endif
 #endif
 
 #if @GNULIB_STRSTR@
@@ -354,13 +345,12 @@ extern char *strstr (const char *haystack, const char 
*needle)
    POSIX says that it operates on "strings", and "string" in POSIX is defined
    as a sequence of bytes, not of characters.  */
 # undef strstr
-# define strstr(a,b) \
-    (GL_LINK_WARNING ("strstr is quadratic on many systems, and cannot " \
-                      "work correctly on character strings in most "    \
-                      "multibyte locales - " \
-                      "use mbsstr if you care about internationalization, " \
-                      "or use strstr if you care about speed"), \
-     strstr (a, b))
+/* Assume strstr is always declared.  */
+_GL_WARN_ON_USE (strstr, "strstr is quadratic on many systems, and cannot "
+                 "work correctly on character strings in most "
+                 "multibyte locales - "
+                 "use mbsstr if you care about internationalization, "
+                 "or use strstr if you care about speed");
 #endif
 
 /* Find the first occurrence of NEEDLE in HAYSTACK, using case-insensitive
@@ -378,13 +368,13 @@ extern char *strcasestr (const char *haystack, const char 
*needle)
    It is a glibc extension, and glibc implements it only for unibyte
    locales.  */
 # undef strcasestr
-# define strcasestr(a,b) \
-    (GL_LINK_WARNING ("strcasestr does work correctly on character strings " \
-                      "in multibyte locales - " \
-                      "use mbscasestr if you care about " \
-                      "internationalization, or use c-strcasestr if you want " 
\
-                      "a locale independent function"), \
-     strcasestr (a, b))
+# if HAVE_RAW_DECL_STRCASESTR
+_GL_WARN_ON_USE (strcasestr, "strcasestr does work correctly on character "
+                 "strings in multibyte locales - "
+                 "use mbscasestr if you care about "
+                 "internationalization, or use c-strcasestr if you want "
+                 "a locale independent function");
+# endif
 #endif
 
 /* Parse S into tokens separated by characters in DELIM.
@@ -413,7 +403,7 @@ extern char *strcasestr (const char *haystack, const char 
*needle)
 # if @REPLACE_STRTOK_R@
 #  undef strtok_r
 #  define strtok_r rpl_strtok_r
-# elif @UNDEFINE_STRTOK_R@
+# elif @UNDEFINE_STRTOK_R@ || defined GNULIB_POSIXCHECK
 #  undef strtok_r
 # endif
 # if ! @HAVE_DECL_STRTOK_R@ || @REPLACE_STRTOK_R@
@@ -422,19 +412,16 @@ extern char *strtok_r (char *restrict s, char const 
*restrict delim,
      _GL_ARG_NONNULL ((2, 3));
 # endif
 # if defined GNULIB_POSIXCHECK
-#  undef strtok_r
-#  define strtok_r(s,d,p) \
-     (GL_LINK_WARNING ("strtok_r cannot work correctly on character strings " \
-                       "in multibyte locales - " \
-                       "use mbstok_r if you care about internationalization"), 
\
-      strtok_r (s, d, p))
+_GL_WARN_ON_USE (strtok_r, "strtok_r cannot work correctly on character "
+                 "strings in multibyte locales - "
+                 "use mbstok_r if you care about internationalization");
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef strtok_r
-# define strtok_r(s,d,p) \
-    (GL_LINK_WARNING ("strtok_r is unportable - " \
-                      "use gnulib module strtok_r for portability"), \
-     strtok_r (s, d, p))
+# if HAVE_RAW_DECL_STRTOK_R
+_GL_WARN_ON_USE (strtok_r, "strtok_r is unportable - "
+                 "use gnulib module strtok_r for portability");
+# endif
 #endif
 
 
@@ -614,10 +601,9 @@ extern char *strerror (int);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef strerror
-# define strerror(e) \
-    (GL_LINK_WARNING ("strerror is unportable - " \
-                      "use gnulib module strerror to guarantee non-NULL 
result"), \
-     strerror (e))
+/* Assume strerror is always declared.  */
+_GL_WARN_ON_USE (strerror, "strerror is unportable - "
+                 "use gnulib module strerror to guarantee non-NULL result");
 #endif
 
 #if @GNULIB_STRSIGNAL@
@@ -629,10 +615,10 @@ extern char *strsignal (int __sig);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef strsignal
-# define strsignal(a) \
-    (GL_LINK_WARNING ("strsignal is unportable - " \
-                      "use gnulib module strsignal for portability"), \
-     strsignal (a))
+# if HAVE_RAW_DECL_STRSIGNAL
+_GL_WARN_ON_USE (strsignal, "strsignal is unportable - "
+                 "use gnulib module strsignal for portability");
+# endif
 #endif
 
 #if @GNULIB_STRVERSCMP@
@@ -641,10 +627,10 @@ extern int strverscmp (const char *, const char *) 
_GL_ARG_NONNULL ((1, 2));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef strverscmp
-# define strverscmp(a, b) \
-    (GL_LINK_WARNING ("strverscmp is unportable - " \
-                      "use gnulib module strverscmp for portability"), \
-     strverscmp (a, b))
+# if HAVE_RAW_DECL_STRVERSCMP
+_GL_WARN_ON_USE (strverscmp, "strverscmp is unportable - "
+                 "use gnulib module strverscmp for portability");
+# endif
 #endif
 
 
diff --git a/gl/unistd.in.h b/gl/unistd.in.h
index 0b2d591..27c8b17 100644
--- a/gl/unistd.in.h
+++ b/gl/unistd.in.h
@@ -114,8 +114,6 @@
 # endif
 #endif
 
-/* The definition of GL_LINK_WARNING is copied here.  */
-
 /* The definition of _GL_ARG_NONNULL is copied here.  */
 
 /* The definition of _GL_WARN_ON_USE is copied here.  */
@@ -164,11 +162,11 @@ extern int chown (const char *file, uid_t uid, gid_t gid)
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef chown
-# define chown(f,u,g) \
-    (GL_LINK_WARNING ("chown fails to follow symlinks on some systems and " \
-                      "doesn't treat a uid or gid of -1 on some systems - " \
-                      "use gnulib module chown for portability"), \
-     chown (f, u, g))
+# if HAVE_RAW_DECL_CHOWN
+_GL_WARN_ON_USE (chown, "chown fails to follow symlinks on some systems and "
+                 "doesn't treat a uid or gid of -1 on some systems - "
+                 "use gnulib module chown for portability");
+# endif
 #endif
 
 
@@ -184,10 +182,9 @@ extern int close (int);
 # define close close_used_without_requesting_gnulib_module_close
 #elif defined GNULIB_POSIXCHECK
 # undef close
-# define close(f) \
-    (GL_LINK_WARNING ("close does not portably work on sockets - " \
-                      "use gnulib module close for portability"), \
-     close (f))
+/* Assume close is always declared.  */
+_GL_WARN_ON_USE (close, "close does not portably work on sockets - "
+                 "use gnulib module close for portability");
 #endif
 
 
@@ -211,10 +208,10 @@ extern int dup2 (int oldfd, int newfd);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef dup2
-# define dup2(o,n) \
-    (GL_LINK_WARNING ("dup2 is unportable - " \
-                      "use gnulib module dup2 for portability"), \
-     dup2 (o, n))
+# if HAVE_RAW_DECL_DUP2
+_GL_WARN_ON_USE (dup2, "dup2 is unportable - "
+                 "use gnulib module dup2 for portability");
+# endif
 #endif
 
 
@@ -233,10 +230,10 @@ extern int dup2 (int oldfd, int newfd);
 extern int dup3 (int oldfd, int newfd, int flags);
 #elif defined GNULIB_POSIXCHECK
 # undef dup3
-# define dup3(o,n,f) \
-    (GL_LINK_WARNING ("dup3 is unportable - " \
-                      "use gnulib module dup3 for portability"), \
-     dup3 (o, n, f))
+# if HAVE_RAW_DECL_DUP3
+_GL_WARN_ON_USE (dup3, "dup3 is unportable - "
+                 "use gnulib module dup3 for portability");
+# endif
 #endif
 
 
@@ -274,10 +271,10 @@ extern int euidaccess (const char *filename, int mode) 
_GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef euidaccess
-# define euidaccess(f,m) \
-    (GL_LINK_WARNING ("euidaccess is unportable - " \
-                      "use gnulib module euidaccess for portability"), \
-     euidaccess (f, m))
+# if HAVE_RAW_DECL_EUIDACCESS
+_GL_WARN_ON_USE (euidaccess, "euidaccess is unportable - "
+                 "use gnulib module euidaccess for portability");
+# endif
 #endif
 
 
@@ -288,10 +285,10 @@ extern int faccessat (int fd, char const *file, int mode, 
int flag)
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef faccessat
-# define faccessat(d,n,m,f)                         \
-    (GL_LINK_WARNING ("faccessat is not portable - " \
-                      "use gnulib module faccessat for portability"), \
-     faccessat (d, n, m, f))
+# if HAVE_RAW_DECL_FACCESSAT
+_GL_WARN_ON_USE (faccessat, "faccessat is not portable - "
+                 "use gnulib module faccessat for portability");
+# endif
 #endif
 
 
@@ -314,10 +311,10 @@ extern const char *_gl_directory_name (int fd);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef fchdir
-# define fchdir(f) \
-    (GL_LINK_WARNING ("fchdir is unportable - " \
-                      "use gnulib module fchdir for portability"), \
-     fchdir (f))
+# if HAVE_RAW_DECL_FCHDIR
+_GL_WARN_ON_USE (fchdir, "fchdir is unportable - "
+                 "use gnulib module fchdir for portability");
+# endif
 #endif
 
 
@@ -332,10 +329,10 @@ extern int fchownat (int fd, char const *file, uid_t 
owner, gid_t group, int fla
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef fchownat
-# define fchownat(d,n,o,g,f)                        \
-    (GL_LINK_WARNING ("fchownat is not portable - " \
-                      "use gnulib module openat for portability"), \
-     fchownat (d, n, o, g, f))
+# if HAVE_RAW_DECL_FCHOWNAT
+_GL_WARN_ON_USE (fchownat, "fchownat is not portable - "
+                 "use gnulib module openat for portability");
+# endif
 #endif
 
 
@@ -349,10 +346,10 @@ extern int fsync (int fd);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef fsync
-# define fsync(fd) \
-    (GL_LINK_WARNING ("fsync is unportable - " \
-                      "use gnulib module fsync for portability"), \
-     fsync (fd))
+# if HAVE_RAW_DECL_FSYNC
+_GL_WARN_ON_USE (fsync, "fsync is unportable - "
+                 "use gnulib module fsync for portability");
+# endif
 #endif
 
 
@@ -366,10 +363,10 @@ extern int ftruncate (int fd, off_t length);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef ftruncate
-# define ftruncate(f,l) \
-    (GL_LINK_WARNING ("ftruncate is unportable - " \
-                      "use gnulib module ftruncate for portability"), \
-     ftruncate (f, l))
+# if HAVE_RAW_DECL_FTRUNCATE
+_GL_WARN_ON_USE (ftruncate, "ftruncate is unportable - "
+                 "use gnulib module ftruncate for portability");
+# endif
 #endif
 
 
@@ -390,10 +387,10 @@ extern char * getcwd (char *buf, size_t size);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef getcwd
-# define getcwd(b,s) \
-    (GL_LINK_WARNING ("getcwd is unportable - " \
-                      "use gnulib module getcwd for portability"), \
-     getcwd (b, s))
+# if HAVE_RAW_DECL_GETCWD
+_GL_WARN_ON_USE (getcwd, "getcwd is unportable - "
+                 "use gnulib module getcwd for portability");
+# endif
 #endif
 
 
@@ -413,10 +410,10 @@ extern int getdomainname(char *name, size_t len) 
_GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef getdomainname
-# define getdomainname(n,l) \
-    (GL_LINK_WARNING ("getdomainname is unportable - " \
-                      "use gnulib module getdomainname for portability"), \
-     getdomainname (n, l))
+# if HAVE_RAW_DECL_GETDOMAINNAME
+_GL_WARN_ON_USE (getdomainname, "getdomainname is unportable - "
+                 "use gnulib module getdomainname for portability");
+# endif
 #endif
 
 
@@ -428,10 +425,10 @@ extern int getdtablesize (void);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef getdtablesize
-# define getdtablesize() \
-    (GL_LINK_WARNING ("getdtablesize is unportable - " \
-                      "use gnulib module getdtablesize for portability"), \
-     getdtablesize ())
+# if HAVE_RAW_DECL_GETDTABLESIZE
+_GL_WARN_ON_USE (getdtablesize, "getdtablesize is unportable - "
+                 "use gnulib module getdtablesize for portability");
+# endif
 #endif
 
 
@@ -450,10 +447,10 @@ int getgroups (int n, gid_t *groups);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef getgroups
-# define getgroups(n,g)                                                 \
-    (GL_LINK_WARNING ("getgroups is unportable - "                      \
-                      "use gnulib module getgroups for portability"),   \
-     getgroups (n, g))
+# if HAVE_RAW_DECL_GETGROUPS
+_GL_WARN_ON_USE (getgroups, "getgroups is unportable - "
+                 "use gnulib module getgroups for portability");
+# endif
 #endif
 
 
@@ -477,10 +474,10 @@ extern int gethostname(char *name, size_t len) 
_GL_ARG_NONNULL ((1));
 # define gethostname 
gethostname_used_without_requesting_gnulib_module_gethostname
 #elif defined GNULIB_POSIXCHECK
 # undef gethostname
-# define gethostname(n,l) \
-    (GL_LINK_WARNING ("gethostname is unportable - " \
-                      "use gnulib module gethostname for portability"), \
-     gethostname (n, l))
+# if HAVE_RAW_DECL_GETHOSTNAME
+_GL_WARN_ON_USE (gethostname, "gethostname is unportable - "
+                 "use gnulib module gethostname for portability");
+# endif
 #endif
 
 
@@ -500,10 +497,10 @@ extern char *getlogin (void);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef getlogin
-# define getlogin() \
-    (GL_LINK_WARNING ("getlogin is unportable - " \
-                      "use gnulib module getlogin for portability"), \
-     getlogin ())
+# if HAVE_RAW_DECL_GETLOGIN
+_GL_WARN_ON_USE (getlogin, "getlogin is unportable - "
+                 "use gnulib module getlogin for portability");
+# endif
 #endif
 
 
@@ -527,10 +524,10 @@ extern int getlogin_r (char *name, size_t size) 
_GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef getlogin_r
-# define getlogin_r(n,s) \
-    (GL_LINK_WARNING ("getlogin_r is unportable - " \
-                      "use gnulib module getlogin_r for portability"), \
-     getlogin_r (n, s))
+# if HAVE_RAW_DECL_GETLOGIN_R
+_GL_WARN_ON_USE (getlogin_r, "getlogin_r is unportable - "
+                 "use gnulib module getlogin_r for portability");
+# endif
 #endif
 
 
@@ -585,10 +582,10 @@ extern int getpagesize (void);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef getpagesize
-# define getpagesize() \
-    (GL_LINK_WARNING ("getpagesize is unportable - " \
-                      "use gnulib module getpagesize for portability"), \
-     getpagesize ())
+# if HAVE_RAW_DECL_GETPAGESIZE
+_GL_WARN_ON_USE (getpagesize, "getpagesize is unportable - "
+                 "use gnulib module getpagesize for portability");
+# endif
 #endif
 
 
@@ -605,20 +602,20 @@ extern void endusershell (void);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef getusershell
-# define getusershell() \
-    (GL_LINK_WARNING ("getusershell is unportable - " \
-                      "use gnulib module getusershell for portability"), \
-     getusershell ())
+# if HAVE_RAW_DECL_GETUSERSHELL
+_GL_WARN_ON_USE (getusershell, "getusershell is unportable - "
+                 "use gnulib module getusershell for portability");
+# endif
 # undef setusershell
-# define setusershell() \
-    (GL_LINK_WARNING ("setusershell is unportable - " \
-                      "use gnulib module getusershell for portability"), \
-     setusershell ())
+# if HAVE_RAW_DECL_SETUSERSHELL
+_GL_WARN_ON_USE (setusershell, "setusershell is unportable - "
+                 "use gnulib module getusershell for portability");
+# endif
 # undef endusershell
-# define endusershell() \
-    (GL_LINK_WARNING ("endusershell is unportable - " \
-                      "use gnulib module getusershell for portability"), \
-     endusershell ())
+# if HAVE_RAW_DECL_ENDUSERSHELL
+_GL_WARN_ON_USE (endusershell, "endusershell is unportable - "
+                 "use gnulib module getusershell for portability");
+# endif
 #endif
 
 
@@ -638,10 +635,10 @@ extern int lchown (char const *file, uid_t owner, gid_t 
group)
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef lchown
-# define lchown(f,u,g) \
-    (GL_LINK_WARNING ("lchown is unportable to pre-POSIX.1-2001 " \
-                      "systems - use gnulib module lchown for portability"), \
-     lchown (f, u, g))
+# if HAVE_RAW_DECL_LCHOWN
+_GL_WARN_ON_USE (lchown, "lchown is unportable to pre-POSIX.1-2001 systems - "
+                 "use gnulib module lchown for portability");
+# endif
 #endif
 
 
@@ -659,10 +656,10 @@ extern int link (const char *path1, const char *path2)
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef link
-# define link(path1,path2) \
-    (GL_LINK_WARNING ("link is unportable - " \
-                      "use gnulib module link for portability"), \
-     link (path1, path2))
+# if HAVE_RAW_DECL_LINK
+_GL_WARN_ON_USE (link, "link is unportable - "
+                 "use gnulib module link for portability");
+# endif
 #endif
 
 #if @GNULIB_LINKAT@
@@ -680,10 +677,10 @@ extern int linkat (int fd1, const char *path1, int fd2, 
const char *path2,
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef linkat
-# define linkat(f1,path1,f2,path2,f)              \
-    (GL_LINK_WARNING ("linkat is unportable - " \
-                      "use gnulib module linkat for portability"), \
-     linkat (f1, path1, f2, path2,f))
+# if HAVE_RAW_DECL_LINKAT
+_GL_WARN_ON_USE (linkat, "linkat is unportable - "
+                 "use gnulib module linkat for portability");
+# endif
 #endif
 
 #if @GNULIB_LSEEK@
@@ -697,10 +694,10 @@ extern int linkat (int fd1, const char *path1, int fd2, 
const char *path2,
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef lseek
-# define lseek(f,o,w) \
-    (GL_LINK_WARNING ("lseek does not fail with ESPIPE on pipes on some " \
-                      "systems - use gnulib module lseek for portability"), \
-     lseek (f, o, w))
+# if HAVE_RAW_DECL_LSEEK
+_GL_WARN_ON_USE (lseek, "lseek does not fail with ESPIPE on pipes on some "
+                 "systems - use gnulib module lseek for portability");
+# endif
 #endif
 
 
@@ -719,10 +716,10 @@ extern int linkat (int fd1, const char *path1, int fd2, 
const char *path2,
 extern int pipe2 (int fd[2], int flags) _GL_ARG_NONNULL ((1));
 #elif defined GNULIB_POSIXCHECK
 # undef pipe2
-# define pipe2(f,o) \
-    (GL_LINK_WARNING ("pipe2 is unportable - " \
-                      "use gnulib module pipe2 for portability"), \
-     pipe2 (f, o))
+# if HAVE_RAW_DECL_PIPE2
+_GL_WARN_ON_USE (pipe2, "pipe2 is unportable - "
+                 "use gnulib module pipe2 for portability");
+# endif
 #endif
 
 
@@ -740,10 +737,10 @@ extern int pipe2 (int fd[2], int flags) _GL_ARG_NONNULL 
((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef pread
-# define pread(f,b,s,o)                        \
-    (GL_LINK_WARNING ("pread is unportable - " \
-                      "use gnulib module pread for portability"), \
-     pread (f, b, s, o))
+# if HAVE_RAW_DECL_PREAD
+_GL_WARN_ON_USE (pread, "pread is unportable - "
+                 "use gnulib module pread for portability");
+# endif
 #endif
 
 
@@ -762,10 +759,10 @@ extern ssize_t readlink (const char *file, char *buf, 
size_t bufsize)
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef readlink
-# define readlink(f,b,s) \
-    (GL_LINK_WARNING ("readlink is unportable - " \
-                      "use gnulib module readlink for portability"), \
-     readlink (f, b, s))
+# if HAVE_RAW_DECL_READLINK
+_GL_WARN_ON_USE (readlink, "readlink is unportable - "
+                 "use gnulib module readlink for portability");
+# endif
 #endif
 
 
@@ -776,10 +773,10 @@ extern ssize_t readlinkat (int fd, char const *file, char 
*buf, size_t len)
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef readlinkat
-# define readlinkat(d,n,b,l)                         \
-    (GL_LINK_WARNING ("readlinkat is not portable - " \
-                      "use gnulib module symlinkat for portability"), \
-     readlinkat (d, n, b, l))
+# if HAVE_RAW_DECL_READLINKAT
+_GL_WARN_ON_USE (readlinkat, "readlinkat is not portable - "
+                 "use gnulib module symlinkat for portability");
+# endif
 #endif
 
 
@@ -791,10 +788,10 @@ extern int rmdir (char const *name) _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef rmdir
-# define rmdir(n) \
-    (GL_LINK_WARNING ("rmdir is unportable - " \
-                      "use gnulib module rmdir for portability"), \
-     rmdir (n))
+# if HAVE_RAW_DECL_RMDIR
+_GL_WARN_ON_USE (rmdir, "rmdir is unportable - "
+                 "use gnulib module rmdir for portability");
+# endif
 #endif
 
 
@@ -812,10 +809,10 @@ extern unsigned int sleep (unsigned int n);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef sleep
-# define sleep(n) \
-    (GL_LINK_WARNING ("sleep is unportable - " \
-                      "use gnulib module sleep for portability"), \
-     sleep (n))
+# if HAVE_RAW_DECL_SLEEP
+_GL_WARN_ON_USE (sleep, "sleep is unportable - "
+                 "use gnulib module sleep for portability");
+# endif
 #endif
 
 
@@ -830,10 +827,10 @@ extern int symlink (char const *contents, char const 
*file)
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef symlink
-# define symlink(c,n)                        \
-    (GL_LINK_WARNING ("symlink is not portable - " \
-                      "use gnulib module symlink for portability"), \
-     symlink (c, n))
+# if HAVE_RAW_DECL_SYMLINK
+_GL_WARN_ON_USE (symlink, "symlink is not portable - "
+                 "use gnulib module symlink for portability");
+# endif
 #endif
 
 
@@ -844,10 +841,10 @@ extern int symlinkat (char const *contents, int fd, char 
const *file)
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef symlinkat
-# define symlinkat(c,d,n)                            \
-    (GL_LINK_WARNING ("symlinkat is not portable - " \
-                      "use gnulib module symlinkat for portability"), \
-     symlinkat (c, d, n))
+# if HAVE_RAW_DECL_SYMLINKAT
+_GL_WARN_ON_USE (symlinkat, "symlinkat is not portable - "
+                 "use gnulib module symlinkat for portability");
+# endif
 #endif
 
 
@@ -859,10 +856,10 @@ extern int unlink (char const *file) _GL_ARG_NONNULL 
((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef unlink
-# define unlink(n)                         \
-    (GL_LINK_WARNING ("unlink is not portable - " \
-                      "use gnulib module unlink for portability"), \
-     unlink (n))
+# if HAVE_RAW_DECL_UNLINK
+_GL_WARN_ON_USE (unlink, "unlink is not portable - "
+                 "use gnulib module unlink for portability");
+# endif
 #endif
 
 
@@ -876,10 +873,10 @@ extern int unlinkat (int fd, char const *file, int flag) 
_GL_ARG_NONNULL ((2));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef unlinkat
-# define unlinkat(d,n,f)                         \
-    (GL_LINK_WARNING ("unlinkat is not portable - " \
-                      "use gnulib module openat for portability"), \
-     unlinkat (d, n, f))
+# if HAVE_RAW_DECL_UNLINKAT
+_GL_WARN_ON_USE (unlinkat, "unlinkat is not portable - "
+                 "use gnulib module openat for portability");
+# endif
 #endif
 
 
@@ -897,10 +894,10 @@ extern int usleep (useconds_t n);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef usleep
-# define usleep(n) \
-    (GL_LINK_WARNING ("usleep is unportable - " \
-                      "use gnulib module usleep for portability"), \
-     usleep (n))
+# if HAVE_RAW_DECL_USLEEP
+_GL_WARN_ON_USE (usleep, "usleep is unportable - "
+                 "use gnulib module usleep for portability");
+# endif
 #endif
 
 
diff --git a/gltests/Makefile.am b/gltests/Makefile.am
index c1b84ab..f4a3b41 100644
--- a/gltests/Makefile.am
+++ b/gltests/Makefile.am
@@ -43,6 +43,8 @@ libtests_a_DEPENDENCIES = $(gltests_LIBOBJS)
 EXTRA_libtests_a_SOURCES =
 AM_LIBTOOLFLAGS = --preserve-dup-deps
 
+TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' srcdir='$(srcdir)'
+
 ## begin gnulib module alloca-opt
 
 BUILT_SOURCES += $(ALLOCA_H)
@@ -103,7 +105,6 @@ libtests_a_SOURCES += binary-io.h
 ## begin gnulib module binary-io-tests
 
 TESTS += test-binary-io.sh
-TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@'
 check_PROGRAMS += test-binary-io
 
 EXTRA_DIST += test-binary-io.sh test-binary-io.c macros.h
@@ -151,7 +152,7 @@ BUILT_SOURCES += fcntl.h
 
 # We need the following in order to create <fcntl.h> when the system
 # doesn't have one that works with the given compiler.
-fcntl.h: fcntl.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
+fcntl.h: fcntl.in.h $(WARN_ON_USE_H) $(ARG_NONNULL_H)
        $(AM_V_GEN)rm -f address@hidden $@ && \
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
          sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
@@ -165,8 +166,8 @@ fcntl.h: fcntl.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
              -e 's|@''REPLACE_FCNTL''@|$(REPLACE_FCNTL)|g' \
              -e 's|@''REPLACE_OPEN''@|$(REPLACE_OPEN)|g' \
              -e 's|@''REPLACE_OPENAT''@|$(REPLACE_OPENAT)|g' \
-             -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
              -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
+             -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
              < $(srcdir)/fcntl.in.h; \
        } > address@hidden && \
        mv address@hidden $@
@@ -193,29 +194,11 @@ EXTRA_DIST += macros.h signature.h test-getopt.c 
test-getopt.h test-getopt_long.
 
 ## end   gnulib module getopt-posix-tests
 
-## begin gnulib module link-warning
-
-# The BUILT_SOURCES created by this Makefile snippet are not used via #include
-# statements but through direct file reference. Therefore this snippet must be
-# present in all Makefile.am that need it. This is ensured by the applicability
-# 'all' defined above.
-
-BUILT_SOURCES += link-warning.h
-# The link-warning.h that gets inserted into generated .h files is the same as
-# build-aux/link-warning.h, except that it has the copyright header cut off.
-link-warning.h: $(top_srcdir)/build-aux/link-warning.h
-       $(AM_V_GEN)rm -f address@hidden $@ && \
-       sed -n -e '/GL_LINK_WARNING/,$$p' \
-         < $(top_srcdir)/build-aux/link-warning.h \
-         > address@hidden && \
-       mv address@hidden $@
-MOSTLYCLEANFILES += link-warning.h link-warning.h-t
-
-LINK_WARNING_H=link-warning.h
+## begin gnulib module ignore-value
 
-EXTRA_DIST += $(top_srcdir)/build-aux/link-warning.h
+libtests_a_SOURCES += ignore-value.h
 
-## end   gnulib module link-warning
+## end   gnulib module ignore-value
 
 ## begin gnulib module lstat
 
@@ -424,7 +407,7 @@ BUILT_SOURCES += stdlib.h
 
 # We need the following in order to create <stdlib.h> when the system
 # doesn't have one that works with the given compiler.
-stdlib.h: stdlib.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
+stdlib.h: stdlib.in.h $(WARN_ON_USE_H) $(ARG_NONNULL_H)
        $(AM_V_GEN)rm -f address@hidden $@ && \
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
          sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
@@ -480,8 +463,8 @@ stdlib.h: stdlib.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
              -e 's|@''REPLACE_SETENV''@|$(REPLACE_SETENV)|g' \
              -e 's|@''REPLACE_STRTOD''@|$(REPLACE_STRTOD)|g' \
              -e 's|@''REPLACE_UNSETENV''@|$(REPLACE_UNSETENV)|g' \
-             -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
              -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
+             -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
              < $(srcdir)/stdlib.in.h; \
        } > address@hidden && \
        mv address@hidden $@
@@ -538,7 +521,7 @@ BUILT_SOURCES += sys/stat.h
 
 # We need the following in order to create <sys/stat.h> when the system
 # has one that is incomplete.
-sys/stat.h: sys_stat.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
+sys/stat.h: sys_stat.in.h $(WARN_ON_USE_H) $(ARG_NONNULL_H)
        $(AM_V_at)$(MKDIR_P) sys
        $(AM_V_GEN)rm -f address@hidden $@ && \
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
@@ -577,8 +560,8 @@ sys/stat.h: sys_stat.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
              -e 's|@''REPLACE_MKNOD''@|$(REPLACE_MKNOD)|g' \
              -e 's|@''REPLACE_STAT''@|$(REPLACE_STAT)|g' \
              -e 's|@''REPLACE_UTIMENSAT''@|$(REPLACE_UTIMENSAT)|g' \
-             -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
              -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
+             -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
              < $(srcdir)/sys_stat.in.h; \
        } > address@hidden && \
        mv address@hidden $@
@@ -691,7 +674,6 @@ libtests_a_SOURCES += version-etc-fsf.c
 ## begin gnulib module version-etc-tests
 
 TESTS += test-version-etc.sh
-TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@'
 check_PROGRAMS += test-version-etc
 test_version_etc_LDADD = $(LDADD) @LIBINTL@
 EXTRA_DIST += test-version-etc.c test-version-etc.sh
@@ -723,7 +705,7 @@ BUILT_SOURCES += wchar.h
 
 # We need the following in order to create <wchar.h> when the system
 # version does not work standalone.
-wchar.h: wchar.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
+wchar.h: wchar.in.h $(WARN_ON_USE_H) $(ARG_NONNULL_H)
        $(AM_V_GEN)rm -f address@hidden $@ && \
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
          sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
@@ -765,8 +747,8 @@ wchar.h: wchar.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
              -e 's|@''REPLACE_WCSRTOMBS''@|$(REPLACE_WCSRTOMBS)|g' \
              -e 's|@''REPLACE_WCSNRTOMBS''@|$(REPLACE_WCSNRTOMBS)|g' \
              -e 's|@''REPLACE_WCWIDTH''@|$(REPLACE_WCWIDTH)|g' \
-             -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
              -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
+             -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
            < $(srcdir)/wchar.in.h; \
        } > address@hidden && \
        mv address@hidden $@
diff --git a/gltests/fcntl.in.h b/gltests/fcntl.in.h
index 92bb50d..a1d9e23 100644
--- a/gltests/fcntl.in.h
+++ b/gltests/fcntl.in.h
@@ -27,7 +27,6 @@
 #include <sys/types.h>
 #ifndef __GLIBC__ /* Avoid namespace pollution on glibc systems.  */
 # include <sys/stat.h>
-# include <unistd.h>
 #endif
 address@hidden@ @NEXT_FCNTL_H@
 
@@ -39,7 +38,6 @@
 #include <sys/types.h>
 #ifndef __GLIBC__ /* Avoid namespace pollution on glibc systems.  */
 # include <sys/stat.h>
-# include <unistd.h>
 #endif
 /* The include_next requires a split double-inclusion guard.  */
 address@hidden@ @NEXT_FCNTL_H@
@@ -47,11 +45,15 @@
 #ifndef _GL_FCNTL_H
 #define _GL_FCNTL_H
 
+#ifndef __GLIBC__ /* Avoid namespace pollution on glibc systems.  */
+# include <unistd.h>
+#endif
 
-/* The definition of GL_LINK_WARNING is copied here.  */
 
 /* The definition of _GL_ARG_NONNULL is copied here.  */
 
+/* The definition of _GL_WARN_ON_USE is copied here.  */
+
 
 /* Declare overridden functions.  */
 
@@ -69,10 +71,10 @@ extern int fcntl (int fd, int action, ...);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef fcntl
-# define fcntl \
-    (GL_LINK_WARNING ("fcntl is not always POSIX compliant - " \
-                      "use gnulib module fcntl for portability"), \
-     fcntl)
+# if HAVE_RAW_DECL_FCNTL
+_GL_WARN_ON_USE (fcntl, "fcntl is not always POSIX compliant - "
+                 "use gnulib module fcntl for portability");
+# endif
 #endif
 
 #if @GNULIB_OPEN@
@@ -83,10 +85,9 @@ extern int open (const char *filename, int flags, ...) 
_GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef open
-# define open \
-    (GL_LINK_WARNING ("open is not always POSIX compliant - " \
-                      "use gnulib module open for portability"), \
-     open)
+/* Assume open is always declared.  */
+_GL_WARN_ON_USE (open, "open is not always POSIX compliant - "
+                 "use gnulib module open for portability");
 #endif
 
 #if @GNULIB_OPENAT@
@@ -100,10 +101,10 @@ extern int openat (int fd, char const *file, int flags, 
/* mode_t mode */ ...)
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef openat
-# define openat \
-    (GL_LINK_WARNING ("openat is not portable - " \
-                      "use gnulib module openat for portability"), \
-     openat)
+# if HAVE_RAW_DECL_OPENAT
+_GL_WARN_ON_USE (openat, "openat is not portable - "
+                 "use gnulib module openat for portability");
+# endif
 #endif
 
 #ifdef __cplusplus
diff --git a/gltests/ignore-value.h b/gltests/ignore-value.h
new file mode 100644
index 0000000..2eb6918
--- /dev/null
+++ b/gltests/ignore-value.h
@@ -0,0 +1,37 @@
+/* ignore a function return without a compiler warning
+
+   Copyright (C) 2008-2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Jim Meyering.  */
+
+/* Use these functions to avoid a warning when using a function declared with
+   gcc's warn_unused_result attribute, but for which you really do want to
+   ignore the result.  Traditionally, people have used a "(void)" cast to
+   indicate that a function's return value is deliberately unused.  However,
+   if the function is declared with __attribute__((warn_unused_result)),
+   gcc issues a warning even with the cast.
+
+   Caution: most of the time, you really should heed gcc's warning, and
+   check the return value.  However, in those exceptional cases in which
+   you're sure you know what you're doing, use this function.
+
+   For the record, here's one of the ignorable warnings:
+   "copy.c:233: warning: ignoring return value of 'fchown',
+   declared with attribute warn_unused_result".  */
+
+static inline void ignore_value (int i) { (void) i; }
+static inline void ignore_ptr (void* p) { (void) p; }
+/* FIXME: what about aggregate types? */
diff --git a/gltests/stdlib.in.h b/gltests/stdlib.in.h
index 5f546ff..7f86496 100644
--- a/gltests/stdlib.in.h
+++ b/gltests/stdlib.in.h
@@ -74,10 +74,10 @@ struct random_data
 # include <unistd.h>
 #endif
 
-/* The definition of GL_LINK_WARNING is copied here.  */
-
 /* The definition of _GL_ARG_NONNULL is copied here.  */
 
+/* The definition of _GL_WARN_ON_USE is copied here.  */
+
 
 /* Some systems do not define EXIT_*, despite otherwise supporting C89.  */
 #ifndef EXIT_SUCCESS
@@ -105,10 +105,10 @@ extern long long atoll (const char *string) 
_GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef atoll
-# define atoll(s) \
-    (GL_LINK_WARNING ("atoll is unportable - " \
-                      "use gnulib module atoll for portability"), \
-     atoll (s))
+# if HAVE_RAW_DECL_ATOLL
+_GL_WARN_ON_USE (atoll, "atoll is unportable - "
+                 "use gnulib module atoll for portability");
+# endif
 #endif
 
 #if @GNULIB_CALLOC_POSIX@
@@ -119,10 +119,9 @@ extern void * calloc (size_t nmemb, size_t size);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef calloc
-# define calloc(n,s) \
-    (GL_LINK_WARNING ("calloc is not POSIX compliant everywhere - " \
-                      "use gnulib module calloc-posix for portability"), \
-     calloc (n, s))
+/* Assume calloc is always declared.  */
+_GL_WARN_ON_USE (calloc, "calloc is not POSIX compliant everywhere - "
+                 "use gnulib module calloc-posix for portability");
 #endif
 
 #if @GNULIB_CANONICALIZE_FILE_NAME@
@@ -134,10 +133,10 @@ extern char *canonicalize_file_name (const char *name) 
_GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef canonicalize_file_name
-# define canonicalize_file_name(n)                        \
-    (GL_LINK_WARNING ("canonicalize_file_name is unportable - " \
-                      "use gnulib module canonicalize-lgpl for portability"), \
-     canonicalize_file_name (n))
+# if HAVE_RAW_DECL_CANONICALIZE_FILE_NAME
+_GL_WARN_ON_USE (canonicalize_file_name, "canonicalize_file_name is unportable 
- "
+                 "use gnulib module canonicalize-lgpl for portability");
+# endif
 #endif
 
 #if @GNULIB_GETLOADAVG@
@@ -150,10 +149,10 @@ extern int getloadavg (double loadavg[], int nelem) 
_GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef getloadavg
-# define getloadavg(l,n) \
-    (GL_LINK_WARNING ("getloadavg is not portable - " \
-                      "use gnulib module getloadavg for portability"), \
-     getloadavg (l, n))
+# if HAVE_RAW_DECL_GETLOADAVG
+_GL_WARN_ON_USE (getloadavg, "getloadavg is not portable - "
+                 "use gnulib module getloadavg for portability");
+# endif
 #endif
 
 #if @GNULIB_GETSUBOPT@
@@ -174,10 +173,10 @@ extern int getsubopt (char **optionp, char *const 
*tokens, char **valuep)
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef getsubopt
-# define getsubopt(o,t,v) \
-    (GL_LINK_WARNING ("getsubopt is unportable - " \
-                      "use gnulib module getsubopt for portability"), \
-     getsubopt (o, t, v))
+# if HAVE_RAW_DECL_GETSUBOPT
+_GL_WARN_ON_USE (getsubopt, "getsubopt is unportable - "
+                 "use gnulib module getsubopt for portability");
+# endif
 #endif
 
 #if @GNULIB_MALLOC_POSIX@
@@ -188,10 +187,9 @@ extern void * malloc (size_t size);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef malloc
-# define malloc(s) \
-    (GL_LINK_WARNING ("malloc is not POSIX compliant everywhere - " \
-                      "use gnulib module malloc-posix for portability"), \
-     malloc (s))
+/* Assume malloc is always declared.  */
+_GL_WARN_ON_USE (malloc, "malloc is not POSIX compliant everywhere - "
+                 "use gnulib module malloc-posix for portability");
 #endif
 
 #if @GNULIB_MKDTEMP@
@@ -205,10 +203,10 @@ extern char * mkdtemp (char * /*template*/) 
_GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef mkdtemp
-# define mkdtemp(t) \
-    (GL_LINK_WARNING ("mkdtemp is unportable - " \
-                      "use gnulib module mkdtemp for portability"), \
-     mkdtemp (t))
+# if HAVE_RAW_DECL_MKDTEMP
+_GL_WARN_ON_USE (mkdtemp, "mkdtemp is unportable - "
+                 "use gnulib module mkdtemp for portability");
+# endif
 #endif
 
 #if @GNULIB_MKOSTEMP@
@@ -229,10 +227,10 @@ extern int mkostemp (char * /*template*/, int /*flags*/) 
_GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef mkostemp
-# define mkostemp(t,f) \
-    (GL_LINK_WARNING ("mkostemp is unportable - " \
-                      "use gnulib module mkostemp for portability"), \
-     mkostemp (t, f))
+# if HAVE_RAW_DECL_MKOSTEMP
+_GL_WARN_ON_USE (mkostemp, "mkostemp is unportable - "
+                 "use gnulib module mkostemp for portability");
+# endif
 #endif
 
 #if @GNULIB_MKOSTEMPS@
@@ -255,10 +253,10 @@ extern int mkostemps (char * /*template*/, int 
/*suffixlen*/, int /*flags*/)
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef mkostemps
-# define mkostemps(t,s,f)                          \
-    (GL_LINK_WARNING ("mkostemps is unportable - " \
-                      "use gnulib module mkostemps for portability"), \
-     mkostemps (t, s, f))
+# if HAVE_RAW_DECL_MKOSTEMPS
+_GL_WARN_ON_USE (mkostemps, "mkostemps is unportable - "
+                 "use gnulib module mkostemps for portability");
+# endif
 #endif
 
 #if @GNULIB_MKSTEMP@
@@ -277,10 +275,10 @@ extern int mkstemp (char * /*template*/) _GL_ARG_NONNULL 
((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef mkstemp
-# define mkstemp(t) \
-    (GL_LINK_WARNING ("mkstemp is unportable - " \
-                      "use gnulib module mkstemp for portability"), \
-     mkstemp (t))
+# if HAVE_RAW_DECL_MKSTEMP
+_GL_WARN_ON_USE (mkstemp, "mkstemp is unportable - "
+                 "use gnulib module mkstemp for portability");
+# endif
 #endif
 
 #if @GNULIB_MKSTEMPS@
@@ -300,10 +298,10 @@ extern int mkstemps (char * /*template*/, int 
/*suffixlen*/)
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef mkstemps
-# define mkstemps(t,s)                             \
-    (GL_LINK_WARNING ("mkstemps is unportable - " \
-                      "use gnulib module mkstemps for portability"), \
-     mkstemps (t, s))
+# if HAVE_RAW_DECL_MKSTEMPS
+_GL_WARN_ON_USE (mkstemps, "mkstemps is unportable - "
+                 "use gnulib module mkstemps for portability");
+# endif
 #endif
 
 #if @GNULIB_PUTENV@
@@ -333,25 +331,25 @@ int random_r (struct random_data *buf, int32_t *result)
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef random_r
-# define random_r(b,r)                            \
-    (GL_LINK_WARNING ("random_r is unportable - " \
-                      "use gnulib module random_r for portability"), \
-     random_r (b,r))
+# if HAVE_RAW_DECL_RANDOM_R
+_GL_WARN_ON_USE (random_r, "random_r is unportable - "
+                 "use gnulib module random_r for portability");
+# endif
 # undef initstate_r
-# define initstate_r(s,b,sz,r)                       \
-    (GL_LINK_WARNING ("initstate_r is unportable - " \
-                      "use gnulib module random_r for portability"), \
-     initstate_r (s,b,sz,r))
+# if HAVE_RAW_DECL_INITSTATE_R
+_GL_WARN_ON_USE (initstate_r, "initstate_r is unportable - "
+                 "use gnulib module random_r for portability");
+# endif
 # undef srandom_r
-# define srandom_r(s,r)                            \
-    (GL_LINK_WARNING ("srandom_r is unportable - " \
-                      "use gnulib module random_r for portability"), \
-     srandom_r (s,r))
+# if HAVE_RAW_DECL_SRANDOM_R
+_GL_WARN_ON_USE (srandom_r, "srandom_r is unportable - "
+                 "use gnulib module random_r for portability");
+# endif
 # undef setstate_r
-# define setstate_r(a,r)                                    \
-    (GL_LINK_WARNING ("setstate_r is unportable - " \
-                      "use gnulib module random_r for portability"), \
-     setstate_r (a,r))
+# if HAVE_RAW_DECL_SETSTATE_R
+_GL_WARN_ON_USE (setstate_r, "setstate_r is unportable - "
+                 "use gnulib module random_r for portability");
+# endif
 #endif
 
 #if @GNULIB_REALLOC_POSIX@
@@ -362,10 +360,9 @@ extern void * realloc (void *ptr, size_t size);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef realloc
-# define realloc(p,s) \
-    (GL_LINK_WARNING ("realloc is not POSIX compliant everywhere - " \
-                      "use gnulib module realloc-posix for portability"), \
-     realloc (p, s))
+/* Assume realloc is always declared.  */
+_GL_WARN_ON_USE (realloc, "realloc is not POSIX compliant everywhere - "
+                 "use gnulib module realloc-posix for portability");
 #endif
 
 #if @GNULIB_REALPATH@
@@ -377,10 +374,10 @@ extern char *realpath (const char *name, char *resolved) 
_GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef realpath
-# define realpath(n,r)                        \
-    (GL_LINK_WARNING ("realpath is unportable - use gnulib module " \
-                      "canonicalize or canonicalize-lgpl for portability"), \
-     realpath (n, r))
+# if HAVE_RAW_DECL_REALPATH
+_GL_WARN_ON_USE (realpath, "realpath is unportable - use gnulib module "
+                 "canonicalize or canonicalize-lgpl for portability");
+# endif
 #endif
 
 #if @GNULIB_RPMATCH@
@@ -391,10 +388,10 @@ extern int rpmatch (const char *response) _GL_ARG_NONNULL 
((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef rpmatch
-# define rpmatch(r) \
-    (GL_LINK_WARNING ("rpmatch is unportable - " \
-                      "use gnulib module rpmatch for portability"), \
-     rpmatch (r))
+# if HAVE_RAW_DECL_RPMATCH
+_GL_WARN_ON_USE (rpmatch, "rpmatch is unportable - "
+                 "use gnulib module rpmatch for portability");
+# endif
 #endif
 
 #if @GNULIB_SETENV@
@@ -410,10 +407,10 @@ extern int setenv (const char *name, const char *value, 
int replace)
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef setenv
-# define setenv(n,v,o)                                                  \
-    (GL_LINK_WARNING ("setenv is unportable - "                         \
-                      "use gnulib module setenv for portability"),      \
-     setenv (n, v, o))
+# if HAVE_RAW_DECL_SETENV
+_GL_WARN_ON_USE (setenv, "setenv is unportable - "
+                 "use gnulib module setenv for portability");
+# endif
 #endif
 
 #if @GNULIB_STRTOD@
@@ -426,10 +423,10 @@ extern double strtod (const char *str, char **endp) 
_GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef strtod
-# define strtod(s, e)                           \
-    (GL_LINK_WARNING ("strtod is unportable - " \
-                      "use gnulib module strtod for portability"), \
-     strtod (s, e))
+# if HAVE_RAW_DECL_STRTOD
+_GL_WARN_ON_USE (strtod, "strtod is unportable - "
+                 "use gnulib module strtod for portability");
+# endif
 #endif
 
 #if @GNULIB_STRTOLL@
@@ -447,10 +444,10 @@ extern long long strtoll (const char *string, char 
**endptr, int base)
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef strtoll
-# define strtoll(s,e,b) \
-    (GL_LINK_WARNING ("strtoll is unportable - " \
-                      "use gnulib module strtoll for portability"), \
-     strtoll (s, e, b))
+# if HAVE_RAW_DECL_STRTOLL
+_GL_WARN_ON_USE (strtoll, "strtoll is unportable - "
+                 "use gnulib module strtoll for portability");
+# endif
 #endif
 
 #if @GNULIB_STRTOULL@
@@ -468,10 +465,10 @@ extern unsigned long long strtoull (const char *string, 
char **endptr, int base)
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef strtoull
-# define strtoull(s,e,b) \
-    (GL_LINK_WARNING ("strtoull is unportable - " \
-                      "use gnulib module strtoull for portability"), \
-     strtoull (s, e, b))
+# if HAVE_RAW_DECL_STRTOULL
+_GL_WARN_ON_USE (strtoull, "strtoull is unportable - "
+                 "use gnulib module strtoull for portability");
+# endif
 #endif
 
 #if @GNULIB_UNSETENV@
@@ -485,10 +482,10 @@ extern int unsetenv (const char *name) _GL_ARG_NONNULL 
((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef unsetenv
-# define unsetenv(n)                                                    \
-    (GL_LINK_WARNING ("unsetenv is unportable - "                       \
-                      "use gnulib module unsetenv for portability"),    \
-     unsetenv (n))
+# if HAVE_RAW_DECL_UNSETENV
+_GL_WARN_ON_USE (unsetenv, "unsetenv is unportable - "
+                 "use gnulib module unsetenv for portability");
+# endif
 #endif
 
 #ifdef __cplusplus
diff --git a/gltests/sys_stat.in.h b/gltests/sys_stat.in.h
index 3bd4822..8edf420 100644
--- a/gltests/sys_stat.in.h
+++ b/gltests/sys_stat.in.h
@@ -47,10 +47,10 @@
 #ifndef _GL_SYS_STAT_H
 #define _GL_SYS_STAT_H
 
-/* The definition of GL_LINK_WARNING is copied here.  */
-
 /* The definition of _GL_ARG_NONNULL is copied here.  */
 
+/* The definition of _GL_WARN_ON_USE is copied here.  */
+
 /* Before doing "#define mkdir rpl_mkdir" below, we need to include all
    headers that may declare mkdir().  */
 #if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
@@ -302,10 +302,10 @@ extern int fchmodat (int fd, char const *file, mode_t 
mode, int flag)
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef fchmodat
-# define fchmodat(d,n,m,f)                         \
-    (GL_LINK_WARNING ("fchmodat is not portable - " \
-                      "use gnulib module openat for portability"), \
-     fchmodat (d, n, m, f))
+# if HAVE_RAW_DECL_FCHMODAT
+_GL_WARN_ON_USE (fchmodat, "fchmodat is not portable - "
+                 "use gnulib module openat for portability");
+# endif
 #endif
 
 
@@ -326,10 +326,10 @@ extern int fstatat (int fd, char const *name, struct stat 
*st, int flags)
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef fstatat
-# define fstatat(d,n,s,f)                         \
-    (GL_LINK_WARNING ("fstatat is not portable - " \
-                      "use gnulib module openat for portability"), \
-     fstatat (d, n, s, f))
+# if HAVE_RAW_DECL_FSTATAT
+_GL_WARN_ON_USE (fstatat, "fstatat is not portable - "
+                 "use gnulib module openat for portability");
+# endif
 #endif
 
 
@@ -343,10 +343,10 @@ extern int futimens (int fd, struct timespec const 
times[2]);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef futimens
-# define futimens(f,t)                         \
-    (GL_LINK_WARNING ("futimens is not portable - " \
-                      "use gnulib module futimens for portability"), \
-     futimens (f, t))
+# if HAVE_RAW_DECL_FUTIMENS
+_GL_WARN_ON_USE (futimens, "futimens is not portable - "
+                 "use gnulib module futimens for portability");
+# endif
 #endif
 
 
@@ -368,10 +368,10 @@ extern int lchmod (const char *filename, mode_t mode) 
_GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef lchmod
-# define lchmod(f,m) \
-    (GL_LINK_WARNING ("lchmod is unportable - " \
-                      "use gnulib module lchmod for portability"), \
-     lchmod (f, m))
+# if HAVE_RAW_DECL_LCHMOD
+_GL_WARN_ON_USE (lchmod, "lchmod is unportable - "
+                 "use gnulib module lchmod for portability");
+# endif
 #endif
 
 
@@ -388,10 +388,10 @@ extern int rpl_lstat (const char *name, struct stat *buf)
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef lstat
-# define lstat(p,b)                                                     \
-  (GL_LINK_WARNING ("lstat is unportable - "                            \
-                    "use gnulib module lstat for portability"),         \
-   lstat (p, b))
+# if HAVE_RAW_DECL_LSTAT
+_GL_WARN_ON_USE (lstat, "lstat is unportable - "
+                 "use gnulib module lstat for portability");
+# endif
 #endif
 
 
@@ -423,10 +423,10 @@ extern int mkdirat (int fd, char const *file, mode_t mode)
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef mkdirat
-# define mkdirat(d,n,m)                         \
-    (GL_LINK_WARNING ("mkdirat is not portable - " \
-                      "use gnulib module openat for portability"), \
-     mkdirat (d, n, m))
+# if HAVE_RAW_DECL_MKDIRAT
+_GL_WARN_ON_USE (mkdirat, "mkdirat is not portable - "
+                 "use gnulib module openat for portability");
+# endif
 #endif
 
 
@@ -440,10 +440,10 @@ extern int mkfifo (char const *file, mode_t mode) 
_GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef mkfifo
-# define mkfifo(n,m)                                                    \
-    (GL_LINK_WARNING ("mkfifo is not portable - "                       \
-                      "use gnulib module mkfifo for portability"),      \
-     mkfifo (n, m))
+# if HAVE_RAW_DECL_MKFIFO
+_GL_WARN_ON_USE (mkfifo, "mkfifo is not portable - "
+                 "use gnulib module mkfifo for portability");
+# endif
 #endif
 
 
@@ -454,10 +454,10 @@ extern int mkfifoat (int fd, char const *file, mode_t 
mode)
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef mkfifoat
-# define mkfifoat(d,n,m)                                     \
-    (GL_LINK_WARNING ("mkfifoat is not portable - " \
-                      "use gnulib module mkfifoat for portability"), \
-     mkfifoat (d, n, m))
+# if HAVE_RAW_DECL_MKFIFOAT
+_GL_WARN_ON_USE (mkfifoat, "mkfifoat is not portable - "
+                 "use gnulib module mkfifoat for portability");
+# endif
 #endif
 
 
@@ -472,10 +472,10 @@ extern int mknod (char const *file, mode_t mode, dev_t 
dev)
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef mknod
-# define mknod(n,m,d)                                                   \
-    (GL_LINK_WARNING ("mknod is not portable - "                        \
-                      "use gnulib module mknod for portability"),       \
-     mknod (n, m, d))
+# if HAVE_RAW_DECL_MKNOD
+_GL_WARN_ON_USE (mknod, "mknod is not portable - "
+                 "use gnulib module mknod for portability");
+# endif
 #endif
 
 
@@ -486,10 +486,10 @@ extern int mknodat (int fd, char const *file, mode_t 
mode, dev_t dev)
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef mknodat
-# define mknodat(f,n,m,d)                            \
-    (GL_LINK_WARNING ("mknodat is not portable - " \
-                      "use gnulib module mkfifoat for portability"), \
-     mknodat (f, n, m, d))
+# if HAVE_RAW_DECL_MKNODAT
+_GL_WARN_ON_USE (mknodat, "mknodat is not portable - "
+                 "use gnulib module mkfifoat for portability");
+# endif
 #endif
 
 
@@ -512,10 +512,10 @@ extern int stat (const char *name, struct stat *buf) 
_GL_ARG_NONNULL ((1, 2));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef stat
-# define stat(p,b)                                                      \
-  (GL_LINK_WARNING ("stat is unportable - "                             \
-                    "use gnulib module stat for portability"),          \
-   stat (p, b))
+# if HAVE_RAW_DECL_STAT
+_GL_WARN_ON_USE (stat, "stat is unportable - "
+                 "use gnulib module stat for portability");
+# endif
 #endif
 
 
@@ -531,10 +531,10 @@ extern int stat (const char *name, struct stat *buf) 
_GL_ARG_NONNULL ((1, 2));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef utimensat
-# define utimensat(d,n,t,f)                          \
-    (GL_LINK_WARNING ("utimensat is not portable - " \
-                      "use gnulib module utimensat for portability"), \
-     utimensat (d, n, t, f))
+# if HAVE_RAW_DECL_UTIMENSAT
+_GL_WARN_ON_USE (utimensat, "utimensat is not portable - "
+                 "use gnulib module utimensat for portability");
+# endif
 #endif
 
 
diff --git a/gltests/test-lstat.c b/gltests/test-lstat.c
index 23ffec4..b8f9237 100644
--- a/gltests/test-lstat.c
+++ b/gltests/test-lstat.c
@@ -35,6 +35,7 @@ SIGNATURE_CHECK (lstat, int, (char const *, struct stat *));
 #include <unistd.h>
 
 #include "same-inode.h"
+#include "ignore-value.h"
 #include "macros.h"
 
 #define BASE "test-lstat.t"
@@ -53,7 +54,7 @@ int
 main (void)
 {
   /* Remove any leftovers from a previous partial run.  */
-  system ("rm -rf " BASE "*");
+  ignore_value (system ("rm -rf " BASE "*"));
 
   return test_lstat_func (do_lstat, true);
 }
diff --git a/gltests/test-symlink.c b/gltests/test-symlink.c
index 2369773..d2df54c 100644
--- a/gltests/test-symlink.c
+++ b/gltests/test-symlink.c
@@ -30,6 +30,7 @@ SIGNATURE_CHECK (symlink, int, (char const *, char const *));
 #include <stdlib.h>
 #include <sys/stat.h>
 
+#include "ignore-value.h"
 #include "macros.h"
 
 #define BASE "test-symlink.t"
@@ -40,7 +41,7 @@ int
 main (void)
 {
   /* Remove any leftovers from a previous partial run.  */
-  system ("rm -rf " BASE "*");
+  ignore_value (system ("rm -rf " BASE "*"));
 
   return test_symlink (symlink, true);
 }
diff --git a/gltests/wchar.in.h b/gltests/wchar.in.h
index 2fa3e61..6342b4e 100644
--- a/gltests/wchar.in.h
+++ b/gltests/wchar.in.h
@@ -75,10 +75,10 @@
 #ifndef _GL_WCHAR_H
 #define _GL_WCHAR_H
 
-/* The definition of GL_LINK_WARNING is copied here.  */
-
 /* The definition of _GL_ARG_NONNULL is copied here.  */
 
+/* The definition of _GL_WARN_ON_USE is copied here.  */
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -115,10 +115,10 @@ extern wint_t btowc (int c);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef btowc
-# define btowc(c) \
-    (GL_LINK_WARNING ("btowc is unportable - " \
-                      "use gnulib module btowc for portability"), \
-     btowc (c))
+# if HAVE_RAW_DECL_BTOWC
+_GL_WARN_ON_USE (btowc, "btowc is unportable - "
+                 "use gnulib module btowc for portability");
+# endif
 #endif
 
 
@@ -134,10 +134,10 @@ extern int wctob (wint_t wc);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef wctob
-# define wctob(w) \
-    (GL_LINK_WARNING ("wctob is unportable - " \
-                      "use gnulib module wctob for portability"), \
-     wctob (w))
+# if HAVE_RAW_DECL_WCTOB
+_GL_WARN_ON_USE (wctob, "wctob is unportable - "
+                 "use gnulib module wctob for portability");
+# endif
 #endif
 
 
@@ -152,10 +152,10 @@ extern int mbsinit (const mbstate_t *ps);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef mbsinit
-# define mbsinit(p) \
-    (GL_LINK_WARNING ("mbsinit is unportable - " \
-                      "use gnulib module mbsinit for portability"), \
-     mbsinit (p))
+# if HAVE_RAW_DECL_MBSINIT
+_GL_WARN_ON_USE (mbsinit, "mbsinit is unportable - "
+                 "use gnulib module mbsinit for portability");
+# endif
 #endif
 
 
@@ -170,10 +170,10 @@ extern size_t mbrtowc (wchar_t *pwc, const char *s, 
size_t n, mbstate_t *ps);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef mbrtowc
-# define mbrtowc(w,s,n,p) \
-    (GL_LINK_WARNING ("mbrtowc is unportable - " \
-                      "use gnulib module mbrtowc for portability"), \
-     mbrtowc (w, s, n, p))
+# if HAVE_RAW_DECL_MBRTOWC
+_GL_WARN_ON_USE (mbrtowc, "mbrtowc is unportable - "
+                 "use gnulib module mbrtowc for portability");
+# endif
 #endif
 
 
@@ -188,10 +188,10 @@ extern size_t mbrlen (const char *s, size_t n, mbstate_t 
*ps);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef mbrlen
-# define mbrlen(s,n,p) \
-    (GL_LINK_WARNING ("mbrlen is unportable - " \
-                      "use gnulib module mbrlen for portability"), \
-     mbrlen (s, n, p))
+# if HAVE_RAW_DECL_MBRLEN
+_GL_WARN_ON_USE (mbrlen, "mbrlen is unportable - "
+                 "use gnulib module mbrlen for portability");
+# endif
 #endif
 
 
@@ -207,10 +207,10 @@ extern size_t mbsrtowcs (wchar_t *dest, const char 
**srcp, size_t len, mbstate_t
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef mbsrtowcs
-# define mbsrtowcs(d,s,l,p) \
-    (GL_LINK_WARNING ("mbsrtowcs is unportable - " \
-                      "use gnulib module mbsrtowcs for portability"), \
-     mbsrtowcs (d, s, l, p))
+# if HAVE_RAW_DECL_MBSRTOWCS
+_GL_WARN_ON_USE (mbsrtowcs, "mbsrtowcs is unportable - "
+                 "use gnulib module mbsrtowcs for portability");
+# endif
 #endif
 
 
@@ -226,10 +226,10 @@ extern size_t mbsnrtowcs (wchar_t *dest, const char 
**srcp, size_t srclen, size_
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef mbsnrtowcs
-# define mbsnrtowcs(d,s,n,l,p) \
-    (GL_LINK_WARNING ("mbsnrtowcs is unportable - " \
-                      "use gnulib module mbsnrtowcs for portability"), \
-     mbsnrtowcs (d, s, n, l, p))
+# if HAVE_RAW_DECL_MBSNRTOWCS
+_GL_WARN_ON_USE (mbsnrtowcs, "mbsnrtowcs is unportable - "
+                 "use gnulib module mbsnrtowcs for portability");
+# endif
 #endif
 
 
@@ -244,10 +244,10 @@ extern size_t wcrtomb (char *s, wchar_t wc, mbstate_t 
*ps);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef wcrtomb
-# define wcrtomb(s,w,p) \
-    (GL_LINK_WARNING ("wcrtomb is unportable - " \
-                      "use gnulib module wcrtomb for portability"), \
-     wcrtomb (s, w, p))
+# if HAVE_RAW_DECL_WCRTOMB
+_GL_WARN_ON_USE (wcrtomb, "wcrtomb is unportable - "
+                 "use gnulib module wcrtomb for portability");
+# endif
 #endif
 
 
@@ -263,10 +263,10 @@ extern size_t wcsrtombs (char *dest, const wchar_t 
**srcp, size_t len, mbstate_t
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef wcsrtombs
-# define wcsrtombs(d,s,l,p) \
-    (GL_LINK_WARNING ("wcsrtombs is unportable - " \
-                      "use gnulib module wcsrtombs for portability"), \
-     wcsrtombs (d, s, l, p))
+# if HAVE_RAW_DECL_WCSRTOMBS
+_GL_WARN_ON_USE (wcsrtombs, "wcsrtombs is unportable - "
+                 "use gnulib module wcsrtombs for portability");
+# endif
 #endif
 
 
@@ -282,10 +282,10 @@ extern size_t wcsnrtombs (char *dest, const wchar_t 
**srcp, size_t srclen, size_
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef wcsnrtombs
-# define wcsnrtombs(d,s,n,l,p) \
-    (GL_LINK_WARNING ("wcsnrtombs is unportable - " \
-                      "use gnulib module wcsnrtombs for portability"), \
-     wcsnrtombs (d, s, n, l, p))
+# if HAVE_RAW_DECL_WCSNRTOMBS
+_GL_WARN_ON_USE (wcsnrtombs, "wcsnrtombs is unportable - "
+                 "use gnulib module wcsnrtombs for portability");
+# endif
 #endif
 
 
@@ -303,10 +303,10 @@ extern int wcwidth (int /* actually wchar_t */);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef wcwidth
-# define wcwidth(w) \
-    (GL_LINK_WARNING ("wcwidth is unportable - " \
-                      "use gnulib module wcwidth for portability"), \
-     wcwidth (w))
+# if HAVE_RAW_DECL_WCWIDTH
+_GL_WARN_ON_USE (wcwidth, "wcwidth is unportable - "
+                 "use gnulib module wcwidth for portability");
+# endif
 #endif
 
 
diff --git a/lib/gen-stringprep-tables.pl b/lib/gen-stringprep-tables.pl
index b1670ce..5f323c6 100755
--- a/lib/gen-stringprep-tables.pl
+++ b/lib/gen-stringprep-tables.pl
@@ -1,6 +1,6 @@
 #! /usr/bin/perl -w
 
-# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008, 2009 Simon Josefsson
+# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008, 2009, 2010 Simon Josefsson
 
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -34,6 +34,7 @@ open(FH, ">$filename") or die "cannot open $filename for 
writing";
 print FH "/* This file is automatically generated.  DO NOT EDIT!\n";
 print FH "   Instead, edit gen-stringprep-tables.pl and re-run.  */\n\n";
 
+print FH "#include <config.h>\n";
 print FH "#include \"stringprep.h\"\n";
 
 while(<>) {
diff --git a/lib/gl/Makefile.am b/lib/gl/Makefile.am
index 0ebc2fb..bc23e71 100644
--- a/lib/gl/Makefile.am
+++ b/lib/gl/Makefile.am
@@ -151,30 +151,6 @@ AM_CFLAGS += $(CFLAG_VISIBILITY)
 
 ## end   gnulib module lib-symbol-visibility
 
-## begin gnulib module link-warning
-
-# The BUILT_SOURCES created by this Makefile snippet are not used via #include
-# statements but through direct file reference. Therefore this snippet must be
-# present in all Makefile.am that need it. This is ensured by the applicability
-# 'all' defined above.
-
-BUILT_SOURCES += link-warning.h
-# The link-warning.h that gets inserted into generated .h files is the same as
-# build-aux/link-warning.h, except that it has the copyright header cut off.
-link-warning.h: $(top_srcdir)/build-aux/link-warning.h
-       $(AM_V_GEN)rm -f address@hidden $@ && \
-       sed -n -e '/GL_LINK_WARNING/,$$p' \
-         < $(top_srcdir)/build-aux/link-warning.h \
-         > address@hidden && \
-       mv address@hidden $@
-MOSTLYCLEANFILES += link-warning.h link-warning.h-t
-
-LINK_WARNING_H=link-warning.h
-
-EXTRA_DIST += $(top_srcdir)/build-aux/link-warning.h
-
-## end   gnulib module link-warning
-
 ## begin gnulib module stdbool
 
 BUILT_SOURCES += $(STDBOOL_H)
@@ -273,7 +249,7 @@ BUILT_SOURCES += string.h
 
 # We need the following in order to create <string.h> when the system
 # doesn't have one that works with the given compiler.
-string.h: string.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
+string.h: string.in.h $(WARN_ON_USE_H) $(ARG_NONNULL_H)
        $(AM_V_GEN)rm -f address@hidden $@ && \
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
          sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
@@ -312,7 +288,8 @@ string.h: string.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
              -e 's|@''GNULIB_STRERROR''@|$(GNULIB_STRERROR)|g' \
              -e 's|@''GNULIB_STRSIGNAL''@|$(GNULIB_STRSIGNAL)|g' \
              -e 's|@''GNULIB_STRVERSCMP''@|$(GNULIB_STRVERSCMP)|g' \
-             -e 's|@''HAVE_MBSLEN''@|$(HAVE_MBSLEN)|g' \
+             < $(srcdir)/string.in.h | \
+         sed -e 's|@''HAVE_MBSLEN''@|$(HAVE_MBSLEN)|g' \
              -e 's|@''HAVE_DECL_MEMMEM''@|$(HAVE_DECL_MEMMEM)|g' \
              -e 's|@''HAVE_MEMPCPY''@|$(HAVE_MEMPCPY)|g' \
              -e 's|@''HAVE_DECL_MEMRCHR''@|$(HAVE_DECL_MEMRCHR)|g' \
@@ -340,8 +317,8 @@ string.h: string.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
              -e 's|@''REPLACE_STRSIGNAL''@|$(REPLACE_STRSIGNAL)|g' \
              -e 's|@''REPLACE_STRTOK_R''@|$(REPLACE_STRTOK_R)|g' \
              -e 's|@''UNDEFINE_STRTOK_R''@|$(UNDEFINE_STRTOK_R)|g' \
-             -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
              -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
+             -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \
              < $(srcdir)/string.in.h; \
        } > address@hidden && \
        mv address@hidden $@
@@ -360,13 +337,32 @@ EXTRA_libgnu_la_SOURCES += strverscmp.c
 
 ## end   gnulib module strverscmp
 
+## begin gnulib module warn-on-use
+
+BUILT_SOURCES += warn-on-use.h
+# The warn-on-use.h that gets inserted into generated .h files is the same as
+# build-aux/warn-on-use.h, except that it has the copyright header cut off.
+warn-on-use.h: $(top_srcdir)/build-aux/warn-on-use.h
+       $(AM_V_GEN)rm -f address@hidden $@ && \
+       sed -n -e '/^.ifndef/,$$p' \
+         < $(top_srcdir)/build-aux/warn-on-use.h \
+         > address@hidden && \
+       mv address@hidden $@
+MOSTLYCLEANFILES += warn-on-use.h warn-on-use.h-t
+
+WARN_ON_USE_H=warn-on-use.h
+
+EXTRA_DIST += $(top_srcdir)/build-aux/warn-on-use.h
+
+## end   gnulib module warn-on-use
+
 ## begin gnulib module wchar
 
 BUILT_SOURCES += wchar.h
 
 # We need the following in order to create <wchar.h> when the system
 # version does not work standalone.
-wchar.h: wchar.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
+wchar.h: wchar.in.h $(WARN_ON_USE_H) $(ARG_NONNULL_H)
        $(AM_V_GEN)rm -f address@hidden $@ && \
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
          sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
@@ -408,8 +404,8 @@ wchar.h: wchar.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
              -e 's|@''REPLACE_WCSRTOMBS''@|$(REPLACE_WCSRTOMBS)|g' \
              -e 's|@''REPLACE_WCSNRTOMBS''@|$(REPLACE_WCSNRTOMBS)|g' \
              -e 's|@''REPLACE_WCWIDTH''@|$(REPLACE_WCWIDTH)|g' \
-             -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
              -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
+             -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
            < $(srcdir)/wchar.in.h; \
        } > address@hidden && \
        mv address@hidden $@
diff --git a/lib/gl/m4/gnulib-comp.m4 b/lib/gl/m4/gnulib-comp.m4
index 4d7f167..84c78df 100644
--- a/lib/gl/m4/gnulib-comp.m4
+++ b/lib/gl/m4/gnulib-comp.m4
@@ -197,7 +197,7 @@ AC_DEFUN([lgltests_LIBSOURCES], [
 AC_DEFUN([lgl_FILE_LIST], [
   build-aux/arg-nonnull.h
   build-aux/config.rpath
-  build-aux/link-warning.h
+  build-aux/warn-on-use.h
   lib/c-ctype.c
   lib/c-ctype.h
   lib/c-strcase.h
@@ -242,6 +242,7 @@ AC_DEFUN([lgl_FILE_LIST], [
   m4/string_h.m4
   m4/strverscmp.m4
   m4/visibility.m4
+  m4/warn-on-use.m4
   m4/wchar.m4
   m4/wchar_t.m4
   m4/wint_t.m4
diff --git a/lib/gl/m4/string_h.m4 b/lib/gl/m4/string_h.m4
index f2f64d1..73c6d83 100644
--- a/lib/gl/m4/string_h.m4
+++ b/lib/gl/m4/string_h.m4
@@ -5,7 +5,7 @@
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 10
+# serial 11
 
 # Written by Paul Eggert.
 
@@ -21,6 +21,13 @@ AC_DEFUN([gl_HEADER_STRING_H_BODY],
   AC_REQUIRE([AC_C_RESTRICT])
   AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
   gl_CHECK_NEXT_HEADERS([string.h])
+
+  dnl Check for declarations of anything we want to poison if the
+  dnl corresponding gnulib module is not in use, and which is not
+  dnl guaranteed by C89.
+  gl_WARN_ON_USE_PREPARE([[#include <string.h>
+    ]], [memmem mempcpy memrchr rawmemchr stpcpy stpncpy strchrnul strdup
+    strndup strnlen strpbrk strsep strcasestr strtok_r strsignal strverscmp])
 ])
 
 AC_DEFUN([gl_STRING_MODULE_INDICATOR],
diff --git a/gl/m4/warn-on-use.m4 b/lib/gl/m4/warn-on-use.m4
similarity index 100%
copy from gl/m4/warn-on-use.m4
copy to lib/gl/m4/warn-on-use.m4
diff --git a/lib/gl/m4/wchar.m4 b/lib/gl/m4/wchar.m4
index b2055f9..e81485d 100644
--- a/lib/gl/m4/wchar.m4
+++ b/lib/gl/m4/wchar.m4
@@ -7,7 +7,7 @@ dnl with or without modifications, as long as this notice is 
preserved.
 
 dnl Written by Eric Blake.
 
-# wchar.m4 serial 30
+# wchar.m4 serial 31
 
 AC_DEFUN([gl_WCHAR_H],
 [
@@ -33,6 +33,19 @@ AC_DEFUN([gl_WCHAR_H],
     HAVE_WINT_T=0
   fi
   AC_SUBST([HAVE_WINT_T])
+
+  dnl Check for declarations of anything we want to poison if the
+  dnl corresponding gnulib module is not in use.
+  gl_WARN_ON_USE_PREPARE([[
+/* Some systems require additional headers.  */
+#ifndef __GLIBC__
+# include <stddef.h>
+# include <stdio.h>
+# include <time.h>
+#endif
+#include <wchar.h>
+    ]], [btowc wctob mbsinit mbrtowc mbrlen mbsrtowcs mbsnrtowcs wcrtomb
+    wcsrtombs wcsnrtombs wcwidth])
 ])
 
 dnl Check whether <wchar.h> is usable at all.
diff --git a/lib/gl/string.in.h b/lib/gl/string.in.h
index ecfede1..4213e14 100644
--- a/lib/gl/string.in.h
+++ b/lib/gl/string.in.h
@@ -48,10 +48,10 @@
 #endif
 
 
-/* The definition of GL_LINK_WARNING is copied here.  */
-
 /* The definition of _GL_ARG_NONNULL is copied here.  */
 
+/* The definition of _GL_WARN_ON_USE is copied here.  */
+
 
 #ifdef __cplusplus
 extern "C" {
@@ -67,10 +67,9 @@ extern void *memchr (void const *__s, int __c, size_t __n)
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef memchr
-# define memchr(s,c,n) \
-    (GL_LINK_WARNING ("memchr has platform-specific bugs - " \
-                      "use gnulib module memchr for portability" ), \
-     memchr (s, c, n))
+/* Assume memchr is always declared.  */
+_GL_WARN_ON_USE (memchr, "memchr has platform-specific bugs - "
+                 "use gnulib module memchr for portability" );
 #endif
 
 /* Return the first occurrence of NEEDLE in HAYSTACK.  */
@@ -85,11 +84,11 @@ extern void *memmem (void const *__haystack, size_t 
__haystack_len,
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef memmem
-# define memmem(a,al,b,bl) \
-    (GL_LINK_WARNING ("memmem is unportable and often quadratic - " \
-                      "use gnulib module memmem-simple for portability, " \
-                      "and module memmem for speed" ), \
-     memmem (a, al, b, bl))
+# if HAVE_RAW_DECL_MEMMEM
+_GL_WARN_ON_USE (memmem, "memmem is unportable and often quadratic - "
+                 "use gnulib module memmem-simple for portability, "
+                 "and module memmem for speed" );
+# endif
 #endif
 
 /* Copy N bytes of SRC to DEST, return pointer to bytes after the
@@ -102,10 +101,10 @@ extern void *mempcpy (void *restrict __dest, void const 
*restrict __src,
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef mempcpy
-# define mempcpy(a,b,n) \
-    (GL_LINK_WARNING ("mempcpy is unportable - " \
-                      "use gnulib module mempcpy for portability"), \
-     mempcpy (a, b, n))
+# if HAVE_RAW_DECL_MEMPCPY
+_GL_WARN_ON_USE (mempcpy, "mempcpy is unportable - "
+                 "use gnulib module mempcpy for portability");
+# endif
 #endif
 
 /* Search backwards through a block for a byte (specified as an int).  */
@@ -116,10 +115,10 @@ extern void *memrchr (void const *, int, size_t)
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef memrchr
-# define memrchr(a,b,c) \
-    (GL_LINK_WARNING ("memrchr is unportable - " \
-                      "use gnulib module memrchr for portability"), \
-     memrchr (a, b, c))
+# if HAVE_RAW_DECL_MEMRCHR
+_GL_WARN_ON_USE (memrchr, "memrchr is unportable - "
+                 "use gnulib module memrchr for portability");
+# endif
 #endif
 
 /* Find the first occurrence of C in S.  More efficient than
@@ -132,10 +131,10 @@ extern void *rawmemchr (void const *__s, int __c_in)
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef rawmemchr
-# define rawmemchr(a,b) \
-    (GL_LINK_WARNING ("rawmemchr is unportable - " \
-                      "use gnulib module rawmemchr for portability"), \
-     rawmemchr (a, b))
+# if HAVE_RAW_DECL_RAWMEMCHR
+_GL_WARN_ON_USE (rawmemchr, "rawmemchr is unportable - "
+                 "use gnulib module rawmemchr for portability");
+# endif
 #endif
 
 /* Copy SRC to DST, returning the address of the terminating '\0' in DST.  */
@@ -146,10 +145,10 @@ extern char *stpcpy (char *restrict __dst, char const 
*restrict __src)
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef stpcpy
-# define stpcpy(a,b) \
-    (GL_LINK_WARNING ("stpcpy is unportable - " \
-                      "use gnulib module stpcpy for portability"), \
-     stpcpy (a, b))
+# if HAVE_RAW_DECL_STPCPY
+_GL_WARN_ON_USE (stpcpy, "stpcpy is unportable - "
+                 "use gnulib module stpcpy for portability");
+# endif
 #endif
 
 /* Copy no more than N bytes of SRC to DST, returning a pointer past the
@@ -163,21 +162,20 @@ extern char *stpncpy (char *restrict __dst, char const 
*restrict __src,
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef stpncpy
-# define stpncpy(a,b,n) \
-    (GL_LINK_WARNING ("stpncpy is unportable - " \
-                      "use gnulib module stpncpy for portability"), \
-     stpncpy (a, b, n))
+# if HAVE_RAW_DECL_STPNCPY
+_GL_WARN_ON_USE (stpncpy, "stpncpy is unportable - "
+                 "use gnulib module stpncpy for portability");
+# endif
 #endif
 
 #if defined GNULIB_POSIXCHECK
 /* strchr() does not work with multibyte strings if the locale encoding is
    GB18030 and the character to be searched is a digit.  */
 # undef strchr
-# define strchr(s,c) \
-    (GL_LINK_WARNING ("strchr cannot work correctly on character strings " \
-                      "in some multibyte locales - " \
-                      "use mbschr if you care about internationalization"), \
-     strchr (s, c))
+/* Assume strchr is always declared.  */
+_GL_WARN_ON_USE (strchr, "strchr cannot work correctly on character strings "
+                 "in some multibyte locales - "
+                 "use mbschr if you care about internationalization");
 #endif
 
 /* Find the first occurrence of C in S or the final NUL byte.  */
@@ -188,10 +186,10 @@ extern char *strchrnul (char const *__s, int __c_in)
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef strchrnul
-# define strchrnul(a,b) \
-    (GL_LINK_WARNING ("strchrnul is unportable - " \
-                      "use gnulib module strchrnul for portability"), \
-     strchrnul (a, b))
+# if HAVE_RAW_DECL_STRCHRNUL
+_GL_WARN_ON_USE (strchrnul, "strchrnul is unportable - "
+                 "use gnulib module strchrnul for portability");
+# endif
 #endif
 
 /* Duplicate S, returning an identical malloc'd string.  */
@@ -205,10 +203,10 @@ extern char *strdup (char const *__s) _GL_ARG_NONNULL 
((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef strdup
-# define strdup(a) \
-    (GL_LINK_WARNING ("strdup is unportable - " \
-                      "use gnulib module strdup for portability"), \
-     strdup (a))
+# if HAVE_RAW_DECL_STRDUP
+_GL_WARN_ON_USE (strdup, "strdup is unportable - "
+                 "use gnulib module strdup for portability");
+# endif
 #endif
 
 /* Return a newly allocated copy of at most N bytes of STRING.  */
@@ -222,10 +220,10 @@ extern char *strndup (char const *__string, size_t __n) 
_GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef strndup
-# define strndup(a,n) \
-    (GL_LINK_WARNING ("strndup is unportable - " \
-                      "use gnulib module strndup for portability"), \
-     strndup (a, n))
+# if HAVE_RAW_DECL_STRNDUP
+_GL_WARN_ON_USE (strndup, "strndup is unportable - "
+                 "use gnulib module strndup for portability");
+# endif
 #endif
 
 /* Find the length (number of bytes) of STRING, but scan at most
@@ -238,10 +236,10 @@ extern size_t strnlen (char const *__string, size_t 
__maxlen)
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef strnlen
-# define strnlen(a,n) \
-    (GL_LINK_WARNING ("strnlen is unportable - " \
-                      "use gnulib module strnlen for portability"), \
-     strnlen (a, n))
+# if HAVE_RAW_DECL_STRNLEN
+_GL_WARN_ON_USE (strnlen, "strnlen is unportable - "
+                 "use gnulib module strnlen for portability");
+# endif
 #endif
 
 #if defined GNULIB_POSIXCHECK
@@ -250,11 +248,10 @@ extern size_t strnlen (char const *__string, size_t 
__maxlen)
    locale encoding is GB18030 and one of the characters to be searched is a
    digit.  */
 # undef strcspn
-# define strcspn(s,a) \
-    (GL_LINK_WARNING ("strcspn cannot work correctly on character strings " \
-                      "in multibyte locales - " \
-                      "use mbscspn if you care about internationalization"), \
-     strcspn (s, a))
+/* Assume strcspn is always declared.  */
+_GL_WARN_ON_USE (strcspn, "strcspn cannot work correctly on character strings "
+                 "in multibyte locales - "
+                 "use mbscspn if you care about internationalization");
 #endif
 
 /* Find the first occurrence in S of any character in ACCEPT.  */
@@ -269,40 +266,36 @@ extern char *strpbrk (char const *__s, char const 
*__accept)
    locale encoding is GB18030 and one of the characters to be searched is a
    digit.  */
 #  undef strpbrk
-#  define strpbrk(s,a) \
-     (GL_LINK_WARNING ("strpbrk cannot work correctly on character strings " \
-                       "in multibyte locales - " \
-                       "use mbspbrk if you care about internationalization"), \
-      strpbrk (s, a))
+_GL_WARN_ON_USE (strpbrk, "strpbrk cannot work correctly on character strings "
+                 "in multibyte locales - "
+                 "use mbspbrk if you care about internationalization");
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef strpbrk
-# define strpbrk(s,a) \
-    (GL_LINK_WARNING ("strpbrk is unportable - " \
-                      "use gnulib module strpbrk for portability"), \
-     strpbrk (s, a))
+# if HAVE_RAW_DECL_STRPBRK
+_GL_WARN_ON_USE (strpbrk, "strpbrk is unportable - "
+                 "use gnulib module strpbrk for portability");
+# endif
 #endif
 
 #if defined GNULIB_POSIXCHECK
 /* strspn() assumes the second argument is a list of single-byte characters.
    Even in this simple case, it cannot work with multibyte strings.  */
 # undef strspn
-# define strspn(s,a) \
-    (GL_LINK_WARNING ("strspn cannot work correctly on character strings " \
-                      "in multibyte locales - " \
-                      "use mbsspn if you care about internationalization"), \
-     strspn (s, a))
+/* Assume strspn is always declared.  */
+_GL_WARN_ON_USE (strspn, "strspn cannot work correctly on character strings "
+                 "in multibyte locales - "
+                 "use mbsspn if you care about internationalization");
 #endif
 
 #if defined GNULIB_POSIXCHECK
 /* strrchr() does not work with multibyte strings if the locale encoding is
    GB18030 and the character to be searched is a digit.  */
 # undef strrchr
-# define strrchr(s,c) \
-    (GL_LINK_WARNING ("strrchr cannot work correctly on character strings " \
-                      "in some multibyte locales - " \
-                      "use mbsrchr if you care about internationalization"), \
-     strrchr (s, c))
+/* Assume strrchr is always declared.  */
+_GL_WARN_ON_USE (strrchr, "strrchr cannot work correctly on character strings "
+                 "in some multibyte locales - "
+                 "use mbsrchr if you care about internationalization");
 #endif
 
 /* Search the next delimiter (char listed in DELIM) starting at *STRINGP.
@@ -328,18 +321,16 @@ extern char *strsep (char **restrict __stringp, char 
const *restrict __delim)
 # endif
 # if defined GNULIB_POSIXCHECK
 #  undef strsep
-#  define strsep(s,d) \
-     (GL_LINK_WARNING ("strsep cannot work correctly on character strings " \
-                       "in multibyte locales - " \
-                       "use mbssep if you care about internationalization"), \
-      strsep (s, d))
+_GL_WARN_ON_USE (strsep, "strsep cannot work correctly on character strings "
+                 "in multibyte locales - "
+                 "use mbssep if you care about internationalization");
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef strsep
-# define strsep(s,d) \
-    (GL_LINK_WARNING ("strsep is unportable - " \
-                      "use gnulib module strsep for portability"), \
-     strsep (s, d))
+# if HAVE_RAW_DECL_STRSEP
+_GL_WARN_ON_USE (strsep, "strsep is unportable - "
+                 "use gnulib module strsep for portability");
+# endif
 #endif
 
 #if @GNULIB_STRSTR@
@@ -354,13 +345,12 @@ extern char *strstr (const char *haystack, const char 
*needle)
    POSIX says that it operates on "strings", and "string" in POSIX is defined
    as a sequence of bytes, not of characters.  */
 # undef strstr
-# define strstr(a,b) \
-    (GL_LINK_WARNING ("strstr is quadratic on many systems, and cannot " \
-                      "work correctly on character strings in most "    \
-                      "multibyte locales - " \
-                      "use mbsstr if you care about internationalization, " \
-                      "or use strstr if you care about speed"), \
-     strstr (a, b))
+/* Assume strstr is always declared.  */
+_GL_WARN_ON_USE (strstr, "strstr is quadratic on many systems, and cannot "
+                 "work correctly on character strings in most "
+                 "multibyte locales - "
+                 "use mbsstr if you care about internationalization, "
+                 "or use strstr if you care about speed");
 #endif
 
 /* Find the first occurrence of NEEDLE in HAYSTACK, using case-insensitive
@@ -378,13 +368,13 @@ extern char *strcasestr (const char *haystack, const char 
*needle)
    It is a glibc extension, and glibc implements it only for unibyte
    locales.  */
 # undef strcasestr
-# define strcasestr(a,b) \
-    (GL_LINK_WARNING ("strcasestr does work correctly on character strings " \
-                      "in multibyte locales - " \
-                      "use mbscasestr if you care about " \
-                      "internationalization, or use c-strcasestr if you want " 
\
-                      "a locale independent function"), \
-     strcasestr (a, b))
+# if HAVE_RAW_DECL_STRCASESTR
+_GL_WARN_ON_USE (strcasestr, "strcasestr does work correctly on character "
+                 "strings in multibyte locales - "
+                 "use mbscasestr if you care about "
+                 "internationalization, or use c-strcasestr if you want "
+                 "a locale independent function");
+# endif
 #endif
 
 /* Parse S into tokens separated by characters in DELIM.
@@ -413,7 +403,7 @@ extern char *strcasestr (const char *haystack, const char 
*needle)
 # if @REPLACE_STRTOK_R@
 #  undef strtok_r
 #  define strtok_r rpl_strtok_r
-# elif @UNDEFINE_STRTOK_R@
+# elif @UNDEFINE_STRTOK_R@ || defined GNULIB_POSIXCHECK
 #  undef strtok_r
 # endif
 # if ! @HAVE_DECL_STRTOK_R@ || @REPLACE_STRTOK_R@
@@ -422,19 +412,16 @@ extern char *strtok_r (char *restrict s, char const 
*restrict delim,
      _GL_ARG_NONNULL ((2, 3));
 # endif
 # if defined GNULIB_POSIXCHECK
-#  undef strtok_r
-#  define strtok_r(s,d,p) \
-     (GL_LINK_WARNING ("strtok_r cannot work correctly on character strings " \
-                       "in multibyte locales - " \
-                       "use mbstok_r if you care about internationalization"), 
\
-      strtok_r (s, d, p))
+_GL_WARN_ON_USE (strtok_r, "strtok_r cannot work correctly on character "
+                 "strings in multibyte locales - "
+                 "use mbstok_r if you care about internationalization");
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef strtok_r
-# define strtok_r(s,d,p) \
-    (GL_LINK_WARNING ("strtok_r is unportable - " \
-                      "use gnulib module strtok_r for portability"), \
-     strtok_r (s, d, p))
+# if HAVE_RAW_DECL_STRTOK_R
+_GL_WARN_ON_USE (strtok_r, "strtok_r is unportable - "
+                 "use gnulib module strtok_r for portability");
+# endif
 #endif
 
 
@@ -614,10 +601,9 @@ extern char *strerror (int);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef strerror
-# define strerror(e) \
-    (GL_LINK_WARNING ("strerror is unportable - " \
-                      "use gnulib module strerror to guarantee non-NULL 
result"), \
-     strerror (e))
+/* Assume strerror is always declared.  */
+_GL_WARN_ON_USE (strerror, "strerror is unportable - "
+                 "use gnulib module strerror to guarantee non-NULL result");
 #endif
 
 #if @GNULIB_STRSIGNAL@
@@ -629,10 +615,10 @@ extern char *strsignal (int __sig);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef strsignal
-# define strsignal(a) \
-    (GL_LINK_WARNING ("strsignal is unportable - " \
-                      "use gnulib module strsignal for portability"), \
-     strsignal (a))
+# if HAVE_RAW_DECL_STRSIGNAL
+_GL_WARN_ON_USE (strsignal, "strsignal is unportable - "
+                 "use gnulib module strsignal for portability");
+# endif
 #endif
 
 #if @GNULIB_STRVERSCMP@
@@ -641,10 +627,10 @@ extern int strverscmp (const char *, const char *) 
_GL_ARG_NONNULL ((1, 2));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef strverscmp
-# define strverscmp(a, b) \
-    (GL_LINK_WARNING ("strverscmp is unportable - " \
-                      "use gnulib module strverscmp for portability"), \
-     strverscmp (a, b))
+# if HAVE_RAW_DECL_STRVERSCMP
+_GL_WARN_ON_USE (strverscmp, "strverscmp is unportable - "
+                 "use gnulib module strverscmp for portability");
+# endif
 #endif
 
 
diff --git a/lib/gl/wchar.in.h b/lib/gl/wchar.in.h
index e2a50fa..c492dd6 100644
--- a/lib/gl/wchar.in.h
+++ b/lib/gl/wchar.in.h
@@ -75,10 +75,10 @@
 #ifndef _GL_WCHAR_H
 #define _GL_WCHAR_H
 
-/* The definition of GL_LINK_WARNING is copied here.  */
-
 /* The definition of _GL_ARG_NONNULL is copied here.  */
 
+/* The definition of _GL_WARN_ON_USE is copied here.  */
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -115,10 +115,10 @@ extern wint_t btowc (int c);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef btowc
-# define btowc(c) \
-    (GL_LINK_WARNING ("btowc is unportable - " \
-                      "use gnulib module btowc for portability"), \
-     btowc (c))
+# if HAVE_RAW_DECL_BTOWC
+_GL_WARN_ON_USE (btowc, "btowc is unportable - "
+                 "use gnulib module btowc for portability");
+# endif
 #endif
 
 
@@ -134,10 +134,10 @@ extern int wctob (wint_t wc);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef wctob
-# define wctob(w) \
-    (GL_LINK_WARNING ("wctob is unportable - " \
-                      "use gnulib module wctob for portability"), \
-     wctob (w))
+# if HAVE_RAW_DECL_WCTOB
+_GL_WARN_ON_USE (wctob, "wctob is unportable - "
+                 "use gnulib module wctob for portability");
+# endif
 #endif
 
 
@@ -152,10 +152,10 @@ extern int mbsinit (const mbstate_t *ps);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef mbsinit
-# define mbsinit(p) \
-    (GL_LINK_WARNING ("mbsinit is unportable - " \
-                      "use gnulib module mbsinit for portability"), \
-     mbsinit (p))
+# if HAVE_RAW_DECL_MBSINIT
+_GL_WARN_ON_USE (mbsinit, "mbsinit is unportable - "
+                 "use gnulib module mbsinit for portability");
+# endif
 #endif
 
 
@@ -170,10 +170,10 @@ extern size_t mbrtowc (wchar_t *pwc, const char *s, 
size_t n, mbstate_t *ps);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef mbrtowc
-# define mbrtowc(w,s,n,p) \
-    (GL_LINK_WARNING ("mbrtowc is unportable - " \
-                      "use gnulib module mbrtowc for portability"), \
-     mbrtowc (w, s, n, p))
+# if HAVE_RAW_DECL_MBRTOWC
+_GL_WARN_ON_USE (mbrtowc, "mbrtowc is unportable - "
+                 "use gnulib module mbrtowc for portability");
+# endif
 #endif
 
 
@@ -188,10 +188,10 @@ extern size_t mbrlen (const char *s, size_t n, mbstate_t 
*ps);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef mbrlen
-# define mbrlen(s,n,p) \
-    (GL_LINK_WARNING ("mbrlen is unportable - " \
-                      "use gnulib module mbrlen for portability"), \
-     mbrlen (s, n, p))
+# if HAVE_RAW_DECL_MBRLEN
+_GL_WARN_ON_USE (mbrlen, "mbrlen is unportable - "
+                 "use gnulib module mbrlen for portability");
+# endif
 #endif
 
 
@@ -207,10 +207,10 @@ extern size_t mbsrtowcs (wchar_t *dest, const char 
**srcp, size_t len, mbstate_t
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef mbsrtowcs
-# define mbsrtowcs(d,s,l,p) \
-    (GL_LINK_WARNING ("mbsrtowcs is unportable - " \
-                      "use gnulib module mbsrtowcs for portability"), \
-     mbsrtowcs (d, s, l, p))
+# if HAVE_RAW_DECL_MBSRTOWCS
+_GL_WARN_ON_USE (mbsrtowcs, "mbsrtowcs is unportable - "
+                 "use gnulib module mbsrtowcs for portability");
+# endif
 #endif
 
 
@@ -226,10 +226,10 @@ extern size_t mbsnrtowcs (wchar_t *dest, const char 
**srcp, size_t srclen, size_
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef mbsnrtowcs
-# define mbsnrtowcs(d,s,n,l,p) \
-    (GL_LINK_WARNING ("mbsnrtowcs is unportable - " \
-                      "use gnulib module mbsnrtowcs for portability"), \
-     mbsnrtowcs (d, s, n, l, p))
+# if HAVE_RAW_DECL_MBSNRTOWCS
+_GL_WARN_ON_USE (mbsnrtowcs, "mbsnrtowcs is unportable - "
+                 "use gnulib module mbsnrtowcs for portability");
+# endif
 #endif
 
 
@@ -244,10 +244,10 @@ extern size_t wcrtomb (char *s, wchar_t wc, mbstate_t 
*ps);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef wcrtomb
-# define wcrtomb(s,w,p) \
-    (GL_LINK_WARNING ("wcrtomb is unportable - " \
-                      "use gnulib module wcrtomb for portability"), \
-     wcrtomb (s, w, p))
+# if HAVE_RAW_DECL_WCRTOMB
+_GL_WARN_ON_USE (wcrtomb, "wcrtomb is unportable - "
+                 "use gnulib module wcrtomb for portability");
+# endif
 #endif
 
 
@@ -263,10 +263,10 @@ extern size_t wcsrtombs (char *dest, const wchar_t 
**srcp, size_t len, mbstate_t
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef wcsrtombs
-# define wcsrtombs(d,s,l,p) \
-    (GL_LINK_WARNING ("wcsrtombs is unportable - " \
-                      "use gnulib module wcsrtombs for portability"), \
-     wcsrtombs (d, s, l, p))
+# if HAVE_RAW_DECL_WCSRTOMBS
+_GL_WARN_ON_USE (wcsrtombs, "wcsrtombs is unportable - "
+                 "use gnulib module wcsrtombs for portability");
+# endif
 #endif
 
 
@@ -282,10 +282,10 @@ extern size_t wcsnrtombs (char *dest, const wchar_t 
**srcp, size_t srclen, size_
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef wcsnrtombs
-# define wcsnrtombs(d,s,n,l,p) \
-    (GL_LINK_WARNING ("wcsnrtombs is unportable - " \
-                      "use gnulib module wcsnrtombs for portability"), \
-     wcsnrtombs (d, s, n, l, p))
+# if HAVE_RAW_DECL_WCSNRTOMBS
+_GL_WARN_ON_USE (wcsnrtombs, "wcsnrtombs is unportable - "
+                 "use gnulib module wcsnrtombs for portability");
+# endif
 #endif
 
 
@@ -303,10 +303,10 @@ extern int wcwidth (int /* actually wchar_t */);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef wcwidth
-# define wcwidth(w) \
-    (GL_LINK_WARNING ("wcwidth is unportable - " \
-                      "use gnulib module wcwidth for portability"), \
-     wcwidth (w))
+# if HAVE_RAW_DECL_WCWIDTH
+_GL_WARN_ON_USE (wcwidth, "wcwidth is unportable - "
+                 "use gnulib module wcwidth for portability");
+# endif
 #endif
 
 
diff --git a/lib/gltests/Makefile.am b/lib/gltests/Makefile.am
index 2614888..3945721 100644
--- a/lib/gltests/Makefile.am
+++ b/lib/gltests/Makefile.am
@@ -43,6 +43,8 @@ libtests_a_DEPENDENCIES = $(lgltests_LIBOBJS)
 EXTRA_libtests_a_SOURCES =
 AM_LIBTOOLFLAGS = --preserve-dup-deps
 
+TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' srcdir='$(srcdir)'
+
 ## begin gnulib module arg-nonnull
 
 # The BUILT_SOURCES created by this Makefile snippet are not used via #include
@@ -79,7 +81,7 @@ EXTRA_DIST += test-c-ctype.c macros.h
 ## begin gnulib module c-strcase-tests
 
 TESTS += test-c-strcase.sh
-TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' LOCALE_FR='@LOCALE_FR@' 
LOCALE_TR_UTF8='@LOCALE_TR_UTF8@'
+TESTS_ENVIRONMENT += LOCALE_FR='@LOCALE_FR@' LOCALE_TR_UTF8='@LOCALE_TR_UTF8@'
 check_PROGRAMS += test-c-strcasecmp test-c-strncasecmp
 EXTRA_DIST += test-c-strcase.sh test-c-strcasecmp.c test-c-strncasecmp.c 
macros.h
 
@@ -102,30 +104,6 @@ EXTRA_DIST += intprops.h
 
 ## end   gnulib module intprops
 
-## begin gnulib module link-warning
-
-# The BUILT_SOURCES created by this Makefile snippet are not used via #include
-# statements but through direct file reference. Therefore this snippet must be
-# present in all Makefile.am that need it. This is ensured by the applicability
-# 'all' defined above.
-
-BUILT_SOURCES += link-warning.h
-# The link-warning.h that gets inserted into generated .h files is the same as
-# build-aux/link-warning.h, except that it has the copyright header cut off.
-link-warning.h: $(top_srcdir)/build-aux/link-warning.h
-       $(AM_V_GEN)rm -f address@hidden $@ && \
-       sed -n -e '/GL_LINK_WARNING/,$$p' \
-         < $(top_srcdir)/build-aux/link-warning.h \
-         > address@hidden && \
-       mv address@hidden $@
-MOSTLYCLEANFILES += link-warning.h link-warning.h-t
-
-LINK_WARNING_H=link-warning.h
-
-EXTRA_DIST += $(top_srcdir)/build-aux/link-warning.h
-
-## end   gnulib module link-warning
-
 ## begin gnulib module stdbool-tests
 
 TESTS += test-stdbool
@@ -182,6 +160,25 @@ libtests_a_SOURCES += verify.h
 
 ## end   gnulib module verify
 
+## begin gnulib module warn-on-use
+
+BUILT_SOURCES += warn-on-use.h
+# The warn-on-use.h that gets inserted into generated .h files is the same as
+# build-aux/warn-on-use.h, except that it has the copyright header cut off.
+warn-on-use.h: $(top_srcdir)/build-aux/warn-on-use.h
+       $(AM_V_GEN)rm -f address@hidden $@ && \
+       sed -n -e '/^.ifndef/,$$p' \
+         < $(top_srcdir)/build-aux/warn-on-use.h \
+         > address@hidden && \
+       mv address@hidden $@
+MOSTLYCLEANFILES += warn-on-use.h warn-on-use.h-t
+
+WARN_ON_USE_H=warn-on-use.h
+
+EXTRA_DIST += $(top_srcdir)/build-aux/warn-on-use.h
+
+## end   gnulib module warn-on-use
+
 ## begin gnulib module wchar-tests
 
 TESTS += test-wchar
diff --git a/lib/stringprep.h b/lib/stringprep.h
index d774235..7a3ddc6 100644
--- a/lib/stringprep.h
+++ b/lib/stringprep.h
@@ -145,6 +145,7 @@ extern "C"
   /* SASL */
 
   extern IDNAPI const Stringprep_profile stringprep_saslprep[];
+  extern IDNAPI const Stringprep_table_element stringprep_saslprep_space_map[];
   extern IDNAPI const Stringprep_profile stringprep_plain[];
   extern IDNAPI const Stringprep_profile stringprep_trace[];
 
@@ -172,6 +173,7 @@ extern "C"
   /* iSCSI */
 
   extern IDNAPI const Stringprep_profile stringprep_iscsi[];
+  extern IDNAPI const Stringprep_table_element stringprep_iscsi_prohibit[];
 
 # define stringprep_iscsi(in, maxlen)          \
   stringprep(in, maxlen, 0, stringprep_iscsi)
diff --git a/maint.mk b/maint.mk
index 366d12a..f9eed6a 100644
--- a/maint.mk
+++ b/maint.mk
@@ -40,10 +40,28 @@ VC_LIST = $(build_aux)/vc-list-files -C $(srcdir)
 # matching files to ignore.
 VC_LIST_ALWAYS_EXCLUDE_REGEX ?= ^$$
 
+# This is to preprocess robustly the output of $(VC_LIST), so that even
+# when $(srcdir) is a pathological name like "....", the leading sed command
+# removes only the intended prefix.
+_dot_escaped_srcdir = $(subst .,\.,$(srcdir))
+
+# Post-process $(VC_LIST) output, prepending $(srcdir)/, but only
+# when $(srcdir) is not ".".
+ifeq ($(srcdir),.)
+_prepend_srcdir_prefix =
+else
+_prepend_srcdir_prefix = | sed 's|^|$(srcdir)/|'
+endif
+
+# In order to be able to consistently filter "."-relative names,
+# (i.e., with no $(srcdir) prefix), this definition is careful to
+# remove any $(srcdir) prefix, and to restore what it removes.
 VC_LIST_EXCEPT = \
-  $(VC_LIST) | if test -f $(srcdir)/.x-$@; then grep -vEf $(srcdir)/.x-$@; \
-              else grep -Ev -e "$${VC_LIST_EXCEPT_DEFAULT-ChangeLog}"; fi \
-       | grep -Ev -e '$(VC_LIST_ALWAYS_EXCLUDE_REGEX)'
+  $(VC_LIST) | sed 's|^$(_dot_escaped_srcdir)/||' \
+       | if test -f $(srcdir)/.x-$@; then grep -vEf $(srcdir)/.x-$@; \
+         else grep -Ev -e "$${VC_LIST_EXCEPT_DEFAULT-ChangeLog}"; fi \
+       | grep -Ev -e '$(VC_LIST_ALWAYS_EXCLUDE_REGEX)' \
+       $(_prepend_srcdir_prefix)
 
 ifeq ($(origin prev_version_file), undefined)
   prev_version_file = $(srcdir)/.prev-version
@@ -700,6 +718,27 @@ sc_copyright_check:
               exit 1; };                                               \
        fi
 
+# #if HAVE_... will evaluate to false for any non numeric string.
+# That would be flagged by using -Wundef, however gnulib currently
+# tests many undefined macros, and so we can't enable that option.
+# So at least preclude common boolean strings as macro values.
+sc_Wundef_boolean:
+       @grep -Ei '^#define.*(yes|no|true|false)$$' '$(CONFIG_INCLUDE)' && \
+         { echo 'Use 0 or 1 for macro values' 1>&2; exit 1; } || :
+
+sc_vulnerable_makefile_CVE-2009-4029:
+       @files=$$(find $(srcdir) -name Makefile.in);                    \
+       if test -n "$$files"; then                                      \
+         grep -E                                                       \
+           'perm -777 -exec chmod a\+rwx|chmod 777 \$$\(distdir\)'     \
+           $$files &&                                                  \
+         { echo '$(ME): the above files are vulnerable; beware of'     \
+           'running "make dist*" rules, and upgrade to fixed automake' \
+           'see http://bugzilla.redhat.com/542609 for details'         \
+               1>&2; exit 1; } || :;                                   \
+       else :;                                                         \
+       fi
+
 vc-diff-check:
        (unset CDPATH; cd $(srcdir) && $(VC) diff) > vc-diffs || :
        if test -s vc-diffs; then                               \
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 345034f..98487bc 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,5 +1,5 @@
 ## Process this file with automake to produce Makefile.in
-# Copyright (C) 2002, 2003, 2004, 2006, 2007, 2008, 2009 Simon Josefsson
+# Copyright (C) 2002, 2003, 2004, 2006, 2007, 2008, 2009, 2010 Simon Josefsson
 #
 # This file is part of GNU Libidn.
 #
@@ -27,7 +27,8 @@ libutils_la_SOURCES = utils.h utils.c
 
 ctests = tst_stringprep$(EXEEXT) tst_punycode$(EXEEXT)                 \
        tst_idna$(EXEEXT) tst_idna2$(EXEEXT) tst_nfkc$(EXEEXT)          \
-       tst_pr29$(EXEEXT) tst_strerror$(EXEEXT) tst_toutf8$(EXEEXT)
+       tst_pr29$(EXEEXT) tst_strerror$(EXEEXT) tst_toutf8$(EXEEXT)     \
+       tst_symbols$(EXEEXT)
 if TLD
 ctests += tst_tld$(EXEEXT)
 endif
diff --git a/tests/tst_symbols.c b/tests/tst_symbols.c
new file mode 100644
index 0000000..e90bb26
--- /dev/null
+++ b/tests/tst_symbols.c
@@ -0,0 +1,123 @@
+/* tst_symbols.c --- Test if all exported symbols are available.
+ * Copyright (C) 2010  Simon Josefsson
+ *
+ * This file is part of GNU Libidn.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <assert.h>
+
+#include <stringprep.h>
+#include <idna.h>
+#include <punycode.h>
+#include <idn-free.h>
+#include <pr29.h>
+#ifdef WITH_TLD
+# include <tld.h>
+#endif
+
+static void
+assert_symbol_exists (const void *p)
+{
+  assert (p);
+}
+
+int
+main (void)
+{
+  assert_symbol_exists ((const void *) idn_free);
+  assert_symbol_exists ((const void *) idna_strerror);
+  assert_symbol_exists ((const void *) idna_to_ascii_4i);
+  assert_symbol_exists ((const void *) idna_to_ascii_4z);
+  assert_symbol_exists ((const void *) idna_to_ascii_8z);
+  assert_symbol_exists ((const void *) idna_to_ascii_lz);
+  assert_symbol_exists ((const void *) idna_to_unicode_44i);
+  assert_symbol_exists ((const void *) idna_to_unicode_4z4z);
+  assert_symbol_exists ((const void *) idna_to_unicode_8z4z);
+  assert_symbol_exists ((const void *) idna_to_unicode_8z8z);
+  assert_symbol_exists ((const void *) idna_to_unicode_8zlz);
+  assert_symbol_exists ((const void *) idna_to_unicode_lzlz);
+  assert_symbol_exists ((const void *) pr29_4);
+  assert_symbol_exists ((const void *) pr29_4z);
+  assert_symbol_exists ((const void *) pr29_8z);
+  assert_symbol_exists ((const void *) pr29_strerror);
+  assert_symbol_exists ((const void *) punycode_decode);
+  assert_symbol_exists ((const void *) punycode_encode);
+  assert_symbol_exists ((const void *) punycode_strerror);
+  assert_symbol_exists ((const void *) stringprep);
+  assert_symbol_exists ((const void *) stringprep_4i);
+  assert_symbol_exists ((const void *) stringprep_4zi);
+  assert_symbol_exists ((const void *) stringprep_check_version);
+  assert_symbol_exists ((const void *) stringprep_convert);
+  assert_symbol_exists ((const void *) stringprep_iscsi);
+  assert_symbol_exists ((const void *) stringprep_iscsi_prohibit);
+  assert_symbol_exists ((const void *) stringprep_kerberos5);
+  assert_symbol_exists ((const void *) stringprep_locale_charset);
+  assert_symbol_exists ((const void *) stringprep_locale_to_utf8);
+  assert_symbol_exists ((const void *) stringprep_nameprep);
+  assert_symbol_exists ((const void *) stringprep_plain);
+  assert_symbol_exists ((const void *) stringprep_profile);
+  assert_symbol_exists ((const void *) stringprep_profiles);
+  assert_symbol_exists ((const void *) stringprep_rfc3454_A_1);
+  assert_symbol_exists ((const void *) stringprep_rfc3454_B_1);
+  assert_symbol_exists ((const void *) stringprep_rfc3454_B_2);
+  assert_symbol_exists ((const void *) stringprep_rfc3454_B_3);
+  assert_symbol_exists ((const void *) stringprep_rfc3454_C_1_1);
+  assert_symbol_exists ((const void *) stringprep_rfc3454_C_1_2);
+  assert_symbol_exists ((const void *) stringprep_rfc3454_C_2_1);
+  assert_symbol_exists ((const void *) stringprep_rfc3454_C_2_2);
+  assert_symbol_exists ((const void *) stringprep_rfc3454_C_3);
+  assert_symbol_exists ((const void *) stringprep_rfc3454_C_4);
+  assert_symbol_exists ((const void *) stringprep_rfc3454_C_5);
+  assert_symbol_exists ((const void *) stringprep_rfc3454_C_6);
+  assert_symbol_exists ((const void *) stringprep_rfc3454_C_7);
+  assert_symbol_exists ((const void *) stringprep_rfc3454_C_8);
+  assert_symbol_exists ((const void *) stringprep_rfc3454_C_9);
+  assert_symbol_exists ((const void *) stringprep_rfc3454_D_1);
+  assert_symbol_exists ((const void *) stringprep_rfc3454_D_2);
+  assert_symbol_exists ((const void *) stringprep_saslprep);
+  assert_symbol_exists ((const void *) stringprep_saslprep_space_map);
+  assert_symbol_exists ((const void *) stringprep_strerror);
+  assert_symbol_exists ((const void *) stringprep_trace);
+  assert_symbol_exists ((const void *) stringprep_ucs4_nfkc_normalize);
+  assert_symbol_exists ((const void *) stringprep_ucs4_to_utf8);
+  assert_symbol_exists ((const void *) stringprep_unichar_to_utf8);
+  assert_symbol_exists ((const void *) stringprep_utf8_nfkc_normalize);
+  assert_symbol_exists ((const void *) stringprep_utf8_to_locale);
+  assert_symbol_exists ((const void *) stringprep_utf8_to_ucs4);
+  assert_symbol_exists ((const void *) stringprep_utf8_to_unichar);
+  assert_symbol_exists ((const void *) stringprep_xmpp_nodeprep);
+  assert_symbol_exists ((const void *) stringprep_xmpp_nodeprep_prohibit);
+  assert_symbol_exists ((const void *) stringprep_xmpp_resourceprep);
+  assert_symbol_exists ((const void *) tld_check_4);
+  assert_symbol_exists ((const void *) tld_check_4t);
+  assert_symbol_exists ((const void *) tld_check_4tz);
+  assert_symbol_exists ((const void *) tld_check_4z);
+  assert_symbol_exists ((const void *) tld_check_8z);
+  assert_symbol_exists ((const void *) tld_check_lz);
+  assert_symbol_exists ((const void *) tld_default_table);
+  assert_symbol_exists ((const void *) tld_get_4);
+  assert_symbol_exists ((const void *) tld_get_4z);
+  assert_symbol_exists ((const void *) tld_get_table);
+  assert_symbol_exists ((const void *) tld_get_z);
+  assert_symbol_exists ((const void *) tld_strerror);
+
+  return 0;
+}


hooks/post-receive
-- 
GNU libidn




reply via email to

[Prev in Thread] Current Thread [Next in Thread]