summaryrefslogtreecommitdiffstats
path: root/sca-cpp/trunk/kernel
diff options
context:
space:
mode:
authorjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2010-01-11 08:30:15 +0000
committerjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2010-01-11 08:30:15 +0000
commite22bdc0f9572b6a1a2304799d481b25b3e962f87 (patch)
treef25fbce46285d0d1b4081daaa632a6f24399b857 /sca-cpp/trunk/kernel
parent030239cff2f98c0e7b2a66e1930008eed418e07d (diff)
Improvements to autoconf build to make support for python, web service etc and relevant test cases optional and generate ac_defines used in ifdefs to check for debug and multithreading. Moved some optional code and test cases around to run them only when the tested features are built.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@897791 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
-rw-r--r--sca-cpp/trunk/kernel/Makefile.am11
-rw-r--r--sca-cpp/trunk/kernel/config.hpp (renamed from sca-cpp/trunk/kernel/debug.hpp)21
-rw-r--r--sca-cpp/trunk/kernel/dynlib-test.cpp1
-rw-r--r--sca-cpp/trunk/kernel/fstream.hpp2
-rw-r--r--sca-cpp/trunk/kernel/function.hpp4
-rw-r--r--sca-cpp/trunk/kernel/gc.hpp4
-rw-r--r--sca-cpp/trunk/kernel/list.hpp13
-rw-r--r--sca-cpp/trunk/kernel/monad.hpp1
-rw-r--r--sca-cpp/trunk/kernel/parallel-test.cpp4
-rw-r--r--sca-cpp/trunk/kernel/parallel.hpp4
-rw-r--r--sca-cpp/trunk/kernel/stream.hpp4
-rw-r--r--sca-cpp/trunk/kernel/string.hpp6
-rw-r--r--sca-cpp/trunk/kernel/value.hpp13
13 files changed, 43 insertions, 45 deletions
diff --git a/sca-cpp/trunk/kernel/Makefile.am b/sca-cpp/trunk/kernel/Makefile.am
index 507454439a..e210e0d323 100644
--- a/sca-cpp/trunk/kernel/Makefile.am
+++ b/sca-cpp/trunk/kernel/Makefile.am
@@ -23,27 +23,20 @@ test_LTLIBRARIES = libdynlib-test.la
includedir = $(prefix)/include/kernel
include_HEADERS = *.hpp
-INCLUDES = -I. -I$(top_builddir)/kernel -I${LIBXML2_INCLUDE} -I${APR_INCLUDE}
-
string_test_SOURCES = string-test.cpp
-string_test_LDADD = -L${LIBXML2_LIB} -lxml2 -L${APR_LIB} -lapr-1 -laprutil-1
libdynlib_test_la_SOURCES = dynlib-test.cpp
-libdynlib_test_la_LIBADD = -L${APR_LIB} -lapr-1 -laprutil-1
kernel_test_SOURCES = kernel-test.cpp
-kernel_test_LDADD = -L${LIBXML2_LIB} -lxml2 -L${APR_LIB} -lapr-1 -laprutil-1
mem_test_SOURCES = mem-test.cpp
-mem_test_LDADD = -L${APR_LIB} -lapr-1 -laprutil-1
parallel_test_SOURCES = parallel-test.cpp
-parallel_test_LDADD = -L${LIBXML2_LIB} -lxml2 -L${APR_LIB} -lapr-1 -laprutil-1
xml_test_SOURCES = xml-test.cpp
-xml_test_LDADD = -L${LIBXML2_LIB} -lxml2 -L${APR_LIB} -lapr-1 -laprutil-1
+xml_test_LDADD = -lxml2
xsd_test_SOURCES = xsd-test.cpp
-xsd_test_LDADD = -L${LIBXML2_LIB} -lxml2 -L${APR_LIB} -lapr-1 -laprutil-1
+xsd_test_LDADD = -lxml2
TESTS = string-test kernel-test mem-test parallel-test xml-test
diff --git a/sca-cpp/trunk/kernel/debug.hpp b/sca-cpp/trunk/kernel/config.hpp
index f9baf73c3c..195612428e 100644
--- a/sca-cpp/trunk/kernel/debug.hpp
+++ b/sca-cpp/trunk/kernel/config.hpp
@@ -19,22 +19,31 @@
/* $Rev$ $Date$ */
-#ifndef tuscany_debug_hpp
-#define tuscany_debug_hpp
+#ifndef tuscany_config_hpp
+#define tuscany_config_hpp
+
+#include "ap_config.h"
+#undef PACKAGE_BUGREPORT
+#undef PACKAGE_NAME
+#undef PACKAGE_STRING
+#undef PACKAGE_TARNAME
+#undef PACKAGE_VERSION
+
+#include "../config.h"
/**
- * Debug functions and macros.
+ * Platform configuration and debug functions.
*/
namespace tuscany
{
-#ifdef _DEBUG
+#ifdef WANT_MAINTAINER_MODE
/**
* Add string watch members to important classes to help watch them in a debugger.
*/
-#define _DEBUG_WATCH
+#define WANT_MAINTAINER_WATCH
/**
* Increment / decrement a debug counter.
@@ -64,4 +73,4 @@ bool debug_dec(long int& c) {
#endif
}
-#endif /* tuscany_debug_hpp */
+#endif /* tuscany_config_hpp */
diff --git a/sca-cpp/trunk/kernel/dynlib-test.cpp b/sca-cpp/trunk/kernel/dynlib-test.cpp
index 9d0e6a2186..419fa29db5 100644
--- a/sca-cpp/trunk/kernel/dynlib-test.cpp
+++ b/sca-cpp/trunk/kernel/dynlib-test.cpp
@@ -24,7 +24,6 @@
*/
#include "function.hpp"
-#include "debug.hpp"
namespace tuscany {
namespace test {
diff --git a/sca-cpp/trunk/kernel/fstream.hpp b/sca-cpp/trunk/kernel/fstream.hpp
index b158e66084..81f6a39f64 100644
--- a/sca-cpp/trunk/kernel/fstream.hpp
+++ b/sca-cpp/trunk/kernel/fstream.hpp
@@ -139,7 +139,7 @@ ifstream cin(stdin);
/**
* Debug log stream.
*/
-#ifdef _DEBUG
+#ifdef WANT_MAINTAINER_MODE
template<typename V> const bool debug(const V& v, const string& msg) {
cerr << msg << ": " << v << endl;
diff --git a/sca-cpp/trunk/kernel/function.hpp b/sca-cpp/trunk/kernel/function.hpp
index 899443462e..db7318303a 100644
--- a/sca-cpp/trunk/kernel/function.hpp
+++ b/sca-cpp/trunk/kernel/function.hpp
@@ -29,11 +29,11 @@
#include <utility>
#include "fstream.hpp"
#include "gc.hpp"
-#include "debug.hpp"
+#include "config.hpp"
namespace tuscany {
-#ifdef _DEBUG
+#ifdef WANT_MAINTAINER_MODE
/**
* Debug counters.
diff --git a/sca-cpp/trunk/kernel/gc.hpp b/sca-cpp/trunk/kernel/gc.hpp
index bfb304615d..4b29d66d64 100644
--- a/sca-cpp/trunk/kernel/gc.hpp
+++ b/sca-cpp/trunk/kernel/gc.hpp
@@ -31,7 +31,7 @@
#include <apr_pools.h>
#include <assert.h>
#include <new>
-#include "debug.hpp"
+#include "config.hpp"
namespace tuscany
{
@@ -139,7 +139,7 @@ public:
/**
* Maintain a stack of memory pools.
*/
-#ifdef _REENTRANT
+#ifdef WANT_THREADS
__thread
#endif
apr_pool_t* gc_pool_stack = NULL;
diff --git a/sca-cpp/trunk/kernel/list.hpp b/sca-cpp/trunk/kernel/list.hpp
index 6a725d0382..84eba6d82f 100644
--- a/sca-cpp/trunk/kernel/list.hpp
+++ b/sca-cpp/trunk/kernel/list.hpp
@@ -30,11 +30,10 @@
#include "string.hpp"
#include "fstream.hpp"
#include "function.hpp"
-#include "debug.hpp"
namespace tuscany {
-#ifdef _DEBUG
+#ifdef WANT_MAINTAINER_MODE
/**
* Debug utilities. Counters used to track instances of lists, and
@@ -71,7 +70,7 @@ bool printListCounters() {
#endif
-#ifdef _DEBUG_WATCH
+#ifdef WANT_MAINTAINER_WATCH
#define debug_watchList() do { \
this->watch = watchList(*this); \
@@ -105,7 +104,7 @@ public:
list(const list& p) : car(p.car), cdr(p.cdr) {
debug_inc(countLists);
debug_inc(countCLists);
-#ifdef _DEBUG_WATCH
+#ifdef WANT_MAINTAINER_WATCH
watch = p.watch;
#endif
}
@@ -115,7 +114,7 @@ public:
return *this;
car = p.car;
cdr = p.cdr;
-#ifdef _DEBUG_WATCH
+#ifdef WANT_MAINTAINER_WATCH
watch = p.watch;
#endif
return *this;
@@ -176,7 +175,7 @@ public:
}
private:
-#ifdef _DEBUG_WATCH
+#ifdef WANT_MAINTAINER_WATCH
template<typename X> friend const string watchList(const list<X>& p);
string watch;
#endif
@@ -189,7 +188,7 @@ private:
lambda<list<T>()> cdr;
};
-#ifdef _DEBUG_WATCH
+#ifdef WANT_MAINTAINER_WATCH
/**
* Debug utility used to write the contents of a list to a string, easier
diff --git a/sca-cpp/trunk/kernel/monad.hpp b/sca-cpp/trunk/kernel/monad.hpp
index 15029b20ec..a312827f6e 100644
--- a/sca-cpp/trunk/kernel/monad.hpp
+++ b/sca-cpp/trunk/kernel/monad.hpp
@@ -27,7 +27,6 @@
*/
#include "function.hpp"
-#include "debug.hpp"
#include "string.hpp"
#include "stream.hpp"
diff --git a/sca-cpp/trunk/kernel/parallel-test.cpp b/sca-cpp/trunk/kernel/parallel-test.cpp
index b47501a58d..2969dd0637 100644
--- a/sca-cpp/trunk/kernel/parallel-test.cpp
+++ b/sca-cpp/trunk/kernel/parallel-test.cpp
@@ -33,7 +33,7 @@
namespace tuscany {
-#ifdef _REENTRANT
+#ifdef WANT_THREADS
int inci = 0;
@@ -153,7 +153,7 @@ bool testWorker() {
int main() {
tuscany::cout << "Testing..." << tuscany::endl;
-#ifdef _REENTRANT
+#ifdef WANT_THREADS
tuscany::testAtomicPerf();
tuscany::testWorker();
#else
diff --git a/sca-cpp/trunk/kernel/parallel.hpp b/sca-cpp/trunk/kernel/parallel.hpp
index 30697004f2..9fb6c59ba7 100644
--- a/sca-cpp/trunk/kernel/parallel.hpp
+++ b/sca-cpp/trunk/kernel/parallel.hpp
@@ -26,7 +26,7 @@
* Simple parallel work execution functions.
*/
-#ifdef _REENTRANT
+#ifdef WANT_THREADS
#include <pthread.h>
#include <sys/syscall.h>
#include <unistd.h>
@@ -37,7 +37,7 @@
namespace tuscany {
-#ifdef _REENTRANT
+#ifdef WANT_THREADS
/**
* Returns the current thread id.
diff --git a/sca-cpp/trunk/kernel/stream.hpp b/sca-cpp/trunk/kernel/stream.hpp
index f3efb13479..32b754f315 100644
--- a/sca-cpp/trunk/kernel/stream.hpp
+++ b/sca-cpp/trunk/kernel/stream.hpp
@@ -27,7 +27,7 @@
*/
#include <stdarg.h>
-#include "debug.hpp"
+#include "config.hpp"
#include "gc.hpp"
#include "string.hpp"
@@ -152,7 +152,7 @@ template<typename T> ostream& operator<<(ostream& out, const gc_ptr<T>& p) {
return out << p.ptr;
}
-#ifdef _DEBUG
+#ifdef WANT_MAINTAINER_MODE
/**
* Debug stream implementation with no dependencies on anything else.
diff --git a/sca-cpp/trunk/kernel/string.hpp b/sca-cpp/trunk/kernel/string.hpp
index 9a3af49fc7..931417e430 100644
--- a/sca-cpp/trunk/kernel/string.hpp
+++ b/sca-cpp/trunk/kernel/string.hpp
@@ -34,7 +34,7 @@
namespace tuscany {
-#ifdef _DEBUG
+#ifdef WANT_MAINTAINER_MODE
/**
* Debug utilities. Counters used to track string copies.
@@ -67,7 +67,7 @@ bool printStringCopyCounters() {
* Instrumented memcpy.
*/
void* string_memcpy(void* t, const void* s, const size_t n) {
-#ifdef _DEBUG
+#ifdef WANT_MAINTAINER_MODE
countStringCopies += 1;
#endif
return memcpy(t, s, n);
@@ -172,7 +172,7 @@ public:
}
private:
-#ifdef _DEBUG
+#ifdef WANT_MAINTAINER_MODE
friend class odebugstream;
#endif
friend class ostringstream;
diff --git a/sca-cpp/trunk/kernel/value.hpp b/sca-cpp/trunk/kernel/value.hpp
index a6c3fbd3f7..4f19ee3915 100644
--- a/sca-cpp/trunk/kernel/value.hpp
+++ b/sca-cpp/trunk/kernel/value.hpp
@@ -33,12 +33,11 @@
#include "function.hpp"
#include "list.hpp"
#include "monad.hpp"
-#include "debug.hpp"
namespace tuscany
{
-#ifdef _DEBUG
+#ifdef WANT_MAINTAINER_MODE
/**
* Debug utilities. Counters used to track instances of values, and
@@ -75,7 +74,7 @@ bool printValueCounters() {
#endif
-#ifdef _DEBUG_WATCH
+#ifdef WANT_MAINTAINER_WATCH
#define debug_watchValue() do { \
this->watch = watchValue(*this); \
@@ -124,7 +123,7 @@ public:
default:
break;
}
-#ifdef _DEBUG_WATCH
+#ifdef WANT_MAINTAINER_WATCH
watch = v.watch;
#endif
}
@@ -223,7 +222,7 @@ public:
default:
break;
}
-#ifdef _DEBUG_WATCH
+#ifdef WANT_MAINTAINER_WATCH
watch = v.watch;
#endif
return *this;
@@ -420,7 +419,7 @@ private:
friend ostream& operator<<(ostream&, const value&);
friend const value::ValueType type(const value& v);
-#ifdef _DEBUG_WATCH
+#ifdef WANT_MAINTAINER_WATCH
friend const string watchValue(const value& v);
string watch;
#endif
@@ -429,7 +428,7 @@ private:
lambda<char()> data;
};
-#ifdef _DEBUG_WATCH
+#ifdef WANT_MAINTAINER_WATCH
/**
* Debug utility used to write the contents of a value to a string, easier