[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Using AC_DEFINE with AC_ARG_ENABLE (or AC_ARG_WITH)
From: |
Nick Bowler |
Subject: |
Re: Using AC_DEFINE with AC_ARG_ENABLE (or AC_ARG_WITH) |
Date: |
Thu, 15 Aug 2019 09:56:58 -0400 |
Hi Chris,
On 8/15/19, Chris Packham <address@hidden> 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