"Ralf Wildenhues" <ralf.wildenh...@gmx.de> writes: > Hello, > > * Ian Lance Taylor wrote on Wed, Jul 20, 2011 at 08:06:51PM CEST: >> Rainer Orth <r...@cebitec.uni-bielefeld.de> writes: >> >> > diff --git a/gcc/configure.ac b/gcc/configure.ac >> > --- a/gcc/configure.ac >> > +++ b/gcc/configure.ac >> > @@ -1041,7 +1041,16 @@ case "${host}" in >> > esac >> > AC_FUNC_FORK >> > >> > +# FIXME: g++ on Solaris 10+ defines _XOPEN_SOURCE=600, which exposes a >> > +# different iconv() prototype. >> > +if test "$ENABLE_BUILD_WITH_CXX" = "yes"; then >> > +AC_LANG_PUSH([C++]) >> > +fi >> > AM_ICONV >> > +if test "$ENABLE_BUILD_WITH_CXX" = "yes"; then >> > +AC_LANG_POP([C++]) >> > +fi >> >> I believe that this kind of conditional use of AC_LANG_PUSH/AC_LANG_POP >> does not work correctly. The autoconf macros don't play well with the >> shell conditionals. We're going to need a different approach. (That >> problem is why I didn't do this long ago--I had a similar patch for a >> while, but I had to take it out.) > > I think something like this should work: > > AS_IF([test "$ENABLE_BUILD_WITH_CXX" = "yes"], > [AC_LANG_PUSH([C++]) > AM_ICONV > AC_LANG_POP([C++])], > [AM_ICONV]) > > Rationale for using AS_IF rather than plain 'if' is that any macros > required by AM_ICONV will get pulled out to before the AS_IF. If they > also need to be run with C++ enabled, then we need to wrap the second > argument of AS_IF into a separate macro. Untested, but please complain > if it doesn't work.
Cool. In general, though, we should ideally be using C++ when appropriate for most or all of the compilation tests, not just for AM_ICONV. Ian