Description: Use libgtest-dev to build tests.
Author: Onur Aslan <onur@onur.im>
Forwarded: not-needed
Last-Update: 2014-10-13

--- a/Makefile.am
+++ b/Makefile.am
@@ -9,31 +9,17 @@
 
 if !HAVE_SHARED_LIBGTEST
 
-# Build gtest before we build protobuf tests.  We don't add gtest to SUBDIRS
-# because then "make check" would also build and run all of gtest's own tests,
-# which takes a lot of time and is generally not useful to us.  Also, we don't
-# want "make install" to recurse into gtest since we don't want to overwrite
-# the installed version of gtest if there is one.
-check-local: gtest/lib/libgtest.la gtest/lib/libgtest_main.la
-
-gtest/lib/libgtest.la gtest/lib/libgtest_main.la: gtest/Makefile
-	@echo "Making lib/libgtest.a lib/libgtest_main.a in gtest"
-	@cd gtest && $(MAKE) $(AM_MAKEFLAGS) lib/libgtest.la lib/libgtest_main.la
-
-gtest/Makefile: gtest/configure
-	@cd gtest && ./configure
-
-# We would like to clean gtest when "make clean" is invoked.  But we have to
-# be careful because clean-local is also invoked during "make distclean", but
-# "make distclean" already recurses into gtest because it's listed among the
-# DIST_SUBDIRS.  distclean will delete gtest/Makefile, so if we then try to
-# cd to the directory again and "make clean" it will fail.  So, check that the
-# Makefile exists before recursing.
-clean-local:
-	@if test -e gtest/Makefile; then \
-		echo "Making clean in gtest"; \
-		cd gtest && $(MAKE) $(AM_MAKEFLAGS) clean; \
-	fi
+# Using Debian's libgtest-dev for tests
+GTEST_DIR = /usr/src/gtest
+
+tests/gtest-all.o:
+	$(CXX) $(CPPFLAGS) -I$(GTEST_DIR) $(CXXFLAGS) -c \
+            $(GTEST_DIR)/src/gtest-all.cc -o tests/gtest-all.o
+
+tests/gtest_main.o:
+	$(CXX) $(CPPFLAGS) -I$(GTEST_DIR) $(CXXFLAGS) -c \
+            $(GTEST_DIR)/src/gtest_main.cc -o tests/gtest_main.o
+
 
 endif !HAVE_SHARED_LIBGTEST
 
@@ -101,8 +87,9 @@
 # FIXME(bnoordhuis) Should be configurable by the user.
 gumbo_test_LDADD += -lgtest -lgtest_main
 else
-gumbo_test_DEPENDENCIES += check-local
-gumbo_test_LDADD += gtest/lib/libgtest.la gtest/lib/libgtest_main.la
+gumbo_test_DEPENDENCIES += tests/gtest-all.o tests/gtest_main.o
+gumbo_test_LDADD += tests/gtest-all.o tests/gtest_main.o
+gumbo_test_LDFLAGS = -pthread
 endif
 
 noinst_PROGRAMS = clean_text find_links get_title positions_of_class benchmark serialize prettyprint
