diff mbox

[06/39] include failed source file in config.log

Message ID 1286888457-5033-7-git-send-email-pbonzini@redhat.com
State New
Headers show

Commit Message

Paolo Bonzini Oct. 12, 2010, 1 p.m. UTC
Also clean config.log from distclean.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 Makefile  |    2 +-
 configure |   21 +++++++++++++++++----
 2 files changed, 18 insertions(+), 5 deletions(-)
diff mbox

Patch

diff --git a/Makefile b/Makefile
index d9971c3..34c2a6c 100644
--- a/Makefile
+++ b/Makefile
@@ -160,7 +160,7 @@  clean:
         done
 
 distclean: clean
-	rm -f config-host.mak config-host.h* config-host.ld $(DOCS) qemu-options.texi qemu-img-cmds.texi qemu-monitor.texi
+	rm -f config-host.mak config-host.h* config-host.ld $(DOCS) qemu-options.texi qemu-img-cmds.texi qemu-monitor.texi config.log
 	rm -f qemu-options.def
 	rm -f config-all-devices.mak
 	rm -f roms/seabios/config.mak roms/vgabios/config.mak
diff --git a/configure b/configure
index 8cd034a..a8738db 100755
--- a/configure
+++ b/configure
@@ -20,16 +20,26 @@  TMPE="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.exe"
 trap "rm -f $TMPC $TMPO $TMPE" EXIT INT QUIT TERM
 rm -f config.log
 
+run_cc() {
+  echo "$cc $@" >&5
+  if $cc "$@" >&5 2>&5; then
+    return 0
+  else
+    echo exit status is $? >&5
+    echo failed program was: >&5
+    sed 's/^/| /' $TMPC >&5
+    return 1
+  fi
+}
+
 compile_object() {
-  echo $cc $QEMU_CFLAGS -c -o $TMPO $TMPC >> config.log
-  $cc $QEMU_CFLAGS -c -o $TMPO $TMPC >> config.log 2>&1
+  run_cc $QEMU_CFLAGS -c -o $TMPO $TMPC
 }
 
 compile_prog() {
   local_cflags="$1"
   local_ldflags="$2"
-  echo $cc $QEMU_CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags >> config.log
-  $cc $QEMU_CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags >> config.log 2>&1
+  run_cc $QEMU_CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags
 }
 
 # check whether a command is available to this shell (may be either an
@@ -906,6 +916,9 @@  echo "NOTE: The object files are built at the place where configure is launched"
 exit 1
 fi
 
+# create config.log file
+exec 5>config.log
+
 # check that the C compiler works.
 cat > $TMPC <<EOF
 int main(void) {}