Commit 064aae138b1b26d326603c5c46763e6bde4bf5f2

Authored by pbrook
1 parent 699e4642

Test if compiler works instead of checking if binary exists.


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1909 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 10 additions and 3 deletions
configure
@@ -293,9 +293,16 @@ cc="${cross_prefix}${cc}" @@ -293,9 +293,16 @@ cc="${cross_prefix}${cc}"
293 ar="${cross_prefix}${ar}" 293 ar="${cross_prefix}${ar}"
294 strip="${cross_prefix}${strip}" 294 strip="${cross_prefix}${strip}"
295 295
296 -if [ ! -x "`which $cc`" ] ; then  
297 - echo "Compiler $cc could not be found"  
298 - exit 296 +# check that the C compiler works.
  297 +cat > $TMPC <<EOF
  298 +int main(void) {}
  299 +EOF
  300 +
  301 +if $cc -c -o $TMPO $TMPC 2>/dev/null ; then
  302 + : C compiler works ok
  303 +else
  304 + echo "ERROR: \"$cc\" either does not exist or does not work"
  305 + exit 1
299 fi 306 fi
300 307
301 if test "$mingw32" = "yes" ; then 308 if test "$mingw32" = "yes" ; then