about summary refs log tree commit diff homepage
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/Core/ExternalDispatcher.cpp7
-rw-r--r--lib/Core/StatsTracker.cpp7
-rw-r--r--lib/Support/Makefile19
-rw-r--r--lib/Support/PrintVersion.cpp31
4 files changed, 50 insertions, 14 deletions
diff --git a/lib/Core/ExternalDispatcher.cpp b/lib/Core/ExternalDispatcher.cpp
index 5f9f8dc6..ecc9912e 100644
--- a/lib/Core/ExternalDispatcher.cpp
+++ b/lib/Core/ExternalDispatcher.cpp
@@ -10,13 +10,6 @@
 #include "ExternalDispatcher.h"
 #include "klee/Config/Version.h"
 
-// Ugh.
-#undef PACKAGE_BUGREPORT
-#undef PACKAGE_NAME
-#undef PACKAGE_STRING
-#undef PACKAGE_TARNAME
-#undef PACKAGE_VERSION
-
 #if LLVM_VERSION_CODE >= LLVM_VERSION(3, 3)
 #include "llvm/IR/Module.h"
 #include "llvm/IR/Constants.h"
diff --git a/lib/Core/StatsTracker.cpp b/lib/Core/StatsTracker.cpp
index 0e564fe5..cf8a1654 100644
--- a/lib/Core/StatsTracker.cpp
+++ b/lib/Core/StatsTracker.cpp
@@ -27,13 +27,6 @@
 #include "UserSearcher.h"
 #include "../Solver/SolverStats.h"
 
-// FIXME: Ugh, this is gross. But otherwise our config.h conflicts with LLVMs.
-#undef PACKAGE_BUGREPORT
-#undef PACKAGE_NAME
-#undef PACKAGE_STRING
-#undef PACKAGE_TARNAME
-#undef PACKAGE_VERSION
-
 #if LLVM_VERSION_CODE > LLVM_VERSION(3, 2)
 #include "llvm/IR/BasicBlock.h"
 #include "llvm/IR/Function.h"
diff --git a/lib/Support/Makefile b/lib/Support/Makefile
index 67272908..ff28b06e 100644
--- a/lib/Support/Makefile
+++ b/lib/Support/Makefile
@@ -14,4 +14,23 @@ DONT_BUILD_RELINKED=1
 BUILD_ARCHIVE=1
 NO_INSTALL=1
 
+# FIXME: This is nasty. We don't want to rebuild this library everytime
+# but this was the only way I could find to make the build work.
+#
+# Note this rule has to go here so it is run first.
+CompileTimeInfoFile:=../../include/klee/Config/CompileTimeInfo.h
+all-local:: $(CompileTimeInfoFile)
+
 include $(LEVEL)/Makefile.common
+
+
+GIT_PRESENT:=$(shell [ -d "$(PROJ_SRC_ROOT)/.git" ] && echo 1 || echo 0)
+
+.PHONY: $(CompileTimeInfoFile)
+$(CompileTimeInfoFile):
+	$(Verb) echo "Regenerating $(CompileTimeInfoFile)"
+	$(Verb) echo '#define KLEE_BUILD_MODE "$(BuildMode)"' > $(CompileTimeInfoFile)
+ifeq ($(GIT_PRESENT),1)
+	$(Verb) echo '#define KLEE_BUILD_REVISION "'$(shell cd $(PROJ_SRC_ROOT); git rev-parse HEAD)'"' >> \
+	$(CompileTimeInfoFile)
+endif
diff --git a/lib/Support/PrintVersion.cpp b/lib/Support/PrintVersion.cpp
new file mode 100644
index 00000000..d62269ba
--- /dev/null
+++ b/lib/Support/PrintVersion.cpp
@@ -0,0 +1,31 @@
+//===-- PrintVersion.cpp --------------------------------------------------===//
+//
+//                     The KLEE Symbolic Virtual Machine
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "klee/Internal/Support/PrintVersion.h"
+#include "klee/Config/config.h"
+#include "llvm/Support/raw_ostream.h"
+#include "llvm/Support/CommandLine.h"
+
+#include "klee/Config/CompileTimeInfo.h"
+
+void klee::printVersion()
+{
+  llvm::outs() << PACKAGE_STRING " (" PACKAGE_URL ")\n";
+  llvm::outs() << "  Built " __DATE__ " (" __TIME__ ")\n";
+  llvm::outs() << "  Build mode: " << KLEE_BUILD_MODE "\n";
+  llvm::outs() << "  Build revision: ";
+#ifdef KLEE_BUILD_REVISION
+  llvm::outs() << KLEE_BUILD_REVISION "\n";
+#else
+  llvm::outs() << "unknown\n";
+#endif
+  // Show LLVM version information
+  llvm::outs() << "\n";
+  llvm::cl::PrintVersionMessage();
+}