?RCS: $Id: Checkcc.U 167 2013-05-08 17:58:00Z rmanfredi $ ?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: Copyright (c) 2000, Jarkko Hietaniemi ?RCS: ?X: ?X: This unit produces a bit of shell code that must be dotted in order ?X: to make quick check on whether the current C compiler is working. ?X: ?MAKE:Checkcc ccname ccversion: Myread Warn startsh cat contains test ?MAKE: -pick add $@ %< ?S:ccname: ?S: This can set either by hints files or by Configure. If using ?S: gcc, this is gcc, and if not, usually equal to cc, unimpressive, no? ?S: Some platforms, however, make good use of this by storing the ?S: flavor of the C compiler being used here. For example if using ?S: the Sun WorkShop suite, ccname will be 'workshop'. ?S:. ?S:ccversion: ?S: This can set either by hints files or by Configure. If using ?S: a (non-gcc) vendor cc, this variable may contain a version for ?S: the compiler. ?S:. ?F:./checkcc ./trygcc !checktmp ?V:despair ?T:trygcc ?LINT:extern cc rm ccflags ldflags ?LINT:change cc ccflags ?LINT:usefile checktmp ?INIT:ccname='' ?INIT:ccversion='' : generate the trygcc script for later perusal cat <trygcc $startsh EOS cat <<'EOSC' >>trygcc case "$cc" in '') ;; *) $rm -f try try.* $cat >try.c <&4 despair=yes trygcc=yes case "$cc" in *gcc*) trygcc=no ;; esac case "`$cc -v -c try.c 2>&1`" in *gcc*) trygcc=no ;; esac if $test X"$trygcc" = Xyes; then if gcc -o try -c try.c; then echo " " echo "You seem to have a working gcc, though." >&4 rp="Would you like to use it?" dflt=y if $test -f myread; then . ./myread else if $test -f UU/myread; then . ./UU/myread else echo "Cannot find myread, sorry. Aborting." >&2 exit 1 fi fi case "$ans" in [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no; ?X: Look whether we have 'call-back units' generated by hints that would ?X: seemingly affect the compiling environment. $cat *.cbu >checktmp 2>/dev/null if $contains ccflags checktmp >/dev/null; then ./warn 4>&4 <checkcc $startsh EOS cat <<'EOSC' >>checkcc case "$cc" in '') ;; *) $rm -f try try.* $cat >try.c <&4 fi $cat >&4 <