The problem is that your pipe always succeeds, because sed
will succeed regardless of what perl does. One approach would be to simply delay the invocation of sed
:
LOC=$( perl -MExtUtils::Embed -e perl_inc )
AS_IF([ test $? != 0 ], [AC_MSG_ERROR([...])])
LOC=$( echo "$LOC" | sed 's/[ \t]*-I//' )
On the other hand, it looks like perl_inc
is 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_MODULES
to see if the desired module is installed.