Skip to content

Commit 5f7e12a

Browse files
committed
macos use Homebrew lapack if got
1 parent 221ba23 commit 5f7e12a

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

Makefile.PL

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ my @pkgs = qw(lapack blas);
1111
our $libs0 = (
1212
eval {require PkgConfig; join ' ', map PkgConfig->find($_)->get_ldflags, @pkgs} ||
1313
eval {require ExtUtils::PkgConfig; join ' ', map ExtUtils::PkgConfig->libs($_), @pkgs} ||
14+
find_macos_libs() ||
1415
find_libs() ||
1516
`pkg-config @pkgs --libs` ||
1617
'-L/usr/lib/atlas -llapack -lblas -latlas'
@@ -80,7 +81,6 @@ WriteMakefile(
8081
8182
sub find_libs {
8283
return if $^O !~ /linux/i;
83-
8484
# in performance order based on libraries I've used
8585
# for xnec2c in Ubuntu, Debian, SuSE, CentOS, etc.
8686
# See comments here for detail:
@@ -93,14 +93,20 @@ sub find_libs {
9393
openblas
9494
openblas_serial
9595
mkl_rt/;
96-
9796
for my $l (@libs) {
9897
return "-l$l" if (check_lib(lib => $l));
9998
}
100-
10199
return;
102100
}
103101
102+
sub find_macos_libs {
103+
return if $^O ne 'darwin';
104+
my $pref = `brew --prefix lapack`;
105+
return if !$pref;
106+
chomp $pref;
107+
qq{-L"$pref/lib" -llapack -lblas};
108+
}
109+
104110
sub MY::postamble {
105111
my $oneliner = PDL::Core::Dev::_oneliner(qq{exit if \$ENV{DESTDIR}; use PDL::Doc; eval { PDL::Doc::add_module(shift); }});
106112
qq|\ninstall :: pure_install\n\t$oneliner \$(NAME)\n|;

0 commit comments

Comments
 (0)