Re: Using AC_DEFINE with AC_ARG_ENABLE (or AC_ARG_WITH)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Chris,

On 8/15/19, Chris Packham <Chris.Packham@xxxxxxxxxxxxxxxxxxx> wrote:
> I'm trying to get a value provided on the ./configure invocation
> through to C code so it can be used. I'm trying to do this with
> AC_DEFINE but maybe this is a job for something else.
[...]
> AC_DEFINE([ENTITY],[${enable_entity}],[Entity])
[...]
> In file included from <command-line>:0:0:
> test.c: In function ‘main’:
> ./config.h:5:16: error: ‘$’ undeclared (first use in this function)
>  #define ENTITY ${enable_entity}
>
> Which is a bit too literal. I suspect I'm missing something (like
> AC_SUBST). But I can't for all the searching figure out how to get a
> value from the ./configure invocation through to the end program.

You must use AC_DEFINE_UNQUOTED[1] if you want shell expansion to
be performed on the value.

[1] https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.69/autoconf.html#Defining-Symbols

Hope that helps,
  Nick

_______________________________________________
Autoconf mailing list
Autoconf@xxxxxxx
https://lists.gnu.org/mailman/listinfo/autoconf




[Index of Archives]     [GCC Help]     [Kernel Discussion]     [RPM Discussion]     [Red Hat Development]     [Yosemite News]     [Linux USB]     [Samba]

  Powered by Linux