changeset 5160:e70798064461

Only declare strdup if it isn't declared by the system.
author Paul Eggert <eggert@cs.ucla.edu>
date Sat, 07 Aug 2004 02:58:12 +0000
parents a535859efd14
children 24371bb8c5a8
files lib/ChangeLog lib/strdup.h m4/ChangeLog m4/strdup.m4
diffstat 4 files changed, 29 insertions(+), 27 deletions(-) [+]
line wrap: on
line diff
--- a/lib/ChangeLog
+++ b/lib/ChangeLog
@@ -20,20 +20,6 @@
 	xstrtod.h, xstrtoimax.c, xstrtol.c, xstrtol.h, xstrtoumax.c:
 	Import changes from coreutils.
 
-2004-08-03  Simon Josefsson  <jas@extundo.com>
-
-	* progname.h: Don't include stdbool.h.
-
-2004-08-01  Simon Josefsson  <jas@extundo.com>
-
-	* xgetdomainname.c: Include stdlib.h, for free().
-
-2004-08-02  Simon Josefsson  <jas@extundo.com>
-
-	* getsubopt.h: New file, with comments from Bruno Haible.
-	* getsubopt.c: New file, from glibc, but slightly modified based on
-	suggestions from Paul Eggert <eggert@cs.ucla.edu>.
-
 2004-08-05  Paul Eggert  <eggert@cs.ucla.edu>
 
 	Merge from coreutils.
@@ -81,6 +67,21 @@
 	* fatal.c, fatal.h: Remove as the "fatal" module wasn't used or
 	working.
 
+2004-08-03  Simon Josefsson  <jas@extundo.com>
+
+	* strdup.h: Only use HAVE_DECL_STRDUP if defined.
+	* progname.h: Don't include stdbool.h.
+
+2004-08-02  Simon Josefsson  <jas@extundo.com>
+
+	* getsubopt.h: New file, with comments from Bruno Haible.
+	* getsubopt.c: New file, from glibc, but slightly modified based on
+	suggestions from Paul Eggert <eggert@cs.ucla.edu>.
+
+2004-08-01  Simon Josefsson  <jas@extundo.com>
+
+	* xgetdomainname.c: Include stdlib.h, for free().
+
 2004-07-16  Simon Josefsson  <jas@extundo.com>
 
 	* dummy.c: New file.
--- a/lib/strdup.h
+++ b/lib/strdup.h
@@ -21,7 +21,7 @@
 /* Get strdup declaration, if available.  */
 #include <string.h>
 
-#if !HAVE_DECL_STRDUP && !defined strdup
+#if defined HAVE_DECL_STRDUP && !HAVE_DECL_STRDUP && !defined strdup
 /* Duplicate S, returning an identical malloc'd string.  */
 extern char *strdup (const char *s);
 #endif
--- a/m4/ChangeLog
+++ b/m4/ChangeLog
@@ -7,10 +7,6 @@
 	fsusage.m4, jm-macros.m4, ls-mntd-fs.m4, md5.m4, mountlist.m4,
 	prereq.m4, sha.m4: Import changes from coreutils.
 
-2004-08-02  Simon Josefsson  <jas@extundo.com>
-
-	* getsubopt.m4: New file.
-
 2004-08-05  Paul Eggert  <eggert@cs.ucla.edu>
 
 	Merge from coreutils.
@@ -30,6 +26,14 @@
 	prerequisite modules now handle the DOS stuff.
 	Don't check for unistd.h.
 
+2004-08-03  Simon Josefsson  <jas@extundo.com>
+
+	* strdup.m4: Always run gl_PREREQ_STRDUP, since strdup.h need it.
+
+2004-08-02  Simon Josefsson  <jas@extundo.com>
+
+	* getsubopt.m4: New file.
+
 2004-08-03  Paul Eggert  <eggert@cs.ucla.edu>
 
 	* fatal.m4: Remove, as the "fatal" module wasn't used or working.
--- a/m4/strdup.m4
+++ b/m4/strdup.m4
@@ -1,4 +1,4 @@
-# strdup.m4 serial 3
+# strdup.m4 serial 4
 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
@@ -9,12 +9,9 @@
 AC_DEFUN([gl_FUNC_STRDUP],
 [
   AC_REPLACE_FUNCS(strdup)
-  if test $ac_cv_func_strdup = no; then
-    gl_PREREQ_STRDUP
-  fi
+  AC_CHECK_DECLS_ONCE(strdup)
+  gl_PREREQ_STRDUP
 ])
 
-# Prerequisites of lib/strdup.h and lib/strdup.c.
-AC_DEFUN([gl_PREREQ_STRDUP], [
-  AC_CHECK_DECLS(strdup)
-])
+# Prerequisites of lib/strdup.c.
+AC_DEFUN([gl_PREREQ_STRDUP], [:])