1 ?RCS: $Id: mallocsrc.U,v 3.0.1.1 1994/05/06 15:10:46 ram Exp $
3 ?RCS: Copyright (c) 1991-1993, Raphael Manfredi
5 ?RCS: You may redistribute only under the terms of the Artistic Licence,
6 ?RCS: as specified in the README file that comes with the distribution.
7 ?RCS: You may reuse parts of this distribution only within the terms of
8 ?RCS: that same Artistic Licence; a copy of which may be found at the root
9 ?RCS: of the source tree for dist 3.0.
11 ?RCS: $Log: mallocsrc.U,v $
12 ?RCS: Revision 3.0.1.1 1994/05/06 15:10:46 ram
13 ?RCS: patch23: added support for MYMALLOC, mainly for perl5 (ADO)
15 ?RCS: Revision 3.0 1993/08/18 12:09:12 ram
16 ?RCS: Baseline for dist 3.0 netwide release.
18 ?MAKE:mallocsrc mallocobj usemymalloc malloctype d_mymalloc \
20 Oldconfig package Guess Setvar rm cat +cc +ccflags Findhdr \
21 i_malloc i_stdlib sed libs
22 ?MAKE: -pick add $@ %<
24 ?S: This variable contains y if the malloc that comes with this package
25 ?S: is desired over the system's version of malloc. People often include
26 ?S: special versions of malloc for effiency, but such versions are often
27 ?S: less portable. See also mallocsrc and mallocobj.
28 ?S: If this is 'y', then -lmalloc is removed from $libs.
31 ?S: This variable contains the name of the malloc.c that comes with
32 ?S: the package, if that malloc.c is preferred over the system malloc.
33 ?S: Otherwise the value is null. This variable is intended for generating
37 ?S: This variable conditionally defines MYMALLOC in case other parts
38 ?S: of the source want to take special action if MYMALLOC is used.
39 ?S: This may include different sorts of profiling or error detection.
42 ?S: This variable contains the name of the malloc.o that this package
43 ?S: generates, if that malloc.o is preferred over the system malloc.
44 ?S: Otherwise the value is null. This variable is intended for generating
45 ?S: Makefiles. See mallocsrc.
48 ?S: This variable contains the return type of free(). It is usually
49 ?S: void, but occasionally int.
52 ?S: This variable contains the kind of ptr returned by malloc and realloc.
55 ?C: This variable contains the return type of free(). It is usually
56 ?C: void, but occasionally int.
58 ?C:Malloc_t (MALLOCPTRTYPE):
59 ?C: This symbol is the type of pointer returned by malloc and realloc.
61 ?H:#define Malloc_t $malloctype /**/
62 ?H:#define Free_t $freetype /**/
65 ?C: This symbol, if defined, indicates that we're using our own malloc.
67 ?H:#$d_mymalloc MYMALLOC /**/
70 ?X: Cannot test for mallocsrc; it is the unit's name and there is a bug in
71 ?X: the interpreter which defines all the names, even though they are not used.
73 : determine which malloc to compile in
75 case "$usemymalloc" in
76 ''|y*|true) dflt='y' ;;
78 *) dflt="$usemymalloc" ;;
80 rp="Do you wish to attempt to use the malloc that comes with $package?"
89 ?X: Maybe libs.U should be dependent on mallocsrc.U, but then
90 ?X: most packages that use dist probably don't supply their own
91 ?X: malloc, so this is probably an o.k. comprpomise
94 : Remove malloc from list of libraries to use
95 echo "Removing unneeded -lmalloc from library list" >&4
96 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
99 echo "libs = $libs" >&4
112 @if MALLOCPTRTYPE || Malloc_t || Free_t
113 : compute the return types of malloc and free
119 #include <sys/types.h>
133 @if MALLOCPTRTYPE || Malloc_t
134 case "$malloctype" in
136 if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
143 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
149 if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
156 echo "Your system uses $freetype free(), it would seem." >&4