Given that I’m using Module::Build to build my perl module, I’d like to test for specific system library prerequisites in my Build.PL and exit with an error if they are not found. This seems like the best way to ensure that the necessary prerequisites will be met when the compiler is called. I could just let the compilation fail when it links, but I think detecting prior to building is better. It’s probably a matter of just searching the same lib directories that the build system will use when compiling, but I’m hoping there is some functionality in Module::Build that could help figure this out.
To be specific, in my case I want to verify that libicu is installed and available in the libpath used by the compiler.
It sounds like you’re looking for Devel::CheckLib. (There’s also ExtUtils::PkgConfig for libraries that use
pkg-configto report configuration details.)BTW, the standard way for Build.PL to report that a non-Perl-module prerequisite is not available is for it to print a message explaining what’s missing and then
exit 0without callingcreate_build_script. Devel::CheckLib provides acheck_lib_or_exitfunction for doing that.