1 |
On Mon, Mar 21, 2011 at 6:37 AM, justin wrote: |
2 |
> During closer investigation I found that it alos changes data width and |
3 |
> similar. probably something which should be checked during configure. |
4 |
|
5 |
oh god, this is why it burns |
6 |
|
7 |
> AC_ARG_ENABLE(64, |
8 |
> AS_HELP_STRING([--enable-64], [64 bit pointers])) |
9 |
> if test "${enable_64}" = "yes" ; then |
10 |
> AC_MSG_CHECKING(for 64bit compilation support) |
11 |
> |
12 |
> dnl Test for Linux 64 bit |
13 |
> |
14 |
> if test "`uname`" = "Linux"; then |
15 |
> CPPFLAGS="-DAJ_Linux64 $CPPFLAGS" |
16 |
> fi |
17 |
|
18 |
this all needs to be punted |
19 |
|
20 |
> exmaple header: |
21 |
> |
22 |
> |
23 |
> dnl Test for FreeBSD 64 bit |
24 |
> #if !defined(AJ_LinuxLF) && !defined(AJ_SolarisLF) && |
25 |
> !defined(AJ_IRIXLF) && !defined(AJ_AIXLF) && !defined(AJ_HPUXLF) && |
26 |
> !defined(AJ_MACOSXLF) && !defined(AJ_FreeBSDLF) && !defined(WIN32) |
27 |
> typedef int ajint; |
28 |
> typedef long ajlong; |
29 |
> typedef unsigned int ajuint; |
30 |
> typedef short ajshort; |
31 |
> typedef unsigned short ajushort; |
32 |
> typedef unsigned long ajulong; |
33 |
> #endif |
34 |
> |
35 |
> |
36 |
> #ifdef AJ_LinuxLF |
37 |
> #define HAVE64 |
38 |
> typedef int ajint; |
39 |
> typedef long long ajlong; |
40 |
> typedef unsigned int ajuint; |
41 |
> typedef short ajshort; |
42 |
> typedef unsigned short ajushort; |
43 |
> typedef unsigned long long ajulong; |
44 |
> #define ftell(a) ftello(a) |
45 |
> #define fseek(a,b,c) fseeko(a,b,c) |
46 |
> #endif |
47 |
|
48 |
so it wants to normalize aj* types to a specific size. it'd make more |
49 |
sense to include stdint.h and then do: |
50 |
typedef int32_t ajint; |
51 |
typedef int64_t ajlong; |
52 |
typedef uint32_t ajuint; |
53 |
typedef int16_t ajshort; |
54 |
typedef uint16_t ajushort; |
55 |
typedef uint64_t ajulong; |
56 |
|
57 |
this should work for *all* targets |
58 |
|
59 |
ftell vs ftello is a bit weirder. i'd say always call ftello() all |
60 |
the time and let the off_t types worry about 32 bit vs 64 bit. so in |
61 |
the configure script. do something like: |
62 |
AC_CHECK_FUNCS([ftello fseeko]) |
63 |
|
64 |
then in the header: |
65 |
#ifdef HAVE_FTELLO |
66 |
#define ftell(a) ftello(a) |
67 |
#endif |
68 |
#ifdef HAVE_FSEEKO |
69 |
#define fseek(a,b,c) fseeko(a,b,c) |
70 |
#endif |
71 |
|
72 |
and again, this should work for all targets, not just linux |
73 |
-mike |