~bregma/grail/lp-1475888

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
#################################
# Initialize Autoconf
AC_PREREQ([2.60])
AC_INIT([Gesture Recognition And Instantiation Library],
        [3.0.8],
        [],
        [grail])
AC_CONFIG_SRCDIR([Makefile.am])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_AUX_DIR([config-aux])
AC_CONFIG_MACRO_DIR([m4])

#################################
# Initialize Automake
AM_INIT_AUTOMAKE([foreign dist-bzip2])
AM_SILENT_RULES([yes])
AM_MAINTAINER_MODE([enable])

LIB_VERSION=6:0:0
AC_SUBST([LIB_VERSION])

# Initialize libtool
AC_PROG_LIBTOOL

#################################
# Checks for programs.
AC_PROG_CC
AC_PROG_CXX
AC_PROG_INSTALL

#################################
# Enable/disable X11 support

AC_ARG_WITH(x11,
            AC_HELP_STRING(--without-x11, Do not use X11 libraries or frame_x11.h (default: autodetect)),
            [],
            [with_x11=auto])

AS_IF([test "x$with_x11" = "xauto"],
      [
        PKG_CHECK_MODULES(XINPUT,
                          frame-x11 x11 xext [xi >= 1.5.99.1] [inputproto >= 2.1.99.6],
                          [have_xinput=yes],
                          [have_xinput=no])
      ])

AS_IF([test "x$with_x11" = "xyes"],
      [
        PKG_CHECK_MODULES(XINPUT,
                          frame-x11 x11 xext [xi >= 1.5.99.1] [inputproto >= 2.1.99.6],
                          [have_xinput=yes])
      ])

AS_IF([test "x$with_x11" = "xno"],
      [have_xinput=no])

AS_IF([test "x$have_xinput" = "xyes"],
      [
        AM_CONDITIONAL(HAVE_XINPUT, true)
      ],
      [
        AM_CONDITIONAL(HAVE_XINPUT, false)
      ])

#################################
# check mandatory build dependencies

PKG_CHECK_MODULES([FRAME], [frame >= 2.2.0])

#################################
# debug builds

AC_ARG_ENABLE(debug,
              AC_HELP_STRING(--enable-debug, Enable debug assertions and other safeguards (default: disabled)),
              [],
              AC_DEFINE([NDEBUG], [], [No debug]))

#################################
# Check for TDD tools
AC_ARG_ENABLE([integration-tests],
              [AS_HELP_STRING([--enable-integration-tests],
                  [Enable building integration test cases (default: auto)])],
              [enable_integration_tests=$enableval],
              [enable_integration_tests=auto])

#################################
# Check for Google C++ Testing Framework
CHECK_GTEST()
AM_CONDITIONAL([HAVE_GTEST], [test "x$have_gtest" = xyes])

AS_IF([test "x$enable_integration_tests" != xno],
      [CHECK_XORG_GTEST(
          [AC_MSG_NOTICE([xorg-gtest is available, integration tests will be built])],
          [AS_IF([test "x$enable_integration_tests" = xyes],
                 [AC_MSG_ERROR(
                     [xorg-gtest is not available])],
                 [AC_MSG_WARN(
                     [xorg-gtest is not available, tests will not be built])
                  have_xorg_gtest=no])])])

AM_CONDITIONAL([ENABLE_INTEGRATION_TESTS], [test "x$have_xorg_gtest" = xyes])
                 
#################################
# Enable coverage reports using gcov
AC_TDD_GCOV

AM_CONDITIONAL([HAVE_GCOV],[test "x$ac_cv_check_gcov" = xyes])
 
AC_CONFIG_FILES([Makefile
                 src/Makefile
                 tools/Makefile
                 test/Makefile
                 test/gtest/Makefile
                 test/integration/Makefile
                 test/regular/Makefile
                 grail.pc])

AC_SUBST(VISIBILITY_CFLAGS, "-fvisibility=hidden")
AC_SUBST(VISIBILITY_CXXFLAGS, "-fvisibility=hidden")
AC_SUBST(WARNING_CPPFLAGS, "-Wall -Werror")
AC_SUBST(CXX11_CXXFLAGS, "-std=c++0x")

AC_OUTPUT

#################################
# Print summary

bold_green=$(tput bold)$(tput setf 2)
bold_white=$(tput bold)$(tput setf 7)
reset=$(tput sgr0)

AC_MSG_NOTICE([])
AC_MSG_NOTICE([${bold_green}Open Input Framework - Grail library - $VERSION${reset}])
AC_MSG_NOTICE([])
AC_MSG_NOTICE([   Prefix                  : ${bold_white}${prefix}${reset}])
AC_MSG_NOTICE([   CFLAGS                  : ${bold_white}${CFLAGS} ${GCC_FLAGS}${reset}])
AC_MSG_NOTICE([   X11 support             : ${bold_white}${have_xinput}${reset}])
AC_MSG_NOTICE([   Build integration tests : ${bold_white}${have_xorg_gtest}${reset}])
AC_MSG_NOTICE([])