On Wed, Nov 12, 2014 at 02:12:07PM +0100, Jakub Jelinek wrote:
> On Wed, Nov 12, 2014 at 01:55:12PM +0100, Basile Starynkevitch wrote:
> > Hello All,
> > 
> > Some plugins (including MELT, see http://gcc-melt.org/ for more)
> > are made of several C++ source files which all include "plugin-version.h"
> > because they have some C++ code which depends upon the particular version 
> > of GCC.
> > 
> > So they typically code
> > 
> >   #if GCCPLUGIN_VERSION >= 4009
> >      /* code for GCC 4.9 or newer. */
> >   #else 
> >      /* code for GCC 4.8 */
> >   #endif /*GCCPLUGIN_VERSION*/
> 
> Can't you just remember that version in configure of your plugin?


Most plugin don't need any configure, because they are installed in 
a version specific directory (like /usr/lib/gcc/x86_64-linux-gnu/4.9/plugin 
for example). I don't think it is wise to require plugin to be 
autoconf-configurable. Their Makefile simply uses 
$(shell gcc -print-file-name=plugin), there is no need to complex
autoconf machinery.

And even a plugin for a particular version of GCC is usually made
of several files, all of them with #include "plugin-version.h";
there is no need to define several times gcc_version.

(another possibility might be to make gcc_version an external symbol
with public visibility inside the cc1 or cc1plus executable)

Thanks for your comment.

Cheers. 
--
Basile Starynkevitch        http://starynkevitch.net/Basile/

Reply via email to