Commit | Line | Data |
---|---|---|
959f3c4c JH |
1 | ?RCS: $Id: cc.U,v 3.0.1.4 1995/05/12 12:06:47 ram Exp $ |
2 | ?RCS: | |
3 | ?RCS: Copyright (c) 1991-1993, Raphael Manfredi | |
4 | ?RCS: | |
5 | ?RCS: You may redistribute only under the terms of the Artistic Licence, | |
6 | ?RCS: as specified in the README file that comes with the distribution. | |
7 | ?RCS: You may reuse parts of this distribution only within the terms of | |
8 | ?RCS: that same Artistic Licence; a copy of which may be found at the root | |
9 | ?RCS: of the source tree for dist 3.0. | |
10 | ?RCS: | |
11 | ?RCS: $Log: cc.U,v $ | |
12 | ?RCS: Revision 3.0.1.4 1995/05/12 12:06:47 ram | |
13 | ?RCS: patch54: may now abort Configure when cc does not work | |
14 | ?RCS: | |
15 | ?RCS: Revision 3.0.1.3 1995/01/11 15:20:11 ram | |
16 | ?RCS: patch45: changed gcc checking message to a more explicit one (WED) | |
17 | ?RCS: | |
18 | ?RCS: Revision 3.0.1.2 1994/10/29 16:04:29 ram | |
19 | ?RCS: patch36: detect gcc even when not called as 'gcc' (ADO) | |
20 | ?RCS: patch36: simplified gcc version checking (ADO) | |
21 | ?RCS: patch36: added ?F: line for metalint file checking | |
22 | ?RCS: | |
23 | ?RCS: Revision 3.0.1.1 1994/05/06 14:26:06 ram | |
24 | ?RCS: patch23: added support for gcc version (ADO) | |
25 | ?RCS: | |
26 | ?RCS: Revision 3.0 1993/08/18 12:05:30 ram | |
27 | ?RCS: Baseline for dist 3.0 netwide release. | |
28 | ?RCS: | |
fca3f377 | 29 | ?MAKE:cc gccversion: cat contains sysman +large cpp ccflags rm \ |
959f3c4c JH |
30 | Mcc Myread Guess Options Oldconfig Loc test |
31 | ?MAKE: -pick add $@ %< | |
32 | ?S:cc: | |
33 | ?S: This variable holds the name of a command to execute a C compiler which | |
34 | ?S: can resolve multiple global references that happen to have the same | |
35 | ?S: name. Usual values are 'cc', 'Mcc', 'cc -M', and 'gcc'. | |
36 | ?S:. | |
37 | ?S:gccversion: | |
38 | ?S: If GNU cc (gcc) is used, this variable holds '1' or '2' to | |
39 | ?S: indicate whether the compiler is version 1 or 2. This is used in | |
40 | ?S: setting some of the default cflags. It is set to '' if not gcc. | |
41 | ?S:. | |
42 | ?F:!gccvers !cc.cbu | |
43 | ?D:cc='cc' | |
44 | ?D:gccversion='' | |
45 | ?LINT:change cpp | |
fca3f377 | 46 | ?LINT:change ccflags |
959f3c4c JH |
47 | : see if we need a special compiler |
48 | echo " " | |
49 | if ./usg; then | |
50 | case "$cc" in | |
51 | '') case "$Mcc" in | |
52 | /*) dflt='Mcc';; | |
53 | *) case "$large" in | |
54 | -M*) dflt='cc';; | |
55 | *) if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then | |
56 | if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then | |
57 | dflt='cc' | |
58 | else | |
59 | dflt='cc -M' | |
60 | fi | |
61 | else | |
62 | dflt='cc' | |
63 | fi;; | |
64 | esac;; | |
65 | esac;; | |
66 | *) dflt="$cc";; | |
67 | esac | |
68 | ?X: I've received sensible complaints about how this prompt. It's | |
69 | ?X: wordy, hard for the novice to check out, and almost never relevant. | |
70 | ?X: I'll only include it if it looks like we need Mcc or cc -M, though | |
71 | ?X: I have no idea if anyone ever needs them anymore. --A.D. 2/1998. | |
72 | case "$dflt" in | |
73 | *M*) $cat <<'EOM' | |
74 | On some older systems the default C compiler will not resolve multiple global | |
75 | references that happen to have the same name. On some such systems the "Mcc" | |
76 | command may be used to force these to be resolved. On other systems a "cc -M" | |
77 | command is required. (Note that the -M flag on other systems indicates a | |
78 | memory model to use!) If you have the Gnu C compiler, you might wish to use | |
79 | that instead. | |
80 | ||
81 | EOM | |
82 | ;; | |
83 | esac | |
84 | rp="Use which C compiler?" | |
85 | . ./myread | |
86 | cc="$ans" | |
87 | else | |
88 | case "$cc" in | |
89 | '') dflt=cc;; | |
90 | *) dflt="$cc";; | |
91 | esac | |
92 | rp="Use which C compiler?" | |
93 | . ./myread | |
94 | cc="$ans" | |
95 | fi | |
96 | : Look for a hint-file generated 'call-back-unit'. Now that the | |
97 | : user has specified the compiler, we may need to set or change some | |
98 | : other defaults. | |
99 | if $test -f cc.cbu; then | |
100 | . ./cc.cbu | |
101 | fi | |
f5f3c0c6 | 102 | ?X: Check if they have gcc in any guise. |
959f3c4c JH |
103 | echo " " |
104 | echo "Checking for GNU cc in disguise and/or its version number..." >&4 | |
105 | $cat >gccvers.c <<EOM | |
106 | #include <stdio.h> | |
107 | int main() { | |
108 | #ifdef __GNUC__ | |
109 | #ifdef __VERSION__ | |
110 | printf("%s\n", __VERSION__); | |
111 | #else | |
112 | printf("%s\n", "1"); | |
113 | #endif | |
114 | #endif | |
115 | exit(0); | |
116 | } | |
117 | EOM | |
d12857d9 | 118 | if $cc $ldflags -o gccvers gccvers.c; then |
959f3c4c JH |
119 | gccversion=`./gccvers` |
120 | case "$gccversion" in | |
121 | '') echo "You are not using GNU cc." ;; | |
fca3f377 | 122 | *) echo "You are using GNU cc $gccversion." |
fca3f377 | 123 | ;; |
959f3c4c JH |
124 | esac |
125 | else | |
126 | echo " " | |
127 | echo "*** WHOA THERE!!! ***" >&4 | |
128 | echo " Your C compiler \"$cc\" doesn't seem to be working!" >&4 | |
129 | ?X: using -K will prevent aborting--maybe they're cross compiling? | |
130 | case "$knowitall" in | |
131 | '') | |
132 | echo " You'd better start hunting for one and let me know about it." >&4 | |
133 | exit 1 | |
134 | ;; | |
135 | esac | |
136 | fi | |
137 | $rm -f gccvers* | |
138 | case "$gccversion" in | |
139 | 1*) cpp=`./loc gcc-cpp $cpp $pth` ;; | |
140 | esac | |
141 |