sink.ctf.fs: append error causes where relevant
[babeltrace.git] / m4 / bt_lib_elfutils.m4
CommitLineData
0235b0db 1# SPDX-License-Identifier: MIT
d3298a55 2#
0235b0db 3# Copyright (C) 2016 Jérémie Galarneau <jeremie.galarneau@efficios.com>
d3298a55 4#
0235b0db 5# bt_lib_elfutils.m4 -- Check elfutils version
d3298a55
JG
6#
7# Check the currently installed version of elfutils by using the
ffa3b3ba
PP
8# `_ELFUTILS_PREREQ` macro defined in <elfutils/version.h>.
9#
10# The cache variable for this test is `bt_cv_lib_elfutils`.
d3298a55 11#
b04abc0d 12# BT_LIB_ELFUTILS(MAJOR_VERSION, MINOR_VERSION, [ACTION-IF-TRUE], [ACTION-IF-FALSE])
d3298a55 13# ---------------------------------------------------------------------------
b04abc0d 14AC_DEFUN([BT_LIB_ELFUTILS], [
d3298a55
JG
15 m4_pushdef([major_version], [$1])
16 m4_pushdef([minor_version], [$2])
23f88ce2
PP
17 m4_pushdef([true_action], m4_default([$3], [:]))
18 m4_pushdef([false_action], m4_default(
19 [$4], [AC_MSG_ERROR(elfutils >= major_version.minor_version is required)]
20 ))
d3298a55 21
ffa3b3ba
PP
22 AC_CACHE_CHECK(
23 [for elfutils version >= major_version.minor_version],
24 [bt_cv_lib_elfutils], [
25 AC_RUN_IFELSE([AC_LANG_SOURCE([
26 #include <stdlib.h>
27 #include <elfutils/version.h>
28
29 int main(void) {
30 return _ELFUTILS_PREREQ(major_version, minor_version) ? EXIT_SUCCESS : EXIT_FAILURE;
31 }
32 ])], [bt_cv_lib_elfutils=yes], [bt_cv_lib_elfutils=no])
33 ]
34 )
d3298a55 35
ffa3b3ba 36 AS_IF([test "x$bt_cv_lib_elfutils" = "xyes"], [true_action], [false_action])
d3298a55
JG
37
38 m4_popdef([false_action])
39 m4_popdef([true_action])
40 m4_popdef([minor_version])
41 m4_popdef([major_version])
42])
This page took 0.059883 seconds and 4 git commands to generate.