Fix: timegm compat on Solaris
[babeltrace.git] / m4 / bt_lib_elfutils.m4
CommitLineData
c9cd7562 1# bt_lib_elfutils.m4 -- Check elfutils version
97e67ce6
JG
2#
3# Copyright (C) 2016 - Jérémie Galarneau <jeremie.galarneau@efficios.com>
4#
5# Permission is hereby granted, free of charge, to any person
6# obtaining a copy of this software and associated documentation files
7# (the "Software"), to deal in the Software without restriction,
8# including without limitation the rights to use, copy, modify, merge,
9# publish, distribute, sublicense, and/or sell copies of the Software,
10# and to permit persons to whom the Software is furnished to do so,
11# subject to the following conditions: The above copyright notice and
12# this permission notice shall be included in all copies or substantial
13# portions of the Software.
14#
15# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22#
23# Check the currently installed version of elfutils by using the
8d53d985
PP
24# `_ELFUTILS_PREREQ` macro defined in <elfutils/version.h>.
25#
26# The cache variable for this test is `bt_cv_lib_elfutils`.
97e67ce6 27#
c9cd7562 28# BT_LIB_ELFUTILS(MAJOR_VERSION, MINOR_VERSION, [ACTION-IF-TRUE], [ACTION-IF-FALSE])
97e67ce6 29# ---------------------------------------------------------------------------
c9cd7562 30AC_DEFUN([BT_LIB_ELFUTILS], [
97e67ce6
JG
31 m4_pushdef([major_version], [$1])
32 m4_pushdef([minor_version], [$2])
11343a40
PP
33 m4_pushdef([true_action], m4_default([$3], [:]))
34 m4_pushdef([false_action], m4_default(
35 [$4], [AC_MSG_ERROR(elfutils >= major_version.minor_version is required)]
36 ))
97e67ce6 37
8d53d985
PP
38 AC_CACHE_CHECK(
39 [for elfutils version >= major_version.minor_version],
40 [bt_cv_lib_elfutils], [
41 AC_RUN_IFELSE([AC_LANG_SOURCE([
42 #include <stdlib.h>
43 #include <elfutils/version.h>
44
45 int main(void) {
46 return _ELFUTILS_PREREQ(major_version, minor_version) ? EXIT_SUCCESS : EXIT_FAILURE;
47 }
48 ])], [bt_cv_lib_elfutils=yes], [bt_cv_lib_elfutils=no])
49 ]
50 )
97e67ce6 51
8d53d985 52 AS_IF([test "x$bt_cv_lib_elfutils" = "xyes"], [true_action], [false_action])
97e67ce6
JG
53
54 m4_popdef([false_action])
55 m4_popdef([true_action])
56 m4_popdef([minor_version])
57 m4_popdef([major_version])
58])
This page took 0.024454 seconds and 4 git commands to generate.