This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Part 2 of a big cleanup action based on the upcoming dist-4.0
[metaconfig.git] / U / compline / charsize.U
CommitLineData
959f3c4c
JH
1?RCS: $Id: charsize.U,v 3.0.1.1 1994/10/29 16:07:13 ram Exp $
2?RCS:
3?RCS: Copyright (c) 1991-1993, Raphael Manfredi
0065f4af 4?RCS:
959f3c4c
JH
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: charsize.U,v $
12?RCS: Revision 3.0.1.1 1994/10/29 16:07:13 ram
13?RCS: patch36: added ?F: line for metalint file checking
14?RCS:
15?RCS: Revision 3.0 1993/08/18 12:05:34 ram
16?RCS: Baseline for dist 3.0 netwide release.
17?RCS:
2cb64bf6 18?MAKE:charsize: cat rm_try Myread Compile run i_stdlib
959f3c4c
JH
19?MAKE: -pick add $@ %<
20?S:charsize:
21?S: This variable contains the value of the CHARSIZE symbol, which
22?S: indicates to the C program how many bytes there are in a character.
23?S:.
24?C:CHARSIZE:
25?C: This symbol contains the size of a char, so that the C preprocessor
26?C: can make decisions based on it.
27?C:.
28?H:#define CHARSIZE $charsize /**/
29?H:.
0065f4af 30?F:!try
959f3c4c
JH
31: check for length of character
32echo " "
33case "$charsize" in
34'')
500277eb 35 echo "Checking to see how big your characters are (hey, you never know)..." >&4
fe2ade02 36 $cat >try.c <<EOCP
959f3c4c 37#include <stdio.h>
3b148aa9
JH
38#$i_stdlib I_STDLIB
39#ifdef I_STDLIB
40#include <stdlib.h>
41#endif
959f3c4c
JH
42int main()
43{
37a56d0d 44 printf("%d\n", (int)sizeof(char));
b8fb7a32 45 exit(0);
959f3c4c
JH
46}
47EOCP
48 set try
49 if eval $compile_ok; then
0f00356b 50 dflt=`$run ./try`
959f3c4c
JH
51 else
52 dflt='1'
53 echo "(I can't seem to compile the test program. Guessing...)"
54 fi
55 ;;
56*)
57 dflt="$charsize"
58 ;;
59esac
60rp="What is the size of a character (in bytes)?"
61. ./myread
62charsize="$ans"
2cb64bf6 63$rm_try
959f3c4c 64