Allow --with-gtest argument with no directory

Added the option to not provide a directory name when using
--with-gtest

refs #237
This commit is contained in:
Alex Lin 2016-05-12 14:42:23 -05:00
parent f19c002365
commit 9d3a51625f
2 changed files with 18 additions and 5 deletions

View File

@ -96,11 +96,13 @@ AC_DEFUN([AX_GTEST_HOME],[
AC_ARG_WITH([gtest],
AS_HELP_STRING([--with-gtest@<:@=DIR@:>@], [GTEST root directory]),
[GTEST_HOME="$withval"
AC_CHECK_FILE([$GTEST_HOME/include/gtest],
AS_IF([test "$GTEST_HOME" = "yes"],
AC_CHECK_HEADER(gtest/gtest.h,[GTEST_HOME="/usr"],AC_MSG_ERROR([could not find gtest/gtest.h])),
AC_CHECK_FILE([$GTEST_HOME/include/gtest],
[],
AC_MSG_ERROR([could not find $GTEST_HOME/sample/bcuser.h])
AC_MSG_ERROR([could not find $GTEST_HOME/include/gtest])
)
],
)],
[GTEST_HOME=""]
)
AC_SUBST([GTEST_HOME])

15
configure vendored
View File

@ -6062,7 +6062,17 @@ fi
# Check whether --with-gtest was given.
if test "${with_gtest+set}" = set; then :
withval=$with_gtest; GTEST_HOME="$withval"
as_ac_File=`$as_echo "ac_cv_file_$GTEST_HOME/include/gtest" | $as_tr_sh`
if test "$GTEST_HOME" = "yes"; then :
ac_fn_cxx_check_header_mongrel "$LINENO" "gtest/gtest.h" "ac_cv_header_gtest_gtest_h" "$ac_includes_default"
if test "x$ac_cv_header_gtest_gtest_h" = xyes; then :
GTEST_HOME="/usr"
else
as_fn_error $? "could not find gtest/gtest.h" "$LINENO" 5
fi
else
as_ac_File=`$as_echo "ac_cv_file_$GTEST_HOME/include/gtest" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $GTEST_HOME/include/gtest" >&5
$as_echo_n "checking for $GTEST_HOME/include/gtest... " >&6; }
if eval \${$as_ac_File+:} false; then :
@ -6082,11 +6092,12 @@ $as_echo "$ac_res" >&6; }
if eval test \"x\$"$as_ac_File"\" = x"yes"; then :
else
as_fn_error $? "could not find $GTEST_HOME/sample/bcuser.h" "$LINENO" 5
as_fn_error $? "could not find $GTEST_HOME/include/gtest" "$LINENO" 5
fi
fi
else
GTEST_HOME=""