This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[UTIL] Perl system does not default to $_
[metaconfig.git] / dist / U / ptrsize.U
CommitLineData
33a01fd2 1?RCS: $Id$
d8875586 2?RCS:
33a01fd2 3?RCS: Copyright (c) 1991-1997, 2004-2006, 2012 Raphael Manfredi
d8875586 4?RCS:
33a01fd2 5?RCS: You may redistribute only under the terms of the Artistic License,
d8875586
MBT
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
33a01fd2 8?RCS: that same Artistic License; a copy of which may be found at the root
d8875586
MBT
9?RCS: of the source tree for dist 4.0.
10?RCS:
d8875586
MBT
11?MAKE:ptrsize: cat rm Myread +cc +ccflags
12?MAKE: -pick add $@ %<
13?S:ptrsize:
14?S: This variable contains the value of the PTRSIZE symbol, which
15?S: indicates to the C program how many bytes there are in a pointer.
16?S:.
17?C:PTRSIZE:
18?C: This symbol contains the size of a pointer, so that the C preprocessor
19?C: can make decisions based on it.
20?C:.
21?H:#define PTRSIZE $ptrsize /**/
22?H:.
23?F:!try
24: check for length of pointer
25echo " "
26case "$ptrsize" in
27'')
28 echo "Checking to see how big your pointers are..." >&4
29 $cat >try.c <<'EOCP'
30#include <stdio.h>
31int main()
32{
33 printf("%d\n", sizeof(char *));
34}
35EOCP
36 if $cc $ccflags -o try try.c >/dev/null 2>&1 ; then
37 dflt=`./try`
38 else
39 dflt='4'
40 echo "(I can't seem to compile the test program. Guessing...)"
41 fi
42 ;;
43*)
44 dflt="$ptrsize"
45 ;;
46esac
47rp="What is the size of a pointer (in bytes)?"
48. ./myread
49ptrsize="$ans"
50$rm -f try.c try
51