On Wed, 30 Jan 2008, Robert May wrote: > So, in the meantime, can anyone suggest a mechanism for testing > whether the perl that is running my Makefile.PL was compiled with a > Microsoft compiler, given that if gcc is being used the Config.pm > values will already have been re-set (with ExtUtils::FakeConfig, > ActivePerl::Config, or similar). > > I can't just blindly add -mms-bitfields' if the compiler is gcc, as > that would break compatibility with gcc-built perls (Strawberry perl > ...), and I don't only want to find ActiveState Perl builds - and I > need it to work back to 5.6.1 > > Or am I stuck with putting a big warning in the README (which won't > stop the bug reports). I don't understand why you need to do this at all; you should just rely on the $Config{ccflags} value. Or are you just creating a workaround for the already released ActivePerl 1001/1002? In that case you can just explicitly test for it: if (defined &Win32::BuildNumber) { } I doubt that there are any other configurations out there where someone builds their own Perl with VC++ and then tries to install modules with GCC using ExtUtils::FakeConfig. The combination of ActivePerl and ExtUtils::FakeConfig should be covered by the test above too. If you want make sure you also catch any instance where somebody uses the ActivePerl sources and builds them with GCC (thereby adding Win32::BuildNumber() as well), then you can use something like this: use Config qw(%Config); my $cc = $Config{cc}; if (defined &ActivePerl::Config::_orig_conf) { $cc = ActivePerl::Config::_orig_conf('cc'); } I dislike this one though, as it calls a private function, so maybe something like use Config qw(%Config); my $cc = $Config{cc}; $cc = "cl" if defined %ActivePerl::Config::; Maybe the most general solution would be: my $cc; for my $file (qw(Config_heavy.pl Config.pm)) { my $fullname = "$Config{privlib}/$file"; open(my $fh, "<", $fullname) or die "Can't read $fullname: $!\n"; while (<$fh>) { $cc = $1, last if /^cc='(.*)'/; } last if defined $cc; } This of course will still fail if someone builds with VC++ and then manually patches Config_heavy.pl instead of overriding it programmatically, but those people should be on their own anyways. :) Cheers, -JanThread Previous | Thread Next