Commit | Line | Data |
---|---|---|
959f3c4c JH |
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 | |
0065f4af | 4 | ?RCS: |
65a32477 | 5 | ?RCS: You may redistribute only under the terms of the Artistic License, |
959f3c4c JH |
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 | |
65a32477 | 8 | ?RCS: that same Artistic License; a copy of which may be found at the root |
959f3c4c JH |
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: | |
cb69034d | 18 | ?MAKE:ptrsize: cat rm_try Myread Compile run use64bitall i_stdlib d_quad |
959f3c4c JH |
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:. | |
0065f4af | 32 | ?F:!try |
88dc2d68 | 33 | ?LINT:extern use64bitint |
959f3c4c JH |
34 | : check for length of pointer |
35 | echo " " | |
36 | case "$ptrsize" in | |
37 | '') | |
0fdea05a | 38 | echo "Checking to see how big your pointers are..." >&4 |
9cf79ea8 | 39 | $cat >try.c <<EOCP |
959f3c4c | 40 | #include <stdio.h> |
3b148aa9 JH |
41 | #$i_stdlib I_STDLIB |
42 | #ifdef I_STDLIB | |
43 | #include <stdlib.h> | |
44 | #endif | |
959f3c4c JH |
45 | int main() |
46 | { | |
cb69034d | 47 | printf("%d\n", (int)sizeof(void *)); |
b8fb7a32 | 48 | exit(0); |
959f3c4c JH |
49 | } |
50 | EOCP | |
51 | set try | |
52 | if eval $compile_ok; then | |
0f00356b | 53 | ptrsize=`$run ./try` |
0fdea05a | 54 | echo "Your pointers are $ptrsize bytes long." |
959f3c4c JH |
55 | else |
56 | dflt='4' | |
57 | echo "(I can't seem to compile the test program. Guessing...)" >&4 | |
58 | rp="What is the size of a pointer (in bytes)?" | |
59 | . ./myread | |
60 | ptrsize="$ans" | |
61 | fi | |
62 | ;; | |
63 | esac | |
2cb64bf6 | 64 | $rm_try |
88dc2d68 JH |
65 | case "$use64bitall" in |
66 | "$define"|true|[yY]*) | |
67 | case "$ptrsize" in | |
68 | 4) cat <<EOM >&4 | |
69 | ||
4b62dc2e JH |
70 | *** You have chosen a maximally 64-bit build, |
71 | *** but your pointers are only 4 bytes wide. | |
907ef768 JH |
72 | *** Please rerun Configure without -Duse64bitall. |
73 | EOM | |
74 | case "$d_quad" in | |
75 | define) | |
76 | cat <<EOM >&4 | |
77 | *** Since you have quads, you could possibly try with -Duse64bitint. | |
78 | EOM | |
79 | ;; | |
80 | esac | |
81 | cat <<EOM >&4 | |
4b62dc2e | 82 | *** Cannot continue, aborting. |
88dc2d68 JH |
83 | |
84 | EOM | |
907ef768 | 85 | |
4b62dc2e | 86 | exit 1 |
88dc2d68 JH |
87 | ;; |
88 | esac | |
89 | ;; | |
90 | esac | |
91 |