2
0

add_cxxflags.m4 497 B

12345678910111213141516171819
  1. dnl @synopsis MN_ADD_CXXFLAGS
  2. dnl
  3. dnl Add the given option to CXXFLAGS, if it doesn't break the compiler
  4. AC_DEFUN([MN_ADD_CXXFLAGS],
  5. [AC_MSG_CHECKING([if $CXX accepts $1])
  6. AC_LANG_ASSERT([C++])
  7. ac_add_cxxflags__old_cxxflags="$CXXFLAGS"
  8. CXXFLAGS="$1"
  9. AC_TRY_LINK([
  10. #include <cstdio>
  11. ],
  12. [puts("Hello, World!"); return 0;],
  13. AC_MSG_RESULT([yes])
  14. CXXFLAGS="$ac_add_cxxflags__old_cxxflags $1",
  15. AC_MSG_RESULT([no])
  16. CXXFLAGS="$ac_add_cxxflags__old_cxxflags"
  17. )
  18. ])# MN_ADD_CXXFLAGS