qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@web.de>
To: Blue Swirl <blauwirbel@gmail.com>
Cc: qemu-devel <qemu-devel@nongnu.org>
Subject: [Qemu-devel] [PATCH] mingw32: Only link against libiberty if required
Date: Sun, 24 Jul 2011 12:12:15 +0200	[thread overview]
Message-ID: <4E2BEFFF.5050000@web.de> (raw)

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

             reply	other threads:[~2011-07-24 10:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-24 10:12 Jan Kiszka [this message]
2011-07-24 11:04 ` [Qemu-devel] [PATCH] mingw32: Only link against libiberty if required Stefan Weil
2011-07-24 11:48   ` Jan Kiszka

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4E2BEFFF.5050000@web.de \
    --to=jan.kiszka@web.de \
    --cc=blauwirbel@gmail.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).