1
# Copyright (C) 2012 Canonical, Ltd.
3
# Permission is hereby granted, free of charge, to any person obtaining a copy
4
# of this software and associated documentation files (the "Software"), to deal
5
# in the Software without restriction, including without limitation the rights
6
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
# copies of the Software, and to permit persons to whom the Software is
8
# furnished to do so, subject to the following conditions:
10
# The above copyright notice and this permission notice (including the next
11
# paragraph) shall be included in all copies or substantial portions of the
14
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
# Checks whether the gtest source is available on the system. Allows for
23
# adjusting the include and source path. Sets have_gtest=yes if the source is
24
# present. Sets GTEST_CPPFLAGS and GTEST_SOURCE to the preprocessor flags and
25
# source location respectively.
26
AC_DEFUN([CHECK_GTEST],
28
AC_ARG_WITH([gtest-include-path],
29
[AS_HELP_STRING([--with-gtest-include-path],
30
[location of the Google test headers])],
31
[GTEST_CPPFLAGS="-I$withval"])
33
AC_ARG_WITH([gtest-source-path],
34
[AS_HELP_STRING([--with-gtest-source-path],
35
[location of the Google test sources, defaults to /usr/src/gtest])],
36
[GTEST_SOURCE="$withval"],
37
[GTEST_SOURCE="/usr/src/gtest"])
39
GTEST_CPPFLAGS="$GTEST_CPPFLAGS -I$GTEST_SOURCE"
43
tmp_CPPFLAGS="$CPPFLAGS"
44
CPPFLAGS="$CPPFLAGS $GTEST_CPPFLAGS"
46
AC_CHECK_HEADER([gtest/gtest.h])
48
CPPFLAGS="$tmp_CPPFLAGS"
52
AC_CHECK_FILES([$GTEST_SOURCE/src/gtest-all.cc]
53
[$GTEST_SOURCE/src/gtest_main.cc],
54
[have_gtest_source=yes],
55
[have_gtest_source=no])
57
AS_IF([test "x$ac_cv_header_gtest_gtest_h" = xyes -a \
58
"x$have_gtest_source" = xyes],
60
[AC_SUBST(GTEST_CPPFLAGS)]
61
[AC_SUBST(GTEST_SOURCE)],