aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2008-02-13 07:47:37 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2008-02-13 07:47:37 +0000
commit0a4624aece9e46b0580dd2d5867b41f6d06ef160 (patch)
treebd7dc1273e5a21ae01d1fe0c570395299a0701a7 /scripts
parent59bb4a4f50c6f0cd1d9d65f60715f35f99076e9b (diff)
downloadbusybox-0a4624aece9e46b0580dd2d5867b41f6d06ef160.tar.gz
build system: don't use -o /dev/null, old gcc can delete /dev/null!
Diffstat (limited to 'scripts')
-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() {
}
check_cc() {
- if $CC $1 -shared -o /dev/null -xc /dev/null >/dev/null 2>&1; then
+ local tempname="/tmp/temp.$$.$RANDOM"
+ # 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
echo "$1";
else
echo "$2";
fi
+ rm "$tempname".o 2>/dev/null
}
check_libc_is_glibc() {
- local tempname="/tmp/temp.$$.$RANDOM.c"
+ local tempname="/tmp/temp.$$.$RANDOM"
echo "\
#include <stdlib.h>
/* Apparently uclibc defines __GLIBC__ (compat trick?). Oh well. */
@@ -63,12 +67,12 @@ check_libc_is_glibc() {
syntax error here
#endif
" >"$tempname"
- if $CC "$tempname" -c -o /dev/null >/dev/null 2>&1; then
+ if $CC "$tempname".c -c -o "$tempname".o >/dev/null 2>&1; then
echo "$2";
else
echo "$1";
fi
- rm "$tempname"
+ rm "$tempname".c "$tempname".o 2>/dev/null
}
EXE="$1"