m4 macro and shell redirection

130 views Asked by At

Can m4 macro do redirection output to the variable with shell $(...)? Variable $MANPAGE_DOCBOOK_XSL is empty :(.

if test "x${XMLCATALOG}" != "x" -a "x$have_xmlcatalog_file" = "xyes"; then
    DOCBOOK_XSL_URI="http://docbook.sourceforge.net/release/xsl/current"
    DOCBOOK_XSL_PATH="manpages/docbook.xsl"
    MANPAGE_DOCBOOK_XSL=$(${XMLCATALOG} ${XML_CATALOG_FILE} ${DOCBOOK_XSL_URI}/${DOCBOOK_XSL_PATH} | sed -n 's|^file:/\+|/|p;q')
fi

https://github.com/pevik/ima-evm-utils/blob/master/m4/manpage-docbook-xsl.m4#L22

Looking at similar code in Wayland, they just check whether command works (whether catalog can be found), but not for the value.

https://github.com/wayland-project/wayland/blob/master/configure.ac#L167

1

There are 1 answers

0
pevik On

In the end I found it was wrong sed part (nothing magic in m4 itself). I sent a patch which fixes the software:

https://patchwork.kernel.org/patch/11712861/

-       MANPAGE_DOCBOOK_XSL=$(${XMLCATALOG} ... | sed -n 's|^file:/\+|/|p;q')
+       MANPAGE_DOCBOOK_XSL=$(${XMLCATALOG} ... | sed 's|^file:/\+|/|')

I guess I should delete this question as invalid.