You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hawq.apache.org by hu...@apache.org on 2016/05/16 02:09:49 UTC

incubator-hawq git commit: HAWQ-711. Bugfix for libyarn/libhdfs3 building dependency, tweak googleTest code

Repository: incubator-hawq
Updated Branches:
  refs/heads/master fb14dbd98 -> 1f794e2b3


HAWQ-711. Bugfix for libyarn/libhdfs3 building dependency, tweak googleTest code


Project: http://git-wip-us.apache.org/repos/asf/incubator-hawq/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-hawq/commit/1f794e2b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-hawq/tree/1f794e2b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-hawq/diff/1f794e2b

Branch: refs/heads/master
Commit: 1f794e2b343549c7c0fe58431d027b3389f4eb1e
Parents: fb14dbd
Author: xunzhang <xu...@gmail.com>
Authored: Mon May 16 10:01:13 2016 +0800
Committer: xunzhang <xu...@gmail.com>
Committed: Mon May 16 10:01:13 2016 +0800

----------------------------------------------------------------------
 .travis.yml                                     | 21 +----
 GNUmakefile.in                                  | 26 ++++---
 configure                                       | 80 ++++++++++----------
 configure.in                                    | 73 +++++++++---------
 depends/libhdfs3/CMake/FindGoogleTest.cmake     | 15 +++-
 depends/libhdfs3/Makefile                       | 25 ++++--
 depends/libhdfs3/Makefile.global.in             |  1 +
 depends/libyarn/CMake/FindGoogleTest.cmake      | 15 +++-
 depends/libyarn/Makefile                        | 25 ++++--
 depends/libyarn/Makefile.global.in              |  1 +
 depends/thirdparty/googletest/.gitignore        |  2 +
 depends/thirdparty/googletest/Makefile          | 24 ++++++
 .../thirdparty/googletest/Makefile.global.in    | 14 ++++
 src/Makefile                                    |  6 +-
 src/Makefile.global.in                          |  5 +-
 src/test/Makefile                               |  2 +-
 src/test/feature/Makefile                       |  9 ++-
 src/test/feature/lib/Makefile                   |  8 +-
 18 files changed, 225 insertions(+), 127 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/1f794e2b/.travis.yml
----------------------------------------------------------------------
diff --git a/.travis.yml b/.travis.yml
index 2e6b838..68563d2 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -38,29 +38,14 @@ install:
   - brew uninstall postgresql
 
 before_script:
-  - cd $TRAVIS_BUILD_DIR/depends/thirdparty/googletest
-  - mkdir build
-  - cd build
-  - cmake ..
-  - make -j2
-  - sudo make install
-  - cd $TRAVIS_BUILD_DIR/depends/libhdfs3
-  - mkdir build
-  - cd build
-  - ../bootstrap --prefix=/usr/local/
-  - make -j2
-  - sudo make install
-  - cd $TRAVIS_BUILD_DIR/depends/libyarn
-  - mkdir build
-  - cd build
-  - ../bootstrap --prefix=/usr/local
-  - make -j2
-  - sudo make install
   - cd $TRAVIS_BUILD_DIR
   - ./configure
 
 script:
   - make -j2
+# waiting higher version of gcc ready
+#- make feature-test
+#- make feature-test-clean
 
 branches:
   except:

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/1f794e2b/GNUmakefile.in
----------------------------------------------------------------------
diff --git a/GNUmakefile.in b/GNUmakefile.in
index d38273c..e457ddd 100644
--- a/GNUmakefile.in
+++ b/GNUmakefile.in
@@ -10,6 +10,8 @@ include $(top_builddir)/src/Makefile.global
 
 all:
 #	$(MAKE) -C doc all
+# waiting for higher version of gcc ready
+#$(MAKE) -C depends/thirdparty/googletest all
 	$(MAKE) -C depends/libhdfs3 all
 	$(MAKE) -C depends/libyarn all
 	$(MAKE) -C src all
@@ -24,6 +26,8 @@ all:
 
 install: 
 #	$(MAKE) -C doc $@
+# waiting for higher version of gcc ready
+#$(MAKE) -C depends/thirdparty/googletest install
 	$(MAKE) -C depends/libhdfs3 $@
 	$(MAKE) -C depends/libyarn $@
 	$(MAKE) -C src $@
@@ -52,19 +56,21 @@ distprep:
 	$(MAKE) -C config $@
 	$(MAKE) -C contrib $@
 
-feature_test:
-	$(MAKE) -C src feature_test
+feature-test:
+	$(MAKE) -C src feature-test
 
