trylink: use mktemp instead of hardcoding paths
This way we respect standard tempdir env vars and are guaranteed to be unique. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
This commit is contained in:
parent
49acc1a761
commit
4a08e82d44
@ -46,7 +46,7 @@ try() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
check_cc() {
|
check_cc() {
|
||||||
local tempname="/tmp/temp.$$.$RANDOM"
|
local tempname="$(mktemp)"
|
||||||
# Can use "-o /dev/null", but older gcc tend to *unlink it* on failure! :(
|
# Can use "-o /dev/null", but older gcc tend to *unlink it* on failure! :(
|
||||||
# "-xc": C language. "/dev/null" is an empty source file.
|
# "-xc": C language. "/dev/null" is an empty source file.
|
||||||
if $CC $1 -shared -xc /dev/null -o "$tempname".o >/dev/null 2>&1; then
|
if $CC $1 -shared -xc /dev/null -o "$tempname".o >/dev/null 2>&1; then
|
||||||
@ -54,11 +54,11 @@ check_cc() {
|
|||||||
else
|
else
|
||||||
echo "$2";
|
echo "$2";
|
||||||
fi
|
fi
|
||||||
rm "$tempname".o 2>/dev/null
|
rm -f "$tempname" "$tempname".o
|
||||||
}
|
}
|
||||||
|
|
||||||
check_libc_is_glibc() {
|
check_libc_is_glibc() {
|
||||||
local tempname="/tmp/temp.$$.$RANDOM"
|
local tempname="$(mktemp)"
|
||||||
echo "\
|
echo "\
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
/* Apparently uclibc defines __GLIBC__ (compat trick?). Oh well. */
|
/* Apparently uclibc defines __GLIBC__ (compat trick?). Oh well. */
|
||||||
@ -71,7 +71,7 @@ check_libc_is_glibc() {
|
|||||||
else
|
else
|
||||||
echo "$1";
|
echo "$1";
|
||||||
fi
|
fi
|
||||||
rm "$tempname".c "$tempname".o 2>/dev/null
|
rm -f "$tempname" "$tempname".[co]
|
||||||
}
|
}
|
||||||
|
|
||||||
EXE="$1"
|
EXE="$1"
|
||||||
|
Loading…
Reference in New Issue
Block a user