]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
build-sys: allow autoconf < 2.64 to be used
authorKir Kolyshkin <kir@openvz.org>
Thu, 3 Sep 2015 00:50:15 +0000 (17:50 -0700)
committerKir Kolyshkin <kir@openvz.org>
Thu, 3 Sep 2015 01:41:52 +0000 (18:41 -0700)
Since commit 50d096a macro m4_ifblank is used, but as it is only
available in autoconf-2.64, on CentOS 6 system we end up with:

> $ ./autogen.sh
> configure:25396: error: possibly undefined macro: m4_ifblank
>       If this token and others are legitimate, please use
> m4_pattern_allow.
>       See the Autoconf documentation.
> [root@kir-ovz2 util-linux]# autoconf --version
> autoconf (GNU Autoconf) 2.63

So, the obvious thing to do would be to raise AC_PREREQ to 2.64
in configure.ac. But, given the facts that
 - autoconf 2.64 is not available for RHEL/CentOS 6,
 - the only need is one small macro,
it's better to just add the missing macro.

While at it, add the m4_ifnblank, too.

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
m4/ul.m4

index fb0dd85b57fc4e7382578e25b7e9b477b12c3fb5..9a0f34bb81da1f3eb82288e6bcda382bb290b99c 100644 (file)
--- a/m4/ul.m4
+++ b/m4/ul.m4
@@ -1,3 +1,29 @@
+dnl If needed, define the m4_ifblank and m4_ifnblank macros from autoconf 2.64
+dnl This allows us to run with earlier Autoconfs as well.
+dnl
+dnl m4_ifblank(COND, [IF-BLANK], [IF-TEXT])
+dnl m4_ifnblank(COND, [IF-TEXT], [IF-BLANK])
+dnl ----------------------------------------
+dnl If COND is empty, or consists only of blanks (space, tab, newline),
+dnl then expand IF-BLANK, otherwise expand IF-TEXT.  This differs from
+dnl m4_ifval only if COND has just whitespace, but it helps optimize in
+dnl spite of users who mistakenly leave trailing space after what they
+dnl thought was an empty argument:
+dnl   macro(
+dnl         []
+dnl        )
+dnl
+dnl Writing one macro in terms of the other causes extra overhead, so
+dnl we inline both definitions.
+ifdef([m4_ifblank],[],[
+m4_define([m4_ifblank],
+[m4_if(m4_translit([[$1]],  [ ][       ][
+]), [], [$2], [$3])])])
+
+ifdef([m4_ifnblank],[],[
+m4_define([m4_ifnblank],
+[m4_if(m4_translit([[$1]],  [ ][       ][
+]), [], [$3], [$2])])])
 
 dnl UL_PKG_STATIC(VARIABLE, MODULES)
 dnl