~online-accounts/webaccounts-browser-extension/trunk

« back to all changes in this revision

Viewing changes to m4/gtest.m4

  • Committer: Alberto Mardegan
  • Date: 2012-06-06 07:12:03 UTC
  • mto: This revision was merged to the branch mainline in revision 9.
  • Revision ID: alberto.mardegan@canonical.com-20120606071203-nge3j3n07y7as02b
Do not include gtest sources.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Copyright (C) 2012 Canonical, Ltd.
 
2
#
 
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:
 
9
#
 
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
 
12
# Software.
 
13
#
 
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
 
20
# SOFTWARE.
 
21
 
 
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],
 
27
[
 
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"])
 
32
 
 
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"])
 
38
 
 
39
  GTEST_CPPFLAGS="$GTEST_CPPFLAGS -I$GTEST_SOURCE"
 
40
 
 
41
  AC_LANG_PUSH([C++])
 
42
 
 
43
  tmp_CPPFLAGS="$CPPFLAGS"
 
44
  CPPFLAGS="$CPPFLAGS $GTEST_CPPFLAGS"
 
45
 
 
46
  AC_CHECK_HEADER([gtest/gtest.h])
 
47
 
 
48
  CPPFLAGS="$tmp_CPPFLAGS"
 
49
 
 
50
  AC_LANG_POP
 
51
 
 
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])
 
56
 
 
57
  AS_IF([test "x$ac_cv_header_gtest_gtest_h" = xyes -a \
 
58
              "x$have_gtest_source" = xyes],
 
59
        [have_gtest=yes]
 
60
        [AC_SUBST(GTEST_CPPFLAGS)]
 
61
        [AC_SUBST(GTEST_SOURCE)],
 
62
        [have_gtest=no])
 
63
]) # CHECK_GTEST