-feature_test_clean:
-	$(MAKE) -C src feature_test_clean
+feature-test-clean:
+	$(MAKE) -C src feature-test-clean
 
 # clean, distclean, etc should apply to contrib too, even though
 # it's not built by default
 clean:
 #	$(MAKE) -C doc $@
 	$(MAKE) -C contrib $@
-	$(MAKE) -C depends/libhdfs3 $@
-	$(MAKE) -C depends/libyarn $@
+# waiting for higher version of gcc ready
+#-$(MAKE) -C depends/thirdparty/googletest $@
+	-$(MAKE) -C depends/libhdfs3 $@
+	-$(MAKE) -C depends/libyarn $@
 	$(MAKE) -C src $@
 	$(MAKE) -C config $@
 	$(MAKE) -C contrib/formatter_fixedwidth $@
@@ -73,7 +79,7 @@ clean:
 	$(MAKE) -C contrib/gp_cancel_query $@
 	$(MAKE) -C contrib/hawq-hadoop $@
 	$(MAKE) -C tools $@
-	$(MAKE) -C src feature_test clean
+	-$(MAKE) -C src feature-test-clean
 # Garbage from autoconf:
 	@rm -rf autom4te.cache/
 
@@ -82,11 +88,13 @@ clean:
 distclean maintainer-clean:
 #	-$(MAKE) -C doc $@
 	-$(MAKE) -C contrib $@
+# waiting for higher version of gcc ready
+#-$(MAKE) -C depends/thirdparty/googletest $@
 	-$(MAKE) -C depends/libhdfs3 $@
 	-$(MAKE) -C depends/libyarn $@
 	-$(MAKE) -C config $@
 	-$(MAKE) -C tools $@
-	-$(MAKE) -C src feature_test clean
+	-$(MAKE) -C src feature-test-clean
 	-$(MAKE) -C src $@
 	-rm -f config.cache config.log config.status GNUmakefile
 # Garbage from autoconf:
@@ -183,4 +191,4 @@ coverage-reset:
 
 
 .PHONY: dist distdir distcheck
-unexport split-dist
+#unexport split-dist

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/1f794e2b/configure
----------------------------------------------------------------------
diff --git a/configure b/configure
index ae9564e..2131eb6 100755
--- a/configure
+++ b/configure
@@ -710,6 +710,7 @@ with_gnu_ld
 LD
 LDFLAGS_SL
 LDFLAGS_EX
+INCLUDES
 ELF_SYS
 EGREP
 GREP
@@ -732,7 +733,6 @@ with_python
 with_perl
 with_tcl
 enable_thread_safety
-INCLUDES
 ORCA_DEPENDS_OBJDIR_DEFAULT
 ORCA_DEPENDS_DIR_INTER
 enable_orca
@@ -5508,40 +5508,6 @@ fi
 
 
 #
-# Include directories
-#
-ac_save_IFS=$IFS
-IFS="${IFS}${PATH_SEPARATOR}"
-# SRCH_INC comes from the template file
-for dir in $with_includes $SRCH_INC; do
-  if test -d "$dir"; then
-    INCLUDES="$INCLUDES -I$dir"
-  else
-    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: *** Include directory $dir does not exist." >&5
-$as_echo "$as_me: WARNING: *** Include directory $dir does not exist." >&2;}
-  fi
-done
-IFS=$ac_save_IFS
-
-
-
-#
-# Library directories
-#
-ac_save_IFS=$IFS
-IFS="${IFS}${PATH_SEPARATOR}"
-# LIBRARY_DIRS comes from command line, SRCH_LIB from template file.
-for dir in $LIBRARY_DIRS $SRCH_LIB; do
-  if test -d "$dir"; then
-    LIBDIRS="$LIBDIRS -L$dir"
-  else
-    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: *** Library directory $dir does not exist." >&5
-$as_echo "$as_me: WARNING: *** Library directory $dir does not exist." >&2;}
-  fi
-done
-IFS=$ac_save_IFS
-
-#
 # Enable thread-safe client libraries
 #
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking allow thread-safe client libraries" >&5
@@ -6456,6 +6422,45 @@ rm -f conftest*
 
 
 #
