?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:
?RCS: You may redistribute only under the terms of the Artistic Licence,
?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: Revision 3.0 1993/08/18 12:09:12 ram
?RCS: Baseline for dist 3.0 netwide release.
?RCS:
-?MAKE:mallocsrc mallocobj usemymalloc malloctype d_mymalloc \
+?MAKE:mallocsrc mallocobj usemallocwrap usemymalloc malloctype d_mymalloc \
freetype: Myread \
Oldconfig package Guess Setvar rm cat +cc +ccflags Findhdr \
- i_malloc i_stdlib sed libs _o ptrsize
+ i_malloc i_stdlib 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
?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 effiency, but such versions are often
+?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.
?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' ;;
-*) dflt='n' ;;
-esac
-case "$ptrsize" in
-4) ;;
-*) dflt='n' ;;
+[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