Re: autoheader an AC_DEFINE

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

 



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






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

  Powered by Linux