From 487253ea1f81b8223334200ada86a3d3b7de6d9c Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Thu, 22 Jun 1995 09:00:11 +0000 Subject: [PATCH] Tue Jun 20 02:18:19 1995 Roland McGrath * Makerules (lib%.so: lib%_pic.a): Pass -soname switch giving the library's name including $(libprefix) and major version number. * locale/locale-ctype.c (allocate_arrays): Use xmalloc and bzero in place of xcalloc. * Makeconfig (prefix, exec_prefix, libprefix): Instead of `ifndef', use the $(origin) function to only set these if they are undefined, and not if they are defined to empty. * gnu-versions.h: New file. * features.h (__GNU_LIBRARY__): Increase value to 5. --- ChangeLog | 15 +++++++++++++ Makeconfig | 6 +++--- Makerules | 1 + features.h | 10 +++++++-- gnu-versions.h | 50 +++++++++++++++++++++++++++++++++++++++++++ locale/locale-ctype.c | 12 +++++++---- 6 files changed, 85 insertions(+), 9 deletions(-) create mode 100644 gnu-versions.h diff --git a/ChangeLog b/ChangeLog index e9812c8054..b133e7589e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +Tue Jun 20 02:18:19 1995 Roland McGrath + + * Makerules (lib%.so: lib%_pic.a): Pass -soname switch giving the + library's name including $(libprefix) and major version number. + + * locale/locale-ctype.c (allocate_arrays): Use xmalloc and bzero + in place of xcalloc. + + * Makeconfig (prefix, exec_prefix, libprefix): Instead of + `ifndef', use the $(origin) function to only set these if they are + undefined, and not if they are defined to empty. + + * gnu-versions.h: New file. + * features.h (__GNU_LIBRARY__): Increase value to 5. + Wed Jun 14 03:45:24 1995 Roland McGrath * stdio/stdio.h (__validfp): Use ({...}) rather than a comma diff --git a/Makeconfig b/Makeconfig index 620f23d991..b63dabb831 100644 --- a/Makeconfig +++ b/Makeconfig @@ -115,12 +115,12 @@ export sysdep_dir := $(sysdep_dir) # Common prefix for machine-independent installation directories. -ifndef prefix +ifeq ($(origin prefix),undefined) # ifndef would override explicit empty value. prefix = /usr/local endif # Common prefix for machine-dependent installation directories. -ifndef exec_prefix +ifeq ($(origin exec_prefix),undefined) exec_prefix = $(prefix) endif @@ -133,7 +133,7 @@ endif # the prefix is spliced between `lib' and the name, so the linker switch # `-l$(libprefix)NAME' finds the library; for other files the prefix is # just prepended to the whole file name. -ifndef libprefix +ifeq ($(origin libprefix),undefined) libprefix = endif diff --git a/Makerules b/Makerules index 2191251f35..c6de338570 100644 --- a/Makerules +++ b/Makerules @@ -554,6 +554,7 @@ ifeq (yes,$(build-shared)) # on other shared objects. lib%.so: lib%_pic.a $(LINK.o) -shared -o $@ \ + -soname lib$(libprefix)$*.so$($(@F)-version) \ $(LDFLAGS.so) $(LDFLAGS-$(notdir $*).so) \ -L$(firstword $(objdir) .) -L$(common-objpfx:%/=%) \ $(LDLIBS-$(notdir $*).so) -Wl,--whole-archive $< \ diff --git a/features.h b/features.h index 0778092ed9..7801bb8c20 100644 --- a/features.h +++ b/features.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 1992, 1993 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1992, 1993, 1995 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 @@ -126,8 +126,14 @@ Cambridge, MA 02139, USA. */ #endif +/* This macro indicates that the installed library is the GNU C Library. + Its value must be incremented whenever any existing library interface + changes such that callers must be recompiled with the new header files. + This value should always coincide with the major version number used for + the shared C library corresponding to this set of header files. */ + #undef __GNU_LIBRARY__ -#define __GNU_LIBRARY__ 1 +#define __GNU_LIBRARY__ 5 #if !defined(__GNUC__) || __GNUC__ < 2 diff --git a/gnu-versions.h b/gnu-versions.h new file mode 100644 index 0000000000..631a0f7fbf --- /dev/null +++ b/gnu-versions.h @@ -0,0 +1,50 @@ +/* Header with interface version macros for library pieces copied elsewhere. +Copyright (C) 1995 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 +modify it under the terms of the GNU Library General Public License as +published by the Free Software Foundation; either version 2 of the +License, or (at your option) any later version. + +The GNU C Library 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 +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#ifndef _GNU_VERSIONS_H +#define _GNU_VERSIONS_H 1 + +/* This file exists to define these few macros. Each specifies a version + number associated with the library interface of a piece of the C library + which is also distributed with other GNU packages. These pieces are + both part of the GNU C library and also distributed with other GNU + packages so those packages may use their facilities on systems lacking + the GNU C library. The source files for each piece surround all their + code with `#ifndef ELIDE_CODE' after defining it with this: + + #define OBSTACK_INTERFACE_VERSION 1 + #if !defined (_LIBC) && defined (__GNU_LIBRARY__) && __GNU_LIBRARY__ > 1 + #include + #if _GNU_OBSTACK_INTERFACE_VERSION == OBSTACK_INTERFACE_VERSION + #define ELIDE_CODE + #endif + #endif + + This allows those one to avoid compiling those files when part of a GNU + package not libc, on a system using a GNU C library that supports the + same interface. + + Please preserve the format of the comments after each macro. And + remember, if any of these versions change, the libc.so major version + number must change too (so avoid it)! */ + +#define _GNU_OBSTACK_INTERFACE_VERSION 1 /* vs malloc/obstack.c */ +#define _GNU_REGEX_INTERFACE_VERSION 1 /* vs posix/regex.c */ + +#endif /* gnu-versions.h */ diff --git a/locale/locale-ctype.c b/locale/locale-ctype.c index 1ce09bab2b..e7a1e97960 100644 --- a/locale/locale-ctype.c +++ b/locale/locale-ctype.c @@ -534,16 +534,20 @@ allocate_arrays (void) char *ptr; int size = charmap_data.hash_size * charmap_data.hash_layers; - ctype_b = (u16 *) xcalloc (size - (-128), sizeof (u16)); + ctype_b = xmalloc ((size - (-128)) * sizeof (u16)); + bzero (ctype_b, (size - (-128)) * sizeof (u16)); ctype_b += 128; - names_b = (i32 *) xcalloc (size, sizeof (i32)); + names_b = xmalloc (size * sizeof (i32)); + bzero (names_b, size * sizeof (i32)); - toupper_b = (i32 *) xcalloc ((size - (-128)), sizeof (i32)); + toupper_b = xmalloc ((size - (-128)) * sizeof (i32)); + bzero (toupper_b, (size - (-128)) * sizeof (i32)); toupper_b += 128; - tolower_b = (i32 *) xcalloc ((size - (-128)), sizeof (i32)); + tolower_b = xmalloc ((size - (-128)) * sizeof (i32)); + bzero (tolower_b, (size - (-128)) * sizeof (i32)); tolower_b += 128; ptr = NULL;