On Thu, Oct 11, 2001 at 03:35:43AM -0400, Glenn Maynard wrote:
> On Thu, Oct 11, 2001 at 10:16:38AM +0400, Alexander V. Lukyanov wrote:
> > > Asked someone in debian/potato to try this out; the static initializer
> > > test failed.
> > >
> > > Reading specs from /usr/lib/gcc-lib/i386-linux/2.95.2/specs
> > > gcc version 2.95.2 20000220 (Debian GNU/Linux)
> >
> > This usually means that gcc was incorrecly compiled itself. The feature is
>
> Attached is a patch to test C++ compiler sanity early, so failure doesn't
> come up with some irrelevant error message later and confuse innocent
> programmers. :)
>
> --
> Glenn Maynard
> Index: m4/lftp.m4
> ===================================================================
> RCS file: /home/lav/cvsroot/lftp/m4/lftp.m4,v
> retrieving revision 1.1
> diff -u -r1.1 lftp.m4
> --- m4/lftp.m4 2001/03/22 12:46:51 1.1
> +++ m4/lftp.m4 2001/10/11 07:29:28
> @@ -41,6 +41,20 @@
> fi
> AC_MSG_RESULT(using $CXX)
> ])
> +dnl try to build and run a dummy program
> +AC_DEFUN(LFTP_CXX_TEST,
> +[
> + AC_LANG_SAVE
> + AC_LANG_CPLUSPLUS
> + AC_MSG_CHECKING(if c++ compiler works)
> + AC_TRY_RUN([int main() { return(0); } ],
> + [cxx_sane=yes], [cxx_sane=no], [cxx_sane=yes])
> + AC_MSG_RESULT($cxx_sane)
> + if test x$cxx_sane = xno; then
> + AC_MSG_ERROR(C++ test compile failed; check your C++ compiler)
> + fi
> + AC_LANG_RESTORE
> +])
Why don't you just:
AC_TRY_RUN([int main() { return(0); } ], ,[
AC_MSG_ERROR([C++ test compile failed; check your C++ compiler])])
--
albert chin ([EMAIL PROTECTED])