From 0e57f0c510b7d7eb688695359048a1f0a585e26a Mon Sep 17 00:00:00 2001 From: rmanfredi Date: Thu, 24 Aug 2006 12:32:52 +0000 Subject: Moving project to sourceforge. git-svn-id: svn://svn.code.sf.net/p/dist/code/trunk/dist@1 2592e710-e01b-42a5-8df0-11608a6cc53d --- mcon/U/Checkcc.U | 135 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 135 insertions(+) create mode 100644 mcon/U/Checkcc.U (limited to 'mcon/U/Checkcc.U') diff --git a/mcon/U/Checkcc.U b/mcon/U/Checkcc.U new file mode 100644 index 0000000..ac1b513 --- /dev/null +++ b/mcon/U/Checkcc.U @@ -0,0 +1,135 @@ +?RCS: $Id$ +?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: 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 <checkcc +$startsh +EOS +cat <<'EOSC' >>checkcc +case "$cc" in +'') ;; +*) $rm -f try try.* + $cat >try.c <&4 + fi + $cat >&4 <