?RCS: $Id$ ?RCS: ?RCS: Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi ?RCS: ?RCS: You may redistribute only under the terms of the Artistic License, ?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 License; 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(void) { static const char *foo; static const spug y; (void) foo; (void) y; return 0; } EOCP if $cc -c $ccflags const.c; 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