3
# Copyright (C) 2012 Canonical, Ltd.
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:
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
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
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],
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"])
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"])
41
GTEST_CPPFLAGS="$GTEST_CPPFLAGS -I$GTEST_SOURCE"
43
AC_CHECK_FILES([$GTEST_SOURCE/src/gtest-all.cc]
44
[$GTEST_SOURCE/src/gtest_main.cc],
48
AS_IF([test "x$have_gtest_source" = xyes],
49
[AC_SUBST(GTEST_CPPFLAGS)]
50
[AC_SUBST(GTEST_SOURCE)])
53
# CHECK_XORG_GTEST([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
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.
61
# Both default actions are no-ops.
62
AC_DEFUN([CHECK_XORG_GTEST],
64
AC_REQUIRE([_CHECK_GTEST])
66
PKG_CHECK_EXISTS([xorg-gtest],
67
[have_xorg_gtest=yes],
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"
75
PKG_CHECK_MODULES(X11, [x11], [have_x11=yes], [have_x11=no])
77
# Check if we should include support for evemu
79
[AS_HELP_STRING([--with-evemu],
80
[support Linux input device recording playback
81
(default: enabled if available)])],
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,
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"])
95
AS_IF([test "x$have_gtest" != xyes -o "x$have_x11" != xyes],
98
AS_IF([test "x$have_xorg_gtest" = xyes],
99
[AC_SUBST(XORG_GTEST_SOURCE)]
100
[AC_SUBST(XORG_GTEST_CPPFLAGS)]
102
# Get BASE_CXXFLAGS and STRICT_CXXFLAGS
103
[XORG_MACROS_VERSION(1.17)]
104
[AC_LANG_PUSH([C++])]
110
]) # CHECK_XORG_GTEST