]> git.ipfire.org Git - thirdparty/libtool.git/commitdiff
Keywords:
authorGary V. Vaughan <gary@gnu.org>
Thu, 8 Apr 2004 13:06:16 +0000 (13:06 +0000)
committerGary V. Vaughan <gary@gnu.org>
Thu, 8 Apr 2004 13:06:16 +0000 (13:06 +0000)
Factor out the bottom portability layer from ltdl.  Code in this
layer has global symbols renamed by lt__pre89.h, and may not
refer to any symbols except those provided by the system libraries
or other code in the portability layer:

* libltdl/lt__pre89.h: New file.  Rename all the symbols from
LTLIBOBJS into the lt__ namespace so that they don't clash with
other libraries.
* libltdl/ltdl.c (rpl_memcpy, rpl_memmove, rpl_strchr, rpl_strcmp)
(rpl_strrchr): Moved from here...
* libltdl/memcpy.c (memcpy): ...to here, and fixed void *
dereference bug...
* libltdl/memmove.c (memmove): ...to here, and fixed void *
dereference bug...
* libltdl/strchr.c (strchr): ...to here...
* libltdl/strcmp.c (strcmp): ...here...
* libltdl/strrchr.c (strrchr): ...and here.
* libltdl/Makefile.am (libltdl_la_SOURCES): Add lt__pre89.h.
(libltdl_la_LIBADD, libltdlc_la_LIBADD): Add $(LTLIBOBJS).
(ltdldata_DATA): Add replacement sources files.
* m4/ltdl.m4 (AC_LIB_LTDL): Do careful config.h and LTLIBOBJ
setting for missing pre89 functions.

$Revision: 1.1470 $ $Date: 2004/04/08 12:01:57 $

ChangeLog
libltdl/Makefile.am
libltdl/ltdl.c
m4/ltdl.m4

index 662e0510dde65e80fc0aa58db1f24fba38beea6a..351edeae8b0039475867911180066febd3ca31dc 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,28 @@
+2004-04-08  Gary V. Vaughan  <gary@gnu.org>
+
+       Factor out the bottom portability layer from ltdl.  Code in this
+       layer has global symbols renamed by lt__pre89.h, and may not
+       refer to any symbols except those provided by the system libraries
+       or other code in the portability layer:
+
+       * libltdl/lt__pre89.h: New file.  Rename all the symbols from
+       LTLIBOBJS into the lt__ namespace so that they don't clash with
+       other libraries.
+       * libltdl/ltdl.c (rpl_memcpy, rpl_memmove, rpl_strchr, rpl_strcmp)
+       (rpl_strrchr): Moved from here...
+       * libltdl/memcpy.c (memcpy): ...to here, and fixed void *
+       dereference bug...
+       * libltdl/memmove.c (memmove): ...to here, and fixed void *
+       dereference bug...
+       * libltdl/strchr.c (strchr): ...to here...
+       * libltdl/strcmp.c (strcmp): ...here...
+       * libltdl/strrchr.c (strrchr): ...and here.
+       * libltdl/Makefile.am (libltdl_la_SOURCES): Add lt__pre89.h.
+       (libltdl_la_LIBADD, libltdlc_la_LIBADD): Add $(LTLIBOBJS).
+       (ltdldata_DATA): Add replacement sources files.
+       * m4/ltdl.m4 (AC_LIB_LTDL): Do careful config.h and LTLIBOBJ
+       setting for missing pre89 functions.
+
 2004-04-08  Gary V. Vaughan  <gary@gnu.org>
 
        * libltdl/ltdl.h (LT_PARAMS): Removed.  Changed all users to
index 89857f5f4fe54fb649289eff331ca86dd082a256..a5096df5920da3abfa94557aeb1efadec129804d 100644 (file)
@@ -38,14 +38,16 @@ endif
 ## default.
 CLEANFILES = libltdl.la libltdlc.la
 
-libltdl_la_SOURCES = lt__alloc.c lt__alloc.h lt_system.h ltdl.c ltdl.h
+libltdl_la_SOURCES = lt__alloc.c lt__alloc.h lt__pre89.h lt_system.h \
+                    ltdl.c ltdl.h
 libltdl_la_LDFLAGS = -no-undefined -version-info 5:0:2
-libltdl_la_LIBADD = $(LIBADD_DL)
+libltdl_la_LIBADD = $(LIBADD_DL) $(LTLIBOBJS)
 
 libltdlc_la_SOURCES = $(libltdl_la_SOURCES)
-libltdlc_la_LIBADD = $(LIBADD_DL)
+libltdlc_la_LIBADD = $(LIBADD_DL) $(LTLIBOBJS)
 
 ## These are installed as a subdirectory of pkgdatadir so that
 ## libtoolize --ltdl can find them later:
 ltdldatadir = $(pkgdatadir)/libltdl
-ltdldata_DATA = COPYING.LIB Makefile.am README $(libltdl_la_SOURCES)
+ltdldata_DATA = COPYING.LIB Makefile.am README $(libltdl_la_SOURCES) \
+               memcpy.c memmove.c strchr.c strcmp.c strrchr.c
index 41224cebbcc0fa50f23afcc03def308cf50a41bb..620a281aaefa7e1e1e26bf61fb2b4bfd11aed2e5 100644 (file)
@@ -71,6 +71,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
 
 #include "ltdl.h"
 #include "lt__alloc.h"
