Skip to content

Commit

Permalink
add logic to detect one version of lapack at one location, and nclude…
Browse files Browse the repository at this point in the history
… it in the build. No calls to it yet
  • Loading branch information
Whiteknight committed Aug 22, 2010
1 parent 4e23a2f commit c20761a
Showing 1 changed file with 29 additions and 4 deletions.
33 changes: 29 additions & 4 deletions setup.nqp
Expand Up @@ -29,7 +29,8 @@ sub MAIN(@argv) {
}
if $mode eq "build" {
probe_for_cblas(%PLA);
system_linker_settings(%PLA);
find_blas(%PLA);
find_lapack(%PLA);
}
if $mode eq "test" {
run_test_harness(%PLA);
Expand All @@ -56,13 +57,12 @@ sub probe_for_cblas(%PLA) {
}
}

sub system_linker_settings(%PLA) {
%PLA{'dynpmc_cflags'} := '-g -Isrc/include/';
sub find_blas(%PLA) {
my %config := get_config();
my $osname := %config{'osname'};
if $osname eq 'linux' {
my %searches;
%searches{'/usr/lib/libblas.so'} := '-lblas';
%searches{'/usr/lib/libblas.so'} := ' -lblas';
%searches{'/usr/lib/atlas/libcblas.so'} := '-L/usr/lib/atlas -lcblas';
for %searches {
my $searchloc := $_;
Expand All @@ -82,6 +82,30 @@ sub system_linker_settings(%PLA) {
}
}

sub find_lapack(%PLA) {
my %config := get_config();
my $osname := %config{'osname'};
if $osname eq 'linux' {
my %searches;
%searches{'/usr/lib/liblapack-3.so'} := ' -llapack-3';
for %searches {
my $searchloc := $_;
my $test_ldd := pir::spawnw__IS('ldd ' ~ $searchloc);
if $test_ldd == 0 {
my $flags := %PLA{'dynpmc_ldflags'};
my $libflags := %searches{$searchloc};
$flags := ~$flags ~ $libflags;
%PLA{'dynpmc_ldflags'} := $flags;
return;
}
}
}
else {
pir::say("Only Linux is currently supported");
pir::exit(1);
}
}

sub run_test_harness(%PLA) {
my $nqp := get_nqp();
my $result := pir::spawnw__IS($nqp ~ " t/harness");
Expand Down Expand Up @@ -142,6 +166,7 @@ sub clean_c_library_files(*%kv) {
}

sub setup_dynpmc(%PLA) {
%PLA{'dynpmc_cflags'} := '-g -Isrc/include/';
%PLA{'dynpmc'}{'linalg_group'} := <
src/pmc/nummatrix2d.pmc
src/pmc/pmcmatrix2d.pmc
Expand Down

0 comments on commit c20761a

Please sign in to comment.