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