Commit 1360677cfe3ca8f945fa1de77823df21a77e4500
1 parent
3990d09a
Attached patch makes NetBSD use the native bswap functions
which compile. Signed-off-by: Christoph Egger <Christoph.Egger@amd.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5886 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
2 changed files
with
17 additions
and
0 deletions
bswap.h
... | ... | @@ -5,6 +5,12 @@ |
5 | 5 | |
6 | 6 | #include <inttypes.h> |
7 | 7 | |
8 | +#ifdef HAVE_MACHINE_BSWAP_H | |
9 | +#include <sys/endian.h> | |
10 | +#include <sys/types.h> | |
11 | +#include <machine/bswap.h> | |
12 | +#else | |
13 | + | |
8 | 14 | #ifdef HAVE_BYTESWAP_H |
9 | 15 | #include <byteswap.h> |
10 | 16 | #else |
... | ... | @@ -58,6 +64,8 @@ static inline uint64_t bswap64(uint64_t x) |
58 | 64 | return bswap_64(x); |
59 | 65 | } |
60 | 66 | |
67 | +#endif /* ! HAVE_MACHINE_BSWAP_H */ | |
68 | + | |
61 | 69 | static inline void bswap16s(uint16_t *s) |
62 | 70 | { |
63 | 71 | *s = bswap16(*s); | ... | ... |
configure
... | ... | @@ -1229,6 +1229,15 @@ EOF |
1229 | 1229 | if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then |
1230 | 1230 | echo "#define HAVE_BYTESWAP_H 1" >> $config_h |
1231 | 1231 | fi |
1232 | + cat > $TMPC << EOF | |
1233 | +#include <sys/endian.h> | |
1234 | +#include <sys/types.h> | |
1235 | +#include <machine/bswap.h> | |
1236 | +int main(void) { return bswap32(0); } | |
1237 | +EOF | |
1238 | + if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then | |
1239 | + echo "#define HAVE_MACHINE_BSWAP_H 1" >> $config_h | |
1240 | + fi | |
1232 | 1241 | fi |
1233 | 1242 | |
1234 | 1243 | if [ "$openbsd" = "yes" ] ; then | ... | ... |