~ubuntu-branches/ubuntu/trusty/geis/trusty

« back to all changes in this revision

Viewing changes to m4/xorg-gtest.m4

  • Committer: Package Import Robot
  • Author(s): Chase Douglas
  • Date: 2012-07-30 08:51:42 UTC
  • Revision ID: package-import@ubuntu.com-20120730085142-jrc33ygjvt0ob1wl
Tags: upstream-2.2.11
ImportĀ upstreamĀ versionĀ 2.2.11

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# serial 2
 
2
 
 
3
# Copyright (C) 2012 Canonical, Ltd.
 
4
#
 
5
# Permission is hereby granted, free of charge, to any person obtaining a copy
 
6
# of this software and associated documentation files (the "Software"), to deal
 
7
# in the Software without restriction, including without limitation the rights
 
8
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 
9
# copies of the Software, and to permit persons to whom the Software is
 
10
# furnished to do so, subject to the following conditions:
 
11
#
 
12
# The above copyright notice and this permission notice (including the next
 
13
# paragraph) shall be included in all copies or substantial portions of the
 
14
# Software.
 
15
#
 
16
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 
17
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 
18
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 
19
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 
20
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 
21
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 
22
# SOFTWARE.
 
23
 
 
24
# Checks whether the gtest source is available on the system. Allows for
 
25
# adjusting the include and source path. Sets have_gtest=yes if the source is
 
26
# present. Sets GTEST_CPPFLAGS and GTEST_SOURCE to the preprocessor flags and
 
27
# source location respectively.
 
28
AC_DEFUN([_CHECK_GTEST],
 
29
[
 
30
  AC_ARG_WITH([gtest-source-path],
 
31
              [AS_HELP_STRING([--with-gtest-source-path],
 
32
                              [location of the Google test sources, defaults to /usr/src/gtest])],
 
33
              [GTEST_SOURCE="$withval"; GTEST_CPPFLAGS="-I$withval/include"],
 
34
              [GTEST_SOURCE="/usr/src/gtest"])
 
35
 
 
36
  AC_ARG_WITH([gtest-include-path],
 
37
              [AS_HELP_STRING([--with-gtest-include-path],
 
38
                              [location of the Google test headers])],
 
39
              [GTEST_CPPFLAGS="-I$withval"])
 
40
 
 
41
  GTEST_CPPFLAGS="$GTEST_CPPFLAGS -I$GTEST_SOURCE"
 
42
 
 
43
  AC_CHECK_FILES([$GTEST_SOURCE/src/gtest-all.cc]
 
44
                 [$GTEST_SOURCE/src/gtest_main.cc],
 
45
                 [have_gtest=yes],
 
46
                 [have_gtest=no])
 
47
 
 
48
  AS_IF([test "x$have_gtest_source" = xyes],
 
49
        [AC_SUBST(GTEST_CPPFLAGS)]
 
50
        [AC_SUBST(GTEST_SOURCE)])
 
51
]) # _CHECK_GTEST
 
52
 
 
53
# CHECK_XORG_GTEST([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
 
54
#
 
55
# Checks whether the xorg-gtest source is available on the system. Allows for
 
56
# adjusting the include and source path. Sets have_xorg_gtest=yes if the source
 
57
# is present. Sets XORG_GTEST_CPPFLAGS and XORG_GTEST_SOURCE to the preprocessor
 
58
# flags and source location respectively. Sets XORG_GTEST_LIBS to all the
 
59
# libraries needed to link against a built xorg-gtest library.
 
60
#
 
61
# Both default actions are no-ops.
 
62
AC_DEFUN([CHECK_XORG_GTEST],
 
63
[
 
64
  AC_REQUIRE([_CHECK_GTEST])
 
65
 
 
66
  PKG_CHECK_EXISTS([xorg-gtest],
 
67
                   [have_xorg_gtest=yes],
 
68
                   [have_xorg_gtest=no])
 
69
 
 
70
  XORG_GTEST_SOURCE=`$PKG_CONFIG --variable=sourcedir --print-errors xorg-gtest`
 
71
  XORG_GTEST_CPPFLAGS=`$PKG_CONFIG --variable=CPPflags --print-errors xorg-gtest`
 
72
  XORG_GTEST_CPPFLAGS="$GTEST_CPPFLAGS $XORG_GTEST_CPPFLAGS"
 
73
  XORG_GTEST_CPPFLAGS="$XORG_GTEST_CPPFLAGS -I$XORG_GTEST_SOURCE"
 
74
 
 
75
  PKG_CHECK_MODULES(X11, [x11], [have_x11=yes], [have_x11=no])
 
76
 
 
77
  # Check if we should include support for evemu
 
78
  AC_ARG_WITH([evemu],
 
79
              [AS_HELP_STRING([--with-evemu],
 
80
                              [support Linux input device recording playback
 
81
                               (default: enabled if available)])],
 
82
              [],
 
83
              [with_evemu=check])
 
84
 
 
85
  AS_IF([test "x$with_evemu" = xyes],
 
86
        [PKG_CHECK_MODULES(EVEMU, [evemu], [have_xorg_gtest_evemu=yes])],
 
87
        [test "x$with_evemu" = xcheck],
 
88
        [PKG_CHECK_MODULES(EVEMU,
 
89
                           [evemu],
 
90
                           [have_xorg_gtest_evemu=yes],
 
91
                           [have_xorg_gtest_evemu=no])])
 
92
  AS_IF([test "x$have_xorg_gtest_evemu" = xyes],
 
93
        [XORG_GTEST_CPPFLAGS="$XORG_GTEST_CPPFLAGS -DHAVE_EVEMU"])
 
94
 
 
95
  AS_IF([test "x$have_gtest" != xyes -o "x$have_x11" != xyes],
 
96
        [have_xorg_gtest=no])
 
97
 
 
98
  AS_IF([test "x$have_xorg_gtest" = xyes],
 
99
        [AC_SUBST(XORG_GTEST_SOURCE)]
 
100
        [AC_SUBST(XORG_GTEST_CPPFLAGS)]
 
101
 
 
102
        # Get BASE_CXXFLAGS and STRICT_CXXFLAGS
 
103
        [XORG_MACROS_VERSION(1.17)]
 
104
        [AC_LANG_PUSH([C++])]
 
105
        [XORG_STRICT_OPTION]
 
106
        [AC_LANG_POP]
 
107
        [$1],
 
108
        [$2])
 
109
 
 
110
]) # CHECK_XORG_GTEST