From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1L21qJ-0000K6-CA for qemu-devel@nongnu.org; Mon, 17 Nov 2008 06:00:31 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1L21qI-0000Ju-B3 for qemu-devel@nongnu.org; Mon, 17 Nov 2008 06:00:31 -0500 Received: from [199.232.76.173] (port=37275 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1L21qI-0000Jr-5L for qemu-devel@nongnu.org; Mon, 17 Nov 2008 06:00:30 -0500 Received: from outbound-dub.frontbridge.com ([213.199.154.16]:25592 helo=IE1EHSOBE005.bigfish.com) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_ARCFOUR_MD5:16) (Exim 4.60) (envelope-from ) id 1L21qH-0003fS-SG for qemu-devel@nongnu.org; Mon, 17 Nov 2008 06:00:30 -0500 From: Christoph Egger Date: Mon, 17 Nov 2008 13:00:13 +0200 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="Boundary-00=_96UIJJRjNTOFLer" Message-ID: <200811171200.13793.Christoph.Egger@amd.com> Subject: [Qemu-devel] [PATCH] fix compile & linking errors on NetBSD Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Blue Swirl --Boundary-00=_96UIJJRjNTOFLer Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hi, Attached patch fixes some compile and linking issues on NetBSD. =2D change configure and bswap.h to get the bswap* functions =2D adapt configure to link against -lrt to fix aio linking errors =2D adapt configure to link against -lossaudio to fix oss linking errors =2D add native softfloat fpu functions Signed-off-by: Christoph Egger =2D-=20 AMD Saxony, Dresden, Germany Operating System Research Center Legal Information: AMD Saxony Limited Liability Company & Co. KG Sitz (Gesch=E4ftsanschrift): Wilschdorfer Landstr. 101, 01109 Dresden, Deutschland Registergericht Dresden: HRA 4896 vertretungsberechtigter Komplement=E4r: AMD Saxony LLC (Sitz Wilmington, Delaware, USA) Gesch=E4ftsf=FChrer der AMD Saxony LLC: Dr. Hans-R. Deppe, Thomas McCoy --Boundary-00=_96UIJJRjNTOFLer Content-Type: text/x-diff; charset="us-ascii"; name="qemu.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="qemu.diff" Index: qemu-sockets.c =================================================================== --- qemu-sockets.c (revision 5728) +++ qemu-sockets.c (working copy) @@ -20,6 +20,7 @@ #include #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 +#ifdef HAVE_MACHINE_BSWAP_H +#include +#include +#include +#else + #ifdef HAVE_BYTESWAP_H #include #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 +#include +#include +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 #endif -#ifdef __OpenBSD__ -/* Get OpenBSD version number */ +#if defined(__OpenBSD__) || defined(__NetBSD__) #include #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))) --Boundary-00=_96UIJJRjNTOFLer--