bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-gnulib] proposed 'string' module for gnulib


From: Bruno Haible
Subject: Re: [bug-gnulib] proposed 'string' module for gnulib
Date: Sat, 27 Jan 2007 15:42:31 +0100 (MET)
User-agent: KMail/1.5.4

Paul Eggert wrote:
>       * m4/memmem.m4 (gl_FUNC_MEMMEM): Set HAVE_DECL_MEMMEM if necessary.
>       * m4/mempcpy.m4 (gl_FUNC_MEMPCPY): Set HAVE_MEMPCPY if necessary.
>       ...

Some ordering constraint is missing here. We have to guarantee that the
HAVE_DECL_MEMMEM=1 statement occurs after the HAVE_DECL_MEMMEM=0 default
in m4/string_h.m4. The module dependency from 'memmem' to 'string' only
ensures that gl_HEADER_STRING_H and gl_HEADER_STRING_H_BODY will be
expanded; it does not ensure that this expansion occurs before the
gl_FUNC_MEMMEM expansion.

I'm committing this fix.

2007-01-27  Bruno Haible  <address@hidden>

        * m4/string_h.m4 (gl_HEADER_STRING_H_DEFAULTS): New macro, extracted
        from gl_HEADER_STRING_H_BODY.
        (gl_HEADER_STRING_H_BODY): Require it.
        * m4/memmem.m4 (gl_FUNC_MEMMEM): Require gl_HEADER_STRING_H_DEFAULTS.
        * m4/mempcpy.m4 (gl_FUNC_MEMPCPY): Likewise.
        * m4/memrchr.m4 (gl_FUNC_MEMRCHR): Likewise.
        * m4/stpcpy.m4 (gl_FUNC_STPCPY): Likewise.
        * m4/stpncpy.m4 (gl_FUNC_STPNCPY): Likewise.
        * m4/strcase.m4 (gl_FUNC_STRCASECMP, gl_FUNC_STRNCASECMP): Likewise.
        * m4/strcasestr.m4 (gl_FUNC_STRCASESTR): Likewise.
        * m4/strchrnul.m4 (gl_FUNC_STRCHRNUL): Likewise.
        * m4/strdup.m4 (gl_FUNC_STRDUP): Likewise.
        * m4/strndup.m4 (gl_FUNC_STRNDUP): Likewise.
        * m4/strnlen.m4 (gl_FUNC_STRNLEN): Likewise.
        * m4/strpbrk.m4 (gl_FUNC_STRPBRK): Likewise.
        * m4/strsep.m4 (gl_FUNC_STRSEP): Likewise.
        * m4/strstr.m4 (gl_FUNC_STRSTR): Likewise.
        * m4/strtok_r.m4 (gl_FUNC_STRTOK_R): Likewise.

*** m4/string_h.m4      27 Jan 2007 13:17:16 -0000      1.2
--- m4/string_h.m4      27 Jan 2007 14:31:22 -0000
***************
*** 17,26 ****
--- 17,30 ----
  AC_DEFUN([gl_HEADER_STRING_H_BODY],
  [
    AC_REQUIRE([AC_C_RESTRICT])
+   AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
    gl_ABSOLUTE_HEADER([string.h])
    ABSOLUTE_STRING_H=\"$gl_cv_absolute_string_h\"
    AC_SUBST([ABSOLUTE_STRING_H])
+ ])
  
+ AC_DEFUN([gl_HEADER_STRING_H_DEFAULTS],
+ [
    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])
*** m4/memmem.m4        26 Jan 2007 22:16:55 -0000      1.3
--- m4/memmem.m4        27 Jan 2007 14:31:22 -0000
***************
*** 1,4 ****
! # memmem.m4 serial 3
  dnl Copyright (C) 2002, 2003, 2004, 2007 Free Software Foundation, Inc.
  dnl This file is free software; the Free Software Foundation
  dnl gives unlimited permission to copy and/or distribute it,
--- 1,4 ----
! # memmem.m4 serial 4
  dnl Copyright (C) 2002, 2003, 2004, 2007 Free Software Foundation, Inc.
  dnl This file is free software; the Free Software Foundation
  dnl gives unlimited permission to copy and/or distribute it,
