Alexandre Lision | 7c6f4a6 | 2013-09-05 13:27:01 -0400 | [diff] [blame] | 1 | dnl @synopsis MN_ADD_CXXFLAGS |
| 2 | dnl |
| 3 | dnl Add the given option to CXXFLAGS, if it doesn't break the compiler |
| 4 | |
| 5 | AC_DEFUN([MN_ADD_CXXFLAGS], |
| 6 | [AC_MSG_CHECKING([if $CXX accepts $1]) |
| 7 | AC_LANG_ASSERT([C++]) |
| 8 | ac_add_cxxflags__old_cxxflags="$CXXFLAGS" |
| 9 | CXXFLAGS="$1" |
| 10 | AC_TRY_LINK([ |
| 11 | #include <cstdio> |
| 12 | ], |
| 13 | [puts("Hello, World!"); return 0;], |
| 14 | AC_MSG_RESULT([yes]) |
| 15 | CXXFLAGS="$ac_add_cxxflags__old_cxxflags $1", |
| 16 | AC_MSG_RESULT([no]) |
| 17 | CXXFLAGS="$ac_add_cxxflags__old_cxxflags" |
| 18 | ) |
| 19 | ])# MN_ADD_CXXFLAGS |