https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79341

--- Comment #9 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
gcc/configure.ac has:
# Determine the version of glibc, if any, used on the target.
AC_MSG_CHECKING([for target glibc version])
AC_ARG_WITH([glibc-version],
  [AS_HELP_STRING([--with-glibc-version=M.N],
    [assume GCC used with glibc version M.N or later])], [
if [echo "$with_glibc_version" | grep '^[0-9][0-9]*\.[0-9][0-9]*$']; then
  glibc_version_major=`echo "$with_glibc_version" | sed -e 's/\..*//'`
  glibc_version_minor=`echo "$with_glibc_version" | sed -e 's/.*\.//'`
else
  AC_MSG_ERROR([option --with-glibc-version requires a version number M.N])
fi], [
glibc_version_major=0
glibc_version_minor=0
[if test -f $target_header_dir/features.h \
  && glibc_version_major_define=`$EGREP '^[     ]*#[    ]*define[      
]+__GLIBC__[    ]+[0-9]' $target_header_dir/features.h` \
  && glibc_version_minor_define=`$EGREP '^[     ]*#[    ]*define[      
]+__GLIBC_MINOR__[      ]+[0-9]' $target_header_dir/features.h`; then
  glibc_version_major=`echo "$glibc_version_major_define" | sed -e
's/.*__GLIBC__[      ]*//'`
  glibc_version_minor=`echo "$glibc_version_minor_define" | sed -e
's/.*__GLIBC_MINOR__[        ]*//'`
fi]])
AC_MSG_RESULT([$glibc_version_major.$glibc_version_minor])
AC_DEFINE_UNQUOTED([TARGET_GLIBC_MAJOR], [$glibc_version_major],
[GNU C Library major version number used on the target, or 0.])
AC_DEFINE_UNQUOTED([TARGET_GLIBC_MINOR], [$glibc_version_minor],
[GNU C Library minor version number used on the target, or 0.])

The problem is that this isn't available in the toplevel configure when
sourcing libsanitizer/configure.tgt to decide easily on UNSUPPORTED.
So we'd have to say supported there and later perhaps change that.

Seems we have already a precedent, libsanitizer/configure.ac has:
AC_MSG_CHECKING([for necessary platform features])
case "$target" in
  *-*-linux*)
    # Some old Linux distributions miss required syscalls.
    sanitizer_supported=no
    AC_TRY_COMPILE([#include <sys/syscall.h>],[
      syscall (__NR_gettid);
      syscall (__NR_futex);
      syscall (__NR_exit_group);
    ], [sanitizer_supported=yes])
    ;;
  *)
    sanitizer_supported=yes
    ;;
esac
AC_MSG_RESULT($sanitizer_supported)
AM_CONDITIONAL(SANITIZER_SUPPORTED, test "$sanitizer_supported" = yes)

so it should then for s390*-*-linux* also test for glibc >= 2.19 using
AC_TRY_COMPILE and preprocessor macros or so?

Reply via email to