M4 - shell command execution

I am new to m4 and am trying to set up a macro that allows the user to specify the location of the library in configure mode ./configure --with-mylib=/path/to/lib.so.

In the m4 macro, with help, AC_ARG_WITHI check if the given file really exists, and then save the path to the specified lib. MYLIB_PATH=esyscmd([dirname $withval]). This causes an error:

dirname: missing operand

The shell does not know about $withval. How to execute it to execute this command?

Thank,

Andrew

+3
source share
1 answer

This is because it esyscmdis executed m4when the configurescript is created, i.e. at compile time. Use

MYLIB_PATH=`dirname $with_mylib`

instead.

, $withval " with_package, - _", / , , .

+3

Source: https://habr.com/ru/post/1784121/


All Articles