From 96db0d957f1b7ae8fa882dd282b0ede7badb26b7 Mon Sep 17 00:00:00 2001
From: Brian Norris <banorris@uci.edu>
Date: Mon, 16 Jul 2012 22:26:25 -0700
Subject: [PATCH] config: automatically determine BIT48

GCC says we can use _LP64, and LLVM (clang) imitates, so this can be
automatically redefined for 32-bit/64-bit architectures.

Also, add config.h to Makefile so it triggers a rebuild. This is still a blunt
mechanism, but it's fine for now.
---
 Makefile | 2 +-
 config.h | 8 ++++++++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index a6ec00b..206d76d 100644
--- a/Makefile
+++ b/Makefile
@@ -10,7 +10,7 @@ USER_H=libthreads.h libatomic.h
 
 MODEL_CC=libthreads.cc schedule.cc libatomic.cc model.cc threads.cc librace.cc action.cc nodestack.cc clockvector.cc main.cc snapshot-interface.cc cyclegraph.cc datarace.cc
 MODEL_O=libthreads.o schedule.o libatomic.o model.o threads.o librace.o action.o nodestack.o clockvector.o main.o snapshot-interface.o cyclegraph.o datarace.o
-MODEL_H=libthreads.h schedule.h common.h libatomic.h model.h threads.h librace.h action.h nodestack.h clockvector.h snapshot-interface.h cyclegraph.h hashtable.h datarace.h
+MODEL_H=libthreads.h schedule.h common.h libatomic.h model.h threads.h librace.h action.h nodestack.h clockvector.h snapshot-interface.h cyclegraph.h hashtable.h datarace.h config.h
 
 SHMEM_CC=snapshot.cc malloc.c mymemory.cc
 SHMEM_O=snapshot.o malloc.o mymemory.o
diff --git a/config.h b/config.h
index ed30531..62bc92b 100644
--- a/config.h
+++ b/config.h
@@ -7,6 +7,14 @@
 
 /** Do we have a 48 bit virtual address (64 bit machine) or 32 bit addresses.
  * Set to 1 for 48-bit, 0 for 32-bit. */
+#ifndef BIT48
+
+#ifdef _LP64
 #define BIT48 1
+#else
+#define BIT48 0
+#endif
+
+#endif /* BIT48 */
 
 #endif
-- 
2.34.1