Skip to content

Commit

Permalink
Add -std=c++11 to CXXFLAGS if needed
Browse files Browse the repository at this point in the history
  • Loading branch information
lballabio committed Jun 4, 2021
1 parent 1811cbd commit bae755e
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
29 changes: 29 additions & 0 deletions acinclude.m4
@@ -1,4 +1,33 @@

# QL_CHECK_CPP11
# --------------------
# Check whether C++11 features are supported by default.
# If not (e.g., with Clang on Mac OS) add -std=c++11
AC_DEFUN([QL_CHECK_CPP11],
[AC_MSG_CHECKING([for C++11 support])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[@%:@include <initializer_list>
struct S {
int i = 3;
double x = 3.5;
};
class C {
public:
C(int) noexcept;
C(std::initializer_list<int>);
S f() { return { 2, 1.5 }; }
};
]],
[[]])],
[AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])
AC_MSG_WARN([Adding -std=c++11 to CXXFLAGS])
AC_SUBST([CXXFLAGS],["${CXXFLAGS} -std=c++11"])
])
])

# QL_CHECK_BOOST_DEVEL
# --------------------
# Check whether the Boost headers are available
Expand Down
3 changes: 3 additions & 0 deletions configure.ac
Expand Up @@ -74,6 +74,9 @@ if test "$ql_openmp" = "yes" ; then
AC_SUBST([CXXFLAGS],["${CXXFLAGS} ${OPENMP_CXXFLAGS}"])
fi

# Check for C++11 support
QL_CHECK_CPP11

# Check for Boost components
QL_CHECK_BOOST
AM_CONDITIONAL(BOOST_UNIT_TEST_FOUND, test "x${BOOST_UNIT_TEST_LIB}" != "x")
Expand Down

0 comments on commit bae755e

Please sign in to comment.