[PATCH xorg-gtest 2/5] Use BASE_CXXFLAGS from xorg macros

Chase Douglas chase.douglas at canonical.com
Mon Mar 5 11:47:39 PST 2012


The X.org macros package version 1.16.2 is the first to define
BASE_CXXFLAGS; however, we don't need to require version 1.16.2. If it's
available, then great. If not, $(BASE_CXXFLAGS) will be empty and
nothing terrible will happen.

Signed-off-by: Chase Douglas <chase.douglas at canonical.com>
---
 configure.ac         |   11 +++++++----
 examples/Makefile.am |    2 +-
 src/Makefile.am      |    2 +-
 src/environment.cpp  |    6 +++---
 4 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/configure.ac b/configure.ac
index 40a0e70..e6f94df 100644
--- a/configure.ac
+++ b/configure.ac
@@ -18,16 +18,19 @@ AC_SUBST([LIB_VERSION])
 # Initialize libtool
 AC_PROG_LIBTOOL
 
+
+# Checks for programs.
+AC_PROG_CXX
+AC_PROG_INSTALL
+
+AC_LANG([C++])
+
 # Require X.Org macros 1.16 or later for XORG_TESTSET_CFLAG
 m4_ifndef([XORG_MACROS_VERSION],
 	  [m4_fatal([must install xorg-macros 1.16 or later before running autoconf/autogen])])
 XORG_MACROS_VERSION(1.16)
 XORG_DEFAULT_OPTIONS
 
-# Checks for programs.
-AC_PROG_CXX
-AC_PROG_INSTALL
-
 PKG_CHECK_MODULES(XSERVER, x11)
  
 # Check for Google Test
diff --git a/examples/Makefile.am b/examples/Makefile.am
index b311687..e8f8713 100644
--- a/examples/Makefile.am
+++ b/examples/Makefile.am
@@ -29,7 +29,7 @@ noinst_PROGRAMS = xorg-gtest-example
 xorg_gtest_example_SOURCES = xorg-gtest.cpp
 
 AM_CPPFLAGS = -I$(top_srcdir)/include
-AM_CXXFLAGS = $(XSERVER_CFLAGS) $(GTEST_CPPFLAGS)
+AM_CXXFLAGS = $(XSERVER_CFLAGS) $(GTEST_CPPFLAGS) $(BASE_CXXFLAGS)
 
 xorg_gtest_example_LDADD = $(top_builddir)/src/libxorg-gtest.la $(top_builddir)/src/libxorg-gtest_main.la -lgtest -lpthread -lX11
 
diff --git a/src/Makefile.am b/src/Makefile.am
index 06a5e12..0790745 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -50,6 +50,6 @@ libxorg_gtest_main_la_LDFLAGS = \
 	$(XSERVER_LIBS) \
 	-Wl,--version-script=$(top_srcdir)/src/libxorg-gtest_main.ver
 
-AM_CXXFLAGS = -I$(top_srcdir)/include $(XSERVER_CFLAGS)
+AM_CXXFLAGS = -I$(top_srcdir)/include $(XSERVER_CFLAGS) $(BASE_CXXFLAGS)
 
 EXTRA_DIST = libxorg-gtest.ver libxorg-gtest_main.ver
diff --git a/src/environment.cpp b/src/environment.cpp
index 845c1a6..3da27cb 100644
--- a/src/environment.cpp
+++ b/src/environment.cpp
@@ -113,10 +113,10 @@ void xorg::testing::Environment::SetUp() {
   Process::SetEnv("DISPLAY", display_string, true);
 
   for (int i = 0; i < 10; ++i) {
-    Display* display = XOpenDisplay(NULL);
+    Display* test_display = XOpenDisplay(NULL);
 
-    if (display) {
-      XCloseDisplay(display);
+    if (test_display) {
+      XCloseDisplay(test_display);
       return;
     }
 
-- 
1.7.9



More information about the xorg-devel mailing list