Merge lp:~dandrader/frame/lp1080819 into lp:frame

Proposed by Daniel d'Andrada
Status: Merged
Merged at revision: 103
Proposed branch: lp:~dandrader/frame/lp1080819
Merge into: lp:frame
Diff against target: 399 lines (+139/-30)
12 files modified
.bzrignore (+1/-0)
Makefile.am (+10/-1)
configure.ac (+61/-2)
frame-x11.pc.in (+9/-0)
include/oif/frame.h.in (+4/-0)
src/Makefile.am (+10/-2)
src/value.h (+0/-2)
test/Makefile.am (+11/-2)
test/regular/Makefile.am (+17/-5)
test/regular/accept-ended-touch.cpp (+2/-2)
test/regular/frame-x11-fixture.cpp (+10/-10)
test/regular/frame-x11-fixture.h (+4/-4)
To merge this branch: bzr merge lp:~dandrader/frame/lp1080819
Reviewer Review Type Date Requested Status
Stephen M. Webb (community) Approve
Review via email: mp+135162@code.launchpad.net

Description of the change

To post a comment you must log in.
lp:~dandrader/frame/lp1080819 updated
104. By Daniel d'Andrada

Add frame-x11.pc

So that configure scripts can know if the installed frame has X11 support.

105. By Daniel d'Andrada

Remove stray #include

Revision history for this message
Stephen M. Webb (bregma) wrote :

I approve of most of these changes in general, with the following exceptions.

(1) as far as I know, it is not an error to mention a symbol name in a GNU linker version script and that symbol is not present. That means there is no need to run the preprocessor on the version script; a single version script should suffice regardless of package build options selected. Less to go wrong.

(2) You should avoid embedding device-specific control in the diagnostic output of configure. The right way to get pretty colour into the diagnostic output is to use the tput program. For example,

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

You should also use AC_MSG_NOTICE to send notices to the diagnostic output because (a) it send it to all the right places (echo only sends to stdout), and (2) the autoconf tool facilities react properly to command-line options like --quiet.

review: Needs Fixing
lp:~dandrader/frame/lp1080819 updated
106. By Daniel d'Andrada

Improve implementation of the pretty summary of the configure script

- Do not use device-specific terminal commands directly
- Use AC_MSG_NOTICE instead of echo to ensure the messages go to the right places
  and obey configure options such as --quiet

107. By Daniel d'Andrada

No need to configure libframe.ver

Fixed according to review comments from Stephen Webb:
"It is not an error to mention a symbol name in a GNU linker version script and
that symbol is not present. That means there is no need to run the preprocessor
on the version script. A single version script should suffice regardless of
package build options selected."

Revision history for this message
Daniel d'Andrada (dandrader) wrote :

Updated according to comments.

Revision history for this message
Stephen M. Webb (bregma) wrote :

include/oif/frame_x11.h will not get packaged by 'make dist' if not configured to use X11. This is unlikely to be a real problem in production, but if there's a way to work around it that would be good.

Other than that warning, this looks good.

review: Approve
Revision history for this message
Daniel d'Andrada (dandrader) wrote :

