autoconf
[Top][All Lists]
Advanced

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

Re: How to write directly to config.h from configure?


From: Zack Weinberg
Subject: Re: How to write directly to config.h from configure?
Date: Thu, 26 Jul 2018 11:53:40 -0400

On Thu, Jul 26, 2018 at 11:36 AM, Jeffrey Walton <address@hidden> wrote:
...
> The problem is, the project's config.h has some stuff that does not
> seem to fit in the Autotools model like typedefs and declarations of
> namespaces. I think the solution is to write directly to config.h but
> I can't figure out how to do it. Testing code like below is lost
> (i.e., it is not in the resulting config.h):
>
>     ## Some real autoconf tests...
>
>     cat << EOT >> config.h
>       typedef unsigned char byte;
>       typedef unsigned short word16;
>       typedef unsigned int word32;
>     EOT
>
>     ## Back to real autoconf tests...
>
> Is it possible to write directly to config.h? If yes, then how do I do it?

I don't think there's any way to _conditionally_ include a block of
code in the generated config.h.  If the test can be restructured into
an appropriate form, you could do something like this:

if test $ac_cv_whatever = yes; then
   AC_DEFINE([TYPESIZES_C8_S16_I32]
fi
AH_VERBATIM([TYPESIZES_B8_S16_I32_COND],
[#ifdef TYPESIZES_C8_S16_I32_COND
       typedef unsigned char byte;
       typedef unsigned short word16;
       typedef unsigned int word32;
#endif
])

Also, AC_DEFINE_UNQUOTED may be useful.



reply via email to

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