From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1QVkv2-0005jv-Vt for garchives@archives.gentoo.org; Sun, 12 Jun 2011 13:41:37 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 8EFA71C05A; Sun, 12 Jun 2011 13:41:29 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 4EDE31C05A for ; Sun, 12 Jun 2011 13:41:29 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id C47631B4010 for ; Sun, 12 Jun 2011 13:41:28 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 08BF78003C for ; Sun, 12 Jun 2011 13:41:28 +0000 (UTC) From: "Justin Lecher" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Justin Lecher" Message-ID: Subject: [gentoo-commits] proj/sci:master commit in: eclass/ X-VCS-Repository: proj/sci X-VCS-Files: eclass/fortran-2.eclass X-VCS-Directories: eclass/ X-VCS-Committer: jlec X-VCS-Committer-Name: Justin Lecher X-VCS-Revision: e9b97df9fd560ad0c0778438c6dcc5114a519083 Date: Sun, 12 Jun 2011 13:41:28 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: X-Archives-Hash: 1e3915b18415fe5e7e0237976f7ac710 commit: e9b97df9fd560ad0c0778438c6dcc5114a519083 Author: Justin Lecher gentoo org> AuthorDate: Sun Jun 12 13:40:47 2011 +0000 Commit: Justin Lecher gentoo org> CommitDate: Sun Jun 12 13:40:47 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/sci.git;a=3Dc= ommit;h=3De9b97df9 fortran-2.eclass, added mpif* cpabilities and get_fcomp function --- eclass/fortran-2.eclass | 54 ++++++++++++++++++++++++++++++++++++++++-= ----- 1 files changed, 47 insertions(+), 7 deletions(-) diff --git a/eclass/fortran-2.eclass b/eclass/fortran-2.eclass index dd1da73..ec2c602 100644 --- a/eclass/fortran-2.eclass +++ b/eclass/fortran-2.eclass @@ -3,21 +3,22 @@ # $Header: $ =20 # Author Justin Lecher +# Test functions provided by Sebastien Fabbro and Kacper Kowalik =20 # @ECLASS: fortran-2.eclass # @MAINTAINER: -# sci@gentoo.org # jlec@gentoo.org +# sci@gentoo.org # @BLURB: Packages, which need a frortran compiler should inherit this e= class. # @DESCRIPTION: # If you need a fortran compiler, inherit this eclass. This eclass tests= for -# working fortran compilers. Optional, check for openmp capability of th= e -# current fortran compiler through FCOPENMP=3D1. Only function exported -# is pkg_setup. +# working fortran compilers. Optional, it checks for openmp capability o= f the +# current fortran compiler through FC_NEED_OPENMP=3D1. +# Only phase function exported is pkg_setup. =20 -# @ECLASS-VARIABLE: FCOPENMP +# @ECLASS-VARIABLE: FC_NEED_OPENMP # @DESCRIPTION: -# If FCOPNMP=3D1, FC is tested for openmp capabilities +# SET FC_NEED_OPENMP=3D1 in order to test FC for openmp capabilities # # Default is 0 =20 @@ -26,10 +27,15 @@ inherit toolchain-funcs DEPEND=3D"virtual/fortran" RDEPEND=3D"${DEPEND}" =20 +# internal function +# +# FUNCTION: _have-valid-fortran +# DESCRIPTION: +# Check whether FC returns a working fortran compiler _have-valid-fortran() { local base=3D${T}/test-tc-fortran cat <<- EOF > "${base}.f" - end + end EOF $(tc-getFC "$@") "${base}.f" -o "${base}" >&/dev/null local ret=3D$? @@ -37,6 +43,10 @@ _have-valid-fortran() { return ${ret} } =20 +# internal function +# +# FUNCTION: _fortran-has-openmp +# DESCRIPTION: # See if the fortran supports OpenMP. _fortran-has-openmp() { local flag @@ -45,6 +55,10 @@ _fortran-has-openmp() { flag=3D-fopenmp ;; ifort) flag=3D-openmp ;; + mpi*) + local _fcomp=3D$($(tc-getFC) -show | awk '{print $1}') + FC=3D${_fcomp} _fortran-has-openmp + return $? ;; *) return 0 ;; esac @@ -60,9 +74,35 @@ _fortran-has-openmp() { return ${ret} } =20 +# @FUNCTION: get_fcomp +# @DESCRIPTION: +# Returns the canonical name or the native compiler of the current fortr= an compiler +# +# e.g. +# +# x86_64-linux-gnu-gfortran -> gfortran +get_fcomp() { + case $(tc-getFC) in + *gfortran* ) + echo "gfortran" ;; + ifort ) + echo "ifc" ;; + mpi*) + local _fcomp=3D$($(tc-getFC) -show | awk '{print $1}') + echo "$(FC=3D${_fcomp} get_fcomp)";; + * ) + echo $(tc-getFC) ;; + esac +} + +# @FUNCTION: fortran-2_pkg_setup +# @DESCRIPTION: +# Setup functionallity, checks for a valid fortran compiler and optional= ly for its openmp support. fortran-2_pkg_setup() { _have-valid-fortran || \ die "Please emerge the current gcc with USE=3Dfortran or export FC def= ining a working fortran compiler" + export F77=3D"$(tc-getFC)" + export F95=3D"$(tc-getFC)" if [[ ${FCOPENMP} =3D=3D 1 ]]; then _fortran-has-openmp || \ die "Please emerge current gcc with USE=3Dopenmp or export FC with com= piler that supports OpenMP"