Commit | Line | Data |
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 |
65 | case "$optimize" in |
66 | ' ') dflt="none";; |
67 | '') dflt="-g";; |
68 | *) dflt="$optimize";; |
69 | esac |
70 | $cat <<EOH |
71 | |
72 | Some C compilers have problems with their optimizers, by default, $package |
73 | compiles with the -O flag to use the optimizer. Alternately, you might want |
74 | to use the symbolic debugger, which uses the -g flag (on traditional Unix |
75 | systems). Either flag can be specified here. To use neither flag, specify |
76 | the word "none". |
77 | |
78 | EOH |
79 | rp="What optimizer/debugger flag should be used?" |
80 | . ./myread |
81 | optimize="$ans" |
82 | case "$optimize" in |
83 | 'none') optimize=" ";; |
84 | esac |
85 | |
86 | case "$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" ;; |
107 | esac |
108 | |
109 | ?X: In USG mode, a MIPS system may need some BSD includes |
110 | case "$mips_type" in |
111 | *BSD*) ;; |
112 | '') ;; |
113 | *) inclwanted="$inclwanted $usrinc/bsd";; |
114 | esac |
115 | for 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 |
124 | done |
125 | |
126 | ?X: Include test function (header, symbol) |
127 | inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then |
128 | xxx=true; |
129 | elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then |
130 | xxx=true; |
131 | else |
132 | xxx=false; |
133 | fi; |
134 | if $xxx; then |
135 | case "$dflt" in |
136 | *$2*);; |
137 | *) dflt="$dflt -D$2";; |
138 | esac; |
139 | fi' |
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: |
145 | if ./osf1; then |
146 | set signal.h __LANGUAGE_C__; eval $inctest |
147 | else |
148 | set signal.h LANGUAGE_C; eval $inctest |
149 | fi |
150 | set signal.h NO_PROTOTYPE; eval $inctest |
151 | set signal.h _NO_PROTO; eval $inctest |
152 | |
153 | case "$dflt" in |
154 | '') dflt=none;; |
155 | esac |
156 | $cat <<EOH |
157 | |
158 | Your 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, |
160 | but you should NOT include libraries or ld flags like -lwhatever. If you |
161 | want $package to honor its debug switch, you should include -DDEBUGGING here. |
162 | To use no flags, specify the word "none". |
163 | |
164 | Your C compiler might also need additional flags, such as -DJMPCLOBBER |
165 | or -DCRIPPLED_CC. |
166 | EOH |
167 | ?X: strip leading space |
168 | set X $dflt |
169 | shift |
170 | dflt=${1+"$@"} |
171 | rp="Any additional cc flags?" |
172 | . ./myread |
173 | case "$ans" in |
174 | none) ccflags='';; |
175 | *) ccflags="$ans";; |
176 | esac |
177 | |
178 | : the following weeds options from ccflags that are of no interest to cpp |
179 | cppflags="$ccflags" |
180 | case "$cc" in |
181 | *gcc*) if $test "$gccversion" = "1"; then |
182 | cppflags="$cppflags -D__GNUC__" |
183 | fi ;; |
184 | esac |
185 | case "$mips_type" in |
186 | '');; |
187 | *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";; |
188 | esac |
189 | case "$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 | ;; |
203 | esac |
204 | |
205 | : flags used in final linking phase |
206 | case "$ldflags" in |
207 | '') if venix; then |
208 | dflt='-i -z' |
209 | else |
210 | dflt='none' |
211 | fi |
212 | ;; |
213 | *) dflt="$ldflags";; |
214 | esac |
215 | echo " " |
216 | rp="Any additional ld flags (NOT including libraries)?" |
217 | . ./myread |
218 | case "$ans" in |
219 | none) ldflags='';; |
220 | *) ldflags="$ans";; |
221 | esac |
222 | rmlist="$rmlist pdp11" |
223 | |
224 | @if lkflags |
225 | : partial linking may need other flags |
226 | case "$lkflags" in |
227 | '') case "$ldflags" in |
228 | '') dflt='none';; |
229 | *) dflt="$ldflags";; |
230 | esac;; |
231 | *) dflt="$lkflags";; |
232 | esac |
233 | echo " " |
234 | rp="Partial linking flags to be used (NOT including -r)?" |
235 | . ./myread |
236 | case "$ans" in |
237 | none) lkflags='';; |
238 | *) lkflags="$ans";; |
239 | esac |
240 | |
241 | @end |