cmake/autotools: Use AC_CHECK_SIZEOF to fix 32bit support

This commit is contained in:
Sebastian Pipping 2021-05-20 15:29:21 +02:00
parent 0ee4a6a94e
commit 09ec4ff9c1
3 changed files with 6 additions and 3 deletions

View File

@ -29,6 +29,7 @@ PACKAGE_STRING
PACKAGE_TARNAME
PACKAGE_URL
PACKAGE_VERSION
SIZEOF_VOID_P
size_t
STDC_HEADERS
VERSION

View File

@ -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()

View File

@ -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