+#include "lt__pre89.h"
 
 #if defined(HAVE_CLOSEDIR) && defined(HAVE_OPENDIR) && defined(HAVE_READDIR) && defined(HAVE_DIRENT_H)
 /* We have a fully operational dirent subsystem.  */
@@ -141,134 +142,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
 
 
 
-\f
-/* --- REPLACEMENT FUNCTIONS --- */
-
-
-#if ! HAVE_STRCMP
-
-#undef strcmp
-#define strcmp rpl_strcmp
-
-static int
-strcmp (const char *str1, const char *str2)
-{
-  if (str1 == str2)
-    return 0;
-  if (str1 == 0)
-    return -1;
-  if (str2 == 0)
-    return 1;
-
-  for (;*str1 && *str2; ++str1, ++str2)
-    {
-      if (*str1 != *str2)
-       break;
-    }
-
-  return (int)(*str1 - *str2);
-}
-#endif
-
-
-#if ! HAVE_STRCHR
-
-#  if HAVE_INDEX
-#    define strchr index
-#  else
-#    define strchr rpl_strchr
-
-static const char *
-strchr (const char *str, int ch)
-{
-  const char *p;
-
-  for (p = str; *p != (char)ch && *p != LT_EOS_CHAR; ++p)
-    /*NOWORK*/;
-
-  return (*p == (char)ch) ? p : 0;
-}
-
-#  endif
-#endif /* !HAVE_STRCHR */
-
-
-#if ! HAVE_STRRCHR
-
-#  if HAVE_RINDEX
-#    define strrchr rindex
-#  else
-#    define strrchr rpl_strrchr
-
-static const char *
-strrchr (const char *str, int ch)
-{
-  const char *p, *q = 0;
-
-  for (p = str; *p != LT_EOS_CHAR; ++p)
-    {
-      if (*p == (char) ch)
-       {
-         q = p;
-       }
-    }
-
-  return q;
-}
-
-# endif
-#endif
-
-/* NOTE:  Neither bcopy nor the memcpy implementation below can
-          reliably handle copying in overlapping areas of memory.  Use
-          memmove (for which there is a fallback implmentation below)
-         if you need that behaviour.  */
-#if ! HAVE_MEMCPY
-
-#  if HAVE_BCOPY
-#    define memcpy(dest, src, size)    bcopy (src, dest, size)
-#  else
-#    define memcpy rpl_memcpy
-
-static void *
-memcpy (void *dest, const void *src, size_t size)
-{
-  size_t i = 0;
-
-  for (i = 0; i < size; ++i)
-    {
-      dest[i] = src[i];
-    }
-
-  return dest;
-}
-
-#  endif /* !HAVE_BCOPY */
-#endif   /* !HAVE_MEMCPY */
-
-#if ! HAVE_MEMMOVE
-#  define memmove rpl_memmove
-
-static void *
-memmove (void *dest, const void *src, size_t size)
-{
-  size_t i;
-
-  if (dest < src)
-    for (i = 0; i < size; ++i)
-      {
-       dest[i] = src[i];
-      }
-  else if (dest > src)
-    for (i = size -1; i >= 0; --i)
-      {
-       dest[i] = src[i];
-      }
-
-  return dest;
-}
-
-#endif /* !HAVE_MEMMOVE */
 
 # if LT_USE_WINDOWS_DIRENT_EMULATION
 
index 57cb062f963e6c4ea0271089b2fd15412a8d6e8d..fc9cfb5a99514569ec676caaac58ca063495d600 100644 (file)
@@ -110,10 +110,23 @@ AC_CHECK_HEADERS([assert.h ctype.h errno.h malloc.h memory.h stdlib.h \
        [], [], [AC_INCLUDES_DEFAULT])
 AC_CHECK_HEADERS([string.h strings.h], [break], [], [AC_INCLUDES_DEFAULT])
 
-AC_CHECK_FUNCS([strchr index], [break])
-AC_CHECK_FUNCS([strrchr rindex], [break])
-AC_CHECK_FUNCS([memcpy bcopy], [break])
-AC_CHECK_FUNCS([memmove strcmp])
+AC_FOREACH([LTDL_Func], [strchr index strrchr rindex memcpy bcopy],
+    [AH_TEMPLATE(AS_TR_CPP(HAVE_[]LTDL_Func),
+                [Define to 1 if you have the `]LTDL_Func[' function.])])
+
+AC_CHECK_FUNC([strchr], [AC_DEFINE([HAVE_STRCHR])],
+    [AC_CHECK_FUNC([index], [AC_DEFINE([HAVE_INDEX])],
+       [AC_LIBOBJ([strchr])])])
+
+AC_CHECK_FUNC([strrchr], [AC_DEFINE([HAVE_STRRCHR])],
+    [AC_CHECK_FUNC([rindex], [AC_DEFINE([HAVE_RINDEX])],
+       [AC_LIBOBJ([strrchr])])])
+
+AC_CHECK_FUNC([memcpy], [AC_DEFINE([HAVE_MEMCPY])],
+    [AC_CHECK_FUNC([bcopy],  [AC_DEFINE([HAVE_BCOPY])],
+       [AC_LIBOBJ([memcpy])])])
+
+AC_REPLACE_FUNCS([memmove strcmp])
 AC_CHECK_FUNCS([closedir opendir readdir])
 ])# AC_LIB_LTDL