autoconf
[Top][All Lists]
Advanced

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

Re: autoheader an AC_DEFINE


From: aotto
Subject: Re: autoheader an AC_DEFINE
Date: Fri, 2 Sep 2022 23:25:57 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.0

Hi,

I had 2 problems:

1. my AC_DEFINE was only in the positive AS_IF state and the default #undef was 
chosen for the negative state
     → Solution: As mentioned, add a variable and remove AC_DEFINE from the 
condition

2. the AC_DEFINE does not use the variable, the AC_DEFINE_UNQUOTED has done the 
job.

it is fine now.

thanks.


On 02.09.22 21:40, Zack Weinberg wrote:
On Fri, Sep 2, 2022, at 2:03 PM, aotto wrote:
Hi,

I use autoconf to config my application. My problem is that I require a
macro with

      #define NAME 1

or

      #define NAME 0

autoconf / autoheader uses for '#define NAME 0' the value '#undef NAME'
This ought to work:

AS_IF([test x"$ac_cv_condition_for_NAME" = xyes],
  [AC_DEFINE([NAME], [1], [Explanation of NAME.])],
  [AC_DEFINE([NAME], [0], [Explanation of NAME.])])

And so should this:

AS_IF([test x"$ac_cv_condition_for_NAME" = xyes],
   [value_NAME=1],
   [value_NAME=0])
AC_DEFINE_UNQUOTED([NAME], [$value_NAME], [Explanation of NAME.])

If neither of those works, we're going to need to see a self-contained 
configure.ac that demonstrates exactly what you're trying to do, because the 
problem must be more complicated than just how you're using AC_DEFINE.

zw





reply via email to

[Prev in Thread] Current Thread [Next in Thread]