+# Include directories
+#
+#INCLUDES="$INCLUDES -I$ac_pwd/depends/thirdparty/googletest/googletest/include -I$ac_pwd/depends/thirdparty/googletest/googlemock/include"
+
+ac_save_IFS=$IFS
+IFS="${IFS}${PATH_SEPARATOR}"
+# SRCH_INC comes from the template file
+for dir in $with_includes $SRCH_INC; do
+  if test -d "$dir"; then
+    INCLUDES="$INCLUDES -I$dir"
+  else
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: *** Include directory $dir does not exist." >&5
+$as_echo "$as_me: WARNING: *** Include directory $dir does not exist." >&2;}
+  fi
+done
+IFS=$ac_save_IFS
+
+
+
+#
+# Library directories
+#
+#LIBDIRS="$LIBDIRS -L$ac_pwd/depends/thirdparty/googletest/build/googlemock/gtest -L$ac_pwd/depends/thirdparty/googletest/build/googlemock"
+
+ac_save_IFS=$IFS
+IFS="${IFS}${PATH_SEPARATOR}"
+# LIBRARY_DIRS comes from command line, SRCH_LIB from template file.
+for dir in $LIBRARY_DIRS $SRCH_LIB; do
+  if test -d "$dir"; then
+    LIBDIRS="$LIBDIRS -L$dir"
+  else
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: *** Library directory $dir does not exist." >&5
+$as_echo "$as_me: WARNING: *** Library directory $dir does not exist." >&2;}
+  fi
+done
+IFS=$ac_save_IFS
+
+
+#
 # Assignments
 #
 
@@ -16419,8 +16424,7 @@ $as_echo "done" >&6; }
 fi
 
 
-
-ac_config_files="$ac_config_files GNUmakefile src/VERSIONS.mk depends/libhdfs3/Makefile.global depends/libyarn/Makefile.global src/Makefile.global src/pl/pljava/src/java/Makefile.global"
+ac_config_files="$ac_config_files GNUmakefile src/VERSIONS.mk depends/thirdparty/googletest/Makefile.global depends/libhdfs3/Makefile.global depends/libyarn/Makefile.global src/Makefile.global src/pl/pljava/src/java/Makefile.global"
 
 
 ac_config_links="$ac_config_links src/backend/port/dynloader.c:src/backend/port/dynloader/${template}.c src/backend/port/pg_sema.c:${SEMA_IMPLEMENTATION} src/backend/port/pg_shmem.c:${SHMEM_IMPLEMENTATION} src/include/dynloader.h:src/backend/port/dynloader/${template}.h src/include/pg_config_os.h:src/include/port/${template}.h src/Makefile.port:src/makefiles/Makefile.${template}"
@@ -17140,6 +17144,7 @@ do
     "src/backend/port/tas.s") CONFIG_LINKS="$CONFIG_LINKS src/backend/port/tas.s:src/backend/port/tas/${tas_file}" ;;
     "GNUmakefile") CONFIG_FILES="$CONFIG_FILES GNUmakefile" ;;
     "src/VERSIONS.mk") CONFIG_FILES="$CONFIG_FILES src/VERSIONS.mk" ;;
+    "depends/thirdparty/googletest/Makefile.global") CONFIG_FILES="$CONFIG_FILES depends/thirdparty/googletest/Makefile.global" ;;
     "depends/libhdfs3/Makefile.global") CONFIG_FILES="$CONFIG_FILES depends/libhdfs3/Makefile.global" ;;
     "depends/libyarn/Makefile.global") CONFIG_FILES="$CONFIG_FILES depends/libyarn/Makefile.global" ;;
     "src/Makefile.global") CONFIG_FILES="$CONFIG_FILES src/Makefile.global" ;;
@@ -17806,4 +17811,3 @@ for pgac_var in `set | sed 's/=.*//' | $EGREP 'with_|enable_'`; do
   { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: option ignored: --$pgac_txt" >&5
 $as_echo "$as_me: WARNING: option ignored: --$pgac_txt" >&2;}
 done
-

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/1f794e2b/configure.in
----------------------------------------------------------------------
diff --git a/configure.in b/configure.in
index 391e17e..34d77fe 100644
--- a/configure.in
+++ b/configure.in
@@ -652,38 +652,6 @@ AC_SUBST(ORCA_DEPENDS_DIR_INTER)
 AC_SUBST(ORCA_DEPENDS_OBJDIR_DEFAULT)
 
 #
-# Include directories
-#
-ac_save_IFS=$IFS
-IFS="${IFS}${PATH_SEPARATOR}"
-# SRCH_INC comes from the template file
-for dir in $with_includes $SRCH_INC; do
-  if test -d "$dir"; then
-    INCLUDES="$INCLUDES -I$dir"
-  else
-    AC_MSG_WARN([*** Include directory $dir does not exist.])
-  fi
-done
-IFS=$ac_save_IFS
-AC_SUBST(INCLUDES)
-
-
-#
-# Library directories
-#
-ac_save_IFS=$IFS
-IFS="${IFS}${PATH_SEPARATOR}"
-# LIBRARY_DIRS comes from command line, SRCH_LIB from template file.
-for dir in $LIBRARY_DIRS $SRCH_LIB; do
-  if test -d "$dir"; then
-    LIBDIRS="$LIBDIRS -L$dir"
-  else
-    AC_MSG_WARN([*** Library directory $dir does not exist.])
-  fi
-done
-IFS=$ac_save_IFS
-
-#
 # Enable thread-safe client libraries
 #
 AC_MSG_CHECKING([allow thread-safe client libraries])
