/[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.150 Revision 1.151
1# Copyright 1999-2009 Gentoo Foundation 1# Copyright 1999-2009 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.150 2011/02/25 10:51:44 dirtyepic Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/flag-o-matic.eclass,v 1.151 2011/07/12 03:58:11 vapier Exp $
4 4
5# @ECLASS: flag-o-matic.eclass 5# @ECLASS: flag-o-matic.eclass
6# @MAINTAINER: 6# @MAINTAINER:
7# toolchain@gentoo.org 7# toolchain@gentoo.org
8# @BLURB: common functions to manipulate and query toolchain flags 8# @BLURB: common functions to manipulate and query toolchain flags
485# @DESCRIPTION: 485# @DESCRIPTION:
486# Short-hand that should hopefully work for both C and C++ compiler, but 486# Short-hand that should hopefully work for both C and C++ compiler, but
487# its really only present due to the append-flags() abomination. 487# its really only present due to the append-flags() abomination.
488test-flags() { test-flags-CC "$@"; } 488test-flags() { test-flags-CC "$@"; }
489 489
490# @FUNCTION: test_flag
491# @DESCRIPTION:
492# DEPRICIATED, use test-flags()
493test_flag() {
494 ewarn "test_flag: deprecated, please use test-flags()!" >&2
495
496 test-flags-CC "$@"
497}
498
499# @FUNCTION: test_version_info 490# @FUNCTION: test_version_info
500# @USAGE: <version> 491# @USAGE: <version>
501# @DESCRIPTION: 492# @DESCRIPTION:
502# Returns shell true if the current C compiler version matches <version>, else returns shell false. 493# Returns shell true if the current C compiler version matches <version>, else returns shell false.
503# Accepts shell globs. 494# Accepts shell globs.
538 fi 529 fi
539 done 530 done
540 return 1 531 return 1
541} 532}
542 533
543# @FUNCTION: has_hardened 534# DEAD FUNCS. Remove by Dec 2011.
544# @DESCRIPTION: 535test_flag() { die "$0: deprecated, please use test-flags()!" ; }
545# DEPRECATED - use gcc-specs-relro or gcc-specs-now from toolchain-funcs
546has_hardened() {
547 ewarn "has_hardened: deprecated, please use gcc-specs-{relro,now}()!" >&2 536has_hardened() { die "$0: deprecated, please use gcc-specs-{relro,now}()!" ; }
548
549 test_version_info Hardened && return 0
550 # The specs file wont exist unless gcc has GCC_SPECS support
551 [[ -f ${GCC_SPECS} && ${GCC_SPECS} != ${GCC_SPECS/hardened/} ]]
552}
553
554# @FUNCTION: has_pic
555# @DESCRIPTION:
556# DEPRECATED - use gcc-specs-pie from toolchain-funcs
557# indicate whether PIC is set
558has_pic() {
559 ewarn "has_pic: deprecated, please use gcc-specs-pie()!" >&2 537has_pic() { die "$0: deprecated, please use gcc-specs-pie()!" ; }
560
561 [[ ${CFLAGS/-fPIC} != ${CFLAGS} || \
562 ${CFLAGS/-fpic} != ${CFLAGS} ]] || \
563 gcc-specs-pie
564}
565
566# @FUNCTION: has_pie
567# @DESCRIPTION:
568# DEPRECATED - use gcc-specs-pie from toolchain-funcs
569# indicate whether PIE is set
570has_pie() {
571 ewarn "has_pie: deprecated, please use gcc-specs-pie()!" >&2 538has_pie() { die "$0: deprecated, please use gcc-specs-pie()!" ; }
572
573 [[ ${CFLAGS/-fPIE} != ${CFLAGS} || \
574 ${CFLAGS/-fpie} != ${CFLAGS} ]] || \
575 gcc-specs-pie
576}
577
578# @FUNCTION: has_ssp_all
579# @DESCRIPTION:
580# DEPRECATED - use gcc-specs-ssp from toolchain-funcs
581# indicate whether code for SSP is being generated for all functions
582has_ssp_all() {
583 ewarn "has_ssp_all: deprecated, please use gcc-specs-ssp()!" >&2 539has_ssp_all() { die "$0: deprecated, please use gcc-specs-ssp()!" ; }
584
585 # note; this matches only -fstack-protector-all
586 [[ ${CFLAGS/-fstack-protector-all} != ${CFLAGS} || \
587 -n $(echo | $(tc-getCC) ${CFLAGS} -E -dM - | grep __SSP_ALL__) ]] || \
588 gcc-specs-ssp-to-all
589}
590
591# @FUNCTION: has_ssp
592# @DESCRIPTION:
593# DEPRECATED - use gcc-specs-ssp from toolchain-funcs
594# indicate whether code for SSP is being generated
595has_ssp() {
596 ewarn "has_ssp: deprecated, please use gcc-specs-ssp()!" >&2 540has_ssp() { die "$0: deprecated, please use gcc-specs-ssp()!" ; }
597
598 # note; this matches both -fstack-protector and -fstack-protector-all
599 [[ ${CFLAGS/-fstack-protector} != ${CFLAGS} || \
600 -n $(echo | $(tc-getCC) ${CFLAGS} -E -dM - | grep __SSP__) ]] || \
601 gcc-specs-ssp
602}
603 541
604# @FUNCTION: has_m64 542# @FUNCTION: has_m64
605# @DESCRIPTION: 543# @DESCRIPTION:
606# This doesn't test if the flag is accepted, it tests if the flag actually 544# This doesn't test if the flag is accepted, it tests if the flag actually
607# WORKS. Non-multilib gcc will take both -m32 and -m64. If the flag works 545# WORKS. Non-multilib gcc will take both -m32 and -m64. If the flag works

Legend:
Removed from v.1.150  
changed lines
  Added in v.1.151

  ViewVC Help
Powered by ViewVC 1.1.20