The patches below update general functionality, or OS/2-related
functionality, but contained in generally-interesting files.

Description of the patch:

a) mod2fname should a pseudo-builtin to work right - it is needed in
miniperl, so I deleted `require DynaLoader' around places where it is
used in MakeMaker.

b) One of the last missing dependencies is added to `Makefile': it now
knows how to build itself from `Makefile.SH' (before only `makefile'
new this). makedepend.SH is updated to filter out this dependency from
automatic ones.

c) pdksh choked on a last symbols being '\\' in a here-document - in
Makefile.SH.

d) The prefix of the perl library can be changes systemwise by using
environment variables (OS/2-only, so no concern for security). This
solves the remaining problems with binary distribution.

e) Wrapup for Perl_sbrk slightly changed to simplify it use.

f) t/lib/io_upd.t corrected to bail out under OS/2.

g) x2p/Makefile.SH corrected to put -DPERL_FOR_X2P on the compile
line, so os2-specific malloc can simplify itself to avoid hassle with
linking.

h) Test::Harness now prints out a table of failed tests with all the
relevant info.

diff -ru perl5_003_01/lib/Test/Harness.pm perl5_003_01.try/lib/Test/Harness.pm
--- perl5_003_01/lib/Test/Harness.pm	Tue Jul 30 14:11:38 1996
+++ perl5_003_01.try/lib/Test/Harness.pm	Sat Aug 03 21:59:20 1996
@@ -5,7 +5,10 @@
 use Benchmark;
 use Config;
 use FileHandle;
-use vars qw($VERSION $verbose $switches $have_devel_corestack);
+use strict;
+
+use vars qw($VERSION $verbose $switches $have_devel_corestack $curtest
+	    @ISA @EXPORT @EXPORT_OK);
 $have_devel_corestack = 0;
 
 $VERSION = "1.12";
@@ -14,6 +17,23 @@
 @EXPORT= qw(&runtests);
 @EXPORT_OK= qw($verbose $switches);
 
+format STDOUT_TOP =
+Failed Test  Status Wstat Total Fail  Failed  List of failed
+------------------------------------------------------------------------------
+.
+
+format STDOUT =
+@<<<<<<<<<<<<<< @>> @>>>> @>>>> @>>> ^##.##%  @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
+{ $curtest->{name},
+                $curtest->{estat},
+                    $curtest->{wstat},
+                          $curtest->{max},
+                                $curtest->{failed},
+                                     $curtest->{percent},
+                                              $curtest->{canon}
+}
+.
+
 
 $verbose = 0;
 $switches = "-w";
@@ -21,7 +41,7 @@
 sub runtests {
     my(@tests) = @_;
     local($|) = 1;
-    my($test,$te,$ok,$next,$max,$pct);
+    my($test,$te,$ok,$next,$max,$pct,$totok,@failed,%failedtests);
     my $totmax = 0;
     my $files = 0;
     my $bad = 0;
@@ -82,6 +102,11 @@
 		}
 	    }
 	    $bad++;
+	    $failedtests{$test} = { canon => '??',  max => $max || '??',
+				    failed => '??', 
+				    name => $test, percent => undef,
+				    estat => $estatus, wstat => $wstatus,
+				  };
 	} elsif ($ok == $max && $next == $max+1) {
 	    if ($max) {
 		print "ok\n";
@@ -94,14 +119,30 @@
 		push @failed, $next..$max;
 	    }
 	    if (@failed) {
-		print canonfailed($max,@failed);
+		my ($txt, $canon) = canonfailed($max,@failed);
+		print $txt;
+		$failedtests{$test} = { canon => $canon,  max => $max,
+					failed => scalar @failed,
+					name => $test, percent => 100*(scalar @failed)/$max,
+					estat => '', wstat => '',
+				      };
 	    } else {
 		print "Don't know which tests failed: got $ok ok, expected $max\n";
+		$failedtests{$test} = { canon => '??',  max => $max,
+					failed => '??', 
+					name => $test, percent => undef,
+					estat => '', wstat => '',
+				      };
 	    }
 	    $bad++;
 	} elsif ($next == 0) {
 	    print "FAILED before any test output arrived\n";
 	    $bad++;
+	    $failedtests{$test} = { canon => '??',  max => '??',
+				    failed => '??',
+				    name => $test, percent => undef,
+				    estat => '', wstat => '',
+				  };
 	}
     }
     my $t_total = timediff(new Benchmark, $t_start);
