strverscmp: migrate from "strverscmp.h" to <string.h>
authorEric Blake <ebb9@byu.net>
Tue, 19 Aug 2008 15:23:40 +0000 (09:23 -0600)
committerEric Blake <ebb9@byu.net>
Tue, 19 Aug 2008 16:48:46 +0000 (10:48 -0600)
* modules/string (Makefile.am): Add new hooks.
* modules/strverscmp (Files): Remove strverscmp.h.
(Depends-on): Add string.
(configure.ac): Add indicator.
(Include): Mention new header.
* m4/string_h.m4 (gl_HEADER_STRING_H_DEFAULTS): Provide new
defaults.
* m4/strverscmp.m4 (gl_FUNC_STRVERSCMP): Inform string module of
results.
* lib/strverscmp.h: Delete.
* lib/string.in.h (strverscmp): Provide declaration, when needed.
* tests/test-strverscmp.c (includes): Adjust client.
* lib/check-version.c (includes): Likewise.
* NEWS: Document the change.

Signed-off-by: Eric Blake <ebb9@byu.net>
ChangeLog
NEWS
lib/check-version.c
lib/string.in.h
lib/strverscmp.h [deleted file]
m4/string_h.m4
m4/strverscmp.m4
modules/string
modules/strverscmp
tests/test-strverscmp.c

index 35c2013..6008e52 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,21 @@
 2008-08-19  Eric Blake  <ebb9@byu.net>
 
+       strverscmp: migrate from "strverscmp.h" to <string.h>
+       * modules/string (Makefile.am): Add new hooks.
+       * modules/strverscmp (Files): Remove strverscmp.h.
+       (Depends-on): Add string.
+       (configure.ac): Add indicator.
+       (Include): Mention new header.
+       * m4/string_h.m4 (gl_HEADER_STRING_H_DEFAULTS): Provide new
+       defaults.
+       * m4/strverscmp.m4 (gl_FUNC_STRVERSCMP): Inform string module of
+       results.
+       * lib/strverscmp.h: Delete.
+       * lib/string.in.h (strverscmp): Provide declaration, when needed.
+       * tests/test-strverscmp.c (includes): Adjust client.
+       * lib/check-version.c (includes): Likewise.
+       * NEWS: Document the change.
+
        strverscmp: add unit test
        * modules/strverscmp-tests: New file.
        * tests/test-strverscmp.c: Likewise.
diff --git a/NEWS b/NEWS
index b5b08a6..7b918d3 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,9 @@ User visible incompatible changes
 
 Date        Modules         Changes
 
+2008-08-19  strverscmp      The include file is changed from "strverscmp.h"
+                            to <string.h>.
+
 2008-08-14  lock            The include file is changed from "lock.h"
                             to "glthread/lock.h".
             tls             The include file is changed from "tls.h"
index c4074ae..5152b9c 100644 (file)
@@ -1,6 +1,6 @@
 /* check-version.h --- Check version string compatibility.
-   Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free
-   Software Foundation, Inc.
+   Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+   2008 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -23,7 +23,7 @@
 #include <config.h>
 
 #include <stddef.h>
-#include <strverscmp.h>
+#include <string.h>
 
 /* Get specification. */
 #include "check-version.h"
index 49ea1d8..e62b8dd 100644 (file)
@@ -576,6 +576,18 @@ extern char *strsignal (int __sig);
      strsignal (a))
 #endif
 
+#if @GNULIB_STRVERSCMP@
+# if !@HAVE_STRVERSCMP@
+extern int strverscmp (const char *, const char *);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef strverscmp
+# define strverscmp(a, b) \
+    (GL_LINK_WARNING ("strverscmp is unportable - " \
+                      "use gnulib module strverscmp for portability"), \
+     strverscmp (a, b))
+#endif
+
 
 #ifdef __cplusplus
 }
diff --git a/lib/strverscmp.h b/lib/strverscmp.h
deleted file mode 100644 (file)
index 7edeac5..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-/* Compare strings while treating digits characters numerically.
-
-   Copyright (C) 1997, 2003 Free Software Foundation, Inc.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2, or (at your option)
-   any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
-
-#ifndef STRVERSCMP_H_
-# define STRVERSCMP_H_
-
-int strverscmp (const char *, const char *);
-
-#endif /* not STRVERSCMP_H_ */
index 7143690..b37f843 100644 (file)
@@ -5,7 +5,7 @@
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 4
+# serial 5
 
 # Written by Paul Eggert.
 
