m4/ax_lib_elfutils.m4: use m4_default() for optional args.
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Wed, 2 Nov 2016 05:41:13 +0000 (01:41 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 26 May 2017 13:34:27 +0000 (09:34 -0400)
The current macro code does not work because, if you provide 4
arguments to the macro, then `true_action` is not defined (but
it should be: it's the third argument).

Use m4_default() here to expand to a default value if the
argument does not exist.

Also use [:] instead of [] (good practice, safer for shells).

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
configure.ac
m4/ax_lib_elfutils.m4

index d7c458056fd7d36553f8ccdab217d08fb350271d..22b5d5d93bf55ebed8f4a354be6fb8112272afe4 100644 (file)
@@ -274,7 +274,7 @@ AS_IF([test "x$_enable_debug_info" = xyes], [
            # Check if libelf and libdw are present
            AC_CHECK_LIB([elf], [elf_version], [], [AC_MSG_ERROR(Missing libelf (from elfutils >= 0.154) which is required by debug info. You can disable this feature using --disable-debug-info.)])
            AC_CHECK_LIB([dw], [dwarf_begin], [], [AC_MSG_ERROR(Missing libdw (from elfutils >= 0.154) which is required by debug info. You can disable this feature using --disable-debug-info.)])
            # Check if libelf and libdw are present
            AC_CHECK_LIB([elf], [elf_version], [], [AC_MSG_ERROR(Missing libelf (from elfutils >= 0.154) which is required by debug info. You can disable this feature using --disable-debug-info.)])
            AC_CHECK_LIB([dw], [dwarf_begin], [], [AC_MSG_ERROR(Missing libdw (from elfutils >= 0.154) which is required by debug info. You can disable this feature using --disable-debug-info.)])
-           AX_LIB_ELFUTILS([0], [154], [], [AC_MSG_ERROR(elfutils >= 0.154 is required to use the debug info feature. You can disable this feature using --disable-debug-info.)])
+           AX_LIB_ELFUTILS([0], [154], [:], [AC_MSG_ERROR(elfutils >= 0.154 is required to use the debug info feature. You can disable this feature using --disable-debug-info.)])
             AC_DEFINE([ENABLE_DEBUG_INFO], [1], [Define to 1 if you enable the 'debug info' feature])
 ], [])
 
             AC_DEFINE([ENABLE_DEBUG_INFO], [1], [Define to 1 if you enable the 'debug info' feature])
 ], [])
 
index f4fcb0dd098f05bcbcbfba3902568c425c120e2a..5cefc748bf14a06a545533ebe2bd15f919c003a5 100644 (file)
 AC_DEFUN([AX_LIB_ELFUTILS], [
        m4_pushdef([major_version], [$1])
        m4_pushdef([minor_version], [$2])
 AC_DEFUN([AX_LIB_ELFUTILS], [
        m4_pushdef([major_version], [$1])
        m4_pushdef([minor_version], [$2])
-
-       m4_if([$#], 3, [
-               m4_pushdef([true_action], [$3])
-       ], [
-               m4_pushdef([true_action], [])
-       ])
-
-       m4_if([$#], 4, [
-               m4_pushdef([false_action], [$4])
-       ], [
-               m4_pushdef([false_action], [
-                       AC_MSG_ERROR(elfutils >= major_version.minor_version is required)])
-       ])
+       m4_pushdef([true_action], m4_default([$3], [:]))
+       m4_pushdef([false_action], m4_default(
+               [$4], [AC_MSG_ERROR(elfutils >= major_version.minor_version is required)]
+       ))
 
        AC_CACHE_CHECK(
                [for elfutils version >= major_version.minor_version],
 
        AC_CACHE_CHECK(
                [for elfutils version >= major_version.minor_version],
This page took 0.026069 seconds and 4 git commands to generate.