Fix: configure: support Autoconf 2.70
[babeltrace.git] / m4 / ae_lib_elfutils.m4
... / ...
CommitLineData
1# SPDX-License-Identifier: MIT
2#
3# Copyright (C) 2016 Jérémie Galarneau <jeremie.galarneau@efficios.com>
4# Copyright (C) 2020 Michael Jeanson <mjeanson@efficios.com>
5#
6# ae_lib_elfutils.m4 -- Check elfutils version
7#
8# Check the currently installed version of elfutils by using the
9# `_ELFUTILS_PREREQ` macro defined in <elfutils/version.h>.
10#
11# The cache variable for this test is `ae_cv_lib_elfutils`.
12#
13# AE_LIB_ELFUTILS(MAJOR_VERSION, MINOR_VERSION, [ACTION-IF-TRUE], [ACTION-IF-FALSE])
14# ---------------------------------------------------------------------------
15AC_DEFUN([AE_LIB_ELFUTILS], [
16m4_pushdef([major_version], [$1])
17m4_pushdef([minor_version], [$2])
18m4_pushdef([true_action], m4_default([$3], [:]))
19m4_pushdef([false_action], m4_default(
20 [$4], [AC_MSG_ERROR(elfutils >= major_version.minor_version is required)]
21))
22
23AC_CACHE_CHECK(
24 [for elfutils version >= major_version.minor_version],
25 [ae_cv_lib_elfutils], [
26 AC_LANG_PUSH([C])
27 AC_COMPILE_IFELSE(
28 [AC_LANG_SOURCE([
29 #include <elfutils/version.h>
30
31 #if (!_ELFUTILS_PREREQ(][]major_version[][, ][]minor_version[][))
32 #error "elfutils minimum required version not met."
33 #endif
34
35 void main(void) {
36 return;
37 }
38 ])],
39 [ae_cv_lib_elfutils=yes],
40 [ae_cv_lib_elfutils=no]
41 )
42 AC_LANG_POP([C])
43])
44
45AS_IF([test "x$ae_cv_lib_elfutils" = "xyes"], [true_action], [false_action])
46
47m4_popdef([false_action])
48m4_popdef([true_action])
49m4_popdef([minor_version])
50m4_popdef([major_version])
51])
This page took 0.022463 seconds and 4 git commands to generate.