From fba5138c0dc4a5418e49a29d955e847f7affc735 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Sun, 24 Apr 2022 11:12:35 +0200 Subject: [PATCH] Add SIZEOF_{LONG,POINTER,SIZE_T} checks --- .../libbuild2/autoconf/checks/SIZEOF_LONG.h | 16 +++++++++++++ .../autoconf/checks/SIZEOF_POINTER.h | 23 +++++++++++++++++++ .../libbuild2/autoconf/checks/SIZEOF_SIZE_T.h | 23 +++++++++++++++++++ 3 files changed, 62 insertions(+) create mode 100644 libbuild2-autoconf/libbuild2/autoconf/checks/SIZEOF_LONG.h create mode 100644 libbuild2-autoconf/libbuild2/autoconf/checks/SIZEOF_POINTER.h create mode 100644 libbuild2-autoconf/libbuild2/autoconf/checks/SIZEOF_SIZE_T.h diff --git a/libbuild2-autoconf/libbuild2/autoconf/checks/SIZEOF_LONG.h b/libbuild2-autoconf/libbuild2/autoconf/checks/SIZEOF_LONG.h new file mode 100644 index 0000000..7bf85ee --- /dev/null +++ b/libbuild2-autoconf/libbuild2/autoconf/checks/SIZEOF_LONG.h @@ -0,0 +1,16 @@ +// SIZEOF_LONG + +#undef SIZEOF_LONG + +#ifdef _MSC_VER +# define SIZEOF_LONG 4 +#else +/* Both GCC and Clang (and maybe others) define __SIZEOF_LONG__. */ +# ifdef __SIZEOF_LONG__ +# define SIZEOF_LONG __SIZEOF_LONG__ +# endif +#endif + +#ifndef SIZEOF_LONG +# error unable to determine size of long int +#endif diff --git a/libbuild2-autoconf/libbuild2/autoconf/checks/SIZEOF_POINTER.h b/libbuild2-autoconf/libbuild2/autoconf/checks/SIZEOF_POINTER.h new file mode 100644 index 0000000..b832971 --- /dev/null +++ b/libbuild2-autoconf/libbuild2/autoconf/checks/SIZEOF_POINTER.h @@ -0,0 +1,23 @@ +// SIZEOF_POINTER + +/* See also SIZEOF_SIZE_T (the two may not be the same). */ + +#undef SIZEOF_POINTER + +#ifdef _MSC_VER +/* _WIN64 is defined for both x64 (x86_64) and ARM64 (aarch64). */ +# ifdef _WIN64 +# define SIZEOF_POINTER 8 +# else +# define SIZEOF_POINTER 4 +# endif +#else +/* Both GCC and Clang (and maybe others) define __SIZEOF_POINTER__. */ +# ifdef __SIZEOF_POINTER__ +# define SIZEOF_POINTER __SIZEOF_POINTER__ +# endif +#endif + +#ifndef SIZEOF_POINTER +# error unable to determine size of pointer +#endif diff --git a/libbuild2-autoconf/libbuild2/autoconf/checks/SIZEOF_SIZE_T.h b/libbuild2-autoconf/libbuild2/autoconf/checks/SIZEOF_SIZE_T.h new file mode 100644 index 0000000..11c1a95 --- /dev/null +++ b/libbuild2-autoconf/libbuild2/autoconf/checks/SIZEOF_SIZE_T.h @@ -0,0 +1,23 @@ +// SIZEOF_SIZE_T + +/* See also SIZEOF_POINTER (the two may not be the same). */ + +#undef SIZEOF_SIZE_T + +#ifdef _MSC_VER +/* _WIN64 is defined for both x64 (x86_64) and ARM64 (aarch64). */ +# ifdef _WIN64 +# define SIZEOF_SIZE_T 8 +# else +# define SIZEOF_SIZE_T 4 +# endif +#else +/* Both GCC and Clang (and maybe others) define __SIZEOF_SIZE_T__. */ +# ifdef __SIZEOF_SIZE_T__ +# define SIZEOF_SIZE_T __SIZEOF_SIZE_T__ +# endif +#endif + +#ifndef SIZEOF_SIZE_T +# error unable to determine size of size_t +#endif