diff options
author | Richard Jones <rjones@redhat.com> | 2009-10-29 17:54:48 +0000 |
---|---|---|
committer | Richard Jones <rjones@redhat.com> | 2009-10-29 17:54:48 +0000 |
commit | a4e27cdf4d3b831792dd20d796dc98a5bc684290 (patch) | |
tree | c7fe946a3fd8ae839056583387dc73404caa4a10 | |
parent | e02f42cb1d7f60c9d2f020d7d8c1b5316fb61310 (diff) | |
download | libguestfs-a4e27cdf4d3b831792dd20d796dc98a5bc684290.tar.gz libguestfs-a4e27cdf4d3b831792dd20d796dc98a5bc684290.tar.xz libguestfs-a4e27cdf4d3b831792dd20d796dc98a5bc684290.zip |
RHEL 5: Detect endianness functions and supply them.
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | hivex/hivex.c | 31 | ||||
-rw-r--r-- | hivex/hivexget.c | 2 | ||||
-rw-r--r-- | hivex/hivexml.c | 2 |
4 files changed, 35 insertions, 2 deletions
diff --git a/configure.ac b/configure.ac index a235a06a..709b1b74 100644 --- a/configure.ac +++ b/configure.ac @@ -123,7 +123,7 @@ dnl Check sizeof long. AC_CHECK_SIZEOF([long]) dnl Headers. -AC_CHECK_HEADERS([errno.h sys/types.h sys/un.h sys/wait.h sys/socket.h]) +AC_CHECK_HEADERS([errno.h sys/types.h sys/un.h sys/wait.h sys/socket.h endian.h byteswap.h]) dnl Check for rpcgen and XDR library. rpcgen is optional. AC_CHECK_PROG([RPCGEN],[rpcgen],[rpcgen],[no]) diff --git a/hivex/hivex.c b/hivex/hivex.c index 16be753b..85d6c7be 100644 --- a/hivex/hivex.c +++ b/hivex/hivex.c @@ -18,11 +18,12 @@ * See file LICENSE for the full license. */ +#include <config.h> + #include <stdio.h> #include <stdlib.h> #include <stdint.h> #include <string.h> -#include <endian.h> #include <fcntl.h> #include <unistd.h> #include <errno.h> @@ -30,6 +31,34 @@ #include <sys/mman.h> #include <sys/stat.h> #include <assert.h> +#ifdef HAVE_ENDIAN_H +#include <endian.h> +#endif +#ifdef HAVE_BYTESWAP_H +#include <byteswap.h> +#endif + +#if __BYTE_ORDER == __LITTLE_ENDIAN +#ifndef be32toh +#define be32toh(x) __bswap_32 (x) +#endif +#ifndef be64toh +#define be64toh(x) __bswap_64 (x) +#endif +#ifndef le32toh +#define le32toh(x) (x) +#endif +#else +#ifndef be32toh +#define be32toh(x) (x) +#endif +#ifndef be64toh +#define be64toh(x) (x) +#endif +#ifndef le32toh +#define le32toh(x) __bswap_32 (x) +#endif +#endif #include "hivex.h" diff --git a/hivex/hivexget.c b/hivex/hivexget.c index 9bb6bbb1..04c854f1 100644 --- a/hivex/hivexget.c +++ b/hivex/hivexget.c @@ -16,6 +16,8 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ +#include <config.h> + #include <stdio.h> #include <stdlib.h> #include <string.h> diff --git a/hivex/hivexml.c b/hivex/hivexml.c index af3de9e4..9dd394ef 100644 --- a/hivex/hivexml.c +++ b/hivex/hivexml.c @@ -16,6 +16,8 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ +#include <config.h> + #include <stdio.h> #include <stdlib.h> #include <string.h> |