Alt-Acme-Math-XS-CPP
view release on metacpan or search on metacpan
inc/ExtUtils/CppGuess.pm view on Meta::CPAN
extra_compiler_flags
extra_linker_flags
=head2 makemaker_options
Returns the correct options to the C<WriteMakefile> function of
C<ExtUtils::MakeMaker>.
These are:
CCFLAGS
dynamic_lib => { OTHERLDFLAGS => ... }
If you specify the extra compiler or linker flags in the
constructor, they'll be merged into C<CCFLAGS> or
C<OTHERLDFLAGS> respectively.
=head2 is_gcc
Returns true if the detected compiler is in the gcc family.
=head2 is_msvc
Returns true if the detected compiler is in the MS VC family.
=head2 add_extra_compiler_flags
Takes a string as argument that is added to the string of extra compiler
flags.
=head2 add_extra_linker_flags
Takes a string as argument that is added to the string of extra linker
flags.
=head1 AUTHOR
Mattia Barbon <mbarbon@cpan.org>
Steffen Mueller <smueller@cpan.org>
Tobias Leich <froggs@cpan.org>
=head1 COPYRIGHT AND LICENSE
Copyright 2010, 2011 by Mattia Barbon.
This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
=cut
use Config ();
use File::Basename qw();
use Capture::Tiny 'capture_merged';
our $VERSION = '0.07';
sub new {
my( $class, %args ) = @_;
my $self = bless {
cc => $Config::Config{cc},
%args
}, $class;
return $self;
}
sub guess_compiler {
my( $self ) = @_;
return $self->{guess} if $self->{guess};
if( $^O =~ /^mswin/i ) {
$self->_guess_win32() or return();
} else {
$self->_guess_unix() or return();
}
return $self->{guess};
}
sub _get_cflags {
my( $self ) = @_;
$self->guess_compiler || die;
my $cflags = $self->{guess}{extra_cflags};
$cflags .= ' ' . $self->{extra_compiler_flags}
if defined $self->{extra_compiler_flags};
return $cflags;
}
sub _get_lflags {
my( $self ) = @_;
$self->guess_compiler || die;
my $lflags = $self->{guess}{extra_lflags};
$lflags .= ' ' . $self->{extra_linker_flags}
if defined $self->{extra_linker_flags};
return $lflags;
}
sub makemaker_options {
my( $self ) = @_;
my $lflags = $self->_get_lflags;
my $cflags = $self->_get_cflags;
return ( CCFLAGS => $cflags,
dynamic_lib => { OTHERLDFLAGS => $lflags },
);
}
sub module_build_options {
my( $self ) = @_;
my $lflags = $self->_get_lflags;
my $cflags = $self->_get_cflags;
return ( extra_compiler_flags => $cflags,
extra_linker_flags => $lflags,
);
}
( run in 2.249 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )