Message ID | mcry681pgll.fsf@google.com |
---|---|
State | New |
Headers | show |
On Tue, Dec 07, 2010 at 10:45:10AM -0800, Ian Lance Taylor wrote: > This is an example of the alternative approach I was thinking of: only > run the C++ tests if the C++ compiler works. Does this look OK? It could work, but I think you should a) rm -f conftest.* b) C++ ac_compile is $CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext so you should probably use $CXXFLAGS $CPPFLAGS too, not sure if .cc vs. .cpp extension could matter for any weird compilers. c) >&5 should probably be >&AS_MESSAGE_LOG_FD > 2010-12-07 Ian Lance Taylor <iant@google.com> > > PR bootstrap/46810 > * configure.ac: Only run C++ tests if the C++ compiler works. > > > Index: configure.ac > =================================================================== > --- configure.ac (revision 167515) > +++ configure.ac (working copy) > @@ -913,13 +913,17 @@ AC_C_BIGENDIAN > # Checks for C++ headers > # ---------------------- > > -AC_LANG_PUSH(C++) > +# Only run the tests if the C++ compiler works. > +echo "int i;" > conftest.cc > +if $CXX -c conftest.cc >&5; then > + AC_LANG_PUSH(C++) > + > + AC_CHECK_HEADERS(unordered_map) > + AC_CHECK_HEADERS(tr1/unordered_map) > + AC_CHECK_HEADERS(ext/hash_map) > > -AC_CHECK_HEADERS(unordered_map) > -AC_CHECK_HEADERS(tr1/unordered_map) > -AC_CHECK_HEADERS(ext/hash_map) > - > -AC_LANG_POP(C++) > + AC_LANG_POP(C++) > +fi > > # -------- > # UNSORTED Jakub
* Jakub Jelinek wrote on Tue, Dec 07, 2010 at 08:06:56PM CET: > On Tue, Dec 07, 2010 at 10:45:10AM -0800, Ian Lance Taylor wrote: > > This is an example of the alternative approach I was thinking of: only > > run the C++ tests if the C++ compiler works. Does this look OK? > > It could work, but I think you should > a) rm -f conftest.* > b) C++ ac_compile is > $CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext > so you should probably use $CXXFLAGS $CPPFLAGS too, not sure if > .cc vs. .cpp extension could matter for any weird compilers. For MSVC it makes a difference. Not sure if there is any danger of GCC ever being compiled with it though. :-) A compile-only test doesn't catch whether linking fails though, nor whether preprocessing is borked for some other reason; I don't think this is all that relevant though. Agreed on all other accounts. > c) >&5 should probably be >&AS_MESSAGE_LOG_FD > > 2010-12-07 Ian Lance Taylor <iant@google.com> > > > > PR bootstrap/46810 > > * configure.ac: Only run C++ tests if the C++ compiler works. Cheers, Ralf
Index: configure.ac =================================================================== --- configure.ac (revision 167515) +++ configure.ac (working copy) @@ -913,13 +913,17 @@ AC_C_BIGENDIAN # Checks for C++ headers # ---------------------- -AC_LANG_PUSH(C++) +# Only run the tests if the C++ compiler works. +echo "int i;" > conftest.cc +if $CXX -c conftest.cc >&5; then + AC_LANG_PUSH(C++) + + AC_CHECK_HEADERS(unordered_map) + AC_CHECK_HEADERS(tr1/unordered_map) + AC_CHECK_HEADERS(ext/hash_map) -AC_CHECK_HEADERS(unordered_map) -AC_CHECK_HEADERS(tr1/unordered_map) -AC_CHECK_HEADERS(ext/hash_map) - -AC_LANG_POP(C++) + AC_LANG_POP(C++) +fi # -------- # UNSORTED