On Wednesday 25 January 2006 10:20, Igor Bukanov wrote: > Is there any option to ask GCC to print various size and alignment > info on the target platform? This would be very nice during cross > compilation when one can not run the executables to autoconfigure for > such parameters. > > Currently I consider for that a hack like copiling the following source: > > #include <stddef.h> > union aligned_fields { > double d; > void (*f)(); > ... > }; > > struct align_test { > union aligned_fields u1; > char c; > };
Autoconf already has tests for things like this. Something along the lines of: const char D_P_S_4[sizeof(void *) == 4 : -1 : 1]; const char D_P_S_8[sizeof(void *) == 8 : -1 : 1]; Then see which compiles, or grep the error messages. Paul