Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100755 342 lines (302 sloc) 9.701 kB
a02608d @jhi The problem described in 20010514.031 still wasn't
jhi authored
1 case $PERL_CONFIG_SH in
1c3d792 perl 4.0 patch 1: (combined patch)
Larry Wall authored
2 '')
a0d0e21 perl 5.000
Larry Wall authored
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 ;;
1c3d792 perl 4.0 patch 1: (combined patch)
Larry Wall authored
13 esac
2b31790 perl 4.0 patch 5: patch #4, continued
Larry Wall authored
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.
1c3d792 perl 4.0 patch 1: (combined patch)
Larry Wall authored
16 case "$0" in
17 */*) cd `expr X$0 : 'X\(.*\)/'` ;;
18 esac
bc730b1 @jhi cflags.SH: scan the gcc warning flags only once, during .SH expansion
jhi authored
19
37723eb @jhi cflags.SH: 30327 wasn't portable Bourne (avoid '!: not found')
jhi authored
20 if test -f config_h.SH -a ! -f config.h; then
6ef8aa7 @rgs cflags.SH was broken: it was compiling a C file for testing available
rgs authored
21 . ./config_h.SH
11e2f39 @rgs Avoid to run config_h.SH twice during configuration.
rgs authored
22 CONFIG_H=already-done
6ef8aa7 @rgs cflags.SH was broken: it was compiling a C file for testing available
rgs authored
23 fi
24
bc730b1 @jhi cflags.SH: scan the gcc warning flags only once, during .SH expansion
jhi authored
25 warn=''
26
27 # Add -Wall for the core modules iff gcc and not already -Wall
28 case "$gccversion" in
29 '') ;;
30 Intel*) ;; # The Intel C++ plays gcc on TV but is not really it.
31 *) case "$ccflags" in
32 *-Wall*) ;;
33 *) warn="$warn -Wall" ;;
34 esac
35 ;;
36 esac
37
a07cd53 @jhi Re: [PATCH] cflags.SH: rethink of the gcc -std=c89 and -pedantic
jhi authored
38 # Create a test source file for testing what options can be fed to
39 # gcc in this system; include a selection of most common and commonly
40 # hairy include files.
41
42 cat >_cflags.c <<__EOT__
43 #include "EXTERN.h"
44 #include "perl.h"
45 /* The stdio.h, errno.h, and setjmp.h should be there in any ANSI C89. */
46 #include <stdio.h>
47 #include <errno.h>
48 #include <setjmp.h>
49 /* Just in case the inclusion of perl.h did not
50 * pull in enough system headers, let's try again. */
51 #ifdef I_STDLIB
52 #include <stdlib.h>
53 #endif
54 #ifdef I_STDDEF
55 #include <stddef.h>
56 #endif
57 #ifdef I_STDARG
58 #include <stdarg.h>
59 #endif
60 #ifdef I_LIMITS
61 #include <limits.h>
62 #endif
63 #ifdef I_DIRENT
64 #include <dirent.h>
65 #endif
66 #ifdef I_UNISTD
67 #include <unistd.h>
68 #endif
463bdba Re: [perl #46725] v5.10.0 util.c and pp_sys.c fail to compile under M…
Andy Dougherty authored
69 #ifdef I_SYS_TYPES
a07cd53 @jhi Re: [PATCH] cflags.SH: rethink of the gcc -std=c89 and -pedantic
jhi authored
70 #include <sys/types.h>
71 #endif
463bdba Re: [perl #46725] v5.10.0 util.c and pp_sys.c fail to compile under M…
Andy Dougherty authored
72 #ifdef I_SYS_PARAM
a07cd53 @jhi Re: [PATCH] cflags.SH: rethink of the gcc -std=c89 and -pedantic
jhi authored
73 #include <sys/param.h>
74 #endif
463bdba Re: [perl #46725] v5.10.0 util.c and pp_sys.c fail to compile under M…
Andy Dougherty authored
75 #ifdef I_SYS_RESOURCE
a07cd53 @jhi Re: [PATCH] cflags.SH: rethink of the gcc -std=c89 and -pedantic
jhi authored
76 #include <sys/resource.h>
77 #endif
463bdba Re: [perl #46725] v5.10.0 util.c and pp_sys.c fail to compile under M…
Andy Dougherty authored
78 #ifdef I_SYS_SELECT
a07cd53 @jhi Re: [PATCH] cflags.SH: rethink of the gcc -std=c89 and -pedantic
jhi authored
79 #include <sys/select.h>
80 #endif
81 #if defined(HAS_SOCKET) && !defined(VMS) && !defined(WIN32) /* See perl.h. */
82 #include <sys/socket.h>
83 #endif
463bdba Re: [perl #46725] v5.10.0 util.c and pp_sys.c fail to compile under M…
Andy Dougherty authored
84 #ifdef I_SYS_STAT
a07cd53 @jhi Re: [PATCH] cflags.SH: rethink of the gcc -std=c89 and -pedantic
jhi authored
85 #include <sys/stat.h>
86 #endif
463bdba Re: [perl #46725] v5.10.0 util.c and pp_sys.c fail to compile under M…
Andy Dougherty authored
87 #ifdef I_SYS_TIME
a07cd53 @jhi Re: [PATCH] cflags.SH: rethink of the gcc -std=c89 and -pedantic
jhi authored
88 #include <sys/time.h>
89 #endif
463bdba Re: [perl #46725] v5.10.0 util.c and pp_sys.c fail to compile under M…
Andy Dougherty authored
90 #ifdef I_SYS_TIMES
a07cd53 @jhi Re: [PATCH] cflags.SH: rethink of the gcc -std=c89 and -pedantic
jhi authored
91 #include <sys/times.h>
92 #endif
463bdba Re: [perl #46725] v5.10.0 util.c and pp_sys.c fail to compile under M…
Andy Dougherty authored
93 #ifdef I_SYS_WAIT
a07cd53 @jhi Re: [PATCH] cflags.SH: rethink of the gcc -std=c89 and -pedantic
jhi authored
94 #include <sys/wait.h>
95 #endif
96 /* The gcc -ansi can cause a lot of noise in Solaris because of:
97 /usr/include/sys/resource.h:148: warning: 'struct rlimit64' declared inside parameter list
98 */
99 int main(int argc, char *argv[]) {
100
101 /* Add here test code found to be problematic in some gcc platform. */
102
103 /* Off_t/off_t is a struct in Solaris with largefiles, and with gcc -ansi
104 * that struct cannot be compared in some gcc releases with a flat
105 * integer, such as a STRLEN. */
106
215ed6c FreeBSD atoll() warning (Was Re: Code freeze
Andy Dougherty authored
107 IV iv;
a07cd53 @jhi Re: [PATCH] cflags.SH: rethink of the gcc -std=c89 and -pedantic
jhi authored
108 Off_t t0a = 2;
109 STRLEN t0b = 3;
110 int t0c = t0a == t0b;
111
215ed6c FreeBSD atoll() warning (Was Re: Code freeze
Andy Dougherty authored
112 /* In FreeBSD 6.2 (and probably other releases too), with -Duse64bitint,
113 perl will use atoll(3). However, that declaration is hidden in <stdlib.h>
114 if we force the compiler to use -std=c89 mode.
115 */
116 iv = Atol("42");
117
118 return (!t0c && (iv == 42)) ? 0 : -1; /* Try to avoid 'unused' warnings. */
a07cd53 @jhi Re: [PATCH] cflags.SH: rethink of the gcc -std=c89 and -pedantic
jhi authored
119 }
120 __EOT__
121
122 stdflags=''
bc730b1 @jhi cflags.SH: scan the gcc warning flags only once, during .SH expansion
jhi authored
123
215ed6c FreeBSD atoll() warning (Was Re: Code freeze
Andy Dougherty authored
124 # Further gcc warning options. Build up a list of options that work.
125 # Note that some problems may only show up with combinations of options,
126 # e.g. a warning might show up only with -Wall -ansi, not with either
127 # one individually.
128 # TODO: Ponder whether to migrate this back to Configure so hints files can
129 # tweak it. Also, be paranoid about whether results we've deduced in Configure
130 # (especially about things like long long, which are not in C89) will still be
131 # valid if we now add flags like -std=c89.
132
bc730b1 @jhi cflags.SH: scan the gcc warning flags only once, during .SH expansion
jhi authored
133 case "$gccversion" in
134 '') ;;
a07cd53 @jhi Re: [PATCH] cflags.SH: rethink of the gcc -std=c89 and -pedantic
jhi authored
135 [12]*) ;; # gcc versions 1 (gasp!) and 2 are not good for this.
136 Intel*) ;; # # Is that you, Intel C++?
db7198b RT #74436: [PATCH] Add -Wwrite-strings
Robin Barker authored
137 *) for opt in -ansi -std=c89 -W -Wextra -Wdeclaration-after-statement \
138 -Wendif-labels -Wc++-compat -Wwrite-strings
bc730b1 @jhi cflags.SH: scan the gcc warning flags only once, during .SH expansion
jhi authored
139 do
140 case " $ccflags " in
a07cd53 @jhi Re: [PATCH] cflags.SH: rethink of the gcc -std=c89 and -pedantic
jhi authored
141 *" $opt "*) ;; # Skip if already there.
142 *) rm -f _cflags$_exe
463bdba Re: [perl #46725] v5.10.0 util.c and pp_sys.c fail to compile under M…
Andy Dougherty authored
143 case "`$cc $cflags $warn $stdflags $opt _cflags.c -o _cflags$_exe 2>&1`" in
bc730b1 @jhi cflags.SH: scan the gcc warning flags only once, during .SH expansion
jhi authored
144 *"unrecognized"*) ;;
215ed6c FreeBSD atoll() warning (Was Re: Code freeze
Andy Dougherty authored
145 *"implicit declaration"*) ;; # Was something useful hidden?
bc730b1 @jhi cflags.SH: scan the gcc warning flags only once, during .SH expansion
jhi authored
146 *"Invalid"*) ;;
9ac4c10 @jhi cflags.SH: strip -std=c89 for g++
jhi authored
147 *"is valid for C"*) ;;
a07cd53 @jhi Re: [PATCH] cflags.SH: rethink of the gcc -std=c89 and -pedantic
jhi authored
148 *) if test -x _cflags$_exe
149 then
150 case "$opt" in
151 -std*) stdflags="$stdflags $opt" ;;
152 *) warn="$warn $opt" ;;
153 esac
154 fi
155 ;;
bc730b1 @jhi cflags.SH: scan the gcc warning flags only once, during .SH expansion
jhi authored
156 esac
157 ;;
158 esac
159 done
160 ;;
161 esac
a07cd53 @jhi Re: [PATCH] cflags.SH: rethink of the gcc -std=c89 and -pedantic
jhi authored
162 rm -f _cflags.c _cflags$_exe
bc730b1 @jhi cflags.SH: scan the gcc warning flags only once, during .SH expansion
jhi authored
163
9ac4c10 @jhi cflags.SH: strip -std=c89 for g++
jhi authored
164 case "$gccversion" in
165 '') ;;
166 *)
3e8416a @rgs If we have specified -Dgccansipedantic on the Configure command-line,
rgs authored
167 if [ "$gccansipedantic" = "" ]; then
168 # If we have -Duse64bitint (or equivalent) in effect and the quadtype
169 # has become 'long long', gcc -pedantic becomes unbearable (moreso
170 # when combined with -Wall) because long long and LL and %lld|%Ld
171 # become warn-worthy. So let's drop the -pedantic in that case.
172 case "$quadtype:$sPRId64" in
173 "long long"*|*lld*|*Ld*)
174 ccflags="`echo $ccflags|sed 's/-pedantic/ /'`"
175 warn="`echo $warn|sed 's/-pedantic/ /'`"
176 ;;
177 esac
215ed6c FreeBSD atoll() warning (Was Re: Code freeze
Andy Dougherty authored
178 # Similarly, since 'long long' isn't part of C89, FreeBSD 6.2 headers
179 # don't declare atoll() under -std=c89, but we need it. In general,
180 # insisting on -std=c89 is inconsistent with insisting on using
181 # 'long long'. So drop -std=c89 and -ansi as well if we're using
182 # 'long long' as our main integral type.
183 case "$ivtype" in
184 "long long")
185 ccflags=`echo $ccflags|sed -e 's/-pedantic/ /' -e 's/-std=c89/ /' -e 's/-ansi/ /'`
186 warn=`echo $warn|sed -e 's/-pedantic/ /' -e 's/-ansi/ /'`
a510538 typo?
Robin Barker authored
187 stdflags=`echo $stdflags|sed -e 's/-std=c89/ /'`
215ed6c FreeBSD atoll() warning (Was Re: Code freeze
Andy Dougherty authored
188 ;;
189 esac
3e8416a @rgs If we have specified -Dgccansipedantic on the Configure command-line,
rgs authored
190 fi
5cf489d @rgs Typo fix (by Dominic Dunlop)
rgs authored
191 # Using certain features (like the gcc statement expressions)
192 # requires knowing whether -pedantic has been specified.
9ac4c10 @jhi cflags.SH: strip -std=c89 for g++
jhi authored
193 case "$warn$ccflags" in
194 *-pedantic*) warn="$warn -DPERL_GCC_PEDANTIC" ;;
195 esac
a07cd53 @jhi Re: [PATCH] cflags.SH: rethink of the gcc -std=c89 and -pedantic
jhi authored
196 ;;
197 esac
b1e55ca @jhi g++ heavy shoveling
jhi authored
198
10edeb5 @jhi g++ large patch
jhi authored
199 # Code to set any extra flags here.
a07cd53 @jhi Re: [PATCH] cflags.SH: rethink of the gcc -std=c89 and -pedantic
jhi authored
200 extra=''
11fcce8 @jhi Re: [PATCH] cflags.SH: add -std=c89
jhi authored
201
2b31790 perl 4.0 patch 5: patch #4, continued
Larry Wall authored
202 echo "Extracting cflags (with variable substitutions)"
203 : This section of the file will have variable substitutions done on it.
204 : Move anything that needs config subs from !NO!SUBS! section to !GROK!THIS!.
205 : Protect any dollar signs and backticks that you do not want interpreted
206 : by putting a backslash in front. You may delete these comments.
165b742 Remove old version of target before creating new one
Perl 5 Porters authored
207 rm -f cflags
2b31790 perl 4.0 patch 5: patch #4, continued
Larry Wall authored
208 $spitshell >cflags <<!GROK!THIS!
ecfc542 perl5.000 patch.0g: [various portability fixes, and use latest metaco…
Andy Dougherty authored
209 $startsh
bc730b1 @jhi cflags.SH: scan the gcc warning flags only once, during .SH expansion
jhi authored
210
11fcce8 @jhi Re: [PATCH] cflags.SH: add -std=c89
jhi authored
211 # Extra warnings, used e.g. for gcc.
bc730b1 @jhi cflags.SH: scan the gcc warning flags only once, during .SH expansion
jhi authored
212 warn="$warn"
11fcce8 @jhi Re: [PATCH] cflags.SH: add -std=c89
jhi authored
213 # Extra standardness.
214 stdflags="$stdflags"
b1e55ca @jhi g++ heavy shoveling
jhi authored
215 # Extra extra.
216 extra="$extra"
dcff826 @demerphq eliminate .patchnum and related infrastrcuture from *nix based build …
demerphq authored
217 # what do executables look like?
218 _exe="$_exe"
bc730b1 @jhi cflags.SH: scan the gcc warning flags only once, during .SH expansion
jhi authored
219
2b31790 perl 4.0 patch 5: patch #4, continued
Larry Wall authored
220 !GROK!THIS!
221
222 : In the following dollars and backticks do not need the extra backslash.
223 $spitshell >>cflags <<'!NO!SUBS!'
a02608d @jhi The problem described in 20010514.031 still wasn't
jhi authored
224 case $PERL_CONFIG_SH in
2b31790 perl 4.0 patch 5: patch #4, continued
Larry Wall authored
225 '')
a0d0e21 perl 5.000
Larry Wall authored
226 if test -f config.sh; then TOP=.;
227 elif test -f ../config.sh; then TOP=..;
228 elif test -f ../../config.sh; then TOP=../..;
229 elif test -f ../../../config.sh; then TOP=../../..;
230 elif test -f ../../../../config.sh; then TOP=../../../..;
231 else
232 echo "Can't find config.sh."; exit 1
233 fi
234 . $TOP/config.sh
235 ;;
236 esac
237
75550b4 @paulg1973 Nuke obsolete way to build debugging (etc) perls
paulg1973 authored
238 : syntax: cflags [optimize=XXX] [file[.suffix]]
239 : displays the compiler command line for file
240
1167a30 OPTIMIZE= during perl make
Ilya Zakharevich authored
241 case "X$1" in
26102cc @jhi When in Rome, quote like the Romans do.
jhi authored
242 Xoptimize=*|X"optimize=*")
1167a30 OPTIMIZE= during perl make
Ilya Zakharevich authored
243 eval "$1"
244 shift
245 ;;
246 esac
247
1c3d792 perl 4.0 patch 1: (combined patch)
Larry Wall authored
248 also=': '
249 case $# in
2b31790 perl 4.0 patch 5: patch #4, continued
Larry Wall authored
250 1) also='echo 1>&2 " CCCMD = "'
1c3d792 perl 4.0 patch 1: (combined patch)
Larry Wall authored
251 esac
252
253 case $# in
254 0) set *.c; echo "The current C flags are:" ;;
255 esac
2b31790 perl 4.0 patch 5: patch #4, continued
Larry Wall authored
256
578789a Slightly modified patch.
Sean Sheedy authored
257 set `echo "$* " | sed -e 's/\.[oc] / /g' -e 's/\.obj / /g' -e "s/\\$obj_ext / /g"`
2b31790 perl 4.0 patch 5: patch #4, continued
Larry Wall authored
258
1c3d792 perl 4.0 patch 1: (combined patch)
Larry Wall authored
259 for file do
260
261 case "$#" in
262 1) ;;
2b31790 perl 4.0 patch 5: patch #4, continued
Larry Wall authored
263 *) echo $n " $file.c $c" ;;
1c3d792 perl 4.0 patch 1: (combined patch)
Larry Wall authored
264 esac
265
2b31790 perl 4.0 patch 5: patch #4, continued
Larry Wall authored
266 : allow variables like toke_cflags to be evaluated
267
8736538 cygwin32 update (untested adaptation of patch against 5.005_03)
Alexander Smishlajev authored
268 if echo $file | grep -v / >/dev/null
269 then
270 eval 'eval ${'"${file}_cflags"'-""}'
271 fi
2b31790 perl 4.0 patch 5: patch #4, continued
Larry Wall authored
272
273 : or customize here
274
1c3d792 perl 4.0 patch 1: (combined patch)
Larry Wall authored
275 case "$file" in
276 *) ;;
5729ffd In cflags.SH trim the case statement of file basenames.
Nicholas Clark authored
277
278 *) : Customization examples follow: ;;
279 av) ccflags=`echo $ccflags | sed -e s/-pipe//` ;;
280 deb) ccflags="$ccflags -fno-jump-tables" ;;
281 hv) warn=`echo $warn | sed -e s/-Wextra//` ;;
282 toke) optimize=-O0 ;;
1c3d792 perl 4.0 patch 1: (combined patch)
Larry Wall authored
283 esac
284
5729ffd In cflags.SH trim the case statement of file basenames.
Nicholas Clark authored
285 : The examples are intentionally unreachable as the '*)' case always
286 : matches. To use them, move before the '*)' and edit as appropriate.
287 : It is not a good idea to set ccflags to an absolute value here, as it
288 : often contains general -D defines which are needed for correct
289 : compilation. It is better to edit ccflags as shown, using interpolation
290 : to add flags, or sed to remove flags.
291
292
a7d5944 fix broken indentation, and move PERL_PATCHNUM logic to a different p…
Yves Orton authored
293 case "$cc" in
294 *g++*)
295 # Extra paranoia in case people have bad canned ccflags:
296 # bad in the sense that the flags are accepted by g++,
297 # but then whined about.
298 for f in -Wdeclaration-after-statement -std=c89
299 do
300 ccflags=`echo $ccflags|sed 's/$f/ /'`
301 done
302 ;;
303 esac
304 cppflags=`echo $cppflags|sed 's/-Wdeclaration-after-statement/ /'`
305
306 case "$cc" in
d5db65c @rurban cflags: clang complains a lot about -Wunused-value which are not fixable
rurban authored
307 *clang)
308 # clang complains a lot about -Wunused-value which are not fixable
309 warn="$warn -Wno-unused-value"
310 ;;
a7d5944 fix broken indentation, and move PERL_PATCHNUM logic to a different p…
Yves Orton authored
311 *g++*)
312 # Without -Wno-unused-variable g++ 4.x compiles are rather unwatchable
313 # because of all the warnings about Perl___notused, and g++ doesn't do
314 # __attribute__((unused)) (and even if at some stage it may, people do
315 # have older gcc installations), and ((void)x) isn't enough to silence
316 # the noises about XS functions not using their cv parameter, so we need
317 # the -Wno-unused-parameter too.
318 # Yes, we lose some valid warnings, but hopefully other compilers
319 # (like gcc) will still pick up those warnings.
320 for o in -Wno-unused-variable -Wno-unused-parameter
321 do
322 case "$warn" in
323 *$o*) ;;
324 *) warn="$warn $o" ;;
325 esac
326 done
327 ;;
7e82727 @jhi (1) g++ 4.x (or Mac OS X) (2) Solaris g++ or CC
jhi authored
328 esac
666ea19 @jhi g++ stage 1 reached
jhi authored
329
69c7f29 Experiment with putting the F<.patch>level into patchlevel.h
Nicholas Clark authored
330
c4f23d7 [PATCH for 5.004_64] Configure patch Config_64-01
Andy Dougherty authored
331 : Can we perhaps use $ansi2knr here
b1e55ca @jhi g++ heavy shoveling
jhi authored
332 echo "$cc -c -DPERL_CORE $ccflags $stdflags $optimize $warn $extra"
333 eval "$also "'"$cc -DPERL_CORE -c $ccflags $stdflags $optimize $warn $extra"'
2b31790 perl 4.0 patch 5: patch #4, continued
Larry Wall authored
334
a0d0e21 perl 5.000
Larry Wall authored
335 . $TOP/config.sh
2b31790 perl 4.0 patch 5: patch #4, continued
Larry Wall authored
336
a7d5944 fix broken indentation, and move PERL_PATCHNUM logic to a different p…
Yves Orton authored
337 # end per file behaviour
1c3d792 perl 4.0 patch 1: (combined patch)
Larry Wall authored
338 done
2b31790 perl 4.0 patch 5: patch #4, continued
Larry Wall authored
339 !NO!SUBS!
a0d0e21 perl 5.000
Larry Wall authored
340 chmod 755 cflags
2b31790 perl 4.0 patch 5: patch #4, continued
Larry Wall authored
341 $eunicefix cflags
Something went wrong with that request. Please try again.