bug-gnulib
[Top][All Lists]
Advanced

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

[Bug-gnulib] make modules usable in shared libraries


From: Bruno Haible
Subject: [Bug-gnulib] make modules usable in shared libraries
Date: Fri, 31 Jan 2003 16:48:45 +0100 (CET)

Hi,

I've added a patch that makes the modules

  rename
  strnlen
  strtod
  utime

usable in shared libraries. When we detect that a function exists in
the system but does not work sufficiently well, we need to a #define
in order to ensure that our modification is taken into account.
(Recall that on ELF system, the precendence order is so that a
function in the main executable overrides the one in libc, but the one
in other shared libraries may or may not override the one in libc - it
depends on the link command line.)

Hope it's uncontroversial.

Bruno


2003-01-31  Bruno Haible  <address@hidden>

        * m4/rename.m4 (vb_FUNC_RENAME): Add a redirection from 'rename' to
        'rpl_rename'.
        * m4/strnlen.m4 (gl_FUNC_STRNLEN): Add a redirection from 'strnlen' to
        'rpl_strnlen'.
        * m4/strtod.m4 (gl_FUNC_STRTOD): Add a redirection from 'strtod' to
        'rpl_strtod'.
        * m4/utime.m4 (jm_FUNC_UTIME): Add a redirection from 'utime' to
        'rpl_utime'.
        * lib/rename.c: #undef rename before defining rpl_rename.
        * lib/strnlen.c: #undef strnlen, define rpl_strnlen instead of strnlen.

*** m4/rename.m4        31 Dec 2002 13:43:06 -0000      1.7
--- m4/rename.m4        31 Jan 2003 15:40:45 -0000
***************
*** 1,4 ****
! #serial 4
  
  dnl From Volker Borchert.
  dnl Determine whether rename works for source paths with a trailing slash.
--- 1,4 ----
! #serial 5
  
  dnl From Volker Borchert.
  dnl Determine whether rename works for source paths with a trailing slash.
***************
*** 33,38 ****
--- 33,40 ----
    ])
    if test $vb_cv_func_rename_trailing_slash_bug = yes; then
      AC_LIBOBJ(rename)
+     AC_DEFINE(rename, rpl_rename,
+       [Define to rpl_rename if the replacement function should be used.])
      AC_DEFINE(RENAME_TRAILING_SLASH_BUG, 1,
        [Define if rename does not work for source paths with a trailing slash,
         like the one from SunOS 4.1.1_U1.])
*** m4/strnlen.m4       31 Dec 2002 13:42:07 -0000      1.3
--- m4/strnlen.m4       31 Jan 2003 15:40:45 -0000
***************
*** 1,5 ****
! # strnlen.m4 serial 1
! dnl Copyright (C) 2002 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
  dnl Public License, this file may be distributed as part of a program
--- 1,5 ----
! # strnlen.m4 serial 2
! dnl Copyright (C) 2002-2003 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
  dnl Public License, this file may be distributed as part of a program
***************
*** 17,22 ****
--- 17,24 ----
      # that the above use of AC_FUNC_STRNLEN means we may have to use
      # lib/strnlen.c.
      #AC_LIBOBJ(strnlen)
+     AC_DEFINE(strnlen, rpl_strnlen,
+       [Define to rpl_strnlen if the replacement function should be used.])
      gl_PREREQ_STRNLEN
    fi
  ])
*** m4/strtod.m4        31 Dec 2002 13:42:07 -0000      1.3
--- m4/strtod.m4        31 Jan 2003 15:40:45 -0000
***************
*** 1,5 ****
! # strtod.m4 serial 1
! dnl Copyright (C) 2002 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
  dnl Public License, this file may be distributed as part of a program
--- 1,5 ----
! # strtod.m4 serial 2
! dnl Copyright (C) 2002-2003 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
  dnl Public License, this file may be distributed as part of a program
***************
*** 10,15 ****
--- 10,17 ----
  [
    AC_REQUIRE([AC_FUNC_STRTOD])
    if test $ac_cv_func_strtod = no; then
+     AC_DEFINE(strtod, rpl_strtod,
+       [Define to rpl_strtod if the replacement function should be used.])
      gl_PREREQ_STRTOD
    fi
  ])
