From fa9ade356b0543f11295023de3b4441a1e7d39a3 Mon Sep 17 00:00:00 2001
From: Mike Pall <mike>
Date: Mon, 24 Oct 2011 16:35:17 +0200
Subject: Allow selection of single-number vs. dual-number mode in Makefile.

---
 src/Makefile  | 6 ++++++
 src/lj_arch.h | 4 ++++
 2 files changed, 10 insertions(+)

diff --git a/src/Makefile b/src/Makefile
index acde0dbb..30985003 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -118,6 +118,12 @@ XCFLAGS=
 # interpreter. Don't bother if your OS wouldn't run on them, anyway.
 #XCFLAGS+= -DLUAJIT_CPU_NOCMOV
 #
+# Some architectures (e.g. PPC) can use either single-number (1) or
+# dual-number (2) mode. Uncomment one of these lines to override the
+# default mode. Please see LJ_ARCH_NUMMODE in lj_arch.h for details.
+#XCFLAGS+= -DLUAJIT_NUMMODE=1
+#XCFLAGS+= -DLUAJIT_NUMMODE=2
+#
 ##############################################################################
 
 ##############################################################################
diff --git a/src/lj_arch.h b/src/lj_arch.h
index 80ab051e..f6448848 100644
--- a/src/lj_arch.h
+++ b/src/lj_arch.h
@@ -235,6 +235,10 @@
 #endif
 
 /* Enable or disable the dual-number mode for the VM. */
+#if (LJ_ARCH_NUMMODE == LJ_NUMMODE_SINGLE && LUAJIT_NUMMODE == 2) || \
+    (LJ_ARCH_NUMMODE == LJ_NUMMODE_DUAL && LUAJIT_NUMMODE == 1)
+#error "No support for this number mode on this architecture"
+#endif
 #if LJ_ARCH_NUMMODE == LJ_NUMMODE_DUAL || \
     (LJ_ARCH_NUMMODE == LJ_NUMMODE_DUAL_SINGLE && LUAJIT_NUMMODE != 1) || \
     (LJ_ARCH_NUMMODE == LJ_NUMMODE_SINGLE_DUAL && LUAJIT_NUMMODE == 2)
-- 
cgit v1.2.3-55-g6feb