@@ -63,6 +63,7 @@ AC_DEFUN([gl_HEADER_STRING_H_DEFAULTS],
   GNULIB_MBSTOK_R=0;    AC_SUBST([GNULIB_MBSTOK_R])
   GNULIB_STRERROR=0;    AC_SUBST([GNULIB_STRERROR])
   GNULIB_STRSIGNAL=0;   AC_SUBST([GNULIB_STRSIGNAL])
+  GNULIB_STRVERSCMP=0;   AC_SUBST([GNULIB_STRVERSCMP])
   dnl Assume proper GNU behavior unless another module says otherwise.
   HAVE_DECL_MEMMEM=1;          AC_SUBST([HAVE_DECL_MEMMEM])
   HAVE_MEMPCPY=1;              AC_SUBST([HAVE_MEMPCPY])
@@ -81,6 +82,7 @@ AC_DEFUN([gl_HEADER_STRING_H_DEFAULTS],
   HAVE_DECL_STRTOK_R=1;                AC_SUBST([HAVE_DECL_STRTOK_R])
   HAVE_DECL_STRERROR=1;                AC_SUBST([HAVE_DECL_STRERROR])
   HAVE_DECL_STRSIGNAL=1;       AC_SUBST([HAVE_DECL_STRSIGNAL])
+  HAVE_STRVERSCMP=1;           AC_SUBST([HAVE_STRVERSCMP])
   REPLACE_STRERROR=0;          AC_SUBST([REPLACE_STRERROR])
   REPLACE_STRSIGNAL=0;         AC_SUBST([REPLACE_STRSIGNAL])
   REPLACE_MEMMEM=0;            AC_SUBST([REPLACE_MEMMEM])
index 5f01ba9..a3f9aff 100644 (file)
@@ -1,5 +1,6 @@
-# strverscmp.m4 serial 5
-dnl Copyright (C) 2002, 2005, 2006, 2007 Free Software Foundation, Inc.
+# strverscmp.m4 serial 6
+dnl Copyright (C) 2002, 2005, 2006, 2007, 2008 Free Software
+dnl Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
@@ -9,9 +10,11 @@ AC_DEFUN([gl_FUNC_STRVERSCMP],
   dnl Persuade glibc <string.h> to declare strverscmp().
   AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
 
+  AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
   AC_REPLACE_FUNCS(strverscmp)
   if test $ac_cv_func_strverscmp = no; then
     gl_PREREQ_STRVERSCMP
+    HAVE_STRVERSCMP=0
   fi
 ])
 
index 6ca5c23..dc0063d 100644 (file)
@@ -54,6 +54,7 @@ string.h: string.in.h
              -e 's|@''GNULIB_STRTOK_R''@|$(GNULIB_STRTOK_R)|g' \
              -e 's|@''GNULIB_STRERROR''@|$(GNULIB_STRERROR)|g' \
              -e 's|@''GNULIB_STRSIGNAL''@|$(GNULIB_STRSIGNAL)|g' \
+             -e 's|@''GNULIB_STRVERSCMP''@|$(GNULIB_STRVERSCMP)|g' \
              -e 's|@''HAVE_DECL_MEMMEM''@|$(HAVE_DECL_MEMMEM)|g' \
              -e 's|@''HAVE_MEMPCPY''@|$(HAVE_MEMPCPY)|g' \
              -e 's|@''HAVE_DECL_MEMRCHR''@|$(HAVE_DECL_MEMRCHR)|g' \
@@ -71,6 +72,7 @@ string.h: string.in.h
              -e 's|@''HAVE_DECL_STRTOK_R''@|$(HAVE_DECL_STRTOK_R)|g' \
              -e 's|@''HAVE_DECL_STRERROR''@|$(HAVE_DECL_STRERROR)|g' \
              -e 's|@''HAVE_DECL_STRSIGNAL''@|$(HAVE_DECL_STRSIGNAL)|g' \
+             -e 's|@''HAVE_STRVERSCMP''@|$(HAVE_STRVERSCMP)|g' \
              -e 's|@''REPLACE_MEMMEM''@|$(REPLACE_MEMMEM)|g' \
              -e 's|@''REPLACE_STRCASESTR''@|$(REPLACE_STRCASESTR)|g' \
              -e 's|@''REPLACE_STRSTR''@|$(REPLACE_STRSTR)|g' \
index ad18c1f..33822c7 100644 (file)
@@ -2,20 +2,21 @@ Description:
 Compare strings holding version numbers.
 
 Files:
-lib/strverscmp.h
 lib/strverscmp.c
 m4/strverscmp.m4
 
 Depends-on:
 extensions
+string
 
 configure.ac:
 gl_FUNC_STRVERSCMP
+gl_STRING_MODULE_INDICATOR([strverscmp])
 
 Makefile.am:
 
 Include:
-"strverscmp.h"
+<string.h>
 
 License:
 LGPLv2+
index 605b0f6..04da20c 100644 (file)
@@ -19,7 +19,7 @@
 
 #include <config.h>
 
-#include "strverscmp.h"
+#include <string.h>
 
 #include <stdio.h>
 #include <stdlib.h>