/[gentoo-x86]/eclass/flag-o-matic.eclass
Gentoo

Diff of /eclass/flag-o-matic.eclass

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

Revision 1.74 Revision 1.79
1# Copyright 1999-2004 Gentoo Foundation 1# Copyright 1999-2004 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/flag-o-matic.eclass,v 1.74 2004/10/21 07:40:47 kugelfang Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/flag-o-matic.eclass,v 1.79 2004/12/25 18:45:56 chriswhite Exp $
4# 4#
5# Author Bart Verwilst <verwilst@gentoo.org> 5# Author Bart Verwilst <verwilst@gentoo.org>
6 6
7ECLASS=flag-o-matic 7ECLASS=flag-o-matic
8INHERITED="$INHERITED $ECLASS" 8INHERITED="$INHERITED $ECLASS"
9 9
10# Please leave ${IUSE} in this until portage .51 is stable, otherwise
11# IUSE gets clobbered.
12IUSE="${IUSE} debug" 10IUSE="debug"
13 11
14# need access to emktemp() 12# need access to emktemp()
15inherit eutils toolchain-funcs 13inherit eutils toolchain-funcs
16 14
17# 15#
74# 72#
75 73
76# C[XX]FLAGS that we allow in strip-flags 74# C[XX]FLAGS that we allow in strip-flags
77setup-allowed-flags() { 75setup-allowed-flags() {
78 if [ -z "${ALLOWED_FLAGS}" ] ; then 76 if [ -z "${ALLOWED_FLAGS}" ] ; then
79 export ALLOWED_FLAGS="-O -O1 -O2 -mcpu -march -mtune -fstack-protector -fno-stack-protector -fno-pie -fno-unit-at-a-time -pipe -g" 77 export ALLOWED_FLAGS="-pipe"
78 export ALLOWED_FLAGS="${ALLOWED_FLAGS} -O -O0 -O1 -O2 -mcpu -march -mtune"
79 export ALLOWED_FLAGS="${ALLOWED_FLAGS} -fstack-protector -fno-stack-protector"
80 export ALLOWED_FLAGS="${ALLOWED_FLAGS} -fno-pie -fno-unit-at-a-time"
81 export ALLOWED_FLAGS="${ALLOWED_FLAGS} -g -g0 -g1 -g2 -g3 -ggdb -ggdb0 -ggdb1 -ggdb2 -ggdb3"
80 case "${ARCH}" in 82 case "${ARCH}" in
81 mips) ALLOWED_FLAGS="${ALLOWED_FLAGS} -mips1 -mips2 -mips3 -mips4 -mips32 -mips64 -mips16 -EL -EB -mabi" ;; 83 mips) ALLOWED_FLAGS="${ALLOWED_FLAGS} -mips1 -mips2 -mips3 -mips4 -mips32 -mips64 -mips16 -EL -EB -mabi" ;;
82 amd64) ALLOWED_FLAGS="${ALLOWED_FLAGS} -fPIC -m64" ;; 84 amd64) ALLOWED_FLAGS="${ALLOWED_FLAGS} -fPIC -m64" ;;
83 x86) ALLOWED_FLAGS="${ALLOWED_FLAGS} -m32" ;; 85 x86) ALLOWED_FLAGS="${ALLOWED_FLAGS} -m32" ;;
84 alpha) ALLOWED_FLAGS="${ALLOWED_FLAGS} -fPIC" ;; 86 alpha) ALLOWED_FLAGS="${ALLOWED_FLAGS} -fPIC" ;;
85 ia64) ALLOWED_FLAGS="${ALLOWED_FLAGS} -fPIC" ;; 87 ia64) ALLOWED_FLAGS="${ALLOWED_FLAGS} -fPIC" ;;
88 sparc) ALLOWED_FLAGS="${ALLOWED_FLAGS} -m32 -m64" ;;
89 ppc) ALLOWED_FLAGS="${ALLOWED_FLAGS} -mabi" ;;
86 esac 90 esac
87 fi 91 fi
88 # allow a bunch of flags that negate features / control ABI 92 # allow a bunch of flags that negate features / control ABI
89 ALLOWED_FLAGS="${ALLOWED_FLAGS} -fno-stack-protector -fno-stack-protector-all" 93 ALLOWED_FLAGS="${ALLOWED_FLAGS} -fno-stack-protector -fno-stack-protector-all"
90 case "${ARCH}" in 94 case "${ARCH}" in
265 export CXXFLAGS="${NEW_CXXFLAGS}" 269 export CXXFLAGS="${NEW_CXXFLAGS}"
266 return 0 270 return 0
267} 271}
268 272
269test_flag() { 273test_flag() {
270 local cc=${CC:-gcc} ; cc=${cc%% *}
271 if ${cc} -S -xc "$@" -o "$(emktemp)" /dev/null &>/dev/null; then 274 if $(tc-getCC) -S -xc "$@" -o "$(emktemp)" /dev/null &>/dev/null; then
272 printf "%s\n" "$*" 275 printf "%s\n" "$*"
273 return 0 276 return 0
274 fi 277 fi
275 return 1 278 return 1
276} 279}
277 280
278test_version_info() { 281test_version_info() {
279 local cc=${CC:-gcc} ; cc=${cc%% *}
280 if [[ $(${cc} --version 2>&1) == *$1* ]]; then 282 if [[ $($(tc-getCC) --version 2>&1) == *$1* ]]; then
281 return 0 283 return 0
282 else 284 else
283 return 1 285 return 1
284 fi 286 fi
285} 287}
420 422
421etexec-flags() { 423etexec-flags() {
422 # if you're not using a hardened compiler you wont need this 424 # if you're not using a hardened compiler you wont need this
423 # PIC/no-pic kludge in the first place. 425 # PIC/no-pic kludge in the first place.
424 has_hardened || return 0 426 has_hardened || return 0
425 # this kludge breaks on amd64, and probably other -fPIC dependant
426 # archs.
427 use amd64 && return 0 427 use amd64 && return 0
428 use mips && return 0
428 429
429 if has_pie || has_pic; then 430 if has_pie || has_pic; then
430 [ -z "`is-flag -fno-pic`" ] && 431 [ -z "`is-flag -fno-pic`" ] &&
431 export CFLAGS="${CFLAGS} `test_flag -fno-pic`" 432 export CFLAGS="${CFLAGS} `test_flag -fno-pic`"
432 [ -z "`is-flag -nopie`" ] && 433 [ -z "`is-flag -nopie`" ] &&

Legend:
Removed from v.1.74  
changed lines
  Added in v.1.79

  ViewVC Help
Powered by ViewVC 1.1.20