svn commit: trunk/busybox/scripts

vda at busybox.net vda at busybox.net
Wed Feb 13 07:47:39 UTC 2008


Author: vda
Date: 2008-02-12 23:47:37 -0800 (Tue, 12 Feb 2008)
New Revision: 21002

Log:
build system: don't use -o /dev/null, old gcc can delete /dev/null!



Modified:
   trunk/busybox/scripts/trylink


Changeset:
Modified: trunk/busybox/scripts/trylink
===================================================================
--- trunk/busybox/scripts/trylink	2008-02-12 20:31:44 UTC (rev 21001)
+++ trunk/busybox/scripts/trylink	2008-02-13 07:47:37 UTC (rev 21002)
@@ -47,15 +47,19 @@
 }
 
 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 @@
 	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"




More information about the busybox-cvs mailing list