Add gtest support for axiom
diff --git a/axiom/Makefile.am b/axiom/Makefile.am
index b0fbc97..02e3a7c 100644
--- a/axiom/Makefile.am
+++ b/axiom/Makefile.am
@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
datadir=$(prefix)
-SUBDIRS = src $(TESTDIR) include
+SUBDIRS = src $(GTEST) $(TESTDIR) include
includedir=$(prefix)/include/axis2-${PACKAGE_VERSION}/
include_HEADERS=$(top_builddir)/include/*.h
data_DATA= INSTALL README AUTHORS NEWS CREDITS LICENSE COPYING
diff --git a/axiom/configure.ac b/axiom/configure.ac
index 4022f80..0a6d95e 100644
--- a/axiom/configure.ac
+++ b/axiom/configure.ac
@@ -26,6 +26,7 @@
dnl Checks for programs.
AC_PROG_CC
AC_PROG_CPP
+AC_PROG_CXX
AC_PROG_LIBTOOL
AC_PROG_INSTALL
AC_PROG_LN_S
@@ -161,18 +162,44 @@
AC_MSG_RESULT(no)
CFLAGS="$CFLAGS"
CPPFLAGS="$CPPFLAGS"
+ CXXFLAGS="$CXXFLAGS"
;;
*)
AC_MSG_RESULT(yes)
CFLAGS="$CFLAGS -fprofile-arcs -ftest-coverage"
CPPFLAGS="$CPPFLAGS -fprofile-arcs -ftest-coverage"
+ CXXFLAGS="$CXXFLAGS -fprofile-arcs -ftest-coverage"
+ LDFLAGS="$LDFLAGS -lgcov --coverage"
+
;;
esac ],[
AC_MSG_RESULT(no)
CFLAGS="$CFLAGS"
- CPPFLAGS="$CPPFLAGS"]
+ CPPFLAGS="$CPPFLAGS"
+ CXXFLAGS="$CXXFLAGS"]
)
+AC_MSG_CHECKING(whether to use the Google test framework)
+AC_ARG_WITH(gtest,
+ [ --with-gtest[=PATH] Find the gtest source files in 'PATH'.],
+[ case "$withval" in
+ no)
+ AC_MSG_RESULT(no)
+ USE_GTEST=""
+ GTEST_DIR=""
+ GTEST=""
+ ;;
+ *)
+ AC_MSG_RESULT(yes)
+ GTEST_DIR="$withval"
+ GTEST="gtest"
+ CXXFLAGS="$CXXFLAGS -g -Wall -Wextra -pthread"
+ ;;
+ esac ],
+ AC_MSG_RESULT(no)
+)
+
+
AC_MSG_CHECKING(whether to build tests)
AC_ARG_ENABLE(tests, [ --enable-tests build tests. default=no],
[ case "${enableval}" in
@@ -200,6 +227,8 @@
AC_SUBST(WRAPPER_DIR)
AC_SUBST(GUTHTHILA_LIBS)
AC_SUBST(TESTDIR)
+AC_SUBST(GTEST_DIR)
+AC_SUBST(GTEST)
AC_SUBST(XPATH_DIR)
AC_CONFIG_FILES([Makefile \
@@ -212,6 +241,7 @@
src/util/Makefile \
src/attachments/Makefile \
src/xpath/Makefile \
+ gtest/Makefile \
test/Makefile \
test/om/Makefile \
test/soap/Makefile \
diff --git a/axiom/gtest/Makefile.am b/axiom/gtest/Makefile.am
new file mode 100644
index 0000000..34b967b
--- /dev/null
+++ b/axiom/gtest/Makefile.am
@@ -0,0 +1,14 @@
+
+noinst_LIBRARIES = libgtest.a libgtest_main.a
+
+libgtest_a_SOURCES = $(GTEST_DIR)/src/gtest-all.cc
+libgtest_a_CPPFLAGS = -I$(GTEST_DIR)/include -I$(GTEST_DIR)
+libgtest_a_CXXFLAGS = -g -Wall -Wextra
+libgtest_a_LDFLAGS = -pthread
+
+libgtest_main_a_SOURCES = $(GTEST_DIR)/src/gtest_main.cc
+libgtest_main_CPPFLAGS = -I$(GTEST_DIR)/include -I$(GTEST_DIR)
+libgtest_main_a_CXXFLAGS = -g -Wall -Wextra
+libgtest_main_LDFLAGS = -pthread
+libgtest_main_a_LIBADD = libgtest.a
+
diff --git a/axiom/test/om/Makefile.am b/axiom/test/om/Makefile.am
index 448d5f1..418f43e 100644
--- a/axiom/test/om/Makefile.am
+++ b/axiom/test/om/Makefile.am
@@ -12,17 +12,20 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-TESTS =
+TESTS = test_om
noinst_PROGRAMS = test_om
check_PROGRAMS = test_om
SUBDIRS =
-AM_CFLAGS = -g -O2
-test_om_SOURCES = test_om.c
-test_om_LDADD = ../../../util/src/libaxutil.la \
- $(top_builddir)/src/parser/$(WRAPPER_DIR)/libaxis2_parser.la \
- $(top_builddir)/src/om/libaxis2_axiom.la
+test_om_SOURCES = test_om.cc
-INCLUDES = -I$(top_builddir)/include \
+test_om_LDADD = ../../../util/src/libaxutil.la \
+ $(top_builddir)/src/parser/$(WRAPPER_DIR)/libaxis2_parser.la \
+ $(top_builddir)/src/om/libaxis2_axiom.la \
+ $(top_builddir)/$(GTEST)/libgtest.a \
+ $(top_builddir)/$(GTEST)/libgtest_main.a
+
+AM_CPPFLAGS = -I$(top_builddir)/include \
-I$(top_builddir)/src/parser \
- -I ../../../util/include
+ -I ../../../util/include \
+ -I $(GTEST_DIR)/include
diff --git a/axiom/test/om/test_om.c b/axiom/test/om/test_om.cc
similarity index 100%
rename from axiom/test/om/test_om.c
rename to axiom/test/om/test_om.cc