From: Dodji Seketeli Date: Mon, 9 Jan 2023 17:01:32 +0000 (+0100) Subject: Better detect suitable libctf version X-Git-Tag: upstream/2.3~72 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=554fea5e879127a5de2960dd760e518119fb4408;p=platform%2Fupstream%2Flibabigail.git Better detect suitable libctf version 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 --- diff --git a/configure.ac b/configure.ac index d2896020..d19c2f96 100644 --- a/configure.ac +++ b/configure.ac @@ -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 ]) + + 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