How do I get Perl MakeMaker to change the default value for CFLAGS that it inserts into Makefiles? Based on this post, I tried this:
export CFLAGS=...
then inside cpan, I confirmed it with
! print $ENV{CFLAGS}
but it still uses whatever CFLAGS Perl was built with.
I looked in lib/perl/.../Config.pm as suggested by this post but CFLAGS doesn't appear to be set there.
I have a related question that got answered: How to tell CPAN about path to make and cc
I made a little headway in CPAN/Config.pm
'makepl_arg' => q[ CCFLAGS="-D_REENTRANT -O2 -m32 -I/opt/csw/bdb48/include -I/opt/csw/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -m32 -DVERSION=\"1.616\" -DXS_VERSION=\"1.616\" -fPIC -I/opt/csw/lib/perl/5.10.1/CORE"],
but this only appends the value to whatever was already in CFLAGS, which gcc doesn't understand (like "-x03" and "-KPIC").
I have successfully modified /opt/csw/lib/perl/5.10.1/Config_heavy.pl so that MakeMaker can generate Makefiles that will work on a solaris system under OpenCSW.
Others who are having similar problems may download it here: https://gist.github.com/1569718
I have also posted this back to maintainers at opencsw.org so that they will hopefully update the OpenCSW release of Perl. I noted in my post that the right way to do this is to rebuild Perl entirely with tools belonging to the OpenCSW distro, because I believe that this file gets generated automatically by other scripts when any given Perl distro is built (although I haven't verified how it actually gets built). This patched file is merely an expedient so that I could get my work done, which is under a deadline.
I would have greatly preferred to accomplish my goal by modifying settings in CPAN/Config.pm. This worked for setting the correct paths to gcc and gmake, but not for changing the command-line flags to gcc, because CPAN would append these flags to the previously set argument string. gcc would quit after encountering those flags, some of which were incompatible (e.g. "-xO3" and "-KPIC").
For the record, CSWperl 5.10.1,REV=2011.01.15 is the current release of Perl from CSW that I have installed from OpenCSW.
Hope this may help someone else.