m4/ax_lib_elfutils.m4: add cache variable
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Wed, 2 Nov 2016 05:40:12 +0000 (01:40 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 26 May 2017 13:34:19 +0000 (09:34 -0400)
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
m4/ax_lib_elfutils.m4

index fcfe06b997176c9f0bb41eaad65ca4ed124ea693..f4fcb0dd098f05bcbcbfba3902568c425c120e2a 100644 (file)
@@ -21,7 +21,9 @@
 # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #
 # Check the currently installed version of elfutils by using the
-# _ELFUTILS_PREREQ macro defined in elfutils/version.h.
+# `_ELFUTILS_PREREQ` macro defined in <elfutils/version.h>.
+#
+# The cache variable for this test is `bt_cv_lib_elfutils`.
 #
 # AX_LIB_ELFUTILS(MAJOR_VERSION, MINOR_VERSION, [ACTION-IF-TRUE], [ACTION-IF-FALSE])
 # ---------------------------------------------------------------------------
@@ -29,7 +31,6 @@ AC_DEFUN([AX_LIB_ELFUTILS], [
        m4_pushdef([major_version], [$1])
        m4_pushdef([minor_version], [$2])
 
-       AC_MSG_CHECKING([for elfutils version >= major_version.minor_version])
        m4_if([$#], 3, [
                m4_pushdef([true_action], [$3])
        ], [
@@ -43,20 +44,21 @@ AC_DEFUN([AX_LIB_ELFUTILS], [
                        AC_MSG_ERROR(elfutils >= major_version.minor_version is required)])
        ])
 
-       AC_RUN_IFELSE([
-               AC_LANG_SOURCE([
-                       #include <stdlib.h>
-                       #include <elfutils/version.h>
+       AC_CACHE_CHECK(
+               [for elfutils version >= major_version.minor_version],
+               [bt_cv_lib_elfutils], [
+                       AC_RUN_IFELSE([AC_LANG_SOURCE([
+                               #include <stdlib.h>
+                               #include <elfutils/version.h>
+
+                               int main(void) {
+                                       return _ELFUTILS_PREREQ(major_version, minor_version) ? EXIT_SUCCESS : EXIT_FAILURE;
+                               }
+                       ])], [bt_cv_lib_elfutils=yes], [bt_cv_lib_elfutils=no])
+               ]
+       )
 
-                       int main(void) {
-                               return _ELFUTILS_PREREQ(major_version, minor_version) ? EXIT_SUCCESS : EXIT_FAILURE;
-                       }
-               ])
-       ],
-               echo yes
-               true_action,
-               echo no
-               false_action)
+       AS_IF([test "x$bt_cv_lib_elfutils" = "xyes"], [true_action], [false_action])
 
        m4_popdef([false_action])
        m4_popdef([true_action])
This page took 0.034241 seconds and 4 git commands to generate.