qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH] mingw32: Only link against libiberty if required


From: Jan Kiszka
Subject: [Qemu-devel] [PATCH] mingw32: Only link against libiberty if required
Date: Sun, 24 Jul 2011 12:12:15 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); de; rv:1.8.1.12) Gecko/20080226 SUSE/2.0.0.12-1.1 Thunderbird/2.0.0.12 Mnenhy/0.7.5.666

From: Jan Kiszka <address@hidden>

Not all (didn't find any) mingw32 cross-toolchains ship a binutils-devel
package, thus lack libiberty.a. According to 08f3896a, -liberty is only
needed for getopt when building for 64 bit. Test for the availability
of a getopt implementation and only pull in libiberty when linking
without it failed.

Signed-off-by: Jan Kiszka <address@hidden>
---
 configure |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/configure b/configure
index 6911c3b..42effb9 100755
--- a/configure
+++ b/configure
@@ -481,7 +481,16 @@ if test "$mingw32" = "yes" ; then
   QEMU_CFLAGS="-DWIN32_LEAN_AND_MEAN -DWINVER=0x501 $QEMU_CFLAGS"
   # enable C99/POSIX format strings (needs mingw32-runtime 3.15 or later)
   QEMU_CFLAGS="-D__USE_MINGW_ANSI_STDIO=1 $QEMU_CFLAGS"
-  LIBS="-lwinmm -lws2_32 -liberty -liphlpapi $LIBS"
+  # check need for -liberty (getopt on w64)
+  cat > $TMPC << EOF
+#include <unistd.h>
+int main(void) { return getopt(0, NULL, NULL); }
+EOF
+  if compile_prog "" "" ; then
+    LIBS="-lwinmm -lws2_32 -liphlpapi $LIBS"
+  else
+    LIBS="-lwinmm -lws2_32 -liberty -liphlpapi $LIBS"
+  fi
   prefix="c:/Program Files/Qemu"
   mandir="\${prefix}"
   datadir="\${prefix}"
-- 
1.7.3.4



reply via email to

[Prev in Thread] Current Thread [Next in Thread]