configure: Fix libc version check

Desktop / LibreOffice - Ismael Luceno [iodev.co.uk] - 5 October 2021 08:40 UTC

Testing for gnu_get_libc_version isn't quite right (available before 2.1), and the feature macros were already present.

The new test at least will fail for glibc < 2.1, but will pass on non-glibc systems.

The buildsystem should be actually checking for some sort of compliance barrier instead, but this is a start.

###

diff --git a/configure.ac b/configure.ac
index 0dcd4f283330..c0713a64df5a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -11327,15 +11327,13 @@ dnl ***************************************
dnl testing libc version for Linux...
dnl ***************************************
if test "$_os" = "Linux"; then
- AC_MSG_CHECKING([whether libc is >= 2.1.1])
- exec 6>/dev/null # no output
- AC_CHECK_LIB(c, gnu_get_libc_version, HAVE_LIBC=yes; export HAVE_LIBC)
- exec 6>&1 # output on again
- if test "$HAVE_LIBC"; then
- AC_MSG_RESULT([yes])
- else
- AC_MSG_ERROR([no, upgrade libc])
- fi
+ AC_MSG_CHECKING([whether the libc is recent enough])
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+ #include
+ #if defined(__GNU_LIBRARY__) && (__GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 1))
+ #error glibc >= 2.1 is required
+ #endif
+ ]])],, [AC_MSG_RESULT([yes])], [AC_MSG_ERROR([no, upgrade libc])])
fi

dnl =========================================

19d85ff18f3f configure: Fix libc version check
configure.ac | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)

Upstream: cgit.freedesktop.org


  • Share