This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perl 5.0 alpha 9
[perl5.git] / U / mallocsrc.U
CommitLineData
2304df62
AD
1?RCS: $Id: mallocsrc.U,v 3.0 1993/08/18 12:09:12 ram Exp $
2?RCS:
3?RCS: Copyright (c) 1991-1993, Raphael Manfredi
4?RCS:
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.
10?RCS:
11?RCS: $Log: mallocsrc.U,v $
12?RCS: Revision 3.0 1993/08/18 12:09:12 ram
13?RCS: Baseline for dist 3.0 netwide release.
14?RCS:
85e6fe83
LW
15?MAKE:mallocsrc mallocobj usemymalloc malloctype d_mymalloc: Myread Oldconfig package \
16 Guess Setvar test rm cat +cc +ccflags Findhdr
2304df62
AD
17?MAKE: -pick add $@ %<
18?S:usemymalloc:
19?S: This variable contains y if the malloc that comes with this package
20?S: is desired over the system's version of malloc. People often include
21?S: special versions of malloc for effiency, but such versions are often
22?S: less portable. See also mallocsrc and mallocobj.
23?S:.
24?S:mallocsrc:
25?S: This variable contains the name of the malloc.c that comes with
26?S: the package, if that malloc.c is preferred over the system malloc.
27?S: Otherwise the value is null. This variable is intended for generating
28?S: Makefiles.
29?S:.
85e6fe83
LW
30?S:d_mymalloc:
31?S: This variable conditionally defines MYMALLOC in case other parts
32?S: of the source want to take special action if MYMALLOC is used.
33?S: This may include different sorts of profiling or error detection.
34?S:.
2304df62
AD
35?S:mallocobj:
36?S: This variable contains the name of the malloc.o that this package
37?S: generates, if that malloc.o is preferred over the system malloc.
38?S: Otherwise the value is null. This variable is intended for generating
39?S: Makefiles. See mallocsrc.
40?S:.
41?S:malloctype:
42?S: This variable contains the kind of ptr returned by malloc and realloc.
43?S:.
44?C:Malloc_t (MALLOCPTRTYPE):
45?C: This symbol is the type of pointer returned by malloc and realloc.
46?C:.
47?H:#define Malloc_t $malloctype /**/
48?H:.
85e6fe83
LW
49?C:MYMALLOC:
50?C: This symbol, if defined, indicates that we're using our own malloc.
51?C:.
52?H:#$d_mymalloc MYMALLOC /**/
53?H:.
2304df62
AD
54?X: Cannot test for mallocsrc; it is the unit's name and there is a bug in
55?X: the interpreter which defines all the names, even though they are not used.
56@if mallocobj
57: determine which malloc to compile in
58: Old versions had dflt='y' only for bsd or v7.
59echo " "
60case "$usemymalloc" in
61'')
62 if bsd || v7; then
63 dflt='y'
64 else
65 dflt='y'
66 fi
67 ;;
68*) dflt="$usemymalloc"
69 ;;
70esac
71rp="Do you wish to attempt to use the malloc that comes with $package?"
72. ./myread
73usemymalloc="$ans"
74case "$ans" in
85e6fe83
LW
75y*) mallocsrc='malloc.c'
76 mallocobj='malloc.o'
77 d_mymalloc="$define"
78 ;;
79*) mallocsrc=''
80 mallocobj=''
81 d_mymalloc="$undef"
82 ;;
2304df62 83esac
2304df62 84@end
85e6fe83 85
2304df62
AD
86@if MALLOCPTRTYPE || Malloc_t
87: compute the type returned by malloc
88echo " "
89case "$malloctype" in
90'')
91 if $test `./findhdr malloc.h`; then
92 echo "#include <malloc.h>" > malloc.c
93 fi
94#include <malloc.h>
95 $cat >>malloc.c <<'END'
96void *malloc();
97END
98 if $cc $ccflags -c malloc.c >/dev/null 2>&1; then
99 malloctype='void *'
100 else
101 malloctype='char *'
102 fi
103 $rm -f malloc.[co]
104 ;;
105esac
106echo "Your system wants malloc to return '$malloctype', it would seem." >&4
107
108@end