views:

221

answers:

2

When building a Perl module ExtUtils::MakeMaker uses the flags defined in Config.pm (see perldoc Config) for values such as ccflags and ldflags.

How do I override theses values (short of editing the Makefile.PL)?

perl Makefile.PL ldflags=<options>

does not seem to work.

Context: I am trying to compile Term::Readline::Gnu on OS X 10.6. The default OS X perl is a universal binary and thus has ccflags like -arch i386 -arch ppc etc.
On the other hand my version of Gnu Readline (6.0) has been compiled from source for -arch i386 only. As such it does not contain the expected symbols for a module trying to link to it using -arch ppc.

A: 

Information provided in the Hintsfile Support section of the docs might be relevant, although I have not tried it.

Sinan Ünür
+3  A: 

In general, trying to override the settings in Config.pm is an exercise in futility. The more normal reason for wanting to change them is to change the compiler on a machine where Perl was compiled with a non-GNU compiler but you want to use GCC. This is so hard to do that it is by far simpler to rebuild Perl with your chosen compiler, install all the auxilliary modules, and then use build your chosen new module rather than try to fight 'the system'.

You can therefore do one of two things - build your GNU Readline library with the same options that Perl would use, or build your Perl with the options used to build GNU Readline. Trying to bend one to meet the other is not recommended if you value your machine and the hair on your head (please don't hit the machine that hard - it is the software you should be frustrated with, not the hardware; Mac's are nice!).

Of the two options, rebuilding GNU Readline is probably the easier - it is smaller and has fewer add-ons.

Jonathan Leffler