Use autoconf to detect WORDS_LITTLEENDIAN

Use autoconf to detect littleendian word order, and use
WORDS_LITTLEENDIAN instead of X86_MEMORY when we don't require
unaligned memory accesses to be permitted.
This commit is contained in:
H. Peter Anvin 2008-06-08 20:53:29 -07:00
parent cb38f505e4
commit 2f0f9ea286
3 changed files with 14 additions and 9 deletions

View file

@ -103,6 +103,9 @@ char *strsep(char **, const char *);
*/
#if defined(__386__) || defined(__i386__) || defined(__x86_64__)
# define X86_MEMORY 1
# ifndef WORDS_LITTLEENDIAN
# define WORDS_LITTLEENDIAN 1
# endif
#else
# define X86_MEMORY 0
#endif

View file

@ -1,6 +1,6 @@
dnl Process this file with autoconf 2.59 or later to produce
dnl Process this file with autoconf 2.61 or later to produce
dnl a configure script.
AC_PREREQ(2.59)
AC_PREREQ(2.61)
AC_INIT(config.h.in)
AC_CONFIG_HEADERS(config.h)
@ -48,9 +48,7 @@ AC_PREFIX_PROGRAM(nasm)
dnl Checks for programs.
dnl Consider AC_USE_SYSTEM_EXTENSIONS if autoconf 2.61 is OK in the future
AC_GNU_SOURCE
AC_ISC_POSIX
AC_MINIX
AC_USE_SYSTEM_EXTENSIONS
AC_PROG_CC
AC_PROG_LN_S
AC_PROG_MAKE_SET
@ -95,6 +93,13 @@ AC_CHECK_HEADERS(stdbool.h)
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_SIZE_T
AC_C_BIGENDIAN(AC_DEFINE(WORDS_BIGENDIAN),AC_DEFINE(WORDS_LITTLEENDIAN))
AH_TEMPLATE(WORDS_BIGENDIAN,
[Define to 1 if your processor stores words with the most significant
byte first (like Motorola and SPARC, unlike Intel and VAX).])
AH_TEMPLATE(WORDS_LITTLEENDIAN,
[Define to 1 if your processor stores words with the most significant
byte first (like Intel and VAX, unlike Motorola and SPARC).])
dnl Checks for library functions.
AC_SUBST(XOBJS)

5
wsaa.h
View file

@ -4,10 +4,7 @@
#include "compiler.h"
#include "nasmlib.h"
/* XXX: only LITTLE_ENDIAN is actually needed here. The way these
macros is written, it does not require that unaligned references
are permitted. */
#if X86_MEMORY
#ifdef WORDS_LITTEENDIAN
#define WSAACHAR(s,v) \
do { \