From 09ec4ff9c14d1859f57efcb1303d666c8232d7a9 Mon Sep 17 00:00:00 2001 From: Sebastian Pipping Date: Thu, 20 May 2021 15:29:21 +0200 Subject: [PATCH] cmake/autotools: Use AC_CHECK_SIZEOF to fix 32bit support --- .github/workflows/data/expat_config_h_in__expected.txt | 1 + expat/cmake/autotools/expat-config-version.cmake.in | 6 +++--- expat/configure.ac | 2 ++ 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/data/expat_config_h_in__expected.txt b/.github/workflows/data/expat_config_h_in__expected.txt index 3c23e8fc..56f66137 100644 --- a/.github/workflows/data/expat_config_h_in__expected.txt +++ b/.github/workflows/data/expat_config_h_in__expected.txt @@ -29,6 +29,7 @@ PACKAGE_STRING PACKAGE_TARNAME PACKAGE_URL PACKAGE_VERSION +SIZEOF_VOID_P size_t STDC_HEADERS VERSION diff --git a/expat/cmake/autotools/expat-config-version.cmake.in b/expat/cmake/autotools/expat-config-version.cmake.in index 798d861d..5b296752 100644 --- a/expat/cmake/autotools/expat-config-version.cmake.in +++ b/expat/cmake/autotools/expat-config-version.cmake.in @@ -55,13 +55,13 @@ if("FALSE") endif() # if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it: -if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "8" STREQUAL "") +if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "@ac_cv_sizeof_void_p@" STREQUAL "") return() endif() # check that the installed version has the same 32/64bit-ness as the one which is currently searching: -if(NOT CMAKE_SIZEOF_VOID_P STREQUAL "8") - math(EXPR installedBits "8 * 8") +if(NOT CMAKE_SIZEOF_VOID_P STREQUAL "@ac_cv_sizeof_void_p@") + math(EXPR installedBits "@ac_cv_sizeof_void_p@ * 8") set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)") set(PACKAGE_VERSION_UNSUITABLE TRUE) endif() diff --git a/expat/configure.ac b/expat/configure.ac index 7d60a2c2..6ba69a2e 100644 --- a/expat/configure.ac +++ b/expat/configure.ac @@ -372,6 +372,7 @@ LIBDIR_BASENAME="$(basename "${libdir}")" SO_MAJOR="$(expr "${LIBCURRENT}" - "${LIBAGE}")" SO_MINOR="${LIBAGE}" SO_PATCH="${LIBREVISION}" +AC_CHECK_SIZEOF([void *]) # sets ac_cv_sizeof_void_p AC_SUBST([EXPAT_ATTR_INFO]) AC_SUBST([EXPAT_DTD]) AC_SUBST([EXPAT_LARGE_SIZE]) @@ -384,6 +385,7 @@ AC_SUBST([LIBDIR_BASENAME]) AC_SUBST([SO_MAJOR]) AC_SUBST([SO_MINOR]) AC_SUBST([SO_PATCH]) +AC_SUBST([ac_cv_sizeof_void_p]) dnl write the Automake flags we set