[gdal-dev] cpl_port.h CPL_LSB macro setting

Frank Warmerdam warmerdam at pobox.com
Tue Jun 16 13:09:23 EDT 2009


Rubin, Jared wrote:
> 
> Is there a test in configure script to set the CPL_LSB macro automatically?
> I am building on both big and little endian and I am not seeing the 
> macro being set
> CPL_IS_LSB is not being set to either 0 or 1
> thanks

Jared,

The AC_C_BIGENDIAN step in configure sets the WORDS_BIGENDIAN macro (or not)
in cpl_config.h.  cpl_port.h then checks for this to decide whether to set
CPL_LSB or CPL_MSB and how to set CPL_IS_LSB.

The following code in cpl_port.h should ensure that anything including
cpl_port.h gets a 1 or 0 definition of CPL_IS_LSB.  Note that there are
some files (such as sublibraries such as libtiff or libpng) that do not
include cpl_port.h.

#if defined(CPL_LSB)
#  define CPL_IS_LSB 1
#else
#  define CPL_IS_LSB 0
#endif

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent



More information about the gdal-dev mailing list