summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2011-09-11 21:15:40 +0200
committerBruno Haible <bruno@clisp.org>2011-09-11 21:15:40 +0200
commit19b6ec55b1e70fc29dd9600e0b3c262b06c47c0b (patch)
treeff35dfb57081cccf57ac31ec32a375f76110c610
parent28d57000306f68f4ef8f0ada970c5733f9ed99f4 (diff)
downloadgnulib-19b6ec55b1e70fc29dd9600e0b3c262b06c47c0b.tar.gz
strings: Don't assume <strings.h> exists.
* lib/strings.in.h: Include <strings.h> only if HAVE_STRINGS_H is 1. * m4/strings_h.m4 (gl_HEADER_STRINGS_H_BODY): Set HAVE_STRINGS_H. * modules/strings (Makefile.am): Substitute HAVE_STRINGS_H. * doc/posix-headers/strings.texi: Mention the MSVC problem.
-rw-r--r--ChangeLog8
-rw-r--r--doc/posix-headers/strings.texi3
-rw-r--r--lib/strings.in.h4
-rw-r--r--m4/strings_h.m49
-rw-r--r--modules/strings1
5 files changed, 23 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index f6987e2e06..520e8000b9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
2011-09-11 Bruno Haible <bruno@clisp.org>
+ strings: Don't assume <strings.h> exists.
+ * lib/strings.in.h: Include <strings.h> only if HAVE_STRINGS_H is 1.
+ * m4/strings_h.m4 (gl_HEADER_STRINGS_H_BODY): Set HAVE_STRINGS_H.
+ * modules/strings (Makefile.am): Substitute HAVE_STRINGS_H.
+ * doc/posix-headers/strings.texi: Mention the MSVC problem.
+
+2011-09-11 Bruno Haible <bruno@clisp.org>
+
dirent: Don't assume <dirent.h> exists.
* lib/dirent.in.h: Include <dirent.h> only if HAVE_DIRENT_H is 1.
* m4/dirent_h.m4 (gl_DIRENT_H): Set HAVE_DIRENT_H.
diff --git a/doc/posix-headers/strings.texi b/doc/posix-headers/strings.texi
index 7a4619e4e9..63713eedea 100644
--- a/doc/posix-headers/strings.texi
+++ b/doc/posix-headers/strings.texi
@@ -15,6 +15,9 @@ Minix 3.1.8.
Portability problems not fixed by Gnulib:
@itemize
@item
+This header file is missing on some platforms:
+MSVC 9.
+@item
This header file defines symbols, such as @samp{index}, often used for
variables, making debugging harder.
@end itemize
diff --git a/lib/strings.in.h b/lib/strings.in.h
index a82b2d4c21..296867b7fa 100644
--- a/lib/strings.in.h
+++ b/lib/strings.in.h
@@ -30,7 +30,9 @@
#endif
/* The include_next requires a split double-inclusion guard. */
-#@INCLUDE_NEXT@ @NEXT_STRINGS_H@
+#if @HAVE_STRINGS_H@
+# @INCLUDE_NEXT@ @NEXT_STRINGS_H@
+#endif
#ifndef _@GUARD_PREFIX@_STRINGS_H
#define _@GUARD_PREFIX@_STRINGS_H
diff --git a/m4/strings_h.m4 b/m4/strings_h.m4
index 12ca5eb4a2..481f8f334a 100644
--- a/m4/strings_h.m4
+++ b/m4/strings_h.m4
@@ -1,5 +1,5 @@
# Configure a replacement for <strings.h>.
-# serial 5
+# serial 6
# Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
@@ -16,7 +16,14 @@ AC_DEFUN([gl_HEADER_STRINGS_H],
AC_DEFUN([gl_HEADER_STRINGS_H_BODY],
[
AC_REQUIRE([gl_HEADER_STRINGS_H_DEFAULTS])
+
gl_CHECK_NEXT_HEADERS([strings.h])
+ if test $ac_cv_header_strings_h = yes; then
+ HAVE_STRINGS_H=1
+ else
+ HAVE_STRINGS_H=0
+ fi
+ AC_SUBST([HAVE_STRINGS_H])
dnl Check for declarations of anything we want to poison if the
dnl corresponding gnulib module is not in use.
diff --git a/modules/strings b/modules/strings
index 905a45c6ed..ced757dec9 100644
--- a/modules/strings
+++ b/modules/strings
@@ -24,6 +24,7 @@ strings.h: strings.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_USE
$(AM_V_GEN)rm -f $@-t $@ && \
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
sed -e 's|@''GUARD_PREFIX''@|${gl_include_guard_prefix}|g' \
+ -e 's|@''HAVE_STRINGS_H''@|$(HAVE_STRINGS_H)|g' \
-e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \