File Coverage

blib/lib/Devel/PatchPerl.pm
Criterion Covered Total %
statement 69 265 26.0
branch 22 156 14.1
condition 1 25 4.0
subroutine 12 48 25.0
pod 2 2 100.0
total 106 496 21.3


line stmt bran cond sub pod time code
1             package Devel::PatchPerl;
2             $Devel::PatchPerl::VERSION = '1.44';
3             # ABSTRACT: Patch perl source a la Devel::PPPort's buildperl.pl
4              
5 2     2   28282 use strict;
  2         4  
  2         49  
6 2     2   6 use warnings;
  2         3  
  2         47  
7 2     2   760 use File::pushd qw[pushd];
  2         36701  
  2         94  
8 2     2   11 use File::Spec;
  2         2  
  2         25  
9 2     2   744 use IO::File;
  2         1423  
  2         211  
10 2     2   1622 use Devel::PatchPerl::Hints qw[hint_file];
  2         3  
  2         95  
11 2     2   792 use Module::Pluggable search_path => ['Devel::PatchPerl::Plugin'];
  2         15430  
  2         10  
12 2     2   122 use vars qw[@ISA @EXPORT_OK];
  2         2  
  2         7394  
13              
14             @ISA = qw(Exporter);
15             @EXPORT_OK = qw(patch_source);
16              
17             my $patch_exe = _can_run('gpatch') || _can_run('patch');
18              
19             my @patch = (
20             {
21             perl => [
22             qw/
23             5.005
24             /,
25             ],
26             subs => [
27             [ \&_patch_5_005, 1 ],
28             ],
29             },
30             {
31             perl => [
32             qw/
33             5.005_01
34             /,
35             ],
36             subs => [
37             [ \&_patch_5_005_01, 1 ],
38             ],
39             },
40             {
41             perl => [
42             qw/
43             5.005_02
44             /,
45             ],
46             subs => [
47             [ \&_patch_5_005_02, 1 ],
48             ],
49             },
50             {
51             perl => [
52             qr/^5\.00[2345]/,
53             qw/
54             5.001n
55             /,
56             ],
57             subs => [
58             [ \&_patch_handy, 1 ],
59             ],
60             },
61             {
62             perl => [
63             qw/
64             5.005
65             5.005_01
66             5.005_02
67             5.005_03
68             5.005_04
69             /,
70             ],
71             subs => [
72             [ \&_replace_makedepend, 1 ],
73             ],
74             },
75             {
76             perl => [
77             qr/^5\.00[01234]/,
78             qw/
79             5.005
80             5.005_01
81             5.005_02
82             5.005_03
83             /,
84             ],
85             subs => [
86             [ \&_patch_db, 1 ],
87             ],
88             },
89             {
90             perl => [
91             qr/^5\.6\.[1-2]$/,
92             qr/^5\.7\.[0-1]$/,
93             ],
94             subs => [
95             [ \&_patch_makefile_sh_phony ],
96             ],
97             },
98             {
99             perl => [
100             qw/
101             5.6.0
102             5.6.1
103             5.7.0
104             5.7.1
105             5.7.2
106             5.7.3
107             5.8.0
108             /,
109             ],
110             subs => [
111             [ \&_patch_db, 3 ],
112             ],
113             },
114             {
115             perl => [
116             qr/^5\.004_0[1234]$/,
117             ],
118             subs => [
119             [ \&_patch_doio ],
120             ],
121             },
122             {
123             perl => [
124             qw/
125             5.005
126             5.005_01
127             5.005_02
128             /,
129             ],
130             subs => [
131             [ \&_patch_sysv, old_format => 1 ],
132             ],
133             },
134             {
135             perl => [
136             qw/
137             5.005_03
138             5.005_04
139             /,
140             qr/^5\.6\.[0-2]$/,
141             qr/^5\.7\.[0-3]$/,
142             qr/^5\.8\.[0-8]$/,
143             qr/^5\.9\.[0-5]$/
144             ],
145             subs => [
146             [ \&_patch_sysv, old_format => 0 ],
147             ],
148             },
149             {
150             perl => [
151             qr/^5\.004_05$/,
152             qr/^5\.005(?:_0[1-4])?$/,
153             qr/^5\.6\.[01]$/,
154             ],
155             subs => [
156             [ \&_patch_configure ],
157             [ \&_patch_makedepend_lc ],
158             ],
159             },
160             {
161             perl => [
162             qr/^5\.6\.[0-2]$/,
163             ],
164             subs => [
165             [ \&_patch_conf_gconvert ],
166             [ \&_patch_sort_N ],
167             ],
168             },
169             {
170             perl => [
171             '5.8.0',
172             ],
173             subs => [
174             [ \&_patch_makedepend_lc ],
175             ],
176             },
177             {
178             perl => [
179             qr/.*/,
180             ],
181             subs => [
182             [ \&_patch_conf_solaris ],
183             [ \&_patch_bitrig ],
184             [ \&_patch_hints ],
185             [ \&_patch_patchlevel ],
186             [ \&_patch_develpatchperlversion ],
187             [ \&_patch_errno_gcc5 ],
188             ],
189             },
190             {
191             perl => [
192             qr/^5\.6\.[0-2]$/,
193             qr/^5\.7\.[0-3]$/,
194             qr/^5\.8\.[0-8]$/,
195             ],
196             subs => [
197             [ \&_patch_makedepend_SH ],
198             ],
199             },
200             {
201             perl => [
202             qr/^5\.1[0-2]/,
203             ],
204             subs => [
205             [ \&_patch_archive_tar_tests ],
206             [ \&_patch_odbm_file_hints_linux ],
207             ],
208             },
209             {
210             perl => [
211             qr/^5.1([24].\d+|0.1)/,
212             ],
213             subs => [
214             [ \&_patch_make_ext_pl ],
215             ],
216             },
217             {
218             perl => [ qr/^5\.8\.9$/, ],
219             subs => [ [ \&_patch_589_perlio_c ], ],
220             },
221             {
222             perl => [ qr/^5\.8\.[89]$/ ],
223             subs => [ [ \&_patch_hsplit_rehash_58 ] ],
224             },
225             {
226             perl => [
227             qr/^5\.10\.1$/,
228             qr/^5\.12\.5$/,
229             ],
230             subs => [ [ \&_patch_hsplit_rehash_510 ] ],
231             },
232             {
233             perl => [
234             qr/^5\.18\.0$/,
235             ],
236             subs => [ [ \&_patch_regmatch_pointer_5180 ] ],
237             },
238             {
239             perl => [
240             qr/^5\.20\.0$/,
241             ],
242             subs => [ [ \&_patch_cow_speed ] ],
243             },
244             {
245             perl => [
246             qr/^5\.6\.[012]$/,
247             qr/^5\.8\.[89]$/,
248             qr/^5\.10\.[01]$/,
249             ],
250             subs => [ [ \&_patch_preprocess_options ] ],
251             },
252             {
253             perl => [
254             qr/^5\.18\.3$/,
255             ],
256             subs => [ [ \&_patch_5183_metajson ] ],
257             },
258             );
259              
260             sub patch_source {
261 0     0 1 0 my $vers = shift;
262 0 0       0 $vers = shift if eval { $vers->isa(__PACKAGE__) };
  0         0  
263 0   0     0 my $source = shift || '.';
264 0 0       0 if ( !$vers ) {
265 0         0 $vers = _determine_version($source);
266 0 0       0 if ( $vers ) {
267 0         0 warn "Auto-guessed '$vers'\n";
268             }
269             else {
270 0         0 die "You didn't provide a perl version and I don't appear to be in a perl source tree\n";
271             }
272             }
273 0         0 $source = File::Spec->rel2abs($source);
274             {
275 0         0 my $dir = pushd( $source );
  0         0  
276 0         0 for my $p ( grep { _is( $_->{perl}, $vers ) } @patch ) {
  0         0  
277 0         0 for my $s (@{$p->{subs}}) {
  0         0  
278 0         0 my($sub, @args) = @$s;
279 0 0       0 push @args, $vers unless scalar @args;
280 0         0 $sub->(@args);
281             }
282             }
283 0         0 _process_plugin( version => $vers, source => $source, patchexe => $patch_exe );
284             }
285             }
286              
287             sub _process_plugin {
288 1     1   7 my %args = @_;
289 1 50       5 return unless my $possible = $ENV{PERL5_PATCHPERL_PLUGIN};
290 1 0       9 my ($plugin) = grep { $possible eq $_ or /\Q$possible\E$/ } __PACKAGE__->plugins;
  0         0  
291 1 50       244 unless ( $plugin ) {
292             warn "# You specified a plugin '", $ENV{PERL5_PATCHPERL_PLUGIN},
293 1         108 "' that isn't installed, just thought you might be interested.\n";
294 1         6 return;
295             }
296             {
297 0         0 local $@;
298 0         0 eval "require $plugin";
299 0 0       0 if ($@) {
300             die "# I tried to load '", $ENV{PERL5_PATCHPERL_PLUGIN},
301 0         0 "' but it didn't work out. Here is what happened '$@'\n";
302             }
303             }
304             {
305 0         0 local $@;
  0         0  
  0         0  
306 0         0 eval {
307 0         0 $plugin->patchperl(
308             %args,
309             );
310             };
311 0 0       0 if ($@) {
312 0         0 warn "# Warnings from the plugin: '$@'\n";
313             }
314             }
315 0         0 return 1;
316             }
317              
318             sub _can_run {
319 4     4   7 my $command = shift;
320              
321             # a lot of VMS executables have a symbol defined
322             # check those first
323 4 50       14 if ( $^O eq 'VMS' ) {
324 0         0 require VMS::DCLsym;
325 0         0 my $syms = VMS::DCLsym->new;
326 0 0       0 return $command if scalar $syms->getsym( uc $command );
327             }
328              
329 4         22 require File::Spec;
330 4         1487 require ExtUtils::MakeMaker;
331              
332 4         155146 my @possibles;
333              
334 4 50       41 if( File::Spec->file_name_is_absolute($command) ) {
335 0         0 return MM->maybe_command($command);
336              
337             } else {
338 4         64 for my $dir (
339             File::Spec->path,
340             File::Spec->curdir
341             ) {
342 32 100 33     643 next if ! $dir || ! -d $dir;
343 28 50       155 my $abs = File::Spec->catfile( $^O eq 'MSWin32' ? Win32::GetShortPathName( $dir ) : $dir, $command);
344 28 100       64 push @possibles, $abs if $abs = MM->maybe_command($abs);
345             }
346             }
347 4 50       45 return @possibles if wantarray;
348 4         20 return shift @possibles;
349             }
350              
351             sub _is
352             {
353 0     0   0 my($s1, $s2) = @_;
354              
355 0 0       0 defined $s1 != defined $s2 and return 0;
356              
357 0 0       0 ref $s2 and ($s1, $s2) = ($s2, $s1);
358              
359 0 0       0 if (ref $s1) {
360 0 0       0 if (ref $s1 eq 'ARRAY') {
361 0   0     0 _is($_, $s2) and return 1 for @$s1;
362 0         0 return 0;
363             }
364 0         0 return $s2 =~ $s1;
365             }
366              
367 0         0 return $s1 eq $s2;
368             }
369              
370             sub _patch
371             {
372 0     0   0 my($patch) = @_;
373 0         0 print "patching $_\n" for $patch =~ /^\+{3}\s+(\S+)/gm;
374 0         0 my $diff = 'tmp.diff';
375 0         0 _write_or_die($diff, $patch);
376 0 0       0 die "No patch utility found\n" unless $patch_exe;
377 0         0 local $ENV{PATCH_GET} = 0; # I can't reproduce this at all, but meh.
378 0         0 _run_or_die("$patch_exe -f -s -p0 <$diff");
379 0 0       0 unlink $diff or die "unlink $diff: $!\n";
380             }
381              
382             sub _write_or_die
383             {
384 0     0   0 my($file, $data) = @_;
385 0 0       0 my $fh = IO::File->new(">$file") or die "$file: $!\n";
386 0         0 $fh->print($data);
387             }
388              
389             sub _run_or_die
390             {
391             # print "[running @_]\n";
392 0 0   0   0 die unless system( @_ ) == 0;
393             }
394              
395             sub determine_version {
396 6     6 1 3450 my $src = shift;
397 6 100       7 $src = shift if eval { $src->isa(__PACKAGE__) };
  6         41  
398 6 100       11 $src = '.' unless $src;
399 6         9 _determine_version($src);
400             }
401              
402             sub _determine_version {
403 8     8   745 my ($source) = @_;
404 8         64 my $patchlevel_h = File::Spec->catfile($source, 'patchlevel.h');
405 8 100       138 return unless -e $patchlevel_h;
406 7         6 my $version;
407             {
408 7         5 my %defines;
  7         8  
409 7         172 open my $fh, '<', $patchlevel_h;
410 7         9 my @vers;
411 7         83 while (<$fh>) {
412 613         350 chomp;
413 613 100       1161 next unless /^#define/;
414 33         105 my ($foo,$bar) = ( split /\s+/ )[1,2];
415 33         111 $defines{$foo} = $bar;
416             }
417 7 100       13 if ( my @wotsits = grep { defined $defines{$_} } qw(PERL_REVISION PERL_VERSION PERL_SUBVERSION) ) {
  21 100       52  
418 3         6 $version = join '.', map { $defines{$_} } @wotsits;
  9         46  
419             }
420 8         17 elsif ( my @watsits = grep { defined $defines{$_} } qw(PATCHLEVEL SUBVERSION) ) {
421 3         4 $version = sprintf '5.%03d_%02d', map { $defines{$_} } @watsits;
  6         40  
422             }
423             else {
424 1         11 return;
425             }
426             }
427 6         17 return $version;
428             }
429              
430             # adapted from patchlevel.h for use with perls that predate it
431             sub _patch_patchlevel {
432 0 0   0     return if -d '.git';
433 0   0       my $dpv = $Devel::PatchPerl::VERSION || "(unreleased)";
434 0 0         open my $plin, "patchlevel.h" or die "Couldn't open patchlevel.h : $!";
435 0 0         open my $plout, ">patchlevel.new" or die "Couldn't write on patchlevel.new : $!";
436 0           my $seen=0;
437 0           while (<$plin>) {
438 0 0 0       if (/\t,NULL/ and $seen) {
439 0           print {$plout} qq{\t,"Devel::PatchPerl $dpv"\n};
  0            
440             }
441 0 0         $seen++ if /local_patches\[\]/;
442 0           print {$plout} $_;
  0            
443             }
444 0 0         close $plout or die "Couldn't close filehandle writing to patchlevel.new : $!";
445 0 0         close $plin or die "Couldn't close filehandle reading from patchlevel.h : $!";
446 0 0 0       unlink "patchlevel.bak" or warn "Couldn't unlink patchlevel.bak : $!"
447             if -e "patchlevel.bak";
448 0 0         rename "patchlevel.h", "patchlevel.bak" or
449             die "Couldn't rename patchlevel.h to patchlevel.bak : $!";
450 0 0         rename "patchlevel.new", "patchlevel.h" or
451             die "Couldn't rename patchlevel.new to patchlevel.h : $!";
452             }
453              
454             sub _patch_hints {
455 0     0     my @os;
456 0           push @os, $^O;
457 0 0         push @os, 'linux' if $^O eq 'gnukfreebsd'; # kfreebsd uses linux hints
458 0           foreach my $os ( @os ) {
459 0 0         return unless my ($file,$data) = hint_file( $os );
460 0           my $path = File::Spec->catfile( 'hints', $file );
461 0 0         if ( -e $path ) {
462 0 0         chmod 0644, $path or die "$!\n";
463             }
464 0 0         open my $fh, '>', $path or die "$!\n";
465 0           print $fh $data;
466 0           close $fh;
467             }
468 0           return 1;
469             }
470              
471             sub _patch_db
472             {
473 0     0     my $ver = shift;
474 0           for my $file ('ext/DB_File/DB_File.xs', 'Configure') {
475 0           print "patching $file\n";
476 0           _run_or_die($^X, '-pi.bak', '-e', "s///", $file);
477 0 0         unlink "$file.bak" if -e "$file.bak";
478             }
479             }
480              
481             sub _patch_doio
482             {
483 0     0     _patch(<<'END');
484             --- doio.c.org 2004-06-07 23:14:45.000000000 +0200
485             +++ doio.c 2003-11-04 08:03:03.000000000 +0100
486             @@ -75,6 +75,16 @@
487             # endif
488             #endif
489              
490             +#if _SEM_SEMUN_UNDEFINED
491             +union semun
492             +{
493             + int val;
494             + struct semid_ds *buf;
495             + unsigned short int *array;
496             + struct seminfo *__buf;
497             +};
498             +#endif
499             +
500             bool
501             do_open(gv,name,len,as_raw,rawmode,rawperm,supplied_fp)
502             GV *gv;
503             END
504             }
505              
506             sub _patch_sysv
507             {
508 0     0     my %opt = @_;
509              
510             # check if patching is required
511 0 0 0       return if $^O ne 'linux' or -f '/usr/include/asm/page.h';
512              
513 0 0         if ($opt{old_format}) {
514 0           _patch(<<'END');
515             --- ext/IPC/SysV/SysV.xs.org 1998-07-20 10:20:07.000000000 +0200
516             +++ ext/IPC/SysV/SysV.xs 2007-08-12 10:51:06.000000000 +0200
517             @@ -3,9 +3,6 @@
518             #include "XSUB.h"
519            
520             #include
521             -#ifdef __linux__
522             -#include
523             -#endif
524             #if defined(HAS_MSG) || defined(HAS_SEM) || defined(HAS_SHM)
525             #include
526             #ifdef HAS_MSG
527             END
528             }
529             else {
530 0           _patch(<<'END');
531             --- ext/IPC/SysV/SysV.xs.org 2007-08-11 00:12:46.000000000 +0200
532             +++ ext/IPC/SysV/SysV.xs 2007-08-11 00:10:51.000000000 +0200
533             @@ -3,9 +3,6 @@
534             #include "XSUB.h"
535            
536             #include
537             -#ifdef __linux__
538             -# include
539             -#endif
540             #if defined(HAS_MSG) || defined(HAS_SEM) || defined(HAS_SHM)
541             #ifndef HAS_SEM
542             # include
543             END
544             }
545             }
546              
547             sub _patch_configure
548             {
549 0     0     _patch(<<'END');
550             --- Configure
551             +++ Configure
552             @@ -3380,6 +3380,18 @@
553             test "X$gfpthkeep" != Xy && gfpth=""
554             EOSC
555            
556             +# gcc 3.1 complains about adding -Idirectories that it already knows about,
557             +# so we will take those off from locincpth.
558             +case "$gccversion" in
559             +3*)
560             + echo "main(){}">try.c
561             + for incdir in `$cc -v -c try.c 2>&1 | \
562             + sed '1,/^#include <\.\.\.>/d;/^End of search list/,$d;s/^ //'` ; do
563             + locincpth=`echo $locincpth | sed s!$incdir!!`
564             + done
565             + $rm -f try try.*
566             +esac
567             +
568             : What should the include directory be ?
569             echo " "
570             $echo $n "Hmm... $c"
571             END
572             }
573              
574             sub _patch_makedepend_lc
575             {
576 0     0     _patch(<<'END');
577             --- makedepend.SH
578             +++ makedepend.SH
579             @@ -58,6 +58,10 @@ case $PERL_CONFIG_SH in
580             ;;
581             esac
582            
583             +# Avoid localized gcc/cc messages
584             +LC_ALL=C
585             +export LC_ALL
586             +
587             # We need .. when we are in the x2p directory if we are using the
588             # cppstdin wrapper script.
589             # Put .. and . first so that we pick up the present cppstdin, not
590             END
591             }
592              
593              
594             sub _patch_makedepend_SH
595             {
596 0     0     my $perl = shift;
597             SWITCH: {
598             # If 5.6.0
599 0 0         if ( $perl eq '5.6.0' ) {
  0            
600 0           _patch(<<'BADGER');
601             --- makedepend.SH.org 2000-03-02 18:12:26.000000000 +0000
602             +++ makedepend.SH 2010-09-01 10:13:37.000000000 +0100
603             @@ -1,5 +1,5 @@
604             #! /bin/sh
605             -case $CONFIGDOTSH in
606             +case $PERL_CONFIG_SH in
607             '')
608             if test -f config.sh; then TOP=.;
609             elif test -f ../config.sh; then TOP=..;
610             @@ -29,6 +29,13 @@
611             !GROK!THIS!
612             $spitshell >>makedepend <<'!NO!SUBS!'
613            
614             +if test -d .depending; then
615             + echo "$0: Already running, exiting."
616             + exit 0
617             +fi
618             +
619             +mkdir .depending
620             +
621             # This script should be called with
622             # sh ./makedepend MAKE=$(MAKE)
623             case "$1" in
624             @@ -37,7 +44,7 @@
625            
626             export PATH || (echo "OOPS, this isn't sh. Desperation time. I will feed myself to sh."; sh \$0; kill \$\$)
627            
628             -case $CONFIGDOTSH in
629             +case $PERL_CONFIG_SH in
630             '')
631             if test -f config.sh; then TOP=.;
632             elif test -f ../config.sh; then TOP=..;
633             @@ -51,6 +58,11 @@
634             ;;
635             esac
636            
637             +# Avoid localized gcc messages
638             +case "$ccname" in
639             + gcc) LC_ALL=C ; export LC_ALL ;;
640             +esac
641             +
642             # We need .. when we are in the x2p directory if we are using the
643             # cppstdin wrapper script.
644             # Put .. and . first so that we pick up the present cppstdin, not
645             @@ -58,6 +70,10 @@
646             PATH=".$path_sep..$path_sep$PATH"
647             export PATH
648            
649             +case "$osname" in
650             +amigaos) cat=/bin/cat ;; # must be absolute
651             +esac
652             +
653             $cat /dev/null >.deptmp
654             $rm -f *.c.c c/*.c.c
655             if test -f Makefile; then
656             @@ -67,7 +83,6 @@
657             # to be out of date. I don't know if OS/2 has touch, so do this:
658             case "$osname" in
659             os2) ;;
660             - netbsd) ;;
661             *) $touch $firstmakefile ;;
662             esac
663             fi
664             @@ -99,25 +114,20 @@
665             $echo *.c | $tr ' ' $trnl | $egrep -v '\*' >.clist)
666             for file in `$cat .clist`; do
667             # for file in `cat /dev/null`; do
668             - if [ "$osname" = uwin ]; then
669             - uwinfix="-e s,\\\\\\\\,/,g -e s,\\([a-zA-Z]\\):/,/\\1/,g"
670             - else
671             - if [ "$osname" = os2 ]; then
672             - uwinfix="-e s,\\\\\\\\,/,g"
673             - else
674             - if [ "$archname" = cygwin ]; then
675             - uwinfix="-e s,\\\\\\\\,/,g"
676             - else
677             - uwinfix=
678             - fi
679             - fi
680             - fi
681             + case "$osname" in
682             + uwin) uwinfix="-e s,\\\\\\\\,/,g -e s,\\([a-zA-Z]\\):/,/\\1/,g" ;;
683             + os2) uwinfix="-e s,\\\\\\\\,/,g" ;;
684             + cygwin) uwinfix="-e s,\\\\\\\\,/,g" ;;
685             + posix-bc) uwinfix="-e s/\\*POSIX(\\(.*\\))/\\1/" ;;
686             + vos) uwinfix="-e s/\#/\\\#/" ;;
687             + *) uwinfix="" ;;
688             + esac
689             case "$file" in
690             *.c) filebase=`basename $file .c` ;;
691             *.y) filebase=`basename $file .y` ;;
692             esac
693             case "$file" in
694             - */*) finc="-I`echo $file | sed 's#/[^/]*$##`" ;;
695             + */*) finc="-I`echo $file | sed 's#/[^/]*$##'`" ;;
696             *) finc= ;;
697             esac
698             $echo "Finding dependencies for $filebase$_o."
699             @@ -130,22 +140,45 @@
700             -e 's|\\$||' \
701             -e p \
702             -e '}' ) >UU/$file.c
703             +
704             if [ "$osname" = os390 -a "$file" = perly.c ]; then
705             $echo '#endif' >>UU/$file.c
706             fi
707             - $cppstdin $finc -I. $cppflags $cppminus
708             - $sed \
709             - -e '1d' \
710             - -e '/^#.*/d' \
711             - -e '/^#.*"-"/d' \
712             - -e 's#\.[0-9][0-9]*\.c#'"$file.c#" \
713             - -e 's/^[ ]*#[ ]*line/#/' \
714             - -e '/^# *[0-9][0-9]* *[".\/]/!d' \
715             - -e 's/^.*"\(.*\)".*$/'$filebase'\$(OBJ_EXT): \1/' \
716             - -e 's/^# *[0-9][0-9]* \(.*\)$/'$filebase'\$(OBJ_EXT): \1/' \
717             - -e 's|: \./|: |' \
718             - -e 's|\.c\.c|.c|' $uwinfix | \
719             - $uniq | $sort | $uniq >> .deptmp
720             +
721             + if [ "$osname" = os390 ]; then
722             + $cppstdin $finc -I. $cppflags $cppminus
723             + $sed \
724             + -e '/^#.*/d' \
725             + -e '/^#.*"-"/d' \
726             + -e 's#\.[0-9][0-9]*\.c#'"$file.c#" \
727             + -e 's/^[ ]*#[ ]*line/#/' \
728             + -e '/^# *[0-9][0-9]* *[".\/]/!d' \
729             + -e 's/^.*"\(.*\)".*$/'$filebase'\$(OBJ_EXT): \1/' \
730             + -e 's/^# *[0-9][0-9]* \(.*\)$/'$filebase'\$(OBJ_EXT): \1/' \
731             + -e 's|: \./|: |' \
732             + -e 's|\.c\.c|.c|' $uwinfix | \
733             + $uniq | $sort | $uniq >> .deptmp
734             + else
735             + $cppstdin $finc -I. $cppflags $cppminus .cout 2>.cerr
736             + $sed \
737             + -e '1d' \
738             + -e '/^#.*/d' \
739             + -e '/^#.*/d' \
740             + -e '/^#.*/d' \
741             + -e '/^#.*/d' \
742             + -e '/^#.*/d' \
743             + -e '/^#.*"-"/d' \
744             + -e '/^#.*"\/.*\/"/d' \
745             + -e '/: file path prefix .* never used$/d' \
746             + -e 's#\.[0-9][0-9]*\.c#'"$file.c#" \
747             + -e 's/^[ ]*#[ ]*line/#/' \
748             + -e '/^# *[0-9][0-9]* *[".\/]/!d' \
749             + -e 's/^.*"\(.*\)".*$/'$filebase'\$(OBJ_EXT): \1/' \
750             + -e 's/^# *[0-9][0-9]* \(.*\)$/'$filebase'\$(OBJ_EXT): \1/' \
751             + -e 's|: \./|: |' \
752             + -e 's|\.c\.c|.c|' $uwinfix .cout .cerr| \
753             + $uniq | $sort | $uniq >> .deptmp
754             + fi
755             done
756            
757             $sed <$mf >$mf.new -e '1,/^# AUTOMATICALLY/!d'
758             @@ -177,6 +210,10 @@
759             $echo "Updating $mf..."
760             $echo "# If this runs make out of memory, delete /usr/include lines." \
761             >> $mf.new
762             + if [ "$osname" = vos ]; then
763             + $sed 's|.incl.c|.h|' .deptmp >.deptmp.vos
764             + mv -f .deptmp.vos .deptmp
765             + fi
766             $sed 's|^\(.*\$(OBJ_EXT):\) *\(.*/.*\.c\) *$|\1 \2; '"$defrule \2|" .deptmp \
767             >>$mf.new
768             else
769             @@ -208,7 +245,8 @@
770             $cp $mf.new $mf
771             $rm $mf.new
772             $echo "# WARNING: Put nothing here or make depend will gobble it up!" >> $mf
773             -$rm -rf .deptmp UU .shlist .clist .hlist .hsed
774             +$rm -rf .deptmp UU .shlist .clist .hlist .hsed .cout .cerr
775             +rmdir .depending
776            
777             !NO!SUBS!
778             $eunicefix makedepend
779             BADGER
780 0           last SWITCH;
781             }
782             # If 5.6.1
783 0 0         if ( $perl eq '5.6.1' ) {
784 0           _patch(<<'BADGER');
785             --- makedepend.SH.org 2001-03-19 07:33:17.000000000 +0000
786             +++ makedepend.SH 2010-09-01 10:14:47.000000000 +0100
787             @@ -1,5 +1,5 @@
788             #! /bin/sh
789             -case $CONFIGDOTSH in
790             +case $PERL_CONFIG_SH in
791             '')
792             if test -f config.sh; then TOP=.;
793             elif test -f ../config.sh; then TOP=..;
794             @@ -29,6 +29,13 @@
795             !GROK!THIS!
796             $spitshell >>makedepend <<'!NO!SUBS!'
797            
798             +if test -d .depending; then
799             + echo "$0: Already running, exiting."
800             + exit 0
801             +fi
802             +
803             +mkdir .depending
804             +
805             # This script should be called with
806             # sh ./makedepend MAKE=$(MAKE)
807             case "$1" in
808             @@ -37,7 +44,7 @@
809            
810             export PATH || (echo "OOPS, this isn't sh. Desperation time. I will feed myself to sh."; sh \$0; kill \$\$)
811            
812             -case $CONFIGDOTSH in
813             +case $PERL_CONFIG_SH in
814             '')
815             if test -f config.sh; then TOP=.;
816             elif test -f ../config.sh; then TOP=..;
817             @@ -51,6 +58,11 @@
818             ;;
819             esac
820            
821             +# Avoid localized gcc messages
822             +case "$ccname" in
823             + gcc) LC_ALL=C ; export LC_ALL ;;
824             +esac
825             +
826             # We need .. when we are in the x2p directory if we are using the
827             # cppstdin wrapper script.
828             # Put .. and . first so that we pick up the present cppstdin, not
829             @@ -58,6 +70,10 @@
830             PATH=".$path_sep..$path_sep$PATH"
831             export PATH
832            
833             +case "$osname" in
834             +amigaos) cat=/bin/cat ;; # must be absolute
835             +esac
836             +
837             $cat /dev/null >.deptmp
838             $rm -f *.c.c c/*.c.c
839             if test -f Makefile; then
840             @@ -67,7 +83,6 @@
841             # to be out of date. I don't know if OS/2 has touch, so do this:
842             case "$osname" in
843             os2) ;;
844             - netbsd) ;;
845             *) $touch $firstmakefile ;;
846             esac
847             fi
848             @@ -99,29 +114,20 @@
849             $echo *.c | $tr ' ' $trnl | $egrep -v '\*' >.clist)
850             for file in `$cat .clist`; do
851             # for file in `cat /dev/null`; do
852             - if [ "$osname" = uwin ]; then
853             - uwinfix="-e s,\\\\\\\\,/,g -e s,\\([a-zA-Z]\\):/,/\\1/,g"
854             - else
855             - if [ "$osname" = os2 ]; then
856             - uwinfix="-e s,\\\\\\\\,/,g"
857             - else
858             - if [ "$archname" = cygwin ]; then
859             - uwinfix="-e s,\\\\\\\\,/,g"
860             - else
861             - if [ "$osname" = posix-bc ]; then
862             - uwinfix="-e s/\\*POSIX(\\(.*\\))/\\1/"
863             - else
864             - uwinfix=
865             - fi
866             - fi
867             - fi
868             - fi
869             + case "$osname" in
870             + uwin) uwinfix="-e s,\\\\\\\\,/,g -e s,\\([a-zA-Z]\\):/,/\\1/,g" ;;
871             + os2) uwinfix="-e s,\\\\\\\\,/,g" ;;
872             + cygwin) uwinfix="-e s,\\\\\\\\,/,g" ;;
873             + posix-bc) uwinfix="-e s/\\*POSIX(\\(.*\\))/\\1/" ;;
874             + vos) uwinfix="-e s/\#/\\\#/" ;;
875             + *) uwinfix="" ;;
876             + esac
877             case "$file" in
878             *.c) filebase=`basename $file .c` ;;
879             *.y) filebase=`basename $file .y` ;;
880             esac
881             case "$file" in
882             - */*) finc="-I`echo $file | sed 's#/[^/]*$##`" ;;
883             + */*) finc="-I`echo $file | sed 's#/[^/]*$##'`" ;;
884             *) finc= ;;
885             esac
886             $echo "Finding dependencies for $filebase$_o."
887             @@ -134,10 +140,12 @@
888             -e 's|\\$||' \
889             -e p \
890             -e '}' ) >UU/$file.c
891             +
892             + if [ "$osname" = os390 -a "$file" = perly.c ]; then
893             + $echo '#endif' >>UU/$file.c
894             + fi
895             +
896             if [ "$osname" = os390 ]; then
897             - if [ "$file" = perly.c ]; then
898             - $echo '#endif' >>UU/$file.c
899             - fi
900             $cppstdin $finc -I. $cppflags $cppminus
901             $sed \
902             -e '/^#.*/d' \
903             @@ -151,18 +159,24 @@
904             -e 's|\.c\.c|.c|' $uwinfix | \
905             $uniq | $sort | $uniq >> .deptmp
906             else
907             - $cppstdin $finc -I. $cppflags $cppminus
908             + $cppstdin $finc -I. $cppflags $cppminus .cout 2>.cerr
909             $sed \
910             -e '1d' \
911             -e '/^#.*/d' \
912             + -e '/^#.*/d' \
913             + -e '/^#.*/d' \
914             + -e '/^#.*/d' \
915             + -e '/^#.*/d' \
916             -e '/^#.*"-"/d' \
917             + -e '/^#.*"\/.*\/"/d' \
918             + -e '/: file path prefix .* never used$/d' \
919             -e 's#\.[0-9][0-9]*\.c#'"$file.c#" \
920             -e 's/^[ ]*#[ ]*line/#/' \
921             -e '/^# *[0-9][0-9]* *[".\/]/!d' \
922             -e 's/^.*"\(.*\)".*$/'$filebase'\$(OBJ_EXT): \1/' \
923             -e 's/^# *[0-9][0-9]* \(.*\)$/'$filebase'\$(OBJ_EXT): \1/' \
924             -e 's|: \./|: |' \
925             - -e 's|\.c\.c|.c|' $uwinfix | \
926             + -e 's|\.c\.c|.c|' $uwinfix .cout .cerr| \
927             $uniq | $sort | $uniq >> .deptmp
928             fi
929             done
930             @@ -196,6 +210,10 @@
931             $echo "Updating $mf..."
932             $echo "# If this runs make out of memory, delete /usr/include lines." \
933             >> $mf.new
934             + if [ "$osname" = vos ]; then
935             + $sed 's|.incl.c|.h|' .deptmp >.deptmp.vos
936             + mv -f .deptmp.vos .deptmp
937             + fi
938             $sed 's|^\(.*\$(OBJ_EXT):\) *\(.*/.*\.c\) *$|\1 \2; '"$defrule \2|" .deptmp \
939             >>$mf.new
940             else
941             @@ -227,7 +245,8 @@
942             $cp $mf.new $mf
943             $rm $mf.new
944             $echo "# WARNING: Put nothing here or make depend will gobble it up!" >> $mf
945             -$rm -rf .deptmp UU .shlist .clist .hlist .hsed
946             +$rm -rf .deptmp UU .shlist .clist .hlist .hsed .cout .cerr
947             +rmdir .depending
948            
949             !NO!SUBS!
950             $eunicefix makedepend
951             BADGER
952 0           last SWITCH;
953             }
954             # If 5.6.2
955 0 0         if ( $perl eq '5.6.2' ) {
956 0           _patch(<<'BADGER');
957             --- makedepend.SH.org 2003-07-30 23:46:59.000000000 +0100
958             +++ makedepend.SH 2010-09-01 10:15:47.000000000 +0100
959             @@ -1,5 +1,5 @@
960             #! /bin/sh
961             -case $CONFIGDOTSH in
962             +case $PERL_CONFIG_SH in
963             '')
964             if test -f config.sh; then TOP=.;
965             elif test -f ../config.sh; then TOP=..;
966             @@ -29,6 +29,13 @@
967             !GROK!THIS!
968             $spitshell >>makedepend <<'!NO!SUBS!'
969            
970             +if test -d .depending; then
971             + echo "$0: Already running, exiting."
972             + exit 0
973             +fi
974             +
975             +mkdir .depending
976             +
977             # This script should be called with
978             # sh ./makedepend MAKE=$(MAKE)
979             case "$1" in
980             @@ -37,7 +44,7 @@
981            
982             export PATH || (echo "OOPS, this isn't sh. Desperation time. I will feed myself to sh."; sh \$0; kill \$\$)
983            
984             -case $CONFIGDOTSH in
985             +case $PERL_CONFIG_SH in
986             '')
987             if test -f config.sh; then TOP=.;
988             elif test -f ../config.sh; then TOP=..;
989             @@ -63,6 +70,10 @@
990             PATH=".$path_sep..$path_sep$PATH"
991             export PATH
992            
993             +case "$osname" in
994             +amigaos) cat=/bin/cat ;; # must be absolute
995             +esac
996             +
997             $cat /dev/null >.deptmp
998             $rm -f *.c.c c/*.c.c
999             if test -f Makefile; then
1000             @@ -72,7 +83,6 @@
1001             # to be out of date. I don't know if OS/2 has touch, so do this:
1002             case "$osname" in
1003             os2) ;;
1004             - netbsd) ;;
1005             *) $touch $firstmakefile ;;
1006             esac
1007             fi
1008             @@ -104,29 +114,20 @@
1009             $echo *.c | $tr ' ' $trnl | $egrep -v '\*' >.clist)
1010             for file in `$cat .clist`; do
1011             # for file in `cat /dev/null`; do
1012             - if [ "$osname" = uwin ]; then
1013             - uwinfix="-e s,\\\\\\\\,/,g -e s,\\([a-zA-Z]\\):/,/\\1/,g"
1014             - else
1015             - if [ "$osname" = os2 ]; then
1016             - uwinfix="-e s,\\\\\\\\,/,g"
1017             - else
1018             - if [ "$archname" = cygwin ]; then
1019             - uwinfix="-e s,\\\\\\\\,/,g"
1020             - else
1021             - if [ "$osname" = posix-bc ]; then
1022             - uwinfix="-e s/\\*POSIX(\\(.*\\))/\\1/"
1023             - else
1024             - uwinfix=
1025             - fi
1026             - fi
1027             - fi
1028             - fi
1029             + case "$osname" in
1030             + uwin) uwinfix="-e s,\\\\\\\\,/,g -e s,\\([a-zA-Z]\\):/,/\\1/,g" ;;
1031             + os2) uwinfix="-e s,\\\\\\\\,/,g" ;;
1032             + cygwin) uwinfix="-e s,\\\\\\\\,/,g" ;;
1033             + posix-bc) uwinfix="-e s/\\*POSIX(\\(.*\\))/\\1/" ;;
1034             + vos) uwinfix="-e s/\#/\\\#/" ;;
1035             + *) uwinfix="" ;;
1036             + esac
1037             case "$file" in
1038             *.c) filebase=`basename $file .c` ;;
1039             *.y) filebase=`basename $file .y` ;;
1040             esac
1041             case "$file" in
1042             - */*) finc="-I`echo $file | sed 's#/[^/]*$##`" ;;
1043             + */*) finc="-I`echo $file | sed 's#/[^/]*$##'`" ;;
1044             *) finc= ;;
1045             esac
1046             $echo "Finding dependencies for $filebase$_o."
1047             @@ -139,10 +140,12 @@
1048             -e 's|\\$||' \
1049             -e p \
1050             -e '}' ) >UU/$file.c
1051             +
1052             + if [ "$osname" = os390 -a "$file" = perly.c ]; then
1053             + $echo '#endif' >>UU/$file.c
1054             + fi
1055             +
1056             if [ "$osname" = os390 ]; then
1057             - if [ "$file" = perly.c ]; then
1058             - $echo '#endif' >>UU/$file.c
1059             - fi
1060             $cppstdin $finc -I. $cppflags $cppminus
1061             $sed \
1062             -e '/^#.*/d' \
1063             @@ -156,21 +159,24 @@
1064             -e 's|\.c\.c|.c|' $uwinfix | \
1065             $uniq | $sort | $uniq >> .deptmp
1066             else
1067             - $cppstdin $finc -I. $cppflags $cppminus
1068             + $cppstdin $finc -I. $cppflags $cppminus .cout 2>.cerr
1069             $sed \
1070             -e '1d' \
1071             -e '/^#.*/d' \
1072             - -e '/^#.*/d' \
1073             - -e '/^#.*/d' \
1074             - -e '/^#.*/d' \
1075             + -e '/^#.*/d' \
1076             + -e '/^#.*/d' \
1077             + -e '/^#.*/d' \
1078             + -e '/^#.*/d' \
1079             -e '/^#.*"-"/d' \
1080             + -e '/^#.*"\/.*\/"/d' \
1081             + -e '/: file path prefix .* never used$/d' \
1082             -e 's#\.[0-9][0-9]*\.c#'"$file.c#" \
1083             -e 's/^[ ]*#[ ]*line/#/' \
1084             -e '/^# *[0-9][0-9]* *[".\/]/!d' \
1085             -e 's/^.*"\(.*\)".*$/'$filebase'\$(OBJ_EXT): \1/' \
1086             -e 's/^# *[0-9][0-9]* \(.*\)$/'$filebase'\$(OBJ_EXT): \1/' \
1087             -e 's|: \./|: |' \
1088             - -e 's|\.c\.c|.c|' $uwinfix | \
1089             + -e 's|\.c\.c|.c|' $uwinfix .cout .cerr| \
1090             $uniq | $sort | $uniq >> .deptmp
1091             fi
1092             done
1093             @@ -204,6 +210,10 @@
1094             $echo "Updating $mf..."
1095             $echo "# If this runs make out of memory, delete /usr/include lines." \
1096             >> $mf.new
1097             + if [ "$osname" = vos ]; then
1098             + $sed 's|.incl.c|.h|' .deptmp >.deptmp.vos
1099             + mv -f .deptmp.vos .deptmp
1100             + fi
1101             $sed 's|^\(.*\$(OBJ_EXT):\) *\(.*/.*\.c\) *$|\1 \2; '"$defrule \2|" .deptmp \
1102             >>$mf.new
1103             else
1104             @@ -235,7 +245,8 @@
1105             $cp $mf.new $mf
1106             $rm $mf.new
1107             $echo "# WARNING: Put nothing here or make depend will gobble it up!" >> $mf
1108             -$rm -rf .deptmp UU .shlist .clist .hlist .hsed
1109             +$rm -rf .deptmp UU .shlist .clist .hlist .hsed .cout .cerr
1110             +rmdir .depending
1111            
1112             !NO!SUBS!
1113             $eunicefix makedepend
1114             BADGER
1115 0           last SWITCH;
1116             }
1117             # If 5.7.0
1118 0 0         if ( $perl eq '5.7.0' ) {
1119 0           _patch(<<'BADGER');
1120             --- makedepend.SH.org 2000-08-13 19:35:04.000000000 +0100
1121             +++ makedepend.SH 2010-09-01 10:47:14.000000000 +0100
1122             @@ -1,5 +1,5 @@
1123             #! /bin/sh
1124             -case $CONFIGDOTSH in
1125             +case $PERL_CONFIG_SH in
1126             '')
1127             if test -f config.sh; then TOP=.;
1128             elif test -f ../config.sh; then TOP=..;
1129             @@ -29,6 +29,13 @@
1130             !GROK!THIS!
1131             $spitshell >>makedepend <<'!NO!SUBS!'
1132            
1133             +if test -d .depending; then
1134             + echo "$0: Already running, exiting."
1135             + exit 0
1136             +fi
1137             +
1138             +mkdir .depending
1139             +
1140             # This script should be called with
1141             # sh ./makedepend MAKE=$(MAKE)
1142             case "$1" in
1143             @@ -37,7 +44,7 @@
1144            
1145             export PATH || (echo "OOPS, this isn't sh. Desperation time. I will feed myself to sh."; sh \$0; kill \$\$)
1146            
1147             -case $CONFIGDOTSH in
1148             +case $PERL_CONFIG_SH in
1149             '')
1150             if test -f config.sh; then TOP=.;
1151             elif test -f ../config.sh; then TOP=..;
1152             @@ -51,6 +58,11 @@
1153             ;;
1154             esac
1155            
1156             +# Avoid localized gcc messages
1157             +case "$ccname" in
1158             + gcc) LC_ALL=C ; export LC_ALL ;;
1159             +esac
1160             +
1161             # We need .. when we are in the x2p directory if we are using the
1162             # cppstdin wrapper script.
1163             # Put .. and . first so that we pick up the present cppstdin, not
1164             @@ -58,6 +70,10 @@
1165             PATH=".$path_sep..$path_sep$PATH"
1166             export PATH
1167            
1168             +case "$osname" in
1169             +amigaos) cat=/bin/cat ;; # must be absolute
1170             +esac
1171             +
1172             $cat /dev/null >.deptmp
1173             $rm -f *.c.c c/*.c.c
1174             if test -f Makefile; then
1175             @@ -67,7 +83,6 @@
1176             # to be out of date. I don't know if OS/2 has touch, so do this:
1177             case "$osname" in
1178             os2) ;;
1179             - netbsd) ;;
1180             *) $touch $firstmakefile ;;
1181             esac
1182             fi
1183             @@ -99,25 +114,20 @@
1184             $echo *.c | $tr ' ' $trnl | $egrep -v '\*' >.clist)
1185             for file in `$cat .clist`; do
1186             # for file in `cat /dev/null`; do
1187             - if [ "$osname" = uwin ]; then
1188             - uwinfix="-e s,\\\\\\\\,/,g -e s,\\([a-zA-Z]\\):/,/\\1/,g"
1189             - else
1190             - if [ "$osname" = os2 ]; then
1191             - uwinfix="-e s,\\\\\\\\,/,g"
1192             - else
1193             - if [ "$archname" = cygwin ]; then
1194             - uwinfix="-e s,\\\\\\\\,/,g"
1195             - else
1196             - uwinfix=
1197             - fi
1198             - fi
1199             - fi
1200             + case "$osname" in
1201             + uwin) uwinfix="-e s,\\\\\\\\,/,g -e s,\\([a-zA-Z]\\):/,/\\1/,g" ;;
1202             + os2) uwinfix="-e s,\\\\\\\\,/,g" ;;
1203             + cygwin) uwinfix="-e s,\\\\\\\\,/,g" ;;
1204             + posix-bc) uwinfix="-e s/\\*POSIX(\\(.*\\))/\\1/" ;;
1205             + vos) uwinfix="-e s/\#/\\\#/" ;;
1206             + *) uwinfix="" ;;
1207             + esac
1208             case "$file" in
1209             *.c) filebase=`basename $file .c` ;;
1210             *.y) filebase=`basename $file .y` ;;
1211             esac
1212             case "$file" in
1213             - */*) finc="-I`echo $file | sed 's#/[^/]*$##`" ;;
1214             + */*) finc="-I`echo $file | sed 's#/[^/]*$##'`" ;;
1215             *) finc= ;;
1216             esac
1217             $echo "Finding dependencies for $filebase$_o."
1218             @@ -130,10 +140,12 @@
1219             -e 's|\\$||' \
1220             -e p \
1221             -e '}' ) >UU/$file.c
1222             +
1223             + if [ "$osname" = os390 -a "$file" = perly.c ]; then
1224             + $echo '#endif' >>UU/$file.c
1225             + fi
1226             +
1227             if [ "$osname" = os390 ]; then
1228             - if [ "$file" = perly.c ]; then
1229             - $echo '#endif' >>UU/$file.c
1230             - fi
1231             $cppstdin $finc -I. $cppflags $cppminus
1232             $sed \
1233             -e '/^#.*/d' \
1234             @@ -147,18 +159,24 @@
1235             -e 's|\.c\.c|.c|' $uwinfix | \
1236             $uniq | $sort | $uniq >> .deptmp
1237             else
1238             - $cppstdin $finc -I. $cppflags $cppminus
1239             + $cppstdin $finc -I. $cppflags $cppminus .cout 2>.cerr
1240             $sed \
1241             -e '1d' \
1242             -e '/^#.*/d' \
1243             + -e '/^#.*/d' \
1244             + -e '/^#.*/d' \
1245             + -e '/^#.*/d' \
1246             + -e '/^#.*/d' \
1247             -e '/^#.*"-"/d' \
1248             + -e '/^#.*"\/.*\/"/d' \
1249             + -e '/: file path prefix .* never used$/d' \
1250             -e 's#\.[0-9][0-9]*\.c#'"$file.c#" \
1251             -e 's/^[ ]*#[ ]*line/#/' \
1252             -e '/^# *[0-9][0-9]* *[".\/]/!d' \
1253             -e 's/^.*"\(.*\)".*$/'$filebase'\$(OBJ_EXT): \1/' \
1254             -e 's/^# *[0-9][0-9]* \(.*\)$/'$filebase'\$(OBJ_EXT): \1/' \
1255             -e 's|: \./|: |' \
1256             - -e 's|\.c\.c|.c|' $uwinfix | \
1257             + -e 's|\.c\.c|.c|' $uwinfix .cout .cerr| \
1258             $uniq | $sort | $uniq >> .deptmp
1259             fi
1260             done
1261             @@ -192,6 +210,10 @@
1262             $echo "Updating $mf..."
1263             $echo "# If this runs make out of memory, delete /usr/include lines." \
1264             >> $mf.new
1265             + if [ "$osname" = vos ]; then
1266             + $sed 's|.incl.c|.h|' .deptmp >.deptmp.vos
1267             + mv -f .deptmp.vos .deptmp
1268             + fi
1269             $sed 's|^\(.*\$(OBJ_EXT):\) *\(.*/.*\.c\) *$|\1 \2; '"$defrule \2|" .deptmp \
1270             >>$mf.new
1271             else
1272             @@ -223,7 +245,8 @@
1273             $cp $mf.new $mf
1274             $rm $mf.new
1275             $echo "# WARNING: Put nothing here or make depend will gobble it up!" >> $mf
1276             -$rm -rf .deptmp UU .shlist .clist .hlist .hsed
1277             +$rm -rf .deptmp UU .shlist .clist .hlist .hsed .cout .cerr
1278             +rmdir .depending
1279            
1280             !NO!SUBS!
1281             $eunicefix makedepend
1282             BADGER
1283 0           last SWITCH;
1284             }
1285             # If 5.7.1
1286 0 0         if ( $perl eq '5.7.1' ) {
1287 0           _patch(<<'BADGER');
1288             --- makedepend.SH.org 2001-03-11 16:30:08.000000000 +0000
1289             +++ makedepend.SH 2010-09-01 10:44:54.000000000 +0100
1290             @@ -1,5 +1,5 @@
1291             #! /bin/sh
1292             -case $CONFIGDOTSH in
1293             +case $PERL_CONFIG_SH in
1294             '')
1295             if test -f config.sh; then TOP=.;
1296             elif test -f ../config.sh; then TOP=..;
1297             @@ -29,6 +29,13 @@
1298             !GROK!THIS!
1299             $spitshell >>makedepend <<'!NO!SUBS!'
1300            
1301             +if test -d .depending; then
1302             + echo "$0: Already running, exiting."
1303             + exit 0
1304             +fi
1305             +
1306             +mkdir .depending
1307             +
1308             # This script should be called with
1309             # sh ./makedepend MAKE=$(MAKE)
1310             case "$1" in
1311             @@ -37,7 +44,7 @@
1312            
1313             export PATH || (echo "OOPS, this isn't sh. Desperation time. I will feed myself to sh."; sh \$0; kill \$\$)
1314            
1315             -case $CONFIGDOTSH in
1316             +case $PERL_CONFIG_SH in
1317             '')
1318             if test -f config.sh; then TOP=.;
1319             elif test -f ../config.sh; then TOP=..;
1320             @@ -51,6 +58,11 @@
1321             ;;
1322             esac
1323            
1324             +# Avoid localized gcc messages
1325             +case "$ccname" in
1326             + gcc) LC_ALL=C ; export LC_ALL ;;
1327             +esac
1328             +
1329             # We need .. when we are in the x2p directory if we are using the
1330             # cppstdin wrapper script.
1331             # Put .. and . first so that we pick up the present cppstdin, not
1332             @@ -58,6 +70,10 @@
1333             PATH=".$path_sep..$path_sep$PATH"
1334             export PATH
1335            
1336             +case "$osname" in
1337             +amigaos) cat=/bin/cat ;; # must be absolute
1338             +esac
1339             +
1340             $cat /dev/null >.deptmp
1341             $rm -f *.c.c c/*.c.c
1342             if test -f Makefile; then
1343             @@ -67,7 +83,6 @@
1344             # to be out of date. I don't know if OS/2 has touch, so do this:
1345             case "$osname" in
1346             os2) ;;
1347             - netbsd) ;;
1348             *) $touch $firstmakefile ;;
1349             esac
1350             fi
1351             @@ -99,29 +114,20 @@
1352             $echo *.c | $tr ' ' $trnl | $egrep -v '\*' >.clist)
1353             for file in `$cat .clist`; do
1354             # for file in `cat /dev/null`; do
1355             - if [ "$osname" = uwin ]; then
1356             - uwinfix="-e s,\\\\\\\\,/,g -e s,\\([a-zA-Z]\\):/,/\\1/,g"
1357             - else
1358             - if [ "$osname" = os2 ]; then
1359             - uwinfix="-e s,\\\\\\\\,/,g"
1360             - else
1361             - if [ "$archname" = cygwin ]; then
1362             - uwinfix="-e s,\\\\\\\\,/,g"
1363             - else
1364             - if [ "$osname" = posix-bc ]; then
1365             - uwinfix="-e s/\\*POSIX(\\(.*\\))/\\1/"
1366             - else
1367             - uwinfix=
1368             - fi
1369             - fi
1370             - fi
1371             - fi
1372             + case "$osname" in
1373             + uwin) uwinfix="-e s,\\\\\\\\,/,g -e s,\\([a-zA-Z]\\):/,/\\1/,g" ;;
1374             + os2) uwinfix="-e s,\\\\\\\\,/,g" ;;
1375             + cygwin) uwinfix="-e s,\\\\\\\\,/,g" ;;
1376             + posix-bc) uwinfix="-e s/\\*POSIX(\\(.*\\))/\\1/" ;;
1377             + vos) uwinfix="-e s/\#/\\\#/" ;;
1378             + *) uwinfix="" ;;
1379             + esac
1380             case "$file" in
1381             *.c) filebase=`basename $file .c` ;;
1382             *.y) filebase=`basename $file .y` ;;
1383             esac
1384             case "$file" in
1385             - */*) finc="-I`echo $file | sed 's#/[^/]*$##`" ;;
1386             + */*) finc="-I`echo $file | sed 's#/[^/]*$##'`" ;;
1387             *) finc= ;;
1388             esac
1389             $echo "Finding dependencies for $filebase$_o."
1390             @@ -134,10 +140,12 @@
1391             -e 's|\\$||' \
1392             -e p \
1393             -e '}' ) >UU/$file.c
1394             +
1395             + if [ "$osname" = os390 -a "$file" = perly.c ]; then
1396             + $echo '#endif' >>UU/$file.c
1397             + fi
1398             +
1399             if [ "$osname" = os390 ]; then
1400             - if [ "$file" = perly.c ]; then
1401             - $echo '#endif' >>UU/$file.c
1402             - fi
1403             $cppstdin $finc -I. $cppflags $cppminus
1404             $sed \
1405             -e '/^#.*/d' \
1406             @@ -151,18 +159,24 @@
1407             -e 's|\.c\.c|.c|' $uwinfix | \
1408             $uniq | $sort | $uniq >> .deptmp
1409             else
1410             - $cppstdin $finc -I. $cppflags $cppminus
1411             + $cppstdin $finc -I. $cppflags $cppminus .cout 2>.cerr
1412             $sed \
1413             -e '1d' \
1414             -e '/^#.*/d' \
1415             + -e '/^#.*/d' \
1416             + -e '/^#.*/d' \
1417             + -e '/^#.*/d' \
1418             + -e '/^#.*/d' \
1419             -e '/^#.*"-"/d' \
1420             + -e '/^#.*"\/.*\/"/d' \
1421             + -e '/: file path prefix .* never used$/d' \
1422             -e 's#\.[0-9][0-9]*\.c#'"$file.c#" \
1423             -e 's/^[ ]*#[ ]*line/#/' \
1424             -e '/^# *[0-9][0-9]* *[".\/]/!d' \
1425             -e 's/^.*"\(.*\)".*$/'$filebase'\$(OBJ_EXT): \1/' \
1426             -e 's/^# *[0-9][0-9]* \(.*\)$/'$filebase'\$(OBJ_EXT): \1/' \
1427             -e 's|: \./|: |' \
1428             - -e 's|\.c\.c|.c|' $uwinfix | \
1429             + -e 's|\.c\.c|.c|' $uwinfix .cout .cerr| \
1430             $uniq | $sort | $uniq >> .deptmp
1431             fi
1432             done
1433             @@ -196,6 +210,10 @@
1434             $echo "Updating $mf..."
1435             $echo "# If this runs make out of memory, delete /usr/include lines." \
1436             >> $mf.new
1437             + if [ "$osname" = vos ]; then
1438             + $sed 's|.incl.c|.h|' .deptmp >.deptmp.vos
1439             + mv -f .deptmp.vos .deptmp
1440             + fi
1441             $sed 's|^\(.*\$(OBJ_EXT):\) *\(.*/.*\.c\) *$|\1 \2; '"$defrule \2|" .deptmp \
1442             >>$mf.new
1443             else
1444             @@ -227,7 +245,8 @@
1445             $cp $mf.new $mf
1446             $rm $mf.new
1447             $echo "# WARNING: Put nothing here or make depend will gobble it up!" >> $mf
1448             -$rm -rf .deptmp UU .shlist .clist .hlist .hsed
1449             +$rm -rf .deptmp UU .shlist .clist .hlist .hsed .cout .cerr
1450             +rmdir .depending
1451            
1452             !NO!SUBS!
1453             $eunicefix makedepend
1454             BADGER
1455 0           last SWITCH;
1456             }
1457             # If 5.7.2
1458 0 0         if ( $perl eq '5.7.2' ) {
1459 0           _patch(<<'BADGER');
1460             --- makedepend.SH.org 2001-07-09 15:11:05.000000000 +0100
1461             +++ makedepend.SH 2010-09-01 10:45:32.000000000 +0100
1462             @@ -18,10 +18,6 @@
1463             */*) cd `expr X$0 : 'X\(.*\)/'` ;;
1464             esac
1465            
1466             -case "$osname" in
1467             -amigaos) cat=/bin/cat ;; # must be absolute
1468             -esac
1469             -
1470             echo "Extracting makedepend (with variable substitutions)"
1471             rm -f makedepend
1472             $spitshell >makedepend <
1473             @@ -33,6 +29,13 @@
1474             !GROK!THIS!
1475             $spitshell >>makedepend <<'!NO!SUBS!'
1476            
1477             +if test -d .depending; then
1478             + echo "$0: Already running, exiting."
1479             + exit 0
1480             +fi
1481             +
1482             +mkdir .depending
1483             +
1484             # This script should be called with
1485             # sh ./makedepend MAKE=$(MAKE)
1486             case "$1" in
1487             @@ -55,6 +58,11 @@
1488             ;;
1489             esac
1490            
1491             +# Avoid localized gcc messages
1492             +case "$ccname" in
1493             + gcc) LC_ALL=C ; export LC_ALL ;;
1494             +esac
1495             +
1496             # We need .. when we are in the x2p directory if we are using the
1497             # cppstdin wrapper script.
1498             # Put .. and . first so that we pick up the present cppstdin, not
1499             @@ -62,6 +70,10 @@
1500             PATH=".$path_sep..$path_sep$PATH"
1501             export PATH
1502            
1503             +case "$osname" in
1504             +amigaos) cat=/bin/cat ;; # must be absolute
1505             +esac
1506             +
1507             $cat /dev/null >.deptmp
1508             $rm -f *.c.c c/*.c.c
1509             if test -f Makefile; then
1510             @@ -71,7 +83,6 @@
1511             # to be out of date. I don't know if OS/2 has touch, so do this:
1512             case "$osname" in
1513             os2) ;;
1514             - netbsd) ;;
1515             *) $touch $firstmakefile ;;
1516             esac
1517             fi
1518             @@ -103,29 +114,20 @@
1519             $echo *.c | $tr ' ' $trnl | $egrep -v '\*' >.clist)
1520             for file in `$cat .clist`; do
1521             # for file in `cat /dev/null`; do
1522             - if [ "$osname" = uwin ]; then
1523             - uwinfix="-e s,\\\\\\\\,/,g -e s,\\([a-zA-Z]\\):/,/\\1/,g"
1524             - else
1525             - if [ "$osname" = os2 ]; then
1526             - uwinfix="-e s,\\\\\\\\,/,g"
1527             - else
1528             - if [ "$archname" = cygwin ]; then
1529             - uwinfix="-e s,\\\\\\\\,/,g"
1530             - else
1531             - if [ "$osname" = posix-bc ]; then
1532             - uwinfix="-e s/\\*POSIX(\\(.*\\))/\\1/"
1533             - else
1534             - uwinfix=
1535             - fi
1536             - fi
1537             - fi
1538             - fi
1539             + case "$osname" in
1540             + uwin) uwinfix="-e s,\\\\\\\\,/,g -e s,\\([a-zA-Z]\\):/,/\\1/,g" ;;
1541             + os2) uwinfix="-e s,\\\\\\\\,/,g" ;;
1542             + cygwin) uwinfix="-e s,\\\\\\\\,/,g" ;;
1543             + posix-bc) uwinfix="-e s/\\*POSIX(\\(.*\\))/\\1/" ;;
1544             + vos) uwinfix="-e s/\#/\\\#/" ;;
1545             + *) uwinfix="" ;;
1546             + esac
1547             case "$file" in
1548             *.c) filebase=`basename $file .c` ;;
1549             *.y) filebase=`basename $file .y` ;;
1550             esac
1551             case "$file" in
1552             - */*) finc="-I`echo $file | sed 's#/[^/]*$##`" ;;
1553             + */*) finc="-I`echo $file | sed 's#/[^/]*$##'`" ;;
1554             *) finc= ;;
1555             esac
1556             $echo "Finding dependencies for $filebase$_o."
1557             @@ -138,10 +140,12 @@
1558             -e 's|\\$||' \
1559             -e p \
1560             -e '}' ) >UU/$file.c
1561             +
1562             + if [ "$osname" = os390 -a "$file" = perly.c ]; then
1563             + $echo '#endif' >>UU/$file.c
1564             + fi
1565             +
1566             if [ "$osname" = os390 ]; then
1567             - if [ "$file" = perly.c ]; then
1568             - $echo '#endif' >>UU/$file.c
1569             - fi
1570             $cppstdin $finc -I. $cppflags $cppminus
1571             $sed \
1572             -e '/^#.*/d' \
1573             @@ -155,18 +159,24 @@
1574             -e 's|\.c\.c|.c|' $uwinfix | \
1575             $uniq | $sort | $uniq >> .deptmp
1576             else
1577             - $cppstdin $finc -I. $cppflags $cppminus
1578             + $cppstdin $finc -I. $cppflags $cppminus .cout 2>.cerr
1579             $sed \
1580             -e '1d' \
1581             -e '/^#.*/d' \
1582             + -e '/^#.*/d' \
1583             + -e '/^#.*/d' \
1584             + -e '/^#.*/d' \
1585             + -e '/^#.*/d' \
1586             -e '/^#.*"-"/d' \
1587             + -e '/^#.*"\/.*\/"/d' \
1588             + -e '/: file path prefix .* never used$/d' \
1589             -e 's#\.[0-9][0-9]*\.c#'"$file.c#" \
1590             -e 's/^[ ]*#[ ]*line/#/' \
1591             -e '/^# *[0-9][0-9]* *[".\/]/!d' \
1592             -e 's/^.*"\(.*\)".*$/'$filebase'\$(OBJ_EXT): \1/' \
1593             -e 's/^# *[0-9][0-9]* \(.*\)$/'$filebase'\$(OBJ_EXT): \1/' \
1594             -e 's|: \./|: |' \
1595             - -e 's|\.c\.c|.c|' $uwinfix | \
1596             + -e 's|\.c\.c|.c|' $uwinfix .cout .cerr| \
1597             $uniq | $sort | $uniq >> .deptmp
1598             fi
1599             done
1600             @@ -200,6 +210,10 @@
1601             $echo "Updating $mf..."
1602             $echo "# If this runs make out of memory, delete /usr/include lines." \
1603             >> $mf.new
1604             + if [ "$osname" = vos ]; then
1605             + $sed 's|.incl.c|.h|' .deptmp >.deptmp.vos
1606             + mv -f .deptmp.vos .deptmp
1607             + fi
1608             $sed 's|^\(.*\$(OBJ_EXT):\) *\(.*/.*\.c\) *$|\1 \2; '"$defrule \2|" .deptmp \
1609             >>$mf.new
1610             else
1611             @@ -231,7 +245,8 @@
1612             $cp $mf.new $mf
1613             $rm $mf.new
1614             $echo "# WARNING: Put nothing here or make depend will gobble it up!" >> $mf
1615             -$rm -rf .deptmp UU .shlist .clist .hlist .hsed
1616             +$rm -rf .deptmp UU .shlist .clist .hlist .hsed .cout .cerr
1617             +rmdir .depending
1618            
1619             !NO!SUBS!
1620             $eunicefix makedepend
1621             BADGER
1622 0           last SWITCH;
1623             }
1624             # If 5.7.3
1625 0 0         if ( $perl eq '5.7.3' ) {
1626 0           _patch(<<'BADGER');
1627             --- makedepend.SH.org 2002-03-05 01:10:22.000000000 +0000
1628             +++ makedepend.SH 2010-09-01 10:46:13.000000000 +0100
1629             @@ -18,10 +18,6 @@
1630             */*) cd `expr X$0 : 'X\(.*\)/'` ;;
1631             esac
1632            
1633             -case "$osname" in
1634             -amigaos) cat=/bin/cat ;; # must be absolute
1635             -esac
1636             -
1637             echo "Extracting makedepend (with variable substitutions)"
1638             rm -f makedepend
1639             $spitshell >makedepend <
1640             @@ -33,6 +29,13 @@
1641             !GROK!THIS!
1642             $spitshell >>makedepend <<'!NO!SUBS!'
1643            
1644             +if test -d .depending; then
1645             + echo "$0: Already running, exiting."
1646             + exit 0
1647             +fi
1648             +
1649             +mkdir .depending
1650             +
1651             # This script should be called with
1652             # sh ./makedepend MAKE=$(MAKE)
1653             case "$1" in
1654             @@ -55,6 +58,11 @@
1655             ;;
1656             esac
1657            
1658             +# Avoid localized gcc messages
1659             +case "$ccname" in
1660             + gcc) LC_ALL=C ; export LC_ALL ;;
1661             +esac
1662             +
1663             # We need .. when we are in the x2p directory if we are using the
1664             # cppstdin wrapper script.
1665             # Put .. and . first so that we pick up the present cppstdin, not
1666             @@ -62,6 +70,10 @@
1667             PATH=".$path_sep..$path_sep$PATH"
1668             export PATH
1669            
1670             +case "$osname" in
1671             +amigaos) cat=/bin/cat ;; # must be absolute
1672             +esac
1673             +
1674             $cat /dev/null >.deptmp
1675             $rm -f *.c.c c/*.c.c
1676             if test -f Makefile; then
1677             @@ -71,7 +83,6 @@
1678             # to be out of date. I don't know if OS/2 has touch, so do this:
1679             case "$osname" in
1680             os2) ;;
1681             - netbsd) ;;
1682             *) $touch $firstmakefile ;;
1683             esac
1684             fi
1685             @@ -116,7 +127,7 @@
1686             *.y) filebase=`basename $file .y` ;;
1687             esac
1688             case "$file" in
1689             - */*) finc="-I`echo $file | sed 's#/[^/]*$##`" ;;
1690             + */*) finc="-I`echo $file | sed 's#/[^/]*$##'`" ;;
1691             *) finc= ;;
1692             esac
1693             $echo "Finding dependencies for $filebase$_o."
1694             @@ -129,6 +140,11 @@
1695             -e 's|\\$||' \
1696             -e p \
1697             -e '}' ) >UU/$file.c
1698             +
1699             + if [ "$osname" = os390 -a "$file" = perly.c ]; then
1700             + $echo '#endif' >>UU/$file.c
1701             + fi
1702             +
1703             if [ "$osname" = os390 ]; then
1704             $cppstdin $finc -I. $cppflags $cppminus
1705             $sed \
1706             @@ -143,13 +159,16 @@
1707             -e 's|\.c\.c|.c|' $uwinfix | \
1708             $uniq | $sort | $uniq >> .deptmp
1709             else
1710             - $cppstdin $finc -I. $cppflags $cppminus &1 |
1711             + $cppstdin $finc -I. $cppflags $cppminus .cout 2>.cerr
1712             $sed \
1713             -e '1d' \
1714             -e '/^#.*/d' \
1715             -e '/^#.*/d' \
1716             + -e '/^#.*/d' \
1717             -e '/^#.*/d' \
1718             + -e '/^#.*/d' \
1719             -e '/^#.*"-"/d' \
1720             + -e '/^#.*"\/.*\/"/d' \
1721             -e '/: file path prefix .* never used$/d' \
1722             -e 's#\.[0-9][0-9]*\.c#'"$file.c#" \
1723             -e 's/^[ ]*#[ ]*line/#/' \
1724             @@ -157,7 +176,7 @@
1725             -e 's/^.*"\(.*\)".*$/'$filebase'\$(OBJ_EXT): \1/' \
1726             -e 's/^# *[0-9][0-9]* \(.*\)$/'$filebase'\$(OBJ_EXT): \1/' \
1727             -e 's|: \./|: |' \
1728             - -e 's|\.c\.c|.c|' $uwinfix | \
1729             + -e 's|\.c\.c|.c|' $uwinfix .cout .cerr| \
1730             $uniq | $sort | $uniq >> .deptmp
1731             fi
1732             done
1733             @@ -191,6 +210,10 @@
1734             $echo "Updating $mf..."
1735             $echo "# If this runs make out of memory, delete /usr/include lines." \
1736             >> $mf.new
1737             + if [ "$osname" = vos ]; then
1738             + $sed 's|.incl.c|.h|' .deptmp >.deptmp.vos
1739             + mv -f .deptmp.vos .deptmp
1740             + fi
1741             $sed 's|^\(.*\$(OBJ_EXT):\) *\(.*/.*\.c\) *$|\1 \2; '"$defrule \2|" .deptmp \
1742             >>$mf.new
1743             else
1744             @@ -222,7 +245,8 @@
1745             $cp $mf.new $mf
1746             $rm $mf.new
1747             $echo "# WARNING: Put nothing here or make depend will gobble it up!" >> $mf
1748             -$rm -rf .deptmp UU .shlist .clist .hlist .hsed
1749             +$rm -rf .deptmp UU .shlist .clist .hlist .hsed .cout .cerr
1750             +rmdir .depending
1751            
1752             !NO!SUBS!
1753             $eunicefix makedepend
1754             BADGER
1755 0           last SWITCH;
1756             }
1757             # If 5.8.0
1758 0 0         if ( $perl eq '5.8.0' ) {
1759 0           _patch(<<'BADGER');
1760             --- makedepend.SH.org 2002-07-09 15:06:42.000000000 +0100
1761             +++ makedepend.SH 2010-09-01 10:16:37.000000000 +0100
1762             @@ -58,6 +58,11 @@
1763             ;;
1764             esac
1765            
1766             +# Avoid localized gcc messages
1767             +case "$ccname" in
1768             + gcc) LC_ALL=C ; export LC_ALL ;;
1769             +esac
1770             +
1771             # We need .. when we are in the x2p directory if we are using the
1772             # cppstdin wrapper script.
1773             # Put .. and . first so that we pick up the present cppstdin, not
1774             @@ -78,7 +83,6 @@
1775             # to be out of date. I don't know if OS/2 has touch, so do this:
1776             case "$osname" in
1777             os2) ;;
1778             - netbsd) ;;
1779             *) $touch $firstmakefile ;;
1780             esac
1781             fi
1782             @@ -123,7 +127,7 @@
1783             *.y) filebase=`basename $file .y` ;;
1784             esac
1785             case "$file" in
1786             - */*) finc="-I`echo $file | sed 's#/[^/]*$##`" ;;
1787             + */*) finc="-I`echo $file | sed 's#/[^/]*$##'`" ;;
1788             *) finc= ;;
1789             esac
1790             $echo "Finding dependencies for $filebase$_o."
1791             @@ -136,6 +140,11 @@
1792             -e 's|\\$||' \
1793             -e p \
1794             -e '}' ) >UU/$file.c
1795             +
1796             + if [ "$osname" = os390 -a "$file" = perly.c ]; then
1797             + $echo '#endif' >>UU/$file.c
1798             + fi
1799             +
1800             if [ "$osname" = os390 ]; then
1801             $cppstdin $finc -I. $cppflags $cppminus
1802             $sed \
1803             @@ -157,7 +166,9 @@
1804             -e '/^#.*/d' \
1805             -e '/^#.*/d' \
1806             -e '/^#.*/d' \
1807             + -e '/^#.*/d' \
1808             -e '/^#.*"-"/d' \
1809             + -e '/^#.*"\/.*\/"/d' \
1810             -e '/: file path prefix .* never used$/d' \
1811             -e 's#\.[0-9][0-9]*\.c#'"$file.c#" \
1812             -e 's/^[ ]*#[ ]*line/#/' \
1813             @@ -199,6 +210,10 @@
1814             $echo "Updating $mf..."
1815             $echo "# If this runs make out of memory, delete /usr/include lines." \
1816             >> $mf.new
1817             + if [ "$osname" = vos ]; then
1818             + $sed 's|.incl.c|.h|' .deptmp >.deptmp.vos
1819             + mv -f .deptmp.vos .deptmp
1820             + fi
1821             $sed 's|^\(.*\$(OBJ_EXT):\) *\(.*/.*\.c\) *$|\1 \2; '"$defrule \2|" .deptmp \
1822             >>$mf.new
1823             else
1824             BADGER
1825 0           last SWITCH;
1826             }
1827             # If 5.8.[12345678]
1828 0           _patch(<<'BADGER');
1829             --- makedepend.SH.org 2003-06-05 19:11:10.000000000 +0100
1830             +++ makedepend.SH 2010-09-01 10:24:39.000000000 +0100
1831             @@ -83,7 +83,6 @@
1832             # to be out of date. I don't know if OS/2 has touch, so do this:
1833             case "$osname" in
1834             os2) ;;
1835             - netbsd) ;;
1836             *) $touch $firstmakefile ;;
1837             esac
1838             fi
1839             @@ -128,7 +127,7 @@
1840             *.y) filebase=`basename $file .y` ;;
1841             esac
1842             case "$file" in
1843             - */*) finc="-I`echo $file | sed 's#/[^/]*$##`" ;;
1844             + */*) finc="-I`echo $file | sed 's#/[^/]*$##'`" ;;
1845             *) finc= ;;
1846             esac
1847             $echo "Finding dependencies for $filebase$_o."
1848             @@ -167,7 +166,9 @@
1849             -e '/^#.*/d' \
1850             -e '/^#.*/d' \
1851             -e '/^#.*/d' \
1852             + -e '/^#.*/d' \
1853             -e '/^#.*"-"/d' \
1854             + -e '/^#.*"\/.*\/"/d' \
1855             -e '/: file path prefix .* never used$/d' \
1856             -e 's#\.[0-9][0-9]*\.c#'"$file.c#" \
1857             -e 's/^[ ]*#[ ]*line/#/' \
1858             @@ -209,6 +210,10 @@
1859             $echo "Updating $mf..."
1860             $echo "# If this runs make out of memory, delete /usr/include lines." \
1861             >> $mf.new
1862             + if [ "$osname" = vos ]; then
1863             + $sed 's|.incl.c|.h|' .deptmp >.deptmp.vos
1864             + mv -f .deptmp.vos .deptmp
1865             + fi
1866             $sed 's|^\(.*\$(OBJ_EXT):\) *\(.*/.*\.c\) *$|\1 \2; '"$defrule \2|" .deptmp \
1867             >>$mf.new
1868             else
1869             BADGER
1870             }
1871             }
1872              
1873             sub _patch_conf_gconvert
1874             {
1875 0     0     my $perl = shift;
1876 0           _patch(<<'END');
1877             --- Configure
1878             +++ Configure
1879             @@ -7851,6 +7851,21 @@ int main()
1880             Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
1881             checkit("0.1", buf);
1882            
1883             + Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
1884             + checkit("0.01", buf);
1885             +
1886             + Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
1887             + checkit("0.001", buf);
1888             +
1889             + Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
1890             + checkit("0.0001", buf);
1891             +
1892             + Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
1893             + if (strlen(buf) > 5)
1894             + checkit("9e-005", buf); /* for Microsoft ?? */
1895             + else
1896             + checkit("9e-05", buf);
1897             +
1898             Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
1899             checkit("1", buf);
1900            
1901             @@ -7889,6 +7904,19 @@ int main()
1902             Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
1903             checkit("123.456", buf);
1904            
1905             + /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
1906             + Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
1907             + /* 34 should be enough to scare even long double
1908             + * places into using the e notation. */
1909             + if (strlen(buf) > 5)
1910             + checkit("1e+034", buf); /* for Microsoft */
1911             + else
1912             + checkit("1e+34", buf);
1913             +
1914             + /* For Perl, if you add additional tests here, also add them to
1915             + * t/base/num.t for benefit of platforms not using Configure or
1916             + * overriding d_Gconvert */
1917             +
1918             exit(0);
1919             }
1920             EOP
1921             END
1922             }
1923              
1924             sub _patch_sort_N {
1925 0     0     system($^X, '-pi.bak', '-e', 's!\$sort \-n \+1!(\$sort -n -k 2 2>/dev/null || \$sort -n +1)!', 'Configure');
1926             }
1927              
1928             sub _patch_archive_tar_tests
1929             {
1930 0     0     my $perl = shift;
1931 0 0         if ($perl =~ /^5\.10/) {
1932 0           _patch(<<'END');
1933             --- lib/Archive/Tar/t/02_methods.t
1934             +++ lib/Archive/Tar/t/02_methods.t
1935             @@ -70,6 +70,20 @@ my $LONG_FILE = qq[directory/really-really-really-really-really-really-really-re
1936             my $TOO_LONG = ($^O eq 'MSWin32' or $^O eq 'cygwin' or $^O eq 'VMS')
1937             && length( cwd(). $LONG_FILE ) > 247;
1938            
1939             +if(!$TOO_LONG) {
1940             + my $alt = File::Spec->catfile( cwd(), $LONG_FILE);
1941             + eval 'mkpath([$alt]);';
1942             + if($@)
1943             + {
1944             + $TOO_LONG = 1;
1945             + }
1946             + else
1947             + {
1948             + $@ = '';
1949             + my $base = File::Spec->catfile( cwd(), 'directory');
1950             + rmtree $base;
1951             + }
1952             +}
1953             ### warn if we are going to skip long file names
1954             if ($TOO_LONG) {
1955             diag("No long filename support - long filename extraction disabled") if ! $ENV{PERL_CORE};
1956             END
1957             }
1958             else {
1959 0           _patch(<<'END');
1960             --- cpan/Archive-Tar/t/02_methods.t
1961             +++ cpan/Archive-Tar/t/02_methods.t
1962             @@ -70,6 +70,20 @@ my $LONG_FILE = qq[directory/really-really-really-really-really-really-really-re
1963             my $TOO_LONG = ($^O eq 'MSWin32' or $^O eq 'cygwin' or $^O eq 'VMS')
1964             && length( cwd(). $LONG_FILE ) > 247;
1965            
1966             +if(!$TOO_LONG) {
1967             + my $alt = File::Spec->catfile( cwd(), $LONG_FILE);
1968             + eval 'mkpath([$alt]);';
1969             + if($@)
1970             + {
1971             + $TOO_LONG = 1;
1972             + }
1973             + else
1974             + {
1975             + $@ = '';
1976             + my $base = File::Spec->catfile( cwd(), 'directory');
1977             + rmtree $base;
1978             + }
1979             +}
1980             ### warn if we are going to skip long file names
1981             if ($TOO_LONG) {
1982             diag("No long filename support - long filename extraction disabled") if ! $ENV{PERL_CORE};
1983             END
1984             }
1985             }
1986              
1987             sub _patch_odbm_file_hints_linux
1988             {
1989 0     0     _patch(<<'END');
1990             --- ext/ODBM_File/hints/linux.pl
1991             +++ ext/ODBM_File/hints/linux.pl
1992             @@ -1,8 +1,8 @@
1993             # uses GDBM dbm compatibility feature - at least on SuSE 8.0
1994             $self->{LIBS} = ['-lgdbm'];
1995            
1996             -# Debian/Ubuntu have /usr/lib/libgdbm_compat.so.3* but not this file,
1997             +# Debian/Ubuntu have libgdbm_compat.so but not this file,
1998             # so linking may fail
1999             -if (-e '/usr/lib/libgdbm_compat.so' or -e '/usr/lib64/libgdbm_compat.so') {
2000             - $self->{LIBS}->[0] .= ' -lgdbm_compat';
2001             +foreach (split / /, $Config{libpth}) {
2002             + $self->{LIBS}->[0] .= ' -lgdbm_compat' if -e $_.'/libgdbm_compat.so';
2003             }
2004             END
2005             }
2006              
2007             sub _patch_make_ext_pl
2008             {
2009 0     0     _patch(<<'END');
2010             --- make_ext.pl
2011             +++ make_ext.pl
2012             @@ -377,6 +377,10 @@ WriteMakefile(
2013             EOM
2014             close $fh or die "Can't close Makefile.PL: $!";
2015             }
2016             + eval {
2017             + my $ftime = time - 4;
2018             + utime $ftime, $ftime, 'Makefile.PL';
2019             + };
2020             print "\nRunning Makefile.PL in $ext_dir\n";
2021            
2022             # Presumably this can be simplified
2023             END
2024             }
2025              
2026             sub _patch_589_perlio_c
2027             {
2028 0     0     _patch(<<'END');
2029             --- perlio.c
2030             +++ perlio.c
2031             @@ -2323,6 +2323,12 @@ PerlIO_init(pTHX)
2032             {
2033             /* MUTEX_INIT(&PL_perlio_mutex) is done in PERL_SYS_INIT3(). */
2034             PERL_UNUSED_CONTEXT;
2035             + /*
2036             + * No, for backwards compatibility (before PERL_SYS_INIT3 changed to be
2037             + * defined as a separate function call), we need to call
2038             + * MUTEX_INIT(&PL_perlio_mutex) (via the PERLIO_INIT macro).
2039             + */
2040             + PERLIO_INIT;
2041             }
2042            
2043             void
2044             END
2045             }
2046              
2047             # http://perl5.git.perl.org/perl.git/commit/2674b61957c26a4924831d5110afa454ae7ae5a6
2048             sub _patch_hsplit_rehash_58
2049             {
2050 0     0     my $perl = shift;
2051              
2052 0           my $patch = <<'END';
2053             --- hv.c
2054             +++ hv.c
2055             @@ -31,7 +31,8 @@ holds the key and hash value.
2056             #define PERL_HASH_INTERNAL_ACCESS
2057             #include "perl.h"
2058            
2059             -#define HV_MAX_LENGTH_BEFORE_SPLIT 14
2060             +#define HV_MAX_LENGTH_BEFORE_REHASH 14
2061             +#define SHOULD_DO_HSPLIT(xhv) ((xhv)->xhv_keys > (xhv)->xhv_max) /* HvTOTALKEYS(hv) > HvMAX(hv) */
2062            
2063             STATIC void
2064             S_more_he(pTHX)
2065             @@ -705,23 +706,8 @@ Perl_hv_common(pTHX_ HV *hv, SV *keysv, const char *key, STRLEN klen,
2066             xhv->xhv_keys++; /* HvTOTALKEYS(hv)++ */
2067             if (!counter) { /* initial entry? */
2068             xhv->xhv_fill++; /* HvFILL(hv)++ */
2069             - } else if (xhv->xhv_keys > (IV)xhv->xhv_max) {
2070             + } else if ( SHOULD_DO_HSPLIT(xhv) ) {
2071             hsplit(hv);
2072             - } else if(!HvREHASH(hv)) {
2073             - U32 n_links = 1;
2074             -
2075             - while ((counter = HeNEXT(counter)))
2076             - n_links++;
2077             -
2078             - if (n_links > HV_MAX_LENGTH_BEFORE_SPLIT) {
2079             - /* Use only the old HvKEYS(hv) > HvMAX(hv) condition to limit
2080             - bucket splits on a rehashed hash, as we're not going to
2081             - split it again, and if someone is lucky (evil) enough to
2082             - get all the keys in one list they could exhaust our memory
2083             - as we repeatedly double the number of buckets on every
2084             - entry. Linear search feels a less worse thing to do. */
2085             - hsplit(hv);
2086             - }
2087             }
2088             }
2089            
2090             @@ -1048,7 +1034,7 @@ S_hsplit(pTHX_ HV *hv)
2091            
2092            
2093             /* Pick your policy for "hashing isn't working" here: */
2094             - if (longest_chain <= HV_MAX_LENGTH_BEFORE_SPLIT /* split worked? */
2095             + if (longest_chain <= HV_MAX_LENGTH_BEFORE_REHASH /* split worked? */
2096             || HvREHASH(hv)) {
2097             return;
2098             }
2099             @@ -1966,8 +1952,8 @@ S_share_hek_flags(pTHX_ const char *str, I32 len, register U32 hash, int flags)
2100             xhv->xhv_keys++; /* HvTOTALKEYS(hv)++ */
2101             if (!next) { /* initial entry? */
2102             xhv->xhv_fill++; /* HvFILL(hv)++ */
2103             - } else if (xhv->xhv_keys > (IV)xhv->xhv_max /* HvKEYS(hv) > HvMAX(hv) */) {
2104             - hsplit(PL_strtab);
2105             + } else if ( SHOULD_DO_HSPLIT(xhv) ) {
2106             + hsplit(PL_strtab);
2107             }
2108             }
2109            
2110             --- t/op/hash.t
2111             +++ t/op/hash.t
2112             @@ -39,22 +39,36 @@ use constant THRESHOLD => 14;
2113             use constant START => "a";
2114            
2115             # some initial hash data
2116             -my %h2 = map {$_ => 1} 'a'..'cc';
2117             +my %h2;
2118             +my $counter= "a";
2119             +$h2{$counter++}++ while $counter ne 'cd';
2120            
2121             ok (!Internals::HvREHASH(%h2),
2122             "starting with pre-populated non-pathological hash (rehash flag if off)");
2123            
2124             my @keys = get_keys(\%h2);
2125             +my $buckets= buckets(\%h2);
2126             $h2{$_}++ for @keys;
2127             +$h2{$counter++}++ while buckets(\%h2) == $buckets; # force a split
2128             ok (Internals::HvREHASH(%h2),
2129             - scalar(@keys) . " colliding into the same bucket keys are triggering rehash");
2130             + scalar(@keys) . " colliding into the same bucket keys are triggering rehash after split");
2131             +
2132             +# returns the number of buckets in a hash
2133             +sub buckets {
2134             + my $hr = shift;
2135             + my $keys_buckets= scalar(%$hr);
2136             + if ($keys_buckets=~m!/([0-9]+)\z!) {
2137             + return 0+$1;
2138             + } else {
2139             + return 8;
2140             + }
2141             +}
2142            
2143             sub get_keys {
2144             my $hr = shift;
2145            
2146             # the minimum of bits required to mount the attack on a hash
2147             my $min_bits = log(THRESHOLD)/log(2);
2148             -
2149             # if the hash has already been populated with a significant amount
2150             # of entries the number of mask bits can be higher
2151             my $keys = scalar keys %$hr;
2152             --
2153             1.7.4.1
2154              
2155             END
2156              
2157 0 0         if ($perl =~ qr/^5\.8\.8$/) {
2158 0           $patch =~ s/non-pathological/non-pathalogical/;
2159 0           $patch =~ s/triggering/triggerring/;
2160             }
2161 0           _patch($patch);
2162             }
2163              
2164             # http://perl5.git.perl.org/perl.git/commit/f14269908e5f8b4cab4b55643d7dd9de577e7918
2165             # http://perl5.git.perl.org/perl.git/commit/9d83adcdf9ab3c1ac7d54d76f3944e57278f0e70
2166             sub _patch_hsplit_rehash_510 {
2167 0     0     _patch(<<'END');
2168             --- ext/Hash-Util-FieldHash/t/10_hash.t
2169             +++ ext/Hash-Util-FieldHash/t/10_hash.t
2170             @@ -46,15 +46,29 @@ use constant START => "a";
2171            
2172             # some initial hash data
2173             fieldhash my %h2;
2174             -%h2 = map {$_ => 1} 'a'..'cc';
2175             +my $counter= "a";
2176             +$h2{$counter++}++ while $counter ne 'cd';
2177            
2178             ok (!Internals::HvREHASH(%h2),
2179             "starting with pre-populated non-pathological hash (rehash flag if off)");
2180            
2181             my @keys = get_keys(\%h2);
2182             +my $buckets= buckets(\%h2);
2183             $h2{$_}++ for @keys;
2184             +$h2{$counter++}++ while buckets(\%h2) == $buckets; # force a split
2185             ok (Internals::HvREHASH(%h2),
2186             - scalar(@keys) . " colliding into the same bucket keys are triggering rehash");
2187             + scalar(@keys) . " colliding into the same bucket keys are triggering rehash after split");
2188             +
2189             +# returns the number of buckets in a hash
2190             +sub buckets {
2191             + my $hr = shift;
2192             + my $keys_buckets= scalar(%$hr);
2193             + if ($keys_buckets=~m!/([0-9]+)\z!) {
2194             + return 0+$1;
2195             + } else {
2196             + return 8;
2197             + }
2198             +}
2199            
2200             sub get_keys {
2201             my $hr = shift;
2202             --- hv.c
2203             +++ hv.c
2204             @@ -35,7 +35,8 @@ holds the key and hash value.
2205             #define PERL_HASH_INTERNAL_ACCESS
2206             #include "perl.h"
2207            
2208             -#define HV_MAX_LENGTH_BEFORE_SPLIT 14
2209             +#define HV_MAX_LENGTH_BEFORE_REHASH 14
2210             +#define SHOULD_DO_HSPLIT(xhv) ((xhv)->xhv_keys > (xhv)->xhv_max) /* HvTOTALKEYS(hv) > HvMAX(hv) */
2211            
2212             static const char S_strtab_error[]
2213             = "Cannot modify shared string table in hv_%s";
2214             @@ -818,23 +819,8 @@ Perl_hv_common(pTHX_ HV *hv, SV *keysv, const char *key, STRLEN klen,
2215             xhv->xhv_keys++; /* HvTOTALKEYS(hv)++ */
2216             if (!counter) { /* initial entry? */
2217             xhv->xhv_fill++; /* HvFILL(hv)++ */
2218             - } else if (xhv->xhv_keys > (IV)xhv->xhv_max) {
2219             + } else if ( SHOULD_DO_HSPLIT(xhv) ) {
2220             hsplit(hv);
2221             - } else if(!HvREHASH(hv)) {
2222             - U32 n_links = 1;
2223             -
2224             - while ((counter = HeNEXT(counter)))
2225             - n_links++;
2226             -
2227             - if (n_links > HV_MAX_LENGTH_BEFORE_SPLIT) {
2228             - /* Use only the old HvKEYS(hv) > HvMAX(hv) condition to limit
2229             - bucket splits on a rehashed hash, as we're not going to
2230             - split it again, and if someone is lucky (evil) enough to
2231             - get all the keys in one list they could exhaust our memory
2232             - as we repeatedly double the number of buckets on every
2233             - entry. Linear search feels a less worse thing to do. */
2234             - hsplit(hv);
2235             - }
2236             }
2237             }
2238            
2239             @@ -1180,7 +1166,7 @@ S_hsplit(pTHX_ HV *hv)
2240            
2241            
2242             /* Pick your policy for "hashing isn't working" here: */
2243             - if (longest_chain <= HV_MAX_LENGTH_BEFORE_SPLIT /* split worked? */
2244             + if (longest_chain <= HV_MAX_LENGTH_BEFORE_REHASH /* split worked? */
2245             || HvREHASH(hv)) {
2246             return;
2247             }
2248             @@ -2506,8 +2492,8 @@ S_share_hek_flags(pTHX_ const char *str, I32 len, register U32 hash, int flags)
2249             xhv->xhv_keys++; /* HvTOTALKEYS(hv)++ */
2250             if (!next) { /* initial entry? */
2251             xhv->xhv_fill++; /* HvFILL(hv)++ */
2252             - } else if (xhv->xhv_keys > (IV)xhv->xhv_max /* HvKEYS(hv) > HvMAX(hv) */) {
2253             - hsplit(PL_strtab);
2254             + } else if ( SHOULD_DO_HSPLIT(xhv) ) {
2255             + hsplit(PL_strtab);
2256             }
2257             }
2258            
2259             diff --git a/t/op/hash.t b/t/op/hash.t
2260             index 9bde518..45eb782 100644
2261             --- t/op/hash.t
2262             +++ t/op/hash.t
2263             @@ -39,22 +39,36 @@ use constant THRESHOLD => 14;
2264             use constant START => "a";
2265            
2266             # some initial hash data
2267             -my %h2 = map {$_ => 1} 'a'..'cc';
2268             +my %h2;
2269             +my $counter= "a";
2270             +$h2{$counter++}++ while $counter ne 'cd';
2271            
2272             ok (!Internals::HvREHASH(%h2),
2273             "starting with pre-populated non-pathological hash (rehash flag if off)");
2274            
2275             my @keys = get_keys(\%h2);
2276             +my $buckets= buckets(\%h2);
2277             $h2{$_}++ for @keys;
2278             +$h2{$counter++}++ while buckets(\%h2) == $buckets; # force a split
2279             ok (Internals::HvREHASH(%h2),
2280             - scalar(@keys) . " colliding into the same bucket keys are triggering rehash");
2281             + scalar(@keys) . " colliding into the same bucket keys are triggering rehash after split");
2282             +
2283             +# returns the number of buckets in a hash
2284             +sub buckets {
2285             + my $hr = shift;
2286             + my $keys_buckets= scalar(%$hr);
2287             + if ($keys_buckets=~m!/([0-9]+)\z!) {
2288             + return 0+$1;
2289             + } else {
2290             + return 8;
2291             + }
2292             +}
2293            
2294             sub get_keys {
2295             my $hr = shift;
2296            
2297             # the minimum of bits required to mount the attack on a hash
2298             my $min_bits = log(THRESHOLD)/log(2);
2299             -
2300             # if the hash has already been populated with a significant amount
2301             # of entries the number of mask bits can be higher
2302             my $keys = scalar keys %$hr;
2303             --
2304             1.7.4.1
2305              
2306              
2307             END
2308             }
2309              
2310             sub _patch_bitrig {
2311 0 0   0     return unless $^O eq 'bitrig';
2312 0           my $perlver = shift;
2313 0           my $num = _norm_ver( $perlver );
2314 0 0         return unless $num < 5.019004;
2315 0 0         unless ( $num < 5.00800 ) {
2316 0           _patch(<<'BOOGLE');
2317             diff --git a/Configure b/Configure
2318             index 19bed50..e4e4075 100755
2319             --- Configure
2320             +++ Configure
2321             @@ -3312,6 +3312,9 @@ EOM
2322             ;;
2323             next*) osname=next ;;
2324             nonstop-ux) osname=nonstopux ;;
2325             + bitrig) osname=bitrig
2326             + osvers="$3"
2327             + ;;
2328             openbsd) osname=openbsd
2329             osvers="$3"
2330             ;;
2331             BOOGLE
2332             }
2333 0 0         if ( $num < 5.008009 ) {
2334 0           _patch(<<'BITRIGM1');
2335             diff --git a/Makefile.SH b/Makefile.SH
2336             index 17298fa..ecaa8ac 100755
2337             --- Makefile.SH
2338             +++ Makefile.SH
2339             @@ -77,7 +77,7 @@ true)
2340             sunos*)
2341             linklibperl="-lperl"
2342             ;;
2343             - netbsd*|freebsd[234]*|openbsd*)
2344             + netbsd*|freebsd[234]*|openbsd*|bitrig*)
2345             linklibperl="-L. -lperl"
2346             ;;
2347             interix*)
2348             BITRIGM1
2349             }
2350             else {
2351 0           _patch(<<'BITRIGMX');
2352             diff --git a/Makefile.SH b/Makefile.SH
2353             index 17298fa..ecaa8ac 100755
2354             --- Makefile.SH
2355             +++ Makefile.SH
2356             @@ -77,7 +77,7 @@ true)
2357             sunos*)
2358             linklibperl="-lperl"
2359             ;;
2360             - netbsd*|freebsd[234]*|openbsd*|dragonfly*)
2361             + netbsd*|freebsd[234]*|openbsd*|dragonfly*|bitrig*)
2362             linklibperl="-L. -lperl"
2363             ;;
2364             interix*)
2365             BITRIGMX
2366             }
2367 0 0         if ( $num < 5.008001 ) {
    0          
    0          
    0          
2368             # NOOP
2369             }
2370             elsif ( $num < 5.008007 ) {
2371 0           _patch(<<'BITRIGC3');
2372             diff --git a/Configure b/Configure
2373             index 19bed50..e4e4075 100755
2374             --- Configure Thu Aug 22 23:20:14 2013
2375             +++ Configure Thu Aug 22 23:20:35 2013
2376             @@ -7855,7 +7855,7 @@
2377             solaris)
2378             xxx="-R $shrpdir"
2379             ;;
2380             - freebsd|netbsd|openbsd)
2381             + freebsd|netbsd|openbsd|bitrig)
2382             xxx="-Wl,-R$shrpdir"
2383             ;;
2384             bsdos|linux|irix*|dec_osf)
2385             BITRIGC3
2386             }
2387             elsif ( $num < 5.008009 ) {
2388 0           _patch(<<'BITRIGC2');
2389             diff --git a/Configure b/Configure
2390             index 19bed50..e4e4075 100755
2391             --- Configure Thu Aug 22 22:56:04 2013
2392             +++ Configure Thu Aug 22 22:56:25 2013
2393             @@ -7892,7 +7892,7 @@
2394             solaris)
2395             xxx="-R $shrpdir"
2396             ;;
2397             - freebsd|netbsd|openbsd|interix)
2398             + freebsd|netbsd|openbsd|interix|bitrig)
2399             xxx="-Wl,-R$shrpdir"
2400             ;;
2401             bsdos|linux|irix*|dec_osf|gnu*)
2402             BITRIGC2
2403             }
2404             elsif ( $num < 5.013000 ) {
2405 0           _patch(<<'BITRIGC1');
2406             diff --git a/Configure b/Configure
2407             index 19bed50..e4e4075 100755
2408             --- Configure
2409             +++ Configure
2410             @@ -8328,7 +8331,7 @@ if "$useshrplib"; then
2411             solaris)
2412             xxx="-R $shrpdir"
2413             ;;
2414             - freebsd|netbsd|openbsd|interix|dragonfly)
2415             + freebsd|netbsd|openbsd|interix|dragonfly|bitrig)
2416             xxx="-Wl,-R$shrpdir"
2417             ;;
2418             bsdos|linux|irix*|dec_osf|gnu*)
2419             BITRIGC1
2420             }
2421             else {
2422 0           _patch(<<'BITRIGCX');
2423             diff --git a/Configure b/Configure
2424             index 19bed50..e4e4075 100755
2425             --- Configure
2426             +++ Configure
2427             @@ -8328,7 +8331,7 @@ if "$useshrplib"; then
2428             solaris)
2429             xxx="-R $shrpdir"
2430             ;;
2431             - freebsd|mirbsd|netbsd|openbsd|interix|dragonfly)
2432             + freebsd|mirbsd|netbsd|openbsd|interix|dragonfly|bitrig)
2433             xxx="-Wl,-R$shrpdir"
2434             ;;
2435             bsdos|linux|irix*|dec_osf|gnu*)
2436             BITRIGCX
2437             }
2438             }
2439              
2440             sub _patch_conf_solaris {
2441 0 0   0     return unless $^O eq 'solaris';
2442 0           my $perlver = shift;
2443 0           my $num = _norm_ver( $perlver );
2444 0 0         return unless $num < 5.018000;
2445 0           _patch(<<'BUBBLE');
2446             diff --git a/Configure b/Configure
2447             index ff511d3..30ab78a 100755
2448             --- Configure
2449             +++ Configure
2450             @@ -8048,7 +8048,20 @@ EOM
2451             ;;
2452             linux|irix*|gnu*) dflt="-shared $optimize" ;;
2453             next) dflt='none' ;;
2454             - solaris) dflt='-G' ;;
2455             + solaris) # See [perl #66604]. On Solaris 11, gcc -m64 on amd64
2456             + # appears not to understand -G. gcc versions at
2457             + # least as old as 3.4.3 support -shared, so just
2458             + # use that with Solaris 11 and later, but keep
2459             + # the old behavior for older Solaris versions.
2460             + case "$gccversion" in
2461             + '') dflt='-G' ;;
2462             + *) case "$osvers" in
2463             + 2.?|2.10) dflt='-G' ;;
2464             + *) dflt='-shared' ;;
2465             + esac
2466             + ;;
2467             + esac
2468             + ;;
2469             sunos) dflt='-assert nodefinitions' ;;
2470             svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
2471             *) dflt='none' ;;
2472             BUBBLE
2473             }
2474              
2475             #commit 4149c7198d9b78d861df289cce40dd865cab57e7
2476             sub _patch_regmatch_pointer_5180 {
2477 0     0     _patch(<<'BOBBLE');
2478             diff --git a/regexec.c b/regexec.c
2479             index bc38839..b865b46 100644
2480             --- regexec.c
2481             +++ regexec.c
2482             @@ -6662,7 +6662,7 @@ S_regrepeat(pTHX_ regexp *prog, char **startposp, const regnode *p,
2483             scan = *startposp;
2484             if (max == REG_INFTY)
2485             max = I32_MAX;
2486             - else if (! utf8_target && scan + max < loceol)
2487             + else if (! utf8_target && loceol - scan > max)
2488             loceol = scan + max;
2489            
2490             /* Here, for the case of a non-UTF-8 target we have adjusted down
2491             @@ -6711,7 +6711,7 @@ S_regrepeat(pTHX_ regexp *prog, char **startposp, const regnode *p,
2492             scan = loceol;
2493             break;
2494             case CANY: /* Move forward bytes, unless goes off end */
2495             - if (utf8_target && scan + max < loceol) {
2496             + if (utf8_target && loceol - scan > max) {
2497            
2498             /* hadn't been adjusted in the UTF-8 case */
2499             scan += max;
2500             @@ -6730,7 +6730,7 @@ S_regrepeat(pTHX_ regexp *prog, char **startposp, const regnode *p,
2501             * can use UTF8_IS_INVARIANT() even if the pattern isn't UTF-8, as it's
2502             * true iff it doesn't matter if the argument is in UTF-8 or not */
2503             if (UTF8_IS_INVARIANT(c) || (! utf8_target && ! is_utf8_pat)) {
2504             - if (utf8_target && scan + max < loceol) {
2505             + if (utf8_target && loceol - scan > max) {
2506             /* We didn't adjust because is UTF-8, but ok to do so,
2507             * since here, to match at all, 1 char == 1 byte */
2508             loceol = scan + max;
2509             @@ -6910,7 +6910,7 @@ S_regrepeat(pTHX_ regexp *prog, char **startposp, const regnode *p,
2510             /* FALLTHROUGH */
2511            
2512             case POSIXA:
2513             - if (utf8_target && scan + max < loceol) {
2514             + if (utf8_target && loceol - scan > max) {
2515            
2516             /* We didn't adjust at the beginning of this routine
2517             * because is UTF-8, but it is actually ok to do so, since here, to
2518             diff --git a/t/re/pat_rt_report.t b/t/re/pat_rt_report.t
2519             index 2244fdf..9a9b5f5 100644
2520             --- t/re/pat_rt_report.t
2521             +++ t/re/pat_rt_report.t
2522             @@ -22,7 +22,7 @@ BEGIN {
2523             }
2524            
2525            
2526             -plan tests => 2530; # Update this when adding/deleting tests.
2527             +plan tests => 2532; # Update this when adding/deleting tests.
2528            
2529             run_tests() unless caller;
2530            
2531             @@ -1158,6 +1158,21 @@ EOP
2532             '$_ = "abc"; /b/g; $_ = "hello"; print eval q|$\'|,"\n"',
2533             "c\n", {}, '$\' first mentioned after match');
2534             }
2535             +
2536             + {
2537             + # [perl #118175] threaded perl-5.18.0 fails pat_rt_report_thr.t
2538             + # this tests some related failures
2539             + #
2540             + # The tests in the block *only* fail when run on 32-bit systems
2541             + # with a malloc that allocates above the 2GB line. On the system
2542             + # in the report above that only happened in a thread.
2543             + my $s = "\x{1ff}" . "f" x 32;
2544             + ok($s =~ /\x{1ff}[[:alpha:]]+/gca, "POSIXA pointer wrap");
2545             +
2546             + # this one segfaulted under the conditions above
2547             + # of course, CANY is evil, maybe it should crash
2548             + ok($s =~ /.\C+/, "CANY pointer wrap");
2549             + }
2550             } # End of sub run_tests
2551            
2552             1;
2553             BOBBLE
2554             }
2555              
2556             sub _patch_makefile_sh_phony {
2557 0     0     _patch(<<'END');
2558             diff --git a/Makefile.SH b/Makefile.SH
2559             index ac5ade4..8e66603 100755
2560             --- Makefile.SH
2561             +++ Makefile.SH
2562             @@ -295,6 +295,30 @@ obj = $(obj1) $(obj2) $(obj3) $(ARCHOBJS)
2563             # EMBEDDING is on by default, and MULTIPLICITY doesn't work.
2564             #
2565              
2566             +.PHONY: all compile translators utilities \
2567             + FORCE \
2568             + preplibrary \
2569             + install install-strip install-all install-verbose install-silent \
2570             + no-install install.perl install.man installman install.html installhtml \
2571             + check_byacc run_byacc \
2572             + regen_headers regen_pods regen_all \
2573             + clean _tidy _mopup _cleaner1 _cleaner2 \
2574             + realclean _realcleaner clobber _clobber \
2575             + distclean veryclean _verycleaner \
2576             + lint \
2577             + depend \
2578             + test check test_prep _test_prep \
2579             + test_tty test-tty _test_tty test_notty test-notty _test_notty \
2580             + utest ucheck test.utf8 check.utf8 \
2581             + test.third check.third utest.third ucheck.third test_notty.third \
2582             + test.deparse test_notty.deparse \
2583             + minitest \
2584             + ok okfile oknack okfilenack nok nokfile noknack nokfilenack \
2585             + clist hlist shlist pllist \
2586             + distcheck \
2587             + elc \
2588             + etags ctags tags
2589             +
2590             lintflags = -hbvxac
2591              
2592             .c$(OBJ_EXT):
2593             END
2594             }
2595              
2596             sub _patch_cow_speed {
2597 0     0     _patch(<<'COWSAY');
2598             diff --git a/sv.c b/sv.c
2599             index 06c0b83..ac1d972 100644
2600             --- sv.c
2601             +++ sv.c
2602             @@ -1574,14 +1574,19 @@ Perl_sv_grow(pTHX_ SV *const sv, STRLEN newlen)
2603             newlen++;
2604             #endif
2605            
2606             +#if defined(PERL_USE_MALLOC_SIZE) && defined(Perl_safesysmalloc_size)
2607             +#define PERL_UNWARANTED_CHUMMINESS_WITH_MALLOC
2608             +#endif
2609             +
2610             if (newlen > SvLEN(sv)) { /* need more room? */
2611             STRLEN minlen = SvCUR(sv);
2612             minlen += (minlen >> PERL_STRLEN_EXPAND_SHIFT) + 10;
2613             if (newlen < minlen)
2614             newlen = minlen;
2615             -#ifndef Perl_safesysmalloc_size
2616             - if (SvLEN(sv))
2617             +#ifndef PERL_UNWARANTED_CHUMMINESS_WITH_MALLOC
2618             + if (SvLEN(sv)) {
2619             newlen = PERL_STRLEN_ROUNDUP(newlen);
2620             + }
2621             #endif
2622             if (SvLEN(sv) && s) {
2623             s = (char*)saferealloc(s, newlen);
2624             @@ -1593,7 +1598,7 @@ Perl_sv_grow(pTHX_ SV *const sv, STRLEN newlen)
2625             }
2626             }
2627             SvPV_set(sv, s);
2628             -#ifdef Perl_safesysmalloc_size
2629             +#ifdef PERL_UNWARANTED_CHUMMINESS_WITH_MALLOC
2630             /* Do this here, do it once, do it right, and then we will never get
2631             called back into sv_grow() unless there really is some growing
2632             needed. */
2633             COWSAY
2634             }
2635              
2636             sub _patch_preprocess_options {
2637 0     0     my $perl = shift;
2638              
2639 0 0         if ($perl =~ /^5\.(?:8|10)\./) {
    0          
2640 0           _patch(<<'END');
2641             diff --git a/perl.c b/perl.c
2642             index 82e5538..b9e02fe 100644
2643             --- perl.c
2644             +++ perl.c
2645             @@ -3758,7 +3758,7 @@ S_open_script(pTHX_ const char *scriptname, bool dosearch, SV *sv,
2646             # ifdef VMS
2647             cpp_discard_flag = "";
2648             # else
2649             - cpp_discard_flag = "-C";
2650             + cpp_discard_flag = "-C -ffreestanding";
2651             # endif
2652            
2653             # ifdef OS2
2654             END
2655             } elsif ($perl =~ /^5\.6\./) {
2656 0           _patch(<<'END');
2657             diff --git a/perl.c b/perl.c
2658             index 623f9be..014d318 100644
2659             --- perl.c
2660             +++ perl.c
2661             @@ -2631,7 +2631,7 @@ sed %s -e \"/^[^#]/b\" \
2662             -e '/^#[ ]*undef[ ]/b' \
2663             -e '/^#[ ]*endif/b' \
2664             -e 's/^[ ]*#.*//' \
2665             - %s | %"SVf" -C %"SVf" %s",
2666             + %s | %"SVf" -C -ffreestanding %"SVf" %s",
2667             # endif
2668             #ifdef LOC_SED
2669             LOC_SED,
2670             END
2671             }
2672             }
2673              
2674             sub _patch_5183_metajson {
2675 0     0     _patch(<<'DOGSAY');
2676             diff --git a/META.json b/META.json
2677             index 64caea7..200e324 100644
2678             --- META.json
2679             +++ META.json
2680             @@ -118,7 +118,7 @@
2681             "TestInit.pm"
2682             ]
2683             },
2684             - "release_status" : "testing",
2685             + "release_status" : "stable",
2686             "resources" : {
2687             "bugtracker" : {
2688             "web" : "http://rt.perl.org/perlbug/"
2689             DOGSAY
2690             }
2691              
2692             sub _patch_handy {
2693 0     0     _patch(<<'END');
2694             --- handy.h
2695             +++ handy.h
2696             @@ -43,12 +43,10 @@
2697             this file first, then you will have to manually set -DHAS_BOOL in
2698             your command line to avoid a conflict.
2699             */
2700             -#ifdef _G_HAVE_BOOL
2701             -# if _G_HAVE_BOOL
2702             +#ifdef __GNUG__
2703             # ifndef HAS_BOOL
2704             # define HAS_BOOL 1
2705             # endif
2706             -# endif
2707             #endif
2708            
2709             /* The NeXT dynamic loader headers will not build with the bool macro
2710             END
2711             }
2712              
2713             sub _replace_makedepend {
2714             # Replace makedepend with blead's version
2715 0     0     _write_or_die('makedepend.SH', <<'END');
2716             #! /bin/sh
2717             case $PERL_CONFIG_SH in
2718             '')
2719             if test -f config.sh; then TOP=.;
2720             elif test -f ../config.sh; then TOP=..;
2721             elif test -f ../../config.sh; then TOP=../..;
2722             elif test -f ../../../config.sh; then TOP=../../..;
2723             elif test -f ../../../../config.sh; then TOP=../../../..;
2724             else
2725             echo "Can't find config.sh."; exit 1
2726             fi
2727             . $TOP/config.sh
2728             ;;
2729             esac
2730             : This forces SH files to create target in same directory as SH file.
2731             : This is so that make depend always knows where to find SH derivatives.
2732             case "$0" in
2733             */*) cd `expr X$0 : 'X\(.*\)/'` ;;
2734             esac
2735              
2736             echo "Extracting makedepend (with variable substitutions)"
2737             rm -f makedepend
2738             $spitshell >makedepend <
2739             $startsh
2740             # makedepend.SH
2741             #
2742             MAKE=$make
2743             trnl='$trnl'
2744             !GROK!THIS!
2745             $spitshell >>makedepend <<'!NO!SUBS!'
2746              
2747             if test -d .depending; then
2748             echo "$0: Already running, exiting."
2749             exit 0
2750             fi
2751              
2752             mkdir .depending
2753              
2754             # This script should be called with
2755             # sh ./makedepend MAKE=$(MAKE)
2756             case "$1" in
2757             MAKE=*) eval $1; shift ;;
2758             esac
2759              
2760             export PATH || (echo "OOPS, this isn't sh. Desperation time. I will feed myself to sh."; sh \$0; kill \$\$)
2761              
2762             case $PERL_CONFIG_SH in
2763             '')
2764             if test -f config.sh; then TOP=.;
2765             elif test -f ../config.sh; then TOP=..;
2766             elif test -f ../../config.sh; then TOP=../..;
2767             elif test -f ../../../config.sh; then TOP=../../..;
2768             elif test -f ../../../../config.sh; then TOP=../../../..;
2769             else
2770             echo "Can't find config.sh."; exit 1
2771             fi
2772             . $TOP/config.sh
2773             ;;
2774             esac
2775              
2776             # Avoid localized gcc messages
2777             case "$ccname" in
2778             gcc) LC_ALL=C ; export LC_ALL ;;
2779             esac
2780              
2781             # We need .. when we are in the x2p directory if we are using the
2782             # cppstdin wrapper script.
2783             # Put .. and . first so that we pick up the present cppstdin, not
2784             # an older one lying about in /usr/local/bin.
2785             PATH=".$path_sep..$path_sep$PATH"
2786             export PATH
2787              
2788             case "$osname" in
2789             amigaos) cat=/bin/cat ;; # must be absolute
2790             esac
2791              
2792             $cat /dev/null >.deptmp
2793             $rm -f *.c.c c/*.c.c
2794             if test -f Makefile; then
2795             rm -f $firstmakefile
2796             cp Makefile $firstmakefile
2797             # On QNX, 'cp' preserves timestamp, so $firstmakefile appears
2798             # to be out of date. I don't know if OS/2 has touch, so do this:
2799             case "$osname" in
2800             os2) ;;
2801             *) $touch $firstmakefile ;;
2802             esac
2803             fi
2804             mf=$firstmakefile
2805             if test -f $mf; then
2806             defrule=`<$mf sed -n \
2807             -e '/^\.c\$(OBJ_EXT):.*;/{' \
2808             -e 's/\$\*\.c//' \
2809             -e 's/^[^;]*;[ ]*//p' \
2810             -e q \
2811             -e '}' \
2812             -e '/^\.c\$(OBJ_EXT): *$/{' \
2813             -e N \
2814             -e 's/\$\*\.c//' \
2815             -e 's/^.*\n[ ]*//p' \
2816             -e q \
2817             -e '}'`
2818             fi
2819             case "$defrule" in
2820             '') defrule='$(CC) -c $(CFLAGS)' ;;
2821             esac
2822              
2823             : Create files in UU directory to avoid problems with long filenames
2824             : on systems with 14 character filename limits so file.c.c and file.c
2825             : might be identical
2826             $test -d UU || mkdir UU
2827              
2828             $MAKE clist || ($echo "Searching for .c files..."; \
2829             $echo *.c | $tr ' ' $trnl | $egrep -v '\*' >.clist)
2830             for file in `$cat .clist`; do
2831             # for file in `cat /dev/null`; do
2832             case "$osname" in
2833             uwin) uwinfix="-e s,\\\\\\\\,/,g -e s,\\([a-zA-Z]\\):/,/\\1/,g" ;;
2834             os2) uwinfix="-e s,\\\\\\\\,/,g" ;;
2835             cygwin) uwinfix="-e s,\\\\\\\\,/,g" ;;
2836             posix-bc) uwinfix="-e s/\\*POSIX(\\(.*\\))/\\1/" ;;
2837             vos) uwinfix="-e s/\#/\\\#/" ;;
2838             *) uwinfix="" ;;
2839             esac
2840             case "$file" in
2841             *.c) filebase=`basename $file .c` ;;
2842             *.y) filebase=`basename $file .y` ;;
2843             esac
2844             case "$file" in
2845             */*) finc="-I`echo $file | sed 's#/[^/]*$##'`" ;;
2846             *) finc= ;;
2847             esac
2848             $echo "Finding dependencies for $filebase$_o."
2849             # Below, we strip out all but preprocessor directives.
2850             # We have to take care of situations like
2851             # #if defined(FOO) BAR /* comment line 1
2852             # more comment lines */
2853             # If we just delete text starting from the '/*' to the end of line, we will
2854             # screw up cases like
2855             # #if defined(FOO) /* comment */ \
2856             # && defined(BAR) /* comment */ \
2857             # && defined(BAZ) /* comment */ \
2858             # etc.
2859             # Also, in lines like
2860             # #defined FOO(a,b) a/**/b
2861             # the comment may be important and so needs to be retained.
2862             # This code processes the single-line comments first; it assumes there is
2863             # at most one straightforward comment per continued preprocessor line,
2864             # replacing each non-empty comment (and its surrounding white space) by a
2865             # single space. (sed only has a greedy '*' quantifier, so this doesn't
2866             # work right if there are multiple comments per line, and strings can look
2867             # like comments to it; both are unlikely in a preprocessor statement.) Any
2868             # continuation line is joined, and the process repeated on the enlarged
2869             # line as long as there are continuations. At the end, if there are any
2870             # comments remaining, they are either completely empty or are like the
2871             # first situation. The latter are just deleted by first deleting to the
2872             # end of line (including preceding white space) things that start with '/*'
2873             # and the next char isn't a '*'; then things that start with '/**', but the
2874             # next char isn't a '/'. (Subsequent lines of the comment are irrelevant
2875             # and get dropped.) At the end, we unjoin very long lines to avoid
2876             # preprocessor limitations
2877             ( $echo "#line 2 \"$file\""; \
2878             $sed -n <$file \
2879             -e "/^${filebase}_init(/q" \
2880             -e ': testcont' \
2881             -e '/^[ ]*#/s|[ ]*/\*..*\*/[ ]*| |' \
2882             -e '/\\$/{' \
2883             -e 'N' \
2884             -e 'b testcont' \
2885             -e '}' \
2886             -e 's/\\\n//g' \
2887             -e '/^#line/d' \
2888             -e '/^[ ]*#/{' \
2889             -e 's|[ ]*/\*[^*].*$||' \
2890             -e 's|[ ]*/\*\*[^/].*$||' \
2891             -e 's/.\{255\}/&\\\n/g' \
2892             -e p \
2893             -e '}' ) >UU/$file.c
2894              
2895             # We're not sure why this was there; the #endif is extraneous on modern z/OS
2896             #if [ "$osname" = os390 -a "$file" = perly.c ]; then
2897             # $echo '#endif' >>UU/$file.c
2898             #fi
2899              
2900             if [ "$osname" = os390 ]; then
2901             $cppstdin $finc -I. $cppflags $cppminus
2902             $sed \
2903             -e '/^#.*/d' \
2904             -e '/^#.*"-"/d' \
2905             -e '/^#.*git_version\.h/d' \
2906             -e 's#\.[0-9][0-9]*\.c#'"$file.c#" \
2907             -e 's/^[ ]*#[ ]*line/#/' \
2908             -e '/^# *[0-9][0-9]* *[".\/]/!d' \
2909             -e 's/^.*"\(.*\)".*$/'$filebase'\$(OBJ_EXT): \1/' \
2910             -e 's/^# *[0-9][0-9]* \(.*\)$/'$filebase'\$(OBJ_EXT): \1/' \
2911             -e 's|: \./|: |' \
2912             -e 's|\.c\.c|.c|' $uwinfix | \
2913             $uniq | $sort | $uniq >> .deptmp
2914             else
2915             $cppstdin $finc -I. $cppflags $cppminus .cout 2>.cerr
2916             $sed \
2917             -e '1d' \
2918             -e '/^#.*/d' \
2919             -e '/^#.*/d' \
2920             -e '/^#.*/d' \
2921             -e '/^#.*/d' \
2922             -e '/^#.*/d' \
2923             -e '/^#.*"-"/d' \
2924             -e '/^#.*"\/.*\/"/d' \
2925             -e '/: file path prefix .* never used$/d' \
2926             -e '/^#.*git_version\.h/d' \
2927             -e 's#\.[0-9][0-9]*\.c#'"$file.c#" \
2928             -e 's/^[ ]*#[ ]*line/#/' \
2929             -e '/^# *[0-9][0-9]* *[".\/]/!d' \
2930             -e 's/^.*"\(.*\)".*$/'$filebase'\$(OBJ_EXT): \1/' \
2931             -e 's/^# *[0-9][0-9]* \(.*\)$/'$filebase'\$(OBJ_EXT): \1/' \
2932             -e 's|: \./|: |' \
2933             -e 's|\.c\.c|.c|' $uwinfix .cout .cerr| \
2934             $uniq | $sort | $uniq >> .deptmp
2935             fi
2936             echo "$filebase\$(OBJ_EXT): $@" >> .deptmp
2937             done
2938              
2939             $sed <$mf >$mf.new -e '1,/^# AUTOMATICALLY/!d'
2940              
2941             if $test -s .deptmp; then
2942             $echo "Updating $mf..."
2943             $echo "# If this runs make out of memory, delete /usr/include lines." \
2944             >> $mf.new
2945             if [ "$osname" = vos ]; then
2946             $sed 's|\.incl\.c|.h|' .deptmp >.deptmp.vos
2947             mv -f .deptmp.vos .deptmp
2948             fi
2949             $sed 's|^\(.*\$(OBJ_EXT):\) *\(.*/.*\.c\) *$|\1 \2; '"$defrule \2|" .deptmp \
2950             >>$mf.new
2951             else
2952             $MAKE hlist || ($echo "Searching for .h files..."; \
2953             $echo *.h | $tr ' ' $trnl | $egrep -v '\*' >.hlist)
2954             $echo "You don't seem to have a proper C preprocessor. Using grep instead."
2955             $egrep '^#include ' `cat .clist` `cat .hlist` >.deptmp
2956             $echo "Updating $mf..."
2957             <.clist $sed -n \
2958             -e '/\//{' \
2959             -e 's|^\(.*\)/\(.*\)\.c|\2\$(OBJ_EXT): \1/\2.c; '"$defrule \1/\2.c|p" \
2960             -e d \
2961             -e '}' \
2962             -e 's|^\(.*\)\.c|\1\$(OBJ_EXT): \1.c|p' >> $mf.new
2963             <.hlist $sed -n 's|\(.*/\)\(.*\)|s= \2= \1\2=|p' >.hsed
2964             <.deptmp $sed -n 's|c:#include "\(.*\)".*$|o: \1|p' | \
2965             $sed 's|^[^;]*/||' | \
2966             $sed -f .hsed >> $mf.new
2967             <.deptmp $sed -n 's|h:#include "\(.*\)".*$|h: \1|p' | \
2968             $sed -f .hsed >> $mf.new
2969             fi
2970             $rm -f $mf.old
2971             $cp $mf $mf.old
2972             $rm -f $mf
2973             $cp $mf.new $mf
2974             $rm $mf.new
2975             $echo "# WARNING: Put nothing here or make depend will gobble it up!" >> $mf
2976             $rm -rf .deptmp UU .clist .hlist .hsed .cout .cerr
2977             rmdir .depending
2978              
2979             !NO!SUBS!
2980             $eunicefix makedepend
2981             chmod +x makedepend
2982             END
2983             }
2984              
2985             sub _patch_5_005_02 {
2986 0     0     _patch(<<'END');
2987             --- Configure
2988             +++ Configure
2989             @@ -21,7 +21,7 @@
2990             # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
2991             #
2992             # Generated on Tue Jul 7 10:10:21 EDT 1998 [metaconfig 3.0 PL70]
2993             -# (with additional metaconfig patches by doughera@lafayette.edu)
2994             +# (with additional metaconfig patches by jhi@iki.fi)
2995            
2996             cat >/tmp/c1$$ <
2997             ARGGGHHHH!!!!!
2998             @@ -56,33 +56,6 @@ case "$0" in
2999             ;;
3000             esac
3001            
3002             -: the newline for tr
3003             -if test X"$trnl" = X; then
3004             - case "`echo foo|tr '\n' x 2>/dev/null`" in
3005             - foox)
3006             - trnl='\n'
3007             - ;;
3008             - esac
3009             -fi
3010             -if test X"$trnl" = X; then
3011             - case "`echo foo|tr '\012' x 2>/dev/null`" in
3012             - foox)
3013             - trnl='\012'
3014             - ;;
3015             - esac
3016             -fi
3017             -if test -n "$DJGPP"; then
3018             - trnl='\012'
3019             -fi
3020             -if test X"$trnl" = X; then
3021             - cat <&2
3022             -
3023             -$me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
3024             -
3025             -EOM
3026             - exit 1
3027             -fi
3028             -
3029             : Proper separator for the PATH environment variable
3030             p_=:
3031             : On OS/2 this directory should exist if this is not floppy only system :-]
3032             @@ -391,7 +364,6 @@ d_getservprotos=''
3033             d_getsbyname=''
3034             d_getsbyport=''
3035             d_gnulibc=''
3036             -i_arpainet=''
3037             d_htonl=''
3038             d_inetaton=''
3039             d_isascii=''
3040             @@ -540,6 +512,7 @@ dlsrc=''
3041             ld=''
3042             lddlflags=''
3043             usedl=''
3044             +ebcdic=''
3045             doublesize=''
3046             fpostype=''
3047             gidtype=''
3048             @@ -548,6 +521,7 @@ h_fcntl=''
3049             h_sysfile=''
3050             db_hashtype=''
3051             db_prefixtype=''
3052             +i_arpainet=''
3053             i_db=''
3054             i_dbm=''
3055             i_rpcsvcdbm=''
3056             @@ -633,6 +607,7 @@ libpth=''
3057             loclibpth=''
3058             plibpth=''
3059             xlibpth=''
3060             +ignore_versioned_solibs=''
3061             libs=''
3062             lns=''
3063             lseektype=''
3064             @@ -697,11 +672,13 @@ randbits=''
3065             installscript=''
3066             scriptdir=''
3067             scriptdirexp=''
3068             +selectminbits=''
3069             selecttype=''
3070             sh=''
3071             sig_name=''
3072             sig_name_init=''
3073             sig_num=''
3074             +sig_num_init=''
3075             installsitearch=''
3076             sitearch=''
3077             sitearchexp=''
3078             @@ -719,6 +696,7 @@ startperl=''
3079             startsh=''
3080             stdchar=''
3081             sysman=''
3082             +trnl=''
3083             uidtype=''
3084             nm_opt=''
3085             nm_so_opt=''
3086             @@ -733,7 +711,6 @@ mips_type=''
3087             usrinc=''
3088             defvoidused=''
3089             voidflags=''
3090             -ebcdic=''
3091             CONFIG=''
3092            
3093             define='define'
3094             @@ -836,6 +813,8 @@ plibpth=''
3095            
3096             : default library list
3097             libswanted=''
3098             +: some systems want only to use the non-versioned libso:s
3099             +ignore_versioned_solibs=''
3100             : Possible local include directories to search.
3101             : Set locincpth to "" in a hint file to defeat local include searches.
3102             locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
3103             @@ -904,7 +883,7 @@ case "$sh" in
3104             $me: Fatal Error: I can't find a Bourne Shell anywhere.
3105            
3106             Usually it's in /bin/sh. How did you even get this far?
3107             -Please contact me (Andy Dougherty) at doughera@lafayette.edu and
3108             +Please contact me (Jarkko Hietaniemi) at jhi@iki.fi and
3109             we'll try to straighten this all out.
3110             EOM
3111             exit 1
3112             @@ -1240,7 +1219,7 @@ cat >extract <<'EOS'
3113             CONFIG=true
3114             echo "Doing variable substitutions on .SH files..."
3115             if test -f $src/MANIFEST; then
3116             - set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH'`
3117             + set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH$'`
3118             else
3119             echo "(Looking for .SH files under the source directory.)"
3120             set x `(cd $src; find . -name "*.SH" -print)`
3121             @@ -1373,7 +1352,7 @@ THIS PACKAGE SEEMS TO BE INCOMPLETE.
3122             You have the option of continuing the configuration process, despite the
3123             distinct possibility that your kit is damaged, by typing 'y'es. If you
3124             do, don't blame me if something goes wrong. I advise you to type 'n'o
3125             -and contact the author (doughera@lafayette.edu).
3126             +and contact the author (jhi@iki.fi).
3127            
3128             EOM
3129             echo $n "Continue? [n] $c" >&4
3130             @@ -1396,6 +1375,30 @@ else
3131             fi
3132             rm -f missing x??
3133            
3134             +echo " "
3135             +: Find the appropriate value for a newline for tr
3136             +if test -n "$DJGPP"; then
3137             + trnl='\012'
3138             +fi
3139             +if test X"$trnl" = X; then
3140             + case "`echo foo|tr '\n' x 2>/dev/null`" in
3141             + foox) trnl='\n' ;;
3142             + esac
3143             +fi
3144             +if test X"$trnl" = X; then
3145             + case "`echo foo|tr '\012' x 2>/dev/null`" in
3146             + foox) trnl='\012' ;;
3147             + esac
3148             +fi
3149             +if test X"$trnl" = X; then
3150             + cat <&2
3151             +
3152             +$me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
3153             +
3154             +EOM
3155             + exit 1
3156             +fi
3157             +
3158             : compute the number of columns on the terminal for proper question formatting
3159             case "$COLUMNS" in
3160             '') COLUMNS='80';;
3161             @@ -1574,7 +1577,7 @@ Much effort has been expended to ensure that this shell script will run on any
3162             Unix system. If despite that it blows up on yours, your best bet is to edit
3163             Configure and run it again. If you can't run Configure for some reason,
3164             you'll have to generate a config.sh file by hand. Whatever problems you
3165             -have, let me (doughera@lafayette.edu) know how I blew it.
3166             +have, let me (jhi@iki.fi) know how I blew it.
3167            
3168             This installation script affects things in two ways:
3169            
3170             @@ -1841,14 +1844,14 @@ ABYZ)
3171             *C9D1*|*c9d1*)
3172             echo "Hey, this might be EBCDIC." >&4
3173             if test "X$up" = X -o "X$low" = X; then
3174             - case "`echo IJ | tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3175             + case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3176             ij) up='[A-IJ-RS-Z]'
3177             low='[a-ij-rs-z]'
3178             ;;
3179             esac
3180             fi
3181             if test "X$up" = X -o "X$low" = X; then
3182             - case "`echo IJ | tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3183             + case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3184             ij) up='A-IJ-RS-Z'
3185             low='a-ij-rs-z'
3186             ;;
3187             @@ -1941,7 +1944,7 @@ EOM
3188             (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/ /g' >&4
3189             dflt=''
3190             : Half the following guesses are probably wrong... If you have better
3191             - : tests or hints, please send them to doughera@lafayette.edu
3192             + : tests or hints, please send them to jhi@iki.fi
3193             : The metaconfig authors would also appreciate a copy...
3194             $test -f /irix && osname=irix
3195             $test -f /xenix && osname=sco_xenix
3196             @@ -2025,7 +2028,7 @@ EOM
3197             osvers="$3"
3198             ;;
3199             dynixptx*) osname=dynixptx
3200             - osvers="$3"
3201             + osvers=`echo "$4" | $sed 's/^v//'`
3202             ;;
3203             freebsd) osname=freebsd
3204             osvers="$3" ;;
3205             @@ -3442,7 +3445,11 @@ cat <<'EOT' >testcpp.c
3206             ABC.XYZ
3207             EOT
3208             cd ..
3209             +if test ! -f cppstdin; then
3210             echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3211             +else
3212             + echo "Keeping your $hint cppstdin wrapper."
3213             +fi
3214             chmod 755 cppstdin
3215             wrapper=`pwd`/cppstdin
3216             ok='false'
3217             @@ -3693,7 +3700,8 @@ case "$libswanted" in
3218             esac
3219             for thislib in $libswanted; do
3220            
3221             - if xxx=`./loc lib$thislib.$so.[0-9]'*' X $libpth`; $test -f "$xxx"; then
3222             + if xxx=`./loc lib$thislib.$so.[0-9]'*' X $libpth`;
3223             + $test -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
3224             echo "Found -l$thislib (shared)."
3225             case " $dflt " in
3226             *"-l$thislib "*);;
3227             @@ -3980,10 +3988,21 @@ rmlist="$rmlist pdp11"
3228             : coherency check
3229             echo " "
3230             echo "Checking your choice of C compiler and flags for coherency..." >&4
3231             +$cat > try.c <<'EOF'
3232             +#include
3233             +main() { printf("Ok\n"); exit(0); }
3234             +EOF
3235             set X $cc $optimize $ccflags -o try $ldflags try.c $libs
3236             shift
3237             -$cat >try.msg <
3238             -I've tried to compile and run a simple program with:
3239             +$cat >try.msg <<'EOM'
3240             +I've tried to compile and run the following simple program:
3241             +
3242             +EOM
3243             +$cat try.c
3244             +
3245             +$cat >> try.msg <
3246             +
3247             +I used the command:
3248            
3249             $*
3250             ./try
3251             @@ -3991,10 +4010,6 @@ I've tried to compile and run a simple program with:
3252             and I got the following output:
3253            
3254             EOM
3255             -$cat > try.c <<'EOF'
3256             -#include
3257             -main() { printf("Ok\n"); exit(0); }
3258             -EOF
3259             dflt=y
3260             if sh -c "$cc $optimize $ccflags -o try $ldflags try.c $libs" >>try.msg 2>&1; then
3261             if sh -c './try' >>try.msg 2>&1; then
3262             @@ -4031,7 +4046,7 @@ y)
3263             $cat try.msg >&4
3264             case "$knowitall" in
3265             '')
3266             - echo "(The supplied flags might be incorrect with this C compiler.)"
3267             + echo "(The supplied flags or libraries might be incorrect.)"
3268             ;;
3269             *) dflt=n;;
3270             esac
3271             @@ -4149,9 +4164,8 @@ eval $inhdr
3272             : determine which malloc to compile in
3273             echo " "
3274             case "$usemymalloc" in
3275             -''|y*|true) dflt='y' ;;
3276             -n*|false) dflt='n' ;;
3277             -*) dflt="$usemymalloc" ;;
3278             +''|[yY]*|true|$define) dflt='y' ;;
3279             +*) dflt='n' ;;
3280             esac
3281             rp="Do you wish to attempt to use the malloc that comes with $package?"
3282             . ./myread
3283             @@ -4253,7 +4267,7 @@ understands function prototypes. Unfortunately, your C compiler
3284             $cc $ccflags
3285             doesn't seem to understand them. Sorry about that.
3286            
3287             -If GNU cc is avaiable for your system, perhaps you could try that instead.
3288             +If GNU cc is available for your system, perhaps you could try that instead.
3289            
3290             Eventually, we hope to support building Perl with pre-ANSI compilers.
3291             If you would like to help in that effort, please contact .
3292             @@ -4308,32 +4322,6 @@ shift;
3293             $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs;'
3294            
3295             echo " "
3296             -echo "Determining whether or not we are on an EBCDIC system..." >&4
3297             -cat >tebcdic.c <
3298             -int main()
3299             -{
3300             - if ('M'==0xd4) return 0;
3301             - return 1;
3302             -}
3303             -EOM
3304             -val=$undef
3305             -set tebcdic
3306             -if eval $compile_ok; then
3307             - if ./tebcdic; then
3308             - echo "You have EBCDIC." >&4
3309             - val="$define"
3310             - else
3311             - echo "Nope, no EBCDIC. Assuming ASCII or some ISO Latin." >&4
3312             - fi
3313             -else
3314             - echo "I'm unable to compile the test program." >&4
3315             - echo "I'll asuume ASCII or some ISO Latin." >&4
3316             -fi
3317             -$rm -f tebcdic.c tebcdic
3318             -set ebcdic
3319             -eval $setvar
3320             -
3321             -echo " "
3322             echo "Checking for GNU C Library..." >&4
3323             cat >gnulibc.c <
3324             #include
3325             @@ -5147,7 +5135,7 @@ case "$shrpdir" in
3326             *) $cat >&4 <
3327             WARNING: Use of the shrpdir variable for the installation location of
3328             the shared $libperl is not supported. It was never documented and
3329             -will not work in this version. Let me (doughera@lafayette.edu)
3330             +will not work in this version. Let me (jhi@iki.fi)
3331             know of any problems this may cause.
3332            
3333             EOM
3334             @@ -6703,6 +6691,10 @@ eval $setvar
3335             set difftime d_difftime
3336             eval $inlibc
3337            
3338             +: see if sys/stat.h is available
3339             +set sys/stat.h i_sysstat
3340             +eval $inhdr
3341             +
3342             : see if this is a dirent system
3343             echo " "
3344             if xinc=`./findhdr dirent.h`; $test "$xinc"; then
3345             @@ -6771,6 +6763,23 @@ set d_dirnamlen
3346             eval $setvar
3347             $rm -f try.c
3348            
3349             +hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
3350             +while $test $# -ge 2; do
3351             + case "$1" in
3352             + $define) echo "#include <$2>";;
3353             + esac ;
3354             + shift 2;
3355             +done > try.c;
3356             +echo "int main () { struct $struct foo; foo.$field = 0; }" >> try.c;
3357             +if eval $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
3358             + val="$define";
3359             +else
3360             + val="$undef";
3361             +fi;
3362             +set $varname;
3363             +eval $setvar;
3364             +$rm -f try.c try.o'
3365             +
3366             : see if dlerror exists
3367             xxx_runnm="$runnm"
3368             runnm=false
3369             @@ -7305,7 +7314,7 @@ esac
3370             set netinet/in.h i_niin sys/in.h i_sysin
3371             eval $inhdr
3372            
3373             -: see if this is an arpa/inet.h
3374             +: see if arpa/inet.h has to be included
3375             set arpa/inet.h i_arpainet
3376             eval $inhdr
3377            
3378             @@ -7635,7 +7644,7 @@ case "$osname" in
3379             freebsd)
3380             case "`ipcs 2>&1`" in
3381             "SVID messages"*"not configured"*)
3382             - echo "But your FreeBSD kernel does not have the msg*(2) configured." >&4
3383             + echo "But your $osname does not have the msg*(2) configured." >&4
3384             h_msg=false
3385             val="$undef"
3386             set msgctl d_msgctl
3387             @@ -7678,7 +7687,7 @@ set poll d_poll
3388             eval $inlibc
3389            
3390            
3391             -: see whether the various POSIXish _yields exist within given cccmd
3392             +: see whether the various POSIXish _yields exist
3393             $cat >try.c <
3394             #include
3395             main() {
3396             @@ -8136,7 +8145,7 @@ case "$osname" in
3397             freebsd)
3398             case "`ipcs 2>&1`" in
3399             "SVID messages"*"not configured"*)
3400             - echo "But your FreeBSD kernel does not have the sem*(2) configured." >&4
3401             + echo "But your $osname does not have the sem*(2) configured." >&4
3402             h_sem=false
3403             val="$undef"
3404             set semctl d_semctl
3405             @@ -8185,6 +8194,31 @@ case "$d_sem" in
3406             $define)
3407             : see whether semctl IPC_STAT can use union semun
3408             echo " "
3409             + $cat > try.h <
3410             +#ifndef S_IRUSR
3411             +# ifdef S_IREAD
3412             +# define S_IRUSR S_IREAD
3413             +# define S_IWUSR S_IWRITE
3414             +# define S_IXUSR S_IEXEC
3415             +# else
3416             +# define S_IRUSR 0400
3417             +# define S_IWUSR 0200
3418             +# define S_IXUSR 0100
3419             +# endif
3420             +# define S_IRGRP (S_IRUSR>>3)
3421             +# define S_IWGRP (S_IWUSR>>3)
3422             +# define S_IXGRP (S_IXUSR>>3)
3423             +# define S_IROTH (S_IRUSR>>6)
3424             +# define S_IWOTH (S_IWUSR>>6)
3425             +# define S_IXOTH (S_IXUSR>>6)
3426             +#endif
3427             +#ifndef S_IRWXU
3428             +# define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
3429             +# define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
3430             +# define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
3431             +#endif
3432             +END
3433             +
3434             $cat > try.c <
3435             #include
3436             #include
3437             @@ -8259,6 +8293,7 @@ END
3438             #include
3439             #include
3440             #include
3441             +#include "try.h"
3442             #ifndef errno
3443             extern int errno;
3444             #endif
3445             @@ -8305,6 +8340,7 @@ END
3446             *) echo "You cannot use struct semid_ds * for semctl IPC_STAT." >&4
3447             ;;
3448             esac
3449             + $rm -f try.h
3450             ;;
3451             *) val="$undef"
3452            
3453             @@ -8499,7 +8535,7 @@ case "$osname" in
3454             freebsd)
3455             case "`ipcs 2>&1`" in
3456             "SVID shared memory"*"not configured"*)
3457             - echo "But your FreeBSD kernel does not have the shm*(2) configured." >&4
3458             + echo "But your $osname does not have the shm*(2) configured." >&4
3459             h_shm=false
3460             val="$undef"
3461             set shmctl d_shmctl
3462             @@ -8652,21 +8688,8 @@ eval $inlibc
3463            
3464             : see if stat knows about block sizes
3465             echo " "
3466             -xxx=`./findhdr sys/stat.h`
3467             -if $contains 'st_blocks;' "$xxx" >/dev/null 2>&1 ; then
3468             - if $contains 'st_blksize;' "$xxx" >/dev/null 2>&1 ; then
3469             - echo "Your stat() knows about block sizes." >&4
3470             - val="$define"
3471             - else
3472             - echo "Your stat() doesn't know about block sizes." >&4
3473             - val="$undef"
3474             - fi
3475             -else
3476             - echo "Your stat() doesn't know about block sizes." >&4
3477             - val="$undef"
3478             -fi
3479             -set d_statblks
3480             -eval $setvar
3481             +set d_statblks stat st_blocks $i_sysstat sys/stat.h
3482             +eval $hasfield
3483            
3484             : see if _ptr and _cnt from stdio act std
3485             echo " "
3486             @@ -9610,6 +9633,32 @@ EOCP
3487             esac
3488             $rm -f try.c try
3489            
3490             +echo " "
3491             +echo "Determining whether or not we are on an EBCDIC system..." >&4
3492             +$cat >tebcdic.c <
3493             +int main()
3494             +{
3495             + if ('M'==0xd4) return 0;
3496             + return 1;
3497             +}
3498             +EOM
3499             +val=$undef
3500             +set tebcdic
3501             +if eval $compile_ok; then
3502             + if ./tebcdic; then
3503             + echo "You have EBCDIC." >&4
3504             + val="$define"
3505             + else
3506             + echo "Nope, no EBCDIC. Assuming ASCII or some ISO Latin." >&4
3507             + fi
3508             +else
3509             + echo "I'm unable to compile the test program." >&4
3510             + echo "I'll assume ASCII or some ISO Latin." >&4
3511             +fi
3512             +$rm -f tebcdic.c tebcdic
3513             +set ebcdic
3514             +eval $setvar
3515             +
3516             : see what type file positions are declared as in the library
3517             rp="What is the type for file position used by fsetpos()?"
3518             set fpos_t fpostype long stdio.h sys/types.h
3519             @@ -10217,8 +10266,10 @@ EOM
3520             : The first arg can be int, unsigned, or size_t
3521             : The last arg may or may not be 'const'
3522             val=''
3523             + : void pointer has been seen but using that
3524             + : breaks the selectminbits test
3525             for xxx in 'fd_set *' 'int *'; do
3526             - for nfd in 'int' 'size_t' 'unsigned' ; do
3527             + for nfd in 'int' 'size_t' 'unsigned' 'unsigned long'; do
3528             for tmo in 'struct timeval *' 'const struct timeval *'; do
3529             case "$val" in
3530             '') try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
3531             @@ -10250,6 +10301,100 @@ EOM
3532             ;;
3533             esac
3534            
3535             +: check for the select 'width'
3536             +case "$selectminbits" in
3537             +'') case "$d_select" in
3538             + $define)
3539             + $cat <
3540             +
3541             +Checking to see on how many bits at a time your select() operates...
3542             +EOM
3543             + $cat >try.c <
3544             +#include
3545             +#$i_time I_TIME
3546             +#$i_systime I_SYS_TIME
3547             +#$i_systimek I_SYS_TIME_KERNEL
3548             +#ifdef I_TIME
3549             +# include
3550             +#endif
3551             +#ifdef I_SYS_TIME
3552             +# ifdef I_SYS_TIME_KERNEL
3553             +# define KERNEL
3554             +# endif
3555             +# include
3556             +# ifdef I_SYS_TIME_KERNEL
3557             +# undef KERNEL
3558             +# endif
3559             +#endif
3560             +#$i_sysselct I_SYS_SELECT
3561             +#ifdef I_SYS_SELECT
3562             +#include
3563             +#endif
3564             +#include
3565             +$selecttype b;
3566             +#define S sizeof(*(b))
3567             +#define MINBITS 64
3568             +#define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
3569             +#define NBITS (NBYTES * 8)
3570             +int main() {
3571             + char s[NBYTES];
3572             + struct timeval t;
3573             + int i;
3574             + FILE* fp;
3575             + int fd;
3576             +
3577             + fclose(stdin);
3578             + fp = fopen("try.c", "r");
3579             + if (fp == 0)
3580             + exit(1);
3581             + fd = fileno(fp);
3582             + if (fd < 0)
3583             + exit(2);
3584             + b = ($selecttype)s;
3585             + for (i = 0; i < NBITS; i++)
3586             + FD_SET(i, b);
3587             + t.tv_sec = 0;
3588             + t.tv_usec = 0;
3589             + select(fd + 1, b, 0, 0, &t);
3590             + for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
3591             + printf("%d\n", i + 1);
3592             + return 0;
3593             +}
3594             +EOCP
3595             + set try
3596             + if eval $compile_ok; then
3597             + selectminbits=`./try`
3598             + case "$selectminbits" in
3599             + '') cat >&4 <
3600             +Cannot figure out on how many bits at a time your select() operates.
3601             +I'll play safe and guess it is 32 bits.
3602             +EOM
3603             + selectminbits=32
3604             + bits="32 bits"
3605             + ;;
3606             + 1) bits="1 bit" ;;
3607             + *) bits="$selectminbits bits" ;;
3608             + esac
3609             + echo "Your select() operates on $bits at a time." >&4
3610             + else
3611             + rp='What is the minimum number of bits your select() operates on?'
3612             + case "$byteorder" in
3613             + 1234|12345678) dflt=32 ;;
3614             + *) dflt=1 ;;
3615             + esac
3616             + . ./myread
3617             + val=$ans
3618             + selectminbits="$val"
3619             + fi
3620             + $rm -f try.* try
3621             + ;;
3622             + *) : no select, so pick a harmless default
3623             + selectminbits='32'
3624             + ;;
3625             + esac
3626             + ;;
3627             +esac
3628             +
3629             : Trace out the files included by signal.h, then look for SIGxxx names.
3630             : Remove SIGARRAYSIZE used by HPUX.
3631             : Remove SIGTYP void lines used by OS2.
3632             @@ -10458,7 +10603,13 @@ $eunicefix signal_cmd
3633             : generate list of signal names
3634             echo " "
3635             case "$sig_name_init" in
3636             -'')
3637             +'') doinit=yes ;;
3638             +*) case "$sig_num_init" in
3639             + ''|*,*) doinit=yes ;;
3640             + esac ;;
3641             +esac
3642             +case "$doinit" in
3643             +yes)
3644             echo "Generating a list of signal names and numbers..." >&4
3645             . ./signal_cmd
3646             sig_name=`$awk '{printf "%s ", $1}' signal.lst`
3647             @@ -10466,7 +10617,9 @@ case "$sig_name_init" in
3648             sig_name_init=`$awk 'BEGIN { printf "\"ZERO\", " }
3649             { printf "\"%s\", ", $1 }
3650             END { printf "0\n" }' signal.lst`
3651             - sig_num=`$awk 'BEGIN { printf "0, " }
3652             + sig_num=`$awk '{printf "%d ", $2}' signal.lst`
3653             + sig_num="0 $sig_num"
3654             + sig_num_init=`$awk 'BEGIN { printf "0, " }
3655             { printf "%d, ", $2}
3656             END { printf "0\n"}' signal.lst`
3657             ;;
3658             @@ -10830,7 +10983,13 @@ $rm -f try.c
3659             EOS
3660             chmod +x ccsym
3661             $eunicefix ccsym
3662             -./ccsym | $sort | $uniq >ccsym.raw
3663             +./ccsym > ccsym1.raw
3664             +if $test -s ccsym1.raw; then
3665             + $sort ccsym1.raw | $uniq >ccsym.raw
3666             +else
3667             + mv ccsym1.raw ccsym.raw
3668             +fi
3669             +
3670             $awk '/\=/ { print $0; next }
3671             { print $0"=1" }' ccsym.raw >ccsym.list
3672             $awk '{ print $0"=1" }' Cppsym.true >ccsym.true
3673             @@ -11055,10 +11214,6 @@ eval $inhdr
3674             set sys/resource.h i_sysresrc
3675             eval $inhdr
3676            
3677             -: see if sys/stat.h is available
3678             -set sys/stat.h i_sysstat
3679             -eval $inhdr
3680             -
3681             : see if this is a sys/un.h system
3682             set sys/un.h i_sysun
3683             eval $inhdr
3684             @@ -11195,6 +11350,7 @@ for xxx in $known_extensions ; do
3685             esac
3686             ;;
3687             IPC/SysV|ipc/sysv)
3688             + : XXX Do we need a useipcsysv variable here
3689             case "${d_msg}${d_sem}${d_shm}" in
3690             *"${define}"*) avail_ext="$avail_ext $xxx" ;;
3691             esac
3692             @@ -11774,6 +11930,7 @@ i_values='$i_values'
3693             i_varargs='$i_varargs'
3694             i_varhdr='$i_varhdr'
3695             i_vfork='$i_vfork'
3696             +ignore_versioned_solibs='$ignore_versioned_solibs'
3697             incpath='$incpath'
3698             inews='$inews'
3699             installarchlib='$installarchlib'
3700             @@ -11882,6 +12039,7 @@ runnm='$runnm'
3701             scriptdir='$scriptdir'
3702             scriptdirexp='$scriptdirexp'
3703             sed='$sed'
3704             +selectminbits='$selectminbits'
3705             selecttype='$selecttype'
3706             sendmail='$sendmail'
3707             sh='$sh'
3708             @@ -11894,6 +12052,7 @@ shsharp='$shsharp'
3709             sig_name='$sig_name'
3710             sig_name_init='$sig_name_init'
3711             sig_num='$sig_num'
3712             +sig_num_init='$sig_num_init'
3713             signal_t='$signal_t'
3714             sitearch='$sitearch'
3715             sitearchexp='$sitearchexp'
3716             @@ -12023,51 +12182,6 @@ esac
3717             : if this fails, just run all the .SH files by hand
3718             . ./config.sh
3719            
3720             -case "$ebcdic" in
3721             -$define)
3722             - xxx=''
3723             - echo "This is an EBCDIC system, checking if any parser files need regenerating." >&4
3724             - rm -f y.tab.c y.tab.h
3725             - yacc -d perly.y >/dev/null 2>&1
3726             - if cmp -s y.tab.c perly.c; then
3727             - rm -f y.tab.c
3728             - else
3729             - echo "perly.y -> perly.c" >&4
3730             - mv -f y.tab.c perly.c
3731             - chmod u+w perly.c
3732             - sed -e 's/fprintf *( *stderr *,/PerlIO_printf(Perl_debug_log,/g' \
3733             - -e 's/y\.tab/perly/g' perly.c >perly.tmp && mv perly.tmp perly.c
3734             - xxx="$xxx perly.c"
3735             - fi
3736             - if cmp -s y.tab.h perly.h; then
3737             - rm -f y.tab.h
3738             - else
3739             - echo "perly.y -> perly.h" >&4
3740             - mv -f y.tab.h perly.h
3741             - xxx="$xxx perly.h"
3742             - fi
3743             - echo "x2p/a2p.y" >&4
3744             - cd x2p
3745             - rm -f y.tab.c
3746             - yacc a2p.y >/dev/null 2>&1
3747             - if cmp -s y.tab.c a2p.c
3748             - then
3749             - rm -f y.tab.c
3750             - else
3751             - echo "a2p.y -> a2p.c" >&4
3752             - mv -f y.tab.c a2p.c
3753             - chmod u+w a2p.c
3754             - sed -e 's/fprintf *( *stderr *,/PerlIO_printf(Perl_debug_log,/g' \
3755             - -e 's/y\.tab/a2p/g' a2p.c >a2p.tmp && mv a2p.tmp a2p.c
3756             - xxx="$xxx a2p.c"
3757             - fi
3758             - cd ..
3759             - case "$xxx" in
3760             - '') echo "No parser files were regenerated. That's okay." >&4 ;;
3761             - esac
3762             - ;;
3763             -esac
3764             -
3765             echo " "
3766             exec 1>&4
3767             . ./UU/extract
3768             --- Makefile.SH
3769             +++ Makefile.SH
3770             @@ -644,3 +644,83 @@ case `pwd` in
3771             ;;
3772             esac
3773             $rm -f $firstmakefile
3774             +
3775             +# Now do any special processing required before building.
3776             +
3777             +case "$ebcdic" in
3778             +$define)
3779             + xxx=''
3780             + echo "This is an EBCDIC system, checking if any parser files need regenerating." >&4
3781             +case "$osname" in
3782             +os390)
3783             + rm -f y.tab.c y.tab.h
3784             + yacc -d perly.y >/dev/null 2>&1
3785             + if cmp -s y.tab.c perly.c; then
3786             + rm -f y.tab.c
3787             + else
3788             + echo "perly.y -> perly.c" >&2
3789             + mv -f y.tab.c perly.c
3790             + chmod u+w perly.c
3791             + sed -e '/^#include "perl\.h"/a\
3792             +\
3793             +#define yydebug PL_yydebug\
3794             +#define yynerrs PL_yynerrs\
3795             +#define yyerrflag PL_yyerrflag\
3796             +#define yychar PL_yychar\
3797             +#define yyval PL_yyval\
3798             +#define yylval PL_yylval' \
3799             + -e '/YYSTYPE *yyval;/D' \
3800             + -e '/YYSTYPE *yylval;/D' \
3801             + -e '/int yychar,/,/yynerrs;/D' \
3802             + -e 's/int yydebug = 0;/yydebug = 0;/' \
3803             + -e 's/[^_]realloc(/PerlMem_realloc(/g' \
3804             + -e 's/fprintf *( *stderr *,/PerlIO_printf(Perl_debug_log,/g' \
3805             + -e 's/y\.tab/perly/g' perly.c >perly.tmp && mv perly.tmp perly.c
3806             + xxx="$xxx perly.c"
3807             + fi
3808             + if cmp -s y.tab.h perly.h; then
3809             + rm -f y.tab.h
3810             + else
3811             + echo "perly.y -> perly.h" >&2
3812             + mv -f y.tab.h perly.h
3813             + xxx="$xxx perly.h"
3814             + fi
3815             + if cd x2p
3816             + then
3817             + rm -f y.tab.c y.tab.h
3818             + yacc a2p.y >/dev/null 2>&1
3819             + if cmp -s y.tab.c a2p.c
3820             + then
3821             + rm -f y.tab.c
3822             + else
3823             + echo "a2p.y -> a2p.c" >&2
3824             + mv -f y.tab.c a2p.c
3825             + chmod u+w a2p.c
3826             + sed -e 's/fprintf *( *stderr *,/PerlIO_printf(Perl_debug_log,/g' \
3827             + -e 's/y\.tab/a2p/g' a2p.c >a2p.tmp && mv a2p.tmp a2p.c
3828             + xxx="$xxx a2p.c"
3829             + fi
3830             + # In case somebody yacc -d:ed the a2p.y.
3831             + if test -f y.tab.h
3832             + then
3833             + if cmp -s y.tab.h a2p.h
3834             + then
3835             + rm -f y.tab.h
3836             + else
3837             + echo "a2p.h -> a2p.h" >&2
3838             + mv -f y.tab.h a2p.h
3839             + xxx="$xxx a2p.h"
3840             + fi
3841             + fi
3842             + cd ..
3843             + fi
3844             + ;;
3845             +*)
3846             + echo "'$osname' is an EBCDIC system I don't know that well." >&4
3847             + ;;
3848             +esac
3849             + case "$xxx" in
3850             + '') echo "No parser files were regenerated. That's okay." >&2 ;;
3851             + esac
3852             + ;;
3853             +esac
3854             --- config_h.SH
3855             +++ config_h.SH
3856             @@ -1813,7 +1813,7 @@ sed <config.h -e 's!^#undef\(.*/\)\*!/\*#define\1 \*!' -e 's!^#un-
3857             * the sig_name list.
3858             */
3859             #define SIG_NAME $sig_name_init /**/
3860             -#define SIG_NUM $sig_num /**/
3861             +#define SIG_NUM $sig_num_init /**/
3862            
3863             /* VOIDFLAGS:
3864             * This symbol indicates how much support of the void type is given by this
3865             @@ -1902,6 +1902,15 @@ sed <config.h -e 's!^#undef\(.*/\)\*!/\*#define\1 \*!' -e 's!^#un-
3866             #define PRIVLIB "$privlib" /**/
3867             #define PRIVLIB_EXP "$privlibexp" /**/
3868            
3869             +/* SELECT_MIN_BITS:
3870             + * This symbol holds the minimum number of bits operated by select.
3871             + * That is, if you do select(n, ...), how many bits at least will be
3872             + * cleared in the masks if some activity is detected. Usually this
3873             + * is either n or 32*ceil(n/32), especially many little-endians do
3874             + * the latter. This is only useful if you have select(), naturally.
3875             + */
3876             +#define SELECT_MIN_BITS $selectminbits /**/
3877             +
3878             /* SITEARCH:
3879             * This symbol contains the name of the private library for this package.
3880             * The library is private in the sense that it needn't be in anyone's
3881             --- pp_sys.c
3882             +++ pp_sys.c
3883             @@ -56,7 +56,10 @@ extern "C" int syscall(unsigned long,...);
3884            
3885             /* XXX Configure test needed.
3886             h_errno might not be a simple 'int', especially for multi-threaded
3887             - applications. HOST_NOT_FOUND is typically defined in .
3888             + applications, see "extern int errno in perl.h". Creating such
3889             + a test requires taking into account the differences between
3890             + compiling multithreaded and singlethreaded ($ccflags et al).
3891             + HOST_NOT_FOUND is typically defined in .
3892             */
3893             #if defined(HOST_NOT_FOUND) && !defined(h_errno)
3894             extern int h_errno;
3895             @@ -753,12 +756,17 @@ PP(pp_sselect)
3896             maxlen = j;
3897             }
3898            
3899             +/* little endians can use vecs directly */
3900             #if BYTEORDER == 0x1234 || BYTEORDER == 0x12345678
3901             -/* XXX Configure test needed. */
3902             -#if defined(__linux__) || defined(OS2) || defined(NeXT) || defined(__osf__) || defined(sun)
3903             - growsize = sizeof(fd_set);
3904             +# if SELECT_MIN_BITS > 1
3905             + /* If SELECT_MIN_BITS is greater than one we most probably will want
3906             + * to align the sizes with SELECT_MIN_BITS/8 because for example
3907             + * in many little-endian (Intel, Alpha) systems (Linux, OS/2, Digital
3908             + * UNIX, Solaris, NeXT) the smallest quantum select() operates on
3909             + * (sets bit) is 32 bits. */
3910             + growsize = maxlen + (SELECT_MIN_BITS/8 - (maxlen % (SELECT_MIN_BITS/8)));
3911             #else
3912             - growsize = maxlen; /* little endians can use vecs directly */
3913             + growsize = sizeof(fd_set);
3914             #endif
3915             #else
3916             #ifdef NFDBITS
3917             END
3918             }
3919              
3920             sub _patch_5_005_01 {
3921 0     0     _patch(<<'END');
3922             --- Configure
3923             +++ Configure
3924             @@ -21,7 +21,7 @@
3925             # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
3926             #
3927             # Generated on Tue Jul 7 10:10:21 EDT 1998 [metaconfig 3.0 PL70]
3928             -# (with additional metaconfig patches by doughera@lafayette.edu)
3929             +# (with additional metaconfig patches by jhi@iki.fi)
3930            
3931             cat >/tmp/c1$$ <
3932             ARGGGHHHH!!!!!
3933             @@ -56,33 +56,6 @@ case "$0" in
3934             ;;
3935             esac
3936            
3937             -: the newline for tr
3938             -if test X"$trnl" = X; then
3939             - case "`echo foo|tr '\n' x 2>/dev/null`" in
3940             - foox)
3941             - trnl='\n'
3942             - ;;
3943             - esac
3944             -fi
3945             -if test X"$trnl" = X; then
3946             - case "`echo foo|tr '\012' x 2>/dev/null`" in
3947             - foox)
3948             - trnl='\012'
3949             - ;;
3950             - esac
3951             -fi
3952             -if test -n "$DJGPP"; then
3953             - trnl='\012'
3954             -fi
3955             -if test X"$trnl" = X; then
3956             - cat <&2
3957             -
3958             -$me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
3959             -
3960             -EOM
3961             - exit 1
3962             -fi
3963             -
3964             : Proper separator for the PATH environment variable
3965             p_=:
3966             : On OS/2 this directory should exist if this is not floppy only system :-]
3967             @@ -391,7 +364,6 @@ d_getservprotos=''
3968             d_getsbyname=''
3969             d_getsbyport=''
3970             d_gnulibc=''
3971             -i_arpainet=''
3972             d_htonl=''
3973             d_inetaton=''
3974             d_isascii=''
3975             @@ -540,6 +512,7 @@ dlsrc=''
3976             ld=''
3977             lddlflags=''
3978             usedl=''
3979             +ebcdic=''
3980             doublesize=''
3981             fpostype=''
3982             gidtype=''
3983             @@ -548,6 +521,7 @@ h_fcntl=''
3984             h_sysfile=''
3985             db_hashtype=''
3986             db_prefixtype=''
3987             +i_arpainet=''
3988             i_db=''
3989             i_dbm=''
3990             i_rpcsvcdbm=''
3991             @@ -633,6 +607,7 @@ libpth=''
3992             loclibpth=''
3993             plibpth=''
3994             xlibpth=''
3995             +ignore_versioned_solibs=''
3996             libs=''
3997             lns=''
3998             lseektype=''
3999             @@ -697,11 +672,13 @@ randbits=''
4000             installscript=''
4001             scriptdir=''
4002             scriptdirexp=''
4003             +selectminbits=''
4004             selecttype=''
4005             sh=''
4006             sig_name=''
4007             sig_name_init=''
4008             sig_num=''
4009             +sig_num_init=''
4010             installsitearch=''
4011             sitearch=''
4012             sitearchexp=''
4013             @@ -719,6 +696,7 @@ startperl=''
4014             startsh=''
4015             stdchar=''
4016             sysman=''
4017             +trnl=''
4018             uidtype=''
4019             nm_opt=''
4020             nm_so_opt=''
4021             @@ -733,7 +711,6 @@ mips_type=''
4022             usrinc=''
4023             defvoidused=''
4024             voidflags=''
4025             -ebcdic=''
4026             CONFIG=''
4027            
4028             define='define'
4029             @@ -836,6 +813,8 @@ plibpth=''
4030            
4031             : default library list
4032             libswanted=''
4033             +: some systems want only to use the non-versioned libso:s
4034             +ignore_versioned_solibs=''
4035             : Possible local include directories to search.
4036             : Set locincpth to "" in a hint file to defeat local include searches.
4037             locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
4038             @@ -904,7 +883,7 @@ case "$sh" in
4039             $me: Fatal Error: I can't find a Bourne Shell anywhere.
4040            
4041             Usually it's in /bin/sh. How did you even get this far?
4042             -Please contact me (Andy Dougherty) at doughera@lafayette.edu and
4043             +Please contact me (Jarkko Hietaniemi) at jhi@iki.fi and
4044             we'll try to straighten this all out.
4045             EOM
4046             exit 1
4047             @@ -1240,7 +1219,7 @@ cat >extract <<'EOS'
4048             CONFIG=true
4049             echo "Doing variable substitutions on .SH files..."
4050             if test -f $src/MANIFEST; then
4051             - set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH'`
4052             + set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH$'`
4053             else
4054             echo "(Looking for .SH files under the source directory.)"
4055             set x `(cd $src; find . -name "*.SH" -print)`
4056             @@ -1373,7 +1352,7 @@ THIS PACKAGE SEEMS TO BE INCOMPLETE.
4057             You have the option of continuing the configuration process, despite the
4058             distinct possibility that your kit is damaged, by typing 'y'es. If you
4059             do, don't blame me if something goes wrong. I advise you to type 'n'o
4060             -and contact the author (doughera@lafayette.edu).
4061             +and contact the author (jhi@iki.fi).
4062            
4063             EOM
4064             echo $n "Continue? [n] $c" >&4
4065             @@ -1396,6 +1375,30 @@ else
4066             fi
4067             rm -f missing x??
4068            
4069             +echo " "
4070             +: Find the appropriate value for a newline for tr
4071             +if test -n "$DJGPP"; then
4072             + trnl='\012'
4073             +fi
4074             +if test X"$trnl" = X; then
4075             + case "`echo foo|tr '\n' x 2>/dev/null`" in
4076             + foox) trnl='\n' ;;
4077             + esac
4078             +fi
4079             +if test X"$trnl" = X; then
4080             + case "`echo foo|tr '\012' x 2>/dev/null`" in
4081             + foox) trnl='\012' ;;
4082             + esac
4083             +fi
4084             +if test X"$trnl" = X; then
4085             + cat <&2
4086             +
4087             +$me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
4088             +
4089             +EOM
4090             + exit 1
4091             +fi
4092             +
4093             : compute the number of columns on the terminal for proper question formatting
4094             case "$COLUMNS" in
4095             '') COLUMNS='80';;
4096             @@ -1574,7 +1577,7 @@ Much effort has been expended to ensure that this shell script will run on any
4097             Unix system. If despite that it blows up on yours, your best bet is to edit
4098             Configure and run it again. If you can't run Configure for some reason,
4099             you'll have to generate a config.sh file by hand. Whatever problems you
4100             -have, let me (doughera@lafayette.edu) know how I blew it.
4101             +have, let me (jhi@iki.fi) know how I blew it.
4102            
4103             This installation script affects things in two ways:
4104            
4105             @@ -1841,14 +1844,14 @@ ABYZ)
4106             *C9D1*|*c9d1*)
4107             echo "Hey, this might be EBCDIC." >&4
4108             if test "X$up" = X -o "X$low" = X; then
4109             - case "`echo IJ | tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
4110             + case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
4111             ij) up='[A-IJ-RS-Z]'
4112             low='[a-ij-rs-z]'
4113             ;;
4114             esac
4115             fi
4116             if test "X$up" = X -o "X$low" = X; then
4117             - case "`echo IJ | tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
4118             + case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
4119             ij) up='A-IJ-RS-Z'
4120             low='a-ij-rs-z'
4121             ;;
4122             @@ -1941,7 +1944,7 @@ EOM
4123             (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/ /g' >&4
4124             dflt=''
4125             : Half the following guesses are probably wrong... If you have better
4126             - : tests or hints, please send them to doughera@lafayette.edu
4127             + : tests or hints, please send them to jhi@iki.fi
4128             : The metaconfig authors would also appreciate a copy...
4129             $test -f /irix && osname=irix
4130             $test -f /xenix && osname=sco_xenix
4131             @@ -2025,7 +2028,7 @@ EOM
4132             osvers="$3"
4133             ;;
4134             dynixptx*) osname=dynixptx
4135             - osvers="$3"
4136             + osvers=`echo "$4" | $sed 's/^v//'`
4137             ;;
4138             freebsd) osname=freebsd
4139             osvers="$3" ;;
4140             @@ -3454,7 +3457,11 @@ cat <<'EOT' >testcpp.c
4141             ABC.XYZ
4142             EOT
4143             cd ..
4144             +if test ! -f cppstdin; then
4145             echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4146             +else
4147             + echo "Keeping your $hint cppstdin wrapper."
4148             +fi
4149             chmod 755 cppstdin
4150             wrapper=`pwd`/cppstdin
4151             ok='false'
4152             @@ -3705,7 +3712,8 @@ case "$libswanted" in
4153             esac
4154             for thislib in $libswanted; do
4155            
4156             - if xxx=`./loc lib$thislib.$so.[0-9]'*' X $libpth`; $test -f "$xxx"; then
4157             + if xxx=`./loc lib$thislib.$so.[0-9]'*' X $libpth`;
4158             + $test -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4159             echo "Found -l$thislib (shared)."
4160             case " $dflt " in
4161             *"-l$thislib "*);;
4162             @@ -3992,10 +4000,21 @@ rmlist="$rmlist pdp11"
4163             : coherency check
4164             echo " "
4165             echo "Checking your choice of C compiler and flags for coherency..." >&4
4166             +$cat > try.c <<'EOF'
4167             +#include
4168             +main() { printf("Ok\n"); exit(0); }
4169             +EOF
4170             set X $cc $optimize $ccflags -o try $ldflags try.c $libs
4171             shift
4172             -$cat >try.msg <
4173             -I've tried to compile and run a simple program with:
4174             +$cat >try.msg <<'EOM'
4175             +I've tried to compile and run the following simple program:
4176             +
4177             +EOM
4178             +$cat try.c
4179             +
4180             +$cat >> try.msg <
4181             +
4182             +I used the command:
4183            
4184             $*
4185             ./try
4186             @@ -4003,10 +4022,6 @@ I've tried to compile and run a simple program with:
4187             and I got the following output:
4188            
4189             EOM
4190             -$cat > try.c <<'EOF'
4191             -#include
4192             -main() { printf("Ok\n"); exit(0); }
4193             -EOF
4194             dflt=y
4195             if sh -c "$cc $optimize $ccflags -o try $ldflags try.c $libs" >>try.msg 2>&1; then
4196             if sh -c './try' >>try.msg 2>&1; then
4197             @@ -4043,7 +4058,7 @@ y)
4198             $cat try.msg >&4
4199             case "$knowitall" in
4200             '')
4201             - echo "(The supplied flags might be incorrect with this C compiler.)"
4202             + echo "(The supplied flags or libraries might be incorrect.)"
4203             ;;
4204             *) dflt=n;;
4205             esac
4206             @@ -4161,9 +4176,8 @@ eval $inhdr
4207             : determine which malloc to compile in
4208             echo " "
4209             case "$usemymalloc" in
4210             -''|y*|true) dflt='y' ;;
4211             -n*|false) dflt='n' ;;
4212             -*) dflt="$usemymalloc" ;;
4213             +''|[yY]*|true|$define) dflt='y' ;;
4214             +*) dflt='n' ;;
4215             esac
4216             rp="Do you wish to attempt to use the malloc that comes with $package?"
4217             . ./myread
4218             @@ -4265,7 +4279,7 @@ understands function prototypes. Unfortunately, your C compiler
4219             $cc $ccflags
4220             doesn't seem to understand them. Sorry about that.
4221            
4222             -If GNU cc is avaiable for your system, perhaps you could try that instead.
4223             +If GNU cc is available for your system, perhaps you could try that instead.
4224            
4225             Eventually, we hope to support building Perl with pre-ANSI compilers.
4226             If you would like to help in that effort, please contact .
4227             @@ -4320,32 +4334,6 @@ shift;
4228             $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs;'
4229            
4230             echo " "
4231             -echo "Determining whether or not we are on an EBCDIC system..." >&4
4232             -cat >tebcdic.c <
4233             -int main()
4234             -{
4235             - if ('M'==0xd4) return 0;
4236             - return 1;
4237             -}
4238             -EOM
4239             -val=$undef
4240             -set tebcdic
4241             -if eval $compile_ok; then
4242             - if ./tebcdic; then
4243             - echo "You have EBCDIC." >&4
4244             - val="$define"
4245             - else
4246             - echo "Nope, no EBCDIC. Assuming ASCII or some ISO Latin." >&4
4247             - fi
4248             -else
4249             - echo "I'm unable to compile the test program." >&4
4250             - echo "I'll asuume ASCII or some ISO Latin." >&4
4251             -fi
4252             -$rm -f tebcdic.c tebcdic
4253             -set ebcdic
4254             -eval $setvar
4255             -
4256             -echo " "
4257             echo "Checking for GNU C Library..." >&4
4258             cat >gnulibc.c <
4259             #include
4260             @@ -5159,7 +5147,7 @@ case "$shrpdir" in
4261             *) $cat >&4 <
4262             WARNING: Use of the shrpdir variable for the installation location of
4263             the shared $libperl is not supported. It was never documented and
4264             -will not work in this version. Let me (doughera@lafayette.edu)
4265             +will not work in this version. Let me (jhi@iki.fi)
4266             know of any problems this may cause.
4267            
4268             EOM
4269             @@ -6715,6 +6703,10 @@ eval $setvar
4270             set difftime d_difftime
4271             eval $inlibc
4272            
4273             +: see if sys/stat.h is available
4274             +set sys/stat.h i_sysstat
4275             +eval $inhdr
4276             +
4277             : see if this is a dirent system
4278             echo " "
4279             if xinc=`./findhdr dirent.h`; $test "$xinc"; then
4280             @@ -6783,6 +6775,23 @@ set d_dirnamlen
4281             eval $setvar
4282             $rm -f try.c
4283            
4284             +hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
4285             +while $test $# -ge 2; do
4286             + case "$1" in
4287             + $define) echo "#include <$2>";;
4288             + esac ;
4289             + shift 2;
4290             +done > try.c;
4291             +echo "int main () { struct $struct foo; foo.$field = 0; }" >> try.c;
4292             +if eval $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
4293             + val="$define";
4294             +else
4295             + val="$undef";
4296             +fi;
4297             +set $varname;
4298             +eval $setvar;
4299             +$rm -f try.c try.o'
4300             +
4301             : see if dlerror exists
4302             xxx_runnm="$runnm"
4303             runnm=false
4304             @@ -7317,7 +7326,7 @@ esac
4305             set netinet/in.h i_niin sys/in.h i_sysin
4306             eval $inhdr
4307            
4308             -: see if this is an arpa/inet.h
4309             +: see if arpa/inet.h has to be included
4310             set arpa/inet.h i_arpainet
4311             eval $inhdr
4312            
4313             @@ -7643,6 +7652,27 @@ echo " "
4314             case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
4315             *"$undef"*) h_msg=false;;
4316             esac
4317             +
4318             +case "$osname" in
4319             +freebsd)
4320             + case "`ipcs 2>&1`" in
4321             + "SVID messages"*"not configured"*)
4322             + echo "But your $osname does not have the msg*(2) configured." >&4
4323             + h_msg=false
4324             + val="$undef"
4325             + set msgctl d_msgctl
4326             + eval $setvar
4327             + set msgget d_msgget
4328             + eval $setvar
4329             + set msgsnd d_msgsnd
4330             + eval $setvar
4331             + set msgrcv d_msgrcv
4332             + eval $setvar
4333             + ;;
4334             + esac
4335             + ;;
4336             +esac
4337             +
4338             : we could also check for sys/ipc.h ...
4339             if $h_msg && $test `./findhdr sys/msg.h`; then
4340             echo "You have the full msg*(2) library." >&4
4341             @@ -7671,7 +7701,7 @@ set poll d_poll
4342             eval $inlibc
4343            
4344            
4345             -: see whether the various POSIXish _yields exist within given cccmd
4346             +: see whether the various POSIXish _yields exist
4347             $cat >try.c <
4348             #include
4349             main() {
4350             @@ -8125,6 +8155,25 @@ echo " "
4351             case "$d_semctl$d_semget$d_semop" in
4352             *"$undef"*) h_sem=false;;
4353             esac
4354             +
4355             +case "$osname" in
4356             +freebsd)
4357             + case "`ipcs 2>&1`" in
4358             + "SVID messages"*"not configured"*)
4359             + echo "But your $osname does not have the sem*(2) configured." >&4
4360             + h_sem=false
4361             + val="$undef"
4362             + set semctl d_semctl
4363             + eval $setvar
4364             + set semget d_semget
4365             + eval $setvar
4366             + set semop d_semop
4367             + eval $setvar
4368             + ;;
4369             + esac
4370             + ;;
4371             +esac
4372             +
4373             : we could also check for sys/ipc.h ...
4374             if $h_sem && $test `./findhdr sys/sem.h`; then
4375             echo "You have the full sem*(2) library." >&4
4376             @@ -8161,6 +8210,31 @@ case "$d_sem" in
4377             $define)
4378             : see whether semctl IPC_STAT can use union semun
4379             echo " "
4380             + $cat > try.h <
4381             +#ifndef S_IRUSR
4382             +# ifdef S_IREAD
4383             +# define S_IRUSR S_IREAD
4384             +# define S_IWUSR S_IWRITE
4385             +# define S_IXUSR S_IEXEC
4386             +# else
4387             +# define S_IRUSR 0400
4388             +# define S_IWUSR 0200
4389             +# define S_IXUSR 0100
4390             +# endif
4391             +# define S_IRGRP (S_IRUSR>>3)
4392             +# define S_IWGRP (S_IWUSR>>3)
4393             +# define S_IXGRP (S_IXUSR>>3)
4394             +# define S_IROTH (S_IRUSR>>6)
4395             +# define S_IWOTH (S_IWUSR>>6)
4396             +# define S_IXOTH (S_IXUSR>>6)
4397             +#endif
4398             +#ifndef S_IRWXU
4399             +# define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
4400             +# define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
4401             +# define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
4402             +#endif
4403             +END
4404             +
4405             $cat > try.c <
4406             #include
4407             #include
4408             @@ -8235,6 +8309,7 @@ END
4409             #include
4410             #include
4411             #include
4412             +#include "try.h"
4413             #ifndef errno
4414             extern int errno;
4415             #endif
4416             @@ -8281,6 +8356,7 @@ END
4417             *) echo "You cannot use struct semid_ds * for semctl IPC_STAT." >&4
4418             ;;
4419             esac
4420             + $rm -f try.h
4421             ;;
4422             *) val="$undef"
4423            
4424             @@ -8471,6 +8547,27 @@ echo " "
4425             case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
4426             *"$undef"*) h_shm=false;;
4427             esac
4428             +
4429             +case "$osname" in
4430             +freebsd)
4431             + case "`ipcs 2>&1`" in
4432             + "SVID shared memory"*"not configured"*)
4433             + echo "But your $osname does not have the shm*(2) configured." >&4
4434             + h_shm=false
4435             + val="$undef"
4436             + set shmctl d_shmctl
4437             + evat $setvar
4438             + set shmget d_shmget
4439             + evat $setvar
4440             + set shmat d_shmat
4441             + evat $setvar
4442             + set shmdt d_shmdt
4443             + evat $setvar
4444             + ;;
4445             + esac
4446             + ;;
4447             +esac
4448             +
4449             : we could also check for sys/ipc.h ...
4450             if $h_shm && $test `./findhdr sys/shm.h`; then
4451             echo "You have the full shm*(2) library." >&4
4452             @@ -8609,21 +8706,8 @@ eval $inlibc
4453            
4454             : see if stat knows about block sizes
4455             echo " "
4456             -xxx=`./findhdr sys/stat.h`
4457             -if $contains 'st_blocks;' "$xxx" >/dev/null 2>&1 ; then
4458             - if $contains 'st_blksize;' "$xxx" >/dev/null 2>&1 ; then
4459             - echo "Your stat() knows about block sizes." >&4
4460             - val="$define"
4461             - else
4462             - echo "Your stat() doesn't know about block sizes." >&4
4463             - val="$undef"
4464             - fi
4465             -else
4466             - echo "Your stat() doesn't know about block sizes." >&4
4467             - val="$undef"
4468             -fi
4469             -set d_statblks
4470             -eval $setvar
4471             +set d_statblks stat st_blocks $i_sysstat sys/stat.h
4472             +eval $hasfield
4473            
4474             : see if _ptr and _cnt from stdio act std
4475             echo " "
4476             @@ -9567,6 +9651,32 @@ EOCP
4477             esac
4478             $rm -f try.c try
4479            
4480             +echo " "
4481             +echo "Determining whether or not we are on an EBCDIC system..." >&4
4482             +$cat >tebcdic.c <
4483             +int main()
4484             +{
4485             + if ('M'==0xd4) return 0;
4486             + return 1;
4487             +}
4488             +EOM
4489             +val=$undef
4490             +set tebcdic
4491             +if eval $compile_ok; then
4492             + if ./tebcdic; then
4493             + echo "You have EBCDIC." >&4
4494             + val="$define"
4495             + else
4496             + echo "Nope, no EBCDIC. Assuming ASCII or some ISO Latin." >&4
4497             + fi
4498             +else
4499             + echo "I'm unable to compile the test program." >&4
4500             + echo "I'll assume ASCII or some ISO Latin." >&4
4501             +fi
4502             +$rm -f tebcdic.c tebcdic
4503             +set ebcdic
4504             +eval $setvar
4505             +
4506             : see what type file positions are declared as in the library
4507             rp="What is the type for file position used by fsetpos()?"
4508             set fpos_t fpostype long stdio.h sys/types.h
4509             @@ -10174,8 +10284,10 @@ EOM
4510             : The first arg can be int, unsigned, or size_t
4511             : The last arg may or may not be 'const'
4512             val=''
4513             + : void pointer has been seen but using that
4514             + : breaks the selectminbits test
4515             for xxx in 'fd_set *' 'int *'; do
4516             - for nfd in 'int' 'size_t' 'unsigned' ; do
4517             + for nfd in 'int' 'size_t' 'unsigned' 'unsigned long'; do
4518             for tmo in 'struct timeval *' 'const struct timeval *'; do
4519             case "$val" in
4520             '') try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
4521             @@ -10207,6 +10319,100 @@ EOM
4522             ;;
4523             esac
4524            
4525             +: check for the select 'width'
4526             +case "$selectminbits" in
4527             +'') case "$d_select" in
4528             + $define)
4529             + $cat <
4530             +
4531             +Checking to see on how many bits at a time your select() operates...
4532             +EOM
4533             + $cat >try.c <
4534             +#include
4535             +#$i_time I_TIME
4536             +#$i_systime I_SYS_TIME
4537             +#$i_systimek I_SYS_TIME_KERNEL
4538             +#ifdef I_TIME
4539             +# include
4540             +#endif
4541             +#ifdef I_SYS_TIME
4542             +# ifdef I_SYS_TIME_KERNEL
4543             +# define KERNEL
4544             +# endif
4545             +# include
4546             +# ifdef I_SYS_TIME_KERNEL
4547             +# undef KERNEL
4548             +# endif
4549             +#endif
4550             +#$i_sysselct I_SYS_SELECT
4551             +#ifdef I_SYS_SELECT
4552             +#include
4553             +#endif
4554             +#include
4555             +$selecttype b;
4556             +#define S sizeof(*(b))
4557             +#define MINBITS 64
4558             +#define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
4559             +#define NBITS (NBYTES * 8)
4560             +int main() {
4561             + char s[NBYTES];
4562             + struct timeval t;
4563             + int i;
4564             + FILE* fp;
4565             + int fd;
4566             +
4567             + fclose(stdin);
4568             + fp = fopen("try.c", "r");
4569             + if (fp == 0)
4570             + exit(1);
4571             + fd = fileno(fp);
4572             + if (fd < 0)
4573             + exit(2);
4574             + b = ($selecttype)s;
4575             + for (i = 0; i < NBITS; i++)
4576             + FD_SET(i, b);
4577             + t.tv_sec = 0;
4578             + t.tv_usec = 0;
4579             + select(fd + 1, b, 0, 0, &t);
4580             + for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
4581             + printf("%d\n", i + 1);
4582             + return 0;
4583             +}
4584             +EOCP
4585             + set try
4586             + if eval $compile_ok; then
4587             + selectminbits=`./try`
4588             + case "$selectminbits" in
4589             + '') cat >&4 <
4590             +Cannot figure out on how many bits at a time your select() operates.
4591             +I'll play safe and guess it is 32 bits.
4592             +EOM
4593             + selectminbits=32
4594             + bits="32 bits"
4595             + ;;
4596             + 1) bits="1 bit" ;;
4597             + *) bits="$selectminbits bits" ;;
4598             + esac
4599             + echo "Your select() operates on $bits at a time." >&4
4600             + else
4601             + rp='What is the minimum number of bits your select() operates on?'
4602             + case "$byteorder" in
4603             + 1234|12345678) dflt=32 ;;
4604             + *) dflt=1 ;;
4605             + esac
4606             + . ./myread
4607             + val=$ans
4608             + selectminbits="$val"
4609             + fi
4610             + $rm -f try.* try
4611             + ;;
4612             + *) : no select, so pick a harmless default
4613             + selectminbits='32'
4614             + ;;
4615             + esac
4616             + ;;
4617             +esac
4618             +
4619             : Trace out the files included by signal.h, then look for SIGxxx names.
4620             : Remove SIGARRAYSIZE used by HPUX.
4621             : Remove SIGTYP void lines used by OS2.
4622             @@ -10415,7 +10621,13 @@ $eunicefix signal_cmd
4623             : generate list of signal names
4624             echo " "
4625             case "$sig_name_init" in
4626             -'')
4627             +'') doinit=yes ;;
4628             +*) case "$sig_num_init" in
4629             + ''|*,*) doinit=yes ;;
4630             + esac ;;
4631             +esac
4632             +case "$doinit" in
4633             +yes)
4634             echo "Generating a list of signal names and numbers..." >&4
4635             . ./signal_cmd
4636             sig_name=`$awk '{printf "%s ", $1}' signal.lst`
4637             @@ -10423,7 +10635,9 @@ case "$sig_name_init" in
4638             sig_name_init=`$awk 'BEGIN { printf "\"ZERO\", " }
4639             { printf "\"%s\", ", $1 }
4640             END { printf "0\n" }' signal.lst`
4641             - sig_num=`$awk 'BEGIN { printf "0, " }
4642             + sig_num=`$awk '{printf "%d ", $2}' signal.lst`
4643             + sig_num="0 $sig_num"
4644             + sig_num_init=`$awk 'BEGIN { printf "0, " }
4645             { printf "%d, ", $2}
4646             END { printf "0\n"}' signal.lst`
4647             ;;
4648             @@ -10787,7 +11001,13 @@ $rm -f try.c
4649             EOS
4650             chmod +x ccsym
4651             $eunicefix ccsym
4652             -./ccsym | $sort | $uniq >ccsym.raw
4653             +./ccsym > ccsym1.raw
4654             +if $test -s ccsym1.raw; then
4655             + $sort ccsym1.raw | $uniq >ccsym.raw
4656             +else
4657             + mv ccsym1.raw ccsym.raw
4658             +fi
4659             +
4660             $awk '/\=/ { print $0; next }
4661             { print $0"=1" }' ccsym.raw >ccsym.list
4662             $awk '{ print $0"=1" }' Cppsym.true >ccsym.true
4663             @@ -11012,10 +11232,6 @@ eval $inhdr
4664             set sys/resource.h i_sysresrc
4665             eval $inhdr
4666            
4667             -: see if sys/stat.h is available
4668             -set sys/stat.h i_sysstat
4669             -eval $inhdr
4670             -
4671             : see if this is a sys/un.h system
4672             set sys/un.h i_sysun
4673             eval $inhdr
4674             @@ -11152,6 +11368,7 @@ for xxx in $known_extensions ; do
4675             esac
4676             ;;
4677             IPC/SysV|ipc/sysv)
4678             + : XXX Do we need a useipcsysv variable here
4679             case "${d_msg}${d_sem}${d_shm}" in
4680             *"${define}"*) avail_ext="$avail_ext $xxx" ;;
4681             esac
4682             @@ -11731,6 +11948,7 @@ i_values='$i_values'
4683             i_varargs='$i_varargs'
4684             i_varhdr='$i_varhdr'
4685             i_vfork='$i_vfork'
4686             +ignore_versioned_solibs='$ignore_versioned_solibs'
4687             incpath='$incpath'
4688             inews='$inews'
4689             installarchlib='$installarchlib'
4690             @@ -11839,6 +12057,7 @@ runnm='$runnm'
4691             scriptdir='$scriptdir'
4692             scriptdirexp='$scriptdirexp'
4693             sed='$sed'
4694             +selectminbits='$selectminbits'
4695             selecttype='$selecttype'
4696             sendmail='$sendmail'
4697             sh='$sh'
4698             @@ -11851,6 +12070,7 @@ shsharp='$shsharp'
4699             sig_name='$sig_name'
4700             sig_name_init='$sig_name_init'
4701             sig_num='$sig_num'
4702             +sig_num_init='$sig_num_init'
4703             signal_t='$signal_t'
4704             sitearch='$sitearch'
4705             sitearchexp='$sitearchexp'
4706             --- Makefile.SH
4707             +++ Makefile.SH
4708             @@ -644,3 +644,83 @@ case `pwd` in
4709             ;;
4710             esac
4711             $rm -f $firstmakefile
4712             +
4713             +# Now do any special processing required before building.
4714             +
4715             +case "$ebcdic" in
4716             +$define)
4717             + xxx=''
4718             + echo "This is an EBCDIC system, checking if any parser files need regenerating." >&4
4719             +case "$osname" in
4720             +os390)
4721             + rm -f y.tab.c y.tab.h
4722             + yacc -d perly.y >/dev/null 2>&1
4723             + if cmp -s y.tab.c perly.c; then
4724             + rm -f y.tab.c
4725             + else
4726             + echo "perly.y -> perly.c" >&2
4727             + mv -f y.tab.c perly.c
4728             + chmod u+w perly.c
4729             + sed -e '/^#include "perl\.h"/a\
4730             +\
4731             +#define yydebug PL_yydebug\
4732             +#define yynerrs PL_yynerrs\
4733             +#define yyerrflag PL_yyerrflag\
4734             +#define yychar PL_yychar\
4735             +#define yyval PL_yyval\
4736             +#define yylval PL_yylval' \
4737             + -e '/YYSTYPE *yyval;/D' \
4738             + -e '/YYSTYPE *yylval;/D' \
4739             + -e '/int yychar,/,/yynerrs;/D' \
4740             + -e 's/int yydebug = 0;/yydebug = 0;/' \
4741             + -e 's/[^_]realloc(/PerlMem_realloc(/g' \
4742             + -e 's/fprintf *( *stderr *,/PerlIO_printf(Perl_debug_log,/g' \
4743             + -e 's/y\.tab/perly/g' perly.c >perly.tmp && mv perly.tmp perly.c
4744             + xxx="$xxx perly.c"
4745             + fi
4746             + if cmp -s y.tab.h perly.h; then
4747             + rm -f y.tab.h
4748             + else
4749             + echo "perly.y -> perly.h" >&2
4750             + mv -f y.tab.h perly.h
4751             + xxx="$xxx perly.h"
4752             + fi
4753             + if cd x2p
4754             + then
4755             + rm -f y.tab.c y.tab.h
4756             + yacc a2p.y >/dev/null 2>&1
4757             + if cmp -s y.tab.c a2p.c
4758             + then
4759             + rm -f y.tab.c
4760             + else
4761             + echo "a2p.y -> a2p.c" >&2
4762             + mv -f y.tab.c a2p.c
4763             + chmod u+w a2p.c
4764             + sed -e 's/fprintf *( *stderr *,/PerlIO_printf(Perl_debug_log,/g' \
4765             + -e 's/y\.tab/a2p/g' a2p.c >a2p.tmp && mv a2p.tmp a2p.c
4766             + xxx="$xxx a2p.c"
4767             + fi
4768             + # In case somebody yacc -d:ed the a2p.y.
4769             + if test -f y.tab.h
4770             + then
4771             + if cmp -s y.tab.h a2p.h
4772             + then
4773             + rm -f y.tab.h
4774             + else
4775             + echo "a2p.h -> a2p.h" >&2
4776             + mv -f y.tab.h a2p.h
4777             + xxx="$xxx a2p.h"
4778             + fi
4779             + fi
4780             + cd ..
4781             + fi
4782             + ;;
4783             +*)
4784             + echo "'$osname' is an EBCDIC system I don't know that well." >&4
4785             + ;;
4786             +esac
4787             + case "$xxx" in
4788             + '') echo "No parser files were regenerated. That's okay." >&2 ;;
4789             + esac
4790             + ;;
4791             +esac
4792             --- config_h.SH
4793             +++ config_h.SH
4794             @@ -1813,7 +1813,7 @@ sed <config.h -e 's!^#undef\(.*/\)\*!/\*#define\1 \*!' -e 's!^#un-
4795             * the sig_name list.
4796             */
4797             #define SIG_NAME $sig_name_init /**/
4798             -#define SIG_NUM $sig_num /**/
4799             +#define SIG_NUM $sig_num_init /**/
4800            
4801             /* VOIDFLAGS:
4802             * This symbol indicates how much support of the void type is given by this
4803             @@ -1902,6 +1902,15 @@ sed <config.h -e 's!^#undef\(.*/\)\*!/\*#define\1 \*!' -e 's!^#un-
4804             #define PRIVLIB "$privlib" /**/
4805             #define PRIVLIB_EXP "$privlibexp" /**/
4806            
4807             +/* SELECT_MIN_BITS:
4808             + * This symbol holds the minimum number of bits operated by select.
4809             + * That is, if you do select(n, ...), how many bits at least will be
4810             + * cleared in the masks if some activity is detected. Usually this
4811             + * is either n or 32*ceil(n/32), especially many little-endians do
4812             + * the latter. This is only useful if you have select(), naturally.
4813             + */
4814             +#define SELECT_MIN_BITS $selectminbits /**/
4815             +
4816             /* SITEARCH:
4817             * This symbol contains the name of the private library for this package.
4818             * The library is private in the sense that it needn't be in anyone's
4819             --- pp_sys.c
4820             +++ pp_sys.c
4821             @@ -56,7 +56,10 @@ extern "C" int syscall(unsigned long,...);
4822            
4823             /* XXX Configure test needed.
4824             h_errno might not be a simple 'int', especially for multi-threaded
4825             - applications. HOST_NOT_FOUND is typically defined in .
4826             + applications, see "extern int errno in perl.h". Creating such
4827             + a test requires taking into account the differences between
4828             + compiling multithreaded and singlethreaded ($ccflags et al).
4829             + HOST_NOT_FOUND is typically defined in .
4830             */
4831             #if defined(HOST_NOT_FOUND) && !defined(h_errno)
4832             extern int h_errno;
4833             @@ -753,12 +756,17 @@ PP(pp_sselect)
4834             maxlen = j;
4835             }
4836            
4837             +/* little endians can use vecs directly */
4838             #if BYTEORDER == 0x1234 || BYTEORDER == 0x12345678
4839             -/* XXX Configure test needed. */
4840             -#if defined(__linux__) || defined(OS2) || defined(NeXT) || defined(__osf__) || defined(sun)
4841             - growsize = sizeof(fd_set);
4842             +# if SELECT_MIN_BITS > 1
4843             + /* If SELECT_MIN_BITS is greater than one we most probably will want
4844             + * to align the sizes with SELECT_MIN_BITS/8 because for example
4845             + * in many little-endian (Intel, Alpha) systems (Linux, OS/2, Digital
4846             + * UNIX, Solaris, NeXT) the smallest quantum select() operates on
4847             + * (sets bit) is 32 bits. */
4848             + growsize = maxlen + (SELECT_MIN_BITS/8 - (maxlen % (SELECT_MIN_BITS/8)));
4849             #else
4850             - growsize = maxlen; /* little endians can use vecs directly */
4851             + growsize = sizeof(fd_set);
4852             #endif
4853             #else
4854             #ifdef NFDBITS
4855             END
4856             }
4857              
4858             sub _patch_5_005 {
4859 0     0     _patch(<<'END');
4860             --- Configure
4861             +++ Configure
4862             @@ -21,7 +21,7 @@
4863             # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
4864             #
4865             # Generated on Tue Jul 7 10:10:21 EDT 1998 [metaconfig 3.0 PL70]
4866             -# (with additional metaconfig patches by doughera@lafayette.edu)
4867             +# (with additional metaconfig patches by jhi@iki.fi)
4868            
4869             cat >/tmp/c1$$ <
4870             ARGGGHHHH!!!!!
4871             @@ -56,33 +56,6 @@ case "$0" in
4872             ;;
4873             esac
4874            
4875             -: the newline for tr
4876             -if test X"$trnl" = X; then
4877             - case "`echo foo|tr '\n' x 2>/dev/null`" in
4878             - foox)
4879             - trnl='\n'
4880             - ;;
4881             - esac
4882             -fi
4883             -if test X"$trnl" = X; then
4884             - case "`echo foo|tr '\012' x 2>/dev/null`" in
4885             - foox)
4886             - trnl='\012'
4887             - ;;
4888             - esac
4889             -fi
4890             -if test -n "$DJGPP"; then
4891             - trnl='\012'
4892             -fi
4893             -if test X"$trnl" = X; then
4894             - cat <&2
4895             -
4896             -$me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
4897             -
4898             -EOM
4899             - exit 1
4900             -fi
4901             -
4902             : Proper separator for the PATH environment variable
4903             p_=:
4904             : On OS/2 this directory should exist if this is not floppy only system :-]
4905             @@ -391,7 +364,6 @@ d_getservprotos=''
4906             d_getsbyname=''
4907             d_getsbyport=''
4908             d_gnulibc=''
4909             -i_arpainet=''
4910             d_htonl=''
4911             d_inetaton=''
4912             d_isascii=''
4913             @@ -540,6 +512,7 @@ dlsrc=''
4914             ld=''
4915             lddlflags=''
4916             usedl=''
4917             +ebcdic=''
4918             doublesize=''
4919             fpostype=''
4920             gidtype=''
4921             @@ -548,6 +521,7 @@ h_fcntl=''
4922             h_sysfile=''
4923             db_hashtype=''
4924             db_prefixtype=''
4925             +i_arpainet=''
4926             i_db=''
4927             i_dbm=''
4928             i_rpcsvcdbm=''
4929             @@ -633,6 +607,7 @@ libpth=''
4930             loclibpth=''
4931             plibpth=''
4932             xlibpth=''
4933             +ignore_versioned_solibs=''
4934             libs=''
4935             lns=''
4936             lseektype=''
4937             @@ -697,11 +672,13 @@ randbits=''
4938             installscript=''
4939             scriptdir=''
4940             scriptdirexp=''
4941             +selectminbits=''
4942             selecttype=''
4943             sh=''
4944             sig_name=''
4945             sig_name_init=''
4946             sig_num=''
4947             +sig_num_init=''
4948             installsitearch=''
4949             sitearch=''
4950             sitearchexp=''
4951             @@ -719,6 +696,7 @@ startperl=''
4952             startsh=''
4953             stdchar=''
4954             sysman=''
4955             +trnl=''
4956             uidtype=''
4957             nm_opt=''
4958             nm_so_opt=''
4959             @@ -733,7 +711,6 @@ mips_type=''
4960             usrinc=''
4961             defvoidused=''
4962             voidflags=''
4963             -ebcdic=''
4964             CONFIG=''
4965            
4966             define='define'
4967             @@ -836,6 +813,8 @@ plibpth=''
4968            
4969             : default library list
4970             libswanted=''
4971             +: some systems want only to use the non-versioned libso:s
4972             +ignore_versioned_solibs=''
4973             : Possible local include directories to search.
4974             : Set locincpth to "" in a hint file to defeat local include searches.
4975             locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
4976             @@ -904,7 +883,7 @@ case "$sh" in
4977             $me: Fatal Error: I can't find a Bourne Shell anywhere.
4978            
4979             Usually it's in /bin/sh. How did you even get this far?
4980             -Please contact me (Andy Dougherty) at doughera@lafayette.edu and
4981             +Please contact me (Jarkko Hietaniemi) at jhi@iki.fi and
4982             we'll try to straighten this all out.
4983             EOM
4984             exit 1
4985             @@ -1240,7 +1219,7 @@ cat >extract <<'EOS'
4986             CONFIG=true
4987             echo "Doing variable substitutions on .SH files..."
4988             if test -f $src/MANIFEST; then
4989             - set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH'`
4990             + set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH$'`
4991             else
4992             echo "(Looking for .SH files under the source directory.)"
4993             set x `(cd $src; find . -name "*.SH" -print)`
4994             @@ -1373,7 +1352,7 @@ THIS PACKAGE SEEMS TO BE INCOMPLETE.
4995             You have the option of continuing the configuration process, despite the
4996             distinct possibility that your kit is damaged, by typing 'y'es. If you
4997             do, don't blame me if something goes wrong. I advise you to type 'n'o
4998             -and contact the author (doughera@lafayette.edu).
4999             +and contact the author (jhi@iki.fi).
5000            
5001             EOM
5002             echo $n "Continue? [n] $c" >&4
5003             @@ -1396,6 +1375,30 @@ else
5004             fi
5005             rm -f missing x??
5006            
5007             +echo " "
5008             +: Find the appropriate value for a newline for tr
5009             +if test -n "$DJGPP"; then
5010             + trnl='\012'
5011             +fi
5012             +if test X"$trnl" = X; then
5013             + case "`echo foo|tr '\n' x 2>/dev/null`" in
5014             + foox) trnl='\n' ;;
5015             + esac
5016             +fi
5017             +if test X"$trnl" = X; then
5018             + case "`echo foo|tr '\012' x 2>/dev/null`" in
5019             + foox) trnl='\012' ;;
5020             + esac
5021             +fi
5022             +if test X"$trnl" = X; then
5023             + cat <&2
5024             +
5025             +$me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
5026             +
5027             +EOM
5028             + exit 1
5029             +fi
5030             +
5031             : compute the number of columns on the terminal for proper question formatting
5032             case "$COLUMNS" in
5033             '') COLUMNS='80';;
5034             @@ -1574,7 +1577,7 @@ Much effort has been expended to ensure that this shell script will run on any
5035             Unix system. If despite that it blows up on yours, your best bet is to edit
5036             Configure and run it again. If you can't run Configure for some reason,
5037             you'll have to generate a config.sh file by hand. Whatever problems you
5038             -have, let me (doughera@lafayette.edu) know how I blew it.
5039             +have, let me (jhi@iki.fi) know how I blew it.
5040            
5041             This installation script affects things in two ways:
5042            
5043             @@ -1841,14 +1844,14 @@ ABYZ)
5044             *C9D1*|*c9d1*)
5045             echo "Hey, this might be EBCDIC." >&4
5046             if test "X$up" = X -o "X$low" = X; then
5047             - case "`echo IJ | tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
5048             + case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
5049             ij) up='[A-IJ-RS-Z]'
5050             low='[a-ij-rs-z]'
5051             ;;
5052             esac
5053             fi
5054             if test "X$up" = X -o "X$low" = X; then
5055             - case "`echo IJ | tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
5056             + case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
5057             ij) up='A-IJ-RS-Z'
5058             low='a-ij-rs-z'
5059             ;;
5060             @@ -1941,7 +1944,7 @@ EOM
5061             (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/ /g' >&4
5062             dflt=''
5063             : Half the following guesses are probably wrong... If you have better
5064             - : tests or hints, please send them to doughera@lafayette.edu
5065             + : tests or hints, please send them to jhi@iki.fi
5066             : The metaconfig authors would also appreciate a copy...
5067             $test -f /irix && osname=irix
5068             $test -f /xenix && osname=sco_xenix
5069             @@ -2025,7 +2028,7 @@ EOM
5070             osvers="$3"
5071             ;;
5072             dynixptx*) osname=dynixptx
5073             - osvers="$3"
5074             + osvers=`echo "$4" | $sed 's/^v//'`
5075             ;;
5076             freebsd) osname=freebsd
5077             osvers="$3" ;;
5078             @@ -3454,7 +3457,11 @@ cat <<'EOT' >testcpp.c
5079             ABC.XYZ
5080             EOT
5081             cd ..
5082             +if test ! -f cppstdin; then
5083             echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
5084             +else
5085             + echo "Keeping your $hint cppstdin wrapper."
5086             +fi
5087             chmod 755 cppstdin
5088             wrapper=`pwd`/cppstdin
5089             ok='false'
5090             @@ -3705,7 +3712,8 @@ case "$libswanted" in
5091             esac
5092             for thislib in $libswanted; do
5093            
5094             - if xxx=`./loc lib$thislib.$so.[0-9]'*' X $libpth`; $test -f "$xxx"; then
5095             + if xxx=`./loc lib$thislib.$so.[0-9]'*' X $libpth`;
5096             + $test -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
5097             echo "Found -l$thislib (shared)."
5098             case " $dflt " in
5099             *"-l$thislib "*);;
5100             @@ -3992,10 +4000,21 @@ rmlist="$rmlist pdp11"
5101             : coherency check
5102             echo " "
5103             echo "Checking your choice of C compiler and flags for coherency..." >&4
5104             +$cat > try.c <<'EOF'
5105             +#include
5106             +main() { printf("Ok\n"); exit(0); }
5107             +EOF
5108             set X $cc $optimize $ccflags -o try $ldflags try.c $libs
5109             shift
5110             -$cat >try.msg <
5111             -I've tried to compile and run a simple program with:
5112             +$cat >try.msg <<'EOM'
5113             +I've tried to compile and run the following simple program:
5114             +
5115             +EOM
5116             +$cat try.c
5117             +
5118             +$cat >> try.msg <
5119             +
5120             +I used the command:
5121            
5122             $*
5123             ./try
5124             @@ -4003,10 +4022,6 @@ I've tried to compile and run a simple program with:
5125             and I got the following output:
5126            
5127             EOM
5128             -$cat > try.c <<'EOF'
5129             -#include
5130             -main() { printf("Ok\n"); exit(0); }
5131             -EOF
5132             dflt=y
5133             if sh -c "$cc $optimize $ccflags -o try $ldflags try.c $libs" >>try.msg 2>&1; then
5134             if sh -c './try' >>try.msg 2>&1; then
5135             @@ -4043,7 +4058,7 @@ y)
5136             $cat try.msg >&4
5137             case "$knowitall" in
5138             '')
5139             - echo "(The supplied flags might be incorrect with this C compiler.)"
5140             + echo "(The supplied flags or libraries might be incorrect.)"
5141             ;;
5142             *) dflt=n;;
5143             esac
5144             @@ -4161,9 +4176,8 @@ eval $inhdr
5145             : determine which malloc to compile in
5146             echo " "
5147             case "$usemymalloc" in
5148             -''|y*|true) dflt='y' ;;
5149             -n*|false) dflt='n' ;;
5150             -*) dflt="$usemymalloc" ;;
5151             +''|[yY]*|true|$define) dflt='y' ;;
5152             +*) dflt='n' ;;
5153             esac
5154             rp="Do you wish to attempt to use the malloc that comes with $package?"
5155             . ./myread
5156             @@ -4265,7 +4279,7 @@ understands function prototypes. Unfortunately, your C compiler
5157             $cc $ccflags
5158             doesn't seem to understand them. Sorry about that.
5159            
5160             -If GNU cc is avaiable for your system, perhaps you could try that instead.
5161             +If GNU cc is available for your system, perhaps you could try that instead.
5162            
5163             Eventually, we hope to support building Perl with pre-ANSI compilers.
5164             If you would like to help in that effort, please contact .
5165             @@ -4320,32 +4334,6 @@ shift;
5166             $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs;'
5167            
5168             echo " "
5169             -echo "Determining whether or not we are on an EBCDIC system..." >&4
5170             -cat >tebcdic.c <
5171             -int main()
5172             -{
5173             - if ('M'==0xd4) return 0;
5174             - return 1;
5175             -}
5176             -EOM
5177             -val=$undef
5178             -set tebcdic
5179             -if eval $compile_ok; then
5180             - if ./tebcdic; then
5181             - echo "You have EBCDIC." >&4
5182             - val="$define"
5183             - else
5184             - echo "Nope, no EBCDIC. Assuming ASCII or some ISO Latin." >&4
5185             - fi
5186             -else
5187             - echo "I'm unable to compile the test program." >&4
5188             - echo "I'll asuume ASCII or some ISO Latin." >&4
5189             -fi
5190             -$rm -f tebcdic.c tebcdic
5191             -set ebcdic
5192             -eval $setvar
5193             -
5194             -echo " "
5195             echo "Checking for GNU C Library..." >&4
5196             cat >gnulibc.c <
5197             #include
5198             @@ -5159,7 +5147,7 @@ case "$shrpdir" in
5199             *) $cat >&4 <
5200             WARNING: Use of the shrpdir variable for the installation location of
5201             the shared $libperl is not supported. It was never documented and
5202             -will not work in this version. Let me (doughera@lafayette.edu)
5203             +will not work in this version. Let me (jhi@iki.fi)
5204             know of any problems this may cause.
5205            
5206             EOM
5207             @@ -6715,6 +6703,10 @@ eval $setvar
5208             set difftime d_difftime
5209             eval $inlibc
5210            
5211             +: see if sys/stat.h is available
5212             +set sys/stat.h i_sysstat
5213             +eval $inhdr
5214             +
5215             : see if this is a dirent system
5216             echo " "
5217             if xinc=`./findhdr dirent.h`; $test "$xinc"; then
5218             @@ -6783,6 +6775,23 @@ set d_dirnamlen
5219             eval $setvar
5220             $rm -f try.c
5221            
5222             +hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
5223             +while $test $# -ge 2; do
5224             + case "$1" in
5225             + $define) echo "#include <$2>";;
5226             + esac ;
5227             + shift 2;
5228             +done > try.c;
5229             +echo "int main () { struct $struct foo; foo.$field = 0; }" >> try.c;
5230             +if eval $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
5231             + val="$define";
5232             +else
5233             + val="$undef";
5234             +fi;
5235             +set $varname;
5236             +eval $setvar;
5237             +$rm -f try.c try.o'
5238             +
5239             : see if dlerror exists
5240             xxx_runnm="$runnm"
5241             runnm=false
5242             @@ -7317,7 +7326,7 @@ esac
5243             set netinet/in.h i_niin sys/in.h i_sysin
5244             eval $inhdr
5245            
5246             -: see if this is an arpa/inet.h
5247             +: see if arpa/inet.h has to be included
5248             set arpa/inet.h i_arpainet
5249             eval $inhdr
5250            
5251             @@ -7643,6 +7652,27 @@ echo " "
5252             case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
5253             *"$undef"*) h_msg=false;;
5254             esac
5255             +
5256             +case "$osname" in
5257             +freebsd)
5258             + case "`ipcs 2>&1`" in
5259             + "SVID messages"*"not configured"*)
5260             + echo "But your $osname does not have the msg*(2) configured." >&4
5261             + h_msg=false
5262             + val="$undef"
5263             + set msgctl d_msgctl
5264             + eval $setvar
5265             + set msgget d_msgget
5266             + eval $setvar
5267             + set msgsnd d_msgsnd
5268             + eval $setvar
5269             + set msgrcv d_msgrcv
5270             + eval $setvar
5271             + ;;
5272             + esac
5273             + ;;
5274             +esac
5275             +
5276             : we could also check for sys/ipc.h ...
5277             if $h_msg && $test `./findhdr sys/msg.h`; then
5278             echo "You have the full msg*(2) library." >&4
5279             @@ -7671,7 +7701,7 @@ set poll d_poll
5280             eval $inlibc
5281            
5282            
5283             -: see whether the various POSIXish _yields exist within given cccmd
5284             +: see whether the various POSIXish _yields exist
5285             $cat >try.c <
5286             #include
5287             main() {
5288             @@ -8125,6 +8155,25 @@ echo " "
5289             case "$d_semctl$d_semget$d_semop" in
5290             *"$undef"*) h_sem=false;;
5291             esac
5292             +
5293             +case "$osname" in
5294             +freebsd)
5295             + case "`ipcs 2>&1`" in
5296             + "SVID messages"*"not configured"*)
5297             + echo "But your $osname does not have the sem*(2) configured." >&4
5298             + h_sem=false
5299             + val="$undef"
5300             + set semctl d_semctl
5301             + eval $setvar
5302             + set semget d_semget
5303             + eval $setvar
5304             + set semop d_semop
5305             + eval $setvar
5306             + ;;
5307             + esac
5308             + ;;
5309             +esac
5310             +
5311             : we could also check for sys/ipc.h ...
5312             if $h_sem && $test `./findhdr sys/sem.h`; then
5313             echo "You have the full sem*(2) library." >&4
5314             @@ -8161,6 +8210,31 @@ case "$d_sem" in
5315             $define)
5316             : see whether semctl IPC_STAT can use union semun
5317             echo " "
5318             + $cat > try.h <
5319             +#ifndef S_IRUSR
5320             +# ifdef S_IREAD
5321             +# define S_IRUSR S_IREAD
5322             +# define S_IWUSR S_IWRITE
5323             +# define S_IXUSR S_IEXEC
5324             +# else
5325             +# define S_IRUSR 0400
5326             +# define S_IWUSR 0200
5327             +# define S_IXUSR 0100
5328             +# endif
5329             +# define S_IRGRP (S_IRUSR>>3)
5330             +# define S_IWGRP (S_IWUSR>>3)
5331             +# define S_IXGRP (S_IXUSR>>3)
5332             +# define S_IROTH (S_IRUSR>>6)
5333             +# define S_IWOTH (S_IWUSR>>6)
5334             +# define S_IXOTH (S_IXUSR>>6)
5335             +#endif
5336             +#ifndef S_IRWXU
5337             +# define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
5338             +# define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
5339             +# define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
5340             +#endif
5341             +END
5342             +
5343             $cat > try.c <
5344             #include
5345             #include
5346             @@ -8235,6 +8309,7 @@ END
5347             #include
5348             #include
5349             #include
5350             +#include "try.h"
5351             #ifndef errno
5352             extern int errno;
5353             #endif
5354             @@ -8281,6 +8356,7 @@ END
5355             *) echo "You cannot use struct semid_ds * for semctl IPC_STAT." >&4
5356             ;;
5357             esac
5358             + $rm -f try.h
5359             ;;
5360             *) val="$undef"
5361            
5362             @@ -8471,6 +8547,27 @@ echo " "
5363             case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
5364             *"$undef"*) h_shm=false;;
5365             esac
5366             +
5367             +case "$osname" in
5368             +freebsd)
5369             + case "`ipcs 2>&1`" in
5370             + "SVID shared memory"*"not configured"*)
5371             + echo "But your $osname does not have the shm*(2) configured." >&4
5372             + h_shm=false
5373             + val="$undef"
5374             + set shmctl d_shmctl
5375             + evat $setvar
5376             + set shmget d_shmget
5377             + evat $setvar
5378             + set shmat d_shmat
5379             + evat $setvar
5380             + set shmdt d_shmdt
5381             + evat $setvar
5382             + ;;
5383             + esac
5384             + ;;
5385             +esac
5386             +
5387             : we could also check for sys/ipc.h ...
5388             if $h_shm && $test `./findhdr sys/shm.h`; then
5389             echo "You have the full shm*(2) library." >&4
5390             @@ -8609,21 +8706,8 @@ eval $inlibc
5391            
5392             : see if stat knows about block sizes
5393             echo " "
5394             -xxx=`./findhdr sys/stat.h`
5395             -if $contains 'st_blocks;' "$xxx" >/dev/null 2>&1 ; then
5396             - if $contains 'st_blksize;' "$xxx" >/dev/null 2>&1 ; then
5397             - echo "Your stat() knows about block sizes." >&4
5398             - val="$define"
5399             - else
5400             - echo "Your stat() doesn't know about block sizes." >&4
5401             - val="$undef"
5402             - fi
5403             -else
5404             - echo "Your stat() doesn't know about block sizes." >&4
5405             - val="$undef"
5406             -fi
5407             -set d_statblks
5408             -eval $setvar
5409             +set d_statblks stat st_blocks $i_sysstat sys/stat.h
5410             +eval $hasfield
5411            
5412             : see if _ptr and _cnt from stdio act std
5413             echo " "
5414             @@ -9567,6 +9651,32 @@ EOCP
5415             esac
5416             $rm -f try.c try
5417            
5418             +echo " "
5419             +echo "Determining whether or not we are on an EBCDIC system..." >&4
5420             +$cat >tebcdic.c <
5421             +int main()
5422             +{
5423             + if ('M'==0xd4) return 0;
5424             + return 1;
5425             +}
5426             +EOM
5427             +val=$undef
5428             +set tebcdic
5429             +if eval $compile_ok; then
5430             + if ./tebcdic; then
5431             + echo "You have EBCDIC." >&4
5432             + val="$define"
5433             + else
5434             + echo "Nope, no EBCDIC. Assuming ASCII or some ISO Latin." >&4
5435             + fi
5436             +else
5437             + echo "I'm unable to compile the test program." >&4
5438             + echo "I'll assume ASCII or some ISO Latin." >&4
5439             +fi
5440             +$rm -f tebcdic.c tebcdic
5441             +set ebcdic
5442             +eval $setvar
5443             +
5444             : see what type file positions are declared as in the library
5445             rp="What is the type for file position used by fsetpos()?"
5446             set fpos_t fpostype long stdio.h sys/types.h
5447             @@ -10174,8 +10284,10 @@ EOM
5448             : The first arg can be int, unsigned, or size_t
5449             : The last arg may or may not be 'const'
5450             val=''
5451             + : void pointer has been seen but using that
5452             + : breaks the selectminbits test
5453             for xxx in 'fd_set *' 'int *'; do
5454             - for nfd in 'int' 'size_t' 'unsigned' ; do
5455             + for nfd in 'int' 'size_t' 'unsigned' 'unsigned long'; do
5456             for tmo in 'struct timeval *' 'const struct timeval *'; do
5457             case "$val" in
5458             '') try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
5459             @@ -10207,6 +10319,100 @@ EOM
5460             ;;
5461             esac
5462            
5463             +: check for the select 'width'
5464             +case "$selectminbits" in
5465             +'') case "$d_select" in
5466             + $define)
5467             + $cat <
5468             +
5469             +Checking to see on how many bits at a time your select() operates...
5470             +EOM
5471             + $cat >try.c <
5472             +#include
5473             +#$i_time I_TIME
5474             +#$i_systime I_SYS_TIME
5475             +#$i_systimek I_SYS_TIME_KERNEL
5476             +#ifdef I_TIME
5477             +# include
5478             +#endif
5479             +#ifdef I_SYS_TIME
5480             +# ifdef I_SYS_TIME_KERNEL
5481             +# define KERNEL
5482             +# endif
5483             +# include
5484             +# ifdef I_SYS_TIME_KERNEL
5485             +# undef KERNEL
5486             +# endif
5487             +#endif
5488             +#$i_sysselct I_SYS_SELECT
5489             +#ifdef I_SYS_SELECT
5490             +#include
5491             +#endif
5492             +#include
5493             +$selecttype b;
5494             +#define S sizeof(*(b))
5495             +#define MINBITS 64
5496             +#define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
5497             +#define NBITS (NBYTES * 8)
5498             +int main() {
5499             + char s[NBYTES];
5500             + struct timeval t;
5501             + int i;
5502             + FILE* fp;
5503             + int fd;
5504             +
5505             + fclose(stdin);
5506             + fp = fopen("try.c", "r");
5507             + if (fp == 0)
5508             + exit(1);
5509             + fd = fileno(fp);
5510             + if (fd < 0)
5511             + exit(2);
5512             + b = ($selecttype)s;
5513             + for (i = 0; i < NBITS; i++)
5514             + FD_SET(i, b);
5515             + t.tv_sec = 0;
5516             + t.tv_usec = 0;
5517             + select(fd + 1, b, 0, 0, &t);
5518             + for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
5519             + printf("%d\n", i + 1);
5520             + return 0;
5521             +}
5522             +EOCP
5523             + set try
5524             + if eval $compile_ok; then
5525             + selectminbits=`./try`
5526             + case "$selectminbits" in
5527             + '') cat >&4 <
5528             +Cannot figure out on how many bits at a time your select() operates.
5529             +I'll play safe and guess it is 32 bits.
5530             +EOM
5531             + selectminbits=32
5532             + bits="32 bits"
5533             + ;;
5534             + 1) bits="1 bit" ;;
5535             + *) bits="$selectminbits bits" ;;
5536             + esac
5537             + echo "Your select() operates on $bits at a time." >&4
5538             + else
5539             + rp='What is the minimum number of bits your select() operates on?'
5540             + case "$byteorder" in
5541             + 1234|12345678) dflt=32 ;;
5542             + *) dflt=1 ;;
5543             + esac
5544             + . ./myread
5545             + val=$ans
5546             + selectminbits="$val"
5547             + fi
5548             + $rm -f try.* try
5549             + ;;
5550             + *) : no select, so pick a harmless default
5551             + selectminbits='32'
5552             + ;;
5553             + esac
5554             + ;;
5555             +esac
5556             +
5557             : Trace out the files included by signal.h, then look for SIGxxx names.
5558             : Remove SIGARRAYSIZE used by HPUX.
5559             : Remove SIGTYP void lines used by OS2.
5560             @@ -10415,7 +10621,13 @@ $eunicefix signal_cmd
5561             : generate list of signal names
5562             echo " "
5563             case "$sig_name_init" in
5564             -'')
5565             +'') doinit=yes ;;
5566             +*) case "$sig_num_init" in
5567             + ''|*,*) doinit=yes ;;
5568             + esac ;;
5569             +esac
5570             +case "$doinit" in
5571             +yes)
5572             echo "Generating a list of signal names and numbers..." >&4
5573             . ./signal_cmd
5574             sig_name=`$awk '{printf "%s ", $1}' signal.lst`
5575             @@ -10423,7 +10635,9 @@ case "$sig_name_init" in
5576             sig_name_init=`$awk 'BEGIN { printf "\"ZERO\", " }
5577             { printf "\"%s\", ", $1 }
5578             END { printf "0\n" }' signal.lst`
5579             - sig_num=`$awk 'BEGIN { printf "0, " }
5580             + sig_num=`$awk '{printf "%d ", $2}' signal.lst`
5581             + sig_num="0 $sig_num"
5582             + sig_num_init=`$awk 'BEGIN { printf "0, " }
5583             { printf "%d, ", $2}
5584             END { printf "0\n"}' signal.lst`
5585             ;;
5586             @@ -10787,7 +11001,13 @@ $rm -f try.c
5587             EOS
5588             chmod +x ccsym
5589             $eunicefix ccsym
5590             -./ccsym | $sort | $uniq >ccsym.raw
5591             +./ccsym > ccsym1.raw
5592             +if $test -s ccsym1.raw; then
5593             + $sort ccsym1.raw | $uniq >ccsym.raw
5594             +else
5595             + mv ccsym1.raw ccsym.raw
5596             +fi
5597             +
5598             $awk '/\=/ { print $0; next }
5599             { print $0"=1" }' ccsym.raw >ccsym.list
5600             $awk '{ print $0"=1" }' Cppsym.true >ccsym.true
5601             @@ -11012,10 +11232,6 @@ eval $inhdr
5602             set sys/resource.h i_sysresrc
5603             eval $inhdr
5604            
5605             -: see if sys/stat.h is available
5606             -set sys/stat.h i_sysstat
5607             -eval $inhdr
5608             -
5609             : see if this is a sys/un.h system
5610             set sys/un.h i_sysun
5611             eval $inhdr
5612             @@ -11152,6 +11368,7 @@ for xxx in $known_extensions ; do
5613             esac
5614             ;;
5615             IPC/SysV|ipc/sysv)
5616             + : XXX Do we need a useipcsysv variable here
5617             case "${d_msg}${d_sem}${d_shm}" in
5618             *"${define}"*) avail_ext="$avail_ext $xxx" ;;
5619             esac
5620             @@ -11731,6 +11948,7 @@ i_values='$i_values'
5621             i_varargs='$i_varargs'
5622             i_varhdr='$i_varhdr'
5623             i_vfork='$i_vfork'
5624             +ignore_versioned_solibs='$ignore_versioned_solibs'
5625             incpath='$incpath'
5626             inews='$inews'
5627             installarchlib='$installarchlib'
5628             @@ -11839,6 +12057,7 @@ runnm='$runnm'
5629             scriptdir='$scriptdir'
5630             scriptdirexp='$scriptdirexp'
5631             sed='$sed'
5632             +selectminbits='$selectminbits'
5633             selecttype='$selecttype'
5634             sendmail='$sendmail'
5635             sh='$sh'
5636             @@ -11851,6 +12070,7 @@ shsharp='$shsharp'
5637             sig_name='$sig_name'
5638             sig_name_init='$sig_name_init'
5639             sig_num='$sig_num'
5640             +sig_num_init='$sig_num_init'
5641             signal_t='$signal_t'
5642             sitearch='$sitearch'
5643             sitearchexp='$sitearchexp'
5644             --- Makefile.SH
5645             +++ Makefile.SH
5646             @@ -644,3 +644,83 @@ case `pwd` in
5647             ;;
5648             esac
5649             $rm -f $firstmakefile
5650             +
5651             +# Now do any special processing required before building.
5652             +
5653             +case "$ebcdic" in
5654             +$define)
5655             + xxx=''
5656             + echo "This is an EBCDIC system, checking if any parser files need regenerating." >&4
5657             +case "$osname" in
5658             +os390)
5659             + rm -f y.tab.c y.tab.h
5660             + yacc -d perly.y >/dev/null 2>&1
5661             + if cmp -s y.tab.c perly.c; then
5662             + rm -f y.tab.c
5663             + else
5664             + echo "perly.y -> perly.c" >&2
5665             + mv -f y.tab.c perly.c
5666             + chmod u+w perly.c
5667             + sed -e '/^#include "perl\.h"/a\
5668             +\
5669             +#define yydebug PL_yydebug\
5670             +#define yynerrs PL_yynerrs\
5671             +#define yyerrflag PL_yyerrflag\
5672             +#define yychar PL_yychar\
5673             +#define yyval PL_yyval\
5674             +#define yylval PL_yylval' \
5675             + -e '/YYSTYPE *yyval;/D' \
5676             + -e '/YYSTYPE *yylval;/D' \
5677             + -e '/int yychar,/,/yynerrs;/D' \
5678             + -e 's/int yydebug = 0;/yydebug = 0;/' \
5679             + -e 's/[^_]realloc(/PerlMem_realloc(/g' \
5680             + -e 's/fprintf *( *stderr *,/PerlIO_printf(Perl_debug_log,/g' \
5681             + -e 's/y\.tab/perly/g' perly.c >perly.tmp && mv perly.tmp perly.c
5682             + xxx="$xxx perly.c"
5683             + fi
5684             + if cmp -s y.tab.h perly.h; then
5685             + rm -f y.tab.h
5686             + else
5687             + echo "perly.y -> perly.h" >&2
5688             + mv -f y.tab.h perly.h
5689             + xxx="$xxx perly.h"
5690             + fi
5691             + if cd x2p
5692             + then
5693             + rm -f y.tab.c y.tab.h
5694             + yacc a2p.y >/dev/null 2>&1
5695             + if cmp -s y.tab.c a2p.c
5696             + then
5697             + rm -f y.tab.c
5698             + else
5699             + echo "a2p.y -> a2p.c" >&2
5700             + mv -f y.tab.c a2p.c
5701             + chmod u+w a2p.c
5702             + sed -e 's/fprintf *( *stderr *,/PerlIO_printf(Perl_debug_log,/g' \
5703             + -e 's/y\.tab/a2p/g' a2p.c >a2p.tmp && mv a2p.tmp a2p.c
5704             + xxx="$xxx a2p.c"
5705             + fi
5706             + # In case somebody yacc -d:ed the a2p.y.
5707             + if test -f y.tab.h
5708             + then
5709             + if cmp -s y.tab.h a2p.h
5710             + then
5711             + rm -f y.tab.h
5712             + else
5713             + echo "a2p.h -> a2p.h" >&2
5714             + mv -f y.tab.h a2p.h
5715             + xxx="$xxx a2p.h"
5716             + fi
5717             + fi
5718             + cd ..
5719             + fi
5720             + ;;
5721             +*)
5722             + echo "'$osname' is an EBCDIC system I don't know that well." >&4
5723             + ;;
5724             +esac
5725             + case "$xxx" in
5726             + '') echo "No parser files were regenerated. That's okay." >&2 ;;
5727             + esac
5728             + ;;
5729             +esac
5730             --- config_h.SH
5731             +++ config_h.SH
5732             @@ -1813,7 +1813,7 @@ sed <config.h -e 's!^#undef\(.*/\)\*!/\*#define\1 \*!' -e 's!^#un-
5733             * the sig_name list.
5734             */
5735             #define SIG_NAME $sig_name_init /**/
5736             -#define SIG_NUM $sig_num /**/
5737             +#define SIG_NUM $sig_num_init /**/
5738            
5739             /* VOIDFLAGS:
5740             * This symbol indicates how much support of the void type is given by this
5741             @@ -1902,6 +1902,15 @@ sed <config.h -e 's!^#undef\(.*/\)\*!/\*#define\1 \*!' -e 's!^#un-
5742             #define PRIVLIB "$privlib" /**/
5743             #define PRIVLIB_EXP "$privlibexp" /**/
5744            
5745             +/* SELECT_MIN_BITS:
5746             + * This symbol holds the minimum number of bits operated by select.
5747             + * That is, if you do select(n, ...), how many bits at least will be
5748             + * cleared in the masks if some activity is detected. Usually this
5749             + * is either n or 32*ceil(n/32), especially many little-endians do
5750             + * the latter. This is only useful if you have select(), naturally.
5751             + */
5752             +#define SELECT_MIN_BITS $selectminbits /**/
5753             +
5754             /* SITEARCH:
5755             * This symbol contains the name of the private library for this package.
5756             * The library is private in the sense that it needn't be in anyone's
5757             --- pp_sys.c
5758             +++ pp_sys.c
5759             @@ -56,7 +56,10 @@ extern "C" int syscall(unsigned long,...);
5760            
5761             /* XXX Configure test needed.
5762             h_errno might not be a simple 'int', especially for multi-threaded
5763             - applications. HOST_NOT_FOUND is typically defined in .
5764             + applications, see "extern int errno in perl.h". Creating such
5765             + a test requires taking into account the differences between
5766             + compiling multithreaded and singlethreaded ($ccflags et al).
5767             + HOST_NOT_FOUND is typically defined in .
5768             */
5769             #if defined(HOST_NOT_FOUND) && !defined(h_errno)
5770             extern int h_errno;
5771             @@ -753,12 +756,17 @@ PP(pp_sselect)
5772             maxlen = j;
5773             }
5774            
5775             +/* little endians can use vecs directly */
5776             #if BYTEORDER == 0x1234 || BYTEORDER == 0x12345678
5777             -/* XXX Configure test needed. */
5778             -#if defined(__linux__) || defined(OS2) || defined(NeXT) || defined(__osf__)
5779             - growsize = sizeof(fd_set);
5780             +# if SELECT_MIN_BITS > 1
5781             + /* If SELECT_MIN_BITS is greater than one we most probably will want
5782             + * to align the sizes with SELECT_MIN_BITS/8 because for example
5783             + * in many little-endian (Intel, Alpha) systems (Linux, OS/2, Digital
5784             + * UNIX, Solaris, NeXT) the smallest quantum select() operates on
5785             + * (sets bit) is 32 bits. */
5786             + growsize = maxlen + (SELECT_MIN_BITS/8 - (maxlen % (SELECT_MIN_BITS/8)));
5787             #else
5788             - growsize = maxlen; /* little endians can use vecs directly */
5789             + growsize = sizeof(fd_set);
5790             #endif
5791             #else
5792             #ifdef NFDBITS
5793             END
5794             }
5795              
5796             sub _patch_errno_gcc5 {
5797 0     0     my $perlver = shift;
5798 0           my $num = _norm_ver( $perlver );
5799 0 0         return unless $num < 5.021009;
5800 0 0 0       return if $num > 5.020002 && $num < 5.021;
5801 0 0         if ( $num < 5.006 ) {
    0          
    0          
    0          
    0          
5802 0           warn "The Errno GCC 5 patch only goes back as far as v5.6.0\n";
5803 0           warn "You will have to generate your own patch to go farther back\n";
5804 0           return;
5805             }
5806             elsif ( $num < 5.006001 ) {
5807 0           _patch(<<'END');
5808             diff --git a/ext/Errno/Errno_pm.PL b/ext/Errno/Errno_pm.PL
5809             index df68dc3..8385048 100644
5810             --- ext/Errno/Errno_pm.PL
5811             +++ ext/Errno/Errno_pm.PL
5812             @@ -143,16 +143,26 @@ sub write_errno_pm {
5813            
5814             # invoke CPP and read the output
5815            
5816             + my $inhibit_linemarkers = '';
5817             + if ($Config{gccversion} =~ /\A(\d+)\./ and $1 >= 5) {
5818             + # GCC 5.0 interleaves expanded macros with line numbers breaking
5819             + # each line into multiple lines. RT#123784
5820             + $inhibit_linemarkers = ' -P';
5821             + }
5822             +
5823             if ($^O eq 'VMS') {
5824             - my $cpp = "$Config{cppstdin} $Config{cppflags} $Config{cppminus}";
5825             + my $cpp = "$Config{cppstdin} $Config{cppflags}" .
5826             + $inhibit_linemarkers . " $Config{cppminus}";
5827             $cpp =~ s/sys\$input//i;
5828             open(CPPO,"$cpp errno.c |") or
5829             die "Cannot exec $Config{cppstdin}";
5830             } elsif ($^O eq 'MSWin32') {
5831             - open(CPPO,"$Config{cpprun} $Config{cppflags} errno.c |") or
5832             - die "Cannot run '$Config{cpprun} $Config{cppflags} errno.c'";
5833             + my $cpp = "$Config{cpprun} $Config{cppflags}" .
5834             + $inhibit_linemarkers;
5835             + open(CPPO,"$cpp errno.c |") or
5836             + die "Cannot run '$cpp errno.c'";
5837             } else {
5838             - my $cpp = default_cpp();
5839             + my $cpp = default_cpp() . $inhibit_linemarkers;
5840             open(CPPO,"$cpp < errno.c |")
5841             or die "Cannot exec $cpp";
5842             }
5843             END
5844             }
5845             elsif ( $num < 5.007002 ) { # v5.6.0 et al
5846 0           _patch(<<'END');
5847             diff --git a/ext/Errno/Errno_pm.PL b/ext/Errno/Errno_pm.PL
5848             index 3f2f3e0..d8fe44e 100644
5849             --- ext/Errno/Errno_pm.PL
5850             +++ ext/Errno/Errno_pm.PL
5851             @@ -172,16 +172,26 @@ sub write_errno_pm {
5852             unless ($^O eq 'MacOS') { # trust what we have
5853             # invoke CPP and read the output
5854            
5855             + my $inhibit_linemarkers = '';
5856             + if ($Config{gccversion} =~ /\A(\d+)\./ and $1 >= 5) {
5857             + # GCC 5.0 interleaves expanded macros with line numbers breaking
5858             + # each line into multiple lines. RT#123784
5859             + $inhibit_linemarkers = ' -P';
5860             + }
5861             +
5862             if ($^O eq 'VMS') {
5863             - my $cpp = "$Config{cppstdin} $Config{cppflags} $Config{cppminus}";
5864             + my $cpp = "$Config{cppstdin} $Config{cppflags}" .
5865             + $inhibit_linemarkers . " $Config{cppminus}";
5866             $cpp =~ s/sys\$input//i;
5867             open(CPPO,"$cpp errno.c |") or
5868             die "Cannot exec $Config{cppstdin}";
5869             } elsif ($^O eq 'MSWin32') {
5870             - open(CPPO,"$Config{cpprun} $Config{cppflags} errno.c |") or
5871             - die "Cannot run '$Config{cpprun} $Config{cppflags} errno.c'";
5872             + my $cpp = "$Config{cpprun} $Config{cppflags}" .
5873             + $inhibit_linemarkers;
5874             + open(CPPO,"$cpp errno.c |") or
5875             + die "Cannot run '$cpp errno.c'";
5876             } else {
5877             - my $cpp = default_cpp();
5878             + my $cpp = default_cpp() . $inhibit_linemarkers;
5879             open(CPPO,"$cpp < errno.c |")
5880             or die "Cannot exec $cpp";
5881             }
5882             END
5883             }
5884             elsif ( $num < 5.007003 ) { # v5.7.2
5885 0           _patch(<<'END');
5886             diff --git a/ext/Errno/Errno_pm.PL b/ext/Errno/Errno_pm.PL
5887             index 3f2f3e0..d8fe44e 100644
5888             --- ext/Errno/Errno_pm.PL
5889             +++ ext/Errno/Errno_pm.PL
5890             @@ -172,16 +172,26 @@ sub write_errno_pm {
5891             unless ($^O eq 'MacOS') { # trust what we have
5892             # invoke CPP and read the output
5893            
5894             + my $inhibit_linemarkers = '';
5895             + if ($Config{gccversion} =~ /\A(\d+)\./ and $1 >= 5) {
5896             + # GCC 5.0 interleaves expanded macros with line numbers breaking
5897             + # each line into multiple lines. RT#123784
5898             + $inhibit_linemarkers = ' -P';
5899             + }
5900             +
5901             if ($^O eq 'VMS') {
5902             - my $cpp = "$Config{cppstdin} $Config{cppflags} $Config{cppminus}";
5903             + my $cpp = "$Config{cppstdin} $Config{cppflags}" .
5904             + $inhibit_linemarkers . " $Config{cppminus}";
5905             $cpp =~ s/sys\$input//i;
5906             open(CPPO,"$cpp errno.c |") or
5907             die "Cannot exec $Config{cppstdin}";
5908             } elsif ($^O eq 'MSWin32' || $^O eq 'NetWare') {
5909             - open(CPPO,"$Config{cpprun} $Config{cppflags} errno.c |") or
5910             - die "Cannot run '$Config{cpprun} $Config{cppflags} errno.c'";
5911             + my $cpp = "$Config{cpprun} $Config{cppflags}" .
5912             + $inhibit_linemarkers;
5913             + open(CPPO,"$cpp errno.c |") or
5914             + die "Cannot run '$cpp errno.c'";
5915             } else {
5916             - my $cpp = default_cpp();
5917             + my $cpp = default_cpp() . $inhibit_linemarkers;
5918             open(CPPO,"$cpp < errno.c |")
5919             or die "Cannot exec $cpp";
5920             }
5921             END
5922             }
5923             elsif ( $num < 5.008009 ) {
5924 0           _patch(<<'END');
5925             diff --git a/ext/Errno/Errno_pm.PL b/ext/Errno/Errno_pm.PL
5926             index d8a0ab3..796e2f1 100644
5927             --- ext/Errno/Errno_pm.PL
5928             +++ ext/Errno/Errno_pm.PL
5929             @@ -235,16 +235,26 @@ sub write_errno_pm {
5930             unless ($^O eq 'MacOS' || $^O eq 'beos') { # trust what we have / get later
5931             # invoke CPP and read the output
5932            
5933             + my $inhibit_linemarkers = '';
5934             + if ($Config{gccversion} =~ /\A(\d+)\./ and $1 >= 5) {
5935             + # GCC 5.0 interleaves expanded macros with line numbers breaking
5936             + # each line into multiple lines. RT#123784
5937             + $inhibit_linemarkers = ' -P';
5938             + }
5939             +
5940             if ($^O eq 'VMS') {
5941             - my $cpp = "$Config{cppstdin} $Config{cppflags} $Config{cppminus}";
5942             + my $cpp = "$Config{cppstdin} $Config{cppflags}" .
5943             + $inhibit_linemarkers . " $Config{cppminus}";
5944             $cpp =~ s/sys\$input//i;
5945             open(CPPO,"$cpp errno.c |") or
5946             die "Cannot exec $Config{cppstdin}";
5947             } elsif ($^O eq 'MSWin32' || $^O eq 'NetWare') {
5948             - open(CPPO,"$Config{cpprun} $Config{cppflags} errno.c |") or
5949             - die "Cannot run '$Config{cpprun} $Config{cppflags} errno.c'";
5950             + my $cpp = "$Config{cpprun} $Config{cppflags}" .
5951             + $inhibit_linemarkers;
5952             + open(CPPO,"$cpp errno.c |") or
5953             + die "Cannot run '$cpp errno.c'";
5954             } else {
5955             - my $cpp = default_cpp();
5956             + my $cpp = default_cpp() . $inhibit_linemarkers;
5957             open(CPPO,"$cpp < errno.c |")
5958             or die "Cannot exec $cpp";
5959             }
5960             END
5961             }
5962             else {
5963 0           _patch(<<'END');
5964             diff --git a/ext/Errno/Errno_pm.PL b/ext/Errno/Errno_pm.PL
5965             index 3dadfce..c6bfa06 100644
5966             --- ext/Errno/Errno_pm.PL
5967             +++ ext/Errno/Errno_pm.PL
5968             @@ -215,20 +215,31 @@ sub write_errno_pm {
5969             { # BeOS (support now removed) did not enter this block
5970             # invoke CPP and read the output
5971            
5972             + my $inhibit_linemarkers = '';
5973             + if ($Config{gccversion} =~ /\A(\d+)\./ and $1 >= 5) {
5974             + # GCC 5.0 interleaves expanded macros with line numbers breaking
5975             + # each line into multiple lines. RT#123784
5976             + $inhibit_linemarkers = ' -P';
5977             + }
5978             +
5979             if ($^O eq 'VMS') {
5980             - my $cpp = "$Config{cppstdin} $Config{cppflags} $Config{cppminus}";
5981             + my $cpp = "$Config{cppstdin} $Config{cppflags}" .
5982             + $inhibit_linemarkers . " $Config{cppminus}";
5983             $cpp =~ s/sys\$input//i;
5984             open(CPPO,"$cpp errno.c |") or
5985             die "Cannot exec $Config{cppstdin}";
5986             } elsif ($IsMSWin32 || $^O eq 'NetWare') {
5987             - open(CPPO,"$Config{cpprun} $Config{cppflags} errno.c |") or
5988             - die "Cannot run '$Config{cpprun} $Config{cppflags} errno.c'";
5989             + my $cpp = "$Config{cpprun} $Config{cppflags}" .
5990             + $inhibit_linemarkers;
5991             + open(CPPO,"$cpp errno.c |") or
5992             + die "Cannot run '$cpp errno.c'";
5993             } elsif ($IsSymbian) {
5994             - my $cpp = "gcc -E -I$ENV{SDK}\\epoc32\\include\\libc -";
5995             + my $cpp = "gcc -E -I$ENV{SDK}\\epoc32\\include\\libc" .
5996             + $inhibit_linemarkers ." -";
5997             open(CPPO,"$cpp < errno.c |")
5998             or die "Cannot exec $cpp";
5999             } else {
6000             - my $cpp = default_cpp();
6001             + my $cpp = default_cpp() . $inhibit_linemarkers;
6002             open(CPPO,"$cpp < errno.c |")
6003             or die "Cannot exec $cpp";
6004             }
6005             END
6006             }
6007             }
6008              
6009             sub _norm_ver {
6010 0     0     my $ver = shift;
6011 0           my @v = split(qr/[._]0*/, $ver);
6012 0   0       $v[2] ||= 0;
6013 0           return sprintf '%d.%03d%03d', @v;
6014             }
6015              
6016             sub _patch_develpatchperlversion {
6017 0 0   0     return if -d '.git';
6018 0   0       my $dpv = $Devel::PatchPerl::VERSION || "(unreleased)";
6019 0           _patch(<<"END");
6020             diff --git a/Configure b/Configure
6021             index e12c8bb..1a8088f 100755
6022             --- Configure
6023             +++ Configure
6024             @@ -25151,6 +25151,8 @@ zcat='\$zcat'
6025             zip='\$zip'
6026             EOT
6027            
6028             +echo "BuiltWithPatchPerl='$dpv'" >>config.sh
6029             +
6030             : add special variables
6031             \$test -f \$src/patchlevel.h && \
6032             awk '/^#define[ ]+PERL_/ {printf "\%s=\%s\\n",\$2,\$3}' \$src/patchlevel.h >>config.sh
6033             END
6034             }
6035              
6036             qq[patchin'];
6037              
6038             __END__