perl 5.0 alpha 8
[p5sagit/p5-mst-13.2.git] / U / cc.U
CommitLineData
2304df62 1?X: These units are based on the ones supplied with dist-3.0
2?X: patchlevel 22. They have been changed or enhanced to work with
3?X: perl5alpha. I would appreciate hearing about any changes,
4?X: corrections, or enhancements.
5?X: Andy Dougherty doughera@lafcol.lafayette.edu
6?X: Dept. of Physics
7?X: Lafayette College
8?X: Easton, PA 18042-1782
9?X: Sat Apr 2 15:45:17 EST 1994
10?RCS: $Id: cc.U,v 3.0 1993/08/18 12:05:30 ram Exp $
11?RCS:
12?RCS: Copyright (c) 1991-1993, Raphael Manfredi
13?RCS:
14?RCS: You may redistribute only under the terms of the Artistic Licence,
15?RCS: as specified in the README file that comes with the distribution.
16?RCS: You may reuse parts of this distribution only within the terms of
17?RCS: that same Artistic Licence; a copy of which may be found at the root
18?RCS: of the source tree for dist 3.0.
19?RCS:
20?RCS: $Log: cc.U,v $
21?RCS: Revision 3.0 1993/08/18 12:05:30 ram
22?RCS: Baseline for dist 3.0 netwide release.
23?RCS:
24?MAKE:gccversion cc: cat contains sysman +large cpp \
25 Mcc Myread Guess Oldconfig Loc
26?MAKE: -pick add $@ %<
27?S:cc:
28?S: This variable holds the name of a command to execute a C compiler which
29?S: can resolve multiple global references that happen to have the same
30?S: name. Usual values are "cc", "Mcc", "cc -M", and "gcc".
31?S:.
32?S:gccversion:
33?S: If GNU cc (gcc) is used, this variable holds '1' or '2' to
34?S: indicate whether the compiler is version 1 or 2. This is used in
35?S: setting some of the default cflags.
36?D:cc='cc'
37?INIT:gccversion=''
38?LINT:change cpp
39: see if we need a special compiler
40echo " "
41if usg; then
42 case "$cc" in
43 '') case "$Mcc" in
44 /*) dflt='Mcc';;
45 *) case "$large" in
46 -M*) dflt='cc';;
47 *) if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
48 if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
49 dflt='cc'
50 else
51 dflt='cc -M'
52 fi
53 else
54 dflt='cc'
55 fi;;
56 esac;;
57 esac;;
58 *) dflt="$cc";;
59 esac
60 $cat <<'EOM'
61On some systems the default C compiler will not resolve multiple global
62references that happen to have the same name. On some such systems the "Mcc"
63command may be used to force these to be resolved. On other systems a "cc -M"
64command is required. (Note that the -M flag on other systems indicates a
65memory model to use!) If you have the Gnu C compiler, you might wish to use
66that instead.
67
68EOM
69 rp="What command will force resolution on this system?"
70 . ./myread
71 cc="$ans"
72else
73 case "$cc" in
74 '') dflt=cc;;
75 *) dflt="$cc";;
76 esac
77 rp="Use which C compiler?"
78 . ./myread
79 cc="$ans"
80fi
81case "$cc" in
82gcc*) echo "Checking out which version of gcc"
83$cat >gccvers.c <<EOM
84#include <stdio.h>
85int main()
86{
87char *v;
88v = "unknown";
89#ifdef __GNUC__
90# ifdef __VERSION__
91 v = __VERSION__;
92# endif
93#endif
94switch((int) v[0])
95 {
96 case '1': printf("1\n"); break;
97 case '2': printf("2\n"); break;
98 case '3': printf("3\n"); break;
99 default: break;
100 }
101#ifdef __GNUC__
102return 0;
103#else
104return 1;
105#endif
106}
107EOM
108 if $cc -o gccvers $ccflags gccvers.c >/dev/null 2>&1; then
109 gccversion=`./gccvers`
110 echo "You appear to have version $gccversion."
111 else
112 echo "Doesn't appear to be GNU cc."
113 fi
114 $rm -f gccvers*
115 if $test "$gccversion" = '1'; then
116 cpp=`./loc gcc-cpp $cpp $pth`
117 fi
118 ;;
119esac