Don't redeclare strsep if the system already has it.
authorBruno Haible <bruno@clisp.org>
Tue, 5 Oct 2004 17:44:44 +0000 (17:44 +0000)
committerBruno Haible <bruno@clisp.org>
Tue, 5 Oct 2004 17:44:44 +0000 (17:44 +0000)
lib/ChangeLog
lib/strsep.h
m4/ChangeLog
m4/strsep.m4

index b9595ab..e366808 100644 (file)
@@ -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.
index 87351ff..eeb0862 100644 (file)
 #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_ */
index cf0eaa1..9af4ee9 100644 (file)
@@ -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.
index 430a258..cfcb06f 100644 (file)
@@ -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
 ])