That's odd, I've run "./configure --disable-x11" followed by "make dist" and the generated tarball did include frame_x11.h

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file '.bzrignore'
2--- .bzrignore 2012-08-31 19:39:22 +0000
3+++ .bzrignore 2012-11-26 20:02:21 +0000
4@@ -19,6 +19,7 @@
5 coveragereport
6 doc/api
7 libtool
8+include/oif/frame.h
9 m4/libtool.m4
10 m4/ltoptions.m4
11 m4/ltsugar.m4
12
13=== modified file 'Makefile.am'
14--- Makefile.am 2012-07-25 22:43:17 +0000
15+++ Makefile.am 2012-11-26 20:02:21 +0000
16@@ -1,4 +1,9 @@
17-SUBDIRS = doc src tools test
18+SUBDIRS = doc src test
19+
20+# tools are all X11 based
21+if HAVE_XINPUT
22+SUBDIRS += tools
23+endif
24
25 ACLOCAL_AMFLAGS = -I m4 --install
26
27@@ -9,6 +14,10 @@
28 pkgconfigdir = $(libdir)/pkgconfig
29 pkgconfig_DATA = frame.pc
30
31+if HAVE_XINPUT
32+pkgconfig_DATA += frame-x11.pc
33+endif
34+
35 if HAVE_GCOV
36 .PHONY: clean-gcda
37 clean-gcda:
38
39=== modified file 'configure.ac'
40--- configure.ac 2012-11-08 15:55:43 +0000
41+++ configure.ac 2012-11-26 20:02:21 +0000
42@@ -25,7 +25,48 @@
43 AC_PROG_CXX
44 AC_PROG_INSTALL
45
46-PKG_CHECK_MODULES(XINPUT, x11 xext xorg-server [xi >= 1.5.99.1] [inputproto >= 2.1.99.6])
47+
48+# *** Enable/disable the X11 backend ***
49+AC_ARG_ENABLE(x11,
50+ AC_HELP_STRING(--disable-x11, Do not build the X11 backend. (default: enable if available)),
51+ [],
52+ [enable_x11=auto])
53+
54+
55+# Check for X11 as an optional dependency
56+AS_IF([test "x$enable_x11" = "xauto"],
57+ [
58+ PKG_CHECK_MODULES(XINPUT,
59+ x11 xext xorg-server [xi >= 1.5.99.1] [inputproto >= 2.1.99.6],
60+ [have_xinput=yes],
61+ [have_xinput=no])
62+ ])
63+
64+AS_IF([test "x$enable_x11" = "xyes"],
65+ [
66+ PKG_CHECK_MODULES(XINPUT,
67+ x11 xext xorg-server [xi >= 1.5.99.1] [inputproto >= 2.1.99.6],
68+ [have_xinput=yes],
69+ [
70+ AC_MSG_ERROR([x11 and/or XInput libraries not found!])
71+ have_xinput=no
72+ ])
73+ ])
74+
75+AS_IF([test "x$enable_x11" = "xno"],
76+ [have_xinput=no])
77+
78+AS_IF([test "x$have_xinput" = "xyes"],
79+ [
80+ FRAME_X11_BACKEND="FRAME_X11_BACKEND"
81+ AM_CONDITIONAL(HAVE_XINPUT, true)
82+ ],
83+ [
84+ FRAME_X11_BACKEND="FRAME_NO_X11_BACKEND"
85+ AM_CONDITIONAL(HAVE_XINPUT, false)
86+ ])
87+AC_SUBST(FRAME_X11_BACKEND)
88+AC_SUBST(HAVE_XINPUT)
89
90 AC_CHECK_PROG([ASCIIDOC], [a2x], [a2x])
91 AM_CONDITIONAL([HAVE_DOCTOOLS], [test "x$ASCIIDOC" != "x"])
92@@ -47,7 +88,8 @@
93 AS_IF([test "x$enable_integration_tests" != xno],
94 [CHECK_XORG_GTEST(
95 [AC_MSG_NOTICE([xorg-gtest is available, integration tests will be built])],
96- [AC_MSG_WARN([xorg-gtest is not available, tests will not be built])])])
97+ [AC_MSG_WARN([xorg-gtest is not available, tests will not be built])])],
98+ [have_xorg_gtest=no])
99
100 AM_CONDITIONAL([ENABLE_INTEGRATION_TESTS], [test "x$have_xorg_gtest" = xyes])
101
102@@ -65,6 +107,7 @@
103
104 AC_CONFIG_FILES([Makefile
105 doc/Makefile
106+ include/oif/frame.h
107 src/Makefile
108 test/Makefile
109 test/gtest/Makefile
110@@ -74,6 +117,9 @@
111 tools/Makefile
112 frame.pc])
113
114+AS_IF([test "x$have_xinput" = "xyes"],
115+ [AC_CONFIG_FILES([frame-x11.pc])])
116+
117 AC_LANG_PUSH(C++)
118 AC_CHECK_DECL(__clang__, CXX_LIBS="-lstdc++")
119 AC_SUBST(CXX_LIBS)
120@@ -86,3 +132,16 @@
121 AC_SUBST(VISIBILITY_CXXFLAGS, "-fvisibility=hidden")
122
123 AC_OUTPUT
124+
125+bold_green=$(tput bold)$(tput setf 2)
126+bold_white=$(tput bold)$(tput setf 7)
127+reset=$(tput sgr0)
128+
129+AC_MSG_NOTICE([])
130+AC_MSG_NOTICE([${bold_green}Open Input Framework - Frame library - $VERSION${reset}])
131+AC_MSG_NOTICE([])
132+AC_MSG_NOTICE([ Prefix : ${bold_white}${prefix}${reset}])
133+AC_MSG_NOTICE([ CFLAGS : ${bold_white}${CFLAGS} ${GCC_FLAGS}${reset}])
134+AC_MSG_NOTICE([ Build X11 backend : ${bold_white}${have_xinput}${reset}])
135+AC_MSG_NOTICE([ Build integration tests : ${bold_white}${have_xorg_gtest}${reset}])
136+AC_MSG_NOTICE([])
137
138=== added file 'frame-x11.pc.in'
139--- frame-x11.pc.in 1970-01-01 00:00:00 +0000
140+++ frame-x11.pc.in 2012-11-26 20:02:21 +0000
141@@ -0,0 +1,9 @@
142+prefix=@prefix@
143+exec_prefix=@exec_prefix@
144+libdir=@libdir@
145+includedir=@includedir@
146+
147+Name: frame-x11
148+Description: Touch Frame Library - X11 support
149+Version: @PACKAGE_VERSION@
150+Requires: frame = @PACKAGE_VERSION@
151
152=== renamed file 'include/oif/frame.h' => 'include/oif/frame.h.in'
153--- include/oif/frame.h 2012-08-31 17:04:43 +0000
154+++ include/oif/frame.h.in 2012-11-26 20:02:21 +0000
155@@ -52,6 +52,10 @@
156 #endif // __has_feature
157 #endif // __has_feature(c_generic_selections)
158
159+/* Whether the X11 backend (frame_x11.h) is available.
160+ FRAME_X11_BACKEND will be defined if it is and FRAME_NO_X11_BACKEND otherwise. */
161+#define @FRAME_X11_BACKEND@
162+
163 #ifdef __cplusplus
164 extern "C" {
165 #endif
166
167=== modified file 'src/Makefile.am'
168--- src/Makefile.am 2012-11-08 11:21:24 +0000
169+++ src/Makefile.am 2012-11-26 20:02:21 +0000
170@@ -31,8 +31,12 @@
171 libframeinclude_HEADERS = \
172 $(top_srcdir)/include/oif/frame.h \
173 $(top_srcdir)/include/oif/frame_backend.h \
174- $(top_srcdir)/include/oif/frame_internal.h \
175+ $(top_srcdir)/include/oif/frame_internal.h
176+
177+if HAVE_XINPUT
178+libframeinclude_HEADERS += \
179 $(top_srcdir)/include/oif/frame_x11.h
180+endif
181
182 libframe_la_SOURCES = \
183 axis.h \
184@@ -52,7 +56,10 @@
185 value.h \
186 value.cpp \
187 window.h \
188- window.cpp \
189+ window.cpp
190+
191+if HAVE_XINPUT
192+libframe_la_SOURCES += \
193 x11/device_x11.h \
194 x11/device_x11.cpp \
195 x11/frame_x11.cpp \
196@@ -60,5 +67,6 @@
197 x11/handle_x11.cpp \
198 x11/window_x11.h \
199 x11/window_x11.cpp
200+endif
201
202 EXTRA_DIST = $(version_script)
203
204=== modified file 'src/value.h'
205--- src/value.h 2012-06-21 19:41:40 +0000
206+++ src/value.h 2012-11-26 20:02:21 +0000
207@@ -25,8 +25,6 @@
208
209 #include <memory>
210
211-#include <X11/X.h>
212-
213 #include "oif/frame.h"
214 #include "typedefs.h"
215
216
217=== modified file 'test/Makefile.am'
218--- test/Makefile.am 2012-07-17 13:57:32 +0000
219+++ test/Makefile.am 2012-11-26 20:02:21 +0000
220@@ -1,5 +1,14 @@
221-SUBDIRS = gtest x11_mocks regular
222-
223+SUBDIRS = gtest
224+
225+if HAVE_XINPUT
226+SUBDIRS += x11_mocks
227+endif
228+
229+SUBDIRS += regular
230+
231+# integration tests are all X11 based
232+if HAVE_XINPUT
233 if ENABLE_INTEGRATION_TESTS
234 SUBDIRS += integration
235 endif
236+endif
237
238=== modified file 'test/regular/Makefile.am'
239--- test/regular/Makefile.am 2012-08-24 16:30:05 +0000
240+++ test/regular/Makefile.am 2012-11-26 20:02:21 +0000
241@@ -1,4 +1,8 @@
242-test_targets = check-c-compile check-cxx-compile
243+test_targets =
244+
245+if HAVE_XINPUT
246+test_targets += check-c-compile check-cxx-compile
247+endif
248
249 if HAVE_GTEST
250 test_targets += check-regular
251@@ -37,10 +41,14 @@
252 ### check-regular
253
254 check_regular_SOURCES = \
255+ backend.cpp
256+
257+if HAVE_XINPUT
258+check_regular_SOURCES += \
259 accept-ended-touch.cpp \
260- backend.cpp \
261- frame-fixture.cpp \
262- frame-fixture.h
263+ frame-x11-fixture.cpp \
264+ frame-x11-fixture.h
265+endif
266
267 #
268 # Link against the (non-distributed) static lib to pick up the
269@@ -50,10 +58,14 @@
270 $(top_builddir)/src/.libs/libframe.a \
271 $(top_builddir)/test/gtest/libgtest.a \
272 $(top_builddir)/test/gtest/libgtest_main.a \
273- $(top_builddir)/test/x11_mocks/libx11_mocks.a \
274 $(COVERAGE_LIBS) \
275 $(GTEST_LIBS)
276
277+if HAVE_XINPUT
278+check_regular_LDADD += \
279+ $(top_builddir)/test/x11_mocks/libx11_mocks.a
280+endif
281+
282 check_regular_CPPFLAGS = \
283 --std=c++0x \
284 -I$(top_srcdir)/test/x11_mocks \
285
286=== modified file 'test/regular/accept-ended-touch.cpp'
287--- test/regular/accept-ended-touch.cpp 2012-07-17 14:27:23 +0000
288+++ test/regular/accept-ended-touch.cpp 2012-11-26 20:02:21 +0000
289@@ -1,7 +1,7 @@
290-#include "frame-fixture.h"
291+#include "frame-x11-fixture.h"
292 #include "x11_mocks.h"
293
294-class AcceptEndedTouch : public FrameFixture
295+class AcceptEndedTouch : public FrameX11Fixture
296 {
297 };
298
299
300=== renamed file 'test/regular/frame-fixture.cpp' => 'test/regular/frame-x11-fixture.cpp'
301--- test/regular/frame-fixture.cpp 2012-08-31 19:45:35 +0000
302+++ test/regular/frame-x11-fixture.cpp 2012-11-26 20:02:21 +0000
303@@ -1,23 +1,23 @@
304-#include "frame-fixture.h"
305+#include "frame-x11-fixture.h"
306 #include "x11_mocks.h"
307
308-FrameFixture::FrameFixture()
309+FrameX11Fixture::FrameX11Fixture()
310 : frame_handle(nullptr),
311 _xevent_serial_number(1)
312 {
313 }
314
315-void FrameFixture::SetUp()
316+void FrameX11Fixture::SetUp()
317 {
318 xmock_touch_acceptance.clear();
319 }
320
321-void FrameFixture::TearDown()
322+void FrameX11Fixture::TearDown()
323 {
324 ASSERT_EQ(nullptr, frame_handle);
325 }
326
327-void FrameFixture::CreateXMockTouchScreenDevice()
328+void FrameX11Fixture::CreateXMockTouchScreenDevice()
329 {
330 xmock_devices_count = 1;
331 xmock_devices = (XIDeviceInfo*) calloc(xmock_devices_count,
332@@ -59,7 +59,7 @@
333 xmock_devices[0].classes = classes;
334 }
335
336-void FrameFixture::DestroyXMockDevices()
337+void FrameX11Fixture::DestroyXMockDevices()
338 {
339 for (int i = 0; i < xmock_devices_count; ++i)
340 {
341@@ -70,7 +70,7 @@
342 free(xmock_devices);
343 }
344
345-void FrameFixture::SendTouchEvent(
346+void FrameX11Fixture::SendTouchEvent(
347 int event_type, int touch_id, float x, float y)
348 {
349 UFStatus status;
350@@ -112,7 +112,7 @@
351 free(device_event);
352 }
353
354-void FrameFixture::SendTouchOwnershipEvent(int touch_id)
355+void FrameX11Fixture::SendTouchOwnershipEvent(int touch_id)
356 {
357 UFStatus status;
358 XGenericEventCookie xcookie;
359@@ -141,7 +141,7 @@
360 free(ownership_event);
361 }
362
363-void FrameFixture::FetchDeviceAddedEvent(UFDevice *device)
364+void FrameX11Fixture::FetchDeviceAddedEvent(UFDevice *device)
365 {
366 UFEvent event;
367 UFStatus status;
368@@ -157,7 +157,7 @@
369 frame_event_unref(event);
370 }
371
372-void FrameFixture::AssertNoMoreEvents()
373+void FrameX11Fixture::AssertNoMoreEvents()
374 {
375 UFEvent event;
376 UFStatus status;
377
378=== renamed file 'test/regular/frame-fixture.h' => 'test/regular/frame-x11-fixture.h'
379--- test/regular/frame-fixture.h 2012-07-24 20:47:15 +0000
380+++ test/regular/frame-x11-fixture.h 2012-11-26 20:02:21 +0000
381@@ -1,14 +1,14 @@
382-#ifndef GTEST_FRAME_FIXTURE_H
383-#define GTEST_FRAME_FIXTURE_H
384+#ifndef GTEST_FRAME_X11_FIXTURE_H
385+#define GTEST_FRAME_X11_FIXTURE_H
386
387 #include <gtest/gtest.h>
388 #include "oif/frame.h"
389 #include "oif/frame_x11.h"
390
391-class FrameFixture : public ::testing::Test
392+class FrameX11Fixture : public ::testing::Test
393 {
394 protected:
395- FrameFixture();
396+ FrameX11Fixture();
397
398 virtual void SetUp();
399 virtual void TearDown();

Subscribers

People subscribed via source and target branches