qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] mingw32: Only link against libiberty if required
@ 2011-07-24 10:12 Jan Kiszka
  2011-07-24 11:04 ` Stefan Weil
  0 siblings, 1 reply; 3+ messages in thread
From: Jan Kiszka @ 2011-07-24 10:12 UTC (permalink / raw)
  To: Blue Swirl; +Cc: qemu-devel

From: Jan Kiszka <jan.kiszka@siemens.com>

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 <jan.kiszka@siemens.com>
---
 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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-07-24 11:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-24 10:12 [Qemu-devel] [PATCH] mingw32: Only link against libiberty if required Jan Kiszka
2011-07-24 11:04 ` Stefan Weil
2011-07-24 11:48   ` Jan Kiszka

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).