This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Add the files from dist/meta to perl's repo
[metaconfig.git] / dist / U / bitpbyte.U
1 ?RCS: $Id: bitpbyte.U 1 2006-08-24 12:32:52Z rmanfredi $
2 ?RCS:
3 ?RCS: Copyright (c) 1991-1997, 2004-2006, 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 4.0.
10 ?RCS:
11 ?RCS: $Log: bitpbyte.U,v $
12 ?RCS: Revision 3.0.1.1  1994/10/29  16:02:54  ram
13 ?RCS: patch36: added ?F: line for metalint file checking
14 ?RCS:
15 ?RCS: Revision 3.0  1993/08/18  12:05:27  ram
16 ?RCS: Baseline for dist 3.0 netwide release.
17 ?RCS:
18 ?MAKE:bitpbyte: cat rm Myread +cc +ccflags
19 ?MAKE:  -pick add $@ %<
20 ?S:bitpbyte:
21 ?S:     This variable contains the value of the BITS_PER_BYTE symbol, which
22 ?S:     indicates to the C program how many bits there are in a byte.
23 ?S:.
24 ?C:BITS_PER_BYTE:
25 ?C:     This symbol contains the number of bits in a byte, so that the C
26 ?C:     preprocessor can make decisions based on it.
27 ?C:.
28 ?H:#define BITS_PER_BYTE $bitpbyte              /**/
29 ?H:.
30 ?F:!try
31 : check for length of byte
32 echo " "
33 case "$bitpbyte" in
34 '')
35         echo "Checking to see how many bits there are in a byte..." >&4
36         $cat >try.c <<'EOCP'
37 #include <stdio.h>
38 ?X: Standard C requires a macro CHAR_BIT in <limits.h>
39 #ifdef __STDC__
40 #include <limits.h>
41 #ifndef CHAR_BIT
42 #define CHAR_BIT 8
43 #endif
44 #ifndef BITSPERBYTE
45 #define BITSPERBYTE CHAR_BIT
46 #endif
47 #else
48 ?X: On non standard C, try with <values.h>
49 #include <values.h>
50 #ifndef BITSPERBYTE
51 #define BITSPERBYTE 8
52 #endif
53 #endif
54 int main()
55 {
56         printf("%d\n", BITSPERBYTE);
57 }
58 EOCP
59         if $cc $ccflags -o try try.c >/dev/null 2>&1 ; then
60                 dflt=`./try`
61         else
62                 dflt='8'
63                 echo "(I can't seem to compile the test program.  Guessing...)"
64         fi
65         ;;
66 *)
67         dflt="$bitpbyte"
68         ;;
69 esac
70 rp="What is the length of a byte (in bits)?"
71 . ./myread
72 bitpbyte="$ans"
73 $rm -f try.c try
74