*** m4/utime.m4 31 Dec 2002 13:43:06 -0000      1.4
--- m4/utime.m4 31 Jan 2003 15:40:45 -0000
***************
*** 1,4 ****
! #serial 4
  
  dnl From Jim Meyering
  dnl Replace the utime function on systems that need it.
--- 1,4 ----
! #serial 5
  
  dnl From Jim Meyering
  dnl Replace the utime function on systems that need it.
***************
*** 10,15 ****
--- 10,17 ----
    AC_REQUIRE([AC_FUNC_UTIME_NULL])
    if test $ac_cv_func_utime_null = no; then
      AC_LIBOBJ(utime)
+     AC_DEFINE(utime, rpl_utime,
+       [Define to rpl_utime if the replacement function should be used.])
      gl_PREREQ_UTIME
    fi
  ])
*** lib/rename.c        8 Mar 2002 08:23:47 -0000       1.19
--- lib/rename.c        31 Jan 2003 15:40:45 -0000
***************
*** 1,7 ****
  /* Work around the bug in some systems whereby rename fails when the source
     path has a trailing slash.  The rename functions of SunOS 4.1.1_U1 and
     mips-dec-ultrix4.4 have this bug.
!    Copyright (C) 2001, 2002 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
--- 1,7 ----
  /* Work around the bug in some systems whereby rename fails when the source
     path has a trailing slash.  The rename functions of SunOS 4.1.1_U1 and
     mips-dec-ultrix4.4 have this bug.
!    Copyright (C) 2001-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
***************
*** 19,25 ****
  
  /* written by Volker Borchert */
  
! #include <config.h>
  #include <stdio.h>
  #if HAVE_STDLIB_H
  # include <stdlib.h>
--- 19,29 ----
  
  /* written by Volker Borchert */
  
! #if HAVE_CONFIG_H
! # include <config.h>
! #endif
! #undef rename
! 
  #include <stdio.h>
  #if HAVE_STDLIB_H
  # include <stdlib.h>
*** lib/strnlen.c       2 Mar 2002 17:39:17 -0000       1.7
--- lib/strnlen.c       31 Jan 2003 15:40:45 -0000
***************
*** 1,5 ****
  /* Find the length of STRING, but scan at most MAXLEN characters.
!    Copyright (C) 1996, 1997, 1998, 2000-2002 Free Software Foundation, Inc.
     This file is part of the GNU C Library.
  
     The GNU C Library is free software; you can redistribute it and/or
--- 1,5 ----
  /* Find the length of STRING, but scan at most MAXLEN characters.
!    Copyright (C) 1996, 1997, 1998, 2000-2003 Free Software Foundation, Inc.
     This file is part of the GNU C Library.
  
     The GNU C Library is free software; you can redistribute it and/or
***************
*** 20,35 ****
  #if HAVE_CONFIG_H
  # include <config.h>
  #endif
  
  #if HAVE_STRING_H
  # if !STDC_HEADERS && HAVE_MEMORY_H
  #  include <memory.h>
  # endif
- /* Temporarily redefine strnlen so that an inconsistent prototype
-    (on at least AIX4.3.2.0 w/gcc-2.95.3) doesn't cause trouble.  */
- # define strnlen system_strnlen
  # include <string.h>
- # undef strnlen
  #else
  # include <strings.h>
  #endif
--- 20,32 ----
  #if HAVE_CONFIG_H
  # include <config.h>
  #endif
+ #undef strnlen
  
  #if HAVE_STRING_H
  # if !STDC_HEADERS && HAVE_MEMORY_H
  #  include <memory.h>
  # endif
  # include <string.h>
  #else
  # include <strings.h>
  #endif
***************
*** 43,48 ****
--- 40,49 ----
  
  #undef __strnlen
  #undef strnlen
+ 
+ #ifndef _LIBC
+ # define strnlen rpl_strnlen
+ #endif
  
  #ifndef weak_alias
  # define __strnlen strnlen




reply via email to

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