Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 41529

Summary: ebuild command to return endianness of architecture
Product: Portage Development Reporter: Jeremy Huddleston (RETIRED) <eradicator>
Component: Core - Ebuild SupportAssignee: Portage team <dev-portage>
Status: RESOLVED INVALID    
Severity: enhancement    
Priority: High    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description Jeremy Huddleston (RETIRED) gentoo-dev 2004-02-13 22:00:09 UTC
It'd be nice to have a command available to ebuild authors which returned the endianness (big or little endian) of the architecture... so we could do something like:

if eisbigendian; then
  CFLAGS="${CFLAGS} -DBIGENDIAN"
fi

or similar rather than doing a switch statement and trying to remember which arch is which endianness... 

Reproducible: Always
Steps to Reproduce:
1.
2.
3.
Comment 1 SpanKY gentoo-dev 2004-02-13 22:05:33 UTC
if your only need is for .c code then

#include <sys/types.h>
#if BYTE_ORDER == LITTLE_ENDIAN
#warn little !
#endif
#if BYTE_ORDER == BIG_ENDIAN
#warn big !
#endif