From: Guillaume Marcais Date: 2005-12-07T09:04:46+09:00 Subject: Re: Determining endianness in extconf.rb On Wed, 2005-12-07 at 07:22 +0900, Aaron Patterson wrote: > On Tue, Dec 06, 2005 at 02:00:33PM +0900, nobuyoshi nakada wrote: > [snip] > > > > Since config.h defines WORDS_BIGENDIAN for big-endian > > platforms, you don't have to test it in extconf.rb. > > > > -- > > Nobu Nakada > > I guess I don't understand how I am supposed to set up my build > environment.... As far as I can tell, config.h is generated while > building Ruby from source. The only config.h on my system is: > > /usr/lib/ruby/1.8/i386-linux/config.h > > Which does not have WORDS_BIGENDIAN listed in it. I did find > WORDS_BIGENDIAN in /usr/lib/ruby/1.8/i386-linux/defines.h but it just > says to look at __BIG_ENDIAN__. That's because you are on Intel, which is little endian. > Can you point me to a small project that I can model my build after, or > an example exconf.rb? What he is saying is that you should not modify your extconf.rb file. In your C code, just do: #ifdef WORDS_BIGENDIAN // Big endian code #else // Little endian code #endif Guillaume. > > Thanks for the help! > > --Aaron > >