diff --git a/libbuild2-autoconf/libbuild2/autoconf/checks/SIZEOF_POINTER.h b/libbuild2-autoconf/libbuild2/autoconf/checks/SIZEOF_POINTER.h index b832971..1f258fe 100644 --- a/libbuild2-autoconf/libbuild2/autoconf/checks/SIZEOF_POINTER.h +++ b/libbuild2-autoconf/libbuild2/autoconf/checks/SIZEOF_POINTER.h @@ -1,6 +1,6 @@ // SIZEOF_POINTER -/* See also SIZEOF_SIZE_T (the two may not be the same). */ +/* See also SIZEOF_SIZE_T (the two may not be the same), SIZEOF_VOID_P. */ #undef SIZEOF_POINTER diff --git a/libbuild2-autoconf/libbuild2/autoconf/checks/SIZEOF_VOID_P.h b/libbuild2-autoconf/libbuild2/autoconf/checks/SIZEOF_VOID_P.h index 61d3773..e6e98c0 100644 --- a/libbuild2-autoconf/libbuild2/autoconf/checks/SIZEOF_VOID_P.h +++ b/libbuild2-autoconf/libbuild2/autoconf/checks/SIZEOF_VOID_P.h @@ -1,11 +1,23 @@ // SIZEOF_VOID_P +/* See also SIZEOF_SIZE_T (the two may not be the same), SIZEOF_POINTER. */ + #undef SIZEOF_VOID_P -/* @@ TODO: redo using SIZEOF_POINTER (see SIZEOF_SIZE_T). */ - -#if defined(_WIN64) || defined(__x86_64__) || defined(__ppc64__) -# define SIZEOF_VOID_P 8 +#ifdef _MSC_VER +/* _WIN64 is defined for both x64 (x86_64) and ARM64 (aarch64). */ +# ifdef _WIN64 +# define SIZEOF_VOID_P 8 +# else +# define SIZEOF_VOID_P 4 +# endif #else -# define SIZEOF_VOID_P 4 +/* Both GCC and Clang (and maybe others) define __SIZEOF_POINTER__. */ +# ifdef __SIZEOF_POINTER__ +# define SIZEOF_VOID_P __SIZEOF_POINTER__ +# endif +#endif + +#ifndef SIZEOF_VOID_P +# error unable to determine size of pointer #endif