blob: 1c0a4deb96fb6301e62a886d0b44576dd015a98d [file] [log] [blame]
Alexandre Lision7c6f4a62013-09-05 13:27:01 -04001dnl @synopsis MN_ADD_CXXFLAGS
2dnl
3dnl Add the given option to CXXFLAGS, if it doesn't break the compiler
4
5AC_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