***************
*** 9,14 ****
--- 9,15 ----
    dnl Persuade glibc <string.h> to declare memmem().
    AC_REQUIRE([AC_GNU_SOURCE])
  
+   AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
    AC_REPLACE_FUNCS(memmem)
    AC_CHECK_DECLS_ONCE(memmem)
    if test $ac_cv_have_decl_memmem = no; then
*** m4/mempcpy.m4       26 Jan 2007 22:16:55 -0000      1.4
--- m4/mempcpy.m4       27 Jan 2007 14:31:22 -0000
***************
*** 1,4 ****
! # mempcpy.m4 serial 5
  dnl Copyright (C) 2003, 2004, 2006, 2007 Free Software Foundation, Inc.
  dnl This file is free software; the Free Software Foundation
  dnl gives unlimited permission to copy and/or distribute it,
--- 1,4 ----
! # mempcpy.m4 serial 6
  dnl Copyright (C) 2003, 2004, 2006, 2007 Free Software Foundation, Inc.
  dnl This file is free software; the Free Software Foundation
  dnl gives unlimited permission to copy and/or distribute it,
***************
*** 6,15 ****
  
  AC_DEFUN([gl_FUNC_MEMPCPY],
  [
- 
    dnl Persuade glibc <string.h> to declare mempcpy().
    AC_REQUIRE([AC_GNU_SOURCE])
  
    AC_REPLACE_FUNCS(mempcpy)
    if test $ac_cv_func_mempcpy = no; then
      HAVE_MEMPCPY=0
--- 6,15 ----
  
  AC_DEFUN([gl_FUNC_MEMPCPY],
  [
    dnl Persuade glibc <string.h> to declare mempcpy().
    AC_REQUIRE([AC_GNU_SOURCE])
  
+   AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
    AC_REPLACE_FUNCS(mempcpy)
    if test $ac_cv_func_mempcpy = no; then
      HAVE_MEMPCPY=0
*** m4/memrchr.m4       26 Jan 2007 22:16:55 -0000      1.7
--- m4/memrchr.m4       27 Jan 2007 14:31:22 -0000
***************
*** 1,4 ****
! # memrchr.m4 serial 6
  dnl Copyright (C) 2002, 2003, 2005, 2006, 2007 Free Software Foundation, Inc.
  dnl This file is free software; the Free Software Foundation
  dnl gives unlimited permission to copy and/or distribute it,
--- 1,4 ----
! # memrchr.m4 serial 7
  dnl Copyright (C) 2002, 2003, 2005, 2006, 2007 Free Software Foundation, Inc.
  dnl This file is free software; the Free Software Foundation
  dnl gives unlimited permission to copy and/or distribute it,
***************
*** 9,14 ****
--- 9,15 ----
    dnl Persuade glibc <string.h> to declare memrchr().
    AC_REQUIRE([AC_GNU_SOURCE])
  
+   AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
    AC_CHECK_DECLS_ONCE([memrchr])
    if test $ac_cv_have_decl_memrchr = no; then
      HAVE_DECL_MEMRCHR=0
*** m4/stpcpy.m4        26 Jan 2007 22:16:55 -0000      1.3
--- m4/stpcpy.m4        27 Jan 2007 14:31:22 -0000
***************
*** 1,4 ****
! # stpcpy.m4 serial 2
  dnl Copyright (C) 2002, 2007 Free Software Foundation, Inc.
  dnl This file is free software; the Free Software Foundation
  dnl gives unlimited permission to copy and/or distribute it,
--- 1,4 ----
! # stpcpy.m4 serial 3
  dnl Copyright (C) 2002, 2007 Free Software Foundation, Inc.
  dnl This file is free software; the Free Software Foundation
  dnl gives unlimited permission to copy and/or distribute it,
***************
*** 9,14 ****
--- 9,15 ----
    dnl Persuade glibc <string.h> to declare stpcpy().
    AC_REQUIRE([AC_GNU_SOURCE])
  
+   AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
    AC_REPLACE_FUNCS(stpcpy)
    if test $ac_cv_func_stpcpy = no; then
      HAVE_STPCPY=0
*** m4/stpncpy.m4       26 Jan 2007 22:16:55 -0000      1.8
--- m4/stpncpy.m4       27 Jan 2007 14:31:22 -0000
***************
*** 1,4 ****
! # stpncpy.m4 serial 5
  dnl Copyright (C) 2002-2003, 2005-2007 Free Software Foundation, Inc.
  dnl This file is free software; the Free Software Foundation
  dnl gives unlimited permission to copy and/or distribute it,
--- 1,4 ----
! # stpncpy.m4 serial 6
  dnl Copyright (C) 2002-2003, 2005-2007 Free Software Foundation, Inc.
  dnl This file is free software; the Free Software Foundation
  dnl gives unlimited permission to copy and/or distribute it,
***************
*** 9,14 ****
--- 9,16 ----
    dnl Persuade glibc <string.h> to declare stpncpy().
    AC_REQUIRE([AC_GNU_SOURCE])
  
+   AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
+ 
    dnl Both glibc and AIX (4.3.3, 5.1) have an stpncpy() function
    dnl declared in <string.h>. Its side effects are the same as those
    dnl of strncpy():
*** m4/strcase.m4       26 Jan 2007 22:16:55 -0000      1.7
--- m4/strcase.m4       27 Jan 2007 14:31:22 -0000
***************
*** 1,4 ****
! # strcase.m4 serial 5
  dnl Copyright (C) 2002, 2005-2007 Free Software Foundation, Inc.
  dnl This file is free software; the Free Software Foundation
  dnl gives unlimited permission to copy and/or distribute it,
--- 1,4 ----
! # strcase.m4 serial 6
  dnl Copyright (C) 2002, 2005-2007 Free Software Foundation, Inc.
  dnl This file is free software; the Free Software Foundation
  dnl gives unlimited permission to copy and/or distribute it,
***************
*** 12,26 ****
  
  AC_DEFUN([gl_FUNC_STRCASECMP],
  [
    dnl No known system has a strcasecmp() function that works correctly in
    dnl multibyte locales. Therefore we use our version always.
    AC_LIBOBJ(strcasecmp)
-   gl_PREREQ_STRCASECMP
    REPLACE_STRCASECMP=1
  ])
  
  AC_DEFUN([gl_FUNC_STRNCASECMP],
  [
    AC_REPLACE_FUNCS(strncasecmp)
    if test $ac_cv_func_strncasecmp = no; then
      gl_PREREQ_STRNCASECMP
--- 12,28 ----
  
  AC_DEFUN([gl_FUNC_STRCASECMP],
  [
+   AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
    dnl No known system has a strcasecmp() function that works correctly in
    dnl multibyte locales. Therefore we use our version always.
    AC_LIBOBJ(strcasecmp)
    REPLACE_STRCASECMP=1
+   gl_PREREQ_STRCASECMP
  ])
  
  AC_DEFUN([gl_FUNC_STRNCASECMP],
  [
+   AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
    AC_REPLACE_FUNCS(strncasecmp)
    if test $ac_cv_func_strncasecmp = no; then
      gl_PREREQ_STRNCASECMP
*** m4/strcasestr.m4    27 Jan 2007 13:17:16 -0000      1.3
--- m4/strcasestr.m4    27 Jan 2007 14:31:22 -0000
***************
*** 1,4 ****
! # strcasestr.m4 serial 3
  dnl Copyright (C) 2005, 2007 Free Software Foundation, Inc.
  dnl This file is free software; the Free Software Foundation
  dnl gives unlimited permission to copy and/or distribute it,
--- 1,4 ----
! # strcasestr.m4 serial 4
  dnl Copyright (C) 2005, 2007 Free Software Foundation, Inc.
  dnl This file is free software; the Free Software Foundation
  dnl gives unlimited permission to copy and/or distribute it,
***************
*** 6,11 ****
--- 6,12 ----
  
  AC_DEFUN([gl_FUNC_STRCASESTR],
  [
+   AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
    dnl No known system has a strcasestr() function that works correctly in
    dnl multibyte locales. Therefore we use our version always.
    AC_LIBOBJ(strcasestr)
*** m4/strchrnul.m4     26 Jan 2007 22:16:55 -0000      1.4
--- m4/strchrnul.m4     27 Jan 2007 14:31:22 -0000
***************
*** 1,4 ****
! # strchrnul.m4 serial 4
  dnl Copyright (C) 2003, 2007 Free Software Foundation, Inc.
  dnl This file is free software; the Free Software Foundation
  dnl gives unlimited permission to copy and/or distribute it,
--- 1,4 ----
! # strchrnul.m4 serial 5
  dnl Copyright (C) 2003, 2007 Free Software Foundation, Inc.
  dnl This file is free software; the Free Software Foundation
  dnl gives unlimited permission to copy and/or distribute it,
***************
*** 9,14 ****
--- 9,15 ----
    dnl Persuade glibc <string.h> to declare strchrnul().
    AC_REQUIRE([AC_GNU_SOURCE])
  
+   AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
    AC_REPLACE_FUNCS(strchrnul)
    if test $ac_cv_func_strchrnul = no; then
      HAVE_STRCHRNUL=0
*** m4/strdup.m4        26 Jan 2007 22:16:55 -0000      1.8
--- m4/strdup.m4        27 Jan 2007 14:31:22 -0000
***************
*** 1,4 ****
! # strdup.m4 serial 8
  
  dnl Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Free Software
  dnl Foundation, Inc.
--- 1,4 ----
! # strdup.m4 serial 9
  
  dnl Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Free Software
  dnl Foundation, Inc.
***************
*** 9,14 ****
--- 9,15 ----
  
  AC_DEFUN([gl_FUNC_STRDUP],
  [
+   AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
    AC_REPLACE_FUNCS(strdup)
    AC_CHECK_DECLS_ONCE(strdup)
    if test $ac_cv_have_decl_strdup = no; then
*** m4/strndup.m4       26 Jan 2007 22:16:55 -0000      1.13
--- m4/strndup.m4       27 Jan 2007 14:31:22 -0000
***************
*** 1,4 ****
! # strndup.m4 serial 12
  dnl Copyright (C) 2002-2003, 2005-2007 Free Software Foundation, Inc.
  dnl This file is free software; the Free Software Foundation
  dnl gives unlimited permission to copy and/or distribute it,
--- 1,4 ----
! # strndup.m4 serial 13
  dnl Copyright (C) 2002-2003, 2005-2007 Free Software Foundation, Inc.
  dnl This file is free software; the Free Software Foundation
  dnl gives unlimited permission to copy and/or distribute it,
***************
*** 9,14 ****
--- 9,15 ----
    dnl Persuade glibc <string.h> to declare strndup().
    AC_REQUIRE([AC_GNU_SOURCE])
  
+   AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
    AC_CHECK_DECLS_ONCE([strndup])
    if test $ac_cv_have_decl_strndup = no; then
      HAVE_DECL_STRNDUP=0
*** m4/strnlen.m4       26 Jan 2007 22:16:55 -0000      1.9
--- m4/strnlen.m4       27 Jan 2007 14:31:22 -0000
***************
*** 1,5 ****
! # strnlen.m4 serial 7
! dnl Copyright (C) 2002-2003, 2005, 2006, 2007 Free Software 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.
--- 1,5 ----
! # strnlen.m4 serial 8
! dnl Copyright (C) 2002-2003, 2005-2007 Free Software 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,14 ****
--- 9,15 ----
    dnl Persuade glibc <string.h> to declare strnlen().
    AC_REQUIRE([AC_GNU_SOURCE])
  
+   AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
    AC_CHECK_DECLS_ONCE([strnlen])
    if test $ac_cv_have_decl_strnlen = no; then
      HAVE_DECL_STRNLEN=0
*** m4/strpbrk.m4       26 Jan 2007 22:16:55 -0000      1.4
--- m4/strpbrk.m4       27 Jan 2007 14:31:22 -0000
***************
*** 1,4 ****
! # strpbrk.m4 serial 3
  dnl Copyright (C) 2002-2003, 2007 Free Software Foundation, Inc.
  dnl This file is free software; the Free Software Foundation
  dnl gives unlimited permission to copy and/or distribute it,
--- 1,4 ----
! # strpbrk.m4 serial 4
  dnl Copyright (C) 2002-2003, 2007 Free Software Foundation, Inc.
  dnl This file is free software; the Free Software Foundation
  dnl gives unlimited permission to copy and/or distribute it,
***************
*** 6,11 ****
--- 6,12 ----
  
  AC_DEFUN([gl_FUNC_STRPBRK],
  [
+   AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
    AC_REPLACE_FUNCS(strpbrk)
    if test $ac_cv_func_strpbrk = no; then
      HAVE_STRPBRK=0
*** m4/strsep.m4        26 Jan 2007 22:16:55 -0000      1.4
--- m4/strsep.m4        27 Jan 2007 14:31:22 -0000
***************
*** 1,4 ****
! # strsep.m4 serial 4
  dnl Copyright (C) 2002, 2003, 2004, 2007 Free Software Foundation, Inc.
  dnl This file is free software; the Free Software Foundation
  dnl gives unlimited permission to copy and/or distribute it,
--- 1,4 ----
! # strsep.m4 serial 5
  dnl Copyright (C) 2002, 2003, 2004, 2007 Free Software Foundation, Inc.
  dnl This file is free software; the Free Software Foundation
  dnl gives unlimited permission to copy and/or distribute it,
***************
*** 9,14 ****
--- 9,15 ----
    dnl Persuade glibc <string.h> to declare strsep().
    AC_REQUIRE([AC_GNU_SOURCE])
  
+   AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
    AC_REPLACE_FUNCS(strsep)
    if test $ac_cv_func_strsep = no; then
      HAVE_STRSEP=0
*** m4/strstr.m4        26 Jan 2007 22:16:55 -0000      1.7
--- m4/strstr.m4        27 Jan 2007 14:31:22 -0000
***************
*** 1,16 ****
! # strstr.m4 serial 5
! dnl Copyright (C) 2002-2003, 2005 Free Software 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.
  
  AC_DEFUN([gl_FUNC_STRSTR],
  [
    dnl No known system has a strstr() function that works correctly in
    dnl multibyte locales. Therefore we use our version always.
    AC_LIBOBJ(strstr)
-   gl_PREREQ_STRSTR
    REPLACE_STRSTR=1
  ])
  
  # Prerequisites of lib/strstr.c.
--- 1,17 ----
! # strstr.m4 serial 6
! dnl Copyright (C) 2002-2003, 2005, 2007 Free Software 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.
  
  AC_DEFUN([gl_FUNC_STRSTR],
  [
+   AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
    dnl No known system has a strstr() function that works correctly in
    dnl multibyte locales. Therefore we use our version always.
    AC_LIBOBJ(strstr)
    REPLACE_STRSTR=1
+   gl_PREREQ_STRSTR
  ])
  
  # Prerequisites of lib/strstr.c.
*** m4/strtok_r.m4      26 Jan 2007 22:16:55 -0000      1.4
--- m4/strtok_r.m4      27 Jan 2007 14:31:22 -0000
***************
*** 1,4 ****
! # strtok_r.m4 serial 4
  dnl Copyright (C) 2002, 2003, 2004, 2007 Free Software Foundation, Inc.
  dnl This file is free software; the Free Software Foundation
  dnl gives unlimited permission to copy and/or distribute it,
--- 1,4 ----
! # strtok_r.m4 serial 5
  dnl Copyright (C) 2002, 2003, 2004, 2007 Free Software Foundation, Inc.
  dnl This file is free software; the Free Software Foundation
  dnl gives unlimited permission to copy and/or distribute it,
***************
*** 6,11 ****
--- 6,12 ----
  
  AC_DEFUN([gl_FUNC_STRTOK_R],
  [
+   AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
    AC_REPLACE_FUNCS(strtok_r)
    AC_CHECK_DECLS_ONCE(strtok_r)
    if test $ac_cv_have_decl_strtok_r = no; then





reply via email to

[Prev in Thread] Current Thread [Next in Thread]