From 44fd637accbdb4f21edb7cc5194f5cf0848eac62 Mon Sep 17 00:00:00 2001
From: Bruno Haible <bruno@clisp.org>
Date: Tue, 5 Oct 2004 17:44:44 +0000
Subject: [PATCH] Don't redeclare strsep if the system already has it.

---
 lib/ChangeLog | 4 ++++
 lib/strsep.h  | 8 +++++++-
 m4/ChangeLog  | 5 +++++
 m4/strsep.m4  | 6 ++++--
 4 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/lib/ChangeLog b/lib/ChangeLog
index b9595ab020..e366808fd6 100644
--- a/lib/ChangeLog
+++ b/lib/ChangeLog
@@ -1,3 +1,7 @@
+2004-10-05  Bruno Haible  <bruno@clisp.org>
+
+	* strsep.h: Don't declare strsep() if HAVE_STRSEP.
+
 2004-10-04  Paul Eggert  <eggert@cs.ucla.edu>
 
 	* xalloc.h (xmemdup): Renamed from xclone.  All uses changed.
diff --git a/lib/strsep.h b/lib/strsep.h
index 87351ff4a7..eeb0862bc6 100644
--- a/lib/strsep.h
+++ b/lib/strsep.h
@@ -20,11 +20,15 @@
 #ifndef GNULIB_STRSEP_H_
 #define GNULIB_STRSEP_H_
 
+#if HAVE_STRSEP
+
 /*
- * Get strsep, if available.
+ * Get strsep() declaration.
  */
 #include <string.h>
 
+#else
+
 /* Searches the next delimiter (char listed in DELIM) starting at *STRINGP.
    If one is found, it is overwritten with a NUL, and *STRINGP is advanced
    to point to the next char after it.  Otherwise, *STRINGP is set to NULL.
@@ -40,4 +44,6 @@
 
 extern char *strsep (char **stringp, const char *delim);
 
+#endif
+
 #endif /* GNULIB_STRSEP_H_ */
diff --git a/m4/ChangeLog b/m4/ChangeLog
index cf0eaa1c4c..9af4ee9031 100644
--- a/m4/ChangeLog
+++ b/m4/ChangeLog
@@ -1,3 +1,8 @@
+2004-10-05  Bruno Haible  <bruno@clisp.org>
+
+	* strsep.m4 (gl_FUNC_STRSEP): Require AC_GNU_SOURCE. Don't check
+	for the declaration of strsep.
+
 2004-10-04  Paul Eggert  <eggert@cs.ucla.edu>
 
 	* xalloc.m4 (gl_PREREQ_XSTRDUP): Remove.  All uses removed.
diff --git a/m4/strsep.m4 b/m4/strsep.m4
index 430a25805f..cfcb06fb9e 100644
--- a/m4/strsep.m4
+++ b/m4/strsep.m4
@@ -1,4 +1,4 @@
-# strsep.m4 serial 1
+# strsep.m4 serial 2
 dnl Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
 dnl This file is free software, distributed under the terms of the GNU
 dnl General Public License.  As a special exception to the GNU General
@@ -8,8 +8,10 @@ dnl the same distribution terms as the rest of that program.
 
 AC_DEFUN([gl_FUNC_STRSEP],
 [
+  dnl Persuade glibc <string.h> to declare strsep().
+  AC_REQUIRE([AC_GNU_SOURCE])
+
   AC_REPLACE_FUNCS(strsep)
-  AC_CHECK_DECLS_ONCE(strsep)
   gl_PREREQ_STRSEP
 ])
 
-- 
2.39.5