From df3b23968d5bda4050b7f7a002a7e5a1d7a48a74 Mon Sep 17 00:00:00 2001 From: Chris Dyer Date: Thu, 25 Apr 2013 23:32:02 -0400 Subject: only turn on c++11 for extractor --- extractor/Makefile.am | 2 +- m4/ax_cxx_compile_stdcxx_11.m4 | 9 +++++++-- utils/filelib.h | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/extractor/Makefile.am b/extractor/Makefile.am index d8239b7d..fc799f74 100644 --- a/extractor/Makefile.am +++ b/extractor/Makefile.am @@ -145,5 +145,5 @@ libextractor_a_SOURCES = \ translation_table.cc \ vocabulary.cc -AM_CPPFLAGS = -W -Wall -Wno-sign-compare -std=c++0x -fopenmp $(GTEST_CPPFLAGS) $(GMOCK_CPPFLAGS) +AM_CPPFLAGS = -W -Wall -Wno-sign-compare $(CXX11_SWITCH) -fopenmp $(GTEST_CPPFLAGS) $(GMOCK_CPPFLAGS) AM_LDFLAGS = -fopenmp diff --git a/m4/ax_cxx_compile_stdcxx_11.m4 b/m4/ax_cxx_compile_stdcxx_11.m4 index 1bc31128..f6cf4a15 100644 --- a/m4/ax_cxx_compile_stdcxx_11.m4 +++ b/m4/ax_cxx_compile_stdcxx_11.m4 @@ -74,6 +74,7 @@ AC_DEFUN([AX_CXX_COMPILE_STDCXX_11], [dnl ac_success=yes fi + restore_it="$CXXFLAGS" m4_if([$1], [noext], [], [dnl if test x$ac_success = xno; then for switch in -std=gnu++11 -std=gnu++0x; do @@ -87,7 +88,8 @@ AC_DEFUN([AX_CXX_COMPILE_STDCXX_11], [dnl [eval $cachevar=no]) CXXFLAGS="$ac_save_CXXFLAGS"]) if eval test x\$$cachevar = xyes; then - CXXFLAGS="$CXXFLAGS $switch" + CXXFLAGS="$CXXFLAGS" + c11switch="$switch" ac_success=yes break fi @@ -107,12 +109,15 @@ AC_DEFUN([AX_CXX_COMPILE_STDCXX_11], [dnl [eval $cachevar=no]) CXXFLAGS="$ac_save_CXXFLAGS"]) if eval test x\$$cachevar = xyes; then - CXXFLAGS="$CXXFLAGS $switch" + CXXFLAGS="$CXXFLAGS" + c11switch="$switch" ac_success=yes break fi done fi]) + CXXFLAGS="$restore_it" + AC_SUBST([CXX11_SWITCH], ["$c11switch"]) AC_LANG_POP([C++]) if test x$ax_cxx_compile_cxx11_required = xtrue; then if test x$ac_success = xno; then diff --git a/utils/filelib.h b/utils/filelib.h index bb6e7415..b9ea3940 100644 --- a/utils/filelib.h +++ b/utils/filelib.h @@ -27,7 +27,7 @@ struct BaseFile { } bool is_null() const { return !ps_; } operator bool() const { - return ps_; + return ps_.get(); } S* stream() { return ps_.get(); } S* operator->() { return ps_.get(); } // compat with old ReadFile * -> new Readfile. remove? -- cgit v1.2.3