summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChase Douglas <chase.douglas@ubuntu.com>2011-12-14 08:25:54 -0800
committerChase Douglas <chase.douglas@ubuntu.com>2011-12-14 08:25:54 -0800
commitbb34e8586f1d74e4717dc8300bea6628b9a38804 (patch)
treeade70db0afe4cb29751fdba1697581733ead2a8b
parent4ee62b348d2346e03b6cbbfd94f710eda499d011 (diff)
parent5b07f09f0713b670070e4d44ada2aeab3f6e883c (diff)
Merge gtest configure check fixes
-rw-r--r--configure.ac3
-rw-r--r--m4/gtest.m412
2 files changed, 11 insertions, 4 deletions
diff --git a/configure.ac b/configure.ac
index af3bffc..b2cef93 100644
--- a/configure.ac
+++ b/configure.ac
@@ -31,7 +31,8 @@ PKG_CHECK_MODULES( XSERVER, x11 [xorg-server] )
# Check for Google Test
AC_CHECK_GTEST
-AM_CONDITIONAL([HAVE_GTEST], [test "x$have_gtest" = xyes])
+AS_IF([test "x$ac_cv_lib_gtest_main" != xyes],
+ AC_MSG_ERROR([package 'gtest' not found]))
AC_SUBST([GTEST_LDFLAGS])
AC_SUBST([GTEST_CXXFLAGS])
diff --git a/m4/gtest.m4 b/m4/gtest.m4
index 459d1f5..d7e0b85 100644
--- a/m4/gtest.m4
+++ b/m4/gtest.m4
@@ -16,9 +16,15 @@ AC_DEFUN([AC_CHECK_GTEST],
[GTEST_LDFLAGS="-L$withval -lpthread"],
[GTEST_LDFLAGS='-lgtest -lpthread'])
- AC_HAVE_LIBRARY( [gtest],
- [have_gtest=yes],
- AC_MSG_WARN([package 'gtest' not found: tests disabled]))
+ AC_LANG_PUSH(C++)
+ # We need to get to the 5th arg to link with -lpthread too. Mimic the default
+ # AC_CHECK_LIB action when found.
+ AC_CHECK_LIB([gtest], [main],
+ [AC_DEFINE(HAVE_LIBGTEST) LIBS="-lgtest $LIBS"],
+ [],
+ [-lpthread])
+
+ AC_LANG_POP
]) # AC_CHECK_GTEST