summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2008-06-08 20:53:29 -0700
committerH. Peter Anvin <hpa@zytor.com>2008-06-08 20:53:29 -0700
commit2f0f9ea286e2e37681608e7d4b4ebd4253848478 (patch)
tree0c17efacf930fb52603471979881318d3b8d6b01
parentcb38f505e48e47fda39fb1956b71ea571b9ea5a8 (diff)
downloadnasm-2f0f9ea286e2e37681608e7d4b4ebd4253848478.tar.gz
nasm-2f0f9ea286e2e37681608e7d4b4ebd4253848478.tar.bz2
nasm-2f0f9ea286e2e37681608e7d4b4ebd4253848478.zip
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.
-rw-r--r--compiler.h3
-rw-r--r--configure.in15
-rw-r--r--wsaa.h5
3 files changed, 14 insertions, 9 deletions
diff --git a/compiler.h b/compiler.h
index ced029c..01e1127 100644
--- a/compiler.h
+++ b/compiler.h
@@ -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
diff --git a/configure.in b/configure.in
index da26da9..9a73514 100644
--- a/configure.in
+++ b/configure.in
@@ -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)
diff --git a/wsaa.h b/wsaa.h
index b336489..d70b64a 100644
--- a/wsaa.h
+++ b/wsaa.h
@@ -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 { \