Merge lp:~cjwatson/frame/cross into lp:frame

Proposed by Colin Watson
Status: Merged
Approved by: Daniel d'Andrada
Approved revision: 110
Merged at revision: 110
Proposed branch: lp:~cjwatson/frame/cross
Merge into: lp:frame
Diff against target: 81 lines (+14/-35)
2 files modified
m4/gtest.m4 (+12/-4)
m4/xorg-gtest.m4 (+2/-31)
To merge this branch: bzr merge lp:~cjwatson/frame/cross
Reviewer Review Type Date Requested Status
Daniel d'Andrada (community) Approve
PS Jenkins bot continuous-integration Pending
Review via email: mp+137457@code.launchpad.net

Commit message

Remove _CHECK_GTEST macro, and fix CHECK_GTEST to work correctly when cross-compiling.

Description of the change

Fix cross-building.

Firstly, the _CHECK_GTEST macro appears to be a cloned-and-hacked copy of CHECK_GTEST, and furthermore it's broken: observe that $have_gtest_source is tested but never set. It seems better to delete it in favour of the one that looks more likely to work.

Secondly, AC_CHECK_FILES doesn't work when cross-compiling, and fails hard, exiting the configure script. I chose to replace it with a compiler test: this is slower, but it avoids this problem. Of course, tests can't generally actually be run when cross-building unless you have qemu-user-static support or similar, but it still ought to be possible to perform the build. I've tested that this permits cross-building frame from amd64 to armhf.

From the looks of things, I suspect that these Autoconf macros exist in multiple Canonical projects. If there's an upstream source for them, or if I should submit matching MPs to other projects, please let me know.

To post a comment you must log in.
Revision history for this message
Daniel d'Andrada (dandrader) wrote :

Looks ok.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'm4/gtest.m4'
--- m4/gtest.m4 2012-07-18 12:28:56 +0000
+++ m4/gtest.m4 2012-12-02 23:33:20 +0000
@@ -38,10 +38,18 @@
3838
39 GTEST_CPPFLAGS="$GTEST_CPPFLAGS -I$GTEST_SOURCE"39 GTEST_CPPFLAGS="$GTEST_CPPFLAGS -I$GTEST_SOURCE"
4040
41 AC_CHECK_FILES([$GTEST_SOURCE/src/gtest-all.cc]41 AC_LANG_PUSH(C++)
42 [$GTEST_SOURCE/src/gtest_main.cc],42 gtest_save_CPPFLAGS=$CPPFLAGS
43 [have_gtest=yes],43 CPPFLAGS="$CPPFLAGS $GTEST_CPPFLAGS"
44 [have_gtest=no])44 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include "src/gtest-all.cc"]])],
45 [have_gtest=yes],
46 [have_gtest=no])
47 AS_IF([test "x$have_gtest" = xyes],
48 [AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include "src/gtest_main.cc"]])],
49 [],
50 [have_gtest=no])])
51 CPPFLAGS=$gtest_save_CPPFLAGS
52 AC_LANG_POP(C++)
4553
46 AS_IF([test "x$have_gtest" = xyes],54 AS_IF([test "x$have_gtest" = xyes],
47 [GTEST_LIBS=-lpthread55 [GTEST_LIBS=-lpthread
4856
=== modified file 'm4/xorg-gtest.m4'
--- m4/xorg-gtest.m4 2012-06-21 19:41:40 +0000
+++ m4/xorg-gtest.m4 2012-12-02 23:33:20 +0000
@@ -1,4 +1,4 @@
1# serial 21# serial 3
22
3# Copyright (C) 2012 Canonical, Ltd.3# Copyright (C) 2012 Canonical, Ltd.
4#4#
@@ -21,35 +21,6 @@
21# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE21# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22# SOFTWARE.22# SOFTWARE.
2323
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.
28AC_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])24# CHECK_XORG_GTEST([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
54#25#
55# Checks whether the xorg-gtest source is available on the system. Allows for26# Checks whether the xorg-gtest source is available on the system. Allows for
@@ -61,7 +32,7 @@
61# Both default actions are no-ops.32# Both default actions are no-ops.
62AC_DEFUN([CHECK_XORG_GTEST],33AC_DEFUN([CHECK_XORG_GTEST],
63[34[
64 AC_REQUIRE([_CHECK_GTEST])35 AC_REQUIRE([CHECK_GTEST])
6536
66 PKG_CHECK_EXISTS([xorg-gtest],37 PKG_CHECK_EXISTS([xorg-gtest],
67 [have_xorg_gtest=yes],38 [have_xorg_gtest=yes],

Subscribers

People subscribed via source and target branches