1 From 697ab0905c59561562dc52cd3b925781e07814f3 Mon Sep 17 00:00:00 2001
2 From: Philippe Proulx <eeppeliteloop@gmail.com>
3 Date: Wed, 2 Nov 2016 01:40:12 -0400
4 Subject: [PATCH] m4/ax_lib_elfutils.m4: add cache variable
6 This patch adds an autoconf cache variable to override the
7 AC_RUN_IFELSE() test result when cross-compiling.
9 Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
10 [Philippe: grabbed from this pull request:
11 https://github.com/efficios/babeltrace/pull/52
14 m4/ax_lib_elfutils.m4 | 32 +++++++++++++++++---------------
15 1 file changed, 17 insertions(+), 15 deletions(-)
17 diff --git a/m4/ax_lib_elfutils.m4 b/m4/ax_lib_elfutils.m4
18 index fcfe06b..f4fcb0d 100644
19 --- a/m4/ax_lib_elfutils.m4
20 +++ b/m4/ax_lib_elfutils.m4
22 # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 # Check the currently installed version of elfutils by using the
25 -# _ELFUTILS_PREREQ macro defined in elfutils/version.h.
26 +# `_ELFUTILS_PREREQ` macro defined in <elfutils/version.h>.
28 +# The cache variable for this test is `bt_cv_lib_elfutils`.
30 # AX_LIB_ELFUTILS(MAJOR_VERSION, MINOR_VERSION, [ACTION-IF-TRUE], [ACTION-IF-FALSE])
31 # ---------------------------------------------------------------------------
32 @@ -29,7 +31,6 @@ AC_DEFUN([AX_LIB_ELFUTILS], [
33 m4_pushdef([major_version], [$1])
34 m4_pushdef([minor_version], [$2])
36 - AC_MSG_CHECKING([for elfutils version >= major_version.minor_version])
38 m4_pushdef([true_action], [$3])
40 @@ -43,20 +44,21 @@ AC_DEFUN([AX_LIB_ELFUTILS], [
41 AC_MSG_ERROR(elfutils >= major_version.minor_version is required)])
47 - #include <elfutils/version.h>
49 + [for elfutils version >= major_version.minor_version],
50 + [bt_cv_lib_elfutils], [
51 + AC_RUN_IFELSE([AC_LANG_SOURCE([
53 + #include <elfutils/version.h>
56 + return _ELFUTILS_PREREQ(major_version, minor_version) ? EXIT_SUCCESS : EXIT_FAILURE;
58 + ])], [bt_cv_lib_elfutils=yes], [bt_cv_lib_elfutils=no])
63 - return _ELFUTILS_PREREQ(major_version, minor_version) ? EXIT_SUCCESS : EXIT_FAILURE;
71 + AS_IF([test "x$bt_cv_lib_elfutils" = "xyes"], [true_action], [false_action])
73 m4_popdef([false_action])
74 m4_popdef([true_action])