diff options
author | Chris Dyer <redpony@gmail.com> | 2009-12-03 16:49:30 -0500 |
---|---|---|
committer | Chris Dyer <redpony@gmail.com> | 2009-12-03 16:49:30 -0500 |
commit | 9fae7b75c64f4dfb6e45ff8f2ec61b597f37d225 (patch) | |
tree | 61a187c4fa6db8527f90f3060d18357f7b60b44a /m4/gtest.m4 | |
parent | 671c21451542e2dd20e45b4033d44d8e8735f87b (diff) |
fix build in new layout
Diffstat (limited to 'm4/gtest.m4')
-rw-r--r-- | m4/gtest.m4 | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/m4/gtest.m4 b/m4/gtest.m4 new file mode 100644 index 00000000..ebb488a8 --- /dev/null +++ b/m4/gtest.m4 @@ -0,0 +1,61 @@ +dnl GTEST_LIB_CHECK([minimum version [, +dnl action if found [,action if not found]]]) +dnl +dnl Check for the presence of the Google Test library, optionally at a minimum +dnl version, and indicate a viable version with the HAVE_GTEST flag. It defines +dnl standard variables for substitution including GTEST_CPPFLAGS, +dnl GTEST_CXXFLAGS, GTEST_LDFLAGS, and GTEST_LIBS. It also defines +dnl GTEST_VERSION as the version of Google Test found. Finally, it provides +dnl optional custom action slots in the event GTEST is found or not. +AC_DEFUN([GTEST_LIB_CHECK], +[ +dnl Provide a flag to enable or disable Google Test usage. +AC_ARG_ENABLE([gtest], + [AS_HELP_STRING([--enable-gtest], + [Enable tests using the Google C++ Testing Framework.] + [(Default is enabled.)])], + [], + [enable_gtest=check]) +AC_ARG_VAR([GTEST_CONFIG], + [The exact path of Google Test's 'gtest-config' script.]) +AC_ARG_VAR([GTEST_CPPFLAGS], + [C-like preprocessor flags for Google Test.]) +AC_ARG_VAR([GTEST_CXXFLAGS], + [C++ compile flags for Google Test.]) +AC_ARG_VAR([GTEST_LDFLAGS], + [Linker path and option flags for Google Test.]) +AC_ARG_VAR([GTEST_LIBS], + [Library linking flags for Google Test.]) +AC_ARG_VAR([GTEST_VERSION], + [The version of Google Test available.]) +HAVE_GTEST="no" +AS_IF([test "x$enable_gtest" != "xno"], + [AC_PATH_PROG([GTEST_CONFIG], [gtest-config]) + AS_IF([test -x "$GTEST_CONFIG"], + [AS_IF([test "x$1" != "x"], + [_min_version="--min-version=$1" + AC_MSG_CHECKING([for Google Test at least version >= $1])], + [_min_version="--min-version=0" + AC_MSG_CHECKING([for Google Test])]) + AS_IF([$GTEST_CONFIG $_min_version], + [AC_MSG_RESULT([yes]) + HAVE_GTEST="yes"], + [AC_MSG_RESULT([no])])]) + AS_IF([test "x$HAVE_GTEST" = "xyes"], + [GTEST_CPPFLAGS=$($GTEST_CONFIG --cppflags) + GTEST_CXXFLAGS=$($GTEST_CONFIG --cxxflags) + GTEST_LDFLAGS=$($GTEST_CONFIG --ldflags) + GTEST_LIBS=$($GTEST_CONFIG --libs) + GTEST_VERSION=$($GTEST_CONFIG --version) + AC_DEFINE([HAVE_GTEST],[1],[Defined when Google Test is available.])], + [AS_IF([test "x$enable_gtest" = "xyes"], + [AC_MSG_ERROR([ + The Google C++ Testing Framework was explicitly enabled, but a viable version + could not be found on the system. +])])])]) +AC_SUBST([HAVE_GTEST]) +AM_CONDITIONAL([HAVE_GTEST],[test "x$HAVE_GTEST" = "xyes"]) +AS_IF([test "x$HAVE_GTEST" = "xyes"], + [AS_IF([test "x$2" != "x"],[$2],[:])], + [AS_IF([test "x$3" != "x"],[$3],[:])]) +]) |