dont output to /dev/null, use a temp file instead
authorMike Frysinger <vapier@gentoo.org>
Sat, 9 Oct 2004 18:28:46 +0000 (18:28 +0000)
committerMike Frysinger <vapier@gentoo.org>
Sat, 9 Oct 2004 18:28:46 +0000 (18:28 +0000)
eclass/flag-o-matic.eclass

index 3fbb642c137f0e051034bc36d929048dbde9a9aa..fe9f66b89978999f26f68e4cf1e3c8e0e28b5270 100644 (file)
@@ -1,6 +1,6 @@
 # Copyright 1999-2004 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.71 2004/10/01 10:00:36 robbat2 Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/flag-o-matic.eclass,v 1.72 2004/10/09 18:28:46 vapier Exp $
 #
 # Author Bart Verwilst <verwilst@gentoo.org>
 
@@ -11,6 +11,9 @@ INHERITED="$INHERITED $ECLASS"
 # IUSE gets clobbered.
 IUSE="${IUSE} debug"
 
+# need access to emktemp()
+inherit eutils
+
 #
 #### filter-flags <flags> ####
 # Remove particular flags from C[XX]FLAGS
@@ -265,7 +268,7 @@ strip-flags() {
 
 test_flag() {
        local cc=${CC:-gcc} ; cc=${cc%% *}
-       if ${cc} -S -xc "$@" -o /dev/null /dev/null &>/dev/null; then
+       if ${cc} -S -xc "$@" -o "$(emktemp)" /dev/null &>/dev/null; then
                printf "%s\n" "$*"
                return 0
        fi
@@ -345,10 +348,10 @@ has_m64() {
        # actually -WORKS-. non-multilib gcc will take both -m32 and -m64!
        # please dont replace this function with test_flag in some future
        # clean-up!
-       temp=`mktemp`
+       local temp="$(emktemp)"
        echo "int main() { return(0); }" > ${temp}.c
-       ${CC/ .*/} -m64 -o /dev/null ${temp}.c > /dev/null 2>&1
-       ret=$?
+       ${CC/ .*/} -m64 -o "$(emktemp)" ${temp}.c > /dev/null 2>&1
+       local ret=$?
        rm -f ${temp}.c
        [ "$ret" != "1" ] && return 0
        return 1
@@ -359,10 +362,10 @@ has_m32() {
        # actually -WORKS-. non-multilib gcc will take both -m32 and -m64!
        # please dont replace this function with test_flag in some future
        # clean-up!
-       temp=`mktemp`
+       local temp="$(emktemp)"
        echo "int main() { return(0); }" > ${temp}.c
-       ${CC/ .*/} -m32 -o /dev/null ${temp}.c > /dev/null 2>&1
-       ret=$?
+       ${CC/ .*/} -m32 -o "$(emktemp)" ${temp}.c > /dev/null 2>&1
+       local ret=$?
        rm -f ${temp}.c
        [ "$ret" != "1" ] && return 0
        return 1