/[gentoo-x86]/eclass/fortran-2.eclass
Gentoo

Diff of /eclass/fortran-2.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.17 Revision 1.18
1# Copyright 1999-2013 Gentoo Foundation 1# Copyright 1999-2013 Gentoo Foundation
2# Distributed under the terms of the GNU General Public License v2 2# Distributed under the terms of the GNU General Public License v2
3# $Header: /var/cvsroot/gentoo-x86/eclass/fortran-2.eclass,v 1.17 2013/03/13 11:03:12 jlec Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/fortran-2.eclass,v 1.18 2013/07/18 07:03:33 jlec Exp $
4 4
5# @ECLASS: fortran-2.eclass 5# @ECLASS: fortran-2.eclass
6# @MAINTAINER: 6# @MAINTAINER:
7# jlec@gentoo.org 7# jlec@gentoo.org
8# sci@gentoo.org 8# sci@gentoo.org
107 local fcomp=${1} 107 local fcomp=${1}
108 local fdia=${2} 108 local fdia=${2}
109 local fcode=${filebase}.f${fdia} 109 local fcode=${filebase}.f${fdia}
110 local ret 110 local ret
111 111
112 [[ $# -lt 1 ]] && \
112 [[ $# -lt 1 ]] && die "_fortran_compile_test() needs at least one arguments" 113 die "_fortran_compile_test() needs at least one arguments"
113 114
114 [[ -f ${fcode} ]] || _fortran_write_testsuite 115 [[ -f ${fcode} ]] || _fortran_write_testsuite
115 116
116 ${fcomp} "${fcode}" -o "${fcode}.x" >> "${T}"/_fortran_compile_test.log 2>&1 117 ${fcomp} "${fcode}" -o "${fcode}.x" \
118 >> "${T}"/_fortran_compile_test.log 2>&1
117 ret=$? 119 ret=$?
118 120
119 rm -f "${fcode}.x" 121 rm -f "${fcode}.x"
120 return ${ret} 122 return ${ret}
121} 123}
136 call omp_get_num_threads 138 call omp_get_num_threads
137 end 139 end
138 EOF 140 EOF
139 141
140 for flag in -fopenmp -xopenmp -openmp -mp -omp -qsmp=omp; do 142 for flag in -fopenmp -xopenmp -openmp -mp -omp -qsmp=omp; do
141 ${_fc} ${flag} "${fcode}" -o "${fcode}.x" &>> "${T}"/_fortran_compile_test.log 143 ${_fc} ${flag} "${fcode}" -o "${fcode}.x" \
144 &>> "${T}"/_fortran_compile_test.log
142 ret=$? 145 ret=$?
143 (( ${ret} )) || break 146 (( ${ret} )) || break
144 done 147 done
145 148
146 rm -f "${fcode}.x" 149 rm -f "${fcode}.x"
162} 165}
163 166
164# @FUNCTION: _fortran_test_function 167# @FUNCTION: _fortran_test_function
165# @INTERNAL 168# @INTERNAL
166# @DESCRIPTION: 169# @DESCRIPTION:
167# Internal testfunction for working fortran compiler. It is called in fortran-2_pkg_setup 170# Internal testfunction for working fortran compiler.
171# It is called in fortran-2_pkg_setup
168_fortran_test_function() { 172_fortran_test_function() {
169 local dialect 173 local dialect
170 174
171 : ${F77:=$(tc-getFC)} 175 : ${F77:=$(tc-getFC)}
172 176
173 : ${FORTRAN_STANDARD:=77} 177 : ${FORTRAN_STANDARD:=77}
174 for dialect in ${FORTRAN_STANDARD}; do 178 for dialect in ${FORTRAN_STANDARD}; do
175 case ${dialect} in 179 case ${dialect} in
176 77) _fortran_compile_test $(tc-getF77) || _fortran_die_msg ;; 180 77) _fortran_compile_test $(tc-getF77) || \
181 _fortran_die_msg ;;
177 90|95) _fortran_compile_test $(tc-getFC) 90 || _fortran_die_msg ;; 182 90|95) _fortran_compile_test $(tc-getFC) 90 || \
183 _fortran_die_msg ;;
178 2003) _fortran_compile_test $(tc-getFC) 03 || _fortran_die_msg ;; 184 2003) _fortran_compile_test $(tc-getFC) 03 || \
185 _fortran_die_msg ;;
179 2008) die "Future" ;; 186 2008) die "Future" ;;
180 *) die "${dialect} is not a Fortran dialect." ;; 187 *) die "${dialect} is not a Fortran dialect." ;;
181 esac 188 esac
182 done 189 done
183 190
188 195
189 if [[ ${FORTRAN_NEED_OPENMP} == 1 ]]; then 196 if [[ ${FORTRAN_NEED_OPENMP} == 1 ]]; then
190 if _fortran-has-openmp; then 197 if _fortran-has-openmp; then
191 einfo "${FC} has OPENMP support" 198 einfo "${FC} has OPENMP support"
192 else 199 else
193 die "Please install current gcc with USE=openmp or set the FC variable to a compiler that supports OpenMP" 200 die "Please install current gcc with USE=openmp or " \
201 "set the FC variable to a compiler that supports OpenMP"
194 fi 202 fi
195 fi 203 fi
196} 204}
197 205
198# @FUNCTION: fortran-2_pkg_setup 206# @FUNCTION: fortran-2_pkg_setup
199# @DESCRIPTION: 207# @DESCRIPTION:
208# Setup functionallity,
200# Setup functionallity, checks for a valid fortran compiler and optionally for its openmp support. 209# checks for a valid fortran compiler and optionally for its openmp support.
201fortran-2_pkg_setup() { 210fortran-2_pkg_setup() {
202 for _f_use in ${FORTRAN_NEEDED}; do 211 for _f_use in ${FORTRAN_NEEDED}; do
203 case ${_f_use} in 212 case ${_f_use} in
204 always) 213 always)
205 _fortran_test_function && break 214 _fortran_test_function && break

Legend:
Removed from v.1.17  
changed lines
  Added in v.1.18

  ViewVC Help
Powered by ViewVC 1.1.20