Mon 07 Jul 2008 05:55:24 AM UTC, comment #2:
I'm quite sorry for long long delay about this issue.
Recently I've written a cpp code to determine the
size of int & long in compilation time. Still configure
writes the values obtained by AC_CHECK_SIZEOF(),
most cpp can determine the sizes from standard cpp macros
INT_MAX and LONG_MAX.
#include <limits.h>
#if ( 0x7FFFFFFFUL < 0x7FFFFFFFFFFFFFFFUL )
# warning cpp can evaluate 64bit numerics
# if ( INT_MAX < 0x7FFF )
# error Non-standard C whose int cannot cover signed 16bit
# elif ( 0x7FFF <= INT_MAX ) && ( INT_MAX < 0x7FFFFFFFUL )
# define FT_SIZEOF_INT 2
# elif ( 0x7FFFFFFF <= INT_MAX ) && ( INT_MAX < 0x7FFFFFFFFFFFUL )
# define FT_SIZEOF_INT 4
# else
# define FT_SIZEOF_INT 8
# endif
# if ( LONG_MAX < 0x7FFFFFFFL )
# error Non-standard C whose long cannot cover signed 32bit
# elif ( ( 0x7FFFFFFFL <= LONG_MAX ) && ( LONG_MAX < 0x7FFFFFFFFFFFUL ) )
# define FT_SIZEOF_LONG 4
# else
# define FT_SIZEOF_LONG 8
# endif
#else /* cpp cannot evaluate signed 64bit */
# warning cpp does not support 64bit numeric
/*
* Here we list the environment that can execute multiple ABIs
* with different bitsize (e.g. IRIX on mips64, AIX on ppc64)
* or build binary for multiple ABIs by single SDK (Mac OS X).
* The environment that use single ABI or multiple ABIs but
* same bit-length should be prepared by configure.
*/
# if defined( linux ) || defined( _FreeBSD_ ) || defined( _NetBSD_ ) || defined( _OpenBSD_ )
# if defined( __amd64 ) || defined( __ia64 ) || defined( __ppc64 ) || defined( __mips64 ) || defined( __sparc64 ) || defined( __sh64 )
# define _LP64_ 1
# elif defined( __i386 ) || defined( __ppc ) || defined( __mips ) || defined( __sparc ) || defined( __sh )
# define _LP32_ 1
# endif
/* AIX */
# elif defined( _AIX ) /* See /usr/include/sys/limits.h */
# if defined( _64BIT_ )
# define _LP64_ 1
# else
# define _LP32_ 1
# endif
/* HP-UX */
# elif defined( __hpux )
# ifndef _LP64_
# define _LP32_ 1
# endif
/* IRIX */
# elif defined( sgi )
# if defined( _MIPS_SZLONG ) && ( _MIPS_SZLONG == 64 )
# define _LP64_
# else
# define _LP32_
# endif
/* Mac OS X */
# elif defined( _APPLE_ ) && defined( _MACH_ )
# ifndef _LP64_
# define _LP32_
# endif
/* Solaris */
# elif defined( sun )
# ifdef _LP64
# define _LP64_
# else
# define _LP32_
# endif
# endif
# if defined( _LP32_ ) || defined( _LLP64_ )
# define FT_SIZEOF_INT 4
# define FT_SIZEOF_LONG 4
# elif defined( _LP64_ )
# define FT_SIZEOF_INT 4
# define FT_SIZEOF_LONG 8
# elif defined( _ILP64_ )
# define FT_SIZEOF_INT 8
# define FT_SIZEOF_LONG 8
# else
/* 16bit platform support should be added here */
# define FT_SIZEOF_INT @SIZEOF_INT@
# define FT_SIZEOF_LONG @SIZEOF_INT@
# endif
#endif
|