perl 5.0 alpha 8
[p5sagit/p5-mst-13.2.git] / U / ccflags.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: ccflags.U,v 3.0.1.3 1993/09/13 15:58:29 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: ccflags.U,v $
21?RCS: Revision 3.0.1.3 1993/09/13 15:58:29 ram
22?RCS: patch10: explicitely mention -DDEBUG just in case they need it (WAD)
23?RCS: patch10: removed all the "tans" variable usage (WAD)
24?RCS:
25?RCS: Revision 3.0.1.2 1993/08/27 14:39:38 ram
26?RCS: patch7: added support for OSF/1 machines
27?RCS:
28?RCS: Revision 3.0.1.1 1993/08/25 14:00:24 ram
29?RCS: patch6: added defaults for cppflags, ccflags and ldflags
30?RCS:
31?RCS: Revision 3.0 1993/08/18 12:05:31 ram
32?RCS: Baseline for dist 3.0 netwide release.
33?RCS:
34?MAKE:ccflags ldflags lkflags cppflags optimize: test cat Myread Guess \
35 Oldconfig cc gccversion mips_type +usrinc package contains
36?MAKE: -pick add $@ %<
37?S:ccflags:
38?S: This variable contains any additional C compiler flags desired by
39?S: the user. It is up to the Makefile to use this.
40?S:.
41?S:cppflags:
42?S: This variable holds the flags that will be passed to the C pre-
43?S: processor. It is up to the Makefile to use it.
44?S:.
45?S:optimize:
46?S: This variable contains any optimizer/debugger flag that should be used.
47?S: It is up to the Makefile to use it.
48?S:.
49?S:ldflags:
50?S: This variable contains any additional C loader flags desired by
51?S: the user. It is up to the Makefile to use this.
52?S:.
53?S:lkflags:
54?S: This variable contains any additional C partial linker flags desired by
55?S: the user. It is up to the Makefile to use this.
56?S:.
57?T:inctest thisincl xxx flag inclwanted
58?D:cppflags=''
59?D:ccflags=''
60?D:ldflags=''
61?INIT:: no include file wanted by default
62?INIT:inclwanted=''
63?INIT:
64: determine optimize, if desired, or use for debug flag also
65case "$optimize" in
66' ') dflt="none";;
67'') dflt="-g";;
68*) dflt="$optimize";;
69esac
70$cat <<EOH
71
72Some C compilers have problems with their optimizers, by default, $package
73compiles with the -O flag to use the optimizer. Alternately, you might want
74to use the symbolic debugger, which uses the -g flag (on traditional Unix
75systems). Either flag can be specified here. To use neither flag, specify
76the word "none".
77
78EOH
79rp="What optimizer/debugger flag should be used?"
80. ./myread
81optimize="$ans"
82case "$optimize" in
83'none') optimize=" ";;
84esac
85
86case "$ccflags" in
87'') case "$cc" in
88 *gcc*) if $test "$gccversion" = "1"; then
89 dflt='-fpcc-struct-return'
90 fi ;;
91 *) dflt='';;
92 esac
93 case "$optimize" in
94 *-g*) dflt="$dflt -DDEBUGGING";;
95 esac
96?X: check for POSIXized ISC
97 case "$cc" in
98 *gcc*) if test -d /etc/conf/kconfig.d &&
99 $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
100 then
101 dflt="$dflt -posix"
102 fi
103 ;;
104 esac
105 ;;
106*) dflt="$ccflags" ;;
107esac
108
109?X: In USG mode, a MIPS system may need some BSD includes
110case "$mips_type" in
111*BSD*) ;;
112'') ;;
113*) inclwanted="$inclwanted $usrinc/bsd";;
114esac
115for thisincl in $inclwanted; do
116 if $test -d $thisincl; then
117 if $test x$thisincl != x$usrinc; then
118 case "$dflt" in
119 *$thisincl*);;
120 *) dflt="$dflt -I$thisincl";;
121 esac
122 fi
123 fi
124done
125
126?X: Include test function (header, symbol)
127inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
128 xxx=true;
129elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
130 xxx=true;
131else
132 xxx=false;
133fi;
134if $xxx; then
135 case "$dflt" in
136 *$2*);;
137 *) dflt="$dflt -D$2";;
138 esac;
139fi'
140
141?X:
142?X: SCO unix uses NO_PROTOTYPE instead of _NO_PROTO
143?X: OSF/1 uses __LANGUAGE_C__ instead of LANGUAGE_C
144?X:
145if ./osf1; then
146 set signal.h __LANGUAGE_C__; eval $inctest
147else
148 set signal.h LANGUAGE_C; eval $inctest
149fi
150set signal.h NO_PROTOTYPE; eval $inctest
151set signal.h _NO_PROTO; eval $inctest
152
153case "$dflt" in
154'') dflt=none;;
155esac
156$cat <<EOH
157
158Your C compiler may want other flags. For this question you should include
159-I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
160but you should NOT include libraries or ld flags like -lwhatever. If you
161want $package to honor its debug switch, you should include -DDEBUGGING here.
162To use no flags, specify the word "none".
163
164Your C compiler might also need additional flags, such as -DJMPCLOBBER
165or -DCRIPPLED_CC.
166EOH
167?X: strip leading space
168set X $dflt
169shift
170dflt=${1+"$@"}
171rp="Any additional cc flags?"
172. ./myread
173case "$ans" in
174none) ccflags='';;
175*) ccflags="$ans";;
176esac
177
178: the following weeds options from ccflags that are of no interest to cpp
179cppflags="$ccflags"
180case "$cc" in
181*gcc*) if $test "$gccversion" = "1"; then
182 cppflags="$cppflags -D__GNUC__"
183 fi ;;
184esac
185case "$mips_type" in
186'');;
187*BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
188esac
189case "$cppflags" in
190'');;
191*) set X $cppflags
192 cppflags=''
193 for flag
194 do
195 case $flag in
196 -D*|-I*|-traditional|-ansi|-nostdinc) cppflags="$cppflags $flag";;
197 esac
198 done
199 case "$cppflags" in
200 *-*) echo "(C preprocessor flags: $cppflags)";;
201 esac
202 ;;
203esac
204
205: flags used in final linking phase
206case "$ldflags" in
207'') if venix; then
208 dflt='-i -z'
209 else
210 dflt='none'
211 fi
212 ;;
213*) dflt="$ldflags";;
214esac
215echo " "
216rp="Any additional ld flags (NOT including libraries)?"
217. ./myread
218case "$ans" in
219none) ldflags='';;
220*) ldflags="$ans";;
221esac
222rmlist="$rmlist pdp11"
223
224@if lkflags
225: partial linking may need other flags
226case "$lkflags" in
227'') case "$ldflags" in
228 '') dflt='none';;
229 *) dflt="$ldflags";;
230 esac;;
231*) dflt="$lkflags";;
232esac
233echo " "
234rp="Partial linking flags to be used (NOT including -r)?"
235. ./myread
236case "$ans" in
237none) lkflags='';;
238*) lkflags="$ans";;
239esac
240
241@end