From: Eric Blake Date: Tue, 19 Aug 2008 15:23:40 +0000 (-0600) Subject: strverscmp: migrate from "strverscmp.h" to X-Git-Tag: v0.1~7135^2~1 X-Git-Url: http://erislabs.net/gitweb/?a=commitdiff_plain;h=b6d87f536521a59758453d8dbd071e7cd6efc39d;p=gnulib.git strverscmp: migrate from "strverscmp.h" to * 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 --- diff --git a/ChangeLog b/ChangeLog index 35c2013bd..6008e5272 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,21 @@ 2008-08-19 Eric Blake + strverscmp: migrate from "strverscmp.h" to + * 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 b5b08a60f..7b918d346 100644 --- 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 . + 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" diff --git a/lib/check-version.c b/lib/check-version.c index c4074ae80..5152b9ca4 100644 --- a/lib/check-version.c +++ b/lib/check-version.c @@ -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 #include -#include +#include /* Get specification. */ #include "check-version.h" diff --git a/lib/string.in.h b/lib/string.in.h index 49ea1d831..e62b8dd2e 100644 --- a/lib/string.in.h +++ b/lib/string.in.h @@ -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 index 7edeac5e4..000000000 --- a/lib/strverscmp.h +++ /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_ */ diff --git a/m4/string_h.m4 b/m4/string_h.m4 index 7143690eb..b37f843ab 100644 --- a/m4/string_h.m4 +++ b/m4/string_h.m4 @@ -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]) diff --git a/m4/strverscmp.m4 b/m4/strverscmp.m4 index 5f01ba9e5..a3f9aff4b 100644 --- a/m4/strverscmp.m4 +++ b/m4/strverscmp.m4 @@ -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 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 ]) diff --git a/modules/string b/modules/string index 6ca5c2301..dc0063dc2 100644 --- a/modules/string +++ b/modules/string @@ -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' \ diff --git a/modules/strverscmp b/modules/strverscmp index ad18c1f84..33822c76e 100644 --- a/modules/strverscmp +++ b/modules/strverscmp @@ -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" + License: LGPLv2+ diff --git a/tests/test-strverscmp.c b/tests/test-strverscmp.c index 605b0f6d1..04da20c10 100644 --- a/tests/test-strverscmp.c +++ b/tests/test-strverscmp.c @@ -19,7 +19,7 @@ #include -#include "strverscmp.h" +#include #include #include