This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
20603f2614f07509a235de05d4fe32b2781d6925
[metaconfig.git] / U / compline / ptrsize.U
1 ?RCS: $Id: ptrsize.U,v 3.0.1.1 1994/10/29 16:28:19 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: ptrsize.U,v $
12 ?RCS: Revision 3.0.1.1  1994/10/29  16:28:19  ram
13 ?RCS: patch36: added ?F: line for metalint file checking
14 ?RCS:
15 ?RCS: Revision 3.0  1993/08/18  12:09:37  ram
16 ?RCS: Baseline for dist 3.0 netwide release.
17 ?RCS:
18 ?MAKE:ptrsize: cat rm Myread Compile voidflags run use64bitall i_stdlib
19 ?MAKE:  -pick add $@ %<
20 ?S:ptrsize:
21 ?S:     This variable contains the value of the PTRSIZE symbol, which
22 ?S:     indicates to the C program how many bytes there are in a pointer.
23 ?S:.
24 ?C:PTRSIZE:
25 ?C:     This symbol contains the size of a pointer, so that the C preprocessor
26 ?C:     can make decisions based on it.  It will be sizeof(void *) if
27 ?C:     the compiler supports (void *); otherwise it will be
28 ?C:     sizeof(char *).
29 ?C:.
30 ?H:#define PTRSIZE $ptrsize             /**/
31 ?H:.
32 ?LINT:change use64bitall
33 ?LINT:extern use64bitint
34 ?LINT:change use64bitint
35 : check for length of pointer
36 echo " "
37 case "$ptrsize" in
38 '')
39         echo "Checking to see how big your pointers are..." >&4
40         if test "$voidflags" -gt 7; then
41                 echo '#define VOID_PTR char *' > try.c
42         else
43                 echo '#define VOID_PTR void *' > try.c
44         fi
45         $cat >>try.c <<EOCP
46 #include <stdio.h>
47 #$i_stdlib I_STDLIB
48 #ifdef I_STDLIB
49 #include <stdlib.h>
50 #endif
51 int main()
52 {
53     printf("%d\n", (int)sizeof(VOID_PTR));
54     exit(0);
55 }
56 EOCP
57         set try
58         if eval $compile_ok; then
59                 ptrsize=`$run ./try`
60                 echo "Your pointers are $ptrsize bytes long."
61         else
62                 dflt='4'
63                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
64                 rp="What is the size of a pointer (in bytes)?"
65                 . ./myread
66                 ptrsize="$ans"
67         fi
68         ;;
69 esac
70 $rm -f try.c try
71 case "$use64bitall" in
72 "$define"|true|[yY]*)
73         case "$ptrsize" in
74         4)      cat <<EOM >&4
75
76 *** You have chosen a maximally 64-bit build, but your pointers
77 *** are only 4 bytes wide, disabling maximal 64-bitness.
78
79 EOM
80                 use64bitall="$undef"
81                 case "$use64bitint" in
82                 "$define"|true|[yY]*) ;;
83                 *)      cat <<EOM >&4
84
85 *** Downgrading from maximal 64-bitness to using 64-bit integers.
86
87 EOM
88                         use64bitint="$define"
89                         ;;
90                 esac
91                 ;;
92         esac
93         ;;
94 esac
95
96