On 02/26/2017 01:10 AM, Kai Noda wrote: > 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 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
Attachment:
signature.asc
Description: OpenPGP digital signature
_______________________________________________ Autoconf mailing list Autoconf@xxxxxxx https://lists.gnu.org/mailman/listinfo/autoconf