From: Christoph Egger <Christoph.Egger@amd.com>
To: qemu-devel@nongnu.org
Cc: Blue Swirl <blauwirbel@gmail.com>
Subject: [Qemu-devel] [PATCH] fix compile & linking errors on NetBSD
Date: Mon, 17 Nov 2008 13:00:13 +0200 [thread overview]
Message-ID: <200811171200.13793.Christoph.Egger@amd.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 799 bytes --]
Hi,
Attached patch fixes some compile and linking issues on NetBSD.
- change configure and bswap.h to get the bswap* functions
- adapt configure to link against -lrt to fix aio linking errors
- adapt configure to link against -lossaudio to fix oss linking errors
- add native softfloat fpu functions
Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
--
AMD Saxony, Dresden, Germany
Operating System Research Center
Legal Information:
AMD Saxony Limited Liability Company & Co. KG
Sitz (Geschäftsanschrift):
Wilschdorfer Landstr. 101, 01109 Dresden, Deutschland
Registergericht Dresden: HRA 4896
vertretungsberechtigter Komplementär:
AMD Saxony LLC (Sitz Wilmington, Delaware, USA)
Geschäftsführer der AMD Saxony LLC:
Dr. Hans-R. Deppe, Thomas McCoy
[-- Attachment #2: qemu.diff --]
[-- Type: text/x-diff, Size: 4116 bytes --]
Index: qemu-sockets.c
===================================================================
--- qemu-sockets.c (revision 5728)
+++ qemu-sockets.c (working copy)
@@ -20,6 +20,7 @@
#include <unistd.h>
#include "qemu_socket.h"
+#include "qemu-common.h" /* for qemu_isdigit */
#ifndef AI_ADDRCONFIG
# define AI_ADDRCONFIG 0
@@ -120,7 +121,7 @@
return -1;
}
ai.ai_family = PF_INET6;
- } else if (isdigit(str[0])) {
+ } else if (qemu_isdigit(str[0])) {
/* IPv4 addr */
if (2 != sscanf(str,"%64[0-9.]:%32[^,]%n",addr,port,&pos)) {
fprintf(stderr, "%s: ipv4 parse error (%s)\n",
@@ -244,7 +245,7 @@
return -1;
}
ai.ai_family = PF_INET6;
- } else if (isdigit(str[0])) {
+ } else if (qemu_isdigit(str[0])) {
/* IPv4 addr */
if (2 != sscanf(str,"%64[0-9.]:%32[^,]",addr,port)) {
fprintf(stderr, "%s: ipv4 parse error (%s)\n",
Index: bswap.h
===================================================================
--- bswap.h (revision 5728)
+++ bswap.h (working copy)
@@ -5,6 +5,12 @@
#include <inttypes.h>
+#ifdef HAVE_MACHINE_BSWAP_H
+#include <sys/endian.h>
+#include <sys/types.h>
+#include <machine/bswap.h>
+#else
+
#ifdef HAVE_BYTESWAP_H
#include <byteswap.h>
#else
@@ -58,6 +64,8 @@
return bswap_64(x);
}
+#endif /* ! HAVE_MACHINE_BSWAP_H */
+
static inline void bswap16s(uint16_t *s)
{
*s = bswap16(*s);
Index: configure
===================================================================
--- configure (revision 5728)
+++ configure (working copy)
@@ -147,6 +147,7 @@
bsd="yes"
audio_drv_list="oss"
audio_possible_drivers="oss sdl esd pa"
+aiolib="-lpthread"
if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
kqemu="yes"
fi
@@ -155,6 +156,8 @@
bsd="yes"
audio_drv_list="oss"
audio_possible_drivers="oss sdl esd"
+oss_lib="-lossaudio"
+aio_lib="-lrt -lpthread"
;;
OpenBSD)
bsd="yes"
@@ -162,6 +165,7 @@
audio_drv_list="oss"
audio_possible_drivers="oss sdl esd"
oss_lib="-lossaudio"
+aio_lib="-lpthread"
;;
Darwin)
bsd="yes"
@@ -172,6 +176,7 @@
audio_possible_drivers="coreaudio sdl fmod"
OS_CFLAGS="-mdynamic-no-pic"
OS_LDFLAGS="-framework CoreFoundation -framework IOKit"
+aio_lib="-lpthread"
;;
SunOS)
solaris="yes"
@@ -517,7 +522,7 @@
if [ "$darwin" = "yes" -o "$mingw32" = "yes" ] ; then
AIOLIBS=
elif [ "$bsd" = "yes" ]; then
- AIOLIBS="-lpthread"
+ AIOLIBS="$aio_lib"
else
# Some Linux architectures (e.g. s390) don't imply -lpthread automatically.
AIOLIBS="-lrt -lpthread"
@@ -1210,6 +1225,15 @@
if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
echo "#define HAVE_BYTESWAP_H 1" >> $config_h
fi
+ cat > $TMPC << EOF
+#include <sys/endian.h>
+#include <sys/types.h>
+#include <machine/bswap.h>
+int main(void) { return bswap32(0); }
+EOF
+ if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
+ echo "#define HAVE_MACHINE_BSWAP_H 1" >> $config_h
+ fi
fi
if [ "$openbsd" = "yes" ] ; then
Index: fpu/softfloat-native.h
===================================================================
--- fpu/softfloat-native.h (revision 5728)
+++ fpu/softfloat-native.h (working copy)
@@ -8,8 +8,7 @@
#include <fenv.h>
#endif
-#ifdef __OpenBSD__
-/* Get OpenBSD version number */
+#if defined(__OpenBSD__) || defined(__NetBSD__)
#include <sys/param.h>
#endif
@@ -35,6 +34,25 @@
#define unordered(x, y) (isnan(x) || isnan(y))
#endif
+#ifdef __NetBSD__
+#ifndef isgreater
+#define isgreater(x, y) __builtin_isgreater(x, y)
+#endif
+#ifndef isgreaterequal
+#define isgreaterequal(x, y) __builtin_isgreaterequal(x, y)
+#endif
+#ifndef isless
+#define isless(x, y) __builtin_isless(x, y)
+#endif
+#ifndef islessequal
+#define islessequal(x, y) __builtin_islessequal(x, y)
+#endif
+#ifndef isunordered
+#define isunordered(x, y) __builtin_isunordered(x, y)
+#endif
+#endif
+
+
#define isnormal(x) (fpclass(x) >= FP_NZERO)
#define isgreater(x, y) ((!unordered(x, y)) && ((x) > (y)))
#define isgreaterequal(x, y) ((!unordered(x, y)) && ((x) >= (y)))
next reply other threads:[~2008-11-17 11:00 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-17 11:00 Christoph Egger [this message]
2008-11-22 20:28 ` [Qemu-devel] Re: [PATCH] fix compile & linking errors on NetBSD Blue Swirl
2008-11-24 9:21 ` Christoph Egger
2008-11-23 4:36 ` [Qemu-devel] " Thiemo Seufer
2008-11-23 7:29 ` Blue Swirl
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=200811171200.13793.Christoph.Egger@amd.com \
--to=christoph.egger@amd.com \
--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).