@@ -918,6 +886,43 @@ fi])
 AC_SUBST(ELF_SYS)
 
 #
+# Include directories
+#
+#INCLUDES="$INCLUDES -I$ac_pwd/depends/thirdparty/googletest/googletest/include -I$ac_pwd/depends/thirdparty/googletest/googlemock/include"
+
+ac_save_IFS=$IFS
+IFS="${IFS}${PATH_SEPARATOR}"
+# SRCH_INC comes from the template file
+for dir in $with_includes $SRCH_INC; do
+  if test -d "$dir"; then
+    INCLUDES="$INCLUDES -I$dir"
+  else
+    AC_MSG_WARN([*** Include directory $dir does not exist.])
+  fi
+done
+IFS=$ac_save_IFS
+AC_SUBST(INCLUDES)
+
+
+#
+# Library directories
+#
+#LIBDIRS="$LIBDIRS -L$ac_pwd/depends/thirdparty/googletest/build/googlemock/gtest -L$ac_pwd/depends/thirdparty/googletest/build/googlemock"
+
+ac_save_IFS=$IFS
+IFS="${IFS}${PATH_SEPARATOR}"
+# LIBRARY_DIRS comes from command line, SRCH_LIB from template file.
+for dir in $LIBRARY_DIRS $SRCH_LIB; do
+  if test -d "$dir"; then
+    LIBDIRS="$LIBDIRS -L$dir"
+  else
+    AC_MSG_WARN([*** Library directory $dir does not exist.])
+  fi
+done
+IFS=$ac_save_IFS
+
+
+#
 # Assignments
 #
 
@@ -2057,8 +2062,7 @@ else
 fi
 AC_SUBST(vpath_build)
 