@@ -117,9 +158,12 @@
 	$pct = sprintf("%.2f", $good / $total * 100);
 	my $subpct = sprintf " %d/%d subtests failed, %.2f%% okay.",
 	$totmax - $totok, $totmax, 100*$totok/$totmax;
-	if ($bad == 1) {
-	    die "Failed 1 test script, $pct% okay.$subpct\n";
-	} else {
+	my $script;
+	for $script (sort keys %failedtests) {
+	  $curtest = $failedtests{$script};
+	  write;
+	}
+	if ($bad > 1) {
 	    die "Failed $bad/$total test scripts, $pct% okay.$subpct\n";
 	}
     }
@@ -154,6 +198,7 @@
     my @canon = ();
     my $min;
     my $last = $min = shift @failed;
+    my $canon;
     if (@failed) {
 	for (@failed, $failed[-1]) { # don't forget the last one
 	    if ($_ > $last+1 || $_ == $last) {
@@ -168,13 +213,16 @@
 	}
 	local $" = ", ";
 	push @result, "FAILED tests @canon\n";
+	$canon = "@canon";
     } else {
 	push @result, "FAILED test $last\n";
+	$canon = $last;
     }
 
     push @result, "\tFailed $failed/$max tests, ";
     push @result, sprintf("%.2f",100*(1-$failed/$max)), "% okay\n";
-    join "", @result;
+    my $txt = join "", @result;
+    ($txt, $canon);
 }
 
 1;
diff -ru perl5_003_01/makedepend.SH perl5_003_01.try/makedepend.SH
--- perl5_003_01/makedepend.SH	Tue Jul 30 14:11:46 1996
+++ perl5_003_01.try/makedepend.SH	Thu Aug 01 02:51:50 1996
@@ -124,10 +124,12 @@
 $MAKE shlist || ($echo "Searching for .SH files..."; \
 	$echo *.SH | $tr ' ' '\012' | $egrep -v '\*' >.shlist)
 
-# Now extract the dependency on makedepend.SH
-# (it should reside in the main Makefile):
+# Now extract the dependencies on makedepend.SH and Makefile.SH
+# (they should reside in the main Makefile):
 mv .shlist .shlist.old
 $egrep -v '^makedepend\.SH' <.shlist.old >.shlist
+mv .shlist .shlist.old
+$egrep -v '^Makefile\.SH' <.shlist.old >.shlist
 rm .shlist.old
 
 if $test -s .deptmp; then
diff -ru perl5_003_01/Makefile.SH perl5_003_01.try/Makefile.SH
--- perl5_003_01/Makefile.SH	Tue Jul 30 14:10:56 1996
+++ perl5_003_01.try/Makefile.SH	Thu Aug 01 03:34:00 1996
@@ -43,7 +43,13 @@
         # NeXT uses $patchlevel to set the current version of the dynamic
 	# library produced later. And the Major release number in the name
 	plibsuf=.5.$so
-    fi;;
+    fi
+    if test "$osname" = "os2" ; then
+	d_shrplib=custom; 
+	shrpenv=
+	plibsuf=$plibext
+    fi
+    ;;
 *)  plibsuf=$lib_ext
     pldlflags="";;
 esac
@@ -272,13 +278,11 @@
 else
 $spitshell >>Makefile <<!GROK!THIS!
 	version=$patchlevel; \\
+	libtool -dynamic -undefined warning -framework System \\
+	    -compatibility_version 1 -current_version \$\$version \\
+	    -prebind -seg1addr 0x27000000 -install_name \$(shrpdir)/\$@ \\
+	    -o \$@ perl.o \$(obj)
 !GROK!THIS!
-$spitshell >>Makefile <<'!NO!SUBS!'
-	libtool -dynamic -undefined warning -framework System \
-	    -compatibility_version 1 -current_version $$version \
-	    -prebind -seg1addr 0x27000000 -install_name $(shrpdir)/$@ \
-	    -o $@ perl.o $(obj)
-!NO!SUBS!
 fi
 ;;
 custom)
