Merge lp:~chasedouglas/xorg-gtest/configure-error into lp:~oif-team/xorg-gtest/trunk

Proposed by Chase Douglas on 2011-12-14
Status: Merged
Merged at revision: 4
Proposed branch: lp:~chasedouglas/xorg-gtest/configure-error
Merge into: lp:~oif-team/xorg-gtest/trunk
Diff against target: 36 lines (+12/-5)
2 files modified
configure.ac (+2/-1)
m4/gtest.m4 (+10/-4)
To merge this branch: bzr merge lp:~chasedouglas/xorg-gtest/configure-error
Reviewer Review Type Date Requested Status
Thomas Voß (community) 2011-12-14 Approve on 2011-12-14
Stephen M. Webb (community) Approve on 2011-12-14
Chase Douglas (community) Resubmit on 2011-12-14
Review via email: mp+85576@code.launchpad.net

Description of the change

Fix configure so it errors when gtest is not available. Two other minor fixes.

To post a comment you must log in.
6. By Chase Douglas on 2011-12-14

Move check result test to configure.ac and use standard variables

Stephen M. Webb (bregma) wrote :

AC_LANG_CPLUPLUS shouldn't appear in a defined macro like that. Use AC_LANG_PUSH(C++)/AC_LANG_POP instead. Just in case someone copies the .m4 file (and they're likely to at this point).

Other than that this is right.

review: Needs Fixing
7. By Chase Douglas on 2011-12-14

Link against pthread when checking for gtest library

8. By Chase Douglas on 2011-12-14

Use AC_LANG_PUSH(C++)/AC_LANG_POP so as not to contaminate configure.ac

Chase Douglas (chasedouglas) wrote :

Fixed the AC_LANG issue and hopefully fix an issue that Peter Hutterer was seeing with lpthreads not being linked in during the AC_CHECK_LIB test.

review: Resubmit
Stephen M. Webb (bregma) wrote :

Good.

review: Approve
Thomas Voß (thomas-voss) wrote :

Looks good to me.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'configure.ac'
2--- configure.ac 2011-12-06 00:25:36 +0000
3+++ configure.ac 2011-12-14 01:34:23 +0000
4@@ -31,7 +31,8 @@
5 # Check for Google Test
6 AC_CHECK_GTEST
7
8-AM_CONDITIONAL([HAVE_GTEST], [test "x$have_gtest" = xyes])
9+AS_IF([test "x$ac_cv_lib_gtest_main" != xyes],
10+ AC_MSG_ERROR([package 'gtest' not found]))
11
12 AC_SUBST([GTEST_LDFLAGS])
13 AC_SUBST([GTEST_CXXFLAGS])
14
15=== modified file 'm4/gtest.m4'
16--- m4/gtest.m4 2011-12-05 16:27:29 +0000
17+++ m4/gtest.m4 2011-12-14 01:34:23 +0000
18@@ -16,9 +16,15 @@
19 [GTEST_LDFLAGS="-L$withval -lpthread"],
20 [GTEST_LDFLAGS='-lgtest -lpthread'])
21
22- AC_HAVE_LIBRARY( [gtest],
23- [have_gtest=yes],
24- AC_MSG_WARN([package 'gtest' not found: tests disabled]))
25-
26+ AC_LANG_PUSH(C++)
27+
28+ # We need to get to the 5th arg to link with -lpthread too. Mimic the default
29+ # AC_CHECK_LIB action when found.
30+ AC_CHECK_LIB([gtest], [main],
31+ [AC_DEFINE(HAVE_LIBGTEST) LIBS="-lgtest $LIBS"],
32+ [],
33+ [-lpthread])
34+
35+ AC_LANG_POP
36 ]) # AC_CHECK_GTEST
37

Subscribers

People subscribed via source and target branches