X-Git-Url: https://git.openssl.org/?p=openssl.git;a=blobdiff_plain;f=Configure;h=9e58fc133a72ef6995ef148bce93737fd7178706;hp=20470a941ad3fa580a14214614a95bc588c8b56d;hb=888db7f224fec4ead34c32e82fa591dea61d14a2;hpb=223516eadcd6c896392f8915585a50934adb863d diff --git a/Configure b/Configure index 20470a941a..9e58fc133a 100755 --- a/Configure +++ b/Configure @@ -14,7 +14,9 @@ use strict; use File::Basename; use File::Spec::Functions qw/:DEFAULT abs2rel rel2abs/; use File::Path qw/mkpath/; -use IPC::Cmd qw/can_run/; +if ($^O ne "VMS") { + use File::Glob qw/glob/; +} # see INSTALL for instructions. @@ -211,7 +213,7 @@ die "erroneous version information in opensslv.h: ", # Collect target configurations my $pattern = catfile(dirname($0), "Configurations", "*.conf"); -foreach (sort glob($pattern) ) { +foreach (sort glob($pattern)) { &read_config($_); } @@ -224,7 +226,7 @@ if (defined $ENV{$local_config_envname}) { $pattern = catfile($ENV{$local_config_envname}, '*.conf'); } - foreach (sort glob($pattern) ) { + foreach (sort glob($pattern)) { &read_config($_); } } @@ -913,7 +915,7 @@ $config{cross_compile_prefix} = $ENV{'CROSS_COMPILE'} $config{perl} = $ENV{'PERL'} || ($^O ne "VMS" ? $^X : "perl"); $target{cc} = $ENV{'CC'} || $target{cc} || "cc"; $target{ranlib} = $ENV{'RANLIB'} || $target{ranlib} || - (scalar can_run("$config{cross_compile_prefix}ranlib") ? + (which("$config{cross_compile_prefix}ranlib") ? "\$(CROSS_COMPILE)ranlib" : "true"); $target{ar} = $ENV{'AR'} || $target{ar} || "ar"; $target{nm} = $ENV{'NM'} || $target{nm} || "nm"; @@ -1158,7 +1160,7 @@ if ($^O ne "VMS" && !$disabled{makedepend}) { } close(PIPE); - $config{makedepprog} = scalar can_run('makedepend') unless $config{makedepprog}; + $config{makedepprog} = which('makedepend') unless $config{makedepprog}; $disabled{makedepend} = "unavailable" unless $config{makedepprog}; } @@ -2333,13 +2335,34 @@ sub run_dofile foreach (@templates) { die "Can't open $_, $!" unless -f $_; } - my $cmd = "$config{perl} \"-I.\" \"-Mconfigdata\" $dofile -o\"Configure\" \"".join("\" \"",@templates)."\" > \"$out.new\""; + my $cmd = "$config{perl} \"-I.\" \"-Mconfigdata\" \"$dofile\" -o\"Configure\" \"".join("\" \"",@templates)."\" > \"$out.new\""; #print STDERR "DEBUG[run_dofile]: \$cmd = $cmd\n"; system($cmd); exit 1 if $? != 0; rename("$out.new", $out) || die "Can't rename $out.new, $!"; } +sub which +{ + my ($name)=@_; + + if (eval { require IPC::Cmd; 1; }) { + IPC::Cmd->import(); + return scalar IPC::Cmd::can_run($name); + } else { + # if there is $directories component in splitpath, + # then it's not something to test with $PATH... + return $name if (File::Spec->splitpath($name))[1]; + + foreach (File::Spec->path()) { + my $fullpath = catfile($_, "$name$target{exe_extension}"); + if (-f $fullpath and -x $fullpath) { + return $fullpath; + } + } + } +} + # Configuration printer ############################################## sub print_table_entry