@@ -498,6 +502,9 @@
 
 pllist: $(pl)
 	echo $(pl) | tr ' ' '\012' >.pllist
+
+Makefile: Makefile.SH ./config.sh 
+	$(SHELL) Makefile.SH
 
 # AUTOMATICALLY GENERATED MAKE DEPENDENCIES--PUT NOTHING BELOW THIS LINE
 # If this runs make out of memory, delete /usr/include lines.
diff -ru perl5_003_01/malloc.c perl5_003_01.try/malloc.c
--- perl5_003_01/malloc.c	Tue Jul 30 14:11:48 1996
+++ perl5_003_01.try/malloc.c	Thu Aug 01 17:57:16 1996
@@ -646,32 +646,31 @@
 
 #ifdef USE_PERL_SBRK
 
-#ifdef NeXT
-#ifdef HIDEMYMALLOC
-#undef malloc
-#else
-#include "Error: -DUSE_PERL_SBRK on the NeXT requires -DHIDEMYMALLOC"
-#endif
+#   ifdef NeXT
+#      define PERL_SBRK_VIA_MALLOC
+#   endif
+
+#   ifdef PERL_SBRK_VIA_MALLOC
+#      ifdef HIDEMYMALLOC
+#         undef malloc
+#      else
+#         include "Error: -DPERL_SBRK_VIA_MALLOC requires -DHIDEMYMALLOC"
+#      endif
 
 /* it may seem schizophrenic to use perl's malloc and let it call system */
 /* malloc, the reason for that is only the 3.2 version of the OS that had */
 /* frequent core dumps within nxzonefreenolock. This sbrk routine put an */
 /* end to the cores */
 
-#define SYSTEM_ALLOC(a) malloc(a)
-
-#else
-
-/* OS/2 comes to mind ... */
-
-#endif
+#      define SYSTEM_ALLOC(a) malloc(a)
 
+#   endif  /* PERL_SBRK_VIA_MALLOC */
 
 static IV Perl_sbrk_oldchunk;
 static long Perl_sbrk_oldsize;
 
-#define PERLSBRK_32_K (1<<15)
-#define PERLSBRK_64_K (1<<16)
+#   define PERLSBRK_32_K (1<<15)
+#   define PERLSBRK_64_K (1<<16)
 
 char *
 Perl_sbrk(size)




This influence only OS/2-related functionality, but touch generic files:






diff -ru perl5_003_01/doio.c perl5_003_01.try/doio.c
--- perl5_003_01/doio.c	Tue Jul 30 14:11:00 1996
+++ perl5_003_01.try/doio.c	Sat Aug 03 18:45:18 1996
@@ -955,6 +955,8 @@
     }
 }
 
+#ifndef OS2
+
 bool
 do_exec(cmd)
 char *cmd;
@@ -1043,6 +1045,8 @@
     do_execfree();
     return FALSE;
 }
+
+#endif 
 
 I32
 apply(type,mark,sp)
diff -ru perl5_003_01/lib/ExtUtils/MakeMaker.pm perl5_003_01.try/lib/ExtUtils/MakeMaker.pm
--- perl5_003_01/lib/ExtUtils/MakeMaker.pm	Tue Jul 30 14:11:32 1996
+++ perl5_003_01.try/lib/ExtUtils/MakeMaker.pm	Thu Aug 01 02:51:48 1996
@@ -25,8 +25,9 @@
 	   );
 # use strict;
 
-eval {require DynaLoader;};	# Get mod2fname, if defined. Will fail
-                                # with miniperl.
+# &DynaLoader::mod2fname should be available to miniperl, thus 
+# should be a pseudo-builtin (cmp. os2.c).
+#eval {require DynaLoader;};
 
 #
 # Set up the inheritance before we pull in the MM_* packages, because they
diff -ru perl5_003_01/lib/ExtUtils/Mksymlists.pm perl5_003_01.try/lib/ExtUtils/Mksymlists.pm
--- perl5_003_01/lib/ExtUtils/Mksymlists.pm	Sun Jun 23 16:52:58 1996
+++ perl5_003_01.try/lib/ExtUtils/Mksymlists.pm	Thu Aug 01 02:51:48 1996
@@ -40,6 +40,7 @@
     }
 
 #    We'll need this if we ever add any OS which uses mod2fname
