diff options
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/trylink | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/scripts/trylink b/scripts/trylink index 5da494fbb..48c487bcd 100755 --- a/scripts/trylink +++ b/scripts/trylink | |||
@@ -46,19 +46,19 @@ try() { | |||
46 | } | 46 | } |
47 | 47 | ||
48 | check_cc() { | 48 | check_cc() { |
49 | local tempname="/tmp/temp.$$.$RANDOM" | 49 | local tempname="$(mktemp)" |
50 | # Can use "-o /dev/null", but older gcc tend to *unlink it* on failure! :( | 50 | # Can use "-o /dev/null", but older gcc tend to *unlink it* on failure! :( |
51 | # "-xc": C language. "/dev/null" is an empty source file. | 51 | # "-xc": C language. "/dev/null" is an empty source file. |
52 | if $CC $1 -shared -xc /dev/null -o "$tempname".o >/dev/null 2>&1; then | 52 | if $CC $CPPFLAGS $CFLAGS $1 -shared -xc /dev/null -o "$tempname".o >/dev/null 2>&1; then |
53 | echo "$1"; | 53 | echo "$1"; |
54 | else | 54 | else |
55 | echo "$2"; | 55 | echo "$2"; |
56 | fi | 56 | fi |
57 | rm "$tempname".o 2>/dev/null | 57 | rm -f "$tempname" "$tempname".o |
58 | } | 58 | } |
59 | 59 | ||
60 | check_libc_is_glibc() { | 60 | check_libc_is_glibc() { |
61 | local tempname="/tmp/temp.$$.$RANDOM" | 61 | local tempname="$(mktemp)" |
62 | echo "\ | 62 | echo "\ |
63 | #include <stdlib.h> | 63 | #include <stdlib.h> |
64 | /* Apparently uclibc defines __GLIBC__ (compat trick?). Oh well. */ | 64 | /* Apparently uclibc defines __GLIBC__ (compat trick?). Oh well. */ |
@@ -66,12 +66,12 @@ check_libc_is_glibc() { | |||
66 | syntax error here | 66 | syntax error here |
67 | #endif | 67 | #endif |
68 | " >"$tempname".c | 68 | " >"$tempname".c |
69 | if $CC "$tempname".c -c -o "$tempname".o >/dev/null 2>&1; then | 69 | if $CC $CPPFLAGS $CFLAGS "$tempname".c -c -o "$tempname".o >/dev/null 2>&1; then |
70 | echo "$2"; | 70 | echo "$2"; |
71 | else | 71 | else |
72 | echo "$1"; | 72 | echo "$1"; |
73 | fi | 73 | fi |
74 | rm "$tempname".c "$tempname".o 2>/dev/null | 74 | rm -f "$tempname" "$tempname".[co] |
75 | } | 75 | } |
76 | 76 | ||
77 | EXE="$1" | 77 | EXE="$1" |