Skip to content
Snippets Groups Projects
Commit 54e77c9f authored by Christoph Grüninger's avatar Christoph Grüninger
Browse files

[cxx0x_compiler.m4]

Try -std=c++11 before -std=c++0x as the latter causes a warning for
Clang. (solves partly FS#989)

[[Imported from SVN: r6986]]
parent 153091f4
No related branches found
No related tags found
No related merge requests found
# whether g++ accepts -std=c++0x
# whether compiler accepts -std=c++11 or -std=c++0x
# can be disabled by --disable-gxx0xcheck
AC_DEFUN([GXX0X],[
ac_save_CXX="$CXX"
AC_CACHE_CHECK([whether g++ accepts -std=c++0x], dune_cv_gplusplus_accepts_cplusplus0x, [
# try flag -std=c++11
AC_CACHE_CHECK([whether $CXX accepts -std=c++11], dune_cv_gplusplus_accepts_cplusplus11, [
AC_REQUIRE([AC_PROG_CXX])
AC_ARG_ENABLE(gxx0xcheck,
AC_HELP_STRING([--disable-gxx0xcheck],
[try to enable c++0x feature for g++ [[default=yes]]]),
[try flag -std=c++11 to enable C++11 features [[default=yes]]]),
[gxx0xcheck=$enableval],
[gxx0xcheck=yes])
if test "x$GXX" = xyes && test "x$gxx0xcheck" = xyes; then
AC_LANG_PUSH([C++])
CXX="$CXX -std=c++0x"
CXX="$CXX -std=c++11"
AC_TRY_COMPILE([
#include <iostream>
#include <array>
], [],
dune_cv_gplusplus_accepts_cplusplus0x=yes,
dune_cv_gplusplus_accepts_cplusplus0x=no)
AC_LANG_POP
dune_cv_gplusplus_accepts_cplusplus11=yes,
dune_cv_gplusplus_accepts_cplusplus11=no)
AC_LANG_POP([C++])
fi
])
if test "x$dune_cv_gplusplus_accepts_cplusplus0x" == "xyes" ; then
CXX="$ac_save_CXX -std=c++0x"
CXXCPP="$CXXCPP -std=c++0x"
if test "x$dune_cv_gplusplus_accepts_cplusplus11" == "xyes" ; then
CXX="$ac_save_CXX -std=c++11"
CXXCPP="$CXXCPP -std=c++11"
else
CXX="$ac_save_CXX"
# try flag -std=c++0x instead
AC_CACHE_CHECK([whether $CXX accepts -std=c++0x], dune_cv_gplusplus_accepts_cplusplus0x, [
AC_REQUIRE([AC_PROG_CXX])
AC_ARG_ENABLE(gxx0xcheck,
AC_HELP_STRING([--disable-gxx0xcheck],
[try flag -std=c++0x to enable C++11 features [[default=yes]]]),
[gxx0xcheck=$enableval],
[gxx0xcheck=yes])
if test "x$GXX" = xyes && test "x$gxx0xcheck" = xyes; then
AC_LANG_PUSH([C++])
CXX="$CXX -std=c++0x"
AC_TRY_COMPILE([
#include <iostream>
#include <array>
], [],
dune_cv_gplusplus_accepts_cplusplus0x=yes,
dune_cv_gplusplus_accepts_cplusplus0x=no)
AC_LANG_POP([C++])
fi
])
if test "x$dune_cv_gplusplus_accepts_cplusplus0x" == "xyes" ; then
CXX="$ac_save_CXX -std=c++0x"
CXXCPP="$CXXCPP -std=c++0x"
else
CXX="$ac_save_CXX"
fi
fi
])
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment