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], AC_ARG_WITH([gtest],
AS_HELP_STRING([--with-gtest@<:@=DIR@:>@], [GTEST root directory]), AS_HELP_STRING([--with-gtest@<:@=DIR@:>@], [GTEST root directory]),
[GTEST_HOME="$withval" [GTEST_HOME="$withval"
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_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=""] [GTEST_HOME=""]
) )
AC_SUBST([GTEST_HOME]) AC_SUBST([GTEST_HOME])

13
configure vendored
View File

@ -6062,6 +6062,16 @@ fi
# Check whether --with-gtest was given. # Check whether --with-gtest was given.
if test "${with_gtest+set}" = set; then : if test "${with_gtest+set}" = set; then :
withval=$with_gtest; GTEST_HOME="$withval" withval=$with_gtest; GTEST_HOME="$withval"
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_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 "$as_me:${as_lineno-$LINENO}: checking for $GTEST_HOME/include/gtest" >&5
$as_echo_n "checking for $GTEST_HOME/include/gtest... " >&6; } $as_echo_n "checking for $GTEST_HOME/include/gtest... " >&6; }
@ -6082,11 +6092,12 @@ $as_echo "$ac_res" >&6; }
if eval test \"x\$"$as_ac_File"\" = x"yes"; then : if eval test \"x\$"$as_ac_File"\" = x"yes"; then :
else 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
fi
else else
GTEST_HOME="" GTEST_HOME=""