4 if(defined $ENV{'OPENSSL_ROOT_DIR'}) {
8 if (-d "$ENV{'OPENSSL_ROOT_DIR'}/apps") {
9 # The OpenSSL root dir is an OpenSSL build tree
10 $openssl_bindir = "$ENV{'OPENSSL_ROOT_DIR'}/apps";
11 $openssl_libdir = "$ENV{'OPENSSL_ROOT_DIR'}";
13 # The OpenSSL root dir is an OpenSSL installation tree
14 # Since we're not exactly sure what the library path is (because
15 # multilib), we ask pkg-config
16 local $ENV{PKG_CONFIG_PATH} = "$ENV{'OPENSSL_ROOT_DIR'}/lib/pkgconfig";
17 my $pkgans = `pkg-config --libs-only-L openssl`;
19 # If pkg-config failed for any reason, abort. The tests will most
20 # likely fail anyway because the binary path won't have a matching
22 die "pkg-config failure: $! (exit code ", $? >> 8, ", signal ", $? & 0xff, ")"
25 $pkgans =~ s|\R$||; # Better chomp
26 $pkgans =~ s|^-L||; # Remove flag from answer
28 $openssl_libdir = $pkgans;
29 $openssl_bindir = "$ENV{'OPENSSL_ROOT_DIR'}/bin";
32 # Variants of library paths
34 $ENV{'LD_LIBRARY_PATH'} =
35 join(':', $openssl_libdir, split(/:/, $ENV{'LD_LIBRARY_PATH'}));
37 $ENV{'DYLD_LIBRARY_PATH'} =
38 join(':', $openssl_libdir, split(/:/, $ENV{'DYLD_LIBRARY_PATH'}));
41 join(':', $openssl_libdir, split(/:/, $ENV{'LIBPATH'}));
43 # Binary path, works on all Unix-like platforms
45 join(':', $openssl_bindir, split(/:/, $ENV{'PATH'}));
47 my $harness = TAP::Harness->new({
48 verbosity => (($ENV{CTEST_INTERACTIVE_DEBUG_MODE} // 0) != 0)
50 exit ($harness->runtests(glob("*.t"))->all_passed() ? 0 : 1);