strsignal: work around NetBSD bug
authorEric Blake <eblake@redhat.com>
Thu, 9 Sep 2010 23:05:15 +0000 (17:05 -0600)
committerEric Blake <eblake@redhat.com>
Thu, 9 Sep 2010 23:28:38 +0000 (17:28 -0600)
* m4/strsignal.m4 (gl_FUNC_STRSIGNAL): Also check in <unistd.h>.
* lib/string.in.h (includes): Likewise.
* doc/posix-functions/strsignal.texi (strsignal): Document the
bug.
Reported by Nelson H. F. Beebe.

Signed-off-by: Eric Blake <eblake@redhat.com>
ChangeLog
doc/posix-functions/strsignal.texi
lib/string.in.h
m4/strsignal.m4

index 63214de..f3313fe 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2010-09-09  Eric Blake  <eblake@redhat.com>
 
+       strsignal: work around NetBSD bug
+       * m4/strsignal.m4 (gl_FUNC_STRSIGNAL): Also check in <unistd.h>.
+       * lib/string.in.h (includes): Likewise.
+       * doc/posix-functions/strsignal.texi (strsignal): Document the
+       bug.
+       Reported by Nelson H. F. Beebe.
+
        gnulib-tool: work with NetBSD /bin/sh
        * gnulib-tool (func_cache_var, func_cache_lookup_module)
        (func_get_description, func_get_comment, func_get_status)
index 1d48543..51b1d00 100644 (file)
@@ -16,6 +16,11 @@ AIX 4.3.2, HP-UX 11, IRIX 6.5, OSF/1 5.1, mingw.
 This function does not return a string for out-of-range numbers on
 some platforms:
 Solaris, AIX 5.1.
+
+@item
+This function is declared in @code{unistd.h} instead of
+@code{string.h} on some platforms:
+NetBSD 5.0.
 @end itemize
 
 Portability problems not fixed by Gnulib:
index db4c4aa..5409f31 100644 (file)
 # define _GL_ATTRIBUTE_PURE /* empty */
 #endif
 
+/* NetBSD 5.0 declares strsignal in <unistd.h>, not in <string.h>.  */
+/* But avoid namespace pollution on glibc systems.  */
+#if (@GNULIB_STRSIGNAL@ || defined GNULIB_POSIXCHECK)  \
+    && ! defined __GLIBC__
+# include <unistd.h>
+#endif
 
 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
 
index be3c733..6cb8d9d 100644 (file)
@@ -1,4 +1,4 @@
-# strsignal.m4 serial 3
+# strsignal.m4 serial 4
 dnl Copyright (C) 2008, 2009, 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,6 +26,7 @@ AC_DEFUN([gl_FUNC_STRSIGNAL],
       [AC_RUN_IFELSE(
          [AC_LANG_PROGRAM(
             [[#include <string.h>
+#include <unistd.h> /* NetBSD 5.0 declares it in wrong header. */
             ]],
             [[char *s = strsignal (-1);
               return !(s != (char *) 0 && s != (char *) -1);]])],