From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([69.77.167.62] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1KEHPI-0008I6-Gb for garchives@archives.gentoo.org; Thu, 03 Jul 2008 05:31:01 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id E5962E0450; Thu, 3 Jul 2008 05:30:59 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 9E4F2E0450 for ; Thu, 3 Jul 2008 05:30:59 +0000 (UTC) Received: from stork.gentoo.org (stork.gentoo.org [64.127.104.133]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTP id 2E85567239 for ; Thu, 3 Jul 2008 05:30:59 +0000 (UTC) Received: from dberkholz by stork.gentoo.org with local (Exim 4.69) (envelope-from ) id 1KEHPC-0002dB-OE for gentoo-commits@lists.gentoo.org; Thu, 03 Jul 2008 05:30:54 +0000 From: "Donnie Berkholz (dberkholz)" To: gentoo-commits@lists.gentoo.org Reply-To: gentoo-dev@lists.gentoo.org, dberkholz@gentoo.org Subject: [gentoo-commits] gentoo-x86 commit in eclass: flag-o-matic.eclass X-VCS-Repository: gentoo-x86 X-VCS-Files: flag-o-matic.eclass X-VCS-Directories: eclass X-VCS-Committer: dberkholz X-VCS-Committer-Name: Donnie Berkholz Content-Type: text/plain; charset=utf8 Message-Id: Sender: Donnie Berkholz Date: Thu, 03 Jul 2008 05:30:54 +0000 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: 5e947cf9-9d68-431a-ac3e-b4c5edb5602a X-Archives-Hash: 9d05fd030490fbc4bc60c6698ccf752f dberkholz 08/07/03 05:30:54 Modified: flag-o-matic.eclass Log: [Fortran] Add Fortran support to filter-flags(), append-flags(), is-fla= gq(), strip-flags(), strip-unsupported-flags(), get-flag(). Add new funct= ions parallel to existing ones for Fortran: append-fflags(), test-flag-F7= 7(), test-flags-FC(). Revision Changes Path 1.124 eclass/flag-o-matic.eclass file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/flag-o-mati= c.eclass?rev=3D1.124&view=3Dmarkup plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/flag-o-mati= c.eclass?rev=3D1.124&content-type=3Dtext/plain diff : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/flag-o-mati= c.eclass?r1=3D1.123&r2=3D1.124 Index: flag-o-matic.eclass =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /var/cvsroot/gentoo-x86/eclass/flag-o-matic.eclass,v retrieving revision 1.123 retrieving revision 1.124 diff -u -r1.123 -r1.124 --- flag-o-matic.eclass 7 Jun 2008 16:42:32 -0000 1.123 +++ flag-o-matic.eclass 3 Jul 2008 05:30:54 -0000 1.124 @@ -1,6 +1,6 @@ # Copyright 1999-2008 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/flag-o-matic.eclass,v 1.123 20= 08/06/07 16:42:32 flameeyes Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/flag-o-matic.eclass,v 1.124 20= 08/07/03 05:30:54 dberkholz Exp $ =20 # @ECLASS: flag-o-matic.eclass # @MAINTAINER: @@ -26,7 +26,7 @@ # has_ssp =20 =20 -# C[XX]FLAGS that we allow in strip-flags +# {C,CXX,F,FC}FLAGS that we allow in strip-flags # Note: shell globs and character lists are allowed setup-allowed-flags() { if [[ -z ${ALLOWED_FLAGS} ]] ; then @@ -53,7 +53,7 @@ -mlive-g0 -mcmodel -mstack-bias -mno-stack-bias \ -msecure-plt -D*" =20 - # C[XX]FLAGS that we are think is ok, but needs testing + # {C,CXX,F,FC}FLAGS that we are think is ok, but needs testing # NOTE: currently -Os have issues with gcc3 and K6* arch's export UNSTABLE_FLAGS=3D"-Os -O3 -freorder-blocks" return 0 @@ -104,12 +104,14 @@ # @FUNCTION: filter-flags # @USAGE: # @DESCRIPTION: -# Remove particular from {C,CPP,CXX}FLAGS. Accepts shell globs. +# Remove particular from {C,CPP,CXX,F,FC}FLAGS. Accepts shell g= lobs. filter-flags() { _filter-hardened "$@" _filter-var CFLAGS "$@" _filter-var CPPFLAGS "$@" _filter-var CXXFLAGS "$@" + _filter-var FFLAGS "$@" + _filter-var FCFLAGS "$@" return 0 } =20 @@ -131,6 +133,17 @@ return 0 } =20 +# @FUNCTION: append-fflags +# @USAGE: +# @DESCRIPTION: +# Add extra to the current {F,FC}FLAGS. +append-fflags() { + [[ -z $* ]] && return 0 + export FFLAGS=3D"${FFLAGS} $*" + export FCFLAGS=3D"${FCFLAGS} $*" + return 0 +} + # @FUNCTION: append-lfs-flags # @DESCRIPTION: # Add flags that enable Large File Support. @@ -142,11 +155,13 @@ # @FUNCTION: append-flags # @USAGE: # @DESCRIPTION: -# Add extra to your current C[XX]FLAGS. +# Add extra to your current {C,CXX,F,FC}FLAGS. append-flags() { [[ -z $* ]] && return 0 export CFLAGS=3D"${CFLAGS} $*" export CXXFLAGS=3D"${CXXFLAGS} $*" + export FFLAGS=3D"${FFLAGS} $*" + export FCFLAGS=3D"${FCFLAGS} $*" return 0 } =20 @@ -162,7 +177,7 @@ local f fset declare -a new_CFLAGS new_CXXFLAGS =20 - for fset in CFLAGS CXXFLAGS; do + for fset in CFLAGS CXXFLAGS FFLAGS FCFLAGS; do # Looping over the flags instead of using a global # substitution ensures that we're working with flag atoms. # Otherwise globs like -O* have the potential to wipe out the @@ -207,16 +222,16 @@ # @FUNCTION: is-flagq # @USAGE: # @DESCRIPTION: -# Returns shell true if is in C[XX]FLAGS, else returns shell fals= e. Accepts shell globs. +# Returns shell true if is in {C,CXX,F,FC}FLAGS, else returns she= ll false. Accepts shell globs. is-flagq() { [[ -n $2 ]] && die "Usage: is-flag " - _is_flagq CFLAGS $1 || _is_flagq CXXFLAGS $1 + _is_flagq CFLAGS $1 || _is_flagq CXXFLAGS $1 || _is_flagq FFLAGS $1 || = _is_flagq FCFLAGS $1 } =20 # @FUNCTION: is-flag # @USAGE: # @DESCRIPTION: -# Echo's "true" if flag is set in C[XX]FLAGS. Accepts shell globs. +# Echo's "true" if flag is set in {C,CXX,F,FC}FLAGS. Accepts shell glob= s. is-flag() { is-flagq "$@" && echo true } @@ -276,12 +291,14 @@ # @DESCRIPTION: # Strip C[XX]FLAGS of everything except known good/safe flags. strip-flags() { - local x y flag NEW_CFLAGS NEW_CXXFLAGS + local x y flag NEW_CFLAGS NEW_CXXFLAGS NEW_FFLAGS NEW_FCFLAGS =20 setup-allowed-flags =20 local NEW_CFLAGS=3D"" local NEW_CXXFLAGS=3D"" + local NEW_FFLAGS=3D"" + local NEW_FCFLAGS=3D"" =20 # Allow unstable C[XX]FLAGS if we are using unstable profile ... if has ~$(tc-arch) ${ACCEPT_KEYWORDS} ; then @@ -310,6 +327,26 @@ done done =20 + for x in ${FFLAGS}; do + for y in ${ALLOWED_FLAGS}; do + flag=3D${x%%=3D*} + if [ "${flag%%${y}}" =3D "" ] ; then + NEW_FFLAGS=3D"${NEW_FFLAGS} ${x}" + break + fi + done + done + + for x in ${FCFLAGS}; do + for y in ${ALLOWED_FLAGS}; do + flag=3D${x%%=3D*} + if [ "${flag%%${y}}" =3D "" ] ; then + NEW_FCFLAGS=3D"${NEW_FCFLAGS} ${x}" + break + fi + done + done + # In case we filtered out all optimization flags fallback to -O2 if [ "${CFLAGS/-O}" !=3D "${CFLAGS}" -a "${NEW_CFLAGS/-O}" =3D "${NEW_C= FLAGS}" ]; then NEW_CFLAGS=3D"${NEW_CFLAGS} -O2" @@ -317,11 +354,19 @@ if [ "${CXXFLAGS/-O}" !=3D "${CXXFLAGS}" -a "${NEW_CXXFLAGS/-O}" =3D "$= {NEW_CXXFLAGS}" ]; then NEW_CXXFLAGS=3D"${NEW_CXXFLAGS} -O2" fi + if [ "${FFLAGS/-O}" !=3D "${FFLAGS}" -a "${NEW_FFLAGS/-O}" =3D "${NEW_F= FLAGS}" ]; then + NEW_FFLAGS=3D"${NEW_FFLAGS} -O2" + fi + if [ "${FCFLAGS/-O}" !=3D "${FCFLAGS}" -a "${NEW_FCFLAGS/-O}" =3D "${NE= W_FCFLAGS}" ]; then + NEW_FCFLAGS=3D"${NEW_FCFLAGS} -O2" + fi =20 set +f # re-enable pathname expansion =20 export CFLAGS=3D"${NEW_CFLAGS}" export CXXFLAGS=3D"${NEW_CXXFLAGS}" + export FFLAGS=3D"${NEW_FFLAGS}" + export FCFLAGS=3D"${NEW_FCFLAGS}" return 0 } =20 @@ -349,6 +394,18 @@ # Returns shell true if is supported by the C++ compiler, else re= turns shell false. test-flag-CXX() { test-flag-PROG "CXX" "$1"; } =20 +# @FUNCTION: test-flag-F77 +# @USAGE: +# @DESCRIPTION: +# Returns shell true if is supported by the Fortran 77 compiler, = else returns shell false. +test-flag-F77() { test-flag-PROG "F77" "$1"; } + +# @FUNCTION: test-flag-FC +# @USAGE: +# @DESCRIPTION: +# Returns shell true if is supported by the Fortran 90 compiler, = else returns shell false. +test-flag-FC() { test-flag-PROG "FC" "$1"; } + test-flags-PROG() { local comp=3D$1 local flags @@ -381,6 +438,18 @@ # Returns shell true if are supported by the C++ compiler, else = returns shell false. test-flags-CXX() { test-flags-PROG "CXX" "$@"; } =20 +# @FUNCTION: test-flags-F77 +# @USAGE: +# @DESCRIPTION: +# Returns shell true if are supported by the Fortran 77 compiler= , else returns shell false. +test-flags-F77() { test-flags-PROG "F77" "$@"; } + +# @FUNCTION: test-flags-FC +# @USAGE: +# @DESCRIPTION: +# Returns shell true if are supported by the Fortran 90 compiler= , else returns shell false. +test-flags-FC() { test-flags-PROG "FC" "$@"; } + # @FUNCTION: test-flags # @USAGE: # @DESCRIPTION: @@ -412,10 +481,12 @@ =20 # @FUNCTION: strip-unsupported-flags # @DESCRIPTION: -# Strip C[XX]FLAGS of any flags not supported by the active toolchain. +# Strip {C,CXX,F,FC}FLAGS of any flags not supported by the active toolc= hain. strip-unsupported-flags() { export CFLAGS=3D$(test-flags-CC ${CFLAGS}) export CXXFLAGS=3D$(test-flags-CXX ${CXXFLAGS}) + export FFLAGS=3D$(test-flags-F77 ${FFLAGS}) + export FCFLAGS=3D$(test-flags-FC ${FCFLAGS}) } =20 # @FUNCTION: get-flag @@ -430,7 +501,7 @@ # for example, if CFLAGS=3D"-march=3Di686": # `get-flag -march` =3D=3D "-march=3Di686" # `get-flag march` =3D=3D "i686" - for f in ${CFLAGS} ${CXXFLAGS} ; do + for f in ${CFLAGS} ${CXXFLAGS} ${FFLAGS} ${FCFLAGS} ; do if [ "${f/${findflag}}" !=3D "${f}" ] ; then printf "%s\n" "${f/-${findflag}=3D}" return 0 --=20 gentoo-commits@lists.gentoo.org mailing list