From b3a03b79ce621fec579f930c63ba2fdf526d66db Mon Sep 17 00:00:00 2001 From: Diederick Niehorster Date: Mon, 12 Mar 2012 03:32:53 +0000 Subject: [PATCH] now use unsigned __int64 for time type when on MSVC, that is supported down to at least MSVC6 (thanks Sisyphus!) Also, type present checks are not done if stdint or inttypes headers are found, no need for them then. git-svn-id: svn+ssh://svn.code.sf.net/p/freeglut/code/trunk/freeglut/freeglut@1116 7f0cb862-5218-0410-a997-914c9d46530a --- CMakeLists.txt | 11 ++++++++++- config.h.in | 1 + src/fg_internal.h | 2 ++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 98559b4..9fa75b4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -178,7 +178,16 @@ ENDIF() # decide on suitable type for internal time keeping, 64-bit if possible CHECK_INCLUDE_FILES(stdint.h HAVE_STDINT_H) CHECK_INCLUDE_FILES(inttypes.h HAVE_INTTYPES_H) -CHECK_TYPE_SIZE("unsigned long long" ULONG_LONG BUILTIN_TYPES_ONLY) +IF (NOT (HAVE_STDINT_H OR HAVE_INTTYPES_H)) + IF (MSVC) + # Some old Microsoft VC don't support unsigned long long, but all we + # care about support unsigned __int64, so test for presence of that + # type + CHECK_TYPE_SIZE("unsigned __int64" U__INT64 BUILTIN_TYPES_ONLY) + ELSEIF() + CHECK_TYPE_SIZE("unsigned long long" ULONG_LONG BUILTIN_TYPES_ONLY) + ENDIF() +ENDIF() # The generated config.h is placed in the project's build directory, just to diff --git a/config.h.in b/config.h.in index f38897a..60cd956 100644 --- a/config.h.in +++ b/config.h.in @@ -16,3 +16,4 @@ #cmakedefine HAVE_STDINT_H #cmakedefine HAVE_INTTYPES_H #cmakedefine HAVE_ULONG_LONG +#cmakedefine HAVE_U__INT64 diff --git a/src/fg_internal.h b/src/fg_internal.h index 34fdc8e..6fa691f 100644 --- a/src/fg_internal.h +++ b/src/fg_internal.h @@ -163,6 +163,8 @@ #elif defined(HAVE_INTTYPES_H) # include typedef uint64_t fg_time_t; +#elif defined(HAVE_U__INT64) + typedef unsigned __int64 fg_time_t; #elif defined(HAVE_ULONG_LONG) typedef unsigned long long fg_time_t; #else -- 1.7.10.4