From 4a08e82d441dbde5412eca6a6db894b420f203f3 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Mon, 16 Mar 2015 17:46:17 -0400 Subject: 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 --- scripts/trylink | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'scripts') diff --git a/scripts/trylink b/scripts/trylink index 5da494fbb..5a67fcfa8 100755 --- a/scripts/trylink +++ b/scripts/trylink @@ -46,7 +46,7 @@ try() { } check_cc() { - local tempname="/tmp/temp.$$.$RANDOM" + local tempname="$(mktemp)" # Can use "-o /dev/null", but older gcc tend to *unlink it* on failure! :( # "-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 @@ -54,11 +54,11 @@ check_cc() { else echo "$2"; fi - rm "$tempname".o 2>/dev/null + rm -f "$tempname" "$tempname".o } check_libc_is_glibc() { - local tempname="/tmp/temp.$$.$RANDOM" + local tempname="$(mktemp)" echo "\ #include /* Apparently uclibc defines __GLIBC__ (compat trick?). Oh well. */ @@ -71,7 +71,7 @@ check_libc_is_glibc() { else echo "$1"; fi - rm "$tempname".c "$tempname".o 2>/dev/null + rm -f "$tempname" "$tempname".[co] } EXE="$1" -- cgit v1.2.3-55-g6feb From 6798564b9e2f1a81b8c2d0cb4add97cb736d982b Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Mon, 16 Mar 2015 17:47:01 -0400 Subject: trylink: respect compiler settings when probing features The CPPFLAGS/CFLAGS settings might have features that matter, so make sure we utilize them when testing the compiler. URL: https://bugs.gentoo.org/471118 Signed-off-by: Mike Frysinger --- scripts/trylink | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/trylink b/scripts/trylink index 5a67fcfa8..48c487bcd 100755 --- a/scripts/trylink +++ b/scripts/trylink @@ -49,7 +49,7 @@ check_cc() { local tempname="$(mktemp)" # Can use "-o /dev/null", but older gcc tend to *unlink it* on failure! :( # "-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 $CPPFLAGS $CFLAGS $1 -shared -xc /dev/null -o "$tempname".o >/dev/null 2>&1; then echo "$1"; else echo "$2"; @@ -66,7 +66,7 @@ check_libc_is_glibc() { syntax error here #endif " >"$tempname".c - if $CC "$tempname".c -c -o "$tempname".o >/dev/null 2>&1; then + if $CC $CPPFLAGS $CFLAGS "$tempname".c -c -o "$tempname".o >/dev/null 2>&1; then echo "$2"; else echo "$1"; -- cgit v1.2.3-55-g6feb