path: root/mcon/U/cc.U
diff options
Diffstat (limited to 'mcon/U/cc.U')
1 files changed, 129 insertions, 0 deletions
diff --git a/mcon/U/cc.U b/mcon/U/cc.U
new file mode 100644
index 0000000..0c63735
--- /dev/null
+++ b/mcon/U/cc.U
@@ -0,0 +1,129 @@
+?RCS: $Id: cc.U,v 1995/05/12 12:06:47 ram Exp $
+?RCS: Copyright (c) 1991-1993, Raphael Manfredi
+?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 3.0.
+?RCS: $Log: cc.U,v $
+?RCS: Revision 1995/05/12 12:06:47 ram
+?RCS: patch54: may now abort Configure when cc does not work
+?RCS: Revision 1995/01/11 15:20:11 ram
+?RCS: patch45: changed gcc checking message to a more explicit one (WED)
+?RCS: Revision 1994/10/29 16:04:29 ram
+?RCS: patch36: detect gcc even when not called as 'gcc' (ADO)
+?RCS: patch36: simplified gcc version checking (ADO)
+?RCS: patch36: added ?F: line for metalint file checking
+?RCS: Revision 1994/05/06 14:26:06 ram
+?RCS: patch23: added support for gcc version (ADO)
+?RCS: Revision 3.0 1993/08/18 12:05:30 ram
+?RCS: Baseline for dist 3.0 netwide release.
+?MAKE:cc gccversion: cat contains sysman +large cpp rm \
+ Mcc Myread Guess Options Oldconfig Loc
+?MAKE: -pick add $@ %<
+?S: This variable holds the name of a command to execute a C compiler which
+?S: can resolve multiple global references that happen to have the same
+?S: name. Usual values are "cc", "Mcc", "cc -M", and "gcc".
+?S: If GNU cc (gcc) is used, this variable holds '1' or '2' to
+?S: indicate whether the compiler is version 1 or 2. This is used in
+?S: setting some of the default cflags. It is set to '' if not gcc.
+?LINT:change cpp
+: see if we need a special compiler
+echo " "
+if ./usg; then
+ case "$cc" in
+ '') case "$Mcc" in
+ /*) dflt='Mcc';;
+ *) case "$large" in
+ -M*) dflt='cc';;
+ *) if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
+ if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
+ dflt='cc'
+ else
+ dflt='cc -M'
+ fi
+ else
+ dflt='cc'
+ fi;;
+ esac;;
+ esac;;
+ *) dflt="$cc";;
+ esac
+ $cat <<'EOM'
+On some systems the default C compiler will not resolve multiple global
+references that happen to have the same name. On some such systems the "Mcc"
+command may be used to force these to be resolved. On other systems a "cc -M"
+command is required. (Note that the -M flag on other systems indicates a
+memory model to use!) If you have the Gnu C compiler, you might wish to use
+that instead.
+ rp="What command will force resolution on this system?"
+ . ./myread
+ cc="$ans"
+ case "$cc" in
+ '') dflt=cc;;
+ *) dflt="$cc";;
+ esac
+ rp="Use which C compiler?"
+ . ./myread
+ cc="$ans"
+?X: Check if they have gcc in any guise. This is really only needed
+?X: if the user has version 1.x.x and needs -fpcc-struct-return. Alas
+?X: BSD/386 ships a version of gcc 1.4.2 and calls it cc. Hence the
+?X: paranoid test -- ADO.
+echo " "
+echo "Checking for GNU cc in disguise and/or its version number..." >&4
+$cat >gccvers.c <<EOM
+#include <stdio.h>
+int main() {
+#ifdef __GNUC__
+#ifdef __VERSION__
+ printf("%s\n", __VERSION__);
+ printf("%s\n", "1");
+ exit(0);
+if $cc -o gccvers gccvers.c >/dev/null 2>&1; then
+ gccversion=`./gccvers`
+ case "$gccversion" in
+ '') echo "You are not using GNU cc." ;;
+ *) echo "You are using GNU cc $gccversion." ;;
+ esac
+ echo " "
+ echo "*** WHOA THERE!!! ***" >&4
+ echo " Your C compiler \"$cc\" doesn't seem to be working!" >&4
+?X: using -K will prevent aborting--maybe they're cross compiling?
+ case "$knowitall" in
+ '')
+ echo " You'd better start hunting for one and let me know about it." >&4
+ exit 1
+ ;;
+ esac
+$rm -f gccvers*
+case "$gccversion" in
+1*) cpp=`./loc gcc-cpp $cpp $pth` ;;