/[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.52 Revision 1.53
1# Copyright 1999-2003 Gentoo Technologies, Inc. 1# Copyright 1999-2003 Gentoo Technologies, Inc.
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.52 2004/05/30 02:55:58 lv Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/flag-o-matic.eclass,v 1.53 2004/06/01 04:28:38 solar 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"
272 fi 272 fi
273 done 273 done
274 return 1 274 return 1
275} 275}
276 276
277has_hardened() {
278 local cc=${CC:-gcc}
279 [[ $(${cc%% *} --version 2>&1) == *Hardened* ]]
280 return $?
281}
282
277has_pic() { 283has_pic() {
278 [ "${CFLAGS/-fPIC}" != "${CFLAGS}" ] && return 0 284 [ "${CFLAGS/-fPIC}" != "${CFLAGS}" ] && return 0
279 [ "${CFLAGS/-fpic}" != "${CFLAGS}" ] && return 0 285 [ "${CFLAGS/-fpic}" != "${CFLAGS}" ] && return 0
280 [ ! -z "`${CC/ .*/} --version| grep pie`" ] && return 0 286 [ ! -z "`${CC/ .*/} --version| grep pie`" ] && return 0
281 return 1 287 return 1
339 LDFLAGS="${LDFLAGS:1:${#LDFLAGS}-2}" 345 LDFLAGS="${LDFLAGS:1:${#LDFLAGS}-2}"
340 return 0 346 return 0
341} 347}
342 348
343etexec-flags() { 349etexec-flags() {
350 # if your not using a hardened compiler you wont need this
351 # PIC/no-pic kludge in the first place.
352 has_hardened || return
353
344 has_pie || has_pic 354 has_pie || has_pic
345 if [ $? == 0 ] ; then 355 if [ $? == 0 ] ; then
346 [ -z "`is-flag -fno-pic`" ] && 356 [ -z "`is-flag -fno-pic`" ] &&
347 export CFLAGS="${CFLAGS} `test_flag -fno-pic`" 357 export CFLAGS="${CFLAGS} `test_flag -fno-pic`"
348 358

Legend:
Removed from v.1.52  
changed lines
  Added in v.1.53

  ViewVC Help
Powered by ViewVC 1.1.20