summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Lecher <jlec@gentoo.org>2011-03-14 17:06:53 +0000
committerJustin Lecher <jlec@gentoo.org>2011-03-14 17:06:53 +0000
commitb3c8e08153b85111a643f32eab6e4f416349f4f5 (patch)
treea8646490757b6cefc587aa080912da9fd2a47b01 /sci-chemistry
parentUse pkg-config to detect BLAS/LAPAACK libs (diff)
downloadgentoo-2-b3c8e08153b85111a643f32eab6e4f416349f4f5.tar.gz
gentoo-2-b3c8e08153b85111a643f32eab6e4f416349f4f5.tar.bz2
gentoo-2-b3c8e08153b85111a643f32eab6e4f416349f4f5.zip
Use pkg-config to detect BLAS/LAPAACK libs
(Portage version: 2.2.0_alpha26/cvs/Linux x86_64, RepoMan options: --force)
Diffstat (limited to 'sci-chemistry')
-rw-r--r--sci-chemistry/ccp4-apps/ChangeLog10
-rw-r--r--sci-chemistry/ccp4-apps/ccp4-apps-6.1.3-r9.ebuild5
-rw-r--r--sci-chemistry/ccp4-apps/files/6.1.3-lapack.patch597
3 files changed, 610 insertions, 2 deletions
diff --git a/sci-chemistry/ccp4-apps/ChangeLog b/sci-chemistry/ccp4-apps/ChangeLog
index b72b6eac9251..837199428582 100644
--- a/sci-chemistry/ccp4-apps/ChangeLog
+++ b/sci-chemistry/ccp4-apps/ChangeLog
@@ -1,6 +1,14 @@
# ChangeLog for sci-chemistry/ccp4-apps
# Copyright 1999-2011 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/sci-chemistry/ccp4-apps/ChangeLog,v 1.24 2011/03/04 17:02:15 jlec Exp $
+# $Header: /var/cvsroot/gentoo-x86/sci-chemistry/ccp4-apps/ChangeLog,v 1.25 2011/03/14 17:06:53 jlec Exp $
+
+ 14 Mar 2011; Justin Lecher <jlec@gentoo.org> +files/6.1.3-lapack.patch,
+ ccp4-apps-6.1.3-r9.ebuild:
+ Use pkg-config to detect BLAS/LAPAACK libs
+
+ 14 Mar 2011; Justin Lecher <jlec@gentoo.org> +files/6.1.3-lapack.patch,
+ ccp4-apps-6.1.3-r9.ebuild:
+ Use pkg-config to detect BLAS/LAPAACK libs
*ccp4-apps-6.1.3-r9 (04 Mar 2011)
diff --git a/sci-chemistry/ccp4-apps/ccp4-apps-6.1.3-r9.ebuild b/sci-chemistry/ccp4-apps/ccp4-apps-6.1.3-r9.ebuild
index bf22bc2e8b95..520ad814532e 100644
--- a/sci-chemistry/ccp4-apps/ccp4-apps-6.1.3-r9.ebuild
+++ b/sci-chemistry/ccp4-apps/ccp4-apps-6.1.3-r9.ebuild
@@ -1,6 +1,6 @@
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/sci-chemistry/ccp4-apps/ccp4-apps-6.1.3-r9.ebuild,v 1.1 2011/03/04 17:02:15 jlec Exp $
+# $Header: /var/cvsroot/gentoo-x86/sci-chemistry/ccp4-apps/ccp4-apps-6.1.3-r9.ebuild,v 1.2 2011/03/14 17:06:53 jlec Exp $
EAPI="3"
@@ -156,6 +156,9 @@ src_prepare() {
# Not renaming, but unbundling libs
ccp_patch "${FILESDIR}"/${PV}-rename-rapper-ng.patch
+ # Use pkg-config to detect BLAS/LAPCK
+ ccp_patch "${FILESDIR}"/${PV}-lapack.patch
+
# Update things for oasis 4 usage
epatch "${WORKDIR}"/${PV}-oasis4.0.patch
sed 's: oasis : :g' -i src/Makefile.in || die
diff --git a/sci-chemistry/ccp4-apps/files/6.1.3-lapack.patch b/sci-chemistry/ccp4-apps/files/6.1.3-lapack.patch
new file mode 100644
index 000000000000..2514733f876d
--- /dev/null
+++ b/sci-chemistry/ccp4-apps/files/6.1.3-lapack.patch
@@ -0,0 +1,597 @@
+diff --git a/configure b/configure
+index 833f483..bcfa62d 100755
+--- a/configure
++++ b/configure
+@@ -3226,574 +3226,14 @@ else
+ echo
+ echo "Warning: this option has not been extensively tested!"
+ echo "Please report problems to ccp4@ccp4.ac.uk"
+- # Search for vendor LAPACK/BLAS first
+- if test ! "$with_netlib_lapack" ; then
+- # Initialise variables to blank
+- lapackdir=
+- XLAPACK_LIB=
+- # Possible directories to check for vendor or pre-existing LAPACK or
+- # BLAS - add to these if you want to test others
+- trydirs="`echo $LD_LIBRARY_PATH |sed -e s/:/\ /g` /lib /usr/lib /usr/local/lib"
+- # Possible library names
+- # These are the names like xxxx where the library will be libxxxx.a
+- # or libxxxx.so
+- echo
+- echo "Guessing names for native/vendor LAPACK and/or BLAS libraries"
+- echo "on this system"
+- case $system in
+- linux | linux64 | linux32 )
+- # linux users will usually have them in /usr/lib but don't call it
+- trylapack="lapack"
+- tryblas="blas"
+- # if code is non_shared then this can lead to problems. both blas and lapack
+- # need to be resolved even if they are not called!
+- if test "$non_shared" = yes; then
+- echo "You are compiling linux non_shared. This sometimes causes problems "
+- echo " so checking for requirements."
+- echo "Checking: try to link library against test program"
+- if test -f testlink.f || test -f testlink ; then
+- rm -f testlink*
+- fi
+- cat > testlink.f <<EOF
+- PROGRAM TESTLINK
+-C A bit of scala code to test the linking
+- real bf(3), bnorm
+-c
+- integer maxbmt
+- parameter (maxbmt = 2)
+- double precision B(maxbmt,maxbmt), eigval(maxbmt),
+- $ eigvec(maxbmt,maxbmt), w(5*maxbmt)
+- integer m, ia, ix, istat
+-c
+- B(1,1) = 1.00
+- B(1,2) = 1.00
+- B(2,1) = 1.00
+- B(2,2) = 1.00
+-c
+- m = maxbmt
+- ia = maxbmt
+- ix = maxbmt
+- call dsyev('N', 'L', m, B, ia, eigval, w, 5*maxbmt, istat)
+- end
+-EOF
+- #firstly test without -lblas
+- test_compile="$FC $FOPTIM $XFFLAGS -o testlink testlink.f -llapack"
+- echo $test_compile
+- if { (eval $test_compile >& /dev/null ) 2>&1; } && test -s testlink ; then
+- # Compilation was okay
+- echo "... only -llapack needed"
+- XLAPACK_LIB="-llapack"
+- # Set the next two variables so that configure
+- # doesn't try to build netlib libraries
+- LAPACKLIB="lapack"
+- noblas=yes
+- trylapack=
+- tryblas=
+- else
+- echo "more than just -llapack needed...."
+- test_compile="$FC $FOPTIM $XFFLAGS -o testlink testlink.f -llapack -lblas"
+- echo $test_compile
+- if { (eval $test_compile ) 2>&1; } && test -s testlink ; then
+- # Compilation was okay
+- echo "...-llapack and -lblas were needed"
+- XLAPACK_LIB="-llapack -lblas"
+- # Set the next two variables so that configure
+- # doesn't try to build netlib libraries
+- LAPACKLIB="lapack blas"
+- noblas=no
+- trylapack=
+- tryblas=
+- else
+- echo "....could not find either lapack or blas."
+- fi
+- fi
+- fi
+- # add 64 bit libs
+- case $system in
+- linux64 ) trydirs="/usr/lib64 ${trydirs}" ;;
+- esac
+-
+- ;;
+- osf1)
+- # OSF1 has dxml (old version) and cxml
+- # which should have both lapack and blas
+- trylapack="dxml cxml"
+- tryblas=
+- trydirs="${trydirs} /usr/shlib"
+- ;;
+- irix)
+- # Additional search paths for IRIX
+- trydirs="${trydirs} /usr/lib32"
+- # SCSL should have both LAPACK and BLAS
+- trylapack="scs"
+- tryblas="blas"
+- ;;
+- irix64)
+- # Additional search paths for IRIX64
+- trydirs="${trydirs} /usr/lib64"
+- # SCSL should have both LAPACK and BLAS
+- trylapack="scs"
+- tryblas="blas"
+- # Extra compiler flags?
+- #XLAPACKFLAGS="-OPT:IEEE_NaN_inf=ON"
+- ;;
+- aix)
+- # Additional search paths for AIX
+- trydirs="${trydirs}"
+- # AIX might have ESSL library - blas only I think
+- trylapack=
+- tryblas="essl"
+- ;;
+- hpux)
+- # Additional search paths for HPUX
+- trydirs="${trydirs} /opt/fortran/lib /opt/fortran/lib/pa2.0 /opt/mlib/lib/pa2.0"
+- # HPUX should have both LAPACK (part of mlib) and BLAS
+- trylapack="lapack"
+- tryblas="blas"
+- # Extra compiler flags?
+- # +U77 required for ETIME function - this is already in XFFLAGS
+- #XLAPACKFLAGS="+U77"
+- ;;
+-
+- sunos | sunos64)
+- # Sun has libraries with BLAS and LAPACK invoked using
+- # -xlic_lib=sunperf
+- trylapack=
+- tryblas=
+- echo "SunOs can use the Sun Performance Library (if installed)"
+- echo "which has both BLAS and LAPACK 3.0"
+- echo
+- echo "Looking for a valid library to use..."
+- echo
+- # Loop over the possible library names
+- try_libs="sunperf"
+- for testlib in $try_libs
+- do
+- if test ! "$XLAPACK_LIB" ; then
+- # Try running a test compile to see if this a valid library
+- if test -f testlink.f || test -f testlink ; then
+- rm -f testlink*
+- fi
+- cat > testlink.f <<EOF
+-c Test fortran program to link against library
+- PROGRAM TESTLINK
+- IMPLICIT NONE
+- INTEGER A
+- A = 1
+- STOP
+- END
+-EOF
+- test_compile="$FC $FOPTIM $XFFLAGS -o testlink testlink.f -dalign -xlic_lib=$testlib"
+- echo $test_compile
+- if { (eval $test_compile ) 2>&1; } && test -s testlink ; then
+- # Compilation was okay
+- echo "... -xlic_lib=$testlib is okay"
+- XLAPACK_LIB="-dalign -xlic_lib=$testlib"
+- # Set the next two variables so that configure
+- # doesn't try to build netlib libraries
+- LAPACKLIB="$testlib"
+- noblas=yes
+- else
+- # Compilation failed
+- echo "... cannot use -xlic_lib=$testlib"
+- fi
+- # End of test for testlib
+- fi
+- # End of loop over possible lib names
+- done
+- # Report if no suitable library was found
+- if test ! "$XLAPACK_LIB" ; then
+- echo
+- echo "No suitable LAPACK library was found."
+- echo "This may be because the Sun Performance Library is not"
+- echo "installed on your system"
+- echo "Contact your system administrator or Sun vendor"
+- fi
+- ;;
+- Darwin | Darwin32 | Darwin64 )
+- # Darwin has libraries with BLAS and LAPACK invoked using
+- # -framework vecLib
+- echo "Darwin can use the vecLib Library (if installed)"
+- echo "which has both BLAS and LAPACK 3.0"
+- echo
+- # This is a special case so try running a test compile
+- echo "Checking: try to link library against test program"
+- if test -f testlink.f || test -f testlink ; then
+- rm -f testlink*
+- fi
+- cat > testlink.f <<EOF
+-c Test fortran program to link against library
+- PROGRAM TESTLINK
+- IMPLICIT NONE
+- INTEGER A
+- A = 1
+- STOP
+- END
+-EOF
+- test_compile="$FC $FOPTIM $XFFLAGS -o testlink testlink.f -framework vecLib"
+- echo $test_compile
+- if { (eval $test_compile ) 2>&1; } && test -s testlink ; then
+- # Compilation was okay
+- echo "... -framework vecLib is okay"
+- XLAPACK_LIB="-framework vecLib"
+- # Set the next two variables so that configure
+- # doesn't try to build netlib libraries
+- LAPACKLIB="vecLib"
+- noblas=yes
+- else
+-#alternative linking for vecLib libraries
+- case `uname -sr` in
+- *Darwin\ 7.* ) test_compile="$FC $FOPTIM $XFFLAGS -o testlink testlink.f -lcc_dynamic -Wl,-framework -Wl,vecLib" ;;
+- * ) test_compile="$FC $FOPTIM $XFFLAGS -o testlink testlink.f -Wl,-framework -Wl,vecLib" ;;
+- esac
+-
+- echo $test_compile
+- if { (eval $test_compile ) 2>&1; } && test -s testlink ; then
+- # Compilation was okay
+- echo "... -framework vecLib is okay"
+- XLAPACK_LIB="-Wl,-framework -Wl,vecLib"
+- # Set the next two variables so that configure
+- # doesn't try to build netlib libraries
+- LAPACKLIB="-Wl,-framework -Wl,vecLib"
+- noblas=yes
+- else
+- # Compilation failed
+- echo "... cannot use -framework vecLib"
+- echo
+- fi
+- fi
+- trylapack=
+- tryblas=
+-# try the fink installation
+- trydirs="${trydirs} /sw"
+- ;;
+- Darwin_ibm_compilers )
+- # Darwin has libraries with BLAS and LAPACK invoked using
+- # -framework vecLib
+- echo "Darwin can use the vecLib Library (if installed)"
+- echo "which has both BLAS and LAPACK 3.0"
+- echo
+- # This is a special case so try running a test compile
+- echo "Checking: try to link library against test program"
+- if test -f testlink.f || test -f testlink ; then
+- rm -f testlink*
+- fi
+- cat > testlink.f <<EOF
+-c Test fortran program to link against library
+- PROGRAM TESTLINK
+- IMPLICIT NONE
+- INTEGER A
+- A = 1
+- STOP
+- END
+-EOF
+- case `uname -sr` in
+- Darwin\ 8* )
+- XLAPACK_LIB="-L/System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A -lLAPACK -lBLAS"
+- test_compile="$FC $FOPTIM $XFFLAGS -o testlink testlink.f $XLAPACK_LIB"
+- ;;
+- Darwin\ 7* )
+- XLAPACK_LIB="-L/System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A -lLAPACK -lBLAS"
+- test_compile="$FC $FOPTIM $XFFLAGS -o testlink testlink.f -lcc_dynamic $XLAPACK_LIB"
+- ;;
+- *)
+- XLAPACK_LIB="/System/Library/Frameworks/vecLib.Framework/Versions/Current/VecLib"
+- test_compile="$FC $FOPTIM $XFFLAGS -o testlink testlink.f $XLAPACK_LIB"
+- esac
+- echo $test_compile
+- if { (eval $test_compile ) 2>&1; } && test -s testlink ; then
+- # Compilation was okay
+- echo "... -framework vecLib is okay"
+- # Set the next two variables so that configure
+- # doesn't try to build netlib libraries
+- LAPACKLIB="vecLib"
+- noblas=yes
+- else
+- # Compilation failed
+- XLAPACK_LIB=""
+- echo "... cannot use -framework vecLib"
+- echo
+- fi
+- trylapack=
+- tryblas=
+-# try the fink installation
+- trydirs="${trydirs} /sw"
+- ;;
+-
+- Darwin_intel_compilers)
+- # Darwin has libraries with BLAS and LAPACK invoked using
+- # -F vecLib
+- echo "Darwin can use the vecLib Library (if installed)"
+- echo "which has both BLAS and LAPACK 3.0"
+- echo
+- # This is a special case so try running a test compile
+- echo "Checking: try to link library against test program"
+- if test -f testlink.f || test -f testlink ; then
+- rm -f testlink*
+- fi
+- cat > testlink.f <<EOF
+-c Test fortran program to link against library
+- PROGRAM TESTLINK
+- IMPLICIT NONE
+- INTEGER A
+- A = 1
+- STOP
+- END
+-EOF
+- test_compile="$FC $FOPTIM $XFFLAGS -o testlink testlink.f -Wl,-framework -Wl,vecLib"
+- echo $test_compile
+- if { (eval $test_compile ) 2>&1; } && test -s testlink ; then
+- # Compilation was okay
+- # doesn't try to build netlib libraries
+- XLAPACK_LIB="-F /System/Library/Frameworks -Qoption,ld,-framework -Qoption,ld,vecLib"
+- LAPACKLIB="vecLib"
+- noblas=yes
+- else
+- # Compilation failed
+- echo "... cannot use -framework vecLib"
+- echo
+- fi
+- trylapack=
+- tryblas=
+-# try the fink installation
+- trydirs="${trydirs} /sw"
+- ;;
+-
+-# linux_ia64_sgi_altix)
+-# SGI Japan
+- ia64_linux_intel)
+- # Additional search paths for Linux/IA64
+- trydirs="${trydirs} /opt/scsl/lib /usr/lib /usr/local/lib"
+- # SCSL and MKL should have both LAPACK and BLAS
+- trylapack="mkl_lapack scs lapack"
+- tryblas="mkl scs blas"
+- ;;
+- linux_ibm_compilers )
+- trylapack="lapack"
+- tryblas="blas"
+- ;;
+- linux64_ibm_compilers )
+- trydirs="/usr/lib64 ${trydirs}"
+- trylapack="lapack"
+- tryblas="blas"
+- ;;
+- linux_intel_compilers )
+- trydirs="/usr/lib64 ${trydirs}"
+- trylapack="mkl_lapack lapack"
+- tryblas="mkl blas"
+- ;;
+- *)
+- echo "The guesses for this system may not be correct - please"
+- echo "e-mail ccp4@ccp4.ac.uk if you have any extra information"
+- echo
+- # Default guess is just libblas
+- trylapack="lapack"
+- tryblas="blas"
+- ;;
+- esac
+- #
+- # Search for LAPACK libraries
+- #
+- # Write out what the guesses are
+- if test "$trylapack" ; then
+- echo "Possible LAPACK library names for this system:"
+- for libname in $trylapack
+- do
+- echo " lib$libname"
+- done
+- # Possible library name extensions
+- tryexts="a so dylib"
+- # Now loop over all the possibilities and see if anything
+- # turns up
+- echo
+- echo "Searching for libraries with LAPACK and BLAS:"
+- for testdir in $trydirs
+- do
+- for testlib in $trylapack
+- do
+- for ext in $tryexts
+- do
+- if test ! "$LAPACKLIB"; then
+- if test -s "$testdir/lib$testlib.$ext" ; then
+- echo "...found LAPACK library: $testdir/lib$testlib.$ext"
+- # Now try and link to a test program
+- # This is really for IRIX where libraries can be
+- # o32 or n32
+- echo " Testing: try to link library against test program"
+- if test -f testlink.f || test -f testlink ; then
+- rm -f testlink*
+- fi
+- cat > testlink.f <<EOF
+-c Test fortran program to link against library
+- PROGRAM TESTLINK
+- IMPLICIT NONE
+- INTEGER A
+- A = 1
+- STOP
+- END
+-EOF
+- test_compile="$FC $FOPTIM $XFFLAGS -o testlink testlink.f -L$testdir -l$testlib"
+- test_ccompile="$FC $FOPTIM $XFFLAGS -o testlink testlink.f -L$testdir -l$testlib $XLDFLAGS"
+- echo $test_compile
+- if { (eval $test_compile ) 2>&1; } && test -s testlink ; then
+- have_lapack=yes
+- else
+-# cover clapack option
+- echo $test_ccompile
+- if { (eval $test_ccompile ) 2>&1; } && test -s testlink ; then
+- have_lapack=yes
+- fi
+- fi
+- if test x$have_lapack = xyes ; then
+- # This one is okay
+- LAPACKLIB="$testlib"
+- LAPACKDIR="$testdir"
+- echo "Link ok - using lib$LAPACKLIB from $LAPACKDIR"
+- #
+- XLAPACK_LIB="-L$LAPACKDIR -l$LAPACKLIB"
+- #
+- # Test to see if we need BLAS too
+- # Do this by trying to compile a test program
+- # Use the LSAME test for now
+- echo
+- echo " * Checking whether we need a separate BLAS library *"
+- echo " Testing: try linking library against test program"
+- cd lib/lapack/test
+- if test -f testlsame ; then
+- rm -f testsame testlsame.o
+- fi
+- test_compile="$FC $FOPTIM $XFFLAGS -o testlsame lsametst.f -L$LAPACKDIR -l$LAPACKLIB"
+- test_ccompile="$FC $FOPTIM $XFFLAGS -o testlsame lsametst.f -L$LAPACKDIR -l$LAPACKLIB $XLDFLAGS"
+- echo $test_compile
+- if { ( eval $test_compile) 2>&1;} && test -s testlsame ; then
+- have_blas=yes
+- else
+-#cblas route
+- echo $test_ccompile
+- if { ( eval $test_ccompile) 2>&1;} && test -s testlsame ; then
+- have_blas=yes
+- fi
+- fi
+- if test x$have_blas = xyes ; then
+- echo "Test program okay - additional separate BLAS not required"
+- noblas=yes
+- else
+- echo "Test program failed - need a separate BLAS library"
+- fi
+- cd ../../..
+- else
+- # Keep looking
+- echo " link failed - cannot use lib$testlib"
+- fi
+- fi
+- fi
+- done
+- done
+- if test ! "$LAPACKLIB"; then
+- echo "...nothing in $testdir"
+- fi
+- done
+- fi
+-
+- # If LAPACKLIB hasn't been set at this point then no LAPACK library
+- # was found
+- if test ! "$LAPACKLIB" ; then
+- echo
+- echo "No pre-existing LAPACK library found - NetLib LAPACK will be built instead"
+- make_lapack=lapacklib
+- fi
+- # Look for possible BLAS
+- if test ! "$noblas" ; then
+- if test "$tryblas" ; then
+- echo
+- echo "Possible BLAS library names for this system:"
+- for libname in $tryblas
+- do
+- echo " lib$libname"
+- done
+- # Possible library name extensions
+- tryexts="a so"
+- # Now loop over all the possibilities and see if anything
+- # turns up
+- echo
+- echo "Searching for libraries with BLAS:"
+- for testdir in $trydirs
+- do
+- for testlib in $tryblas
+- do
+- for ext in $tryexts
+- do
+- if test ! "$BLASLIB"; then
+- if test -s "$testdir/lib$testlib.$ext" ; then
+- echo "...found BLAS library: $testdir/lib$testlib.$ext"
+- # Now try and link to a test program
+- # This is really for IRIX where libraries can be
+- # o32 or n32
+- echo " Testing: try to link library against test program"
+- if test -f testlink.f || test -f testlink ; then
+- rm -f testlink*
+- fi
+- cat > testlink.f <<EOF
+-c Test fortran program to link against library
+- PROGRAM TESTLINK
+- IMPLICIT NONE
+- INTEGER A
+- A = 1
+- STOP
+- END
+-EOF
+- test_compile="$FC $FOPTIM $XFFLAGS -o testlink testlink.f -L$testdir -l$testlib"
+- test_ccompile="$FC $FOPTIM $XFFLAGS -o testlink testlink.f -L$testdir -l$testlib $XLDFLAGS"
+- echo $test_compile
+- if { ( eval $test_compile) 2>&1;} && test -s testlink ; then
+- have_blas=yes
+- else
+- echo $test_ccompile
+- if { ( eval $test_compile) 2>&1;} && test -s testlink ; then
+- have_blas=yes
+- fi
+- fi
+- if test x$have_blas = xyes ; then
+- # This one is okay
+- BLASLIB="$testlib"
+- BLASDIR="$testdir"
+- BLASEXT="$ext"
+- echo "Link ok - using lib$BLASLIB from $BLASDIR"
+- XLAPACK_LIB="$XLAPACK_LIB -L$BLASDIR -l$BLASLIB"
+- else
+- # Keep looking
+- echo " link failed - cannot use lib$testlib"
+- fi
+- fi
+- fi
+- done
+- done
+- if test ! "$BLASLIB"; then
+- echo "...nothing in $testdir"
+- fi
+- done
+- fi
+- # Do we need to build BLAS too?
+- if test ! "$BLASLIB" ; then
+- echo
+- echo "No pre-existing BLAS library was found - NetLib BLAS will be built instead"
+- echo "This may result in poorer performance of the LAPACK routines"
+- make_blas=blaslib
+- BLASLIB=blas
+- BLASDIR="$srcdir/lib/lapack"
+- BLASEXT="a"
+- fi
+- fi
++ # gentoo is clever
++ make_blas=
++ make_lapack=
++ BLASLIB=$(pkg-config --libs lapack)
++ LAPACKLIB=$(pkg-config --libs lapack)
++ XLAPACK_LIB="${BLASLIB} ${LAPACKLIB}"
++ XFFLAGS_LAPACK="$(pkg-config --cflags lapack blas)"
+ # Otherwise force building of NetLib BLAS and LAPACK libs
+- else
+- echo
+- echo "! Force building of NetLib BLAS and LAPACK..."
+- make_blas=blaslib
+- make_lapack=lapacklib
+- BLASLIB=blas
+- BLASDIR="$srcdir/lib/lapack"
+- BLASEXT="a"
+- fi
+ # need to know if we the lapack library was linked using the C or
+ # fortran linker
+ if test -f testlink.f || test -f testlink || test -f testlink.c ; then
+@@ -3916,8 +3356,8 @@ RANLIB = ${RANLIB}
+ INSTALL_DATA = ${INSTALL_DATA}
+ libdir = $libdir
+ #
+-BLASLIB = lib${BLASLIB}.${BLASEXT}
+-LAPACKLIB = liblapack.a
++BLASLIB = ${BLASLIB}
++LAPACKLIB = ${LAPACKLIB}
+ #
+ # These variables define targets in the main Makefile
+ blaslib = ${make_blas}