Commit | Line | Data |
---|---|---|
fd1a35d0 JH |
1 | ?RCS: $Id$ |
2 | ?RCS: | |
3 | ?RCS: Copyright (c) 2000, Jarkko Hietaniemi | |
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: | |
3bb42500 | 11 | ?MAKE:gccversion gccosandvers: cat cpp rm +cc \ |
0f00356b | 12 | Mcc Myread Guess Options Oldconfig Loc osname osvers run |
fd1a35d0 JH |
13 | ?MAKE: -pick add $@ %< |
14 | ?S:gccversion: | |
15 | ?S: If GNU cc (gcc) is used, this variable holds '1' or '2' to | |
16 | ?S: indicate whether the compiler is version 1 or 2. This is used in | |
17 | ?S: setting some of the default cflags. It is set to '' if not gcc. | |
18 | ?S:. | |
5fc71efb KS |
19 | ?S:gccosandvers: |
20 | ?S: If GNU cc (gcc) is used, this variable the operating system and | |
fcc4de7b JH |
21 | ?S: version used to compile the gcc. It is set to '' if not gcc, |
22 | ?S: or if nothing useful can be parsed as the os version. | |
5fc71efb | 23 | ?S:. |
559accf2 | 24 | ?T:gccshortvers |
fd1a35d0 JH |
25 | ?D:gccversion='' |
26 | ?LINT:change cpp | |
77506990 | 27 | ?LINT:extern ccflags |
fd1a35d0 | 28 | ?LINT:extern ldflags |
3bb42500 JH |
29 | ?LINT:extern ccname |
30 | ?LINT:change ccname | |
7ab230d2 | 31 | ?LINT:change ccflags |
fd1a35d0 JH |
32 | ?X: Check if they have gcc in any guise. |
33 | echo " " | |
34 | echo "Checking for GNU cc in disguise and/or its version number..." >&4 | |
0f00356b | 35 | $cat >try.c <<EOM |
fd1a35d0 JH |
36 | #include <stdio.h> |
37 | int main() { | |
38 | #ifdef __GNUC__ | |
39 | #ifdef __VERSION__ | |
40 | printf("%s\n", __VERSION__); | |
41 | #else | |
42 | printf("%s\n", "1"); | |
43 | #endif | |
44 | #endif | |
45 | exit(0); | |
46 | } | |
47 | EOM | |
0f00356b JH |
48 | if $cc -o try $ccflags $ldflags try.c; then |
49 | gccversion=`$run ./try` | |
fd1a35d0 JH |
50 | case "$gccversion" in |
51 | '') echo "You are not using GNU cc." ;; | |
52 | *) echo "You are using GNU cc $gccversion." | |
05c8895a | 53 | ccname=gcc |
fd1a35d0 JH |
54 | ;; |
55 | esac | |
56 | else | |
57 | echo " " | |
58 | echo "*** WHOA THERE!!! ***" >&4 | |
59 | echo " Your C compiler \"$cc\" doesn't seem to be working!" >&4 | |
60 | ?X: using -K will prevent aborting--maybe they're cross compiling? | |
61 | case "$knowitall" in | |
62 | '') | |
63 | echo " You'd better start hunting for one and let me know about it." >&4 | |
64 | exit 1 | |
65 | ;; | |
66 | esac | |
67 | fi | |
0f00356b | 68 | $rm -f try try.* |
fd1a35d0 JH |
69 | case "$gccversion" in |
70 | 1*) cpp=`./loc gcc-cpp $cpp $pth` ;; | |
71 | esac | |
5fc71efb KS |
72 | case "$gccversion" in |
73 | '') gccosandvers='' ;; | |
559accf2 JH |
74 | *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'` |
75 | gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"` | |
76 | gccshortvers='' | |
5fc71efb | 77 | case "$gccosandvers" in |
fcc4de7b JH |
78 | $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr |
79 | $osname$osvers) ;; # looking good | |
5fc71efb KS |
80 | $osname*) cat <<EOM >&4 |
81 | ||
82 | *** WHOA THERE!!! *** | |
83 | ||
84 | Your gcc has not been compiled for the exact release of | |
85 | your operating system ($gccosandvers versus $osname$osvers). | |
86 | ||
87 | In general it is a good idea to keep gcc synchronized with | |
88 | the operating system because otherwise serious problems | |
89 | may ensue when trying to compile software, like Perl. | |
90 | ||
91 | I'm trying to be optimistic here, though, and will continue. | |
92 | If later during the configuration and build icky compilation | |
fcc4de7b JH |
93 | problems appear (headerfile conflicts being the most common |
94 | manifestation), I suggest reinstalling the gcc to match | |
5fc71efb KS |
95 | your operating system release. |
96 | ||
97 | EOM | |
98 | ;; | |
1c7fa146 | 99 | *) gccosandvers='' ;; # failed to parse, better be silent |
5fc71efb KS |
100 | esac |
101 | ;; | |
102 | esac | |
05c8895a JH |
103 | case "$ccname" in |
104 | '') ccname="$cc" ;; | |
105 | esac | |
fd1a35d0 | 106 | |
7ab230d2 | 107 |