/[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.48 Revision 1.65
1# Copyright 1999-2003 Gentoo Technologies, Inc. 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.48 2004/05/06 02:36:37 vapier Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/flag-o-matic.eclass,v 1.65 2004/07/27 19:25:49 vapier 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
10# Please leave ${IUSE} in this until portage .51 is stable, otherwise
11# IUSE gets clobbered.
12IUSE="${IUSE} debug"
9 13
10# 14#
11#### filter-flags <flags> #### 15#### filter-flags <flags> ####
12# Remove particular flags from C[XX]FLAGS 16# Remove particular flags from C[XX]FLAGS
13# Matches only complete flags 17# Matches only complete flags
52#### filter-ldflags <flags> #### 56#### filter-ldflags <flags> ####
53# Remove particular flags from LDFLAGS 57# Remove particular flags from LDFLAGS
54# Matches only complete flags 58# Matches only complete flags
55# 59#
56#### etexec-flags #### 60#### etexec-flags ####
57# hooked function for hardened-gcc that appends 61# hooked function for hardened gcc that appends
58# -yet_exec {C,CXX,LD}FLAGS when hardened-gcc is installed 62# -fno-pic to {C,CXX,LD}FLAGS
59# and a package is filtering -fPIC,-fpic, -fPIE, -fpie 63# when a package is filtering -fpic, -fPIC, -fpie, -fPIE
60# 64#
61#### fstack-flags #### 65#### fstack-flags ####
62# hooked function for hardened-gcc that appends 66# hooked function for hardened gcc that appends
63# -yno_propolice to {C,CXX,LD}FLAGS when hardened-gcc is installed 67# -fno-stack-protector to {C,CXX,LD}FLAGS
64# and a package is filtering -fstack-protector, -fstack-protector-all 68# when a package is filtering -fstack-protector, -fstack-protector-all
69# notice: modern automatic specs files will also suppress -fstack-protector-all
70# when only -fno-stack-protector is given
65# 71#
66 72
67# C[XX]FLAGS that we allow in strip-flags 73# C[XX]FLAGS that we allow in strip-flags
68setup-allowed-flags() { 74setup-allowed-flags() {
69 if [ -z "${ALLOWED_FLAGS}" ] ; then 75 if [ -z "${ALLOWED_FLAGS}" ] ; then
70 export ALLOWED_FLAGS="-O -O1 -O2 -mcpu -march -mtune -fstack-protector -pipe -g" 76 export ALLOWED_FLAGS="-O -O1 -O2 -mcpu -march -mtune -fstack-protector -fno-unit-at-a-time -pipe -g"
71 case "${ARCH}" in 77 case "${ARCH}" in
72 mips) ALLOWED_FLAGS="${ALLOWED_FLAGS} -mips1 -mips2 -mips3 -mips4 -mabi" ;; 78 mips) ALLOWED_FLAGS="${ALLOWED_FLAGS} -mips1 -mips2 -mips3 -mips4 -mabi" ;;
73 amd64) ALLOWED_FLAGS="${ALLOWED_FLAGS} -fPIC" ;; 79 amd64) ALLOWED_FLAGS="${ALLOWED_FLAGS} -fPIC -m64" ;;
80 x86) ALLOWED_FLAGS="${ALLOWED_FLAGS} -m32" ;;
74 alpha) ALLOWED_FLAGS="${ALLOWED_FLAGS} -fPIC" ;; 81 alpha) ALLOWED_FLAGS="${ALLOWED_FLAGS} -fPIC" ;;
75 ia64) ALLOWED_FLAGS="${ALLOWED_FLAGS} -fPIC" ;; 82 ia64) ALLOWED_FLAGS="${ALLOWED_FLAGS} -fPIC" ;;
76 esac 83 esac
77 fi 84 fi
85 # allow a bunch of flags that negate features / control ABI
86 ALLOWED_FLAGS="${ALLOWED_FLAGS} -fno-stack-protector -fno-stack-protector-all"
87 case "${ARCH}" in
88 x86|amd64|ia64) ALLOWED_FLAGS="${ALLOWED_FLAGS} -mno-mmx -mno-sse -mno-sse2 -mno-sse3 -mno-3dnow" ;;
89 esac
90 ALLOWED_FLAGS="${ALLOWED_FLAGS} -mregparm -mno-app-regs -mapp-regs -msoft-float -mflat -mno-faster-structs -mfaster-structs -mlittle-endian -mbig-endian -mlive-g0 -mcmodel -mno-stack-bias -mstack-bias"
78 91
79 # C[XX]FLAGS that we are think is ok, but needs testing 92 # C[XX]FLAGS that we are think is ok, but needs testing
80 # NOTE: currently -Os have issues with gcc3 and K6* arch's 93 # NOTE: currently -Os have issues with gcc3 and K6* arch's
81 export UNSTABLE_FLAGS="-Os -O3 -freorder-blocks -fprefetch-loop-arrays" 94 export UNSTABLE_FLAGS="-Os -O3 -freorder-blocks -fprefetch-loop-arrays"
82 return 0 95 return 0
83} 96}
84 97
85filter-flags() { 98filter-flags() {
99 local x f fset
100 declare -a new_CFLAGS new_CXXFLAGS
101
86 for x in "$@" ; do 102 for x in "$@" ; do
87 case "${x}" in 103 case "${x}" in
88 -fPIC|-fpic|-fPIE|-fpie|-pie) etexec-flags;; 104 -fPIC|-fpic|-fPIE|-fpie|-pie) etexec-flags;;
89 -fstack-protector|-fstack-protector-all) fstack-flags;; 105 -fstack-protector|-fstack-protector-all) fstack-flags;;
90 *) ;;
91 esac 106 esac
92 done 107 done
93 108
94 # we do this fancy spacing stuff so as to not filter 109 for fset in CFLAGS CXXFLAGS; do
95 # out part of a flag ... we want flag atoms ! :D 110 # Looping over the flags instead of using a global
96 CFLAGS=" ${CFLAGS} " 111 # substitution ensures that we're working with flag atoms.
97 CXXFLAGS=" ${CXXFLAGS} " 112 # Otherwise globs like -O* have the potential to wipe out the
113 # list of flags.
114 for f in ${!fset}; do
98 for x in "$@" ; do 115 for x in "$@"; do
99 CFLAGS="${CFLAGS// ${x} / }" 116 # Note this should work with globs like -O*
100 CXXFLAGS="${CXXFLAGS// ${x} / }" 117 [[ ${f} == ${x} ]] && continue 2
118 done
119 eval new_${fset}\[\${\#new_${fset}\[@]}]=\${f}
101 done 120 done
102 CFLAGS="${CFLAGS:1:${#CFLAGS}-2}" 121 eval export ${fset}=\${new_${fset}\[*]}
103 CXXFLAGS="${CXXFLAGS:1:${#CXXFLAGS}-2}" 122 done
123
104 return 0 124 return 0
105} 125}
106 126
107filter-lfs-flags() { 127filter-lfs-flags() {
108 filter-flags -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE 128 filter-flags -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
111append-lfs-flags() { 131append-lfs-flags() {
112 append-flags -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE 132 append-flags -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
113} 133}
114 134
115append-flags() { 135append-flags() {
116 export CFLAGS="${CFLAGS} $@" 136 export CFLAGS="${CFLAGS} $*"
117 export CXXFLAGS="${CXXFLAGS} $@" 137 export CXXFLAGS="${CXXFLAGS} $*"
118 [ "`is-flag -fno-stack-protector`" -o "`is-flag -fno-stack-protector-all`" ] && fstack-flags 138 [ -n "`is-flag -fno-stack-protector`" -o \
139 -n "`is-flag -fno-stack-protector-all`" ] && fstack-flags
119 return 0 140 return 0
120} 141}
121 142
122replace-flags() { 143replace-flags() {
123 # we do this fancy spacing stuff so as to not filter 144 local f fset
124 # out part of a flag ... we want flag atoms ! :D 145 declare -a new_CFLAGS new_CXXFLAGS
125 CFLAGS=" ${CFLAGS} " 146
126 CXXFLAGS=" ${CXXFLAGS} " 147 for fset in CFLAGS CXXFLAGS; do
127 CFLAGS="${CFLAGS// ${1} / ${2} }" 148 # Looping over the flags instead of using a global
128 CXXFLAGS="${CXXFLAGS// ${1} / ${2} }" 149 # substitution ensures that we're working with flag atoms.
129 CFLAGS="${CFLAGS:1:${#CFLAGS}-2}" 150 # Otherwise globs like -O* have the potential to wipe out the
130 CXXFLAGS="${CXXFLAGS:1:${#CXXFLAGS}-2}" 151 # list of flags.
152 for f in ${!fset}; do
153 # Note this should work with globs like -O*
154 [[ ${f} == ${1} ]] && f=${2}
155 eval new_${fset}\[\${\#new_${fset}\[@]}]=\${f}
156 done
157 eval export ${fset}=\${new_${fset}\[*]}
158 done
159
131 return 0 160 return 0
132} 161}
133 162
134replace-cpu-flags() { 163replace-cpu-flags() {
135 local newcpu="$1" ; shift 164 local oldcpu newcpu="$1" ; shift
136 local oldcpu=""
137 for oldcpu in "$@" ; do 165 for oldcpu in "$@" ; do
166 # quote to make sure that no globbing is done (particularly on
167 # ${oldcpu} prior to calling replace-flags
138 replace-flags -march=${oldcpu} -march=${newcpu} 168 replace-flags "-march=${oldcpu}" "-march=${newcpu}"
139 replace-flags -mcpu=${oldcpu} -mcpu=${newcpu} 169 replace-flags "-mcpu=${oldcpu}" "-mcpu=${newcpu}"
140 replace-flags -mtune=${oldcpu} -mtune=${newcpu} 170 replace-flags "-mtune=${oldcpu}" "-mtune=${newcpu}"
141 done 171 done
142 return 0 172 return 0
143} 173}
144 174
145is-flag() { 175is-flag() {
176 local x
177
146 for x in ${CFLAGS} ${CXXFLAGS} ; do 178 for x in ${CFLAGS} ${CXXFLAGS} ; do
147 if [ "${x}" == "$1" ] ; then 179 if [ "${x}" == "$1" ] ; then
148 echo true 180 echo true
149 return 0 181 return 0
150 fi 182 fi
151 done 183 done
152 return 1 184 return 1
153} 185}
154 186
155filter-mfpmath() { 187filter-mfpmath() {
188 local orig_mfpmath new_math prune_math
189
156 # save the original -mfpmath flag 190 # save the original -mfpmath flag
157 local orig_mfpmath="`get-flag -mfpmath`" 191 orig_mfpmath="`get-flag -mfpmath`"
158 # get the value of the current -mfpmath flag 192 # get the value of the current -mfpmath flag
159 local new_math=" `get-flag mfpmath | tr , ' '` " 193 new_math=" `get-flag mfpmath | tr , ' '` "
160 # figure out which math values are to be removed 194 # figure out which math values are to be removed
161 local prune_math="" 195 prune_math=""
162 for prune_math in "$@" ; do 196 for prune_math in "$@" ; do
163 new_math="${new_math/ ${prune_math} / }" 197 new_math="${new_math/ ${prune_math} / }"
164 done 198 done
165 new_math="`echo ${new_math:1:${#new_math}-2} | tr ' ' ,`" 199 new_math="`echo ${new_math:1:${#new_math}-2} | tr ' ' ,`"
166 200
175 fi 209 fi
176 return 0 210 return 0
177} 211}
178 212
179strip-flags() { 213strip-flags() {
214 local x y flag NEW_CFLAGS NEW_CXXFLAGS
215
180 setup-allowed-flags 216 setup-allowed-flags
181 217
182 local NEW_CFLAGS="" 218 local NEW_CFLAGS=""
183 local NEW_CXXFLAGS="" 219 local NEW_CXXFLAGS=""
184 220
185 # Allow unstable C[XX]FLAGS if we are using unstable profile ... 221 # Allow unstable C[XX]FLAGS if we are using unstable profile ...
186 if [ `has ~${ARCH} ${ACCEPT_KEYWORDS}` ] ; then 222 if has ~${ARCH} ${ACCEPT_KEYWORDS} ; then
187 [ `use debug` ] && einfo "Enabling the use of some unstable flags" 223 use debug && einfo "Enabling the use of some unstable flags"
188 ALLOWED_FLAGS="${ALLOWED_FLAGS} ${UNSTABLE_FLAGS}" 224 ALLOWED_FLAGS="${ALLOWED_FLAGS} ${UNSTABLE_FLAGS}"
189 fi 225 fi
190 226
191 set -f 227 set -f # disable pathname expansion
192 228
193 for x in ${CFLAGS} 229 for x in ${CFLAGS}; do
194 do
195 for y in ${ALLOWED_FLAGS} 230 for y in ${ALLOWED_FLAGS}; do
196 do
197 flag=${x%%=*} 231 flag=${x%%=*}
198 if [ "${flag%%${y}}" = "" ] 232 if [ "${flag%%${y}}" = "" ] ; then
199 then
200 NEW_CFLAGS="${NEW_CFLAGS} ${x}" 233 NEW_CFLAGS="${NEW_CFLAGS} ${x}"
201 break 234 break
202 fi 235 fi
203 done 236 done
204 done 237 done
205 238
206 for x in ${CXXFLAGS} 239 for x in ${CXXFLAGS}; do
207 do
208 for y in ${ALLOWED_FLAGS} 240 for y in ${ALLOWED_FLAGS}; do
209 do
210 flag=${x%%=*} 241 flag=${x%%=*}
211 if [ "${flag%%${y}}" = "" ] 242 if [ "${flag%%${y}}" = "" ] ; then
212 then
213 NEW_CXXFLAGS="${NEW_CXXFLAGS} ${x}" 243 NEW_CXXFLAGS="${NEW_CXXFLAGS} ${x}"
214 break 244 break
215 fi 245 fi
216 done 246 done
217 done 247 done
222 fi 252 fi
223 if [ "${CXXFLAGS/-O}" != "${CXXFLAGS}" -a "${NEW_CXXFLAGS/-O}" = "${NEW_CXXFLAGS}" ]; then 253 if [ "${CXXFLAGS/-O}" != "${CXXFLAGS}" -a "${NEW_CXXFLAGS/-O}" = "${NEW_CXXFLAGS}" ]; then
224 NEW_CXXFLAGS="${NEW_CXXFLAGS} -O2" 254 NEW_CXXFLAGS="${NEW_CXXFLAGS} -O2"
225 fi 255 fi
226 256
227 set +f 257 set +f # re-enable pathname expansion
228
229 [ `use debug` ] \
230 && einfo "CFLAGS=\"${NEW_CFLAGS}\"" \
231 && einfo "CXXFLAGS=\"${NEW_CXXFLAGS}\""
232 258
233 export CFLAGS="${NEW_CFLAGS}" 259 export CFLAGS="${NEW_CFLAGS}"
234 export CXXFLAGS="${NEW_CXXFLAGS}" 260 export CXXFLAGS="${NEW_CXXFLAGS}"
235 return 0 261 return 0
236} 262}
237 263
238test_flag() { 264test_flag() {
265 local cc=${CC:-gcc} ; cc=${cc%% *}
239 if [ -z "`gcc -S -xc "$@" -o /dev/null /dev/null 2>&1`" ]; then 266 if ${cc} -S -xc "$@" -o /dev/null /dev/null &>/dev/null; then
240 echo "$@" 267 printf "%s\n" "$*"
241 return 0 268 return 0
242 fi 269 fi
243 return 1 270 return 1
244} 271}
245 272
273test_version_info() {
274 local cc=${CC:-gcc} ; cc=${cc%% *}
275 if [[ $(${cc} --version 2>&1) == *$1* ]]; then
276 return 0
277 else
278 return 1
279 fi
280}
281
246strip-unsupported-flags() { 282strip-unsupported-flags() {
283 local NEW_CFLAGS NEW_CXXFLAGS
284
247 for x in ${CFLAGS} ; do 285 for x in ${CFLAGS} ; do
248 NEW_CFLAGS=${NEW_CFLAGS}" ""`test_flag ${x}`" 286 NEW_CFLAGS="${NEW_CFLAGS} `test_flag ${x}`"
249 done 287 done
250 for x in ${CXXFLAGS} ; do 288 for x in ${CXXFLAGS} ; do
251 NEW_CXXFLAGS=${NEW_CXXFLAGS}" ""`test_flag ${x}`" 289 NEW_CXXFLAGS="${NEW_CXXFLAGS} `test_flag ${x}`"
252 done 290 done
253 291
254 export CFLAGS="${NEW_CFLAGS}" 292 export CFLAGS="${NEW_CFLAGS}"
255 export CXXFLAGS="${NEW_CXXFLAGS}" 293 export CXXFLAGS="${NEW_CXXFLAGS}"
256} 294}
257 295
258get-flag() { 296get-flag() {
297 local f findflag="$1"
298
259 # this code looks a little flaky but seems to work for 299 # this code looks a little flaky but seems to work for
260 # everything we want ... 300 # everything we want ...
261 # for example, if CFLAGS="-march=i686": 301 # for example, if CFLAGS="-march=i686":
262 # `get-flags -march` == "-march=i686" 302 # `get-flag -march` == "-march=i686"
263 # `get-flags march` == "i686" 303 # `get-flag march` == "i686"
264 local findflag="$1"
265 for f in ${CFLAGS} ${CXXFLAGS} ; do 304 for f in ${CFLAGS} ${CXXFLAGS} ; do
266 if [ "${f/${findflag}}" != "${f}" ] ; then 305 if [ "${f/${findflag}}" != "${f}" ] ; then
267 echo "${f/-${findflag}=}" 306 printf "%s\n" "${f/-${findflag}=}"
268 return 0 307 return 0
269 fi 308 fi
270 done 309 done
271 return 1 310 return 1
311}
312
313has_hardened() {
314 test_version_info Hardened
315 return $?
272} 316}
273 317
274has_pic() { 318has_pic() {
275 [ "${CFLAGS/-fPIC}" != "${CFLAGS}" ] && return 0 319 [ "${CFLAGS/-fPIC}" != "${CFLAGS}" ] && return 0
276 [ "${CFLAGS/-fpic}" != "${CFLAGS}" ] && return 0 320 [ "${CFLAGS/-fpic}" != "${CFLAGS}" ] && return 0
277 has_version sys-devel/hardened-gcc && return 0 321 test_version_info pie && return 0
278 [ ! -z "`${CC/ .*/} --version| grep pie`" ] && return 0
279 return 1 322 return 1
280} 323}
281 324
282has_pie() { 325has_pie() {
283 [ "${CFLAGS/-fPIE}" != "${CFLAGS}" ] && return 0 326 [ "${CFLAGS/-fPIE}" != "${CFLAGS}" ] && return 0
284 [ "${CFLAGS/-fpie}" != "${CFLAGS}" ] && return 0 327 [ "${CFLAGS/-fpie}" != "${CFLAGS}" ] && return 0
285 has_version sys-devel/hardened-gcc && return 0 328 test_version_info pie && return 0
286 [ ! -z "`${CC/ .*/} --version| grep pie`" ] && return 0
287 return 1 329 return 1
288} 330}
289 331
290has_ssp() { 332has_ssp() {
291 [ "${CFLAGS/-fstack-protector}" != "${CFLAGS}" ] && return 0 333 [ "${CFLAGS/-fstack-protector}" != "${CFLAGS}" ] && return 0
292 has_version sys-devel/hardened-gcc && return 0 334 test_version_info ssp && return 0
293 [ ! -z "`${CC/ .*/} --version| grep ssp`" ] && return 0 335 return 1
336}
337
338has_m64() {
339 # this doesnt test if the flag is accepted, it tests if the flag
340 # actually -WORKS-. non-multilib gcc will take both -m32 and -m64!
341 # please dont replace this function with test_flag in some future
342 # clean-up!
343 temp=`mktemp`
344 echo "int main() { return(0); }" > ${temp}.c
345 ${CC/ .*/} -m64 -o /dev/null ${temp}.c > /dev/null 2>&1
346 ret=$?
347 rm -f ${temp}.c
348 [ "$ret" != "1" ] && return 0
349 return 1
350}
351
352has_m32() {
353 # this doesnt test if the flag is accepted, it tests if the flag
354 # actually -WORKS-. non-multilib gcc will take both -m32 and -m64!
355 # please dont replace this function with test_flag in some future
356 # clean-up!
357 temp=`mktemp`
358 echo "int main() { return(0); }" > ${temp}.c
359 ${CC/ .*/} -m32 -o /dev/null ${temp}.c > /dev/null 2>&1
360 ret=$?
361 rm -f ${temp}.c
362 [ "$ret" != "1" ] && return 0
294 return 1 363 return 1
295} 364}
296 365
297replace-sparc64-flags() { 366replace-sparc64-flags() {
298 local SPARC64_CPUS="ultrasparc v9" 367 local SPARC64_CPUS="ultrasparc v9"
299 368
300 if [ "${CFLAGS/mtune}" != "${CFLAGS}" ] 369 if [ "${CFLAGS/mtune}" != "${CFLAGS}" ]; then
301 then
302 for x in ${SPARC64_CPUS} 370 for x in ${SPARC64_CPUS}; do
303 do
304 CFLAGS="${CFLAGS/-mcpu=${x}/-mcpu=v8}" 371 CFLAGS="${CFLAGS/-mcpu=${x}/-mcpu=v8}"
305 done 372 done
306 else 373 else
307 for x in ${SPARC64_CPUS} 374 for x in ${SPARC64_CPUS}; do
308 do
309 CFLAGS="${CFLAGS/-mcpu=${x}/-mcpu=v8 -mtune=${x}}" 375 CFLAGS="${CFLAGS/-mcpu=${x}/-mcpu=v8 -mtune=${x}}"
310 done 376 done
311 fi 377 fi
312 378
313 if [ "${CXXFLAGS/mtune}" != "${CXXFLAGS}" ] 379 if [ "${CXXFLAGS/mtune}" != "${CXXFLAGS}" ]; then
314 then
315 for x in ${SPARC64_CPUS} 380 for x in ${SPARC64_CPUS}; do
316 do
317 CXXFLAGS="${CXXFLAGS/-mcpu=${x}/-mcpu=v8}" 381 CXXFLAGS="${CXXFLAGS/-mcpu=${x}/-mcpu=v8}"
318 done 382 done
319 else 383 else
320 for x in ${SPARC64_CPUS} 384 for x in ${SPARC64_CPUS}; do
321 do
322 CXXFLAGS="${CXXFLAGS/-mcpu=${x}/-mcpu=v8 -mtune=${x}}" 385 CXXFLAGS="${CXXFLAGS/-mcpu=${x}/-mcpu=v8 -mtune=${x}}"
323 done 386 done
324 fi 387 fi
388
389 export CFLAGS CXXFLAGS
325} 390}
326 391
327append-ldflags() { 392append-ldflags() {
328 LDFLAGS="${LDFLAGS} $@" 393 export LDFLAGS="${LDFLAGS} $*"
329 return 0 394 return 0
330} 395}
331 396
332filter-ldflags() { 397filter-ldflags() {
398 local x
399
333 # we do this fancy spacing stuff so as to not filter 400 # we do this fancy spacing stuff so as to not filter
334 # out part of a flag ... we want flag atoms ! :D 401 # out part of a flag ... we want flag atoms ! :D
335 LDFLAGS=" ${LDFLAGS} " 402 LDFLAGS=" ${LDFLAGS} "
336 for x in "$@" ; do 403 for x in "$@" ; do
337 LDFLAGS="${LDFLAGS// ${x} / }" 404 LDFLAGS="${LDFLAGS// ${x} / }"
338 done 405 done
339 LDFLAGS="${LDFLAGS:1:${#LDFLAGS}-2}" 406 LDFLAGS="${LDFLAGS:1:${#LDFLAGS}-2}"
407 export LDFLAGS
340 return 0 408 return 0
341} 409}
342 410
343etexec-flags() { 411etexec-flags() {
412 # if you're not using a hardened compiler you wont need this
413 # PIC/no-pic kludge in the first place.
414 has_hardened || return 0
415
344 has_pie || has_pic 416 if has_pie || has_pic; then
345 if [ $? == 0 ] ; then
346 [ -z "`is-flag -yet_exec`" ] && 417 [ -z "`is-flag -fno-pic`" ] &&
347 export CFLAGS="${CFLAGS} `test_flag -yet_exec`" 418 export CFLAGS="${CFLAGS} `test_flag -fno-pic`"
348 [ -z "`is-flag -nopie`" ] && 419 [ -z "`is-flag -nopie`" ] &&
349 export CFLAGS="${CFLAGS} `test_flag -nopie`" 420 export CFLAGS="${CFLAGS} `test_flag -nopie`"
350 fi 421 fi
422 return 0
351} 423}
352 424
353fstack-flags() { 425fstack-flags() {
354 has_ssp 426 if has_ssp; then
355 if [ $? == 0 ] ; then
356 [ -z "`is-flag -yno_propolice`" ] && 427 [ -z "`is-flag -fno-stack-protector`" ] &&
357 export CFLAGS="${CFLAGS} `test_flag -fno-stack-protector`" 428 export CFLAGS="${CFLAGS} `test_flag -fno-stack-protector`"
358 fi 429 fi
430 return 0
359} 431}

Legend:
Removed from v.1.48  
changed lines
  Added in v.1.65

  ViewVC Help
Powered by ViewVC 1.1.20