Make 25-test_gen.t and 25-test_req.t into one
[openssl.git] / Configure
index 826e88280a788344fff67a04afc764e72f6e585f..e8fc933872607ef7f9ef930aaa17df5f7747e1b0 100755 (executable)
--- a/Configure
+++ b/Configure
@@ -14,7 +14,7 @@ use strict;
 use File::Basename;
 use File::Spec::Functions qw/:DEFAULT abs2rel rel2abs/;
 use File::Path qw/mkpath/;
-use IPC::Cmd qw/can_run/;
+use if $^O ne "VMS", 'File::Glob' => qw/glob/;
 
 # see INSTALL for instructions.
 
@@ -211,7 +211,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 +224,7 @@ if (defined $ENV{$local_config_envname}) {
         $pattern = catfile($ENV{$local_config_envname}, '*.conf');
     }
 
-    foreach (sort glob($pattern) ) {
+    foreach (sort glob($pattern)) {
         &read_config($_);
     }
 }
@@ -378,6 +378,7 @@ our %disabled = ( # "what"         => "comment"
                  "zlib"                => "default",
                  "zlib-dynamic"        => "default",
                  "crypto-mdebug"       => "default",
+                 "crypto-mdebug-backtrace" => "default",
                  "heartbeats"          => "default",
                );
 
@@ -912,7 +913,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";
@@ -1157,7 +1158,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};
 }
 
@@ -1731,13 +1732,6 @@ EOF
         }
     }
 
-    ### Add information about files generated by Configure
-    foreach (map { abs2rel($_) } @generated_headers) {
-        die "Configure gerenerated header file $_ has a GENERATE in a build.info\n"
-            if $unified_info{generate}->{$_};
-        $unified_info{generate}->{$_} = "Generated by Configure";
-    }
-
     ### Make unified_info a bit more efficient
     # One level structures
     foreach (("programs", "libraries", "engines", "scripts", "extra", "overrides")) {
@@ -1976,8 +1970,6 @@ my %builders = (
     unixmake => sub {
         build_Makefile();
 
-        run_dofile("util/domd", "util/domd.in");
-        chmod 0755, "util/domd";
     },
     );
 
@@ -2339,13 +2331,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