<div dir="ltr">Yep, just haven't gotten there yet.</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Jan 17, 2014 at 12:15 AM, Evgeniy Stepanov <span dir="ltr"><<a href="mailto:eugeni.stepanov@gmail.com" target="_blank">eugeni.stepanov@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Do you plan to add the same check to cmake?<br>
<div class="HOEnZb"><div class="h5"><br>
<br>
On Wed, Jan 15, 2014 at 2:31 PM, Chandler Carruth <<a href="mailto:chandlerc@gmail.com">chandlerc@gmail.com</a>> wrote:<br>
> Author: chandlerc<br>
> Date: Wed Jan 15 04:31:15 2014<br>
> New Revision: 199313<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=199313&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=199313&view=rev</a><br>
> Log:<br>
> Add a check to configure that the libstdc++ selected by Clang isn't<br>
> libstdc++v4.6. This is quite hard to test directly, so we test for it by<br>
> checking a known missing feature in that version that was added in v4.7.<br>
><br>
> This should prevent users from upgrading Clang but not GCC and hosting<br>
> with a too-old GCC's libstdc++ and getting strange and hard to debug<br>
> errors when we switch to C++11 by default.<br>
><br>
> Also, switch several of the macros I introduced to use AC_LANG_SOURCE<br>
> rather than AC_LANG_PROGRAM as we don't need configure's help writing<br>
> our main function (and we don't need such a function at all for most of<br>
> the tests).<br>
><br>
> Modified:<br>
> llvm/trunk/autoconf/<a href="http://configure.ac" target="_blank">configure.ac</a><br>
> llvm/trunk/configure<br>
><br>
> Modified: llvm/trunk/autoconf/<a href="http://configure.ac" target="_blank">configure.ac</a><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/autoconf/configure.ac?rev=199313&r1=199312&r2=199313&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/autoconf/configure.ac?rev=199313&r1=199312&r2=199313&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/autoconf/<a href="http://configure.ac" target="_blank">configure.ac</a> (original)<br>
> +++ llvm/trunk/autoconf/<a href="http://configure.ac" target="_blank">configure.ac</a> Wed Jan 15 04:31:15 2014<br>
> @@ -102,15 +102,15 @@ dnl other possible compilers.<br>
> AC_MSG_CHECKING([whether GCC or Clang is our host compiler])<br>
> AC_LANG_PUSH([C++])<br>
> llvm_cv_cxx_compiler=unknown<br>
> -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#if ! __clang__<br>
> - #error<br>
> - #endif<br>
> - ]])],<br>
> +AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#if ! __clang__<br>
> + #error<br>
> + #endif<br>
> + ]])],<br>
> llvm_cv_cxx_compiler=clang,<br>
> - [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#if ! __GNUC__<br>
> - #error<br>
> - #endif<br>
> - ]])],<br>
> + [AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#if ! __GNUC__<br>
> + #error<br>
> + #endif<br>
> + ]])],<br>
> llvm_cv_cxx_compiler=gcc, [])])<br>
> AC_LANG_POP([C++])<br>
> AC_MSG_RESULT([${llvm_cv_cxx_compiler}])<br>
> @@ -129,7 +129,7 @@ case "$enableval" in<br>
> case "$llvm_cv_cxx_compiler" in<br>
> clang)<br>
> AC_MSG_CHECKING([whether Clang is new enough])<br>
> - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[<br>
> + AC_COMPILE_IFELSE([AC_LANG_SOURCE([[<br>
> #if __clang_major__ < 3 || (__clang_major__ == 3 && __clang_minor__ < 1)<br>
> #error This version of Clang is too old to build LLVM<br>
> #endif<br>
> @@ -140,10 +140,34 @@ case "$enableval" in<br>
> The selected Clang compiler is not new enough to build LLVM. Please upgrade to<br>
> Clang 3.1. You may pass --disable-compiler-version-checks to configure to<br>
> bypass these sanity checks.])])<br>
> +<br>
> + dnl Note that libstdc++4.6 is known broken for C++11 builds. The errors<br>
> + dnl are sometimes deeply confusing though. Here we test for an obvious<br>
> + dnl incomplete feature in 4.6's standard library that was completed in<br>
> + dnl 4.7's.<br>
> + AC_MSG_CHECKING([whether Clang will select a modern C++ standard library])<br>
> + llvm_cv_old_cxxflags="$CXXFLAGS"<br>
> + CXXFLAGS="$CXXFLAGS -std=c++0x"<br>
> + AC_LINK_IFELSE([AC_LANG_SOURCE([[<br>
> +#include <atomic><br>
> +std::atomic<float> x(0.0f);<br>
> +int main() { return (float)x; }<br>
> +]])],<br>
> + [AC_MSG_RESULT([yes])],<br>
> + [AC_MSG_RESULT([no])<br>
> + AC_MSG_ERROR([<br>
> +We detected a missing feature in the standard C++ library that was known to be<br>
> +missing in libstdc++4.6 and implemented in libstdc++4.7. There are numerous<br>
> +C++11 problems with 4.6's library, and we don't support GCCs or libstdc++ older<br>
> +than 4.7. You will need to update your system and ensure Clang uses the newer<br>
> +standard library.<br>
> +<br>
> +If this error is incorrect or you need to force things to work, you may pass<br>
> +'--disable-compiler-version-checks' to configure to bypass this test.])])<br>
> ;;<br>
> gcc)<br>
> AC_MSG_CHECKING([whether GCC is new enough])<br>
> - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[<br>
> + AC_COMPILE_IFELSE([AC_LANG_SOURCE([[<br>
> #if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 7)<br>
> #error This version of GCC is too old to build LLVM<br>
> #endif<br>
><br>
> Modified: llvm/trunk/configure<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/configure?rev=199313&r1=199312&r2=199313&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/configure?rev=199313&r1=199312&r2=199313&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/configure (original)<br>
> +++ llvm/trunk/configure Wed Jan 15 04:31:15 2014<br>
> @@ -3593,16 +3593,9 @@ cat confdefs.h >>conftest.$ac_ext<br>
> cat >>conftest.$ac_ext <<_ACEOF<br>
> /* end confdefs.h. */<br>
> #if ! __clang__<br>
> - #error<br>
> - #endif<br>
> + #error<br>
> + #endif<br>
><br>
> -int<br>
> -main ()<br>
> -{<br>
> -<br>
> - ;<br>
> - return 0;<br>
> -}<br>
> _ACEOF<br>
> rm -f conftest.$ac_objext<br>
> if { (ac_try="$ac_compile"<br>
> @@ -3650,16 +3643,9 @@ cat confdefs.h >>conftest.$ac_ext<br>
> cat >>conftest.$ac_ext <<_ACEOF<br>
> /* end confdefs.h. */<br>
> #if ! __GNUC__<br>
> - #error<br>
> - #endif<br>
> -<br>
> -int<br>
> -main ()<br>
> -{<br>
> + #error<br>
> + #endif<br>
><br>
> - ;<br>
> - return 0;<br>
> -}<br>
> _ACEOF<br>
> rm -f conftest.$ac_objext<br>
> if { (ac_try="$ac_compile"<br>
> @@ -3748,13 +3734,6 @@ cat >>conftest.$ac_ext <<_ACEOF<br>
> #error This version of Clang is too old to build LLVM<br>
> #endif<br>
><br>
> -int<br>
> -main ()<br>
> -{<br>
> -<br>
> - ;<br>
> - return 0;<br>
> -}<br>
> _ACEOF<br>
> rm -f conftest.$ac_objext<br>
> if { (ac_try="$ac_compile"<br>
> @@ -3810,6 +3789,88 @@ bypass these sanity checks." >&2;}<br>
> fi<br>
><br>
> rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext<br>
> +<br>
> + { echo "$as_me:$LINENO: checking whether Clang will select a modern C++ standard library" >&5<br>
> +echo $ECHO_N "checking whether Clang will select a modern C++ standard library... $ECHO_C" >&6; }<br>
> + llvm_cv_old_cxxflags="$CXXFLAGS"<br>
> + CXXFLAGS="$CXXFLAGS -std=c++0x"<br>
> + cat >conftest.$ac_ext <<_ACEOF<br>
> +/* confdefs.h. */<br>
> +_ACEOF<br>
> +cat confdefs.h >>conftest.$ac_ext<br>
> +cat >>conftest.$ac_ext <<_ACEOF<br>
> +/* end confdefs.h. */<br>
> +<br>
> +#include <atomic><br>
> +std::atomic<float> x(0.0f);<br>
> +int main() { return (float)x; }<br>
> +<br>
> +_ACEOF<br>
> +rm -f conftest.$ac_objext conftest$ac_exeext<br>
> +if { (ac_try="$ac_link"<br>
> +case "(($ac_try" in<br>
> + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;<br>
> + *) ac_try_echo=$ac_try;;<br>
> +esac<br>
> +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5<br>
> + (eval "$ac_link") 2>conftest.er1<br>
> + ac_status=$?<br>
> + grep -v '^ *+' conftest.er1 >conftest.err<br>
> + rm -f conftest.er1<br>
> + cat conftest.err >&5<br>
> + echo "$as_me:$LINENO: \$? = $ac_status" >&5<br>
> + (exit $ac_status); } &&<br>
> + { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err'<br>
> + { (case "(($ac_try" in<br>
> + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;<br>
> + *) ac_try_echo=$ac_try;;<br>
> +esac<br>
> +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5<br>
> + (eval "$ac_try") 2>&5<br>
> + ac_status=$?<br>
> + echo "$as_me:$LINENO: \$? = $ac_status" >&5<br>
> + (exit $ac_status); }; } &&<br>
> + { ac_try='test -s conftest$ac_exeext'<br>
> + { (case "(($ac_try" in<br>
> + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;<br>
> + *) ac_try_echo=$ac_try;;<br>
> +esac<br>
> +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5<br>
> + (eval "$ac_try") 2>&5<br>
> + ac_status=$?<br>
> + echo "$as_me:$LINENO: \$? = $ac_status" >&5<br>
> + (exit $ac_status); }; }; then<br>
> + { echo "$as_me:$LINENO: result: yes" >&5<br>
> +echo "${ECHO_T}yes" >&6; }<br>
> +else<br>
> + echo "$as_me: failed program was:" >&5<br>
> +sed 's/^/| /' conftest.$ac_ext >&5<br>
> +<br>
> + { echo "$as_me:$LINENO: result: no" >&5<br>
> +echo "${ECHO_T}no" >&6; }<br>
> + { { echo "$as_me:$LINENO: error:<br>
> +We detected a missing feature in the standard C++ library that was known to be<br>
> +missing in libstdc++4.6 and implemented in libstdc++4.7. There are numerous<br>
> +C++11 problems with 4.6's library, and we don't support GCCs or libstdc++ older<br>
> +than 4.7. You will need to update your system and ensure Clang uses the newer<br>
> +standard library.<br>
> +<br>
> +If this error is incorrect or you need to force things to work, you may pass<br>
> +'--disable-compiler-version-checks' to configure to bypass this test." >&5<br>
> +echo "$as_me: error:<br>
> +We detected a missing feature in the standard C++ library that was known to be<br>
> +missing in libstdc++4.6 and implemented in libstdc++4.7. There are numerous<br>
> +C++11 problems with 4.6's library, and we don't support GCCs or libstdc++ older<br>
> +than 4.7. You will need to update your system and ensure Clang uses the newer<br>
> +standard library.<br>
> +<br>
> +If this error is incorrect or you need to force things to work, you may pass<br>
> +'--disable-compiler-version-checks' to configure to bypass this test." >&2;}<br>
> + { (exit 1); exit 1; }; }<br>
> +fi<br>
> +<br>
> +rm -f core conftest.err conftest.$ac_objext \<br>
> + conftest$ac_exeext conftest.$ac_ext<br>
> ;;<br>
> gcc)<br>
> { echo "$as_me:$LINENO: checking whether GCC is new enough" >&5<br>
> @@ -3825,13 +3886,6 @@ cat >>conftest.$ac_ext <<_ACEOF<br>
> #error This version of GCC is too old to build LLVM<br>
> #endif<br>
><br>
> -int<br>
> -main ()<br>
> -{<br>
> -<br>
> - ;<br>
> - return 0;<br>
> -}<br>
> _ACEOF<br>
> rm -f conftest.$ac_objext<br>
> if { (ac_try="$ac_compile"<br>
> @@ -10606,7 +10660,7 @@ else<br>
> lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2<br>
> lt_status=$lt_dlunknown<br>
> cat > conftest.$ac_ext <<EOF<br>
> -#line 10609 "configure"<br>
> +#line 10663 "configure"<br>
> #include "confdefs.h"<br>
><br>
> #if HAVE_DLFCN_H<br>
><br>
><br>
> _______________________________________________<br>
> llvm-commits mailing list<br>
> <a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</div></div></blockquote></div><br></div>