-
-AC_CONFIG_FILES([GNUmakefile src/VERSIONS.mk src/Makefile.global depends/libhdfs3/Makefile.global depends/libyarn/Makefile.global src/Makefile.global src/pl/pljava/src/java/Makefile.global])
+AC_CONFIG_FILES([GNUmakefile src/VERSIONS.mk depends/thirdparty/googletest/Makefile.global depends/libhdfs3/Makefile.global depends/libyarn/Makefile.global src/Makefile.global src/pl/pljava/src/java/Makefile.global])
 
 AC_CONFIG_LINKS([
   src/backend/port/dynloader.c:src/backend/port/dynloader/${template}.c
@@ -2094,4 +2098,3 @@ AC_OUTPUT
 
 # Warn about unknown options
 PGAC_ARG_CHECK
-

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/1f794e2b/depends/libhdfs3/CMake/FindGoogleTest.cmake
----------------------------------------------------------------------
diff --git a/depends/libhdfs3/CMake/FindGoogleTest.cmake b/depends/libhdfs3/CMake/FindGoogleTest.cmake
index 94c84f7..75053fd 100644
--- a/depends/libhdfs3/CMake/FindGoogleTest.cmake
+++ b/depends/libhdfs3/CMake/FindGoogleTest.cmake
@@ -3,27 +3,38 @@ include(CheckCXXSourceRuns)
 find_path(GoogleTest_INCLUDE_DIR gtest/gtest.h
           NO_DEFAULT_PATH
           PATHS
+          "${PROJECT_SOURCE_DIR}/../thirdparty/googletest/googletest/include"
+          "/usr/local/include"
+          "/usr/include")
+
+find_path(GoogleMock_INCLUDE_DIR gmock/gmock.h
+          NO_DEFAULT_PATH
+          PATHS
+          "${PROJECT_SOURCE_DIR}/../thirdparty/googletest/googlemock/include"
           "/usr/local/include"
           "/usr/include")
 
 find_library(Gtest_LIBRARY
              NAMES libgtest.a
              HINTS
+             "${PROJECT_SOURCE_DIR}/../thirdparty/googletest/build/googlemock/gtest"
              "/usr/local/lib"
              "/usr/lib")
 
 find_library(Gmock_LIBRARY
              NAMES libgmock.a
              HINTS
+             "${PROJECT_SOURCE_DIR}/../thirdparty/googletest/build/googlemock"
              "/usr/local/lib"
              "/usr/lib")
 
 message(STATUS "Find GoogleTest include path: ${GoogleTest_INCLUDE_DIR}")
+message(STATUS "Find GoogleMock include path: ${GoogleMock_INCLUDE_DIR}")
 message(STATUS "Find Gtest library path: ${Gtest_LIBRARY}")
 message(STATUS "Find Gmock library path: ${Gmock_LIBRARY}")
 
-set(CMAKE_REQUIRED_INCLUDES ${GoogleTest_INCLUDE_DIR})
-set(CMAKE_REQUIRED_LIBRARIES ${Gtest_LIBRARY} ${Gmock_LIBRARY})
+set(CMAKE_REQUIRED_INCLUDES ${GoogleTest_INCLUDE_DIR} ${GoogleMock_INCLUDE_DIR})
+set(CMAKE_REQUIRED_LIBRARIES ${Gtest_LIBRARY} ${Gmock_LIBRARY} -lpthread)
 set(CMAKE_REQUIRED_FLAGS)
 check_cxx_source_runs("
 #include <gtest/gtest.h>

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/1f794e2b/depends/libhdfs3/Makefile
----------------------------------------------------------------------
diff --git a/depends/libhdfs3/Makefile b/depends/libhdfs3/Makefile
index c5702ae..3f26baa 100644
--- a/depends/libhdfs3/Makefile
+++ b/depends/libhdfs3/Makefile
@@ -6,7 +6,7 @@ subdir = depends/libhdfs3
 top_builddir = ../../
 include Makefile.global
 
-PRE_CFG_ARG = 
+PRE_CFG_ARG =
 # get argument for running ../boostrap
 ifeq ($(enable_debug), yes)
 	PRE_CFG_ARG += --enable-debug
@@ -18,14 +18,16 @@ endif # enable_coverage
 
 ##########################################################################
 #
-.PHONY: all install distclean maintainer-clean clean pre-config
+.PHONY: build all install distclean maintainer-clean clean pre-config
 
 ifeq ($(with_libhdfs3), yes)
 
-all: pre-config
-	cd $(top_srcdir)/$(subdir)/build && $(MAKE)
+# Hack: For the target "all", we will install them temporarily under build/install to compile hawq
+all: build
+	cd $(top_srcdir)/$(subdir)/build; mkdir -p install; \
+	$(MAKE) DESTDIR=$(abs_top_builddir)/$(subdir)/build/install install
 
-install: all 
+install: build
 	cd $(top_srcdir)/$(subdir)/build && $(MAKE) install
 
 distclean:
@@ -35,11 +37,20 @@ maintainer-clean: distclean
 
 clean:
 	if [ -d $(top_srcdir)/$(subdir)/build ]; then \
-		cd $(top_srcdir)/$(subdir)/build && $(MAKE) clean; \
+		cd $(top_srcdir)/$(subdir)/build && $(MAKE) clean && rm -f build.timestamp; \
 	fi
 
+build: pre-config
+	cd $(top_srcdir)/$(subdir)/build && $(MAKE)
+
+# trigger bootstrap only once.
 pre-config:
-	cd $(top_srcdir)/$(subdir)/ && mkdir -p build && cd build && ../bootstrap --prefix=$(prefix) $(PRE_CFG_ARG)
+	cd $(top_srcdir)/$(subdir)/; \
+	mkdir -p build; \
+	cd build; \
+	if [ ! -f build.timestamp ]; then \
+		$(abs_top_srcdir)/$(subdir)/bootstrap --prefix=$(prefix) $(PRE_CFG_ARG) && touch build.timestamp; \
+	fi
 
 else
 

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/1f794e2b/depends/libhdfs3/Makefile.global.in
----------------------------------------------------------------------
diff --git a/depends/libhdfs3/Makefile.global.in b/depends/libhdfs3/Makefile.global.in
index 745de2b..b1ee80f 100644
--- a/depends/libhdfs3/Makefile.global.in
+++ b/depends/libhdfs3/Makefile.global.in
@@ -11,6 +11,7 @@ with_libhdfs3 = @with_libhdfs3@
 # Support for VPATH builds
 vpath_build = @vpath_build@
 abs_top_srcdir = @abs_top_srcdir@
+abs_top_builddir = @abs_top_builddir@
 
 ifneq ($(vpath_build),yes)
 top_srcdir = $(top_builddir)

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/1f794e2b/depends/libyarn/CMake/FindGoogleTest.cmake
----------------------------------------------------------------------
diff --git a/depends/libyarn/CMake/FindGoogleTest.cmake b/depends/libyarn/CMake/FindGoogleTest.cmake
index 94c84f7..75053fd 100644
--- a/depends/libyarn/CMake/FindGoogleTest.cmake
+++ b/depends/libyarn/CMake/FindGoogleTest.cmake
@@ -3,27 +3,38 @@ include(CheckCXXSourceRuns)
 find_path(GoogleTest_INCLUDE_DIR gtest/gtest.h
           NO_DEFAULT_PATH
           PATHS
+          "${PROJECT_SOURCE_DIR}/../thirdparty/googletest/googletest/include"
+          "/usr/local/include"
+          "/usr/include")
+
+find_path(GoogleMock_INCLUDE_DIR gmock/gmock.h
+          NO_DEFAULT_PATH
+          PATHS
+          "${PROJECT_SOURCE_DIR}/../thirdparty/googletest/googlemock/include"
           "/usr/local/include"
           "/usr/include")
 
 find_library(Gtest_LIBRARY
              NAMES libgtest.a
              HINTS
+             "${PROJECT_SOURCE_DIR}/../thirdparty/googletest/build/googlemock/gtest"
              "/usr/local/lib"
              "/usr/lib")
 
 find_library(Gmock_LIBRARY
              NAMES libgmock.a
              HINTS
+             "${PROJECT_SOURCE_DIR}/../thirdparty/googletest/build/googlemock"
              "/usr/local/lib"
              "/usr/lib")
 
 message(STATUS "Find GoogleTest include path: ${GoogleTest_INCLUDE_DIR}")
+message(STATUS "Find GoogleMock include path: ${GoogleMock_INCLUDE_DIR}")
 message(STATUS "Find Gtest library path: ${Gtest_LIBRARY}")
 message(STATUS "Find Gmock library path: ${Gmock_LIBRARY}")
 
-set(CMAKE_REQUIRED_INCLUDES ${GoogleTest_INCLUDE_DIR})
-set(CMAKE_REQUIRED_LIBRARIES ${Gtest_LIBRARY} ${Gmock_LIBRARY})
+set(CMAKE_REQUIRED_INCLUDES ${GoogleTest_INCLUDE_DIR} ${GoogleMock_INCLUDE_DIR})
+set(CMAKE_REQUIRED_LIBRARIES ${Gtest_LIBRARY} ${Gmock_LIBRARY} -lpthread)
 set(CMAKE_REQUIRED_FLAGS)
 check_cxx_source_runs("
 #include <gtest/gtest.h>

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/1f794e2b/depends/libyarn/Makefile
----------------------------------------------------------------------
diff --git a/depends/libyarn/Makefile b/depends/libyarn/Makefile
index 20b71f2..29a7e53 100644
--- a/depends/libyarn/Makefile
+++ b/depends/libyarn/Makefile
@@ -6,7 +6,7 @@ subdir = depends/libyarn
 top_builddir = ../../
 include Makefile.global
 
-PRE_CFG_ARG = 
+PRE_CFG_ARG =
 # get argument for running ../boostrap
 ifeq ($(enable_debug), yes)
 	PRE_CFG_ARG += --enable-debug
@@ -18,14 +18,16 @@ endif # enable_coverage
 
 ##########################################################################
 #
-.PHONY: all install distclean maintainer-clean clean pre-config
+.PHONY: build all install distclean maintainer-clean clean pre-config
 
 ifeq ($(with_libyarn), yes)
 
-all: pre-config
-	cd $(top_srcdir)/$(subdir)/build && $(MAKE)
+# Hack: For the target "all", we will install them temporarily under build/install to compile hawq
+all: build
+	cd $(top_srcdir)/$(subdir)/build; mkdir -p install; \
+	$(MAKE) DESTDIR=$(abs_top_builddir)/$(subdir)/build/install install
 
-install: all
+install: build
 	cd $(top_srcdir)/$(subdir)/build && $(MAKE) install
 
 distclean:
@@ -35,11 +37,20 @@ maintainer-clean: distclean
 
 clean:
 	if [ -d $(top_srcdir)/$(subdir)/build ]; then \
-		cd $(top_srcdir)/$(subdir)/build && $(MAKE) clean; \
+		cd $(top_srcdir)/$(subdir)/build && $(MAKE) clean && rm -f build.timestamp; \
 	fi
 
+build: pre-config
+	cd $(top_srcdir)/$(subdir)/build && $(MAKE)
+
+# trigger bootstrap only once.
 pre-config:
-	cd $(top_srcdir)/$(subdir)/ && mkdir -p build && cd build && ../bootstrap --prefix=$(prefix) $(PRE_CFG_ARG)
+	cd $(top_srcdir)/$(subdir)/; \
+	mkdir -p build; \
+	cd build; \
+	if [ ! -f build.timestamp ]; then \
+		$(abs_top_srcdir)/$(subdir)/bootstrap --prefix=$(prefix) $(PRE_CFG_ARG) && touch build.timestamp; \
+	fi
 
 else
 

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/1f794e2b/depends/libyarn/Makefile.global.in
----------------------------------------------------------------------
diff --git a/depends/libyarn/Makefile.global.in b/depends/libyarn/Makefile.global.in
index b3806aa..38bf5a5 100644
--- a/depends/libyarn/Makefile.global.in
+++ b/depends/libyarn/Makefile.global.in
@@ -11,6 +11,7 @@ with_libyarn = @with_libyarn@
 # Support for VPATH builds
 vpath_build = @vpath_build@
 abs_top_srcdir = @abs_top_srcdir@
+abs_top_builddir = @abs_top_builddir@
 
 ifneq ($(vpath_build),yes)
 top_srcdir = $(top_builddir)

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/1f794e2b/depends/thirdparty/googletest/.gitignore
----------------------------------------------------------------------
diff --git a/depends/thirdparty/googletest/.gitignore b/depends/thirdparty/googletest/.gitignore
new file mode 100644
index 0000000..8341b2e
--- /dev/null
+++ b/depends/thirdparty/googletest/.gitignore
@@ -0,0 +1,2 @@
+build/
+Makefile.global

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/1f794e2b/depends/thirdparty/googletest/Makefile
----------------------------------------------------------------------
diff --git a/depends/thirdparty/googletest/Makefile b/depends/thirdparty/googletest/Makefile
new file mode 100644
index 0000000..feb7d6c
--- /dev/null
+++ b/depends/thirdparty/googletest/Makefile
@@ -0,0 +1,24 @@
+subdir = depends/thirdparty/googletest
+top_builddir = ../../../
+include Makefile.global
+
+.PHONY: all install distclean maintainer-clean clean pre-config
+
+all: pre-config
+	cd $(top_srcdir)/$(subdir)/build && $(MAKE)
+
+install: all
+	cd $(top_srcdir)/$(subdir)/build && $(MAKE) install
+
+distclean:
+	rm -rf $(top_srcdir)/$(subdir)/build
+
+maintainer-clean: distclean
+
+clean:
+	if [ -d $(top_srcdir)/$(subdir)/build ]; then \
+		cd $(top_srcdir)/$(subdir)/build && $(MAKE) clean; \
+	fi
+
+pre-config:
+	cd $(top_srcdir)/$(subdir)/ && mkdir -p build && cd build && cmake -DCMAKE_INSTALL_PREFIX=$(prefix) ..

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/1f794e2b/depends/thirdparty/googletest/Makefile.global.in
----------------------------------------------------------------------
diff --git a/depends/thirdparty/googletest/Makefile.global.in b/depends/thirdparty/googletest/Makefile.global.in
new file mode 100644
index 0000000..6e80a14
--- /dev/null
+++ b/depends/thirdparty/googletest/Makefile.global.in
@@ -0,0 +1,14 @@
+prefix := @prefix@
+
+# Support for VPATH builds
+vpath_build = @vpath_build@
+abs_top_srcdir = @abs_top_srcdir@
+
+ifneq ($(vpath_build),yes)
+top_srcdir = $(top_builddir)
+srcdir = .
+else # vpath_build = yes
+top_srcdir = $(abs_top_srcdir)
+srcdir = $(top_srcdir)/$(subdir)
+VPATH = $(srcdir)
+endif

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/1f794e2b/src/Makefile
----------------------------------------------------------------------
diff --git a/src/Makefile b/src/Makefile
index 2b08a89..062202c 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -26,10 +26,10 @@ all install installdirs uninstall distprep:
 	$(MAKE) -C test/regress $@
 	$(MAKE) -C tools/fsync $@
 
-feature_test:
-	$(MAKE) -C test feature_test
+feature-test:
+	$(MAKE) -C test feature-test
 
-feature_test_clean:
+feature-test-clean:
 	$(MAKE) -C test clean
 
 install: install-local

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/1f794e2b/src/Makefile.global.in
----------------------------------------------------------------------
diff --git a/src/Makefile.global.in b/src/Makefile.global.in
index 702b567..26a449b 100644
--- a/src/Makefile.global.in
+++ b/src/Makefile.global.in
@@ -23,7 +23,7 @@
 # make `all' the default target
 all:
 
-feature_test:
+feature-test:
 
 # Delete target files if the command fails after it has
 # started to update the file.
@@ -221,6 +221,7 @@ COLLATEINDEX	= @COLLATEINDEX@
 
 CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
+CPPFLAGS += -I$(abs_top_srcdir)/depends/libhdfs3/build/install$(prefix)/include -I$(abs_top_srcdir)/depends/libyarn/build/install$(prefix)/include
 
 ifdef PGXS
 override CPPFLAGS := -I$(includedir_server) -I$(includedir_internal) $(CPPFLAGS)
@@ -277,6 +278,8 @@ else
   LDFLAGS = -L$(top_builddir)/src/port
 endif
 LDFLAGS += @LDFLAGS@
+LDFLAGS += -L$(abs_top_srcdir)/depends/libhdfs3/build/install$(prefix)/lib
+LDFLAGS += -L$(abs_top_srcdir)/depends/libyarn/build/install$(prefix)/lib
 
 LDFLAGS_EX = @LDFLAGS_EX@
 # LDFLAGS_SL might have already been assigned by calling makefile

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/1f794e2b/src/test/Makefile
----------------------------------------------------------------------
diff --git a/src/test/Makefile b/src/test/Makefile
index 87871ad..41cad9c 100644
--- a/src/test/Makefile
+++ b/src/test/Makefile
@@ -16,7 +16,7 @@
 .DEFAULT:
 	$(MAKE) -C regress $@
 
-feature_test:
+feature-test:
 	$(MAKE) -C feature all
 
 clean:

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/1f794e2b/src/test/feature/Makefile
----------------------------------------------------------------------
diff --git a/src/test/feature/Makefile b/src/test/feature/Makefile
index c89fb1a..cb7c60f 100644
--- a/src/test/feature/Makefile
+++ b/src/test/feature/Makefile
@@ -6,11 +6,16 @@ include $(top_builddir)/src/Makefile.global
 
 include $(top_builddir)/src/Makefile.global
 
+gtest_include = $(top_builddir)/depends/thirdparty/googletest/googletest/include
+gmock_include = $(top_builddir)/depends/thirdparty/googletest/googlemock/include
+gtest_lib_path = $(top_builddir)/depends/thirdparty/googletest/build/googlemock
+gmock_lib_path = $(top_builddir)/depends/thirdparty/googletest/build/googlemock/gtest
+
 override CXXFLAGS = -Wall -O0 -g -std=c++11
-override CPPFLAGS := -I/usr/include -I/usr/local/include -I/usr/include/libxml2 -I$(top_builddir)/src/test/feature/ -I$(top_builddir)/src/test/feature/lib/ -I$(top_builddir)/src/interfaces/libpq -I$(top_builddir)/src/interfaces -I$(top_builddir)/src/include
+override CPPFLAGS := -I/usr/include -I/usr/local/include -I/usr/include/libxml2 -I$(top_builddir)/src/test/feature/ -I$(top_builddir)/src/test/feature/lib/ -I$(top_builddir)/src/interfaces/libpq -I$(top_builddir)/src/interfaces -I$(top_builddir)/src/include  -I$(gtest_include) -I$(gmock_include)
 
 override LIBS := $(LIBS) -lgtest -lpq -lxml2 -ltest
-override LDFLAGS += -L/usr/local/lib -L/usr/lib -L$(top_builddir)/src/test/feature/lib
+override LDFLAGS += -L/usr/local/lib -L/usr/lib -L$(top_builddir)/src/test/feature/lib -L$(gtest_lib_path) -L$(gmock_lib_path)
 
 PROG = test-main.cpp testlib/test-lib.cpp
 

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/1f794e2b/src/test/feature/lib/Makefile
----------------------------------------------------------------------
diff --git a/src/test/feature/lib/Makefile b/src/test/feature/lib/Makefile
index 204952c..afe2aa8 100644
--- a/src/test/feature/lib/Makefile
+++ b/src/test/feature/lib/Makefile
@@ -1,12 +1,16 @@
 subdir = src/test/feature/lib
 top_builddir = ../../../..
 include $(top_builddir)/src/Makefile.global
+gtest_include = $(top_builddir)/depends/thirdparty/googletest/googletest/include
+gmock_include = $(top_builddir)/depends/thirdparty/googletest/googlemock/include
+gtest_lib_path = $(top_builddir)/depends/thirdparty/googletest/build/googlemock
+gmock_lib_path = $(top_builddir)/depends/thirdparty/googletest/build/googlemock/gtest
 
 override CXXFLAGS = -Wall -O0 -g -c -std=c++11
-override CPPFLAGS := -I/usr/include -I/usr/local/include -I/usr/include/libxml2 -I$(top_builddir)/src/interfaces/libpq -I$(top_builddir)/src/interfaces -I$(top_builddir)/src/include
+override CPPFLAGS := -I/usr/include -I/usr/local/include -I/usr/include/libxml2 -I$(top_builddir)/src/interfaces/libpq -I$(top_builddir)/src/interfaces -I$(top_builddir)/src/include -I$(gtest_include) -I$(gmock_include)
 
 override LIBS := $(LIBS) -lpq -lxml2
-override LDFLAGS += -L/usr/local/lib -L/usr/lib
+override LDFLAGS += -L/usr/local/lib -L/usr/lib -L$(gtest_lib_path) -L$(gmock_lib_path)
 
 PROG = $(abspath string-util.cpp psql.cpp command.cpp xml-parser.cpp hawq-config.cpp sql-util.cpp data-gen.cpp)