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