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 / d_const.U
1 ?RCS: $Id: d_const.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: d_const.U,v $
12 ?RCS: Revision 3.0.1.1  1993/11/10  17:33:41  ram
13 ?RCS: patch14: stronger const check with added typedef for MIPS cc
14 ?RCS:
15 ?RCS: Revision 3.0  1993/08/18  12:05:51  ram
16 ?RCS: Baseline for dist 3.0 netwide release.
17 ?RCS:
18 ?MAKE:d_const: cat rm cc ccflags Setvar
19 ?MAKE:  -pick add $@ %<
20 ?S:d_const:
21 ?S:     This variable conditionally defines the HASCONST symbol, which
22 ?S:     indicates to the C program that this C compiler knows about the
23 ?S:     const type.
24 ?S:.
25 ?C:HASCONST ~ %<:
26 ?C:     This symbol, if defined, indicates that this C compiler knows about
27 ?C:     the const type. There is no need to actually test for that symbol
28 ?C:     within your programs. The mere use of the "const" keyword will
29 ?C:     trigger the necessary tests.
30 ?C:.
31 ?H:?%<:#$d_const HASCONST       /**/
32 ?H:?%<:#ifndef HASCONST
33 ?H:?%<:#define const
34 ?H:?%<:#endif
35 ?H:.
36 ?W:%<:const
37 ?F:const.c const.o
38 ?LINT:set d_const
39 ?LINT:known const
40 : check for const keyword
41 echo " "
42 echo 'Checking to see if your C compiler knows about "const"...' >&4
43 $cat >const.c <<'EOCP'
44 ?X: mmcg@bruce.cs.monash.edu.au reports that:
45 ?X: The MIPS cc compiler (V2.10) on a dec 5000 running Ultrix 4.2A
46 ?X: pretends to understand `const' but doesn't - it'll also fail to
47 ?X: handle typedefs properly if they're declared const. To guard
48 ?X: against this, boost up the test by using an explicit typedef...
49 typedef struct spug { int drokk; } spug;
50 int main()
51 {
52         const char *foo;
53         const spug y;
54 }
55 EOCP
56 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
57         val="$define"
58         echo "Yup, it does."
59 else
60         val="$undef"
61         echo "Nope, it doesn't."
62 fi
63 set d_const
64 eval $setvar
65 $rm -f const.c const.o
66