64 bit python
Martin v. Löwis
martin at v.loewis.de
Thu Jun 5 12:48:00 EDT 2003
"E. McKay Hyde" <hyde at math.umn.edu> writes:
> SIZEOF_LONG=4, as defined in pyconfig.h
That is the core of the problem; this setting is incorrect.
> ; this value appears to be set
> by the autoconf macro AC_CHECK_SIZEOF(long,4). Does this mean that
> the configure script expects a size of 4 bytes?
No. The second argument to AC_CHECK_SIZEOF is not used anymore; in
earlier autoconf versions, it provided a default in case of cross
compilation. Today, there is a tricky algorithm to detect the size of
long even if cross-compiling (i.e. where you can't run the program you
have compiled).
> Or perhaps the macro is using a different compiler in determining
> the size?
It uses $CC.
> I guess I will try to understand how AC_CHECK_SIZEOF works to see if
> it is using the correct compiler and compiler flags.
If you are not cross-compiling, it compiles and runs the program
attached below, with the command $ac_link. The exact command used for
compilation can be found in config.log, but it should be
$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5
HTH,
Martin
#include "confdefs.h"
$ac_includes_default
long longval () { return (long) (sizeof (long)); }
unsigned long ulongval () { return (long) (sizeof (long)); }
#include <stdio.h>
#include <stdlib.h>
#ifdef F77_DUMMY_MAIN
# ifdef __cplusplus
extern "C"
# endif
int F77_DUMMY_MAIN() { return 1; }
#endif
int
main ()
{
FILE *f = fopen ("conftest.val", "w");
if (! f)
exit (1);
if (((long) (sizeof (long))) < 0)
{
long i = longval ();
if (i != ((long) (sizeof (long))))
exit (1);
fprintf (f, "%ld\n", i);
}
else
{
unsigned long i = ulongval ();
if (i != ((long) (sizeof (long))))
exit (1);
fprintf (f, "%lu\n", i);
}
exit (ferror (f) || fclose (f) != 0);
;
return 0;
}
More information about the Python-list
mailing list