From: Max Maischein Date: Thu, 24 Sep 2009 20:18:07 +0000 (+0100) Subject: Make makedef.pl more robust X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=9d6c7f2eccef26a6d6eb46a8192949a88c6aaf8f;p=p5sagit%2Fp5-mst-13.2.git Make makedef.pl more robust --- diff --git a/makedef.pl b/makedef.pl index 1b3c2b5..65c2e28 100644 --- a/makedef.pl +++ b/makedef.pl @@ -34,6 +34,7 @@ BEGIN { unshift @INC, "lib" } +use Config; use strict; use vars qw($PLATFORM $CCTYPE $FILETYPE $CONFIG_ARGS $ARCHNAME $PATCHLEVEL); @@ -75,7 +76,13 @@ if ($PLATFORM eq 'win32' or $PLATFORM eq 'wince' or $PLATFORM eq "aix") { # the user might have chosen to disable because the canned configs are # minimal configs that don't include any of those options. my $opts = ($PLATFORM eq 'wince' ? '-MCross' : ''); # for wince need Cross.pm to get Config.pm - my $config = `$^X $opts -Ilib -V`; + + $ENV{PERL5LIB} = join $Config{path_sep}, @INC; + my $cmd = "$^X $opts -V"; + my $config = `$cmd`; + if (! $config) { + die "Couldn't run [$cmd]: $!"; + }; my($options) = $config =~ /^ Compile-time options: (.*?)\n^ \S/ms; $options =~ s/\s+/ /g; print STDERR "Options: ($options)\n";