summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xConfigure24
-rw-r--r--MANIFEST6
-rw-r--r--Makefile.SH2
-rw-r--r--ext/DynaLoader/dl_dlopen.xs6
-rw-r--r--handy.h27
-rw-r--r--hints/cxux.sh2
-rw-r--r--hints/freebsd.sh32
-rw-r--r--hints/isc.sh18
-rw-r--r--hints/linux.sh17
-rw-r--r--hints/netbsd.sh2
-rw-r--r--hints/next_3_0.sh5
-rw-r--r--hints/next_3_2.sh5
-rw-r--r--hints/powerunix.sh2
-rw-r--r--hints/sco_3.sh11
-rwxr-xr-xinstallperl6
-rw-r--r--lib/ExtUtils/MakeMaker.pm155
-rw-r--r--lib/TieHash.pm4
-rw-r--r--perl.h3
-rw-r--r--pod/Makefile24
-rwxr-xr-xpod/pod2html.SH (renamed from pod/pod2html)101
-rwxr-xr-xpod/pod2latex.SH (renamed from pod/pod2latex)30
-rwxr-xr-xpod/pod2man.SH (renamed from pod/pod2man)29
-rw-r--r--pp_hot.c6
-rw-r--r--pp_sys.c7
-rw-r--r--sv.c6
-rw-r--r--util.c77
26 files changed, 461 insertions, 146 deletions
diff --git a/Configure b/Configure
index 590f816548..e3e58f88ed 100755
--- a/Configure
+++ b/Configure
@@ -20,7 +20,7 @@
# $Id: Head.U,v 3.0.1.7 1995/03/21 08:46:15 ram Exp $
#
-# Generated on Thu Apr 6 11:09:32 EDT 1995 [metaconfig 3.0 PL53]
+# Generated on Fri Apr 14 15:43:12 EDT 1995 [metaconfig 3.0 PL53]
cat >/tmp/c1$$ <<EOF
ARGGGHHHH!!!!!
@@ -4241,7 +4241,7 @@ EOM
rp="Any special flags to pass to $cc -c to compile shared library modules?"
. ./myread
case "$ans" in
- none) cccdlflags='' ;;
+ none) cccdlflags=' ' ;;
*) cccdlflags="$ans" ;;
esac
@@ -4278,11 +4278,11 @@ EOM
fi
rm -f try.c a.out
;;
- *) dflt=ld
+ *) dflt="$ld"
;;
esac
- rp="What comnmand should be used to create dynamic libraries?"
+ rp="What command should be used to create dynamic libraries?"
. ./myread
ld="$ans"
@@ -4311,7 +4311,7 @@ EOM
rp="Any special flags to pass to $ld to create a dynamically loaded library?"
. ./myread
case "$ans" in
- none) lddlflags='' ;;
+ none) lddlflags=' ' ;;
*) lddlflags="$ans" ;;
esac
@@ -4335,7 +4335,7 @@ EOM
rp="Any special flags to pass to $cc to use dynamic loading?"
. ./myread
case "$ans" in
- none) ccdlflags='' ;;
+ none) ccdlflags=' ' ;;
*) ccdlflags="$ans" ;;
esac
;;
@@ -6438,7 +6438,7 @@ them at all. Answer "none" to include no extensions.
EOM
case "$dynamic_ext" in
- ''|' ') dflt="$avail_ext" ;;
+ '') dflt="$avail_ext" ;;
*) dflt="$dynamic_ext" ;;
esac
case "$dflt" in
@@ -6447,12 +6447,12 @@ EOM
rp="What extensions do you wish to load dynamically?"
. ./myread
case "$ans" in
- none) dynamic_ext='' ;;
+ none) dynamic_ext=' ' ;;
*) dynamic_ext="$ans" ;;
esac
case "$static_ext" in
- ''|' ')
+ '')
: Exclude those already listed in dynamic linking
dflt=''
for xxx in $avail_ext; do
@@ -6475,7 +6475,7 @@ EOM
rp="What extensions do you wish to load statically?"
. ./myread
case "$ans" in
- none) static_ext='' ;;
+ none) static_ext=' ' ;;
*) static_ext="$ans" ;;
esac
;;
@@ -6486,7 +6486,7 @@ to include no extensions.
EOM
case "$static_ext" in
- ''|' ') dflt="$avail_ext" ;;
+ '') dflt="$avail_ext" ;;
*) dflt="$static_ext" ;;
esac
@@ -6496,7 +6496,7 @@ EOM
rp="What extensions do you wish to include?"
. ./myread
case "$ans" in
- none) static_ext='' ;;
+ none) static_ext=' ' ;;
*) static_ext="$ans" ;;
esac
;;
diff --git a/MANIFEST b/MANIFEST
index 5dbe6e300a..59137b79bb 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -402,9 +402,9 @@ pod/perlsub.pod Subroutine info
pod/perlsyn.pod Syntax info
pod/perltrap.pod Trap info
pod/perlvar.pod Variable info
-pod/pod2html Translator to turn pod into HTML
-pod/pod2latex Translator to turn pod into LaTeX
-pod/pod2man Translator to turn pod into manpage
+pod/pod2html.SH Precursor for translator to turn pod into HTML
+pod/pod2latex.SH Precursor for translator to turn pod into LaTeX
+pod/pod2man.SH Precursor for translator to turn pod into manpage
pod/splitman Splits perlfunc into multiple man pages
pp.c Push/Pop code
pp.h Push/Pop code defs
diff --git a/Makefile.SH b/Makefile.SH
index 77b3893889..f5dff60848 100644
--- a/Makefile.SH
+++ b/Makefile.SH
@@ -227,6 +227,7 @@ $spitshell >>Makefile <<'!NO!SUBS!'
;;
*)
$spitshell >>Makefile <<'!NO!SUBS!'
+ rm -f $(perllib)
ar rcu $(perllib) perl.o $(obj)
@$(ranlib) $(perllib)
!NO!SUBS!
@@ -329,6 +330,7 @@ clean:
realclean: clean
-cd x2p; $(MAKE) realclean
+ -cd pod; $(MAKE) realclean
@for x in $(DYNALOADER) $(dynamic_ext) $(static_ext) ; do \
sh ext/util/make_ext realclean $$x ; \
done
diff --git a/ext/DynaLoader/dl_dlopen.xs b/ext/DynaLoader/dl_dlopen.xs
index ffd3dbc422..0cba08729e 100644
--- a/ext/DynaLoader/dl_dlopen.xs
+++ b/ext/DynaLoader/dl_dlopen.xs
@@ -115,7 +115,11 @@
#endif
#ifndef HAS_DLERROR
-#define dlerror() "Unknown error - dlerror() not implemented"
+# ifdef __NetBSD__
+# define dlerror() strerror(errno)
+# else
+# define dlerror() "Unknown error - dlerror() not implemented"
+# endif
#endif
diff --git a/handy.h b/handy.h
index 9d87378c5e..aa4107eca5 100644
--- a/handy.h
+++ b/handy.h
@@ -24,15 +24,26 @@
#define Nullsv Null(SV*)
/* bool is built-in for g++-2.6.3, which might be used for an extension.
- gcc-2.6.2 under Linux defines _G_HAVE_BOOL to 0, and does not
- define bool. */
-#if !defined(HAS_BOOL) && !(_G_HAVE_BOOL)
-#ifdef UTS
-#define bool int
-#else
-#define bool char
+ If the extension includes <_G_config.h> before this file then
+ _G_HAVE_BOOL will be properly set. If, however, the extension includes
+ this file first, then you will have to manually set -DHAS_BOOL in
+ your command line to avoid a conflict.
+*/
+#ifdef _G_HAVE_BOOL
+# if _G_HAVE_BOOL
+# ifndef HAS_BOOL
+# define HAS_BOOL 1
+# endif
+# endif
+#endif
+
+#ifndef HAS_BOOL
+# ifdef UTS
+# define bool int
+# else
+# define bool char
+# endif
#endif
-#endif /* !defined(HAS_BOOL) && !(_G_HAVE_BOOL) */
#ifdef TRUE
#undef TRUE
diff --git a/hints/cxux.sh b/hints/cxux.sh
index a4f397c20e..b4125ae6d2 100644
--- a/hints/cxux.sh
+++ b/hints/cxux.sh
@@ -72,7 +72,7 @@ glibpth="/usr/sde/elf/usr/lib $glibpth"
cc='/bin/cc -Xa'
cccdlflags='-Zelf -Zpic'
ccdlflags='-Zelf -Zlink=dynamic -Wl,-Bexport -u sigaction'
-lddlflags='-G'
+lddlflags='-Zlink=so'
# Configure imagines that stdio.h is "standard", but it really isn't.
# Things like the -T and -B file test operators (on file handles) fail when
diff --git a/hints/freebsd.sh b/hints/freebsd.sh
index 4efca6a043..f0c5433cca 100644
--- a/hints/freebsd.sh
+++ b/hints/freebsd.sh
@@ -1,4 +1,4 @@
-# Oringal based on info from
+# Original based on info from
# Carl M. Fongheiser <cmf@ins.infonet.net>
# Date: Thu, 28 Jul 1994 19:17:05 -0500 (CDT)
#
@@ -6,21 +6,45 @@
# Ollivier Robert <Ollivier.Robert@keltia.frmug.fr.net>
# Date: Wed, 28 Sep 1994 00:37:46 +0100 (MET)
#
+# Additional 2.* defines from
+# Ollivier Robert <Ollivier.Robert@keltia.frmug.fr.net>
+# Date: Sat, 8 Apr 1995 20:53:41 +0200 (MET DST)
+#
+# FreeBSD has the dynamic loading dl*() functions in /usr/lib/crt0.o,
+# so Configure doesn't find them (unless you abandon the nm scan).
+#
+# The two flags "-fpic -DPIC" are used to indicate a
+# will-be-shared object. Configure will guess the -fpic, (and the
+# -DPIC is not used by perl proper) but the full define is included to
+# be consistent with the FreeBSD general shared libs building process.
+#
+# setreuid and friends are inherently broken in all versions of FreeBSD.
+#
+
case "$osvers" in
0.*|1.0*)
usedl="$undef"
;;
-*) d_dlopen="$define"
+1.1*) d_dlopen="$define"
cccdlflags='-DPIC -fpic'
- lddlflags='-Bshareable'
+ lddlflags='-Bshareable $lddlflags'
malloctype='void *'
groupstype='int'
d_setregid='undef'
d_setreuid='undef'
d_setrgid='undef'
d_setruid='undef'
- i_unistd='undef'
+ ;;
+*)
+ d_dlopen="$define"
+ cccdlflags='-DPIC -fpic'
+ lddlflags='-Bshareable $lddlflags'
+ d_setregid='undef'
+ d_setreuid='undef'
+ d_setrgid='undef'
+ d_setruid='undef'
;;
esac
# Avoid telldir prototype conflict in pp_sys.c (FreeBSD uses const DIR *)
+# Configure should test for this. Volunteers?
pp_sys_cflags='ccflags="$ccflags -DHAS_TELLDIR_PROTOTYPE"'
diff --git a/hints/isc.sh b/hints/isc.sh
index 7c18380f54..0ecdb7ddc9 100644
--- a/hints/isc.sh
+++ b/hints/isc.sh
@@ -6,9 +6,19 @@
#
# Use Configure -Dcc=gcc to use gcc
#
-set `echo X "$libswanted "| sed -e 's/ c / /'`
+
+# We don't want to explicitly mention -lc (since we're using POSIX mode.)
+# We also don't want -lx (the Xenix compatability libraries.) The only
+# thing that it seems to pick up is chsize(), which has been reported to
+# not work. chsize() can also be implemented via fcntl() in perl (if you
+# define -D_SYSV3). We'll leave in -lPW since it's harmless. Some
+# extension might eventually need it for alloca, though perl doesn't use
+# it.
+
+set `echo X "$libswanted "| sed -e 's/ c / /' -e 's/ x / /'`
shift
libswanted="$*"
+
case "$cc" in
*gcc*) ccflags="$ccflags -posix"
ldflags="$ldflags -posix"
@@ -17,5 +27,11 @@ case "$cc" in
ldflags="$ldflags -Xp"
;;
esac
+
+# You can also include -D_SYSV3 to pick up "traditionally visible"
+# symbols hidden by name-space pollution rules. This raises some
+# compilation "redefinition" warnings, but they appear harmless.
+# ccflags="$ccflags -D_SYSV3"
+
# Pick up dbm.h in <rpcsvc/dbm.h>
ccflags="$ccflags -I/usr/include/rpcsvc"
diff --git a/hints/linux.sh b/hints/linux.sh
index 71afccd1f9..46059e0731 100644
--- a/hints/linux.sh
+++ b/hints/linux.sh
@@ -24,9 +24,10 @@ case "$prefix" in
esac
# Perl expects BSD style signal handling.
-ccflags="-D__USE_BSD_SIGNAL $ccflags"
+# gcc defines _G_HAVE_BOOL to 1, but doesn't actually supply bool.
+ccflags="-D__USE_BSD_SIGNAL -Dbool=char -DHAS_BOOL $ccflags"
-# The following functions are gcc built-ins, but the Configure test
+# The following functions are gcc built-ins, but the Configure tests
# may fail because it doesn't supply a proper prototype.
d_memcmp=define
d_memcpy=define
@@ -68,17 +69,15 @@ if gcc try.c >/dev/null 2>&1 && ./a.out; then
You appear to have ELF support. I'll try to use it for dynamic loading.
EOM
- # Be careful not to overwrite lddlflags, since the user might
- # have specified some -L/path options on the Configure command line.
- lddlflags="-shared $lddlflags"
- ccdlflags='-rdynamic'
- so='so'
- dlext='so'
- ld=gcc
+ # Configure now handles these automatically.
else
echo "You don't have an ELF gcc, using dld if available."
# We might possibly have a version of DLD around.
lddlflags="-r $lddlflags"
+ # These empty values are so that Configure doesn't put in the
+ # Linux ELF values.
+ ccdlflags=' '
+ cccdlflags=' '
so='sa'
dlext='o'
## If you are using DLD 3.2.4 which does not support shared libs,
diff --git a/hints/netbsd.sh b/hints/netbsd.sh
index 33a7bf1c00..67cd95c2ad 100644
--- a/hints/netbsd.sh
+++ b/hints/netbsd.sh
@@ -1,5 +1,5 @@
# hints/netbsd.sh
-# netbsd keeps dynamic loading dl*() functions in /lib/crt0.o,
+# netbsd keeps dynamic loading dl*() functions in /usr/lib/crt0.o,
# so Configure doesn't find them (unless you abandon the nm scan).
case "$osvers" in
0.9*|0.8*)
diff --git a/hints/next_3_0.sh b/hints/next_3_0.sh
index a34d621449..3a50247e9c 100644
--- a/hints/next_3_0.sh
+++ b/hints/next_3_0.sh
@@ -21,7 +21,12 @@ POSIX_cflags='ccflags="-posix $ccflags"'
useposix='undef'
ldflags='-u libsys_s'
libswanted='dbm gdbm db'
+#
lddlflags='-r'
+# Give cccdlflags an empty value since Configure will detect we are
+# using GNU cc and try to specify -fpic for cccdlflags.
+cccdlflags=' '
+#
i_utime='undef'
groupstype='int'
direntrytype='struct direct'
diff --git a/hints/next_3_2.sh b/hints/next_3_2.sh
index aba25b9ed5..887082e2f3 100644
--- a/hints/next_3_2.sh
+++ b/hints/next_3_2.sh
@@ -5,7 +5,12 @@ ccflags='-DUSE_NEXT_CTYPE'
POSIX_cflags='ccflags="-posix $ccflags"'
ldflags='-u libsys_s'
libswanted='dbm gdbm db'
+
lddlflags='-r'
+# Give cccdlflags an empty value since Configure will detect we are
+# using GNU cc and try to specify -fpic for cccdlflags.
+cccdlflags=' '
+
i_utime='undef'
groupstype='int'
direntrytype='struct direct'
diff --git a/hints/powerunix.sh b/hints/powerunix.sh
index f21e6ae8b8..9ce2462315 100644
--- a/hints/powerunix.sh
+++ b/hints/powerunix.sh
@@ -49,7 +49,7 @@ d_csh='undef'
cc='/bin/cc'
cccdlflags='-Zpic'
ccdlflags='-Zlink=dynamic -Wl,-Bexport'
-lddlflags='-G'
+lddlflags='-Zlink=so'
# Configure imagines that stdio.h is "standard", but it really isn't.
# Things like the -T and -B file test operators (on file handles) fail when
diff --git a/hints/sco_3.sh b/hints/sco_3.sh
index a89ffbec6a..11682e1968 100644
--- a/hints/sco_3.sh
+++ b/hints/sco_3.sh
@@ -22,9 +22,20 @@ gcc)
ccflags="$ccflags -U M_XENIX"
optimize="$optimize -O2"
;;
+scocc) ;;
+
*)
ccflags="$ccflags -W0 -U M_XENIX"
;;
esac
i_varargs=undef
+
+# I have received one report that nm extraction doesn't work if you're
+# using the scocc compiler. This system had the following 'myconfig'
+# uname='xxx xxx 3.2 2 i386 '
+# cc='scocc', optimize='-O'
+usenm='false'
+
+# If you want to use nm, you'll probably have to use nm -p. The
+# following does that for you:
nm_opt='-p'
diff --git a/installperl b/installperl
index 4348411383..f9d0ecb159 100755
--- a/installperl
+++ b/installperl
@@ -146,8 +146,9 @@ else {
makedir("$installarchlib/CORE");
foreach $file (<*.h libperl*.*>) {
cp_if_diff($file,"$installarchlib/CORE/$file");
- if ($file =~ /\.a$/ && $osname eq 'next') {
- #on NeXTs we have to rerun ranlib after copying libraries
+ if ($file =~ /\.a$/ && $osname =~ /^(next|sunos)$/) {
+ # on NeXTs and Suns we have to rerun ranlib after copying libraries
+ # (maybe on all platforms which have ranlib ?)
&cmd("$ranlib $installarchlib/CORE/$file");
}
}
@@ -342,6 +343,7 @@ sub cp_if_diff {
-f $from || die "$0: $from not found";
system "cmp", "-s", $from, $to;
if ($?) {
+ unlink($to); # In case we don't have write permissions.
cmd("cp $from $to");
}
}
diff --git a/lib/ExtUtils/MakeMaker.pm b/lib/ExtUtils/MakeMaker.pm
index 73ad1ddebf..d8d5d6fb30 100644
--- a/lib/ExtUtils/MakeMaker.pm
+++ b/lib/ExtUtils/MakeMaker.pm
@@ -1,9 +1,8 @@
package ExtUtils::MakeMaker;
-$Version = 4.091; # Last edited 31 Mar 1995 by Andreas Koenig
+$Version = 4.093; # Last edited 12 Apr 1995 by Andy Dougherty
use Config;
-check_hints();
use Carp;
use Cwd;
@@ -48,11 +47,11 @@ Config.pm. In addition the extension may contribute to the C<%Config>
hash table of Config.pm by supplying hints files in a C<hints/>
directory. The hints files are expected to be named like their
counterparts in C<PERL_SRC/hints>, but with an C<.pl> file name
-extension (eg. C<next_3_2.sh>). They are simply C<eval>ed by MakeMaker
-and can be used to execute commands as well as to include special
-variables. If there is no hintsfile for the actual system, but for
-some previous releases of the same operating system, the latest one of
-those is used.
+extension (eg. C<next_3_2.pl>). They are simply C<eval>ed by MakeMaker
+within the WriteMakefile() subroutine, and can be used to execute
+commands as well as to include special variables. If there is no
+hintsfile for the actual system, but for some previous releases of the
+same operating system, the latest one of those is used.
=head2 Default Makefile Behaviour
@@ -80,7 +79,7 @@ Other interesting targets in the generated Makefile are
make config # to check if the Makefile is up-to-date
make clean # delete local temporary files (Makefile gets renamed)
make realclean # delete all derived files (including installed files)
- make distclean # produce a gzipped file ready for shipping
+ make dist # produce a gzipped file ready for shipping
The macros in the produced Makefile may be overridden on the command
line to the make call as in the following example:
@@ -276,8 +275,7 @@ F<perl5-porters@nicoh.com> or F<comp.lang.perl> as appropriate.
=cut
sub check_hints {
- # We allow extension-specific hints files. If we find one we act as if Config.pm
- # had read the contents
+ # We allow extension-specific hints files.
# First we look for the best hintsfile we have
my(@goodhints);
@@ -300,13 +298,15 @@ sub check_hints {
closedir DIR;
return unless @goodhints; # There was no hintsfile
# the last one in lexical ordering is our choice:
- $hint=(reverse sort @goodhints)[0];
+ $hint=(sort @goodhints)[-1];
# execute the hintsfile:
open HINTS, "hints/$hint.pl";
@goodhints = <HINTS>;
close HINTS;
+ print STDOUT "Processing hints file hints/$hint.pl";
eval join('',@goodhints);
+ print STDOUT $@ if $@;
}
# Setup dummy package:
@@ -444,7 +444,7 @@ normally required:
dynamic_lib: {ARMAYBE => 'ar', OTHERLDFLAGS => '...'}
clean: {FILES => "*.xyz foo"}
realclean: {FILES => '$(INST_ARCHAUTODIR)/*.xyz'}
- distclean: {TARNAME=>'MyTarFile', TARFLAGS=>'cvfF', COMPRESS=>'gzip'}
+ dist: {TARNAME=>'MyTarFile', TARFLAGS=>'cvfF', COMPRESS=>'gzip'}
tool_autosplit: {MAXLEN => 8}
END
@@ -478,7 +478,7 @@ sub help {print $Attrib_Help;}
'subdirs' => {},
'clean' => {},
'realclean' => {},
- 'distclean' => {},
+ 'dist' => {},
'test' => {},
'install' => {},
'force' => {},
@@ -534,6 +534,9 @@ sub WriteMakefile {
parse_args(\%att, @ARGV);
my(%initial_att) = %att; # record initial attributes
+
+ check_hints();
+
my($key);
MY->init_main();
@@ -570,7 +573,7 @@ sub WriteMakefile {
} else {
my(%a) = %{$att{$section} || {}};
print MAKE "\n# --- MakeMaker $section section:";
- print MAKE "# ",%a if $Verbose;
+ print MAKE "# ", join ", ", %a if $Verbose;
print(MAKE MY->nicetext(MY->$section( %a )));
}
}
@@ -1003,7 +1006,7 @@ sub lsdir{
sub find_perl{
my($self, $ver, $names, $dirs, $trace) = @_;
my($name, $dir);
- if ($trace){
+ if ($trace >= 2){
print "Looking for perl $ver by these names: ";
print "@$names, ";
print "in these dirs:";
@@ -1017,7 +1020,7 @@ sub find_perl{
$name .= ".exe" unless -x "$dir/$name";
}
next unless -x "$dir/$name";
- print "Executing $dir/$name" if ($trace);
+ print "Executing $dir/$name" if ($trace >= 2);
my($out);
if ($Is_VMS) {
my($vmscmd) = 'MCR ' . vmsify("$dir/$name");
@@ -1025,7 +1028,10 @@ sub find_perl{
} else {
$out = `$dir/$name -e 'require $ver; print "VER_OK\n" ' 2>&1`;
}
- return "$dir/$name" if $out =~ /VER_OK/;
+ if ($out =~ /VER_OK/) {
+ print "Using $dir/$name" if $trace;
+ return "$dir/$name";
+ }
}
}
print STDOUT "Unable to find a perl $ver (by these names: @$names, in these dirs: @$dirs)\n";
@@ -1223,6 +1229,7 @@ sub const_cccmd{
."Please notify perl5-porters\@nicoh.com\n";
}
my($cccmd)=($old) ? $old : $new;
+ $cccmd =~ s/\b\Q$Config{'cc'}\E\b/\$(CC)/;
"CCCMD = $cccmd\n";
}
@@ -1617,8 +1624,9 @@ sub subdirs {
# This method provides a mechanism to automatically deal with
# subdirectories containing further Makefile.PL scripts.
# It calls the subdir_x() method for each subdirectory.
- foreach(<*/Makefile.PL>){
- s:/Makefile\.PL$:: ;
+ foreach(grep -d, &lsdir()){
+ next if /^\./;
+ next unless -f "$_/Makefile\.PL" ;
print "Including $_ subdirectory" if ($Verbose);
push(@m, MY->subdir_x($_));
}
@@ -1718,7 +1726,7 @@ realclean purge :: clean
}
-sub distclean {
+sub dist {
my($self, %attribs) = @_;
# VERSION should be sanitised before use as a file name
my($tarname) = $attribs{TARNAME} || '$(DISTNAME)-$(VERSION)';
@@ -1728,7 +1736,7 @@ sub distclean {
my($postop) = $attribs{POSTOP} || '@:';
my($mkfiles) = join(' ', map("$_/$att{MAKEFILE} $_/$att{MAKEFILE}.old", ".", @{$att{DIR}}));
"
-distclean: clean
+dist: clean
$preop
$att{RM_F} $mkfiles
cd .. && tar $tarflags $tarname.tar \$(BASEEXT)
@@ -1913,7 +1921,7 @@ sub makeaperl {
$cccmd .= " $Config{'cccdlflags'}" if ($Config{'d_shrplib'});
# The front matter of the linkcommand...
- $linkcmd = join ' ', $Config{'cc'},
+ $linkcmd = join ' ', "\$(CC)",
grep($_, @Config{qw(large split ldflags ccdlflags)});
$linkcmd =~ s/\s+/ /g;
@@ -1935,7 +1943,7 @@ sub makeaperl {
for (sort keys %static) {
next unless /\.a$/;
$_ = dirname($_) . "/extralibs.ld";
- push @$extra, "`cat $_`";
+ push @$extra, $_;
}
grep(s/^/-I/, @$perlinc);
@@ -1951,7 +1959,6 @@ MAP_LINKCMD = $linkcmd
MAP_PERLINC = @{$perlinc}
MAP_STATIC = ",
join(" ", sort keys %static), "
-MAP_EXTRA = @{$extra}
MAP_PRELIBS = $Config{'libs'} $Config{'cryptlib'}
";
@@ -1969,8 +1976,18 @@ MAP_LIBPERL = $libperl
";
push @m, "
-\$(MAP_TARGET): $tmp/perlmain.o \$(MAP_LIBPERL) \$(MAP_STATIC)
- \$(MAP_LINKCMD) -o \$\@ $tmp/perlmain.o \$(MAP_LIBPERL) \$(MAP_STATIC) \$(MAP_EXTRA) \$(MAP_PRELIBS)
+extralibs.ld: @$extra
+ \@ $att{RM_F} \$\@
+ \@ \$(TOUCH) \$\@
+";
+
+ foreach (@$extra){
+ push @m, "\tcat $_ >> \$\@\n";
+ }
+
+ push @m, "
+\$(MAP_TARGET): $tmp/perlmain.o \$(MAP_LIBPERL) \$(MAP_STATIC) extralibs.ld
+ \$(MAP_LINKCMD) -o \$\@ $tmp/perlmain.o \$(MAP_LIBPERL) \$(MAP_STATIC) `cat extralibs.ld` \$(MAP_PRELIBS)
@ echo 'To install the new \"\$(MAP_TARGET)\" binary, call'
@ echo ' make -f $makefilename inst_perl MAP_TARGET=\$(MAP_TARGET)'
@ echo 'To remove the intermediate files say'
@@ -1988,12 +2005,12 @@ $tmp/perlmain.c: $makefilename}, q{
};
-# We write MAP_EXTRA outside the perl program to have it eval'd by the shell
+# We write EXTRA outside the perl program to have it eval'd by the shell
push @m, q{
doc_inst_perl:
@ $(FULLPERL) -e 'use ExtUtils::MakeMaker; MM->writedoc("Perl binary",' \\
-e '"$(MAP_TARGET)", "MAP_STATIC=$(MAP_STATIC)",' \\
- -e '"MAP_EXTRA=@ARGV", "MAP_LIBPERL=$(MAP_LIBPERL)")' -- $(MAP_EXTRA)
+ -e '"MAP_EXTRA=@ARGV", "MAP_LIBPERL=$(MAP_LIBPERL)")' -- `cat extralibs.ld`
};
push @m, qq{
@@ -2004,6 +2021,8 @@ pure_inst_perl: \$(MAP_TARGET)
realclean :: map_clean
+distclean :: realclean
+
map_clean :
$att{RM_F} $tmp/perlmain.o $tmp/perlmain.c $makefilename
};
@@ -2068,12 +2087,34 @@ sub extliblist{
# For gcc-2.6.2 on linux (March 1995), DLD can not load
# .sa libraries, with the exception of libm.sa, so we
# deliberately skip them.
- if (@fullname=<${thispth}/lib${thislib}.${so}.[0-9]*>){
- $fullname=$fullname[-1]; #ATTN: 10 looses against 9!
+ if (@fullname = lsdir($thispth,"^lib$thislib\.$so\.[0-9]+")){
+ # Take care that libfoo.so.10 wins against libfoo.so.9.
+ # Compare two libraries to find the most recent version
+ # number. E.g. if you have libfoo.so.9.0.7 and
+ # libfoo.so.10.1, first convert all digits into two
+ # decimal places. Then we'll add ".00" to the shorter
+ # strings so that we're comparing strings of equal length
+ # Thus we'll compare libfoo.so.09.07.00 with
+ # libfoo.so.10.01.00. Some libraries might have letters
+ # in the version. We don't know what they mean, but will
+ # try to skip them gracefully -- we'll set any letter to
+ # '0'. Finally, sort in reverse so we can take the
+ # first element.
+ $fullname = "$thispth/" .
+ (sort { my($ma) = $a;
+ my($mb) = $b;
+ $ma =~ tr/A-Za-z/0/s;
+ $ma =~ s/\b(\d)\b/0$1/g;
+ $mb =~ tr/A-Za-z/0/s;
+ $mb =~ s/\b(\d)\b/0$1/g;
+ while (length($ma) < length($mb)) { $ma .= ".00"; }
+ while (length($mb) < length($ma)) { $mb .= ".00"; }
+ # Comparison deliberately backwards
+ $mb cmp $ma;} @fullname)[0];
} elsif (-f ($fullname="$thispth/lib$thislib.$so")
- && (($Config{'dlsrc'} ne "dl_dld.xs") || ($thislib eq "m"))){
+ && (($Config{'dlsrc'} ne "dl_dld.xs") || ($thislib eq "m"))){
} elsif (-f ($fullname="$thispth/lib${thislib}_s.a")
- && ($thislib .= "_s") ){ # we must explicitly ask for _s version
+ && ($thislib .= "_s") ){ # we must explicitly use _s version
} elsif (-f ($fullname="$thispth/lib$thislib.a")){
} elsif (-f ($fullname="$thispth/Slib$thislib.a")){
} else {
@@ -2092,12 +2133,13 @@ sub extliblist{
# Do not add it into the list if it is already linked in
# with the main perl executable.
- # We have to special-case the NeXT, because all the math is also in libsys_s
- unless ( $in_perl || ($Config{'osname'} eq 'next' && $thislib eq 'm') ){
+ # We have to special-case the NeXT, because all the math
+ # is also in libsys_s
+ unless ($in_perl ||
+ ($Config{'osname'} eq 'next' && $thislib eq 'm') ){
push(@extralibs, "-l$thislib");
}
-
# We might be able to load this archive file dynamically
if ( $Config{'dlsrc'} =~ /dl_next|dl_dld/){
# We push -l$thislib instead of $fullname because
@@ -2120,7 +2162,8 @@ sub extliblist{
}
last; # found one here so don't bother looking further
}
- print STDOUT "Warning (non-fatal): No library found for -l$thislib" unless $found_lib>0;
+ print STDOUT "Warning (non-fatal): No library found for -l$thislib"
+ unless $found_lib>0;
}
return ('','','') unless $found;
("@extralibs", "@bsloadlibs", "@ldloadlibs");
@@ -2393,6 +2436,41 @@ v4.091 April 3 1995 by Andy Dougherty
Another attempt to fix writedoc() from Dean Roehrich.
+
+v4.092 April 11 1994 by Andreas Koenig
+
+Fixed a docu bug in hint file description. Added printing of a warning
+from eval in the hintfile section if the eval has errors. Moved
+check_hints() into the WriteMakefile() subroutine to avoid evaling
+hintsfiles for other uses of the module (mkbootstrap, mksymlists).
+
+Eliminated csh globbing to work around buggy Linux csh.
+
+In extliblist() libfoo.so.10 now wins against libfoo.so.9.
+
+Use $(CC) instead of $Config{'cc'} everywhere to allow overriding
+according to a patch by Dean Roehrich.
+
+Introduce a ./extralibs.ld file that contains the contents of all
+relevant extralibs.ld files for a static build to shorten the command
+line for the linking of a new static perl.
+
+Minor cosmetics.
+
+v4.093 April 12 1994 by Andy Dougherty
+
+Rename distclean target to plain dist. Insert a dummy distclean
+target that's the same as realclean. This is more consistent with the
+main perl makefile.
+
+Fix up extliblist() so even bizarre names like libfoo.so.10.0.1
+are handled.
+
+Include Tim's suggestions about $verbose and more careful substitution
+of $(CC) for $Config{'cc'}.
+
+Minor cosmetic fixes for my 80-character wide terminal.
+
=head1 NOTES
MakeMaker development work still to be done:
@@ -2402,6 +2480,11 @@ Needs more complete documentation.
Add a html: target when there has been found a general solution to
installing html files.
+Add an uninstall target.
+
+Add a FLAVOR variable that makes it easier to build debugging,
+embedded or multiplicity perls.
+
=cut
# the following keeps AutoSplit happy
diff --git a/lib/TieHash.pm b/lib/TieHash.pm
index 2d5c2f41f0..1abbe8379a 100644
--- a/lib/TieHash.pm
+++ b/lib/TieHash.pm
@@ -10,8 +10,8 @@ sub new {
sub TIEHASH {
my $pack = shift;
- if (defined &{"{$pack}::new"}) {
- carp "WARNING: calling ${pack}->new since ${pack}->TIEHASH is missing"
+ if (defined &{"$pack\::new"}) {
+ carp "WARNING: calling $pack\->new since $pack\->TIEHASH is missing"
if $^W;
$pack->new(@_);
}
diff --git a/perl.h b/perl.h
index e6fad07aaa..8cb8330441 100644
--- a/perl.h
+++ b/perl.h
@@ -647,11 +647,14 @@ U32 cast_ulong _((double));
#ifdef CASTI32
#define I_32(what) ((I32)(what))
#define I_V(what) ((IV)(what))
+#define U_V(what) ((UV)(what))
#else
I32 cast_i32 _((double));
#define I_32(what) (cast_i32((double)(what)))
IV cast_iv _((double));
#define I_V(what) (cast_iv((double)(what)))
+UV cast_uv _((double));
+#define U_V(what) (cast_uv((double)(what)))
#endif
struct Outrec {
diff --git a/pod/Makefile b/pod/Makefile
index 077ecd19bb..47fc2e9512 100644
--- a/pod/Makefile
+++ b/pod/Makefile
@@ -1,5 +1,7 @@
all: man
+PERL = ../miniperl
+
POD = \
perl.pod \
perlapi.pod \
@@ -89,19 +91,35 @@ HTML = \
man: $(MAN)
-html: $(HTML)
+# pod2html runs on all the pods at once in order to build up
+# cross-references.
+html:
+ $(PERL) pod2html *.pod
.SUFFIXES: .pod .man
.pod.man:
- ../miniperl pod2man $*.pod >$*.man
+ $(PERL) pod2man $*.pod >$*.man
.SUFFIXES: .pod .html
.pod.html:
- ../miniperl pod2html $*.pod >$*.html
+ $(PERL) pod2html $*.pod
clean:
rm -f $(MAN) $(HTML)
realclean: clean
+ rm -f pod2man pod2latex pod2html
+
+distclean: realclean
+
+# Dependencies.
+pod2latex: pod2latex.SH ../config.sh
+ sh pod2latex.SH
+
+pod2html: pod2html.SH ../config.sh
+ sh pod2html.SH
+
+pod2man: pod2man.SH ../config.sh
+ sh pod2man.SH
diff --git a/pod/pod2html b/pod/pod2html.SH
index a2cde18ce4..d37cbbe87c 100755
--- a/pod/pod2html
+++ b/pod/pod2html.SH
@@ -1,4 +1,28 @@
-#!/usr/bin/perl
+case $CONFIG in
+'')
+ if test -f config.sh; then TOP=.;
+ elif test -f ../config.sh; then TOP=..;
+ elif test -f ../../config.sh; then TOP=../..;
+ elif test -f ../../../config.sh; then TOP=../../..;
+ elif test -f ../../../../config.sh; then TOP=../../../..;
+ else
+ echo "Can't find config.sh."; exit 1
+ fi
+ . $TOP/config.sh
+ ;;
+esac
+case "$0" in
+*/*) cd `expr X$0 : 'X\(.*\)/'` ;;
+esac
+echo "Extracting pod/pod2html (with variable substitutions)"
+rm -f pod2html
+$spitshell >pod2html <<!GROK!THIS!
+#!$bin/perl
+eval 'exec $bin/perl -S \$0 \${1+"\$@"}'
+ if \$running_under_some_shell;
+!GROK!THIS!
+
+$spitshell >>pod2html <<'!NO!SUBS!'
#
# pod2html - convert pod format to html
#
@@ -46,9 +70,11 @@ unless(@Pods){
# loop twice through the pods, first to learn the links, then to produce html
for $count (0,1){
+ (print "Scanning pods...\n") unless $count;
foreach $podfh ( @Pods ) {
($pod = $podfh) =~ s/\.pod$//;
Debug("files", "opening 2 $podfh" );
+ (print "Creating $pod.html from $podfh\n") if $count;
$RS = "\n=";
open($podfh,"<".$podfh) || die "can't open $podfh: $ERRNO";
@all=<$podfh>;
@@ -60,11 +86,10 @@ for $count (0,1){
$in_list=0;
$html=$pod.".html";
if($count){
- #open(HTML,">&STDOUT") || die "can't create $html: $ERRNO";
open(HTML,">$html") || die "can't create $html: $ERRNO";
print HTML <<'HTML__EOQ', <<"HTML__EOQQ";
- <!-- $RCSfile$$Date$ -->
- <!-- $Log$ -->
+ <!-- \$RCSfile\$\$Revision\$\$Date\$ -->
+ <!-- \$Log\$ -->
<HTML>
HTML__EOQ
<TITLE> \U$pod\E </TITLE>
@@ -77,44 +102,45 @@ HTML__EOQQ
($cmd, $title, $rest) = ($1,$2,$3);
if ($cmd eq "item") {
if($count ){
- ($depth) or &do_list("over",$all[$i],\$in_list,\$depth);
- &do_item($title,$rest,$in_list);
+ ($depth) or do_list("over",$all[$i],\$in_list,\$depth);
+ do_item($title,$rest,$in_list);
}
else{
# scan item
- &scan_thing("item",$title,$pod);
+ scan_thing("item",$title,$pod);
}
}
elsif ($cmd =~ /^head([12])/){
$num=$1;
if($count){
- &do_hdr($num,$title,$rest,$depth);
+ do_hdr($num,$title,$rest,$depth);
}
else{
# header scan
- &scan_thing($cmd,$title,$pod); # skip head1
+ scan_thing($cmd,$title,$pod); # skip head1
}
}
elsif ($cmd =~ /^over/) {
- $depth and &do_list("over",$all[$i+1],\$in_list,\$depth);
+ $count and $depth and do_list("over",$all[$i+1],\$in_list,\$depth);
}
elsif ($cmd =~ /^back/) {
if($count){
($depth) or next; # just skip it
- &do_list("back",$all[$i+1],\$in_list,\$depth);
- &do_rest("$title.$rest");
+ do_list("back",$all[$i+1],\$in_list,\$depth);
+ do_rest("$title.$rest");
}
}
elsif ($cmd =~ /^cut/) {
- &do_rest($rest);
+ next;
}
- else {
- warn "unrecognized header: $cmd";
+ elsif($Debug){
+ (warn "unrecognized header: $cmd") if $Debug;
}
}
+ # close open lists without '=back' stmts
if($count){
while($depth){
- &do_list("back",$all[$i+1],\$in_list,\$depth);
+ do_list("back",$all[$i+1],\$in_list,\$depth);
}
print HTML "\n</HTML>\n";
}
@@ -125,7 +151,7 @@ sub do_list{
my($which,$next_one,$list_type,$depth)=@_;
my($key);
if($which eq "over"){
- ($next_one =~ /^item\s+(.*)/ ) or warn "Bad list, $1\n";
+ ($next_one =~ /^item\s+(.*)/ ) or (warn "Bad list, $1\n") if $Debug;
$key=$1;
if($key =~ /^1\.?/){
$$list_type = "OL";
@@ -137,7 +163,7 @@ sub do_list{
$$list_type="DL";
}
else{
- warn "unknown list type for item $key";
+ (warn "unknown list type for item $key") if $Debug;
}
print HTML qq{\n};
print HTML qq{<$$list_type>};
@@ -152,16 +178,16 @@ sub do_list{
sub do_hdr{
my($num,$title,$rest,$depth)=@_;
($num == 1) and print HTML qq{<p><hr>\n};
- &process_thing(\$title,"NAME");
+ process_thing(\$title,"NAME");
print HTML qq{\n<H$num> };
print HTML $title;
print HTML qq{</H$num>\n};
- &do_rest($rest);
+ do_rest($rest);
}
sub do_item{
my($title,$rest,$list_type)=@_;
- &process_thing(\$title,"NAME");
+ process_thing(\$title,"NAME");
if($list_type eq "DL"){
print HTML qq{\n<DT><STRONG>\n};
print HTML $title;
@@ -172,13 +198,13 @@ sub do_item{
print HTML qq{\n<LI>};
($list_type ne "OL") && (print HTML $title,"\n");
}
- &do_rest($rest);
+ do_rest($rest);
print HTML ($list_type eq "DL" )? qq{</DD>} : qq{</LI>};
}
sub do_rest{
my($rest)=@_;
- my(@lines,$p,$q,$line,@paras,$inpre);
+ my(@lines,$p,$q,$line,,@paras,$inpre);
@paras=split(/\n\n+/,$rest);
for($p=0;$p<=$#paras;$p++){
@lines=split(/\n/,$paras[$p]);
@@ -207,13 +233,13 @@ inner:
foreach $q (@lines){
if($paras[$p]=~/>>|<</){
if($inpre){
- &process_thing(\$q,"HTML");
+ process_thing(\$q,"HTML");
}
else {
print HTML qq{\n</XMP>\n};
print HTML qq{<PRE>\n};
$inpre=1;
- &process_thing(\$q,"HTML");
+ process_thing(\$q,"HTML");
}
}
while($q =~ s/\t+/' 'x (length($&) * 8 - length($`) % 8)/e){
@@ -229,7 +255,7 @@ inner:
else{ # other text
@lines=split(/\n/,$paras[$p]);
foreach $line (@lines){
- &process_thing(\$line,"HTML");
+ process_thing(\$line,"HTML");
print HTML qq{$line\n};
}
}
@@ -239,9 +265,9 @@ inner:
sub process_thing{
my($thing,$htype)=@_;
- &pre_escapes($thing);
- &find_refs($thing,$htype);
- &post_escapes($thing);
+ pre_escapes($thing);
+ find_refs($thing,$htype);
+ post_escapes($thing);
}
sub scan_thing{
@@ -284,7 +310,7 @@ sub scan_thing{
Debug("headers", "header $_");
}
else {
- warn "unrecognized header: $cmd";
+ (warn "unrecognized header: $cmd") if $Debug;
}
}
@@ -316,9 +342,11 @@ sub picrefs {
}
if ($char =~ /[IF]/) {
return "<EM> $bigkey </EM>";
+ } elsif($char =~ /C/) {
+ return "<CODE> $bigkey </CODE>";
} else {
return "<STRONG> $bigkey </STRONG>";
- }
+ }
}
sub find_refs {
@@ -329,7 +357,7 @@ sub find_refs {
$$thing=~s/L<([^>]*)>/lrefs($1,$htype)/ge;
$$thing=~s/([CIBF])<(\W*?(-?\w*).*?)>/picrefs($1, $2, $3, $htype)/ge;
$$thing=~s/((\w+)\(\))/picrefs("I", $1, $2,$htype)/ge;
- $$thing=~s/([\$\@%]([\w:]+|\W\b))/varrefs($1,$htype)/ge;
+ $$thing=~s/([\$\@%](?!&[gl]t)([\w:]+|\W\b))/varrefs($1,$htype)/ge;
(($$thing eq $orig) && ($htype eq "NAME")) &&
($$thing=picrefs("I", $$thing, "", $htype));
}
@@ -354,7 +382,7 @@ sub lrefs {
if (!defined $section && defined $Podnames{$page}) {
return "\n$type$page.html\">\nthe <EM> $page </EM> manpage<\/A>\n";
} else {
- warn "Bizarre entry $page/$item";
+ (warn "Bizarre entry $page/$item") if $Debug;
return "the <EM> $_[0] </EM> manpage\n";
}
}
@@ -385,7 +413,7 @@ sub lrefs {
}
}
}
- warn "No $ref reference for $item (@_)";
+ (warn "No $ref reference for $item (@_)") if $Debug;
return $text;
}
@@ -433,7 +461,7 @@ sub noremap {
sub post_escapes {
my($thing)=@_;
$$thing=~s/[^GM]>>/\&gt\;\&gt\;/g;
- $$thing=~s/([^"MGA])>/$1\&gt\;/g;
+ $$thing=~s/([^"MGAE])>/$1\&gt\;/g;
$$thing=~tr/\200-\377/\000-\177/;
}
@@ -457,3 +485,6 @@ sub trim {
}
+!NO!SUBS!
+chmod 755 pod2html
+$eunicefix pod2html
diff --git a/pod/pod2latex b/pod/pod2latex.SH
index 9dbb2cd27b..7c9d1f6789 100755
--- a/pod/pod2latex
+++ b/pod/pod2latex.SH
@@ -1,4 +1,29 @@
-#!/usr/bin/perl
+case $CONFIG in
+'')
+ if test -f config.sh; then TOP=.;
+ elif test -f ../config.sh; then TOP=..;
+ elif test -f ../../config.sh; then TOP=../..;
+ elif test -f ../../../config.sh; then TOP=../../..;
+ elif test -f ../../../../config.sh; then TOP=../../../..;
+ else
+ echo "Can't find config.sh."; exit 1
+ fi
+ . $TOP/config.sh
+ ;;
+esac
+case "$0" in
+*/*) cd `expr X$0 : 'X\(.*\)/'` ;;
+esac
+echo "Extracting pod/pod2latex (with variable substitutions)"
+rm -f pod2latex
+$spitshell >pod2latex <<!GROK!THIS!
+#!$bin/perl
+eval 'exec $bin/perl -S \$0 \${1+"\$@"}'
+ if \$running_under_some_shell;
+!GROK!THIS!
+
+$spitshell >>pod2latex <<'!NO!SUBS!'
+#
# pod2latex, version 1.1
# by Taro Kawagish (kawagish@imslab.co.jp), Jan 11, 1995.
#
@@ -630,3 +655,6 @@ BEGIN {
"yuml" => '\\"{y}', # small y, dieresis or umlaut mark
);
}
+!NO!SUBS!
+chmod 755 pod2latex
+$eunicefix pod2latex
diff --git a/pod/pod2man b/pod/pod2man.SH
index b375b0184e..1528b0190c 100755
--- a/pod/pod2man
+++ b/pod/pod2man.SH
@@ -1,4 +1,28 @@
-#!/usr/bin/perl
+case $CONFIG in
+'')
+ if test -f config.sh; then TOP=.;
+ elif test -f ../config.sh; then TOP=..;
+ elif test -f ../../config.sh; then TOP=../..;
+ elif test -f ../../../config.sh; then TOP=../../..;
+ elif test -f ../../../../config.sh; then TOP=../../../..;
+ else
+ echo "Can't find config.sh."; exit 1
+ fi
+ . $TOP/config.sh
+ ;;
+esac
+case "$0" in
+*/*) cd `expr X$0 : 'X\(.*\)/'` ;;
+esac
+echo "Extracting pod/pod2man (with variable substitutions)"
+rm -f pod2man
+$spitshell >pod2man <<!GROK!THIS!
+#!$bin/perl
+eval 'exec $bin/perl -S \$0 \${1+"\$@"}'
+ if \$running_under_some_shell;
+!GROK!THIS!
+
+$spitshell >>pod2man <<'!NO!SUBS!'
$/ = "";
$cutting = 1;
@@ -623,3 +647,6 @@ BEGIN {
"yuml" => "y\\*:", # small y, dieresis or umlaut mark
);
}
+!NO!SUBS!
+chmod 755 pod2man
+$eunicefix pod2man
diff --git a/pp_hot.c b/pp_hot.c
index 45a4432023..2812428c41 100644
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -1560,6 +1560,7 @@ PP(pp_entersub)
HV *stash;
register CV *cv;
register CONTEXT *cx;
+ I32 gimme;
if (!sv)
DIE("Not a CODE reference");
@@ -1632,6 +1633,8 @@ PP(pp_entersub)
DIE("No DBsub routine");
}
+ gimme = GIMME;
+
if (CvXSUB(cv)) {
if (CvOLDSTYLE(cv)) {
I32 (*fp3)_((int,int,int));
@@ -1655,7 +1658,7 @@ PP(pp_entersub)
(void)(*CvXSUB(cv))(cv);
/* Enforce some sanity in scalar context. */
- if (GIMME == G_SCALAR && ++markix != stack_sp - stack_base ) {
+ if (gimme == G_SCALAR && ++markix != stack_sp - stack_base ) {
if (markix > stack_sp - stack_base)
*(stack_base + markix) = &sv_undef;
else
@@ -1670,7 +1673,6 @@ PP(pp_entersub)
dMARK;
register I32 items = SP - MARK;
I32 hasargs = (op->op_flags & OPf_STACKED) != 0;
- I32 gimme = GIMME;
AV* padlist = CvPADLIST(cv);
SV** svp = AvARRAY(padlist);
push_return(op->op_next);
diff --git a/pp_sys.c b/pp_sys.c
index 48182e1069..87769759dd 100644
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -1116,7 +1116,7 @@ PP(pp_truncate)
GV *tmpgv;
SETERRNO(0,0);
-#if defined(HAS_TRUNCATE) || defined(HAS_CHSIZE)
+#if defined(HAS_TRUNCATE) || defined(HAS_CHSIZE) || defined(F_FREESP)
#ifdef HAS_TRUNCATE
if (op->op_flags & OPf_SPECIAL) {
tmpgv = gv_fetchpv(POPp,FALSE, SVt_PVIO);
@@ -2321,7 +2321,8 @@ char *cmd;
char *filename;
{
char mybuf[8192];
- char *s, *tmps;
+ char *s,
+ *save_filename = filename;
int anum = 1;
FILE *myfp;
@@ -2373,7 +2374,7 @@ char *filename;
return 0;
}
else { /* some mkdirs return no failure indication */
- anum = (Stat(filename, &statbuf) >= 0);
+ anum = (Stat(save_filename, &statbuf) >= 0);
if (op->op_type == OP_RMDIR)
anum = !anum;
if (anum)
diff --git a/sv.c b/sv.c
index d2fecd0728..4a7a02d3da 100644
--- a/sv.c
+++ b/sv.c
@@ -1038,7 +1038,7 @@ register SV *sv;
if (SvNVX(sv) < 0.0)
return I_V(SvNVX(sv));
else
- return (IV)(UV)SvNVX(sv);
+ return (IV) U_V(SvNVX(sv));
}
if (SvPOKp(sv) && SvLEN(sv)) {
if (dowarn && !looks_like_number(sv))
@@ -1061,7 +1061,7 @@ register SV *sv;
if (SvNVX(sv) < 0.0)
return I_V(SvNVX(sv));
else
- return (IV)(UV)SvNVX(sv);
+ return (IV) U_V(SvNVX(sv));
}
if (SvPOKp(sv) && SvLEN(sv)) {
if (dowarn && !looks_like_number(sv))
@@ -1088,7 +1088,7 @@ register SV *sv;
if (SvNVX(sv) < 0.0)
SvIVX(sv) = I_V(SvNVX(sv));
else
- SvIVX(sv) = (IV)(UV)SvNVX(sv);
+ SvIVX(sv) = (IV) U_V(SvNVX(sv));
}
else if (SvPOKp(sv) && SvLEN(sv)) {
if (dowarn && !looks_like_number(sv))
diff --git a/util.c b/util.c
index 4a45c5ef99..9b3dd87896 100644
--- a/util.c
+++ b/util.c
@@ -29,6 +29,10 @@
# include <vfork.h>
#endif
+#ifdef I_LIMITS /* Needed for cast_xxx() functions below. */
+# include <limits.h>
+#endif
+
/* Put this after #includes because fork and vfork prototypes may
conflict.
*/
@@ -1575,36 +1579,75 @@ double f;
#endif
#ifndef CASTI32
+
+/* Look for MAX and MIN integral values. If we can't find them,
+ we'll use 32-bit two's complement defaults.
+*/
+#ifndef LONG_MAX
+# ifdef MAXLONG /* Often used in <values.h> */
+# define LONG_MAX MAXLONG
+# else
+# define LONG_MAX 2147483647L
+# endif
+#endif
+
+#ifndef LONG_MIN
+# define LONG_MIN (-LONG_MAX - 1)
+#endif
+
+#ifndef ULONG_MAX
+# ifdef MAXULONG
+# define LONG_MAX MAXULONG
+# else
+# define ULONG_MAX 4294967295L
+# endif
+#endif
+
+/* Unfortunately, on some systems the cast_uv() function doesn't
+ work with the system-supplied definition of ULONG_MAX. The
+ comparison (f >= ULONG_MAX) always comes out true. It must be a
+ problem with the compiler constant folding.
+
+ In any case, this workaround should be fine on any two's complement
+ system. If it's not, supply a '-DMY_ULONG_MAX=whatever' in your
+ ccflags.
+ --Andy Dougherty <doughera@lafcol.lafayette.edu>
+*/
+#ifndef MY_ULONG_MAX
+# define MY_ULONG_MAX ((UV)LONG_MAX * (UV)2 + (UV)1)
+#endif
+
I32
cast_i32(f)
double f;
{
-# define BIGDOUBLE 2147483647.0 /* Assume 32 bit int's ! */
-# define BIGNEGDOUBLE (-2147483648.0)
- if (f >= BIGDOUBLE)
- return (I32) BIGDOUBLE;
- if (f <= BIGNEGDOUBLE)
- return (I32) BIGNEGDOUBLE;
+ if (f >= LONG_MAX)
+ return (I32) LONG_MAX;
+ if (f <= LONG_MIN)
+ return (I32) LONG_MIN;
return (I32) f;
}
-# undef BIGDOUBLE
-# undef BIGNEGDOUBLE
IV
cast_iv(f)
double f;
{
- /* XXX This should be fixed. It assumes 32 bit IV's. */
-# define BIGDOUBLE 2147483647.0 /* Assume 32 bit IV's ! */
-# define BIGNEGDOUBLE (-2147483648.0)
- if (f >= BIGDOUBLE)
- return (IV) BIGDOUBLE;
- if (f <= BIGNEGDOUBLE)
- return (IV) BIGNEGDOUBLE;
+ if (f >= LONG_MAX)
+ return (IV) LONG_MAX;
+ if (f <= LONG_MIN)
+ return (IV) LONG_MIN;
return (IV) f;
}
-# undef BIGDOUBLE
-# undef BIGNEGDOUBLE
+
+UV
+cast_uv(f)
+double f;
+{
+ if (f >= MY_ULONG_MAX)
+ return (UV) MY_ULONG_MAX;
+ return (UV) f;
+}
+
#endif
#ifndef HAS_RENAME