autoconf
[Top][All Lists]
Advanced

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

Re: determine base type of a typedef


From: Anatoli
Subject: Re: determine base type of a typedef
Date: Sun, 25 Oct 2020 19:00:20 -0300

Paul,

Thanks for your suggestion.

If I understand you correctly, I should use something like AC_COMPILE_IFELSE 
with the code with a redefine as you specified, right?

Something like:

AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <time.h>
extern time_t foo;
extern long long int foo;]],[[]])],time_fmt="%lld",
    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <time.h>
    extern time_t foo;
    extern long int foo;]],[[]])],time_fmt="%ld",time_fmt="-")
)


On 23/10/20 14:16, Paul Eggert wrote:
> On 10/22/20 6:09 PM, Russell Shaw wrote:
>>     else if(sizeof(time_t) == sizeof(long int)) { 
> 
> This is not the right kind of test. You want to test whether time_t and int 
> are the same types, not whether they're the same size. To do that, you should 
> use code like this:
> 
> extern time_t foo;
> extern long int foo;
> 
> Of course this means you'll need to compile N programs rather than one, but 
> that's life in the big Autoconf city.
> 



reply via email to

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