perl 5.0 alpha 9
[p5sagit/p5-mst-13.2.git] / U / ccflags.U
CommitLineData
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
56case "$optimize" in
57' ') dflt="none";;
58'') dflt="-g";;
59*) dflt="$optimize";;
60esac
61$cat <<EOH
62
63Some C compilers have problems with their optimizers, by default, $package
64compiles with the -O flag to use the optimizer. Alternately, you might want
65to use the symbolic debugger, which uses the -g flag (on traditional Unix
66systems). Either flag can be specified here. To use neither flag, specify
67the word "none".
68
69EOH
70rp="What optimizer/debugger flag should be used?"
71. ./myread
72optimize="$ans"
73case "$optimize" in
74'none') optimize=" ";;
75esac
76
85e6fe83 77dflt=''
2304df62 78case "$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 97esac
98
99?X: In USG mode, a MIPS system may need some BSD includes
100case "$mips_type" in
101*BSD*) ;;
102'') ;;
103*) inclwanted="$inclwanted $usrinc/bsd";;
104esac
105for 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
114done
115
116?X: Include test function (header, symbol)
117inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
118 xxx=true;
119elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
120 xxx=true;
121else
122 xxx=false;
123fi;
124if $xxx; then
125 case "$dflt" in
126 *$2*);;
127 *) dflt="$dflt -D$2";;
128 esac;
129fi'
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:
135if ./osf1; then
136 set signal.h __LANGUAGE_C__; eval $inctest
137else
138 set signal.h LANGUAGE_C; eval $inctest
139fi
140set signal.h NO_PROTOTYPE; eval $inctest
141set signal.h _NO_PROTO; eval $inctest
142
143case "$dflt" in
144'') dflt=none;;
145esac
85e6fe83 146case "$ccflags" in
147'') ;;
148*) dflt="$ccflags";;
149esac
2304df62 150$cat <<EOH
151
152Your 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,
154but you should NOT include libraries or ld flags like -lwhatever. If you
155want $package to honor its debug switch, you should include -DDEBUGGING here.
156To use no flags, specify the word "none".
157
85e6fe83 158Your C compiler might also need additional flags, such as -DJMPCLOBBER,
159-DHIDEMYMALLOC or -DCRIPPLED_CC.
2304df62 160EOH
161?X: strip leading space
162set X $dflt
163shift
164dflt=${1+"$@"}
165rp="Any additional cc flags?"
166. ./myread
167case "$ans" in
168none) ccflags='';;
169*) ccflags="$ans";;
170esac
171
172: the following weeds options from ccflags that are of no interest to cpp
173cppflags="$ccflags"
174case "$cc" in
85e6fe83 175*gcc*) case "$gccversion" in
176 1) cppflags="$cppflags -D__GNUC__" ;;
177 esac
178 ;;
2304df62 179esac
180case "$mips_type" in
181'');;
182*BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
183esac
184case "$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 ;;
198esac
199
200: flags used in final linking phase
201case "$ldflags" in
202'') if venix; then
203 dflt='-i -z'
204 else
205 dflt='none'
206 fi
207 ;;
208*) dflt="$ldflags";;
209esac
210echo " "
211rp="Any additional ld flags (NOT including libraries)?"
212. ./myread
213case "$ans" in
214none) ldflags='';;
215*) ldflags="$ans";;
216esac
217rmlist="$rmlist pdp11"
218
219@if lkflags
220: partial linking may need other flags
221case "$lkflags" in
222'') case "$ldflags" in
223 '') dflt='none';;
224 *) dflt="$ldflags";;
225 esac;;
226*) dflt="$lkflags";;
227esac
228echo " "
229rp="Partial linking flags to be used (NOT including -r)?"
230. ./myread
231case "$ans" in
232none) lkflags='';;
233*) lkflags="$ans";;
234esac
235
236@end