diff options
author | Nick Ing-Simmons <nik@tiuk.ti.com> | 1998-07-19 12:38:30 +0000 |
---|---|---|
committer | Nick Ing-Simmons <nik@tiuk.ti.com> | 1998-07-19 12:38:30 +0000 |
commit | a15299417de39f35d2ce17e6891b4f961265fb6a (patch) | |
tree | 676ab2ce1d7c4e738906552a4d6c4f71645f7d16 | |
parent | 911d147d409bfec728014bf1ae544556d9e97f28 (diff) | |
parent | bdda3fbd757cd1d51073d4e041d25f173c8b2f82 (diff) | |
download | perl-a15299417de39f35d2ce17e6891b4f961265fb6a.tar.gz |
Merge Mainline
p4raw-id: //depot/ansiperl@1566
-rw-r--r-- | Changes | 12 | ||||
-rw-r--r-- | INSTALL | 18 | ||||
-rw-r--r-- | Makefile.SH | 2 | ||||
-rw-r--r-- | README.mpeix | 28 | ||||
-rw-r--r-- | README.threads | 80 | ||||
-rw-r--r-- | cygwin32/ld2 | 2 | ||||
-rw-r--r-- | ext/re/re.pm | 8 | ||||
-rwxr-xr-x | fixvars | 69 | ||||
-rw-r--r-- | hints/aix.sh | 7 | ||||
-rw-r--r-- | hints/dec_osf.sh | 7 | ||||
-rw-r--r-- | hints/freebsd.sh | 56 | ||||
-rw-r--r-- | hints/hpux.sh | 23 | ||||
-rw-r--r-- | hints/irix_6.sh | 28 | ||||
-rw-r--r-- | hints/mpeix.sh | 2 | ||||
-rw-r--r-- | lib/ExtUtils/MakeMaker.pm | 14 | ||||
-rw-r--r-- | lib/Test/Harness.pm | 29 | ||||
-rw-r--r-- | lib/perl5db.pl | 34 | ||||
-rw-r--r-- | os2/os2.sym | 12 | ||||
-rw-r--r-- | pod/perlcall.pod | 74 | ||||
-rw-r--r-- | pod/perldiag.pod | 4 | ||||
-rw-r--r-- | pod/perlop.pod | 10 | ||||
-rw-r--r-- | pod/perltrap.pod | 37 | ||||
-rw-r--r-- | pp.c | 25 | ||||
-rw-r--r-- | pp_hot.c | 8 | ||||
-rw-r--r-- | sv.c | 8 | ||||
-rwxr-xr-x | t/comp/multiline.t | 8 | ||||
-rwxr-xr-x | t/op/pat.t | 27 | ||||
-rwxr-xr-x | t/op/subst.t | 6 | ||||
-rw-r--r-- | toke.c | 8 | ||||
-rw-r--r-- | utils/perlcc.PL | 29 |
30 files changed, 449 insertions, 226 deletions
@@ -28,13 +28,16 @@ current addresses (as of March 1997): Andreas Koenig <a.koenig@mind.de> Doug MacEachern <dougm@opengroup.org> Paul Marquess <pmarquess@bfsec.bt.co.uk> + Stephen McCamant <alias@mcs.com> Hans Mulder <hansm@euronet.nl> Jeff Okamoto <okamoto@hpcc123.corp.hp.com> Ulrich Pfeifer <pfeifer@charly.informatik.uni-dortmund.de> Tom Phoenix <rootbeer@teleport.com> Norbert Pueschel <pueschel@imsdd.meb.uni-bonn.de> Dean Roehrich <roehrich@cray.com> + Hugo van der Sanden <hv@crypt0.demon.co.uk> Roderick Schertler <roderick@argon.org> + Dan Sugalski <sugalskd@osshe.edu> Larry W. Virden <lvirden@cas.org> Ilya Zakharevich <ilya@math.ohio-state.edu> @@ -69,6 +72,15 @@ Version 5.004_75 5.005 Public Beta, Issue 1 ---------------- ____________________________________________________________________________ +[ 1518] By: gsar on 1998/07/15 10:01:41 + Log: add stub docs for ext/B, other minor tweaks + Branch: perl + ! Changes Porting/config_H config_h.SH ext/B/B.pm + ! ext/B/B/Asmdata.pm ext/B/B/Assembler.pm ext/B/B/Bblock.pm + ! ext/B/B/Bytecode.pm ext/B/B/C.pm ext/B/B/CC.pm + ! ext/B/B/Debug.pm ext/B/B/Disassembler.pm ext/B/B/Showlex.pm + ! ext/B/B/Stackobj.pm ext/B/B/Terse.pm ext/B/O.pm sv.c +____________________________________________________________________________ [ 1517] By: gsar on 1998/07/15 08:27:15 Log: up patchlevel to 75 (Beta, Issue 1), add podpatch From: abigail@fnx.com @@ -773,14 +773,18 @@ config.sh. For example, you can replace the rand() and srand() functions in the perl source by any other random number generator by a trick such as the -following: +following (this should all be on one line): - sh Configure -Dccflags='-Drand=random -Dsrand=srandom' + sh Configure -Dccflags='-Dmy_rand=random -Dmy_srand=srandom' \ + -Drandbits=31 -or by adding -Drand=random and -Dsrand=srandom to your ccflags -at the appropriate Configure prompt. (Note: Although this worked for -me, it might not work for you if your system's header files give -different prototypes for rand() and random() or srand() and srandom().) +or you can use the drand48 family of functions with + + sh Configure -Dccflags='-Dmy_rand=lrand48 -Dmy_srand=srand48' \ + -Drandbits=31 + +or by adding the -D flags to your ccflags at the appropriate Configure +prompt. (Read pp.c to see how this works.) You should also run Configure interactively to verify that a hint file doesn't inadvertently override your ccflags setting. (Hints files @@ -1573,4 +1577,4 @@ the contact information to match your distribution. =head1 LAST MODIFIED -$Id: INSTALL,v 1.40 1998/07/06 14:49:02 doughera Released $ +$Id: INSTALL,v 1.42 1998/07/15 18:04:44 doughera Released $ diff --git a/Makefile.SH b/Makefile.SH index 260c23515c..050e471e7d 100644 --- a/Makefile.SH +++ b/Makefile.SH @@ -387,6 +387,7 @@ lib/ExtUtils/Miniperl.pm: miniperlmain.c miniperl minimod.pl lib/Config.pm sh mv-if-diff tmp $@ lib/re.pm: ext/re/re.pm + rm -f $@ cat ext/re/re.pm > $@ $(plextract): miniperl lib/Config.pm lib/re.pm @@ -400,6 +401,7 @@ install.perl: all installperl cd utils; $(MAKE) compile; \ cd ../x2p; $(MAKE) compile; \ cd ../pod; $(MAKE) compile; \ + else :; \ fi $(LDLIBPTH) ./perl installperl diff --git a/README.mpeix b/README.mpeix index bb81fb1f84..9e0b51d796 100644 --- a/README.mpeix +++ b/README.mpeix @@ -1,26 +1,26 @@ - Perl/iX for HP 3000 MPE http://www.cccd.edu/~markb/perlix.html Perl language for MPE -Last updated July 8, 1998 @ 2030 UTC +Last updated July 15, 1998 @ 2030 UTC ------------------------------------------------------------------------ What's New + * July 15, 1998 + o Changed startperl to #!/PERL/PUB/perl so that Perl will recognize + scripts more easily and efficiently. * July 8, 1998 o Updated to version 5.004_70 (internal developer release) which is now MPE-ready. The next public freeware release of Perl should compile "straight out of the box" on MPE. Note that this version of Perl/iX was strictly internal to me and never publicly - released. + released. Note that BIND/iX is now required (well, the include + files and libbind.a) if you wish to compile Perl/iX. * November 6, 1997 o Updated to version 5.004_04. No changes in MPE-specific functionality. - * October 16, 1997 - o Added Demos section to the Perl/iX home page so you can see some - sample Perl applications running on my 3000. ------------------------------------------------------------------------ @@ -95,7 +95,7 @@ anonymous your@email.address bytestream cd /pub/mpe -get perl5.004_70.tar.Z /tmp/perl.tar.Z +get perl5.005.tar.Z /tmp/perl.tar.Z exit .....Or download using some other generic web or ftp client (the alternate @@ -104,8 +104,8 @@ method) Download the following files (make sure that you use "binary mode" or whatever client feature that is 8-bit clean): - * Perl from http://www.cccd.edu/ftp/pub/mpe/perl5.004_70.tar.Z or - ftp://ftp.cccd.edu/pub/mpe/perl5.004_70.tar.Z + * Perl from http://www.cccd.edu/ftp/pub/mpe/perl5.005.tar.Z or + ftp://ftp.cccd.edu/pub/mpe/perl5.005.tar.Z Upload those files to your HP 3000 in an 8-bit clean bytestream manner to: @@ -147,14 +147,14 @@ man/ Perl man page documentation. public_html/feedback.cgi Sample feedback CGI form written in Perl. -src/perl5.004_70 +src/perl5.005 Source code. ------------------------------------------------------------------------ How to Compile Perl/iX - 1. cd src/perl5.004_70 + 1. cd src/perl5.005 2. Read the INSTALL file for the official instructions 3. ./Configure 4. make @@ -181,7 +181,7 @@ Failed 6/183 test scripts, 96.72% okay. 31/5899 subtests failed, 99.47% okay. Getting Started with Perl/iX -Create your Perl script files with "#!/PERL/PUB/PERL" (or an equivalent +Create your Perl script files with "#!/PERL/PUB/perl" (or an equivalent symbolic link) as the first line. Use the chmod command to make sure that your script has execute permission. Run your script! @@ -243,6 +243,9 @@ To-Do List Change History + * October 16, 1997 + o Added Demos section to the Perl/iX home page so you can see some + sample Perl applications running on my 3000. * October 3, 1997 o Added System Requirements section to the Perl/iX home page just so the prerequisites stand out more. Various other home page @@ -255,4 +258,3 @@ Change History ------------------------------------------------------------------------ Mark Bixby, markb@cccd.edu - diff --git a/README.threads b/README.threads index db54f7a1ce..e9f69663f9 100644 --- a/README.threads +++ b/README.threads @@ -2,6 +2,7 @@ Building If you want to build with multi-threading support and you are running one of the following: + * Linux 2.x (with the LinuxThreads library installed: that's the linuxthreads and linuxthreads-devel RPMs for RedHat) @@ -15,48 +16,52 @@ running one of the following: IRIX 6.3 and up should be OK. See lower down for patch details. then you should be able to use - ./Configure -Dusethreads -Doptimize=-g -ders + + ./Configure -Dusethreads -des make + and ignore the rest of this "Building" section. If it doesn't work or you are using another platform which you believe supports -POSIX.1c threads then read on. - -Omit the -e from your ./Configure arguments. For example, use - ./Configure -drs -When it offers to let you change config.sh, do so. If you already -have a config.sh then you can edit it and do - ./Configure -S -to propagate the required changes. -In ccflags, insert -DUSE_THREADS (and probably -DDEBUGGING since -that's what I've been building with). Also insert any other -arguments in there that your compiler needs to use POSIX threads. -Change optimize to -g to give you better debugging information. -Include any necessary explicit libraries in libs and change -ldflags if you need any linker flags instead or as well. - -More explicitly, for Linux (when using the standard kernel-threads -based LinuxThreads library): - Add -DUSE_THREADS -D_REENTRANT -DDEBUGGING to ccflags and cppflags - Add -lpthread to libs - Change optimize to -g +POSIX.1c threads then read on. Additional information may be in +a platform-specific "hints" file in the hints/ subdirectory. + +Omit the -d from your ./Configure arguments. For example, use + + ./Configure -Dusethreads + +When Configure prompts you for ccflags, insert any other arguments in +there that your compiler needs to use POSIX threads. When Configure +prompts you for linking flags, include any flags required for +threading (usually nothing special is required here). Finally, when +COnfigure prompts you for libraries, include any necessary libraries +(e.g. -lpthread). Pay attention to the order of libraries. It is +probably necessary to specify your threading library *before* your +standard C library, e.g. it might be necessary to have -lpthread -lc, +instead of -lc -lpthread. + +Once you have specified all your compiler flags, you can have Configure +accept all the defaults for the remainder of the session by typing &-d +at any Configure prompt. + +Some additional notes (some of these may be obsolete now, other items +may be handled automatically): + For Digital Unix 4.x: - Add -pthread -DUSE_THREADS -DDEBUGGING to ccflags - Add -DUSE_THREADS -DDEBUGGING to cppflags + Add -pthread to ccflags Add -pthread to ldflags - Change optimize to -g Add -lpthread -lc_r to lddlflags + For some reason, the extra includes for pthreads make Digital UNIX complain fatally about the sbrk() delcaration in perl's malloc.c - so use the native malloc as follows: - Change usemymalloc to n - Zap mallocobj and mallocsrc (foo='') - Change d_mymalloc to undef -For Solaris, do the same as for Linux above. + so use the native malloc, e.g. sh Configure -Uusemymalloc, or + manually edit your config.sh as follows: + Change usemymalloc to n + Zap mallocobj and mallocsrc (foo='') + Change d_mymalloc to undef + For IRIX: - Add -DUSE_THREADS -DDEBUGGING to ccflags - Add -DUSE_THREADS -DDEBUGGING to cppflags + (This should all be done automatically by the hint file). Add -lpthread to libs - Change optimize to -g For IRIX 6.2, you have to have the following patches installed: 1404 Irix 6.2 Posix 1003.1b man pages 1645 IRIX 6.2 & 6.3 POSIX header file updates @@ -71,9 +76,9 @@ For IRIX: Thanks to Hannu Napari <Hannu.Napari@hut.fi> for the IRIX pthreads patches information. For AIX: + (This should all be done automatically by the hint file). Change cc to xlc_r or cc_r. - Add -DUSE_THREADS -DNEED_PTHREAD_INIT -DDEBUGGING to ccflags and cppflags - Change optimize to -g + Add -DNEED_PTHREAD_INIT to ccflags and cppflags Add -lc_r to libswanted Change -lc in lddflags to be -lpthread -lc_r -lc @@ -83,9 +88,7 @@ Now you can do a O/S specific bugs -Solaris qsort uses a hidden mutex for synchronisation. If you die() -while doing a sort() then the resulting longjmp() leaves the mutex -locked so you get a deadlock the next time you try to sort(). +Irix 6.2: See the Irix warning above. LinuxThreads 0.5 has a bug which can cause file descriptor 0 to be closed after a fork() leading to many strange symptoms. Version 0.6 @@ -259,3 +262,6 @@ ZOMBIE ----------------------------> DEAD Malcolm Beattie mbeattie@sable.ox.ac.uk Last updated: 27 November 1997 + +Configure-related info updated 16 July 1998 by +Andy Dougherty <doughera@lafayette.edu> diff --git a/cygwin32/ld2 b/cygwin32/ld2 index 9aec8798fe..cdec9d96ef 100644 --- a/cygwin32/ld2 +++ b/cygwin32/ld2 @@ -4,6 +4,6 @@ # passes all args to ld. # -PERLPATH=/perl5.004 +PERLPATH=/perl5.005 $PERLPATH/perl $PERLPATH/perlld "$@" diff --git a/ext/re/re.pm b/ext/re/re.pm index 8b49ca14f4..4a44753172 100644 --- a/ext/re/re.pm +++ b/ext/re/re.pm @@ -81,11 +81,9 @@ sub bits { } foreach my $s (@_){ if ($s eq 'debug') { - eval <<'EOE'; - use DynaLoader; - @ISA = ('DynaLoader'); - bootstrap re; -EOE + require DynaLoader; + @ISA = ('DynaLoader'); + bootstrap re; install() if $on; uninstall() unless $on; next; diff --git a/fixvars b/fixvars new file mode 100755 index 0000000000..a211e5816f --- /dev/null +++ b/fixvars @@ -0,0 +1,69 @@ +#!/usr/local/bin/perl -w +use Data::Dumper; + +my $targ = (@ARGV) ? join(' ',@ARGV) : 'miniperl' ; + +my $work = 1; +while ($work) + { + open(PIPE,"make $targ 2>&1 |") || die "Cannot open pipe to make:$!"; + my %fix; + while (<PIPE>) + { + if (/^(.*):(\d+):\s+\`(\w+)'\s+undeclared/ && -f $1 ) + { + my ($file,$line,$var) = ($1,$2,$3); + $fix{$file} = [] unless exists $fix{$file}; + push(@{$fix{$file}},[$line => $var]) unless ($var =~ /^PL_/ || $file =~ /\.h$/); + } + print; + } + close(PIPE); + warn "Make retured $?\n"; + last unless $?; + my $changed = 0; + foreach my $file (keys %fix) + { + my @ar = sort( { $a->[0] <=> $b->[0] } @{delete $fix{$file}}); + my @miss; + my $fixed = 0; + unless (-w $file) + { + system("d4","edit",$file); + } + @ARGV = ($file); + $. = 0; + local $^I = '.sav'; + while (<>) + { + while (@ar && $. == $ar[0][0]) + { + my ($line,$var) = @{shift(@ar)}; + if (s/\b$var\b/PL_$var/) + { + warn "$file:$line: FIX $var\n"; + $fixed++; + $changed++; + } + else + { + push(@miss,[$line,$var,$_]); + } + } + print; + } + unless ($fixed) + { + rename("$file$^I",$file); + if (@miss) + { + while (@miss) + { + my ($line,$var,$txt) = @{shift(@miss)}; + warn "$file:$line:$var | $txt"; + } + } + } + } + last unless $changed; + } diff --git a/hints/aix.sh b/hints/aix.sh index 10e7603f78..25e2048931 100644 --- a/hints/aix.sh +++ b/hints/aix.sh @@ -92,4 +92,11 @@ EOM # Add the POSIX threads library and the re-entrant libc. lddlflags=`echo $lddlflags | sed 's/ -lc$/ -lpthreads -lc_r -lc/'` + + # Add the c_r library to the list of libraries wanted + # Make sure the c_r library is before the c library or + # make will fail. + set `echo X "$libswanted "| sed -e 's/ c / c_r c /'` + shift + libswanted="$*" fi diff --git a/hints/dec_osf.sh b/hints/dec_osf.sh index 5055302353..a531ea8c8f 100644 --- a/hints/dec_osf.sh +++ b/hints/dec_osf.sh @@ -121,11 +121,8 @@ esac # no attempt to figure out the additional location(s) searched by # gcc, since not all versions of gcc are easily coerced into # revealing that information. -# -# This or the new useshrplib default below breaks the build. -# Commented out for this snapshot. -#glibpth="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc" -#glibpth="$glibpth /usr/lib /usr/local/lib /var/shlib" +glibpth="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc" +glibpth="$glibpth /usr/lib /usr/local/lib /var/shlib" # dlopen() is in libc libswanted="`echo $libswanted | sed -e 's/ dl / /'`" diff --git a/hints/freebsd.sh b/hints/freebsd.sh index f1bbd60457..0f2a5a5a6d 100644 --- a/hints/freebsd.sh +++ b/hints/freebsd.sh @@ -94,6 +94,15 @@ esac # out here to avoid duplicating them everywhere. case "$osvers" in 0.*|1.0*) ;; + +3.0*) if [ -e /usr/lib/aout ]; then + libpth="/usr/lib/aout /usr/local/lib /usr/lib" + glibpth="/usr/lib/aout /usr/local/lib /usr/lib" + fi + cccdlflags='-DPIC -fpic' + lddlflags='-Bshareable' + ;; + *) cccdlflags='-DPIC -fpic' lddlflags="-Bshareable $lddlflags" ;; @@ -115,31 +124,30 @@ EOM cat > UU/usethreads.cbu <<'EOSH' case "$usethreads" in $define) - if [ ! -r /usr/lib/libc_r.a ]; then - cat <<'EOM' >&4 - -The re-entrant C library /usr/lib/libc_r.a does not exist; cannot build -threaded Perl. Consider upgrading to a newer FreeBSD snapshot or release: -at least the FreeBSD 3.0-971225-SNAP is known to have the libc_r.a. - + case "$osvers" in + 3.0*) ldflags="-pthread $ldflags" + ;; + 2.2*) if [ ! -r /usr/lib/libc_r ]; then + cat <<'EOM' >&4 +POSIX threads are not supported by default on FreeBSD $uname_r. Follow the +instructions in 'man pthread' to build and install the needed libraries. EOM - exit 1 - fi - # Patches to libc_r may be required. - # Print out a note about them here. - - # These checks by Andy Dougherty <doughera@lafcol.lafayette.edu> - # Please update or change them as you learn more! - # -lc_r must REPLACE -lc. AD 03/10/1998 - set `echo X "$libswanted "| sed -e 's/ c / c_r /'` - shift - libswanted="$*" - # Configure will probably pick the wrong libc to use for nm scan. - # The safest quick-fix is just to not use nm at all. - usenm=false - # Is vfork buggy in 3.0? - case "$osvers" in - 3.0) usevfork=false ;; + exit 1 + fi + set `echo X "$libswanted "| sed -e 's/ c / c_r /'` + shift + libswanted="$*" + # Configure will probably pick the wrong libc to use for nm + # scan. + # The safest quick-fix is just to not use nm at all. + usenm=false + ;; + *) cat <<'EOM' >&4 +It is not known if FreeBSD $uname_r supports POSIX threads or not. Consider +upgrading to the latest STABLE release. +EOM + exit 1 + ;; esac ;; esac diff --git a/hints/hpux.sh b/hints/hpux.sh index 9b8b3b48ef..84669242de 100644 --- a/hints/hpux.sh +++ b/hints/hpux.sh @@ -185,10 +185,21 @@ esac # These warnings are harmless and can be safely ignored. # -# You should enable these if you use the unbundled ANSI C compiler -# (*not* when using the bundled K&R compiler or gcc) -# [XXX this should be enabled automatically] +# cppstdin and cpprun need the -Aa option if you use the unbundled +# ANSI C compiler (*not* the bundled K&R compiler or gcc) +# [XXX this should be enabled automatically by Configure, but isn't yet.] +# [XXX This is reported not to work. You may have to edit config.sh. +# After running Configure, set cpprun and cppstdin in config.sh, +# run "Configure -S" and then "make".] # -#cpprun='/opt/ansic/bin/cc -E -Aa' -#cppstdin="$cpprun" - +case "$cppstdin" in +'') + case "$ccflags" in + *-Aa*) + cpprun="${cc:-cc} -E -Aa" + cppstdin="$cpprun" + cppminus='-' + ;; + esac + ;; +esac diff --git a/hints/irix_6.sh b/hints/irix_6.sh index 40d42914de..676aacb5ed 100644 --- a/hints/irix_6.sh +++ b/hints/irix_6.sh @@ -45,28 +45,38 @@ esac case "$cc" in *"cc -n32"*) + # Perl 5.004_57 introduced new qsort code into pp_ctl.c that + # makes IRIX cc prior to 7.2.1 to emit bad code. + # so some serious hackery follows to set pp_ctl flags correctly. + # Check for which version of the compiler we're running case "`$cc -version 2>&1`" in *7.0*) # Mongoose 7.0 ccflags="$ccflags -D_BSD_TYPES -D_BSD_TIME -woff 1009,1042,1048,1110,1116,1184 -OPT:Olimit=0" optimize='none' ;; - *7.*) # Mongoose 7.1+ + *7.1*|*7.2) # Mongoose 7.1+ ccflags="$ccflags -D_BSD_TYPES -D_BSD_TIME -woff 1009,1110,1184 -OPT:Olimit=0" optimize='-O3' + pp_ctl_cflags='optimize=-O' + ;; + *7.*) # Mongoose 7.2.1+ + ccflags="$ccflags -D_BSD_TYPES -D_BSD_TIME -woff 1009,1110,1184 -OPT:Olimit=0:space=on" + optimize='-O3' ;; *6.2*) # Ragnarok 6.2 ccflags="$ccflags -D_BSD_TYPES -D_BSD_TIME -woff 1009,1110,1184" optimize='none' ;; *) # Be safe and not optimize - ccflags="$ccflags -D_BSD_TYPES -D_BSD_TIME -woff 1009,1110,1184 -OPT:Olimit=0" + ccflags="$ccflags -D_BSD_TYPES -D_BSD_TIME -woff 1009,1110,1184 -OPT:Olimit=0" optimize='none' ;; esac ld=ld - ldflags=' -L/usr/local/lib -L/usr/lib32 -L/lib32' + # NOTE: -L/usr/lib32 -L/lib32 are automatically selected by the linker + ldflags=' -L/usr/local/lib32 -L/usr/local/lib' cccdlflags=' ' # From: David Billinghurst <David.Billinghurst@riotinto.com.au> # If you get complaints about so_locations then change the following @@ -120,17 +130,13 @@ set `echo X "$libswanted "|sed -e 's/ sun / /' -e 's/ crypt / /' -e 's/ bsd / /' shift libswanted="$*" -# Perl 5.004_57 introduced new qsort code into pp_ctl.c that -# makes IRIX 6.2 cc to emit bad code. -pp_ctl_cflags='optimize=-O' - -if [ "X$usethreads" = "X$define" ]; then +if [ "X$usethreads" = "X$define" -o "X$usethreads" = "Xy" ]; then if test ! -f /usr/include/pthread.h -o ! -f /usr/lib/libpthread.so; then uname_r=`uname -r` case "`uname -r`" in - 6.0|6.1) + 5*|6.0|6.1) echo >&4 "IRIX $uname_r does not have the POSIX threads." - echo >&4 "You should upgrade to at least IRIX 6.3." + echo >&4 "You should upgrade to at least IRIX 6.2 with pthread patches." echo >&4 "Cannot continue, aborting." exit 1 ;; @@ -138,7 +144,7 @@ if [ "X$usethreads" = "X$define" ]; then echo >&4 "" cat >&4 <<EOF IRIX 6.2 $uname_r can have the POSIX threads. -The following IRIX patches must, however, be installed: +The following IRIX patches (or their replacements) must, however, be installed: 1404 Irix 6.2 Posix 1003.1b man pages 1645 IRIX 6.2 & 6.3 POSIX header file updates diff --git a/hints/mpeix.sh b/hints/mpeix.sh index de3adcaa8d..4a32b77fa2 100644 --- a/hints/mpeix.sh +++ b/hints/mpeix.sh @@ -33,7 +33,7 @@ man1dir="$prefix/man/man1" man3dir="$prefix/man/man3" perlpath="$prefix/PERL" scriptdir="$prefix" -startperl="#!$perlpath" +startperl="#!$prefix/perl" startsh='#!/bin/sh' # # Compiling. diff --git a/lib/ExtUtils/MakeMaker.pm b/lib/ExtUtils/MakeMaker.pm index 267b809b21..5b7bb0b6da 100644 --- a/lib/ExtUtils/MakeMaker.pm +++ b/lib/ExtUtils/MakeMaker.pm @@ -1758,14 +1758,14 @@ or you can edit the default by saying something like: $inherited; } -If you running experiments with embedding perl as a library into other -applications, you might find MakeMaker not sufficient. You'd better -have a look at ExtUtils::embed which is a collection of utilities for -embedding. +If you are running experiments with embedding perl as a library into +other applications, you might find MakeMaker is not sufficient. You'd +better have a look at ExtUtils::Embed which is a collection of utilities +for embedding. If you still need a different solution, try to develop another -subroutine, that fits your needs and submit the diffs to -F<perl5-porters@nicoh.com> or F<comp.lang.perl.misc> as appropriate. +subroutine that fits your needs and submit the diffs to +F<perl5-porters@perl.org> or F<comp.lang.perl.moderated> as appropriate. For a complete description of all MakeMaker methods see L<ExtUtils::MM_Unix>. @@ -1919,7 +1919,7 @@ different means on the current architecture). =head1 SEE ALSO ExtUtils::MM_Unix, ExtUtils::Manifest, ExtUtils::testlib, -ExtUtils::Install, ExtUtils::embed +ExtUtils::Install, ExtUtils::Embed =head1 AUTHORS diff --git a/lib/Test/Harness.pm b/lib/Test/Harness.pm index e2c47d62ad..5decc756ff 100644 --- a/lib/Test/Harness.pm +++ b/lib/Test/Harness.pm @@ -11,7 +11,13 @@ use vars qw($VERSION $verbose $switches $have_devel_corestack $curtest @ISA @EXPORT @EXPORT_OK); $have_devel_corestack = 0; -$VERSION = "1.1601"; +$VERSION = "1.1602"; + +# Some experimental versions of OS/2 build have broken $? +my $ignore_exitcode = $ENV{HARNESS_IGNORE_EXITCODE}; + +my $tests_skipped = 0; +my $subtests_skipped = 0; @ISA=('Exporter'); @EXPORT= qw(&runtests); @@ -123,7 +129,7 @@ sub runtests { } } $fh->close; # must close to reap child resource values - my $wstatus = $?; + my $wstatus = $ignore_exitcode ? 0 : $?; # Can trust $? ? my $estatus; $estatus = ($^O eq 'VMS' ? eval 'use vmsish "status"; $estatus = $?' @@ -172,6 +178,7 @@ sub runtests { print "ok\n"; } else { print "skipping test on this platform\n"; + $tests_skipped++; } $good++; } elsif ($max) { @@ -204,6 +211,7 @@ sub runtests { estat => '', wstat => '', }; } + $subtests_skipped += $skipped; } my $t_total = timediff(new Benchmark, $t_start); @@ -218,6 +226,16 @@ sub runtests { $bonusmsg = (" ($totbonus subtest".($totbonus>1?'s':''). " UNEXPECTEDLY SUCCEEDED)") if $totbonus; + if ($tests_skipped) { + $bonusmsg .= ", $tests_skipped test" . ($tests_skipped != 1 ? 's' : '') . + ' skipped'; + } + if ($subtests_skipped) { + $bonusmsg .= ($tests_skipped ? ', plus ' : ', '). + "$subtests_skipped subtest" + . ($subtests_skipped != 1 ? 's' : '') . + " skipped"; + } if ($bad == 0 && $totmax) { print "All tests successful$bonusmsg.\n"; } elsif ($total==0){ @@ -235,6 +253,8 @@ sub runtests { write; } if ($bad) { + $bonusmsg =~ s/^,\s*//; + print "$bonusmsg.\n" if $bonusmsg; die "Failed $bad/$total test scripts, $pct% okay.$subpct\n"; } } @@ -399,6 +419,11 @@ above messages. =back +=head1 ENVIRONMENT + +Setting C<HARNESS_IGNORE_EXITCODE> makes it ignore the exit status +of child processes. + =head1 SEE ALSO L<Test> for writing test scripts and also L<Benchmark> for the diff --git a/lib/perl5db.pl b/lib/perl5db.pl index a2b9926cc1..67a6a6d839 100644 --- a/lib/perl5db.pl +++ b/lib/perl5db.pl @@ -2,7 +2,7 @@ package DB; # Debugger for Perl 5.00x; perl5db.pl patch level: -$VERSION = 1.02; +$VERSION = 1.03; $header = "perl5db.pl version $VERSION"; # Enhanced by ilya@math.ohio-state.edu (Ilya Zakharevich) @@ -1043,7 +1043,7 @@ EOP $cmd =~ /^$rc+\s*(-)?(\d+)?$/ && do { pop(@hist) if length($cmd) > 1; $i = $1 ? ($#hist-($2?$2:1)) : ($2?$2:$#hist); - $cmd = $hist[$i] . "\n"; + $cmd = $hist[$i]; print $OUT $cmd; redo CMD; }; $cmd =~ /^$sh$sh\s*([\x00-\xff]*)/ && do { @@ -1059,7 +1059,7 @@ EOP print $OUT "No such command!\n\n"; next CMD; } - $cmd = $hist[$i] . "\n"; + $cmd = $hist[$i]; print $OUT $cmd; redo CMD; }; $cmd =~ /^$sh$/ && do { @@ -1182,9 +1182,13 @@ sub sub { ? ( (print $LINEINFO ' ' x $#stack, "out "), print_trace($LINEINFO, -1, 1, 1, "$sub$al") ) : print $LINEINFO ' ' x $#stack, "exited $sub$al\n") if $frame & 2; - print ($OUT ($frame & 16 ? ' ' x $#stack : ""), - "list context return from $sub:\n"), dumpit( \@ret ), - $doret = -2 if $doret eq $#stack or $frame & 16; + if ($doret eq $#stack or $frame & 16) { + my $fh = ($doret eq $#stack ? $OUT : $LINEINFO); + print $fh ' ' x $#stack if $frame & 16; + print $fh "list context return from $sub:\n"; + dumpit($fh, \@ret ); + $doret = -2; + } @ret; } else { if (defined wantarray) { @@ -1197,9 +1201,15 @@ sub sub { ? ( (print $LINEINFO ' ' x $#stack, "out "), print_trace($LINEINFO, -1, 1, 1, "$sub$al") ) : print $LINEINFO ' ' x $#stack, "exited $sub$al\n") if $frame & 2; - print ($OUT ($frame & 16 ? ' ' x $#stack : ""), - "scalar context return from $sub: "), dumpit( $ret ), - $doret = -2 if $doret eq $#stack or $frame & 16; + if ($doret eq $#stack or $frame & 16 and defined wantarray) { + my $fh = ($doret eq $#stack ? $OUT : $LINEINFO); + print $fh (' ' x $#stack) if $frame & 16; + print $fh (defined wantarray + ? "scalar context return from $sub: " + : "void context return from $sub\n"); + dumpit( $fh, $ret ) if defined wantarray; + $doret = -2; + } $ret; } } @@ -1229,7 +1239,7 @@ sub eval { if ($at) { print $OUT $at; } elsif ($onetimeDump eq 'dump') { - dumpit(\@res); + dumpit($OUT, \@res); } elsif ($onetimeDump eq 'methods') { methods($res[0]); } @@ -1284,7 +1294,7 @@ sub postponed { } sub dumpit { - local ($savout) = select($OUT); + local ($savout) = select(shift); my $osingle = $single; my $otrace = $trace; $single = $trace = 0; @@ -1365,7 +1375,7 @@ sub dump_trace { push(@a, $_); } } - $context = $context ? '@' : "\$"; + $context = $context ? '@' : (defined $context ? "\$" : '.'); $args = $h ? [@a] : undef; $e =~ s/\n\s*\;\s*\Z// if $e; $e =~ s/([\\\'])/\\$1/g if $e; diff --git a/os2/os2.sym b/os2/os2.sym index 3c794ec95e..4bd97c93e2 100644 --- a/os2/os2.sym +++ b/os2/os2.sym @@ -16,3 +16,15 @@ os2_cond_wait pthread_join pthread_create pthread_detach +XS_Cwd_change_drive +XS_Cwd_current_drive +XS_Cwd_extLibpath +XS_Cwd_extLibpath_set +XS_Cwd_sys_abspath +XS_Cwd_sys_chdir +XS_Cwd_sys_cwd +XS_Cwd_sys_is_absolute +XS_Cwd_sys_is_relative +XS_Cwd_sys_is_rooted +XS_DynaLoader_mod2fname +XS_File__Copy_syscopy diff --git a/pod/perlcall.pod b/pod/perlcall.pod index 37916ae6d8..ac60007878 100644 --- a/pod/perlcall.pod +++ b/pod/perlcall.pod @@ -526,12 +526,18 @@ The C function required to call I<LeftString> would look like this. { dSP ; + ENTER ; + SAVETMPS ; + PUSHMARK(SP) ; XPUSHs(sv_2mortal(newSVpv(a, 0))); XPUSHs(sv_2mortal(newSViv(b))); PUTBACK ; perl_call_pv("LeftString", G_DISCARD); + + FREETMPS ; + LEAVE ; } Here are a few notes on the C function I<call_LeftString>. @@ -598,6 +604,36 @@ on how the XPUSH macros work. =item 6. +Because we created temporary values (by means of sv_2mortal() calls) +we will have to tidy up the Perl stack and dispose of mortal SVs. + +This is the purpose of + + ENTER ; + SAVETMPS ; + +at the start of the function, and + + FREETMPS ; + LEAVE ; + +at the end. The C<ENTER>/C<SAVETMPS> pair creates a boundary for any +temporaries we create. This means that the temporaries we get rid of +will be limited to those which were created after these calls. + +The C<FREETMPS>/C<LEAVE> pair will get rid of any values returned by +the Perl subroutine (see next example), plus it will also dump the +mortal SVs we have created. Having C<ENTER>/C<SAVETMPS> at the +beginning of the code makes sure that no other mortals are destroyed. + +Think of these macros as working a bit like using C<{> and C<}> in Perl +to limit the scope of local variables. + +See the section I<Using Perl to dispose of temporaries> for details of +an alternative to using these macros. + +=item 7. + Finally, I<LeftString> can now be called via the I<perl_call_pv> function. @@ -660,40 +696,8 @@ The only flag specified this time was G_SCALAR. That means the C<@_> array will be created and that the value returned by I<Adder> will still exist after the call to I<perl_call_pv>. - - =item 2. -Because we are interested in what is returned from I<Adder> we cannot -specify G_DISCARD. This means that we will have to tidy up the Perl -stack and dispose of any temporary values ourselves. This is the -purpose of - - ENTER ; - SAVETMPS ; - -at the start of the function, and - - FREETMPS ; - LEAVE ; - -at the end. The C<ENTER>/C<SAVETMPS> pair creates a boundary for any -temporaries we create. This means that the temporaries we get rid of -will be limited to those which were created after these calls. - -The C<FREETMPS>/C<LEAVE> pair will get rid of any values returned by -the Perl subroutine, plus it will also dump the mortal SVs we have -created. Having C<ENTER>/C<SAVETMPS> at the beginning of the code -makes sure that no other mortals are destroyed. - -Think of these macros as working a bit like using C<{> and C<}> in Perl -to limit the scope of local variables. - -See the section I<Using Perl to dispose of temporaries> for details of -an alternative to using these macros. - -=item 3. - The purpose of the macro C<SPAGAIN> is to refresh the local copy of the stack pointer. This is necessary because it is possible that the memory allocated to the Perl stack has been reallocated whilst in the @@ -703,7 +707,7 @@ If you are making use of the Perl stack pointer in your code you must always refresh the local copy using SPAGAIN whenever you make use of the I<perl_call_*> functions or any other Perl internal function. -=item 4. +=item 3. Although only a single value was expected to be returned from I<Adder>, it is still good practice to check the return code from I<perl_call_pv> @@ -715,7 +719,7 @@ didn't check for that possibility and take appropriate action the Perl stack would end up in an inconsistent state. That is something you I<really> don't want to happen ever. -=item 5. +=item 4. The C<POPi> macro is used here to pop the return value from the stack. In this case we wanted an integer, so C<POPi> was used. @@ -730,7 +734,7 @@ they return. POPi integer POPl long -=item 6. +=item 5. The final C<PUTBACK> is used to leave the Perl stack in a consistent state before exiting the function. This is necessary because when we diff --git a/pod/perldiag.pod b/pod/perldiag.pod index b87480e4c8..43226e076d 100644 --- a/pod/perldiag.pod +++ b/pod/perldiag.pod @@ -2845,6 +2845,10 @@ bad side effects. interpreted as a "" or a 0, but maybe it was a mistake. To suppress this warning assign an initial value to your variables. +=item Useless use of "re" pragma + +(W) You did C<use re;> without any arguments. That isn't very useful. + =item Useless use of %s in void context (W) You did something without a side effect in a context that does nothing diff --git a/pod/perlop.pod b/pod/perlop.pod index 8b73629a7c..c7209fac28 100644 --- a/pod/perlop.pod +++ b/pod/perlop.pod @@ -774,11 +774,11 @@ I<successfully> matched regular expression is used instead. If the C</g> option is not used, C<m//> in a list context returns a list consisting of the subexpressions matched by the parentheses in the -pattern, i.e., (C<$1>, C<$2>, C<$3>...). (Note that here -C<$1> etc. are also set, and -that this differs from Perl 4's behavior.) If there are no parentheses, -the return value is the list C<(1)> for success or C<('')> upon failure. -With parentheses, C<()> is returned upon failure. +pattern, i.e., (C<$1>, C<$2>, C<$3>...). (Note that here C<$1> etc. are +also set, and that this differs from Perl 4's behavior.) When there are +no parentheses in the pattern, the return value is the list C<(1)> for +success. With or without parentheses, an empty list is returned upon +failure. Examples: diff --git a/pod/perltrap.pod b/pod/perltrap.pod index 8a3e3bcdab..852d8e9826 100644 --- a/pod/perltrap.pod +++ b/pod/perltrap.pod @@ -650,6 +650,23 @@ Better parsing in perl 5 # perl4 prints: is zero # perl5 warns: "Useless use of a constant in void context" if using -w +=item * Parsing + +String interpolation of the C<$#array> construct differs when braces +are to used around the name. + + @ = (1..3); + print "${#a}"; + + # perl4 prints: 2 + # perl5 fails with syntax error + + @ = (1..3); + print "$#{a}"; + + # perl4 prints: {a} + # perl5 prints: 2 + =back =head2 Numerical Traps @@ -1161,26 +1178,6 @@ repeatedly, like C</x/> or C<m!x!>. # perl5 prints: perl5 -=item * Regular Expression - -Under perl4 and upto version 5.003, a failed C<m//g> match used to -reset the internal iterator, so that subsequent C<m//g> match attempts -began from the beginning of the string. In perl version 5.004 and later, -failed C<m//g> matches do not reset the iterator position (which can be -found using the C<pos()> function--see L<perlfunc/pos>). - - $test = "foop"; - for (1..3) { - print $1 while ($test =~ /(o)/g); - # pos $test = 0; # to get old behavior - } - - # perl4 prints: oooooo - # perl5.004 prints: oo - -You may always reset the iterator yourself as shown in the commented line -to get the old behavior. - =back =head2 Subroutine, Signal, Sorting Traps @@ -1550,6 +1550,19 @@ PP(pp_cos) } } +/* Support Configure command-line overrides for rand() functions. + After 5.005, perhaps we should replace this by Configure support + for drand48(), random(), or rand(). For 5.005, though, maintain + compatibility by calling rand() but allow the user to override it. + See INSTALL for details. --Andy Dougherty 15 July 1998 +*/ +#ifndef my_rand +# define my_rand rand +#endif +#ifndef my_srand +# define my_srand srand +#endif + PP(pp_rand) { djSP; dTARGET; @@ -1561,19 +1574,19 @@ PP(pp_rand) if (value == 0.0) value = 1.0; if (!srand_called) { - (void)srand((unsigned)seed()); + (void)my_srand((unsigned)seed()); srand_called = TRUE; } #if RANDBITS == 31 - value = rand() * value / 2147483648.0; + value = my_rand() * value / 2147483648.0; #else #if RANDBITS == 16 - value = rand() * value / 65536.0; + value = my_rand() * value / 65536.0; #else #if RANDBITS == 15 - value = rand() * value / 32768.0; + value = my_rand() * value / 32768.0; #else - value = rand() * value / (double)(((unsigned long)1) << RANDBITS); + value = my_rand() * value / (double)(((unsigned long)1) << RANDBITS); #endif #endif #endif @@ -1589,7 +1602,7 @@ PP(pp_srand) anum = seed(); else anum = POPu; - (void)srand((unsigned)anum); + (void)my_srand((unsigned)anum); srand_called = TRUE; EXTEND(SP, 1); RETPUSHYES; @@ -853,8 +853,6 @@ PP(pp_match) } } } - if (!rx->nparens && !global) - gimme = G_SCALAR; /* accidental array context? */ safebase = (((gimme == G_ARRAY) || global || !rx->nparens) && !PL_sawampersand); safebase = safebase ? 0 : REXEC_COPY_STR ; @@ -958,6 +956,8 @@ play_it_again: PUTBACK; /* EVAL blocks may use stack */ goto play_it_again; } + else if (!iters) + XPUSHs(&sv_yes); LEAVE_SCOPE(oldsave); RETURN; } @@ -1590,7 +1590,9 @@ PP(pp_subst) DIE("panic: do_subst"); strend = s + len; - maxiters = (strend - s) + 10; + maxiters = 2*(strend - s) + 10; /* We can match twice at each + position, once with zero-length, + second time with non-zero. */ if (!rx->prelen && PL_curpm) { pm = PL_curpm; @@ -3239,12 +3239,7 @@ sv_gets(register SV *sv, register PerlIO *fp, I32 append) /* Grab the size of the record we're getting */ recsize = SvIV(SvRV(PL_rs)); (void)SvPOK_only(sv); /* Validate pointer */ - /* Make sure we've got the room to yank in the whole thing */ - if (SvLEN(sv) <= recsize + 3) { - /* No, so make it bigger */ - SvGROW(sv, recsize + 3); - } - buffer = SvPVX(sv); /* Get the location of the final buffer */ + buffer = SvGROW(sv, recsize + 1); /* Go yank in */ #ifdef VMS /* VMS wants read instead of fread, because fread doesn't respect */ @@ -3255,6 +3250,7 @@ sv_gets(register SV *sv, register PerlIO *fp, I32 append) bytesread = PerlIO_read(fp, buffer, recsize); #endif SvCUR_set(sv, bytesread); + buffer[bytesread] = '\0'; return(SvCUR(sv) ? SvPVX(sv) : Nullch); } else if (RsPARA(PL_rs)) { diff --git a/t/comp/multiline.t b/t/comp/multiline.t index fc1eedc8d2..ed418b84fc 100755 --- a/t/comp/multiline.t +++ b/t/comp/multiline.t @@ -9,11 +9,15 @@ open(try,'>Comp.try') || (die "Can't open temp file."); $x = 'now is the time for all good men to come to. + + +! + '; $y = 'now is the time' . "\n" . 'for all good men' . "\n" . -'to come to.' . "\n"; +'to come to.' . "\n\n\n!\n\n"; if ($x eq $y) {print "ok 1\n";} else {print "not ok 1\n";} @@ -30,7 +34,7 @@ while (<try>) { if ($z eq $y) {print "ok 2\n";} else {print "not ok 2\n";} -if ($count == 3) {print "ok 3\n";} else {print "not ok 3\n";} +if ($count == 7) {print "ok 3\n";} else {print "not ok 3\n";} $_ = ($^O eq 'MSWin32') ? `type Comp.try` : `cat Comp.try`; diff --git a/t/op/pat.t b/t/op/pat.t index cbd5f89ead..ef014f2562 100755 --- a/t/op/pat.t +++ b/t/op/pat.t @@ -4,9 +4,7 @@ # the format supported by op/regexp.t. If you want to add a test # that does fit that format, add it to op/re_tests, not here. -# $RCSfile: pat.t,v $$Revision: 4.1 $$Date: 92/08/07 18:28:12 $ - -print "1..135\n"; +print "1..139\n"; BEGIN { chdir 't' if -d 't'; @@ -560,3 +558,26 @@ my $for_future = make_must_warn('reserved for future extensions'); &$for_future('q(a:[b]:) =~ /[x[:foo:]]/'); &$for_future('q(a=[b]=) =~ /[x[=foo=]]/'); &$for_future('q(a.[b].) =~ /[x[.foo.]]/'); + +# test if failure of patterns returns empty list +$_ = 'aaa'; +@_ = /bbb/; +print "not " if @_; +print "ok $test\n"; +$test++; + +@_ = /bbb/g; +print "not " if @_; +print "ok $test\n"; +$test++; + +@_ = /(bbb)/; +print "not " if @_; +print "ok $test\n"; +$test++; + +@_ = /(bbb)/g; +print "not " if @_; +print "ok $test\n"; +$test++; + diff --git a/t/op/subst.t b/t/op/subst.t index 57a956dda6..2d42eeb386 100755 --- a/t/op/subst.t +++ b/t/op/subst.t @@ -6,7 +6,7 @@ BEGIN { @INC = '../lib' if -d '../lib'; } -print "1..70\n"; +print "1..71\n"; $x = 'foo'; $_ = "x"; @@ -302,3 +302,7 @@ s{ \d+ \b [,.;]? (?{ 'digits' }) }{$^R}xg; print ($_ eq $foo ? "ok 70\n" : "not ok 70\n#'$_'\n#'$foo'\n"); +$_ = 'x' x 20; +s/\d*|x/<$&>/g; +$foo = '<>' . ('<x><>' x 20) ; +print ($_ eq $foo ? "ok 71\n" : "not ok 71\n#'$_'\n#'$foo'\n"); @@ -5246,7 +5246,9 @@ scan_heredoc(register char *s) PL_bufend = SvPVX(PL_linestr) + SvCUR(PL_linestr); #ifdef TMP_CRLF_PATCH if (PL_bufend - PL_linestart >= 2) { - if (PL_bufend[-2] == '\r' || PL_bufend[-2] == '\n') { + if ((PL_bufend[-2] == '\r' && PL_bufend[-1] == '\n') || + (PL_bufend[-2] == '\n' && PL_bufend[-1] == '\r')) + { PL_bufend[-2] = '\n'; PL_bufend--; SvCUR_set(PL_linestr, PL_bufend - SvPVX(PL_linestr)); @@ -5543,7 +5545,9 @@ scan_str(char *start) #ifdef TMP_CRLF_PATCH if (to - SvPVX(sv) >= 2) { - if (to[-2] == '\r' || to[-2] == '\n') { + if ((to[-2] == '\r' && to[-1] == '\n') || + (to[-2] == '\n' && to[-1] == '\r')) + { to[-2] = '\n'; to--; SvCUR_set(sv, to - SvPVX(sv)); diff --git a/utils/perlcc.PL b/utils/perlcc.PL index a0161e5301..b214645ad9 100644 --- a/utils/perlcc.PL +++ b/utils/perlcc.PL @@ -124,9 +124,10 @@ sub _doit $obj = ($options->{'o'})? $options->{'o'} : _getExecutable($file, $module_ext); - $so = "$obj.so"; + $so = "$obj.$Config{so}"; $type = 'sharedlib'; return() if (!$obj); + $objfile = ($options->{'C'}) ? $options->{'C'} : "$file.c"; } else { @@ -175,7 +176,7 @@ sub _doit (_print( "ERROR: In generating code for $file!\n", -1), return()) if ($errcode); - _print( "Compiling C($obj) for $file!\n", 36 ) if (!$options->{'gen'}); + _print( "Compiling C($so) for $file!\n", 36 ) if (!$options->{'gen'}); my $errorcode = _compileCode($file, $objfile, $obj, $so ) if (!$options->{'gen'}); @@ -244,18 +245,19 @@ sub _compileCode if (@_ == 3) # just compiling a program { $return[0] = - _ccharness($sourceprog, "-o", $output_executable, $generated_cfile); + _ccharness('static', $sourceprog, "-o", $output_executable, $generated_cfile); $return[0]; } else { my $object_file = $generated_cfile; - $object_file =~ s"\.c$"\.o"; + $object_file =~ s"\.c$"$Config{_o}"; - $return[0] = _ccharness($sourceprog, "-c", $generated_cfile); + $return[0] = _ccharness('compile', $sourceprog, "-c", $generated_cfile); $return[1] = _ccharness ( - $sourceprog, "-shared","-o", + 'dynamic', + $sourceprog, "-o", $shared_object, $object_file ); return(1) if (grep ($_, @return)); @@ -278,6 +280,7 @@ sub _removeCode sub _ccharness { + my $type = shift; my (@args) = @_; local($") = " "; @@ -291,24 +294,26 @@ sub _ccharness } else { - $libdir = "-L.."; - $incdir = "-I.."; + $libdir = "-L.. -L."; + $incdir = "-I.. -I."; } $libdir .= " -L$options->{L}" if (defined($options->{L})); $incdir .= " -I$options->{L}" if (defined($options->{L})); - my $linkargs; + my $linkargs = ''; - if (!grep(/^-[cS]$/, @ARGV)) + if (!grep(/^-[cS]$/, @args)) { - $linkargs = sprintf("%s $libdir -lperl %s",@Config{qw(ldflags libs)}); + my $lperl = $^O eq 'os2' ? '-llibperl' : '-lperl'; + my $flags = $type eq 'dynamic' ? $Config{lddlflags} : $Config{ldflags}; + $linkargs = "$flags $libdir $lperl @Config{libs}"; } my @sharedobjects = _getSharedObjects($sourceprog); my $cccmd = - "$Config{cc} $Config{ccflags} $incdir @sharedobjects @args $linkargs"; + "$Config{cc} @Config{qw(ccflags optimize)} $incdir @sharedobjects @args $linkargs"; _print ("$cccmd\n", 36); |