¿Cómo especificar un valor para un #define con autoconf?

I'm trying to build Gnu binutils with behaviour unlocked by defining the macro SYSV386_COMPAT 0 to vary the way in which it generates some FPU opcodes.

I can easily go into the header file and set the value manually, but how would I invoke the configure script in order to specify the equivalent of #define SYSV386_COMPAT 0 on the command line? I would prefer to specify something on the command line if at all possible (just because the feature is transitive and I don't think I should be hacking the source). Having said that, I have tried to read at least some of the FM but have had no luck with inserting an AC_DEFINE(SYSV386_COMPAT, 0) en cualquiera binutils/configure.in or gas/configure.in.

preguntado el 09 de marzo de 12 a las 13:03

I don't have sufficient credit here to answer my own question yet, I need to wait another few hours, permitting helpful souls like yourselves to slave away at answering a question to which I have found the answer. I'll post when I can, till then it lies in using ./configure CFLAGS=-DSYSV386_COMPAT=0... -

You should use CPPFLAGS instead of CFLAGS. This will allow the default CFLAGS to be set, so you'll get optimizations. Also, the convention is for preprocessor flags to be in CPPFLAGS -

Thanks William, that's very welcome advice. -

1 Respuestas

OK, so continued searching through other autoconf-tagged answers took me to the second comment for este responder.

I was able to use a similar syntax to invoke configure to get the result I was after:

./configure CPPFLAGS=-DSYSV386_COMPAT=0 --prefix=/path/to/my/deploy/dir

Thanks to William Pursell for his comment above pointing out the benefits of using CPPFLAGS en lugar de CFLAGS, and to anyone who was preparing to answer this question. If you have any further comments about the "best" way of solving this problem then please add to this thread for those coming to it later.

Los mejores deseos,


contestado el 23 de mayo de 17 a las 13:05

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.