This patch extends PC/config.h and configure.in as appropriate for

64-bit readiness (the config values are needed for patches that I will
be submitting later today. The changes are as follows:

- add SIZEOF_OFF_T #define's to PC/config.h (it was already in configure.in)

- add SIZEOF_TIME_T #define to PC/config.h and configure
Needed for some buffer overflow checking because sizeof(time_t) is
different on Win64.

- add SIZEOF_FPOS_T #define
Needed for the Win64 large file support implementation.

- add SIZEOF_HKEY in PC/config.h only
Needed for proper Win32 vs. Win64 handling in PC/winreg.c

- #define HAVE_LARGEFILE_SUPPORT for Win64

- typedef long intptr_t; for all Windows except Win64 (which defines it
itself)
This is a new ANSI (I think) type that is useful (and used by me) for
proper handling in msvcrtmodule.c and posixmodule.c

- indent the nested #ifdef's and #defines in PC/config.h
This is *so* much more readable. There cannot be a compiler
compatibilty issue here can there? Perl uses indented #defines and it
compiles with everything.
This commit is contained in:
Fred Drake 2000-06-29 20:44:47 +00:00
parent d04038d9d2
commit a3f6e91307
4 changed files with 61 additions and 10 deletions

View File

@ -241,23 +241,45 @@ typedef int pid_t;
/* End of compilers - finish up */ /* End of compilers - finish up */
/* define the ANSI intptr_t type for portable use of a pointer sized
integer */
#include <basetsd.h>
#if defined(MS_WINDOWS) && !defined(MS_WIN64)
typedef long intptr_t;
#endif
#if defined(MS_WIN64) #if defined(MS_WIN64)
/* maintain "win32" sys.platform for backward compatibility of Python code, /* maintain "win32" sys.platform for backward compatibility of Python code,
the Win64 API should be close enough to the Win32 API to make this the Win64 API should be close enough to the Win32 API to make this
preferable */ preferable */
#define PLATFORM "win32" # define PLATFORM "win32"
#define SIZEOF_VOID_P 8 # define SIZEOF_VOID_P 8
# define SIZEOF_TIME_T 8
# define SIZEOF_OFF_T 4
# define SIZEOF_FPOS_T 8
# define SIZEOF_HKEY 8
/* configure.in defines HAVE_LARGEFILE_SUPPORT iff HAVE_LONG_LONG,
sizeof(off_t) > sizeof(long), and sizeof(LONG_LONG) >= sizeof(off_t).
On Win64 the second condition is not true, but if fpos_t replaces off_t
then this is true. The uses of HAVE_LARGEFILE_SUPPORT imply that Win64
should define this. */
# define HAVE_LARGEFILE_SUPPORT
#elif defined(MS_WIN32) #elif defined(MS_WIN32)
#define PLATFORM "win32" # define PLATFORM "win32"
#ifdef _M_ALPHA # ifdef _M_ALPHA
#define SIZEOF_VOID_P 8 # define SIZEOF_VOID_P 8
#else # define SIZEOF_TIME_T 8
#define SIZEOF_VOID_P 4 # else
#endif # define SIZEOF_VOID_P 4
# define SIZEOF_TIME_T 4
# define SIZEOF_OFF_T 4
# define SIZEOF_FPOS_T 8
# define SIZEOF_HKEY 4
# endif
#elif defined(MS_WIN16) #elif defined(MS_WIN16)
#define PLATFORM "win16" # define PLATFORM "win16"
#else #else
#define PLATFORM "dos" # define PLATFORM "dos"
#endif #endif

View File

@ -151,6 +151,9 @@
/* The number of bytes in an off_t. */ /* The number of bytes in an off_t. */
#undef SIZEOF_OFF_T #undef SIZEOF_OFF_T
/* The number of bytes in a time_t. */
#undef SIZEOF_TIME_T
/* Defined to enable large file support when an off_t is bigger than a long /* Defined to enable large file support when an off_t is bigger than a long
and long long is available and at least as big as an off_t. You may need and long long is available and at least as big as an off_t. You may need
to add some flags for configuration and compilation to enable this mode. to add some flags for configuration and compilation to enable this mode.

View File

@ -213,6 +213,9 @@
/* The number of bytes in an off_t. */ /* The number of bytes in an off_t. */
#undef SIZEOF_OFF_T #undef SIZEOF_OFF_T
/* The number of bytes in a time_t. */
#undef SIZEOF_TIME_T
/* Defined to enable large file support when an off_t is bigger than a long /* Defined to enable large file support when an off_t is bigger than a long
and long long is available and at least as big as an off_t. You may need and long long is available and at least as big as an off_t. You may need
to add some flags for configuration and compilation to enable this mode. to add some flags for configuration and compilation to enable this mode.
@ -234,6 +237,9 @@
/* The number of bytes in a float. */ /* The number of bytes in a float. */
#undef SIZEOF_FLOAT #undef SIZEOF_FLOAT
/* The number of bytes in a fpos_t. */
#undef SIZEOF_FPOS_T
/* The number of bytes in a int. */ /* The number of bytes in a int. */
#undef SIZEOF_INT #undef SIZEOF_INT
@ -546,6 +552,9 @@
/* Define if you have the <sys/socket.h> header file. */ /* Define if you have the <sys/socket.h> header file. */
#undef HAVE_SYS_SOCKET_H #undef HAVE_SYS_SOCKET_H
/* Define if you have the <sys/socket.h> header file. */
#undef HAVE_SYS_SOCKET_H
/* Define if you have the <sys/time.h> header file. */ /* Define if you have the <sys/time.h> header file. */
#undef HAVE_SYS_TIME_H #undef HAVE_SYS_TIME_H

View File

@ -389,6 +389,7 @@ AC_CHECK_SIZEOF(char)
AC_CHECK_SIZEOF(short) AC_CHECK_SIZEOF(short)
AC_CHECK_SIZEOF(float) AC_CHECK_SIZEOF(float)
AC_CHECK_SIZEOF(double) AC_CHECK_SIZEOF(double)
AC_CHECK_SIZEOF(fpos_t)
AC_MSG_CHECKING(for long long support) AC_MSG_CHECKING(for long long support)
have_long_long=no have_long_long=no
@ -424,6 +425,22 @@ else
AC_MSG_RESULT(no) AC_MSG_RESULT(no)
fi fi
# AC_CHECK_SIZEOF() doesn't include <time.h>.
AC_MSG_CHECKING(size of time_t)
AC_CACHE_VAL(ac_cv_sizeof_time_t,
[AC_TRY_RUN([#include <stdio.h>
#include <time.h>
main()
{
FILE *f=fopen("conftestval", "w");
if (!f) exit(1);
fprintf(f, "%d\n", sizeof(time_t));
exit(0);
}], ac_cv_sizeof_time_t=`cat conftestval`, ac_cv_sizeof_time_t=0)
])
AC_MSG_RESULT($ac_cv_sizeof_time_t)
AC_DEFINE_UNQUOTED(SIZEOF_TIME_T, $ac_cv_sizeof_time_t)
# Minor variations in building a framework between NextStep versions 4 and 5 # Minor variations in building a framework between NextStep versions 4 and 5
AC_SUBST(LIBTOOL_CRUFT) AC_SUBST(LIBTOOL_CRUFT)