I would like to run a shell command during the configure process- if the return value of this operation is 0, I would like to use it. Otherwise, I want to exit with error message.
I wrote something like this:
LOC=$(perl -MExtUtils::Embed -e perl_inc | sed 's/[ \t]*-I//')
RC=$?
AS_IF([ test $RC != 0 ], [AC_MSG_ERROR([Can't find module MExtUtils::Embed in perl. Try installing perl 5.8.8 or above])],)
This won’t work. RC always get the value 0, even when the command fails.
Does anyone knows how to do it right?
Thanks
The problem is that your pipe always succeeds, because
sedwill succeed regardless of what perl does. One approach would be to simply delay the invocation ofsed:On the other hand, it looks like
perl_incis commands to perl rather than the name of a file, so it might be easier to simply add the substitution from sed into your perl.On the third hand, you should probably just use
AX_PROG_PERL_MODULESto see if the desired module is installed.