3 ?RCS: Copyright (c) 2000, Jarkko Hietaniemi
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.
11 ?MAKE:gccversion gccosandvers gccansipedantic: cat cpp rm +cc \
12 Mcc Myread Guess Options Oldconfig Loc osname osvers run
13 ?MAKE: -pick add $@ %<
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.
20 ?S: If GNU cc (gcc) is used, this variable holds the operating system
21 ?S: and version used to compile gcc. It is set to '' if not gcc,
22 ?S: or if nothing useful can be parsed as the os version.
25 ?S: If GNU cc (gcc) is used, this variable will enable (if set) the
26 ?S: -ansi and -pedantic ccflags for building core files (through
27 ?S: cflags script). (See Porting/pumpkin.pod for full description).
38 ?LINT:extern locincpth
41 ?LINT:change locincpth
42 ?LINT:set gccansipedantic
43 ?X: Check if they have gcc in any guise.
44 : Check if we are using GNU gcc and what its version is
46 echo "Checking for GNU cc in disguise and/or its version number..." >&4
50 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
52 printf("%s\n", __VERSION__);
60 if $cc -o try $ccflags $ldflags try.c; then
61 gccversion=`$run ./try`
63 '') echo "You are not using GNU cc." ;;
64 *) echo "You are using GNU cc $gccversion."
70 echo "*** WHOA THERE!!! ***" >&4
71 echo " Your C compiler \"$cc\" doesn't seem to be working!" >&4
72 ?X: using -K will prevent aborting--maybe they're cross compiling?
75 echo " You'd better start hunting for one and let me know about it." >&4
82 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
85 '') gccosandvers='' ;;
86 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
87 gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
89 case "$gccosandvers" in
90 $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
91 $osname$osvers) ;; # looking good
92 $osname*) cat <<EOM >&4
96 Your gcc has not been compiled for the exact release of
97 your operating system ($gccosandvers versus $osname$osvers).
99 In general it is a good idea to keep gcc synchronized with
100 the operating system because otherwise serious problems
101 may ensue when trying to compile software, like Perl.
103 I'm trying to be optimistic here, though, and will continue.
104 If later during the configuration and build icky compilation
105 problems appear (headerfile conflicts being the most common
106 manifestation), I suggest reinstalling the gcc to match
107 your operating system release.
111 *) gccosandvers='' ;; # failed to parse, better be silent
119 # gcc 3.* complain about adding -Idirectories that they already know about,
120 # so we will take those off from locincpth.
121 case "$gccversion" in
123 echo "main(){}">try.c
124 for incdir in $locincpth; do
125 warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
126 grep '^c[cp]p*[01]: warning: changing search order '`
127 if test "X$warn" != X; then
128 locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`