I’m new to m4 and am trying to set up a macro which allows the user to specify the location of a library at configure-time ./configure --with-mylib=/path/to/lib.so.
In the m4 macro using AC_ARG_WITH, I’ll check that the given file actually exists, and then store the path to said lib. MYLIB_PATH=esyscmd([dirname $withval]). This produces the error:
dirname: missing operand
The shell doesn’t seem to know about $withval. How do I get it through to execute this command?
Thanks,
Andrew
That’s because
esyscmdis executed bym4when generating yourconfigurescript, i.e. at “compile time”. Useinstead.
Note that
$withval“is actually just the value of the shell variable namedwith_package, with any non-alphanumeric characters in package changed into_“, so all occurrences of/will be removed and it will likely not be a valid path.