]> git.proxmox.com Git - mirror_qemu.git/blobdiff - configure
Fix a Sparse warning about redefinition of offsetof()
[mirror_qemu.git] / configure
index 5232172f3f0172c7067d4f10f6512196aa4d081d..5570005a0000310c6ccd1fea5a3365fdde8b7578 100755 (executable)
--- a/configure
+++ b/configure
@@ -1602,6 +1602,18 @@ if test "$darwin" != "yes" -a "$mingw32" != "yes" -a "$solaries" != yes -a \
     libs_softmmu="-lutil $libs_softmmu"
 fi
 
+##########################################
+# check if the compiler defines offsetof
+
+need_offsetof=yes
+cat > $TMPC << EOF
+#include <stddef.h>
+int main(void) { struct s { int f; }; return offsetof(struct s, f); }
+EOF
+if compile_prog "" "" ; then
+    need_offsetof=no
+fi
+
 # End of CC checks
 # After here, no more $cc or $ld runs
 
@@ -1901,6 +1913,9 @@ fi
 if test "$fdt" = "yes" ; then
   echo "CONFIG_FDT=y" >> $config_host_mak
 fi
+if test "$need_offsetof" = "yes" ; then
+  echo "CONFIG_NEED_OFFSETOF=y" >> $config_host_mak
+fi
 
 # XXX: suppress that
 if [ "$bsd" = "yes" ] ; then