4 ?RCS: Copyright (c) 2000, Jarkko Hietaniemi
7 ?X: This unit produces a bit of shell code that must be dotted in order
8 ?X: to make quick check on whether the current C compiler is working.
10 ?MAKE:Checkcc ccname ccversion: rm cat test Myread startsh
11 ?MAKE: -pick add $@ %<
13 ?S: This can set either by hints files or by Configure. If using
14 ?S: gcc, this is gcc, and if not, usually equal to cc, unimpressive, no?
15 ?S: Some platforms, however, make good use of this by storing the
16 ?S: flavor of the C compiler being used here. For example if using
17 ?S: the Sun WorkShop suite, ccname will be 'workshop'.
20 ?S: This can set either by hints files or by Configure. If using
21 ?S: a (non-gcc) vendor cc, this variable may contain a version for
35 : Check what type of C compiler we use
44 int main(int argc, char *argv[]) {
48 if $cc -o try $ccflags $ldflags try.c; then
51 echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
57 # Skip this test because it gives a false match on output like:
58 # ./trygcc: line 23: cc: command not found
59 # case "`$cc -v -c try.c 2>&1`" in
62 if $test X"$trygcc" = Xyes; then
63 if gcc -o try -c try.c; then
65 echo "You seem to have a working gcc, though." >&4
66 # Switching compilers may undo the work of hints files.
67 # The most common problem is -D_REENTRANT for threads.
68 # This heuristic catches that case, but gets false positives
69 # if -Dusethreads was not actually specified. Better to
70 # bail out here with a useful message than fail
71 # mysteriously later. Should we perhaps just try to
72 # re-invoke Configure -Dcc=gcc config_args ?
73 if $test -f usethreads.cbu; then
76 *** However, any setting of the C compiler flags (e.g. for thread support)
77 *** will be lost. It may be necessary for you to restart Configure and
78 *** add -Dcc=gcc to your Configure command line.
81 rp="Would you like to go ahead and try gcc anyway?"
84 rp="Would you like to use it?"
87 if $test -f myread; then
90 if $test -f UU/myread; then
93 echo "Cannot find myread, sorry. Aborting." >&2
98 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
111 cat <<'EOSC' >>checkcc
116 int main(int argc, char *argv[]) {
120 if $cc -o try $ccflags $ldflags try.c; then
123 if $test X"$despair" = Xyes; then
124 echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
127 You need to find a working C compiler.
128 Either (purchase and) install the C compiler supplied by your OS vendor,
129 or for a free C compiler try http://gcc.gnu.org/
130 I cannot continue any further, aborting.