On Mon, Mar 21, 2011 at 6:37 AM, justin wrote:
> During closer investigation I found that it alos changes data width and
> similar. probably something which should be checked during configure.

oh god, this is why it burns

> AC_ARG_ENABLE(64,
>   AS_HELP_STRING([--enable-64], [64 bit pointers]))
> if test "${enable_64}" = "yes" ; then
> AC_MSG_CHECKING(for 64bit compilation support)
>
> dnl Test for Linux 64 bit
>
> if test "`uname`" = "Linux"; then
> CPPFLAGS="-DAJ_Linux64 $CPPFLAGS"
> fi

this all needs to be punted

> exmaple header:
>
>
> dnl Test for FreeBSD 64 bit
> #if !defined(AJ_LinuxLF) && !defined(AJ_SolarisLF) &&
> !defined(AJ_IRIXLF) && !defined(AJ_AIXLF) && !defined(AJ_HPUXLF) &&
> !defined(AJ_MACOSXLF) && !defined(AJ_FreeBSDLF) && !defined(WIN32)
> typedef int ajint;
> typedef long ajlong;
> typedef unsigned int ajuint;
> typedef short ajshort;
> typedef unsigned short ajushort;
> typedef unsigned long ajulong;
> #endif
>
>
> #ifdef AJ_LinuxLF
> #define HAVE64
> typedef int ajint;
> typedef long long ajlong;
> typedef unsigned int ajuint;
> typedef short ajshort;
> typedef unsigned short ajushort;
> typedef unsigned long long ajulong;
> #define ftell(a) ftello(a)
> #define fseek(a,b,c) fseeko(a,b,c)
> #endif

so it wants to normalize aj* types to a specific size.  it'd make more
sense to include stdint.h and then do:
typedef int32_t ajint;
typedef int64_t ajlong;
typedef uint32_t ajuint;
typedef int16_t ajshort;
typedef uint16_t ajushort;
typedef uint64_t ajulong;

this should work for *all* targets

ftell vs ftello is a bit weirder.  i'd say always call ftello() all
the time and let the off_t types worry about 32 bit vs 64 bit.  so in
the configure script. do something like:
AC_CHECK_FUNCS([ftello fseeko])

then in the header:
#ifdef HAVE_FTELLO
#define ftell(a) ftello(a)
#endif
#ifdef HAVE_FSEEKO
#define fseek(a,b,c) fseeko(a,b,c)
#endif

and again, this should work for all targets, not just linux
-mike

Reply via email to