[applied] Better detect suitable libctf version
Commit Message
Hello,
On some el9 distros, the version of libctf installed might not have
all the necessary features for the libabigail CTF reader, leading to
compilation errors due to missing types from the ctf-api.h header
file. For instance, the ctf-api.h on some of those distros lacks the
definition of the type struct ctf_dict_t.
This patch adds a configure test for that struct and disables the CTF
support if that type is absent.
* configure.ac: If the "struct ctf_dict_t" type is not present in
the version of ctf-api.h that is present, then switch the support
of CTF off.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
---
configure.ac | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
@@ -333,6 +333,23 @@ if test x$ENABLE_CTF != xno; then
AC_CHECK_LIB(ctf, ctf_open, [LIBCTF=yes], [LIBCTF=no])
fi
+ if test x$LIBCTF = xyes; then
+ dnl Test if struct btf_enum64 is present.
+ AC_CHECK_TYPE([struct ctf_dict_t],
+ [HAVE_CTF_DICT_T=yes],
+ [HAVE_CTF_DICT_T=no],
+ [#include <ctf-api.h>])
+
+ if test x$HAVE_CTF_DICT_T = xyes; then
+ AC_DEFINE([HAVE_CTF_DICT_T], 1, [struct ctf_dict_t is present])
+ fi
+ fi
+
+ if test x$HAVE_CTF_DICT_T = xno; then
+ AC_MSG_NOTICE([Some needed data structures are missing from ctf-api.h. Disabling CTF support.])
+ LIBCTF=no
+ fi
+
if test x$LIBCTF = xyes; then
AC_MSG_NOTICE([CTF support enabled])
AC_DEFINE([WITH_CTF], 1,
@@ -340,7 +357,7 @@ if test x$ENABLE_CTF != xno; then
CTF_LIBS=-lctf
ENABLE_CTF=yes
else
- AC_MSG_NOTICE([no libctf found, CTF support was disabled])
+ AC_MSG_NOTICE([no suitable libctf found, CTF support was disabled])
ENABLE_CTF=no
fi
fi