diff options
author | Chris Dyer <cdyer@cs.cmu.edu> | 2011-09-28 16:05:50 +0100 |
---|---|---|
committer | Chris Dyer <cdyer@cs.cmu.edu> | 2011-09-28 16:05:50 +0100 |
commit | 5e83a23897b5160fa96788c5828d23ab1912d1a6 (patch) | |
tree | fada8e7f0d80e01d517175103b586ee38d312644 /m4 | |
parent | d90a90e61084c069addaa919023dc6896d2f401a (diff) |
upgrade gtest m4 config
Diffstat (limited to 'm4')
-rw-r--r-- | m4/gtest.m4 | 65 |
1 files changed, 39 insertions, 26 deletions
diff --git a/m4/gtest.m4 b/m4/gtest.m4 index b015ddeb..28ccd2de 100644 --- a/m4/gtest.m4 +++ b/m4/gtest.m4 @@ -12,10 +12,10 @@ 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 tests using the Google C++ Testing Framework. + (Default is enabled.)])], [], - [enable_gtest=check]) + [enable_gtest=]) AC_ARG_VAR([GTEST_CONFIG], [The exact path of Google Test's 'gtest-config' script.]) AC_ARG_VAR([GTEST_CPPFLAGS], @@ -29,33 +29,46 @@ AC_ARG_VAR([GTEST_LIBS], 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" +AS_IF([test "x${enable_gtest}" != "xno"], + [AC_MSG_CHECKING([for 'gtest-config']) + AS_IF([test "x${enable_gtest}" != "xyes"], + [AS_IF([test -x "${enable_gtest}/scripts/gtest-config"], + [GTEST_CONFIG="${enable_gtest}/scripts/gtest-config"], + [GTEST_CONFIG="${enable_gtest}/bin/gtest-config"]) + AS_IF([test -x "${GTEST_CONFIG}"], [], + [AC_MSG_RESULT([no]) + AC_MSG_ERROR([dnl +Unable to locate either a built or installed Google Test. +The specific location '${enable_gtest}' was provided for a built or installed +Google Test, but no 'gtest-config' script could be found at this location.]) + ])], + [AC_PATH_PROG([GTEST_CONFIG], [gtest-config])]) + AS_IF([test -x "${GTEST_CONFIG}"], + [AC_MSG_RESULT([${GTEST_CONFIG}]) + m4_ifval([$1], + [_gtest_min_version="--min-version=$1" AC_MSG_CHECKING([for Google Test at least version >= $1])], - [_min_version="--min-version=0" + [_gtest_min_version="--min-version=0" AC_MSG_CHECKING([for Google Test])]) - AS_IF([$GTEST_CONFIG $_min_version], + AS_IF([${GTEST_CONFIG} ${_gtest_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 | sed 's/la/a/') - GTEST_VERSION=$($GTEST_CONFIG --version) + HAVE_GTEST='yes'], + [AC_MSG_RESULT([no])])], + [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. -])])])]) + [AS_IF([test "x${enable_gtest}" = "xyes"], + [AC_MSG_ERROR([dnl +Google Test was enabled, but no viable version could be found.]) + ])])]) 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],[:])]) +dnl AS_IF([test "x$HAVE_GTEST" = "xyes"], [] []) +dnl [m4_ifval([$2], [$2])], +dnl [m4_ifval([$3], [$3])]) ]) |