Commit | Line | Data |
---|---|---|
a02608de | 1 | case $PERL_CONFIG_SH in |
1c3d792e | 2 | '') |
a0d0e21e | 3 | if test -f config.sh; then TOP=.; |
4 | elif test -f ../config.sh; then TOP=..; | |
5 | elif test -f ../../config.sh; then TOP=../..; | |
6 | elif test -f ../../../config.sh; then TOP=../../..; | |
7 | elif test -f ../../../../config.sh; then TOP=../../../..; | |
8 | else | |
9 | echo "Can't find config.sh."; exit 1 | |
10 | fi | |
11 | . $TOP/config.sh | |
12 | ;; | |
1c3d792e | 13 | esac |
2b317908 | 14 | : This forces SH files to create target in same directory as SH file. |
15 | : This is so that make depend always knows where to find SH derivatives. | |
1c3d792e | 16 | case "$0" in |
17 | */*) cd `expr X$0 : 'X\(.*\)/'` ;; | |
18 | esac | |
bc730b18 | 19 | |
20 | warn='' | |
21 | ||
22 | # Add -Wall for the core modules iff gcc and not already -Wall | |
23 | case "$gccversion" in | |
24 | '') ;; | |
25 | Intel*) ;; # The Intel C++ plays gcc on TV but is not really it. | |
26 | *) case "$ccflags" in | |
27 | *-Wall*) ;; | |
28 | *) warn="$warn -Wall" ;; | |
29 | esac | |
30 | ;; | |
31 | esac | |
32 | ||
33 | # The gcc -ansi -pedantic require their own dance, too. | |
34 | case "$gccversion" in | |
35 | '') ;; | |
11fcce85 | 36 | Intel*) ;; # Is that you, Intel C++? |
bc730b18 | 37 | *) case "$gccansipedantic" in |
38 | define) | |
39 | case "$gccversion" in | |
40 | [12]*) ;; # gcc versions 1 (gasp!) and 2 are not good for this. | |
41 | *) case "$osname" in | |
42 | # Add -ansi -pedantic only for known platforms. | |
43 | aix|dec_osf|freebsd|hpux|irix|linux) | |
44 | ansipedantic="-ansi -pedantic" ;; | |
45 | solaris) | |
46 | # Can't add -ansi for Solaris. | |
47 | # Off_t/off_t is a struct in Solaris with largefiles, and with -ansi | |
48 | # that struct cannot be compared with a flat integer, such as a STRLEN. | |
49 | # The -ansi will also cause a lot of noise in Solaris because of: | |
50 | # /usr/include/sys/resource.h:148: warning: `struct rlimit64' declared inside parameter list | |
51 | ansipedantic="-pedantic" ;; | |
52 | esac | |
53 | for i in $ansipedantic | |
54 | do | |
55 | case "$ccflags" in | |
56 | *$i*) ;; | |
57 | *) warn="$warn $i" ;; | |
58 | esac | |
59 | done | |
60 | case "$warn$ccflags" in | |
61 | *-pedantic*) warn="$warn -DPERL_GCC_PEDANTIC" ;; | |
62 | esac | |
63 | ;; | |
64 | esac | |
65 | ;; | |
66 | esac | |
67 | ;; | |
68 | esac | |
69 | ||
70 | # Further gcc warning options. | |
71 | case "$gccversion" in | |
72 | '') ;; | |
9ab92c42 | 73 | [12]*) ;; |
11fcce85 | 74 | Intel*) ;; # Haven't we been through this already? |
bc730b18 | 75 | *) for opt in '' extra declaration-after-statement endif-labels |
76 | do | |
77 | case " $ccflags " in | |
78 | *"-W$opt "*) ;; | |
79 | *) case "`echo >_cflags.c | $cc -W$opt -c _cflags.c -o _cflags.o 2>&1`" in | |
80 | *"unrecognized"*) ;; | |
81 | *"Invalid"*) ;; | |
82 | *) warn="$warn -W$opt" ;; | |
83 | esac | |
84 | ;; | |
85 | esac | |
86 | rm -f _cflags.c cflags.o | |
87 | done | |
88 | ;; | |
89 | esac | |
90 | ||
11fcce85 | 91 | |
92 | stdflags='' | |
93 | ||
94 | # Be strict C89 for gcc (but not for g++). | |
95 | case "$gccversion" in | |
96 | '') ;; | |
97 | Intel*) ;; # Nice try, Intel C++. | |
98 | 12]*) ;; # Go easy on the older versions of gcc. | |
99 | *) case "$cc" in | |
100 | *g++*) ;; | |
6700ad3c | 101 | *) case "$osname" in |
102 | cygwin) ;; # Fails at least up to and including 1.5.20 | |
103 | *) stdflags="$stdflags -std=c89" ;; | |
104 | esac | |
11fcce85 | 105 | esac |
106 | ;; | |
107 | esac | |
108 | ||
2b317908 | 109 | echo "Extracting cflags (with variable substitutions)" |
110 | : This section of the file will have variable substitutions done on it. | |
111 | : Move anything that needs config subs from !NO!SUBS! section to !GROK!THIS!. | |
112 | : Protect any dollar signs and backticks that you do not want interpreted | |
113 | : by putting a backslash in front. You may delete these comments. | |
165b7424 | 114 | rm -f cflags |
2b317908 | 115 | $spitshell >cflags <<!GROK!THIS! |
ecfc5424 | 116 | $startsh |
bc730b18 | 117 | |
11fcce85 | 118 | # Extra warnings, used e.g. for gcc. |
bc730b18 | 119 | warn="$warn" |
11fcce85 | 120 | # Extra standardness. |
121 | stdflags="$stdflags" | |
bc730b18 | 122 | |
2b317908 | 123 | !GROK!THIS! |
124 | ||
125 | : In the following dollars and backticks do not need the extra backslash. | |
126 | $spitshell >>cflags <<'!NO!SUBS!' | |
a02608de | 127 | case $PERL_CONFIG_SH in |
2b317908 | 128 | '') |
a0d0e21e | 129 | if test -f config.sh; then TOP=.; |
130 | elif test -f ../config.sh; then TOP=..; | |
131 | elif test -f ../../config.sh; then TOP=../..; | |
132 | elif test -f ../../../config.sh; then TOP=../../..; | |
133 | elif test -f ../../../../config.sh; then TOP=../../../..; | |
134 | else | |
135 | echo "Can't find config.sh."; exit 1 | |
136 | fi | |
137 | . $TOP/config.sh | |
138 | ;; | |
139 | esac | |
140 | ||
75550b4e | 141 | : syntax: cflags [optimize=XXX] [file[.suffix]] |
142 | : displays the compiler command line for file | |
143 | ||
1167a30e | 144 | case "X$1" in |
26102cc7 | 145 | Xoptimize=*|X"optimize=*") |
1167a30e | 146 | eval "$1" |
147 | shift | |
148 | ;; | |
149 | esac | |
150 | ||
1c3d792e | 151 | also=': ' |
152 | case $# in | |
2b317908 | 153 | 1) also='echo 1>&2 " CCCMD = "' |
1c3d792e | 154 | esac |
155 | ||
156 | case $# in | |
157 | 0) set *.c; echo "The current C flags are:" ;; | |
1c3d792e | 158 | esac |
2b317908 | 159 | |
578789a7 | 160 | set `echo "$* " | sed -e 's/\.[oc] / /g' -e 's/\.obj / /g' -e "s/\\$obj_ext / /g"` |
2b317908 | 161 | |
1c3d792e | 162 | for file do |
163 | ||
164 | case "$#" in | |
165 | 1) ;; | |
2b317908 | 166 | *) echo $n " $file.c $c" ;; |
1c3d792e | 167 | esac |
168 | ||
2b317908 | 169 | : allow variables like toke_cflags to be evaluated |
170 | ||
8736538c | 171 | if echo $file | grep -v / >/dev/null |
172 | then | |
173 | eval 'eval ${'"${file}_cflags"'-""}' | |
174 | fi | |
2b317908 | 175 | |
176 | : or customize here | |
177 | ||
1c3d792e | 178 | case "$file" in |
a0d0e21e | 179 | DB_File) ;; |
180 | GDBM_File) ;; | |
2304df62 | 181 | NDBM_File) ;; |
182 | ODBM_File) ;; | |
183 | POSIX) ;; | |
184 | SDBM_File) ;; | |
185 | av) ;; | |
4b6be2dd | 186 | byterun) ;; |
2304df62 | 187 | deb) ;; |
188 | dl) ;; | |
2b317908 | 189 | doio) ;; |
2304df62 | 190 | doop) ;; |
2b317908 | 191 | dump) ;; |
59bea8cf | 192 | globals) ;; |
2304df62 | 193 | gv) ;; |
194 | hv) ;; | |
a6ec74c1 | 195 | locale) ;; |
59bea8cf | 196 | madly) ;; |
2304df62 | 197 | main) ;; |
2b317908 | 198 | malloc) ;; |
2304df62 | 199 | mg) ;; |
200 | miniperlmain) ;; | |
a6ec74c1 | 201 | numeric) ;; |
2304df62 | 202 | op) ;; |
59bea8cf | 203 | opmini) ;; |
204 | pad) ;; | |
2b317908 | 205 | perl) ;; |
6f4183fe | 206 | perlapi) ;; |
2304df62 | 207 | perlmain) ;; |
2b317908 | 208 | perly) ;; |
2304df62 | 209 | pp) ;; |
a0d0e21e | 210 | pp_ctl) ;; |
211 | pp_hot) ;; | |
a6ec74c1 | 212 | pp_pack) ;; |
59bea8cf | 213 | pp_sort) ;; |
a0d0e21e | 214 | pp_sys) ;; |
2b317908 | 215 | regcomp) ;; |
216 | regexec) ;; | |
2304df62 | 217 | run) ;; |
218 | scope) ;; | |
219 | sv) ;; | |
220 | taint) ;; | |
2b317908 | 221 | toke) ;; |
59bea8cf | 222 | universal) ;; |
2b317908 | 223 | usersub) ;; |
59bea8cf | 224 | utf8) ;; |
2b317908 | 225 | util) ;; |
59bea8cf | 226 | xsutils) ;; |
1c3d792e | 227 | *) ;; |
228 | esac | |
229 | ||
69c7f294 | 230 | if test -f .patch; then |
231 | ccflags="-DPERL_PATCHNUM=`cat .patch` $ccflags" | |
232 | fi | |
233 | ||
c4f23d77 | 234 | : Can we perhaps use $ansi2knr here |
11fcce85 | 235 | echo "$cc -c -DPERL_CORE $ccflags $stdflags $optimize $warn" |
236 | eval "$also "'"$cc -DPERL_CORE -c $ccflags $stdflags $optimize $warn"' | |
2b317908 | 237 | |
a0d0e21e | 238 | . $TOP/config.sh |
2b317908 | 239 | |
1c3d792e | 240 | done |
2b317908 | 241 | !NO!SUBS! |
a0d0e21e | 242 | chmod 755 cflags |
2b317908 | 243 | $eunicefix cflags |