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