diff options
author | Andy Dougherty <doughera@lafcol.lafayette.edu> | 1995-01-26 00:40:50 +0000 |
---|---|---|
committer | Andy Dougherty <doughera@lafcol.lafayette.edu> | 1995-01-26 00:40:50 +0000 |
commit | 75f926282bd78abe2f394977be7dd4dc52cb21ba (patch) | |
tree | fd86369fb52a5fa00387d1ce65c7086f0ac41b94 | |
parent | 420218e7eb4fa5ceefe298e6d9121548b8d806d6 (diff) | |
download | perl-75f926282bd78abe2f394977be7dd4dc52cb21ba.tar.gz |
perl5.000 patch.0i: fix glaring mistakes in patches a-h
This patch does the following things:
1. Fix various bonehead errors I introduced in patches a-g.
2. Incorporate MakeMaker changes to bring it up to version 4.01 (mostly).
3. Stick in things I forgot in patches a-g (e.g. AIX).
4. Some minor additional cleanup in x2p/ for even pickier compilers.
5. More hints updates (hpux and next).
6. Include newest dl_hpux.xs.
I didn't have time to
1. Fix the overlapping strcpy() in op.c
2. Restore h2xs to Larry's original design to process <>.
3. take out unnecessary "use Config" in installperl.
4. Add in vms patches.
I forgot to
[If I remembered what i forgot, I wouldn't have forgotten it. :]
I deliberately decided *not* to
1. Touch pod/*
2. deal with overloading
Specifically, here's what's included:
Configure
Regenerated to be sure it's up-to-date.
Makefile.SH
Build extension libraries right into lib/auto/whatever.
Don't set CCCDLFLAGS since we don't use it anyway.
Take care to avoid modifying lib/Config.pm without reason
Visit DynaLoader for `make clean'. (Previously only did
so for `make realclean'.)
@echo "Note that make realclean does not delete config.sh"
Include config.h dependency.
U/i_db.U
config_h.SH
config.H
Remove unwanted quotes around db_hashtype and db_prefixtype.
configpm
Allow specification of alternate name for lib/Config.pm,
so the makefile mv-if-diff trick saves needless re-making.
ext/DynaLoader/DynaLoader.pm
Updated warning messages and comments.
ext/DynaLoader/dl_hpux.xs
Updated to version 2.1. Now uses bootstrap files.
ext/util/make_ext
Explicitly use #!/bin/sh to start it up. This is useful
for testing make_ext.
Improve & simplify Nested::Extension::Processing.
More robust handling of `make clean'.
hints/hpux_9.sh
Support both the bundled and unbundled compilers.
hints/next_3_2.sh
Back to using -posix rather than POSIX_SOURCE. And that only
for ext/POSIX/POSIX.xs.
installperl
Special ranlib treatment for NeXT, which gets confused about
timestamps in libraries, even when you just copy the library.
Supply missing '$' in samepath() function.
lib/AutoSplit.pm
New parameters.
lib/ExtUtils/MakeMaker.pm
Upgraded from 3.8 to 4.01.
lib/ExtUtils/xsubpp
Documentation changed from man to pod.
lib/Getopt/Long.pm
Avoid typo warning.
Drop unused $optx.
lib/Text/Tabs.pm
Fix package name.
makedepend.SH
Explicitly start with $startsh.
Catch cpp that prints # <stdin> instead of line numbers.
perl.h
Fix bonehead mistake that ended up calling my_fmod even if
not needed.
perl_exp.SH
also add symbols from interp.sym
proto.h
Delete 2 redundant prototypes (newBINOP and newUNOP).
util.c
Add (char *) casts to unsigned char args to bcmp.
x2p/a2p.h
Rearrange order of <string?.h> and bcopy & bzero stuff.
Change a few function prototypes to void, to reflect actual
usage.
x2p/a2py.c
Change a few function types to void, to reflect actual usage.
x2p/handy.h
Make *alloc declarations match those in x2p/util.c.
x2p/util.c
Make *alloc declarations match those in x2p/handy.h.
x2p/walk.c
Add a (Size_t) cast for comparison of 1 to the result of strlen().
Thanks to all who's work is included here. Little of it is mine.
-rwxr-xr-x | Configure | 2 | ||||
-rw-r--r-- | Makefile.SH | 18 | ||||
-rw-r--r-- | U/i_db.U | 4 | ||||
-rw-r--r-- | config.H | 4 | ||||
-rwxr-xr-x | config_h.SH | 4 | ||||
-rwxr-xr-x | configpm | 2 | ||||
-rw-r--r-- | ext/DynaLoader/DynaLoader.pm | 25 | ||||
-rw-r--r-- | ext/DynaLoader/dl_hpux.xs | 44 | ||||
-rw-r--r-- | ext/util/make_ext | 76 | ||||
-rw-r--r-- | hints/hpux_9.sh | 17 | ||||
-rw-r--r-- | hints/next_3_2.sh | 6 | ||||
-rwxr-xr-x | installperl | 22 | ||||
-rw-r--r-- | lib/AutoSplit.pm | 10 | ||||
-rw-r--r-- | lib/ExtUtils/MakeMaker.pm | 576 | ||||
-rwxr-xr-x | lib/ExtUtils/xsubpp | 112 | ||||
-rw-r--r-- | lib/Getopt/Long.pm | 3 | ||||
-rw-r--r-- | lib/Text/Tabs.pm | 2 | ||||
-rwxr-xr-x | makedepend.SH | 6 | ||||
-rw-r--r-- | perl.h | 12 | ||||
-rw-r--r-- | perl_exp.SH | 8 | ||||
-rw-r--r-- | proto.h | 2 | ||||
-rw-r--r-- | util.c | 4 | ||||
-rw-r--r-- | x2p/a2p.h | 24 | ||||
-rw-r--r-- | x2p/a2py.c | 5 | ||||
-rw-r--r-- | x2p/handy.h | 4 | ||||
-rw-r--r-- | x2p/util.c | 13 | ||||
-rw-r--r-- | x2p/walk.c | 2 |
27 files changed, 644 insertions, 363 deletions
@@ -20,7 +20,7 @@ # $Id: Head.U,v 3.0.1.6 1994/10/29 15:54:19 ram Exp $ # -# Generated on Wed Jan 18 13:55:15 EST 1995 [metaconfig 3.0 PL48] +# Generated on Tue Jan 24 16:22:48 EST 1995 [metaconfig 3.0 PL48] cat >/tmp/c1$$ <<EOF ARGGGHHHH!!!!! diff --git a/Makefile.SH b/Makefile.SH index b3e5e04cf1..9bfc035a8f 100644 --- a/Makefile.SH +++ b/Makefile.SH @@ -51,14 +51,14 @@ dynamic_list=' ' for f in $dynamic_ext; do : the dependency named here will never exist base=`echo "$f" | sed 's/.*\///'` - dynamic_list="$dynamic_list ext/$f/$base.$dlext" + dynamic_list="$dynamic_list lib/auto/$f/$base.$dlext" done static_list=' ' static_ai_list=' ' for f in $static_ext; do base=`echo "$f" | sed 's/.*\///'` - static_list="$static_list ext/$f/$base.a" + static_list="$static_list lib/auto/$f/$base.a" if test -f ext/$f/AutoInit.c; then static_ai_list="$static_ai_list ext/$f/AutoInit.c" fi @@ -102,7 +102,6 @@ ranlib = $ranlib # dynamic loading. LDDLFLAGS = $lddlflags CCDLFLAGS = $ccdlflags -CCCDLFLAGS = $cccdlflags DLSUFFIX = .$dlext PLDLFLAGS = $pldlflags PLIBSUF = $plibsuf @@ -112,7 +111,8 @@ dynamic_ext = $dynamic_list static_ext = $static_list ext = \$(dynamic_ext) \$(static_ext) static_ext_autoinit = $static_ai_list -DYNALOADER = ext/DynaLoader/DynaLoader.a +DYNALOADER = lib/auto/DynaLoader/DynaLoader.a + libs = $libs $cryptlib @@ -265,8 +265,10 @@ preplibrary: miniperl lib/Config.pm @./miniperl -Ilib -e 'use AutoSplit; \ autosplit_lib_modules(@ARGV)' lib/*.pm lib/*/*.pm +# Take care to avoid modifying lib/Config.pm without reason lib/Config.pm: config.sh miniperl - ./miniperl configpm + ./miniperl configpm tmp + sh mv-if-diff tmp lib/Config.pm install: all ./perl installperl @@ -330,7 +332,7 @@ clean: rm -f perl.exp ext.libs ext/util/extlibist -cd x2p; $(MAKE) clean -cd pod; $(MAKE) clean - @for x in $(dynamic_ext) $(static_ext) ; do \ + -@for x in $(DYNALOADER) $(dynamic_ext) $(static_ext) ; do \ sh ext/util/make_ext clean $$x ; \ done rm -f perl suidperl miniperl $(perllib) @@ -348,6 +350,7 @@ realclean: clean rm -rf lib/auto rm -f h2ph h2ph.man c2ph pstruct rm -rf .config + @echo "Note that make realclean does not delete config.sh" clobber: realclean rm -f config.sh cppstdin @@ -365,6 +368,9 @@ lint: perly.c $(c) makefile: Makefile make depend +config.h: config.sh + /bin/sh config_h.SH + # When done, touch perlmain.c so that it doesn't get remade each time. depend: makedepend - test -f perly.h || cp /dev/null perly.h @@ -45,8 +45,8 @@ ?C: int, while in newer ones it is size_t. ?C:. ?H:#$i_db I_DB /**/ -?H:#define DB_Hash_t "$db_hashtype" /**/ -?H:#define DB_Prefix_t "$db_prefixtype" /**/ +?H:#define DB_Hash_t $db_hashtype /**/ +?H:#define DB_Prefix_t $db_prefixtype /**/ ?H:. ?F:!try.c !try.o ?LINT:set i_db @@ -1403,8 +1403,8 @@ * in the <db.h> header file. In older versions of DB, it was * int, while in newer ones it is size_t. */ -#define DB_Hash_t "int" /**/ -#define DB_Prefix_t "int" /**/ +#define DB_Hash_t int /**/ +#define DB_Prefix_t int /**/ /* I_NDBM: * This symbol, if defined, indicates that ndbm.h exists and should diff --git a/config_h.SH b/config_h.SH index d0801e4b9b..e6a52404d2 100755 --- a/config_h.SH +++ b/config_h.SH @@ -1417,8 +1417,8 @@ sed <<!GROK!THIS! >config.h -e 's!^#undef!/\*#define!' -e 's!^#un-def!#undef!' * in the <db.h> header file. In older versions of DB, it was * int, while in newer ones it is size_t. */ -#define DB_Hash_t "$db_hashtype" /**/ -#define DB_Prefix_t "$db_prefixtype" /**/ +#define DB_Hash_t $db_hashtype /**/ +#define DB_Prefix_t $db_prefixtype /**/ /* I_NDBM: * This symbol, if defined, indicates that ndbm.h exists and should @@ -1,7 +1,7 @@ #!./miniperl -w +$config_pm = $ARGV[0] || 'lib/Config.pm'; @ARGV = "./config.sh"; -$config_pm = 'lib/Config.pm'; # list names to put first (and hence lookup fastest) @fast = qw(osname osvers so libpth archlib diff --git a/ext/DynaLoader/DynaLoader.pm b/ext/DynaLoader/DynaLoader.pm index 7cabf4e4e3..9a21dfd40b 100644 --- a/ext/DynaLoader/DynaLoader.pm +++ b/ext/DynaLoader/DynaLoader.pm @@ -54,15 +54,13 @@ push(@dl_library_path, split(/:/, $ENV{'LD_LIBRARY_PATH'})) # No prizes for guessing why we don't say 'bootstrap DynaLoader;' here. -&boot_DynaLoader if defined &boot_DynaLoader; +boot_DynaLoader() if defined(&boot_DynaLoader); -print STDERR "DynaLoader.pm loaded (@dl_library_path)\n" - if ($dl_debug >= 2); -# Temporary interface checks for recent changes (Aug 1994) -if (defined(&dl_load_file)){ -die "dl_error not defined" unless defined (&dl_error); -die "dl_undef_symbols not defined" unless defined (&dl_undef_symbols); +if ($dl_debug){ + print STDERR "DynaLoader.pm loaded (@dl_library_path)\n"; + print STDERR "DynaLoader not linked into this perl\n" + unless defined(&boot_DynaLoader); } 1; # End of main code @@ -120,8 +118,15 @@ sub bootstrap { warn "$bs: $@\n" if $@; } - my $libref = DynaLoader::dl_load_file($file) or - croak "Can't load '$file' for module $module: ".&dl_error."\n"; + # Many dynamic extension loading problems will appear to come from + # this section of code: XYZ failed at line 123 of DynaLoader.pm. + # Often these errors are actually occurring in the initialisation + # C code of the extension XS file. Perl reports the error as being + # in this perl code simply because this was the last perl code + # it executed. + + my $libref = dl_load_file($file) or + croak "Can't load '$file' for module $module: ".dl_error()."\n"; my(@unresolved) = dl_undef_symbols(); carp "Undefined symbols present after loading $file: @unresolved\n" @@ -131,6 +136,8 @@ sub bootstrap { croak "Can't find '$bootname' symbol in $file\n"; dl_install_xsub("${module}::bootstrap", $boot_symbol_ref, $file); + + # See comment block above &{"${module}::bootstrap"}(@args); } diff --git a/ext/DynaLoader/dl_hpux.xs b/ext/DynaLoader/dl_hpux.xs index 0558e40eaa..d2c405ecdc 100644 --- a/ext/DynaLoader/dl_hpux.xs +++ b/ext/DynaLoader/dl_hpux.xs @@ -1,5 +1,6 @@ /* * Author: Jeff Okamoto (okamoto@corp.hp.com) + * Version: 2.1, 1995/1/25 */ #ifdef __hp9000s300 @@ -38,13 +39,35 @@ dl_load_file(filename) char * filename CODE: shl_t obj = NULL; + int i, max; + GV *gv; + AV *av; + + gv = gv_fetchpv("DynaLoader::dl_resolve_using", FALSE, SVt_PVAV); + if (gv) { + av = GvAV(gv); + max = AvFILL(av); + for (i = 0; i <= max; i++) { + char *sym = SvPVX(*av_fetch(av, i, 0)); + DLDEBUG(1,fprintf(stderr, "dl_load_file(%s) (dependent)\n", sym)); + obj = shl_load(sym, + BIND_IMMEDIATE | BIND_NONFATAL | BIND_NOSTART | BIND_VERBOSE, + 0L); + if (obj == NULL) { + goto end; + } + } + } + DLDEBUG(1,fprintf(stderr,"dl_load_file(%s): ", filename)); obj = shl_load(filename, BIND_IMMEDIATE | BIND_NONFATAL | BIND_NOSTART | BIND_VERBOSE, 0L); + DLDEBUG(2,fprintf(stderr," libref=%x\n", obj)); +end: ST(0) = sv_newmortal() ; if (obj == NULL) - SaveError("%s",Strerror(errno)) ; + SaveError("%s",Strerror(errno)); else sv_setiv( ST(0), (IV)obj); @@ -64,12 +87,23 @@ dl_find_symbol(libhandle, symbolname) DLDEBUG(2,fprintf(stderr,"dl_find_symbol(handle=%x, symbol=%s)\n", libhandle, symbolname)); status = shl_findsym(&obj, symbolname, TYPE_PROCEDURE, &symaddr); - DLDEBUG(2,fprintf(stderr," symbolref = %x\n", symaddr)); + DLDEBUG(2,fprintf(stderr," symbolref(PROCEDURE) = %x\n", symaddr)); ST(0) = sv_newmortal() ; - if (status == -1) - SaveError("%s",(errno) ? Strerror(errno) : "Symbol not found") ; - else + if (status == -1) { + if (errno == 0) { + status = shl_findsym(&obj, symbolname, TYPE_DATA, &symaddr); + DLDEBUG(2,fprintf(stderr," symbolref(DATA) = %x\n", symaddr)); + if (status == -1) { + SaveError("%s",(errno) ? Strerror(errno) : "Symbol not found") ; + } else { + sv_setiv( ST(0), (IV)symaddr); + } + } else { + SaveError("%s", Strerror(errno)); + } + } else { sv_setiv( ST(0), (IV)symaddr); + } int diff --git a/ext/util/make_ext b/ext/util/make_ext index f4a1b8884e..ae10a9d628 100644 --- a/ext/util/make_ext +++ b/ext/util/make_ext @@ -1,3 +1,5 @@ +#!/bin/sh + # This script acts as a simple interface for building extensions. # It primarily used by the perl Makefile: # @@ -31,24 +33,27 @@ if test "X$extspec" = X; then exit 1; fi -# canonise -extspec=`echo "$extspec" | sed -e 's:^ext/::' -e 's:\.[^\.]*$::'` -extspec="ext/$extspec" -tailext=`echo "$extspec" | sed -e 's:.*/\([^/]*\)$:\1:'"` -headext=`echo "$extspec" | sed -e 's:/[^/]*$::'"` -if test -d "$headext/$tailext"; then - extspec="$headext/$tailext" -fi -if test -f "$extspec/$tailext.xs"; then - extspec="$extspec/$tailext" -fi +# The Perl Makefile.SH will expand all extensions to +# lib/auto/X/X.a (or lib/auto/X/Y/Y.a is nested) +# A user wishing to run make_ext might use +# X (or X/Y or X::Y is nested) + +# canonise into X/Y form (pname) +case "$extspec" in +lib*) # Remove lib/auto prefix and /*.* suffix + pname=`echo "$extspec" | sed -e 's:^lib/auto/::' -e 's:/[^/]*\.[^/]*$::' ` ;; +*::*) # Convert :: to / + pname=`echo "$extspec" | sed -e 's/::/\//g' ` ;; +*) pname="$extspec" ;; +esac +# echo "Converted $extspec to $pname" -# get extension directory path, module name and depth -pname=`echo "$extspec" | sed -e 's:^ext/::' -e 's:/[^/]*$::'` mname=`echo "$pname" | sed -e 's!/!::!g'` depth=`echo "$pname" | sed -e 's![^/][^/]*!..!g'` make=${altmake-make} +makefile=Makefile makeargs='' +makeopts='' if test ! -d "ext/$pname"; then echo " Skipping $extspec (directory does not exist)" @@ -62,28 +67,51 @@ cd ext/$pname # check link type and do any preliminaries case "$target" in - # convert 'static' or 'dynamic' into 'all LINKTYPE=XXX' -static) makeargs="LINKTYPE=static CCCDLFLAGS="; target=all ;; -dynamic) makeargs="LINKTYPE=dynamic"; target=all ;; -*clean) ;; + # convert 'static' or 'dynamic' into 'all LINKTYPE=XXX' +static) makeargs="LINKTYPE=static CCCDLFLAGS=" + target=all + ;; +dynamic) makeargs="LINKTYPE=dynamic"; + target=all + ;; + +*clean) # If Makefile has been moved to Makefile.old by a make clean + # then use Makefile.old for realclean rather than rebuild it + if test ! -f $makefile -a -f Makefile.old; then + makefile=Makefile.old + makeopts="-f $makefile" + echo "Note: Using Makefile.old" + fi + ;; + *) # for the time being we are strict about what make_ext is used for - echo "make_ext: unknown make target '$target'"; exit 1;; -'') echo "make_ext: no make target specified (eg static or dynamic)"; exit 1;; + echo "make_ext: unknown make target '$target'"; exit 1 + ;; +'') echo "make_ext: no make target specified (eg static or dynamic)"; exit 1 + ;; esac -if test ! -f Makefile ; then +if test ! -f $makefile ; then test -f Makefile.PL && ../$depth/miniperl -I../$depth/lib Makefile.PL fi -if test ! -f Makefile ; then - test -f Makefile.SH && sh Makefile.SH +if test ! -f $makefile ; then + if test -f Makefile.SH; then + echo "Warning: Writing $makefile from old-style Makefile.SH!" + sh Makefile.SH + else + echo "Warning: No Makefile!" + fi fi case "$target" in clean) ;; realclean) ;; -*) $make config $passthru;; +*) # Give makefile an opportunity to rewrite itself. + # reassure users that life goes on... + $make config $passthru || echo "$make config failed, continuing anyway..." + ;; esac -$make $target $makeargs $passthru || exit +$make $makeopts $target $makeargs $passthru || exit exit $? diff --git a/hints/hpux_9.sh b/hints/hpux_9.sh index 8d2556a2b2..98ff92f228 100644 --- a/hints/hpux_9.sh +++ b/hints/hpux_9.sh @@ -1,8 +1,21 @@ +# hints/hpux_9.sh, Perl Configure hints file for Hewlett Packard HP/UX 9.x +# Use Configure -Dcc=gcc to use gcc. +ccflags="$ccflags -D_POSIX_SOURCE -D_HPUX_SOURCE" +case "$cc" in +'') if cc $ccflags -Aa 2>&1 | $contains 'Unknown option "A"' >/dev/null + then # The bundled (limited) compiler doesn't + case "$usedl" in # support -Aa for "ANSI C mode". + '') usedl="$undef";; # Nor can it produce shared libraries. + esac + else + ccflags="$ccflags -Aa" # The add-on compiler supports ANSI C + fi + optimize='+O1' + ;; +esac libswanted='ndbm m dld' -ccflags="$ccflags -Aa -D_POSIX_SOURCE -D_HPUX_SOURCE" # ldflags="-Wl,-E -Wl,-a,shared" # Force all shared? ldflags="-Wl,-E" -optimize='+O1' usemymalloc='y' alignbytes=8 selecttype='int *' diff --git a/hints/next_3_2.sh b/hints/next_3_2.sh index 71c9e1040f..ccdf12ae11 100644 --- a/hints/next_3_2.sh +++ b/hints/next_3_2.sh @@ -1,4 +1,8 @@ -ccflags='-D_POSIX_SOURCE -DUSE_NEXT_CTYPE' +# This file has been put together by Anno Siegel <siegel@zrz.TU-Berlin.DE> +# and Andreas Koenig <k@franz.ww.TU-Berlin.DE>. Comments, questions, and +# improvements welcome! +ccflags='-DUSE_NEXT_CTYPE' +POSIX_cflags='ccflags="-posix $ccflags"' ldflags='-u libsys_s' libswanted='dbm gdbm db' lddlflags='-r' diff --git a/installperl b/installperl index 73da720ece..822b70579e 100755 --- a/installperl +++ b/installperl @@ -1,6 +1,6 @@ #!./perl BEGIN { @INC=('./lib', '../lib') } - +use Config; use File::Find; $mainperldir = "/usr/bin"; @@ -139,10 +139,14 @@ else { warn "Can't cd to lib to install lib files: $!\n"; } -# Install header files +# Install header files and libraries makedir("$installarchlib/CORE"); -foreach $file (<*.h libperl*.a>) { +foreach $file (<*.h libperl*.*>) { cp_if_diff($file,"$installarchlib/CORE/$file"); + if ($file =~ /\.a$/ && $Config{'osname'} eq 'next') { + #on NeXTs we have to rerun ranlib after copying libraries + &cmd("$Config{'ranlib'} $installarchlib/CORE/$file"); + } } # Offer to install perl in a "standard" location @@ -267,7 +271,7 @@ sub samepath { local($p1, $p2) = @_; local($dev1, $ino1, $dev2, $ino2); - if ($p1 ne p2) { + if ($p1 ne $p2) { ($dev1, $ino1) = stat($p1); ($dev2, $ino2) = stat($p2); ($dev1 == $dev2 && $ino1 == $ino2); @@ -298,6 +302,7 @@ sub installlib { #We're installing *.al and *.ix files into $installprivlib, #but we have to delete old *.al and *.ix files from the 5.000 #distribution: + #This might not work because $archname might have changed. &unlink("$installarchlib/$name"); } system "cmp", "-s", $_, "$installlib/$name"; @@ -305,7 +310,14 @@ sub installlib { &unlink("$installlib/$name"); &makedir("$installlib/$dir"); &cmd("cp $_ $installlib/$dir"); - &chmod(0644, "$installlib/$name"); + if (/\.a$/ && $Config{'osname'} eq 'next') { + #on NeXTs we have to rerun ranlib after copying libraries + &cmd("$Config{'ranlib'} $installlib/$dir/$_"); + } + # HP-UX (at least) needs to maintain execute permissions + # on dynamically-loaded libraries. + &chmod(0644, "$installlib/$name") + unless (/\.$so$/ || /\.$dlext$/); } } elsif (-d $_) { &makedir("$installlib/$name"); diff --git a/lib/AutoSplit.pm b/lib/AutoSplit.pm index 71115c6c8c..a6422611bc 100644 --- a/lib/AutoSplit.pm +++ b/lib/AutoSplit.pm @@ -24,8 +24,14 @@ $vms = ($Config{'osname'} eq 'VMS'); sub autosplit{ - my($file, $autodir) = @_; - autosplit_file($file, $autodir, $Keep, $CheckForAutoloader, $CheckModTime); + my($file, $autodir, $k, $ckal, $ckmt) = @_; + # $file - the perl source file to be split (after __END__) + # $autodir - the ".../auto" dir below which to write split subs + # Handle optional flags: + $keep = $Keep unless defined $k; + $ckal = $CheckForAutoloader unless defined $ckal; + $ckmt = $CheckModTime unless defined $ckmt; + autosplit_file($file, $autodir, $keep, $ckal, $ckmt); } diff --git a/lib/ExtUtils/MakeMaker.pm b/lib/ExtUtils/MakeMaker.pm index e6b96ef562..c70de4eb19 100644 --- a/lib/ExtUtils/MakeMaker.pm +++ b/lib/ExtUtils/MakeMaker.pm @@ -1,6 +1,6 @@ package ExtUtils::MakeMaker; -$Version = 3.8; # Last edited 17th Jan 1995 by Andreas Koenig +$Version = 4.01; # Last edited 25th Jan 1995 by Tim Bunce use Config; use Carp; @@ -48,10 +48,37 @@ it wishes to have written to the Makefile. The automatically generated Makefile enables the user of the extension to invoke - perl Makefile.PL - make - make test - make install + perl Makefile.PL + make + make test + make install # May need to invoke as root to write into INST_LIB + +The Makefile to be produced may be altered by adding arguments of the +form C<KEY=VALUE>. If the user wants to have the extension installed +into a directory different from C<$Config{"installprivlib"}> it can be +done by specifying + + perl Makefile.PL INST_LIB=~/myperllib + +Note, that in this example MakeMaker does the tilde expansion for you +and INST_ARCHLIB is set to either C<INST_LIB/$Config{"osname"}> if +that directory exists and otherwise to INST_LIB. + +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 + +The macros in the produced Makefile may be overriden on the command +line to the make call like: + + make INST_LIB=/some/where INST_ARCHLIB=/some/where + +Note, that this is a solution provided by C<make> in general, so tilde +expansion will probably not be available and INST_ARCHLIB will not be +set automatically when INST_LIB is given as argument. (This section is yet to be completed ...) @@ -60,22 +87,31 @@ to invoke MakeMaker needs to know, or to guess, where certain things are located. Especially INST_LIB, INST_ARCHLIB, PERL_LIB, PERL_ARCHLIB and PERL_SRC. -Extensions may be built anywhere within the file system after perl has -been installed correctly. Before perl is installed extensions have to -be built below the C<ext/> directory within the tree of the perl -source, i.e. where all the standard extensions are being built. The -generated Makefile will recognize, which of the two is the current -configuration and will set some variables accordingly. +Extensions may be built either using the contents of the perl source +directory tree or from an installed copy of the perl library. + +If an extension is being built below the C<ext/> directory of the perl +source then MakeMaker will set PERL_SRC automatically (e.g., C<../..>). +If PERL_SRC is defined then other variables default to the following: + + PERL_INC = PERL_SRC + PERL_LIB = PERL_SRC/lib + PERL_ARCHLIB = PERL_SRC/lib + INST_LIB = PERL_LIB + INST_ARCHLIB = PERL_ARCHLIB -Only if the extension is being built in PERL_SRC/ext, the variable -PERL_SRC is defined, otherwise it is undefined. Consequently -MakeMaker will default PERL_LIB and PERL_ARCHLIB to PERL_SRC/lib only -if PERL_SRC is defined, otherwise PERL_*LIB will default to the public -library locations. +If an extension is being built away from the perl source then MakeMaker +will leave PERL_SRC undefined and default to using the installed copy +of the perl library. The other variables default to the following: -INST_LIB and INST_ARCHLIB default to PERL_LIB and PERL_ARCHLIB if we -are building below the PERL_SRC/ext directory. Else they default to -./blib. + PERL_INC = $archlib/CORE + PERL_LIB = $privlib + PERL_ARCHLIB = $archlib + INST_LIB = ./blib + INST_ARCHLIB = ./blib + +If perl has not yet been installed then PERL_SRC can be defined on the +command line as shown in the previous section. =head2 Useful Default Makefile Macros @@ -113,7 +149,8 @@ or as NAME=VALUE pairs on the command line: This description is not yet documented; you can get at the description with the command - perl -e 'use ExtUtils::MakeMaker qw(&help); &help;' + perl Makefile.PL help (if you already have a basic Makefile.PL) +or perl -e 'use ExtUtils::MakeMaker qw(&help); &help;' =head2 Overriding MakeMaker Methods @@ -150,30 +187,8 @@ v3.3 November 27th 1994 by Andreas Koenig. v3.4 December 7th 1994 by Andreas Koenig and Tim Bunce. v3.5 December 15th 1994 by Tim Bunce. v3.6 December 15th 1994 by Tim Bunce. - -Added C and H attributes and corresponding macros. These default to the -list of *.c and *.h files in the directory. C also includes *.c file -names corresponding to any *.xs files in the directory. ARMAYBE should -now be specified as an attribute of the dynamic_lib section. The installpm -section now accepts a SPLITLIB attribute. This defaults to '$(INST_LIB)'. -Improved automatic setting of INST_ARCHLIB. Newlines in OBJECT now translate -into <space><backslash><newline><tab> for better formatting. Improved -descriptive comments for EXTRALIBS, LDLOADLIBS and BSLOADLIBS. Bootstrap -files are now always installed - (after a small patch) the DynaLoader will -only read a non-empty bootstrap file. Subdirectory dependencies have -been improved. The .c files produced from .xs files now depend on -XSUBPPDEPS (the typemaps). - -v3.7 December 30th By Tim Bunce - -Most, if not all, the MakeMaker support for no perl source is now -included. Recent ld and mkbootstrap patches applied. -lX11_s suffix -fix applied. - -Also contained patches to Makefile.SH, ext/DynaLoader/DynaLoader.pm, -ext/util/make_ext, and h2xs - -v3.8 January 9th By Andreas Koenig and Tim Bunce +v3.7 December 30th 1994 By Tim Bunce +v3.8 January 17th 1995 By Andreas Koenig and Tim Bunce - Introduces ./blib as the directory, where the ready-to-use module will live for the time of the building process if PERL_SRC/lib is not @@ -231,8 +246,45 @@ split exists. RM_F etc now expanded when Makefile written. Old AUTOSPLITLIB definition deleted. See new dynamic_lib section for new ARMAYBE handling. - install section now uses $(INSTALLPRIVLIB) because on some - systems INSTALLPRIVLIB != PRIVLIB (ditto for archlib) + install section now uses $(INSTALLPRIVLIB) because on some + systems INSTALLPRIVLIB != PRIVLIB (ditto for archlib) + +v3.9 January 19th 1995 By Tim Bunce + +Added ~ processing to parse_args to allow perl Makefile.PL X=~/path. +Added warning about LDTARGET to LDFROM attribute name change. +Fallback INST_ARCHLIB is INST_LIB, or INST_LIB/$archname if it exists. +Tightened up dependency checking of Makefile against config.sh etc. +INST_STATIC is now INST_ARCHLIBDIR/BASEEXT.a for later make-a-perl. +AUTOSPLITFILE tidied up (AutoSplit patch included in this version). +MKPATH now skips inner loop if directory already exists. +The dynamic_lib section was revised with explicit dec_osf support added. +Make clean now renames Makefile to Makefile.old (make_ext also patched). +The large initialize function has been split into smaller pieces. +Added I_PERL_LIBS to simplify -I paths for PERL_*LIB. + +v3.10 January 23rd 1995 By Tim Bunce + +miniperl now given preference when defining PERL. This improves the +reliability of ext/*/Makefile's recreating themselves if needed. +$(XS), $(C) and $(H) renamed to XS_FILES C_FILES and H_FILES. +INST_STATIC now INST_ARCHLIBDIR/BASEEXT.a (alongside INST_DYNAMIC). +Static lib no longer copied back to local directory. + +v3.11 January 24th 1995 By Andreas Koenig + +DynaLoader.c was not deleted by clean target, now fixed. +Added PMDIR attribute that allows directories to be named that contain +only *.p[pl] files to be installed into INST_LIB. Added some documentation. + +v4.00 January 24th 1995 By Tim Bunce + +Revised some of the documentation. Changed version number to 4.00 to +avoid problems caused by my earlier poor choice of 3.10! Renamed PMDIR +to PMLIBDIRS and restructured find code to use inherited MY->libscan. +Added ability to say: "perl Makefile.PL help" to get help. +Added ability to say: "perl Makefile.PL verbose" to get debugging. +Added MakeMaker version number to generated Makefiles. =head1 NOTES @@ -240,12 +292,12 @@ MakeMaker development work still to be done: Needs more complete documentation. -The ext.libs file mechanism will need to be revised to allow a -make-a-perl [list-of-static-extensions] script to work. - Add method to take a list of files and wrap it in a Makefile compatible way (<space><backslash><newline><tab>). +Add a html: target when there has been found a general solution to +installing html files. + =cut @@ -262,7 +314,8 @@ unshift(@MM::ISA, $Is_VMS ? qw(ExtUtils::MM_VMS MM_Unix) : qw(MM_Unix)); $Attrib_Help = <<'END'; NAME: Perl module name for this extension (DBD::Oracle) - This defaults to the directory name. + This will default to the directory name but should + be explicitly defined in the Makefile.PL. DISTNAME: Your name for distributing the package (by tar file) This defaults to NAME above. @@ -305,11 +358,19 @@ $Attrib_Help = <<'END'; DIR: Ref to array of subdirectories containing Makefile.PLs e.g. [ 'sdbm' ] in ext/SDBM_File + PMLIBDIRS: Ref to array of subdirectories containing library files. + Defaults to [ 'lib', $(BASEEXT) ]. The directories will + be scanned and any *.pm and *.pl files they contain will + be installed in the corresponding location in the library. + A MY::libscan() function can be used to alter the behaviour. + Defining PM in the Makefile.PL will override PMLIBDIRS. + PM: Hashref of .pm files and *.pl files to be installed. e.g. { 'name_of_file.pm' => '$(INST_LIBDIR)/install_as.pm' } By default this will include *.pm and *.pl. If a lib directory exists and is not listed in DIR (above) then any *.pm and *.pl files it contains will also be included by default. + Defining PM in the Makefile.PL will override PMLIBDIRS. XS: Hashref of .xs files. MakeMaker will default this. e.g. { 'name_of_file.xs' => 'name_of_file.c' } @@ -337,7 +398,7 @@ normally required: installpm: {SPLITLIB => '$(INST_LIB)' (default) or '$(INST_ARCHLIB)'} linkext: {LINKTYPE => 'static', 'dynamic' or ''} - dynamic_lib {ARMAYBE => 'ar', OTHERLDFLAGS => '...'} + dynamic_lib: {ARMAYBE => 'ar', OTHERLDFLAGS => '...'} clean: {FILES => "*.xyz foo"} realclean: {FILES => '$(INST_ARCHAUTODIR)/*.xyz'} distclean: {TARNAME=>'MyTarFile', TARFLAGS=>'cvfF', COMPRESS=>'gzip'} @@ -408,16 +469,19 @@ sub WriteMakefile { parse_args(\%att, @ARGV); my(%initial_att) = %att; # record initial attributes - MY->initialize(@ARGV); + MY->init_main(); print STDOUT "Writing Makefile for $att{NAME}"; + MY->init_dirscan(); + MY->init_others(); + unlink("Makefile", "MakeMaker.tmp", $Is_VMS ? 'Descrip.MMS' : ''); open MAKE, ">MakeMaker.tmp" or die "Unable to open MakeMaker.tmp: $!"; select MAKE; $|=1; select STDOUT; print MAKE "# This Makefile is for the $att{NAME} extension to perl.\n#"; - print MAKE "# It was generated automatically by MakeMaker from the contents"; + print MAKE "# It was generated automatically by MakeMaker version $Version from the contents"; print MAKE "# of Makefile.PL. Don't edit this file, edit Makefile.PL instead."; print MAKE "#\n# ANY CHANGES MADE HERE WILL BE LOST! \n#"; print MAKE "# MakeMaker Parameters: "; @@ -438,7 +502,7 @@ sub WriteMakefile { } else { my(%a) = %{$att{$section} || {}}; print MAKE "\n# --- MakeMaker $section section:"; - print MAKE "# ",%a if ($Verbose >= 2); + print MAKE "# ",%a if $Verbose; print(MAKE MY->nicetext(MY->$section( %a ))); } } @@ -473,8 +537,17 @@ sub mkbootstrap{ sub parse_args{ my($attr, @args) = @_; foreach (@args){ - next unless m/(.*?)=(.*)/; - $$attr{$1} = $2; + unless (m/(.*?)=(.*)/){ + help(),exit 1 if m/^help$/; + ++$Verbose if m/^verb/; + next; + } + my($name, $value) = ($1, $2); + if ($value =~ m/^~(\w+)?/){ # tilde with optional username + my($home) = ($1) ? (getpwnam($1))[7] : (getpwuid($>))[7]; + $value =~ s/^~(\w+)?/$home/; + } + $$attr{$name} = $value; } # catch old-style 'potential_libs' and inform user how to 'upgrade' if (defined $$attr{'potential_libs'}){ @@ -496,6 +569,11 @@ sub parse_args{ $$attr{'dynamic_lib'} = { %dl, ARMAYBE => $armaybe}; delete $$attr{'ARMAYBE'}; } + if (defined $$attr{'LDTARGET'}){ + print STDERR "LDTARGET should be changed to LDFROM\n"; + $$attr{'LDFROM'} = $$attr{'LDTARGET'}; + delete $$attr{'LDTARGET'}; + } foreach(sort keys %{$attr}){ print STDOUT " $_ => ".neatvalue($$attr{$_}) if ($Verbose); warn "'$_' is not a known MakeMaker parameter name.\n" @@ -537,7 +615,7 @@ if ($Is_VMS = $Config{'osname'} eq 'VMS') { } -sub initialize { +sub init_main { # Find out directory name. This may contain the extension name. my($pwd) = fastcwd(); # from Cwd.pm @@ -598,8 +676,18 @@ sub initialize { $inc_carp_dir => $inc_config_dir, ); $att{INST_ARCHLIB} = $archmap{$att{INST_LIB}}; - die "Unable to determine INST_ARCHLIB. Please define it explicitly.\n" - unless $att{INST_ARCHLIB}; + unless($att{INST_ARCHLIB}){ + # Oh dear, we'll have to default it and warn the user + my($archname) = $Config{'archname'}; + if (-d "$att{INST_LIB}/$archname"){ + $att{INST_ARCHLIB} = "$att{INST_LIB}/$archname"; + warn "Defaulting INST_ARCHLIB to INST_LIB/$archname\n"; + } else { + $att{INST_ARCHLIB} = $att{INST_LIB}; + warn "Warning: Defaulting INST_ARCHLIB to INST_LIB ", + "(not architecture independent).\n"; + } + } } # make a few simple checks @@ -635,8 +723,9 @@ sub initialize { # --- Initialize Perl Binary Locations # Find Perl 5. The only contract here is that both 'PERL' and 'FULLPERL' - # will be working versions of perl 5. - $att{'PERL'} = MY->find_perl(5.0, [ qw(perl5 perl miniperl) ], + # will be working versions of perl 5. miniperl has priority over perl + # for PERL to ensure that $(PERL) is usable while building ./ext/* + $att{'PERL'} = MY->find_perl(5.0, [ qw(miniperl perl) ], [ $att{PERL_SRC}, split(":", $ENV{PATH}), $Config{'bin'} ], 0 ) unless ($att{'PERL'} && -x $att{'PERL'}); @@ -648,58 +737,93 @@ sub initialize { ($att{'PERL'} = 'MCR ' . vmsify($att{'PERL'})) =~ s:.*/::; ($att{'FULLPERL'} = 'MCR ' . vmsify($att{'FULLPERL'})) =~ s:.*/::; } +} - # --- Initialize File and Directory Lists (.xs .pm etc) - - { - my($name, %dir, %xs, %pm, %c, %h, %ignore); - $ignore{'test.pl'} = 1; - $ignore{'makefile.pl'} = 1 if $Is_VMS; - foreach $name (lsdir(".")){ - next if ($name =~ /^\./ or $ignore{$name}); - if (-d $name){ - $dir{$name} = $name if (-f "$name/Makefile.PL"); - }elsif ($name =~ /\.xs$/){ - my($c); ($c = $name) =~ s/\.xs$/.c/; - $xs{$name} = $c; - $c{$c} = 1; - }elsif ($name =~ /\.c$/){ - $c{$name} = 1; - }elsif ($name =~ /\.h$/){ - $h{$name} = 1; - }elsif ($name =~ /\.p[ml]$/){ - $pm{$name} = "\$(INST_LIBDIR)/$name"; - } - } - - # If we have a ./lib dir that does NOT contain a Makefile.PL - # then add in any .pm and .pl files in that directory. - # This makes it easy and tidy to ship a number of perl files. - if (-d "lib" and !$dir{'lib'}){ - foreach $name (lsdir("lib", '\.p[ml]$')){ - # next unless ($name =~ /\.p[ml]$/); - $pm{"lib/$name"} = "\$(INST_LIBDIR)/$name"; - } - } - # Similarly, if we have a ./$(BASEEXT) dir without a Makefile.PL - # we treat it as a directory containing *.pm files for modules - # which are nested below this one. E.g., ./Tk.pm & ./Tk/Text.pm - if (-d $att{BASEEXT} and !$dir{$att{BASEEXT}}){ - foreach $name (lsdir($att{BASEEXT}, '\.p[ml]$')){ - # next unless ($name =~ /\.p[ml]$/); - $pm{"$att{BASEEXT}/$name"} = "\$(INST_LIBDIR)/$att{BASEEXT}/$name"; - } +sub init_dirscan { # --- File and Directory Lists (.xs .pm etc) + + my($name, %dir, %xs, %c, %h, %ignore); + local(%pm); #the sub in find() has to see this hash + $ignore{'test.pl'} = 1; + $ignore{'makefile.pl'} = 1 if $Is_VMS; + foreach $name (lsdir(".")){ + next if ($name =~ /^\./ or $ignore{$name}); + if (-d $name){ + $dir{$name} = $name if (-f "$name/Makefile.PL"); + } elsif ($name =~ /\.xs$/){ + my($c); ($c = $name) =~ s/\.xs$/.c/; + $xs{$name} = $c; + $c{$c} = 1; + } elsif ($name =~ /\.c$/){ + $c{$name} = 1; + } elsif ($name =~ /\.h$/){ + $h{$name} = 1; + } elsif ($name =~ /\.p[ml]$/){ + $pm{$name} = "\$(INST_LIBDIR)/$name"; } + } - $att{DIR} = [sort keys %dir] unless $att{DIRS}; - $att{XS} = \%xs unless $att{XS}; - $att{PM} = \%pm unless $att{PM}; - $att{C} = [sort keys %c] unless $att{C}; - $att{H} = [sort keys %h] unless $att{H}; + # Some larger extensions often wish to install a number of *.pm/pl + # files into the library in various locations. + + # The attribute PMLIBDIRS holds an array reference which lists + # subdirectories which we should search for library files to + # install. PMLIBDIRS defaults to [ 'lib', $att{BASEEXT} ]. + # We recursively search through the named directories (skipping + # any which don't exist or contain Makefile.PL files). + + # For each *.pm or *.pl file found MY->libscan() is called with + # the default installation path in $_. The return value of libscan + # defines the actual installation location. + # The default libscan function simply returns $_. + # The file is skipped if libscan returns false. + + # The default installation location passed to libscan in $_ is: + # + # ./*.pm => $(INST_LIBDIR)/*.pm + # ./xyz/... => $(INST_LIBDIR)/xyz/... + # ./lib/... => $(INST_LIB)/... + # + # In this way the 'lib' directory is seen as the root of the actual + # perl library whereas the others are relative to INST_LIBDIR + # (which includes ROOTEXT). This is a subtle distinction but one + # that's important for nested modules. + + $att{PMLIBDIRS} = [ 'lib', $att{BASEEXT} ] unless $att{PMLIBDIRS}; + + #only existing directories that aren't in $dir are allowed + @{$att{PMLIBDIRS}} = grep -d && !$dir{$_}, @{$att{PMLIBDIRS}}; + + if (@{$att{PMLIBDIRS}}){ + print "Searching PMLIBDIRS: @{$att{PMLIBDIRS}}" + if ($Verbose >= 2); + use File::Find; # try changing to require ! + File::Find::find(sub { + return unless m/\.p[ml]$/; + my($path, $prefix) = ($File::Find::name, '$(INST_LIBDIR)'); + $prefix = '$(INST_LIB)' if ($path =~ s:^lib/::); + local($_) = "$prefix/$path"; + my($inst) = MY->libscan(); + print "libscan($path) => '$inst'" if ($Verbose >= 2); + return unless $inst; + $pm{$path} = "$inst"; + }, @{$att{PMLIBDIRS}}); } - # --- Initialize Other Attributes + $att{DIR} = [sort keys %dir] unless $att{DIRS}; + $att{XS} = \%xs unless $att{XS}; + $att{PM} = \%pm unless $att{PM}; + $att{C} = [sort keys %c] unless $att{C}; + $att{H} = [sort keys %h] unless $att{H}; +} + + +sub libscan { + $_; +} + + +sub init_others { # --- Initialize Other Attributes for $key (keys(%Recognized_Att_Keys), keys(%Other_Att_Keys)){ # avoid warnings for uninitialized vars @@ -753,6 +877,7 @@ sub initialize { $att{RM_RF} = "rm -rf"; $att{TOUCH} = "touch"; $att{CP} = "cp"; + $att{MV} = "mv"; } @@ -818,7 +943,20 @@ INST_ARCHLIB = $att{INST_ARCHLIB} # Perl library to use when building the extension PERL_LIB = $att{PERL_LIB} PERL_ARCHLIB = $att{PERL_ARCHLIB} +"; + # Define I_PERL_LIBS to include the required -Ipaths + # To be cute we only include PERL_ARCHLIB if different + # To be portable we add quotes for VMS + my(@i_perl_libs) = qw{-I$(PERL_ARCHLIB) -I$(PERL_LIB)}; + shift(@i_perl_libs) if ($att{PERL_ARCHLIB} eq $att{PERL_LIB}); + if ($Is_VMS){ + push @m, "I_PERL_LIBS = \"".join('" "',@i_perl_libs)."\"\n"; + } else { + push @m, "I_PERL_LIBS = ".join(' ',@i_perl_libs)."\n"; + } + + push @m, " # Where is the perl source code located? (Eventually we should # be able to build extensions without requiring the perl source # but that's a way off yet). @@ -828,40 +966,38 @@ PERL_INC = $att{PERL_INC} # Perl binaries PERL = $att{'PERL'} FULLPERL = $att{'FULLPERL'} - +"; + push @m, " # FULLEXT = Pathname for extension directory (eg DBD/Oracle). # BASEEXT = Basename part of FULLEXT. May be just equal FULLEXT. # ROOTEXT = Directory part of FULLEXT with leading slash (eg /DBD) FULLEXT = $att{FULLEXT} BASEEXT = $att{BASEEXT} ROOTEXT = $att{ROOTEXT} - -# These will be removed later. Use PERL_SRC and BASEEXT instead. -TOP = \$(PERL_SRC) -EXT = CHANGE_EXT_TO_BASEEXT - +"; + push @m, " INC = $att{INC} DEFINE = $att{DEFINE} OBJECT = $att{OBJECT} LDFROM = $att{LDFROM} LINKTYPE = $att{LINKTYPE} -# Source code: -XS= ".join(" \\\n\t", sort keys %{$att{XS}})." -C = ".join(" \\\n\t", @{$att{C}})." -H = ".join(" \\\n\t", @{$att{H}})." +# Handy lists of source code files: +XS_FILES= ".join(" \\\n\t", sort keys %{$att{XS}})." +C_FILES = ".join(" \\\n\t", @{$att{C}})." +H_FILES = ".join(" \\\n\t", @{$att{H}})." .SUFFIXES: .xs .PRECIOUS: Makefile -.PHONY: all config static dynamic test +.PHONY: all config static dynamic test linkext # This extension may link to it's own library (see SDBM_File) MYEXTLIB = $att{MYEXTLIB} -# Where is the Config.pm that we are using/depend on -CONFIGDEP = \$(PERL_ARCHLIB)/Config.pm +# Where is the Config information that we are using/depend on +CONFIGDEP = \$(PERL_ARCHLIB)/Config.pm \$(PERL_INC)/config.h "; push @m, ' @@ -869,17 +1005,14 @@ CONFIGDEP = \$(PERL_ARCHLIB)/Config.pm INST_LIBDIR = $(INST_LIB)$(ROOTEXT) INST_ARCHLIBDIR = $(INST_ARCHLIB)$(ROOTEXT) -'; - - push @m, ' INST_AUTODIR = $(INST_LIB)/auto/$(FULLEXT) INST_ARCHAUTODIR = $(INST_ARCHLIB)/auto/$(FULLEXT) '; push @m, ' -INST_BOOT = $(INST_ARCHAUTODIR)/$(BASEEXT).bs +INST_STATIC = $(INST_ARCHAUTODIR)/$(BASEEXT).a INST_DYNAMIC = $(INST_ARCHAUTODIR)/$(BASEEXT).$(DLEXT) -INST_STATIC = $(BASEEXT).a +INST_BOOT = $(INST_ARCHAUTODIR)/$(BASEEXT).bs INST_PM = '.join(" \\\n\t", sort values %{$att{PM}}).' '; @@ -888,51 +1021,55 @@ INST_PM = '.join(" \\\n\t", sort values %{$att{PM}}).' sub const_cccmd{ - # This is implemented in the - # same manner as extliblist, e.g., do both and compare results during - # the transition period. - my($cc,$ccflags,$optimize,$large,$split)=@Config{qw(cc ccflags optimize large split)}; - my($prog, $old); - - chop($old = `cd $att{PERL_SRC}; sh $Config{'shellflags'} ./cflags $att{BASEEXT}.c`) + # This is implemented in the same manner as extliblist, + # e.g., do both and compare results during the transition period. + my($cc,$ccflags,$optimize,$large,$split, $shflags) + = @Config{qw(cc ccflags optimize large split shellflags)}; + $shflags = '' unless $shflags; + my($prog, $old); + + chop($old = `cd $att{PERL_SRC}; sh $shflags ./cflags $att{BASEEXT}.c 2>/dev/null`) if $att{PERL_SRC}; - # Why is this written this way ? - if ($prog = $Config{"$att{BASEEXT}_cflags"}) { - my(@o)=`cc=\"$cc\" - ccflags=\"$ccflags\" - optimize=\"$optimize\" - large=\"$large\" - split=\"$split\" - eval '$prog' - echo cc=\$cc - echo ccflags=\$ccflags - echo optimize=\$optimize - echo large=\$large - echo split=\$split - `; - my(%cflags); - foreach $line (@o){ - chomp $line; - if ($line =~ /(.*?)\s*=\s*(.*)\s*$/){ - $cflags{$1} = $2; - print STDERR " $1 = $2" if $Verbose; - } + if ($prog = $Config{"$att{BASEEXT}_cflags"}) { + # Expand hints for this extension via the shell + print STDERR "Processing $att{BASEEXT}_cflags hint:\n" if $Verbose; + my(@o)=`cc=\"$cc\" + ccflags=\"$ccflags\" + optimize=\"$optimize\" + large=\"$large\" + split=\"$split\" + eval '$prog' + echo cc=\$cc + echo ccflags=\$ccflags + echo optimize=\$optimize + echo large=\$large + echo split=\$split + `; + my(%cflags); + foreach $line (@o){ + chomp $line; + if ($line =~ /(.*?)=\s*(.*)\s*$/){ + $cflags{$1} = $2; + print STDERR " $1 = $2" if $Verbose; + } else { + print STDERR "Unrecognised result from hint: '$line'\n"; + } + } + ($cc,$ccflags,$optimize,$large,$split)=@cflags{qw(cc ccflags optimize large split)}; + } + + my($new) = "$cc -c $ccflags $optimize $large $split"; + if (defined($old) and $new ne $old) { + warn "Warning (non-fatal): cflags evaluation in MakeMaker differs from shell output\n" + ." package: $att{NAME}\n" + ." old: $old\n" + ." new: $new\n" + ." Using 'old' set.\n" + ."Please notify perl5-porters\@nicoh.com\n"; } - ($cc,$ccflags,$optimize,$large,$split)=@cflags{qw(cc ccflags optimize large split)}; - } - - my($new) = "$cc -c $ccflags $optimize $large $split"; - if (defined($old) and $new ne $old) { - warn "Warning (non-fatal): cflags evaluation in MakeMaker differs from shell output\n" - ." package: $att{NAME}\n" - ." old: $old\n" - ." new: $new\n" - ." Using 'old' set.\n" - ."Please notify perl5-porters\@nicoh.com\n"; - } - my($cccmd)=($old) ? $old : $new; - "CCCMD = $cccmd\n"; + my($cccmd)=($old) ? $old : $new; + "CCCMD = $cccmd\n"; } @@ -983,7 +1120,6 @@ sub const_loadlibs{ # SunOS/Solaris does not need this because ld records # the information (from LDLOADLIBS) into the object file. # This list is used to create a .bs (bootstrap) file. -# The bootstrap file is installed only if it's not empty. # EXTRALIBS = $att{'EXTRALIBS'} LDLOADLIBS = $att{'LDLOADLIBS'} @@ -1001,7 +1137,7 @@ sub tool_autosplit{ q{ # Usage: $(AUTOSPLITFILE) FileToSplit AutoDirToSplitInto # Remark: the "" around the -I switches are helpful for the VMS support -AUTOSPLITFILE = $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -e 'use AutoSplit;}.$asl.q{ AutoSplit::autosplit_file($$ARGV[0], $$ARGV[1], 0, 1, 1) ;' +AUTOSPLITFILE = $(PERL) $(I_PERL_LIBS) -e 'use AutoSplit;}.$asl.q{ autosplit($$ARGV[0], $$ARGV[1], 0, 1, 1) ;' }; } @@ -1028,11 +1164,12 @@ SHELL = /bin/sh LD = $att{LD} TOUCH = $att{TOUCH} CP = $att{CP} +MV = $att{MV} RM_F = $att{RM_F} RM_RF = $att{RM_RF} ".q{ # The following is a portable way to say mkdir -p -MKPATH = $(PERL) -wle '$$"="/"; foreach $$p (@ARGV){ my(@p); foreach(split(/\//,$$p)){ push(@p,$$_); next if -d "@p/"; print "mkdir @p"; mkdir("@p",0777)||die $$! }} exit 0;' +MKPATH = $(PERL) -wle '$$"="/"; foreach $$p (@ARGV){ next if -d $$p; my(@p); foreach(split(/\//,$$p)){ push(@p,$$_); next if -d "@p/"; print "mkdir @p"; mkdir("@p",0777)||die $$! }} exit 0;' }; } @@ -1075,8 +1212,7 @@ all :: config linkext $(INST_PM) '.$att{NOOP}.' config :: Makefile - @$(MKPATH) $(INST_LIBDIR) - @$(MKPATH) $(INST_ARCHAUTODIR) + @$(MKPATH) $(INST_LIBDIR) $(INST_ARCHAUTODIR) '; } @@ -1097,7 +1233,7 @@ sub dynamic { ' # $(INST_PM) has been moved to the all: target. # It remains here for awhile to allow for old usage: "make dynamic" -dynamic :: $(INST_DYNAMIC) $(INST_BOOT) $(INST_PM) +dynamic :: Makefile $(INST_DYNAMIC) $(INST_BOOT) $(INST_PM) '.$att{NOOP}.' '; } @@ -1110,8 +1246,8 @@ BOOTSTRAP = '."$att{BASEEXT}.bs".' # As MakeMaker mkbootstrap might not write a file (if none is required) # we use touch to prevent make continually trying to remake it. # The DynaLoader only reads a non-empty file. -$(BOOTSTRAP): '.$att{BOOTDEP}.' $(CONFIGDEP) Makefile.PL - $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) \ +$(BOOTSTRAP): Makefile '.$att{BOOTDEP}.' + $(PERL) $(I_PERL_LIBS) \ -e \'use ExtUtils::MakeMaker; &mkbootstrap("$(BSLOADLIBS)");\' \ INST_LIB=$(INST_LIB) INST_ARCHLIB=$(INST_ARCHLIB) PERL_SRC=$(PERL_SRC) NAME=$(NAME) @$(TOUCH) $(BOOTSTRAP) @@ -1122,13 +1258,18 @@ $(INST_BOOT): $(BOOTSTRAP) '; } + sub dynamic_lib { my($self, %attribs) = @_; my($otherldflags) = $attribs{OTHERLDFLAGS} || ""; my($armaybe) = $attribs{ARMAYBE} || $att{ARMAYBE} || ":"; my($ldfrom) = '$(LDFROM)'; + my($osname) = $Config{'osname'}; + $armaybe = 'ar' if ($osname eq 'dec_osf' and $armaybe eq ':'); my(@m); push(@m,' +# This section creates the dynamically loadable $(INST_DYNAMIC) +# from $(OBJECT) and possibly $(MYEXTLIB). ARMAYBE = '.$armaybe.' OTHERLDFLAGS = '.$otherldflags.' @@ -1140,7 +1281,8 @@ $(INST_DYNAMIC): $(OBJECT) $(MYEXTLIB) $(BOOTSTRAP) push(@m,' $(ARMAYBE) cr '.$ldfrom.' $(OBJECT)'."\n"); push(@m,' $(RANLIB) '."$ldfrom\n"); } - push(@m,' $(LD) $(LDDLFLAGS) -o $@ '.$ldfrom. + $ldfrom = "-all $ldfrom -none" if ($osname eq 'dec_osf'); + push(@m,' $(LD) -o $@ $(LDDLFLAGS) '.$ldfrom. ' $(OTHERLDFLAGS) $(MYEXTLIB) $(LDLOADLIBS)'."\n"); join('',@m); } @@ -1152,7 +1294,7 @@ sub static { ' # $(INST_PM) has been moved to the all: target. # It remains here for awhile to allow for old usage: "make static" -static :: $(INST_STATIC) $(INST_PM) +static :: Makefile $(INST_STATIC) $(INST_PM) '.$att{NOOP}.' '; } @@ -1168,13 +1310,11 @@ END push(@m, <<'END'); ar cr $@ $(OBJECT) && $(RANLIB) $@ - @: New mechanism - not yet used: - @echo $(EXTRALIBS) > $(INST_ARCHAUTODIR)/extralibs.ld - $(CP) $@ $(INST_ARCHAUTODIR)/ + @echo "$(EXTRALIBS)" > $(INST_ARCHAUTODIR)/extralibs.ld END push(@m, <<'END') if $att{PERL_SRC}; @: Old mechanism - still needed: - @echo $(EXTRALIBS) >> $(PERL_SRC)/ext.libs + @echo "$(EXTRALIBS)" >> $(PERL_SRC)/ext.libs END join('', "\n",@m); } @@ -1261,10 +1401,9 @@ config :: $subdir/Makefile $subdir/Makefile: $subdir/Makefile.PL \$(CONFIGDEP) }.' @echo "Rebuilding $@ ..." - $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) \\ + $(PERL) $(I_PERL_LIBS) \\ -e "use ExtUtils::MakeMaker; MM->runsubdirpl(qw('.$subdir.'))" \\ - INST_LIB=$(INST_LIB) INST_ARCHLIB=$(INST_ARCHLIB) \\ - $(SUBDIR_MAKEFILE_PL_ARGS) + INST_LIB=$(INST_LIB) INST_ARCHLIB=$(INST_ARCHLIB) $(SUBDIR_MAKEFILE_PL_ARGS) @echo "Rebuild of $@ complete." '.qq{ @@ -1288,12 +1427,12 @@ clean :: '); # clean subdirectories first push(@m, map("\t-cd $_ && test -f Makefile && \$(MAKE) clean\n",@{$att{DIR}})); - push(@m, " $att{RM_F} *~ t/*~ *.o *.a mon.out core so_locations \$(BOOTSTRAP) \$(BASEEXT).bso\n"); - my(@otherfiles); - # Automatically delete the .c files generated from *.xs files: - push(@otherfiles, values %{$att{XS}}); + my(@otherfiles) = values %{$att{XS}}; # .c files from *.xs files push(@otherfiles, $attribs{FILES}) if $attribs{FILES}; - push(@m, " $att{RM_RF} @otherfiles\n") if @otherfiles; + push(@m, " -$att{RM_RF} *~ t/*~ *.o *.a mon.out core so_locations " + ."\$(BOOTSTRAP) \$(BASEEXT).bso @otherfiles\n"); + # See realclean and ext/utils/make_ext for usage of Makefile.old + push(@m, " -$att{MV} Makefile Makefile.old 2>/dev/null\n"); push(@m, " $attribs{POSTOP}\n") if $attribs{POSTOP}; join("", @m); } @@ -1305,13 +1444,16 @@ sub realclean { # Delete temporary files (via clean) and also delete installed files realclean purge :: clean '); - # clean subdirectories first - push(@m, map("\t-cd $_ && test -f Makefile && \$(MAKE) realclean\n",@{$att{DIR}})); - # try to clean those files first, where we might have no permissions, so Makefile won't be lost + # realclean subdirectories first (already cleaned) + $sub = "\t-cd %s && test -f %s && \$(MAKE) %s realclean\n"; + foreach(@{$att{DIR}}){ + push(@m, sprintf($sub,$_,'Makefile.old','-f Makefile.old')); + push(@m, sprintf($sub,$_,'Makefile','')); + } push(@m, " $att{RM_RF} \$(INST_AUTODIR) \$(INST_ARCHAUTODIR)\n"); - push(@m, " $att{RM_F} \$(INST_DYNAMIC) \$(INST_BOOT) \$(INST_PM)\n"); - push(@m, " $att{RM_F} Makefile \$(INST_STATIC)\n"); - my(@otherfiles); + push(@m, " $att{RM_F} \$(INST_DYNAMIC) \$(INST_BOOT)\n"); + push(@m, " $att{RM_F} \$(INST_STATIC) \$(INST_PM)\n"); + my(@otherfiles) = qw(Makefile Makefile.old); # Makefiles last push(@otherfiles, $attribs{FILES}) if $attribs{FILES}; push(@m, " $att{RM_RF} @otherfiles\n") if @otherfiles; push(@m, " $attribs{POSTOP}\n") if $attribs{POSTOP}; @@ -1352,7 +1494,7 @@ test :: all \$(FULLPERL) -I\$(INST_ARCHLIB) -I\$(INST_LIB) -I\$(PERL_ARCHLIB) -I\$(PERL_LIB) -e 'use Test::Harness; runtests \@ARGV;' $tests END push(@m, <<'END') if -f "test.pl"; - $(FULLPERL) -I$(INST_ARCHLIB) -I$(INST_LIB) -I$(PERL_ARCHLIB) -I$(PERL_LIB) test.pl + $(FULLPERL) -I$(INST_ARCHLIB) -I$(INST_LIB) $(I_PERL_LIBS) test.pl END push(@m, map("\tcd $_ && test -f Makefile && \$(MAKE) test LINKTYPE=\$(LINKTYPE)\n",@{$att{DIR}})); push(@m, "\t\@echo 'No tests defined for \$(NAME) extension.'\n") unless @m > 1; @@ -1369,9 +1511,9 @@ install :: all # install subdirectories first push(@m, map("\tcd $_ && test -f Makefile && \$(MAKE) install\n",@{$att{DIR}})); - push(@m, "\t: perl5.000 used to autosplit into INST_ARCHLIB, we delete these old files here + push(@m, "\t: perl5.000 and MM pre 3.8 autosplit into INST_ARCHLIB, we delete these old files here $att{RM_F} \$(INSTALLARCHLIB)/auto/\$(FULLEXT)/*.al \$(INSTALLARCHLIB)/auto/\$(FULLEXT)/*.ix - make INST_LIB=\$(INSTALLPRIVLIB) INST_ARCHLIB=\$(INSTALLARCHLIB) + \$(MAKE) INST_LIB=\$(INSTALLPRIVLIB) INST_ARCHLIB=\$(INSTALLARCHLIB) "); join("",@m); @@ -1396,16 +1538,24 @@ PERL_HDRS = $(PERL_INC)/EXTERN.h $(PERL_INC)/INTERN.h \ $(PERL_INC)/perl.h $(PERL_INC)/perly.h $(PERL_INC)/pp.h \ $(PERL_INC)/proto.h $(PERL_INC)/regcomp.h $(PERL_INC)/regexp.h \ $(PERL_INC)/scope.h $(PERL_INC)/sv.h $(PERL_INC)/unixish.h \ - $(PERL_INC)/util.h + $(PERL_INC)/util.h $(PERL_INC)/config.h $(OBJECT) : $(PERL_HDRS) '); push(@m,' -$(PERL_INC)/config.h: $(PERL_SRC)/config.sh; cd $(PERL_SRC); /bin/sh config_h.SH +# Check for unpropogated config.sh changes. Should never happen. +# We do NOT just update config.h because that is not sufficient. +# An out of date config.h is not fatal but complains loudly! +$(PERL_INC)/config.h: $(PERL_SRC)/config.sh + -@echo "Warning: $(PERL_INC)/config.h out of date with $(PERL_SRC)/config.sh"; false + +# An out of date Config.pm is fatal. +$(PERL_ARCHLIB)/Config.pm: $(PERL_SRC)/config.sh + @echo "$(PERL_ARCHLIB)/Config.pm out of date with $(PERL_SRC)/config.sh" + @false ') if $att{PERL_SRC}; - # This needs a better home: push(@m, join(" ", values %{$att{XS}})." : \$(XSUBPPDEPS)\n") if %{$att{XS}}; join("\n",@m); @@ -1414,17 +1564,19 @@ $(PERL_INC)/config.h: $(PERL_SRC)/config.sh; cd $(PERL_SRC); /bin/sh config_h.SH sub makefile { # We do not know what target was originally specified so we - # must force a manual rerun to be sure. But as it would only + # must force a manual rerun to be sure. But as it should only # happen very rarely it is not a significant problem. - -# This dependency, with no_op, causes problems. Make tries to build OBJECT via no_op! -# So we'll just drop it for now. -#$(OBJECT) : Makefile -#'.$att{NOOP}.' - - ' -Makefile: Makefile.PL $(CONFIGDEP) - $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) Makefile.PL + ' +$(OBJECT) : Makefile + +# We take a very conservative approach here, but it\'s worth it. +# We move Makefile to Makefile.old here to avoid gnu make looping. +Makefile: Makefile.PL $(CONFIGDEP) + @echo "Makefile out-of-date with respect to $?" + @echo "Cleaning current config before rebuilding Makefile..." + -@mv Makefile Makefile.old + -$(MAKE) -f Makefile.old clean >/dev/null 2>&1 || true + $(PERL) $(I_PERL_LIBS) Makefile.PL @echo "Now you must rerun make."; false '; } @@ -1644,7 +1796,7 @@ Andreas Koenig <k@otto.ww.TU-Berlin.DE>, Tim Bunce require DynaLoader; import DynaLoader; - initialize(@ARGV) unless defined $att{'BASEEXT'}; + init_main() unless defined $att{'BASEEXT'}; rename "$att{BASEEXT}.bs", "$att{BASEEXT}.bso"; diff --git a/lib/ExtUtils/xsubpp b/lib/ExtUtils/xsubpp index 1e13118ad5..bc0852303f 100755 --- a/lib/ExtUtils/xsubpp +++ b/lib/ExtUtils/xsubpp @@ -1,8 +1,60 @@ #!./miniperl -'di '; -'ds 00 \"'; -'ig 00 '; -# $Header$ + +=head1 NAME + +xsubpp - compiler to convert Perl XS code into C code + +=head1 SYNOPSIS + +B<xsubpp> [B<-C++>] [B<-except>] [B<-typemap typemap>] file.xs + +=head1 DESCRIPTION + +I<xsubpp> will compile XS code into C code by embedding the constructs +necessary to let C functions manipulate Perl values and creates the glue +necessary to let Perl access those functions. The compiler uses typemaps to +determine how to map C function parameters and variables to Perl values. + +The compiler will search for typemap files called I<typemap>. It will use +the following search path to find default typemaps, with the rightmost +typemap taking precedence. + + ../../../typemap:../../typemap:../typemap:typemap + +=head1 OPTIONS + +=over 5 + +=item B<-C++> + +Adds ``extern "C"'' to the C code. + + +=item B<-except> + +Adds exception handling stubs to the C code. + +=item B<-typemap typemap> + +Indicates that a user-supplied typemap should take precedence over the +default typemaps. This option may be used multiple times, with the last +typemap having the highest precedence. + +=back + +=head1 ENVIRONMENT + +No environment variables are used. + +=head1 AUTHOR + +Larry Wall + +=head1 SEE ALSO + +perl(1) + +=cut $usage = "Usage: xsubpp [-C++] [-except] [-typemap typemap] file.xs\n"; @@ -562,55 +614,3 @@ sub map_type { } exit $errors; - -############################################################################## - - # These next few lines are legal in both Perl and nroff. - -.00 ; # finish .ig - -'di \" finish diversion--previous line must be blank -.nr nl 0-1 \" fake up transition to first page again -.nr % 0 \" start at page 1 -'; __END__ ############# From here on it's a standard manual page ############ -.TH XSUBPP 1 "August 9, 1994" -.AT 3 -.SH NAME -xsubpp \- compiler to convert Perl XS code into C code -.SH SYNOPSIS -.B xsubpp [-C++] [-except] [-typemap typemap] file.xs -.SH DESCRIPTION -.I xsubpp -will compile XS code into C code by embedding the constructs necessary to -let C functions manipulate Perl values and creates the glue necessary to let -Perl access those functions. The compiler uses typemaps to determine how -to map C function parameters and variables to Perl values. -.PP -The compiler will search for typemap files called -.I typemap. -It will use the following search path to find default typemaps, with the -rightmost typemap taking precedence. -.br -.nf - ../../../typemap:../../typemap:../typemap:typemap -.fi -.SH OPTIONS -.TP -.B \-C++ -.br -Adds ``extern "C"'' to the C code. -.TP -.B \-except -Adds exception handling stubs to the C code. -.TP -.B \-typemap typemap -Indicates that a user-supplied typemap should take precedence over the -default typemaps. This option may be used multiple times, with the last -typemap having the highest precedence. -.SH ENVIRONMENT -No environment variables are used. -.SH AUTHOR -Larry Wall -.SH "SEE ALSO" -perl(1) -.ex diff --git a/lib/Getopt/Long.pm b/lib/Getopt/Long.pm index 9c66264fdd..48cda7e12a 100644 --- a/lib/Getopt/Long.pm +++ b/lib/Getopt/Long.pm @@ -203,6 +203,7 @@ require Exporter; $REQUIRE_ORDER = 0; $PERMUTE = 1; $RETURN_IN_ORDER = 2; + $RETURN_IN_ORDER = 2; # avoid typo warning with -w # Handle POSIX compliancy. if ( defined $ENV{"POSIXLY_CORRECT"} ) { @@ -234,7 +235,7 @@ sub GetOptions { local ($genprefix) = $option_start; local ($argend) = $argv_end; local ($error) = 0; - local ($opt, $optx, $arg, $type, $mand, %opctl); + local ($opt, $arg, $type, $mand, %opctl); local ($pkg) = (caller)[0]; local ($optarg); local (%aliases); diff --git a/lib/Text/Tabs.pm b/lib/Text/Tabs.pm index 8ca833f8e8..c90d1aa672 100644 --- a/lib/Text/Tabs.pm +++ b/lib/Text/Tabs.pm @@ -8,7 +8,7 @@ # David Muir Sharnoff <muir@idiom.com> # -package Tabs; +package Text::Tabs; require Exporter; diff --git a/makedepend.SH b/makedepend.SH index 296c954045..35a5d7e65c 100755 --- a/makedepend.SH +++ b/makedepend.SH @@ -18,7 +18,10 @@ case "$0" in esac echo "Extracting makedepend (with variable substitutions)" rm -f makedepend -$spitshell >makedepend <<'!NO!SUBS!' +$spitshell >makedepend <<!GROK!THIS! +$startsh +!GROK!THIS! +$spitshell >>makedepend <<'!NO!SUBS!' # makedepend.SH # @@ -94,6 +97,7 @@ for file in `$cat .clist`; do -e '}' ) >UU/$file.c $cppstdin $finc -I/usr/local/include -I. $cppflags $cppminus <UU/$file.c | $sed \ + -e '/^#.*<stdin>/d' \ -e 's#\.[0-9][0-9]*\.c#'"$file.c#" \ -e 's/^[ ]*#[ ]*line/#/' \ -e '/^# *[0-9][0-9]* *[".\/]/!d' \ @@ -768,11 +768,13 @@ char *strcpy(), *strcat(); # endif #endif -#if !defined(HAS_FMOD) && defined(HAS_DREM) -#define fmod(x,y) drem((x),(y)) -#else -#define USE_MY_FMOD -#define fmod(x,y) my_fmod(x,y) +#ifndef HAS_FMOD +# ifdef HAS_DREM +# define fmod(x,y) drem((x),(y)) +# else +# define USE_MY_FMOD +# define fmod(x,y) my_fmod(x,y) +# endif #endif #ifndef __cplusplus diff --git a/perl_exp.SH b/perl_exp.SH index f67b165821..9b01dc677e 100644 --- a/perl_exp.SH +++ b/perl_exp.SH @@ -1,5 +1,7 @@ #!/bin/sh +# Written: Nov 1994 Wayne Scott (wscott@ichips.intel.com) + # Create the export list for perl. # Needed by AIX to do dynamic linking. @@ -13,6 +15,12 @@ echo "#!" > perl.exp sed -n "/^[A-Za-z]/ p" global.sym >> perl.exp +# also add symbols from interp.sym +# They are only needed if -DMULTIPLICITY is not set but it +# doesn't hurt to include them anyway. +sed -n "/^[A-Za-z]/ p" interp.sym >> perl.exp + +# extra globals not included above. cat <<END >> perl.exp perl_init_ext perl_alloc @@ -226,7 +226,6 @@ OP* newANONLIST _((OP* op)); OP* newANONHASH _((OP* op)); OP* newANONSUB _((I32 floor, OP* block)); OP* newASSIGNOP _((I32 flags, OP* left, I32 optype, OP* right)); -OP* newBINOP _((I32 optype, I32 flags, OP* left, OP* right)); OP* newCONDOP _((I32 flags, OP* expr, OP* true, OP* false)); void newFORM _((I32 floor, OP* op, OP* block)); OP* newFOROP _((I32 flags, char* label, line_t forline, OP* scalar, OP* expr, OP*block, OP*cont)); @@ -241,7 +240,6 @@ OP* newRANGE _((I32 flags, OP* left, OP* right)); OP* newSLICEOP _((I32 flags, OP* subscript, OP* list)); OP* newSTATEOP _((I32 flags, char* label, OP* o)); CV* newSUB _((I32 floor, OP* op, OP* block)); -OP* newUNOP _((I32 optype, I32 flags, OP* child)); CV* newXS _((char *name, void (*subaddr)(CV* cv), char *filename)); #ifdef DEPRECATED CV* newXSUB _((char *name, I32 ix, I32 (*subaddr)(int,int,int), char *filename)); @@ -445,12 +445,12 @@ SV *littlestr; } else { s = bigend - littlelen; - if (*s == *little && bcmp(s,little,littlelen)==0) + if (*s == *little && bcmp((char*)s,little,littlelen)==0) return (char*)s; /* how sweet it is */ else if (bigend[-1] == '\n' && little[littlelen-1] != '\n' && s > big) { s--; - if (*s == *little && bcmp(s,little,littlelen)==0) + if (*s == *little && bcmp((char*)s,little,littlelen)==0) return (char*)s; } return Nullch; @@ -11,13 +11,6 @@ #define VOIDUSED 1 #include "../config.h" -#ifndef HAS_BCOPY -# define bcopy(s1,s2,l) memcpy(s2,s1,l) -#endif -#ifndef HAS_BZERO -# define bzero(s,l) memset(s,0,l) -#endif - /* Use all the "standard" definitions? */ #if defined(STANDARD_C) && defined(I_STDLIB) # include <stdlib.h> @@ -42,6 +35,13 @@ # include <strings.h> #endif +#ifndef HAS_BCOPY +# define bcopy(s1,s2,l) memcpy(s2,s1,l) +#endif +#ifndef HAS_BZERO +# define bzero(s,l) memset(s,0,l) +#endif + #if !defined(HAS_STRCHR) && defined(HAS_INDEX) && !defined(strchr) #define strchr index #define strrchr rindex @@ -273,10 +273,10 @@ EXT STR *Str; /* Prototypes for things in a2p.c */ int aryrefarg _(( int arg )); int bl _(( int arg, int maybe )); -int dump _(( int branch )); +void dump _(( int branch )); int fixfargs _(( int name, int arg, int prevargs )); int fixrargs _(( char *name, int arg, int prevargs )); -int fixup _(( STR *str )); +void fixup _(( STR *str )); int numary _(( int arg )); int oper0 _(( int type )); int oper1 _(( int type, int arg1 )); @@ -284,13 +284,13 @@ int oper2 _(( int type, int arg1, int arg2 )); int oper3 _(( int type, int arg1, int arg2, int arg3 )); int oper4 _(( int type, int arg1, int arg2, int arg3, int arg4 )); int oper5 _(( int type, int arg1, int arg2, int arg3, int arg4, int arg5 )); -int putlines _(( STR *str )); -int putone _(( void )); +void putlines _(( STR *str )); +void putone _(( void )); int rememberargs _(( int arg )); char * scannum _(( char *s )); char * scanpat _(( char *s )); int string _(( char *ptr, int len )); -int yyerror _(( char *s )); +void yyerror _(( char *s )); int yylex _(( void )); EXT int line INIT(0); diff --git a/x2p/a2py.c b/x2p/a2py.c index f1bc18ebe5..f404c1a8fb 100644 --- a/x2p/a2py.c +++ b/x2p/a2py.c @@ -827,6 +827,7 @@ register char *s; return s; } +void yyerror(s) char *s; { @@ -997,6 +998,7 @@ int arg5; int depth = 0; +void dump(branch) int branch; { @@ -1038,6 +1040,7 @@ int maybe; return arg; } +void fixup(str) STR *str; { @@ -1063,6 +1066,7 @@ STR *str; } } +void putlines(str) STR *str; { @@ -1139,6 +1143,7 @@ STR *str; } } +void putone() { register char *t; diff --git a/x2p/handy.h b/x2p/handy.h index 160d83927c..0049a1108b 100644 --- a/x2p/handy.h +++ b/x2p/handy.h @@ -114,8 +114,8 @@ typedef U16 line_t; #ifndef lint #ifndef LEAKTEST #ifndef safemalloc -char *safemalloc _((MEM_SIZE)); -char *saferealloc _((char *, MEM_SIZE)); +Malloc_t safemalloc _((MEM_SIZE)); +Malloc_t saferealloc _((char *, MEM_SIZE)); void safefree _((char *)); #endif #ifndef MSDOS diff --git a/x2p/util.c b/x2p/util.c index 225812add1..a7fdaea35d 100644 --- a/x2p/util.c +++ b/x2p/util.c @@ -20,14 +20,14 @@ static char nomem[] = "Out of memory!\n"; /* paranoid version of malloc */ -char * +Malloc_t safemalloc(size) MEM_SIZE size; { char *ptr; - char *malloc(); + Malloc_t malloc(); - ptr = malloc(size?size:1); /* malloc(0) is NASTY on our system */ + ptr = (char *) malloc(size?size:1); /* malloc(0) is NASTY on our system */ #ifdef DEBUGGING if (debug & 128) fprintf(stderr,"0x%x: (%05d) malloc %d bytes\n",ptr,an++,size); @@ -43,15 +43,16 @@ MEM_SIZE size; /* paranoid version of realloc */ -char * +Malloc_t saferealloc(where,size) char *where; MEM_SIZE size; { char *ptr; - char *realloc(); + Malloc_t realloc(); - ptr = realloc(where,size?size:1); /* realloc(0) is NASTY on our system */ + ptr = (char *) + realloc(where,size?size:1); /* realloc(0) is NASTY on our system */ #ifdef DEBUGGING if (debug & 128) { fprintf(stderr,"0x%x: (%05d) rfree\n",where,an++); diff --git a/x2p/walk.c b/x2p/walk.c index e4cca450ee..fb738756ba 100644 --- a/x2p/walk.c +++ b/x2p/walk.c @@ -1765,7 +1765,7 @@ int *numericptr; prewalk(0,level,ops[node+2].ival,&numarg); prewalk(0,level,ops[node+1].ival,&numarg); prewalk(0,level,ops[node+3].ival,&numarg); - if (numarg || strlen(ops[ops[node+1].ival+1].cval) > 1) { + if (numarg || strlen(ops[ops[node+1].ival+1].cval) > (Size_t)1) { numericize(ops[node+2].ival); if (!numarg) numericize(ops[node+3].ival); |