1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175
|
?RCS: $Id: mallocsrc.U,v 3.0.1.2 1997/02/28 16:10:26 ram Exp $
?RCS:
?RCS: Copyright (c) 1991-1993, Raphael Manfredi
?RCS:
?RCS: You may redistribute only under the terms of the Artistic License,
?RCS: as specified in the README file that comes with the distribution.
?RCS: You may reuse parts of this distribution only within the terms of
?RCS: that same Artistic License; a copy of which may be found at the root
?RCS: of the source tree for dist 3.0.
?RCS:
?RCS: $Log: mallocsrc.U,v $
?RCS: Revision 3.0.1.2 1997/02/28 16:10:26 ram
?RCS: patch61: added support for Free_t, the type of free()
?RCS: patch61: replaced .o with $_o all over the place
?RCS:
?RCS: Revision 3.0.1.1 1994/05/06 15:10:46 ram
?RCS: patch23: added support for MYMALLOC, mainly for perl5 (ADO)
?RCS:
?RCS: Revision 3.0 1993/08/18 12:09:12 ram
?RCS: Baseline for dist 3.0 netwide release.
?RCS:
?MAKE:mallocsrc mallocobj usemallocwrap usemymalloc malloctype d_mymalloc \
freetype: Myread Oldconfig package Guess Setvar Findhdr \
sed libs _o ptrsize useithreads
?MAKE: -pick add $@ %<
?X: Put near top so that other tests don't erroneously include
?X: -lmalloc. --AD 22 June 1998
?Y:TOP
?S:usemymalloc:
?S: This variable contains y if the malloc that comes with this package
?S: is desired over the system's version of malloc. People often include
?S: special versions of malloc for efficiency, but such versions are often
?S: less portable. See also mallocsrc and mallocobj.
?S: If this is 'y', then -lmalloc is removed from $libs.
?S:.
?S:usemallocwrap:
?S: This variable contains y if we are wrapping malloc to prevent
?S: integer overflow during size calculations.
?S:.
?S:mallocsrc:
?S: This variable contains the name of the malloc.c that comes with
?S: the package, if that malloc.c is preferred over the system malloc.
?S: Otherwise the value is null. This variable is intended for generating
?S: Makefiles.
?S:.
?S:d_mymalloc:
?S: This variable conditionally defines MYMALLOC in case other parts
?S: of the source want to take special action if MYMALLOC is used.
?S: This may include different sorts of profiling or error detection.
?S:.
?S:mallocobj:
?S: This variable contains the name of the malloc.o that this package
?S: generates, if that malloc.o is preferred over the system malloc.
?S: Otherwise the value is null. This variable is intended for generating
?S: Makefiles. See mallocsrc.
?S:.
?S:freetype:
?S: This variable contains the return type of free(). It is usually
?S: void, but occasionally int.
?S:.
?S:malloctype:
?S: This variable contains the kind of ptr returned by malloc and realloc.
?S:.
?C:Free_t:
?C: This variable contains the return type of free(). It is usually
?C: void, but occasionally int.
?C:.
?C:Malloc_t (MALLOCPTRTYPE):
?C: This symbol is the type of pointer returned by malloc and realloc.
?C:.
?H:#define Malloc_t $malloctype /**/
?H:#define Free_t $freetype /**/
?H:.
?C:PERL_MALLOC_WRAP:
?C: This symbol, if defined, indicates that we'd like malloc wrap checks.
?C:.
?H:#$usemallocwrap PERL_MALLOC_WRAP /**/
?H:.
?C:MYMALLOC:
?C: This symbol, if defined, indicates that we're using our own malloc.
?C:.
?H:#$d_mymalloc MYMALLOC /**/
?H:.
?LINT:extern usedevel
?LINT:change libs
?X: Cannot test for mallocsrc; it is the unit's name and there is a bug in
?X: the interpreter which defines all the names, even though they are not used.
@if mallocobj
: determine whether to use malloc wrapping
echo " "
case "$usemallocwrap" in
[yY]*|true|$define) dflt='y' ;;
[nN]*|false|$undef) dflt='n' ;;
*) case "$usedevel" in
[yY]*|true|$define) dflt='y' ;;
*) dflt='n' ;;
esac
;;
esac
rp="Do you wish to wrap malloc calls to protect against potential overflows?"
. ./myread
usemallocwrap="$ans"
case "$ans" in
y*|true)
usemallocwrap="$define" ;;
*)
usemallocwrap="$undef" ;;
esac
: determine which malloc to compile in
echo " "
case "$usemymalloc" in
[yY]*|true|$define) dflt='y' ;;
[nN]*|false|$undef) dflt='n' ;;
*) case "$ptrsize" in
4) dflt='y' ;;
*) dflt='n' ;;
esac
if test "$useithreads" = "$define"; then dflt='n'; fi
;;
esac
rp="Do you wish to attempt to use the malloc that comes with $package?"
. ./myread
usemymalloc="$ans"
case "$ans" in
y*|true)
usemymalloc='y'
mallocsrc='malloc.c'
mallocobj="malloc$_o"
d_mymalloc="$define"
?X: Maybe libs.U should be dependent on mallocsrc.U, but then
?X: most packages that use dist probably don't supply their own
?X: malloc, so this is probably an o.k. compromise
case "$libs" in
*-lmalloc*)
: Remove malloc from list of libraries to use
echo "Removing unneeded -lmalloc from library list" >&4
set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
shift
libs="$*"
echo "libs = $libs" >&4
;;
esac
;;
*)
usemymalloc='n'
mallocsrc=''
mallocobj=''
d_mymalloc="$undef"
;;
esac
@end
@if MALLOCPTRTYPE || Malloc_t || Free_t
: compute the return types of malloc and free
echo " "
@if MALLOCPTRTYPE || Malloc_t
case "$malloctype" in
'')
malloctype='void *'
;;
esac
echo "Your system wants malloc to return '$malloctype', it would seem." >&4
@end
@if Free_t
case "$freetype" in
'')
freetype='void'
;;
esac
echo "Your system uses $freetype free(), it would seem." >&4
@end
@end
|