summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xConfigure56
-rw-r--r--Makefile.SH92
-rwxr-xr-xcflags.SH7
-rwxr-xr-xconfigpm16
-rw-r--r--ext/util/make_ext9
-rw-r--r--lib/AutoSplit.pm2
-rwxr-xr-xmakedepend.SH51
-rw-r--r--pod/pod2html.PL11
-rw-r--r--pod/pod2latex.PL10
-rw-r--r--pod/pod2man.PL10
-rw-r--r--pod/pod2text.PL8
-rw-r--r--pod/pod2usage.PL10
-rw-r--r--pod/podchecker.PL10
-rw-r--r--pod/podselect.PL10
-rw-r--r--writemain.SH3
-rwxr-xr-xx2p/Makefile.SH14
-rwxr-xr-xx2p/cflags.SH2
17 files changed, 204 insertions, 117 deletions
diff --git a/Configure b/Configure
index 240154ff36..654312f3f5 100755
--- a/Configure
+++ b/Configure
@@ -20,7 +20,7 @@
# $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
#
-# Generated on Sun Jul 25 13:48:34 EET DST 1999 [metaconfig 3.0 PL70]
+# Generated on Sun Jul 25 14:54:07 EET DST 1999 [metaconfig 3.0 PL70]
# (with additional metaconfig patches by perlbug@perl.com)
cat >/tmp/c1$$ <<EOF
@@ -1296,7 +1296,12 @@ esac
: Find the path to the source tree
case "$src" in
'') case "$0" in
- */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`;;
+ */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
+ case "$src" in
+ /*) ;;
+ *) src=`cd ../$src && pwd` ;;
+ esac
+ ;;
*) src='.';;
esac;;
esac
@@ -2784,6 +2789,9 @@ exp_file=''
nopath_ok=''
orig_rp="$rp"
orig_dflt="$dflt"
+case "$gfpth" in
+'') gfpth='.' ;;
+esac
case "$fn" in
*\(*)
@@ -2910,18 +2918,38 @@ while test "$type"; do
'')
case "$type" in
File)
- if test -f "$ansexp"; then
- type=''
- elif test -r "$ansexp" || (test -h "$ansexp") >/dev/null 2>&1
- then
- echo "($value is not a plain file, but that's ok.)"
- type=''
- fi
+ for fp in $gfpth; do
+ if test "X$fp" = X.; then
+ pf="$ansexp"
+ else
+ pf="$fp/$ansexp"
+ fi
+ if test -f "$pf"; then
+ type=''
+ elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
+ then
+ echo "($value is not a plain file, but that's ok.)"
+ type=''
+ fi
+ if test X"$type" = X; then
+ value="$pf"
+ break
+ fi
+ done
;;
Directory)
- if test -d "$ansexp"; then
- type=''
- fi
+ for fp in $gfpth; do
+ if test "X$fp" = X.; then
+ pf="$ansexp"
+ else
+ pf="$fp/$ansexp"
+ fi
+ if test -d "$pf"; then
+ type=''
+ value="$pf"
+ break
+ fi
+ done
;;
Locate)
if test -d "$ansexp"; then
@@ -2975,6 +3003,7 @@ ans="$value"
rp="$orig_rp"
dflt="$orig_dflt"
rm -f getfile.ok
+test "X$gfpthkeep" != Xy && gfpth=""
EOSC
: determine root of directory hierarchy where package will be installed.
@@ -5169,8 +5198,7 @@ y*) usedl="$define"
tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
rp="Source file to use for dynamic loading"
fn="fne"
- # XXX This getfile call will fail the existence check if you try
- # building away from $src (this is not supported yet).
+ gfpth="$src"
. ./getfile
usedl="$define"
: emulate basename
diff --git a/Makefile.SH b/Makefile.SH
index 79953c7709..8afaae4a33 100644
--- a/Makefile.SH
+++ b/Makefile.SH
@@ -194,7 +194,22 @@ SHELL = $sh
# how to tr(anslate) newlines
TRNL = '$trnl'
+# this is where the sources are
+src = $src
+# this is src quoted for use in regexen
+srcqre = `echo $src|sed -e 's@^\.$@\\\.@' -e 's@^\./$@\\\./@' -e 's@^\.\./@\\\.\\\./@g`
+
+# nice makes grok this
+!GROK!THIS!
+if $test X. != X$src; then
+$spitshell >>Makefile <<!GROK!THIS!
+VPATH = .:$src
+!GROK!THIS!
+else
+$spitshell >>Makefile <<!GROK!THIS!
+VPATH = .
!GROK!THIS!
+fi
## In the following dollars and backticks do not need the extra backslash.
$spitshell >>Makefile <<'!NO!SUBS!'
@@ -281,12 +296,12 @@ utilities: miniperl lib/Config.pm FORCE
FORCE:
@sh -c true
-miniperlmain$(OBJ_EXT): miniperlmain.c
+miniperlmain$(OBJ_EXT): $(src)/miniperlmain.c
$(CCCMD) $(PLDLFLAGS) $*.c
-perlmain.c: miniperlmain.c config.sh $(FIRSTMAKEFILE)
+perlmain.c: $(src)/miniperlmain.c config.sh $(FIRSTMAKEFILE)
sh writemain $(DYNALOADER) $(static_ext) > writemain.tmp
- sh mv-if-diff writemain.tmp perlmain.c
+ sh $(src)/mv-if-diff writemain.tmp perlmain.c
perlmain$(OBJ_EXT): perlmain.c
$(CCCMD) $(PLDLFLAGS) $*.c
@@ -406,7 +421,7 @@ $(LIBPERL): $& perl$(OBJ_EXT) $(obj) $(LIBPERLEXPORT)
miniperl: $& miniperlmain$(OBJ_EXT) $(LIBPERL)
$(LDLIBPTH) $(CC) $(LARGE) $(CLDFLAGS) -o miniperl miniperlmain$(OBJ_EXT) $(LLIBPERL) $(libs)
- $(LDLIBPTH) ./miniperl -w -Ilib -MExporter -e 0 || $(MAKE) minitest
+ $(LDLIBPTH) ./miniperl -w -Ilib -I$(src)/lib -MExporter -e 0 || $(MAKE) minitest
perl: $& perlmain$(OBJ_EXT) $(LIBPERL) $(DYNALOADER) $(static_ext) ext.libs $(PERLEXPORT)
$(SHRPENV) $(LDLIBPTH) $(CC) $(LARGE) $(CLDFLAGS) $(CCDLFLAGS) -o perl perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs)
@@ -440,32 +455,41 @@ sperl$(OBJ_EXT): perl.c perly.h patchlevel.h $(h)
$(CCCMD) -DIAMSUID sperl.c
$(RMS) sperl.c
+lib:
+ @sh ./makedir lib
+
# We have to call our ./makedir because Ultrix 4.3 make can't handle the line
# test -d lib/auto || mkdir lib/auto
#
preplibrary: miniperl lib/Config.pm $(plextract)
@sh ./makedir lib/auto
@echo " AutoSplitting perl library"
- $(LDLIBPTH) ./miniperl -Ilib -e 'use AutoSplit; \
- autosplit_lib_modules(@ARGV)' lib/*.pm lib/*/*.pm
+ $(LDLIBPTH) ./miniperl -Ilib -I$(src)/lib -e 'use AutoSplit; \
+ autosplit_lib_modules(@ARGV)' $(src)/lib/*.pm $(src)/lib/*/*.pm
# Take care to avoid modifying lib/Config.pm without reason
# (If trying to create a new port and having problems with the configpm script,
# try 'make minitest' and/or commenting out the tests at the end of configpm.)
-lib/Config.pm: config.sh miniperl configpm
+lib/Config.pm: lib config.sh miniperl configpm
$(LDLIBPTH) ./miniperl configpm configpm.tmp
- sh mv-if-diff configpm.tmp $@
+ sh $(src)/mv-if-diff configpm.tmp $@
+
+lib/ExtUtils: lib
+ @sh ./makedir lib/ExtUtils
-lib/ExtUtils/Miniperl.pm: miniperlmain.c miniperl minimod.pl lib/Config.pm
+lib/ExtUtils/Miniperl.pm: lib/ExtUtils miniperlmain.c miniperl minimod.pl lib/Config.pm
$(LDLIBPTH) ./miniperl minimod.pl > minimod.tmp
- sh mv-if-diff minimod.tmp $@
+ sh $(src)/mv-if-diff minimod.tmp $@
-lib/re.pm: ext/re/re.pm
+lib/re.pm: lib $(src)/ext/re/re.pm
rm -f $@
- cat ext/re/re.pm > $@
+ cat $(src)/ext/re/re.pm > $@
-$(plextract): miniperl lib/Config.pm lib/re.pm
- $(LDLIBPTH) ./miniperl -Ilib $@.PL
+pod:
+ @sh ./makedir pod
+
+$(plextract): pod miniperl lib/Config.pm lib/re.pm
+ $(LDLIBPTH) ./miniperl -Ilib -I$(src)/lib $(src)/$@.PL
install: all install.perl install.man
@@ -514,13 +538,23 @@ run_byacc: FORCE
chmod 664 vms/perly_c.vms vms/perly_h.vms
perl vms/vms_yfix.pl perly.c perly.h vms/perly_c.vms vms/perly_h.vms
+perly$(OBJ_EXT): $(src)/perly.c
+ $(CCCMD) $(PLDLFLAGS) $(src)/perly.c
+
# We don't want to regenerate perly.c and perly.h, but they might
# appear out-of-date after a patch is applied or a new distribution is
# made.
-perly.c: perly.y
+perly.c: $(src)/perly.y
+ -@sh -c true
+
+perly.h: $(src)/perly.y
+ -@sh -c true
+
+# Both the above and below are needed for an out-of-source experience.
+$(src)/perly.c: $(src)/perly.y
-@sh -c true
-perly.h: perly.y
+$(src)/perly.h: $(src)/perly.y
-@sh -c true
# No compat3.sym here since and including the 5.004_50.
@@ -564,16 +598,16 @@ regen_headers: FORCE
# DynaLoader may be needed for extensions that use Makefile.PL.
$(DYNALOADER): miniperl preplibrary FORCE
- @$(LDLIBPTH) sh ext/util/make_ext static $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL)
+ @$(LDLIBPTH) sh $(src)/ext/util/make_ext static $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL)
d_dummy $(dynamic_ext): miniperl preplibrary $(DYNALOADER) FORCE
- @$(LDLIBPTH) sh ext/util/make_ext dynamic $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL)
+ @$(LDLIBPTH) sh $(src)/ext/util/make_ext dynamic $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL)
s_dummy $(static_ext): miniperl preplibrary $(DYNALOADER) FORCE
- @$(LDLIBPTH) sh ext/util/make_ext static $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL)
+ @$(LDLIBPTH) sh $(src)/ext/util/make_ext static $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL)
n_dummy $(nonxs_ext): miniperl preplibrary $(DYNALOADER) FORCE
- @$(LDLIBPTH) sh ext/util/make_ext nonxs $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL)
+ @$(LDLIBPTH) sh $(src)/ext/util/make_ext nonxs $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL)
clean: _tidy _mopup
@@ -650,8 +684,8 @@ depend: makedepend
cd x2p; $(MAKE) depend
# Cannot postpone this until $firstmakefile is ready ;-)
-makedepend: makedepend.SH config.sh
- sh ./makedepend.SH
+makedepend: $(src)/makedepend.SH config.sh
+ sh $(src)/makedepend.SH
# Cannot delegate rebuilding of t/perl to make to allow interlaced
# test and minitest
@@ -691,25 +725,25 @@ minitest: miniperl lib/re.pm
# Please *don't* use this unless all tests pass.
# If you want to report test failures, use "make nok" instead.
ok: utilities
- $(LDLIBPTH) ./perl -Ilib utils/perlbug -ok -s '(UNINSTALLED)'
+ $(LDLIBPTH) ./perl -Ilib -I$(src)/lib utils/perlbug -ok -s '(UNINSTALLED)'
okfile: utilities
- $(LDLIBPTH) ./perl -Ilib utils/perlbug -ok -s '(UNINSTALLED)' -F perl.ok
+ $(LDLIBPTH) ./perl -Ilib -I$(src)/lib utils/perlbug -ok -s '(UNINSTALLED)' -F perl.ok
nok: utilities
- $(LDLIBPTH) ./perl -Ilib utils/perlbug -nok -s '(UNINSTALLED)'
+ $(LDLIBPTH) ./perl -Ilib -I$(src)/lib utils/perlbug -nok -s '(UNINSTALLED)'
clist: $(c)
- echo $(c) | tr ' ' $(TRNL) >.clist
+ echo $(c) | tr ' ' $(TRNL) | sed -e "s@^$(srcqre)/@@" >.clist
hlist: $(h)
- echo $(h) | tr ' ' $(TRNL) >.hlist
+ echo $(h) | tr ' ' $(TRNL) | sed -e "s@^$(srcqre)/@@" >.hlist
shlist: $(sh)
- echo $(sh) | tr ' ' $(TRNL) >.shlist
+ echo $(sh) | tr ' ' $(TRNL) | sed -e "s@^$(srcqre)/@@" >.shlist
pllist: $(pl)
- echo $(pl) | tr ' ' $(TRNL) >.pllist
+ echo $(pl) | tr ' ' $(TRNL) | sed -e "s@^$(srcqre)/@@" >.pllist
Makefile: Makefile.SH ./config.sh
$(SHELL) Makefile.SH
diff --git a/cflags.SH b/cflags.SH
index 715680eecb..2aed681697 100755
--- a/cflags.SH
+++ b/cflags.SH
@@ -24,6 +24,7 @@ echo "Extracting cflags (with variable substitutions)"
rm -f cflags
$spitshell >cflags <<!GROK!THIS!
$startsh
+src=$src
!GROK!THIS!
: In the following dollars and backticks do not need the extra backslash.
@@ -74,6 +75,12 @@ for file do
*) echo $n " $file.c $c" ;;
esac
+ : allow for out-of-source experience
+
+ if test "X$src" != X.; then
+ ccflags="$ccflags -I$src -I."
+ fi
+
: allow variables like toke_cflags to be evaluated
if echo $file | grep -v / >/dev/null
diff --git a/configpm b/configpm
index dd9e85803d..ac7f3aaec9 100755
--- a/configpm
+++ b/configpm
@@ -1,7 +1,15 @@
#!./miniperl -w
+# File::Spec?
my $config_pm = $ARGV[0] || 'lib/Config.pm';
-my $glossary = $ARGV[1] || 'Porting/Glossary';
+my $src = '.';
+# File::Dirname? File::Spec?
+if ($0 =~ m!^(?:(.+)/)configpm$!) {
+ $src = $1;
+ unshift @INC, "$1/lib";
+}
+# File::Spec?
+my $glossary = $ARGV[1] || "$src/Porting/Glossary";
@ARGV = "./config.sh";
# list names to put first (and hence lookup fastest)
@@ -85,7 +93,11 @@ print CONFIG "\n",
print CONFIG "my \$summary = <<'!END!';\n";
-open(MYCONFIG,"<myconfig.SH") || die "open myconfig.SH failed: $!";
+# File::Spec?
+my $myconfigdotSH =
+ $src eq "." ? "myconfig.SH" : "$src/myconfig.SH";
+
+open(MYCONFIG,"<$myconfigdotSH") || die "open $myconfigdotSH failed: $!";
1 while defined($_ = <MYCONFIG>) && !/^Summary of/;
do { print CONFIG $_ } until !defined($_ = <MYCONFIG>) || /^\s*$/;
close(MYCONFIG);
diff --git a/ext/util/make_ext b/ext/util/make_ext
index 54caf7dfd8..9afbbcccbb 100644
--- a/ext/util/make_ext
+++ b/ext/util/make_ext
@@ -75,7 +75,7 @@ makefile=Makefile
makeargs=''
makeopts=''
-if test ! -d "ext/$pname"; then
+if test ! -d "$src/ext/$pname"; then
echo " Skipping $extspec (directory does not exist)"
exit 0 # not an error ?
fi
@@ -83,6 +83,11 @@ fi
echo " Making $mname ($target)"
+mkdir ext 2>/dev/null
+mkdir ext/$pname 2>/dev/null
+if test ! -f ext/$pname/Makefile.PL; then
+ cat $src/ext/$pname/Makefile.PL > ext/$pname/Makefile.PL
+fi
cd ext/$pname
# check link type and do any preliminaries
@@ -116,7 +121,7 @@ nonxs) makeargs="";
esac
if test ! -f $makefile ; then
- test -f Makefile.PL && ../$depth/miniperl -I../$depth/lib Makefile.PL INSTALLDIRS=perl $passthru
+ test -f Makefile.PL && ../$depth/miniperl -I../$depth/lib -I$src/lib Makefile.PL INSTALLDIRS=perl $passthru
fi
if test ! -f $makefile ; then
if test -f Makefile.SH; then
diff --git a/lib/AutoSplit.pm b/lib/AutoSplit.pm
index 33c0b9a03d..eaa0691093 100644
--- a/lib/AutoSplit.pm
+++ b/lib/AutoSplit.pm
@@ -176,7 +176,7 @@ sub autosplit_lib_modules{
$dir =~ s#[\.\]]#/#g;
$_ = $dir . $name;
}
- autosplit_file("lib/$_", "lib/auto",
+ autosplit_file("$_", "lib/auto",
$Keep, $CheckForAutoloader, $CheckModTime);
}
0;
diff --git a/makedepend.SH b/makedepend.SH
index e1c28468bd..e26c50e09f 100755
--- a/makedepend.SH
+++ b/makedepend.SH
@@ -26,13 +26,14 @@ $startsh
#
MAKE=$make
trnl='$trnl'
+src=$src
!GROK!THIS!
$spitshell >>makedepend <<'!NO!SUBS!'
# This script should be called with
-# sh ./makedepend MAKE=$(MAKE)
+# sh ./makedepend MAKE=$(MAKE) [src=$(src)]
case "$1" in
- MAKE=*) eval $1 ;;
+ MAKE=*) eval $1 ; shift ;;
esac
export PATH || (echo "OOPS, this isn't sh. Desperation time. I will feed myself to sh."; sh \$0; kill \$\$)
@@ -51,6 +52,10 @@ case $CONFIGDOTSH in
;;
esac
+case "$1" in
+ src=*) eval $1 ; shift ;;
+esac
+
# We need .. when we are in the x2p directory if we are using the
# cppstdin wrapper script.
# Put .. and . first so that we pick up the present cppstdin, not
@@ -95,9 +100,18 @@ esac
: might be identical
$test -d UU || mkdir UU
-$MAKE clist || ($echo "Searching for .c files..."; \
- $echo *.c | $tr ' ' $trnl | $egrep -v '\*' >.clist)
-for file in `$cat .clist`; do
+$MAKE clist || (cd $src; $echo "Searching for .c files..."; \
+ $echo *.c | $tr ' ' $trnl | $egrep -v '\*') >.clist
+for base in `$cat .clist`; do
+ case "$src" in
+ .) file="$base" ;;
+ *) if test -f "$base"; then
+ file="$base"
+ elif test -f "$src/$base"; then
+ file="$src/$base"
+ fi
+ ;;
+ esac
# for file in `cat /dev/null`; do
if [ "$osname" = uwin ]; then
uwinfix="-e s,\\\\\\\\,/,g -e s,\\([a-zA-Z]\\):/,/\\1/,g"
@@ -113,14 +127,15 @@ for file in `$cat .clist`; do
fi
fi
case "$file" in
- *.c) filebase=`basename $file .c` ;;
- *.y) filebase=`basename $file .y` ;;
- esac
- case "$file" in
*/*) finc="-I`echo $file | sed 's#/[^/]*$##`" ;;
*) finc= ;;
esac
- $echo "Finding dependencies for $filebase$_o."
+ case "$src" in
+ '') ;;
+ *) finc="-I$src" ;;
+ esac
+ basebase=`basename $base .c`
+ $echo "Finding dependencies for $basebase$_o."
( $echo "#line 1 \"$file\""; \
$sed -n <$file \
-e "/^${filebase}_init(/q" \
@@ -129,16 +144,16 @@ for file in `$cat .clist`; do
-e 's|/\*.*$||' \
-e 's|\\$||' \
-e p \
- -e '}' ) >UU/$file.c
- $cppstdin $finc -I. $cppflags $cppminus <UU/$file.c |
+ -e '}' ) >UU/$base.c
+ $cppstdin $finc -I. $cppflags $cppminus <UU/$base.c |
$sed \
-e '/^#.*<stdin>/d' \
-e '/^#.*"-"/d' \
-e 's#\.[0-9][0-9]*\.c#'"$file.c#" \
-e 's/^[ ]*#[ ]*line/#/' \
-e '/^# *[0-9][0-9]* *[".\/]/!d' \
- -e 's/^.*"\(.*\)".*$/'$filebase'\$(OBJ_EXT): \1/' \
- -e 's/^# *[0-9][0-9]* \(.*\)$/'$filebase'\$(OBJ_EXT): \1/' \
+ -e 's/^.*"\(.*\)".*$/'$base'\$(OBJ_EXT): \1/' \
+ -e 's/^# *[0-9][0-9]* \(.*\)$/'$base'\$(OBJ_EXT): \1/' \
-e 's|: \./|: |' \
-e 's|\.c\.c|.c|' $uwinfix | \
$uniq | $sort | $uniq >> .deptmp
@@ -146,8 +161,8 @@ done
$sed <$mf >$mf.new -e '1,/^# AUTOMATICALLY/!d'
-$MAKE shlist || ($echo "Searching for .SH files..."; \
- $echo *.SH | $tr ' ' $trnl | $egrep -v '\*' >.shlist)
+$MAKE shlist || (cd $src; $echo "Searching for .SH files..."; \
+ $echo *.SH | $tr ' ' $trnl | $egrep -v '\*') >.shlist
# Now extract the dependencies on makedepend.SH and Makefile.SH
# (they should reside in the main Makefile):
@@ -176,8 +191,8 @@ if $test -s .deptmp; then
$sed 's|^\(.*\$(OBJ_EXT):\) *\(.*/.*\.c\) *$|\1 \2; '"$defrule \2|" .deptmp \
>>$mf.new
else
- $MAKE hlist || ($echo "Searching for .h files..."; \
- $echo *.h | $tr ' ' $trnl | $egrep -v '\*' >.hlist)
+ $MAKE hlist || (cd $src; $echo "Searching for .h files..."; \
+ $echo *.h | $tr ' ' $trnl | $egrep -v '\*') >.hlist
$echo "You don't seem to have a proper C preprocessor. Using grep instead."
$egrep '^#include ' `cat .clist` `cat .hlist` >.deptmp
$echo "Updating $mf..."
diff --git a/pod/pod2html.PL b/pod/pod2html.PL
index 366dc163bf..746e101e49 100644
--- a/pod/pod2html.PL
+++ b/pod/pod2html.PL
@@ -2,7 +2,6 @@
use Config;
use File::Basename qw(&basename &dirname);
-use Cwd;
# List explicitly here the variables you want Configure to
# generate. Metaconfig only looks for shell variables, so you
@@ -11,13 +10,11 @@ use Cwd;
# $startperl
# to ensure Configure will look for $Config{startperl}.
-# This forces PL files to create target in same directory as PL file.
-# This is so that make depend always knows where to find PL derivatives.
-$origdir = cwd;
-chdir dirname($0);
-$file = basename($0, '.PL');
+$file = basename($0);
+$file =~ s/\.PL$//i;
$file .= '.com' if $^O eq 'VMS';
+chdir("pod") or die "Can't chdir to pod: $!";
open OUT,">$file" or die "Can't create $file: $!";
print "Extracting $file (with variable substitutions)\n";
@@ -180,4 +177,4 @@ pod2html @ARGV;
close OUT or die "Can't close $file: $!";
chmod 0755, $file or die "Can't reset permissions for $file: $!\n";
exec("$Config{'eunicefix'} $file") if $Config{'eunicefix'} ne ':';
-chdir $origdir;
+
diff --git a/pod/pod2latex.PL b/pod/pod2latex.PL
index feed98e923..01cdf1bd76 100644
--- a/pod/pod2latex.PL
+++ b/pod/pod2latex.PL
@@ -2,7 +2,6 @@
use Config;
use File::Basename qw(&basename &dirname);
-use Cwd;
# List explicitly here the variables you want Configure to
# generate. Metaconfig only looks for shell variables, so you
@@ -11,13 +10,11 @@ use Cwd;
# $startperl
# to ensure Configure will look for $Config{startperl}.
-# This forces PL files to create target in same directory as PL file.
-# This is so that make depend always knows where to find PL derivatives.
-$origdir = cwd;
-chdir dirname($0);
-$file = basename($0, '.PL');
+$file = basename($0);
+$file =~ s/\.PL$//i;
$file .= '.com' if $^O eq 'VMS';
+chdir("pod") or die "Can't chdir to pod: $!";
open OUT,">$file" or die "Can't create $file: $!";
print "Extracting $file (with variable substitutions)\n";
@@ -705,4 +702,3 @@ BEGIN {
close OUT or die "Can't close $file: $!";
chmod 0755, $file or die "Can't reset permissions for $file: $!\n";
exec("$Config{'eunicefix'} $file") if $Config{'eunicefix'} ne ':';
-chdir $origdir;
diff --git a/pod/pod2man.PL b/pod/pod2man.PL
index 20610a84c3..37557bf560 100644
--- a/pod/pod2man.PL
+++ b/pod/pod2man.PL
@@ -2,7 +2,6 @@
use Config;
use File::Basename qw(&basename &dirname);
-use Cwd;
# List explicitly here the variables you want Configure to
# generate. Metaconfig only looks for shell variables, so you
@@ -12,13 +11,11 @@ use Cwd;
# $man3ext
# to ensure Configure will look for $Config{startperl}.
-# This forces PL files to create target in same directory as PL file.
-# This is so that make depend always knows where to find PL derivatives.
-$origdir = cwd;
-chdir dirname($0);
-$file = basename($0, '.PL');
+$file = basename($0);
+$file =~ s/\.PL$//i;
$file .= '.com' if $^O eq 'VMS';
+chdir("pod") or die "Can't chdir to pod: $!";
open OUT,">$file" or die "Can't create $file: $!";
print "Extracting $file (with variable substitutions)\n";
@@ -1234,4 +1231,3 @@ BEGIN {
close OUT or die "Can't close $file: $!";
chmod 0755, $file or die "Can't reset permissions for $file: $!\n";
exec("$Config{'eunicefix'} $file") if $Config{'eunicefix'} ne ':';
-chdir $origdir;
diff --git a/pod/pod2text.PL b/pod/pod2text.PL
index 94516c3997..a1a38751b8 100644
--- a/pod/pod2text.PL
+++ b/pod/pod2text.PL
@@ -2,7 +2,6 @@
use Config;
use File::Basename qw(&basename &dirname);
-use Cwd;
# List explicitly here the variables you want Configure to
# generate. Metaconfig only looks for shell variables, so you
@@ -11,13 +10,11 @@ use Cwd;
# $startperl
# to ensure Configure will look for $Config{startperl}.
-# This forces PL files to create target in same directory as PL file.
-# This is so that make depend always knows where to find PL derivatives.
-$origdir = cwd;
-chdir dirname($0);
+$file = basename($0);
$file = basename($0, '.PL');
$file .= '.com' if $^O eq 'VMS';
+chdir("pod") or die "Can't chdir to pod: $!";
open OUT,">$file" or die "Can't create $file: $!";
print "Extracting $file (with variable substitutions)\n";
@@ -48,4 +45,3 @@ if(@ARGV) {
close OUT or die "Can't close $file: $!";
chmod 0755, $file or die "Can't reset permissions for $file: $!\n";
exec("$Config{'eunicefix'} $file") if $Config{'eunicefix'} ne ':';
-chdir $origdir;
diff --git a/pod/pod2usage.PL b/pod/pod2usage.PL
index fdaa955c69..f534252e3e 100644
--- a/pod/pod2usage.PL
+++ b/pod/pod2usage.PL
@@ -10,13 +10,11 @@ use File::Basename qw(&basename &dirname);
# $startperl
# to ensure Configure will look for $Config{startperl}.
-# This forces PL files to create target in same directory as PL file.
-# This is so that make depend always knows where to find PL derivatives.
-chdir(dirname($0));
-($file = basename($0)) =~ s/\.PL$//;
-$file =~ s/\.pl$//
- if ($^O eq 'VMS' or $^O eq 'os2'); # "case-forgiving"
+$file = basename($0);
+$file =~ s/\.PL$//i;
+$file .= '.com' if $^O eq 'VMS';
+chdir("pod") or die "Can't chdir to pod: $!";
open OUT,">$file" or die "Can't create $file: $!";
print "Extracting $file (with variable substitutions)\n";
diff --git a/pod/podchecker.PL b/pod/podchecker.PL
index 1ca0d79eda..24dcfb88c2 100644
--- a/pod/podchecker.PL
+++ b/pod/podchecker.PL
@@ -10,13 +10,11 @@ use File::Basename qw(&basename &dirname);
# $startperl
# to ensure Configure will look for $Config{startperl}.
-# This forces PL files to create target in same directory as PL file.
-# This is so that make depend always knows where to find PL derivatives.
-chdir(dirname($0));
-($file = basename($0)) =~ s/\.PL$//;
-$file =~ s/\.pl$//
- if ($^O eq 'VMS' or $^O eq 'os2'); # "case-forgiving"
+$file = basename($0);
+$file =~ s/\.PL$//i;
+$file .= '.com' if $^O eq 'VMS';
+chdir("pod") or die "Can't chdir to pod: $!";
open OUT,">$file" or die "Can't create $file: $!";
print "Extracting $file (with variable substitutions)\n";
diff --git a/pod/podselect.PL b/pod/podselect.PL
index 0df830406e..7cff6915bb 100644
--- a/pod/podselect.PL
+++ b/pod/podselect.PL
@@ -10,13 +10,11 @@ use File::Basename qw(&basename &dirname);
# $startperl
# to ensure Configure will look for $Config{startperl}.
-# This forces PL files to create target in same directory as PL file.
-# This is so that make depend always knows where to find PL derivatives.
-chdir(dirname($0));
-($file = basename($0)) =~ s/\.PL$//;
-$file =~ s/\.pl$//
- if ($^O eq 'VMS' or $^O eq 'os2'); # "case-forgiving"
+$file = basename($0);
+$file =~ s/\.PL$//i;
+$file .= '.com' if $^O eq 'VMS';
+chdir("pod") or die "Can't chdir to pod: $!";
open OUT,">$file" or die "Can't create $file: $!";
print "Extracting $file (with variable substitutions)\n";
diff --git a/writemain.SH b/writemain.SH
index 18544c1f81..6c53602472 100644
--- a/writemain.SH
+++ b/writemain.SH
@@ -24,6 +24,7 @@ echo "Extracting writemain (with variable substitutions)"
rm -f writemain
$spitshell >writemain <<!GROK!THIS!
$startsh
+src=$src
!GROK!THIS!
: In the following dollars and backticks do not need the extra backslash.
@@ -55,7 +56,7 @@ for file in $orig ; do
done
-sed '/Do not delete this line--writemain depends on it/q' miniperlmain.c
+sed '/Do not delete this line--writemain depends on it/q' $src/miniperlmain.c
if test X"$args" != "X" ; then
diff --git a/x2p/Makefile.SH b/x2p/Makefile.SH
index 9c004cc778..6a179587fe 100755
--- a/x2p/Makefile.SH
+++ b/x2p/Makefile.SH
@@ -1,4 +1,4 @@
-case $CONFIG in
+case $CONFIGDOTSH in
'')
if test -f config.sh; then TOP=.;
elif test -f ../config.sh; then TOP=..;
@@ -63,6 +63,12 @@ TRNL = '$trnl'
.SUFFIXES: .c \$(OBJ_EXT)
+# this is where the sources are
+src = $src
+
+# nice makes grok this
+VPATH = .:$src
+
!GROK!THIS!
cat >>Makefile <<'!NO!SUBS!'
@@ -89,9 +95,9 @@ plm = a2p.loadmap
addedbyconf = $(shextract) $(plextract)
-h = EXTERN.h INTERN.h ../config.h ../handy.h hash.h a2p.h str.h util.h
+h = EXTERN.h INTERN.h ../config.h handy.h hash.h a2p.h str.h util.h
-c = hash.c $(mallocsrc) str.c util.c walk.c
+c = hash.c str.c util.c walk.c
obj = hash$(OBJ_EXT) $(mallocobj) str$(OBJ_EXT) util$(OBJ_EXT) walk$(OBJ_EXT)
@@ -147,7 +153,7 @@ lint:
lint $(lintflags) $(defs) $(c) > a2p.fuzz
depend: $(mallocsrc) ../makedepend
- sh ../makedepend MAKE=$(MAKE)
+ sh ../makedepend MAKE=$(MAKE) src=$(src)/x2p
clist:
echo $(c) | tr ' ' $(TRNL) >.clist
diff --git a/x2p/cflags.SH b/x2p/cflags.SH
index a58d7d564d..b5ef9170b9 100755
--- a/x2p/cflags.SH
+++ b/x2p/cflags.SH
@@ -1,4 +1,4 @@
-case $CONFIG in
+case $CONFIGDOTSH in
'')
if test -f config.sh; then TOP=.;
elif test -f ../config.sh; then TOP=..;