qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] fix compile & linking errors on NetBSD
@ 2008-11-17 11:00 Christoph Egger
  2008-11-22 20:28 ` [Qemu-devel] " Blue Swirl
  2008-11-23  4:36 ` [Qemu-devel] " Thiemo Seufer
  0 siblings, 2 replies; 5+ messages in thread
From: Christoph Egger @ 2008-11-17 11:00 UTC (permalink / raw)
  To: qemu-devel; +Cc: Blue Swirl

[-- 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)))

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

* [Qemu-devel] Re: [PATCH] fix compile & linking errors on NetBSD
  2008-11-17 11:00 [Qemu-devel] [PATCH] fix compile & linking errors on NetBSD Christoph Egger
@ 2008-11-22 20:28 ` Blue Swirl
  2008-11-24  9:21   ` Christoph Egger
  2008-11-23  4:36 ` [Qemu-devel] " Thiemo Seufer
  1 sibling, 1 reply; 5+ messages in thread
From: Blue Swirl @ 2008-11-22 20:28 UTC (permalink / raw)
  To: Christoph Egger; +Cc: qemu-devel

On 11/17/08, Christoph Egger <Christoph.Egger@amd.com> wrote:
>
>  Hi,
>
>  Attached patch fixes some compile and linking issues on NetBSD.
>
>  - change configure and bswap.h to get the bswap* functions

I didn't apply this, I think the bswap functions are fully optimized
by the compiler.

>  - 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

These are applied as r5774, r5775 and r5776. Thanks.

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

* Re: [Qemu-devel] [PATCH] fix compile & linking errors on NetBSD
  2008-11-17 11:00 [Qemu-devel] [PATCH] fix compile & linking errors on NetBSD Christoph Egger
  2008-11-22 20:28 ` [Qemu-devel] " Blue Swirl
@ 2008-11-23  4:36 ` Thiemo Seufer
  2008-11-23  7:29   ` Blue Swirl
  1 sibling, 1 reply; 5+ messages in thread
From: Thiemo Seufer @ 2008-11-23  4:36 UTC (permalink / raw)
  To: Christoph Egger; +Cc: Blue Swirl, qemu-devel

Christoph Egger wrote:
[snip]
> 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"

Apparently this wasn't tested with FreeBSD. (It is aio_lib, not aiolib.)


Thiemo

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

* Re: [Qemu-devel] [PATCH] fix compile & linking errors on NetBSD
  2008-11-23  4:36 ` [Qemu-devel] " Thiemo Seufer
@ 2008-11-23  7:29   ` Blue Swirl
  0 siblings, 0 replies; 5+ messages in thread
From: Blue Swirl @ 2008-11-23  7:29 UTC (permalink / raw)
  To: Thiemo Seufer; +Cc: Christoph Egger, qemu-devel

On 11/23/08, Thiemo Seufer <ths@networkno.de> wrote:
> Christoph Egger wrote:
>  [snip]
>  > 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"
>
>  Apparently this wasn't tested with FreeBSD. (It is aio_lib, not aiolib.)

Thanks, fixed in r5782.

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

* [Qemu-devel] Re: [PATCH] fix compile & linking errors on NetBSD
  2008-11-22 20:28 ` [Qemu-devel] " Blue Swirl
@ 2008-11-24  9:21   ` Christoph Egger
  0 siblings, 0 replies; 5+ messages in thread
From: Christoph Egger @ 2008-11-24  9:21 UTC (permalink / raw)
  To: Blue Swirl; +Cc: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 1665 bytes --]

On Saturday 22 November 2008 21:28:56 Blue Swirl wrote:
> On 11/17/08, Christoph Egger <Christoph.Egger@amd.com> wrote:
> >  Hi,
> >
> >  Attached patch fixes some compile and linking issues on NetBSD.
> >
> >  - change configure and bswap.h to get the bswap* functions
>
> I didn't apply this, I think the bswap functions are fully optimized
> by the compiler.

The bswap part is needed on NetBSD. W/o it, I get this build error:

bswap.h:46: error: expected declaration specifiers or '...' before '(' token
bswap.h:46: error: expected ')' before '?' token
bswap.h:51: error: expected declaration specifiers or '...' before '(' token
bswap.h:51: error: expected ')' before '?' token
bswap.h:56: error: expected declaration specifiers or '...' before '(' token
bswap.h:56: error: expected ')' before '?' token

Attached patch re-adds this.

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>

>
> >  - 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
>
> These are applied as r5774, r5775 and r5776. Thanks.

Thanks for applying it and fixing the typo.

Christoph

-- 
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: 1091 bytes --]

Index: bswap.h
===================================================================
--- bswap.h	(revision 5786)
+++ 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 5786)
+++ configure	(working copy)
@@ -1222,6 +1233,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

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

end of thread, other threads:[~2008-11-24 15:56 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-17 11:00 [Qemu-devel] [PATCH] fix compile & linking errors on NetBSD Christoph Egger
2008-11-22 20:28 ` [Qemu-devel] " 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

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).