1 # SPDX-License-Identifier: MIT
3 # Copyright (C) 2016 Jérémie Galarneau <jeremie.galarneau@efficios.com>
4 # Copyright (C) 2020 Michael Jeanson <mjeanson@efficios.com>
6 # ae_lib_elfutils.m4 -- Check elfutils version
8 # Check the currently installed version of elfutils by using the
9 # `_ELFUTILS_PREREQ` macro defined in <elfutils/version.h>.
11 # The cache variable for this test is `ae_cv_lib_elfutils`.
13 # AE_LIB_ELFUTILS(MAJOR_VERSION, MINOR_VERSION, [ACTION-IF-TRUE], [ACTION-IF-FALSE])
14 # ---------------------------------------------------------------------------
15 AC_DEFUN([AE_LIB_ELFUTILS], [
16 m4_pushdef([major_version], [$1])
17 m4_pushdef([minor_version], [$2])
18 m4_pushdef([true_action], m4_default([$3], [:]))
19 m4_pushdef([false_action], m4_default(
20 [$4], [AC_MSG_ERROR(elfutils >= major_version.minor_version is required)]
24 [for elfutils version >= major_version.minor_version],
25 [ae_cv_lib_elfutils], [
29 #include <elfutils/version.h>
31 #if (!_ELFUTILS_PREREQ(][]major_version[][, ][]minor_version[][))
32 #error "elfutils minimum required version not met."
39 [ae_cv_lib_elfutils=yes],
40 [ae_cv_lib_elfutils=no]
45 AS_IF([test "x$ae_cv_lib_elfutils" = "xyes"], [true_action], [false_action])
47 m4_popdef([false_action])
48 m4_popdef([true_action])
49 m4_popdef([minor_version])
50 m4_popdef([major_version])