From: Rafael L. <rla...@us...> - 2004-09-04 21:08:48
|
* Alan W. Irwin <ir...@be...> [2004-09-04 11:08]: > On 2004-09-04 17:33+0200 Rafael Laboissiere wrote: > > >* Alan W. Irwin <ir...@be...> [2004-09-03 14:28]: > > > >>Rafael, what test can we put into lib/nn/Makefile.am that gcc is being > >>used > >>as the compiler at build time? > > > >AC_PROG_CC > >if test "$GCC" = yes ; then > > AC_MSG_NOTICE([Cool, gcc is the C compiler]) > >fi > > > >(This is only an illustration. AC_PROG_CC need not to go into > >lib/nn/Makefile.am, since it appears already in configure.ac.) > > The above logic will only work in configuration files processed by autoconf > and will not work in Makefile.am files at all. Is the above shorthand for > the following scenario: we make the above test in one of the files in the cf > directory and then set an automake conditional which in turn will be used in > Makefile.am? This, of course, means that the user won't be able to change > CC between configuration and building, but I am not sure autotools allows > such a compiler change in any case. > > I have to say what I was asking for originally was a pure build-time test in > the Makefile with $CC --version |grep gcc at the heart of the test, but it > may be extremely difficult or impossible to make such a build-time test work > cross-platform so I am willing to settle for the above configure-time logic. We could put in configure.ac (or in a cf/*.ac file), after AC_PROG_CC: AM_CONDITIONAL(cc_is_gcc, [test "$GCC" = yes]) and in lib/nn/Makefile.am: if cc_is_gcc AM_CFLAGS = -O2 -fno-force-mem -ffloat-store endif I did not test this extensively, but it should work. -- Rafael |