Dear Perl Monks,
what would be the best way to detect whether a working C compiler is available at build time of a module (i.e., in Makefile.PL)?
I would like to install a (faster) XS version of a module if that is the case, and a (slower) pure-Perl implementation if not.
Remember that C compilers are not always available on all systems. Sometimes they cost heavy extra money, or sometimes you have to work with what's there on a customer's or provider's server (where frequently installing a C compiler is not an option due to company policies).
Thank you!
UPDATE:
In the meantime, I've adopted a mixed approach, using an "Inline"-like search of the PATH (as fallback) and the "have_compiler" method (which actually compiles and links a test file) when "ExtUtils::CBuilder" is available.
Look here: http://cpansearch.perl.org/src/STBEY/Date-Calc-6.1/Makefile.PL
After that, I dropped this approach altogether and went for the usual "wrapper" approach - "Date::Calc" is now (v6.2) a wrapper which tries to load "Date::Calc::XS", and failing that, loads "Date::Calc::PP".
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |