Reputation: 2094
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.
Upvotes: 2
Views: 124
Reputation: 8542
My usual approach is to use ExtUtils::PkgConfig if it's a pkg-config
based library, or ExtUtils::CChecker to check for more difficult things, such as older libraries that don't use pkg-config
, or more subtle OS features and abilities.
Upvotes: 0
Reputation: 62109
It sounds like you're looking for Devel::CheckLib. (There's also ExtUtils::PkgConfig for libraries that use pkg-config
to 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 0
without calling create_build_script
. Devel::CheckLib provides a check_lib_or_exit
function for doing that.
Upvotes: 5