From 9ea8f09e9cb2bf8de1d2d3f201a3a01e59c32d8c Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 7 Sep 2022 11:21:16 +0200 Subject: [PATCH] Fix SIZEOF_OFF_T check for MinGW --- libbuild2-autoconf-tests/checks/sizeof/driver.c | 2 ++ .../libbuild2/autoconf/checks/SIZEOF_OFF_T.h | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/libbuild2-autoconf-tests/checks/sizeof/driver.c b/libbuild2-autoconf-tests/checks/sizeof/driver.c index 0ab4017..91508fc 100644 --- a/libbuild2-autoconf-tests/checks/sizeof/driver.c +++ b/libbuild2-autoconf-tests/checks/sizeof/driver.c @@ -20,4 +20,6 @@ main () #ifdef TEST_PTHREAD assert (SIZEOF_PTHREAD_T == sizeof (pthread_t)); #endif + + return 0; } diff --git a/libbuild2-autoconf/libbuild2/autoconf/checks/SIZEOF_OFF_T.h b/libbuild2-autoconf/libbuild2/autoconf/checks/SIZEOF_OFF_T.h index 17f49ef..b94d134 100644 --- a/libbuild2-autoconf/libbuild2/autoconf/checks/SIZEOF_OFF_T.h +++ b/libbuild2-autoconf/libbuild2/autoconf/checks/SIZEOF_OFF_T.h @@ -8,10 +8,19 @@ * * Note that the _FILE_OFFSET_BITS macro is expected to be defined by the * user, for example, on the command line. + * + * MinGW uses 32-bit off_t both in the 32-bit and 64-bit modes unless forced + * with _FILE_OFFSET_BITS. */ #ifdef _MSC_VER # define SIZEOF_OFF_T 4 +#elif defined(__MINGW32__) +# if defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS == 64 +# define SIZEOF_OFF_T 8 +# else +# define SIZEOF_OFF_T 4 +# endif #elif (defined(__SIZEOF_SIZE_T__) && __SIZEOF_SIZE_T__ == 8) || \ (defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS == 64) # define SIZEOF_OFF_T 8