Quantcast

#ifndef BIGENDIAN #undef BIGENDIAN ?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

#ifndef BIGENDIAN #undef BIGENDIAN ?

Kai Noda
Hi all,

I don't quite understand this piece of code:

http://git.savannah.gnu.org/gitweb/?p=autoconf.git;a=blobdiff;f=lib/autoconf/c.m4;h=51fdfeba68fffe7f6f5638eaeef00149ed168282;hp=ffaa06e39dff758a24618a8f6504b22103caefac;hb=b0e687ef42e21b1eb7af18c4eaebcd41b0bd5632;hpb=883c8994f1efdc3c550b0d37bf95c947881b735d

#else
# ifndef WORDS_BIGENDIAN
#  undef WORDS_BIGENDIAN
# endif

What was it supposed to achieve? Should it not be either of these two?

#ifndef WORDS_BIGENDIAN
**#define** WORDS_BIGENDIAN

or

**#ifdef** WORDS_BIGENDIAN
#undef WORDS_BIGENDIAN

Please disregard if I missed something elementary. I'm not literate in m4.
I just tried to use AC_C_BIGENDIAN for my project and was startled to
see its output.

Regards,
Kai

野田  開 <[hidden email]>

_______________________________________________
Autoconf mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/autoconf
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: #ifndef BIGENDIAN #undef BIGENDIAN ?

Eric Blake-3
On 02/26/2017 01:10 AM, Kai Noda wrote: This is the proper way to set up a config template.  When config.status
runs, ALL it does is replace '#undef' lines with either '/* #undef */'
or '#define' lines, according to what was learned during configure.  All
other lines are left untouched.

>
> What was it supposed to achieve? Should it not be either of these two?
>
> #ifndef WORDS_BIGENDIAN
> **#define** WORDS_BIGENDIAN

This is what results in the final config.h based on the template on
machines where the #define is needed.

>
> or
>
> **#ifdef** WORDS_BIGENDIAN
> #undef WORDS_BIGENDIAN

No, this is not what is wanted.

>
> Please disregard if I missed something elementary. I'm not literate in m4.

It's not m4, but autoconf doing this.  It's documented here:
https://www.gnu.org/software/autoconf/manual/autoconf.html#Header-Templates

> I just tried to use AC_C_BIGENDIAN for my project and was startled to
> see its output.

The output is correct.  Remember that config.h.in files have a slightly
different syntax than the final generated config.h file.

--
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


_______________________________________________
Autoconf mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/autoconf

signature.asc (617 bytes) Download Attachment
Loading...