+#    not as pseudo-builtin.
 #    require DynaLoader;
     if (defined &DynaLoader::mod2fname and not $spec{DLBASE}) {
         $spec{DLBASE} = DynaLoader::mod2fname([ split(/::/,$spec{NAME}) ]);
diff -ru perl5_003_01/lib/ExtUtils/MM_Unix.pm perl5_003_01.try/lib/ExtUtils/MM_Unix.pm
--- perl5_003_01/lib/ExtUtils/MM_Unix.pm	Tue Jul 30 14:11:30 1996
+++ perl5_003_01.try/lib/ExtUtils/MM_Unix.pm	Thu Aug 01 02:51:48 1996
@@ -1365,14 +1365,11 @@
     # It may also edit @modparts if required.
     if (defined &DynaLoader::mod2fname) {
         $modfname = &DynaLoader::mod2fname(\@modparts);
-    } elsif ($Is_OS2) {                # Need manual correction if run with miniperl:-(
-        $modfname = substr($modfname, 0, 7) . '_';
-    }
-
+    } 
 
     ($self->{PARENT_NAME}, $self->{BASEEXT}) = $self->{NAME} =~ m!([\w:]+::)?(\w+)$! ;
 
-    if (defined &DynaLoader::mod2fname or $Is_OS2) {
+    if (defined &DynaLoader::mod2fname) {
 	# As of 5.001m, dl_os2 appends '_'
 	$self->{DLBASE} = $modfname;
     } else {
diff -ru perl5_003_01/perl.c perl5_003_01.try/perl.c
--- perl5_003_01/perl.c	Tue Jul 30 14:11:54 1996
+++ perl5_003_01.try/perl.c	Thu Aug 01 02:52:18 1996
@@ -1037,6 +1037,9 @@
 #    define PERLLIB_SEP ':'
 #  endif
 #endif
+#ifndef PERLLIB_MANGLE
+#  define PERLLIB_MANGLE(s,n) (s)
+#endif 
 
 static void
 incpush(p)
@@ -1056,10 +1059,11 @@
 	    p++;
 	}
 	if ( (s = strchr(p, PERLLIB_SEP)) != Nullch ) {
-	    av_push(GvAVn(incgv), newSVpv(p, (STRLEN)(s - p)));
+	    av_push(GvAVn(incgv), newSVpv(PERLLIB_MANGLE(p, (STRLEN)(s - p)), 
+					  (STRLEN)(s - p)));
 	    p = s + 1;
 	} else {
-	    av_push(GvAVn(incgv), newSVpv(p, 0));
+	    av_push(GvAVn(incgv), newSVpv(PERLLIB_MANGLE(p, 0), 0));
 	    break;
 	}
     }
diff -ru perl5_003_01/t/lib/io_udp.t perl5_003_01.try/t/lib/io_udp.t
--- perl5_003_01/t/lib/io_udp.t	Tue Jul 30 14:12:32 1996
+++ perl5_003_01.try/t/lib/io_udp.t	Thu Aug 01 03:41:20 1996
@@ -5,7 +5,8 @@
     @INC = '../lib' if -d '../lib';
     require Config; import Config;
     if ( ($Config{'extensions'} !~ /\bSocket\b/ ||
-          $Config{'extensions'} !~ /\bIO\b/)    &&
+          $Config{'extensions'} !~ /\bIO\b/	||
+	  $^O eq 'os2')    &&
           !(($^O eq 'VMS') && $Config{d_socket})) {
 	print "1..0\n";
 	exit 0;
diff -ru perl5_003_01/x2p/Makefile.SH perl5_003_01.try/x2p/Makefile.SH
--- perl5_003_01/x2p/Makefile.SH	Tue Jul 30 14:12:48 1996
+++ perl5_003_01.try/x2p/Makefile.SH	Thu Aug 01 19:16:42 1996
@@ -87,7 +87,7 @@
 lintflags = -phbvxac
 
 .c$(OBJ_EXT):
-	$(CCCMD) $(MAB) $*.c
+	$(CCCMD) $(MAB) -DPERL_FOR_X2P $*.c
 
 all: $(public) $(private) $(util)
 	touch all


