Re: [Module::Build] [PATCH] have_c_compiler() die's if there is no C compiler
Status: Beta
Brought to you by:
kwilliams
|
From: Ken W. <ke...@ma...> - 2006-02-27 03:47:08
|
Hi John,
Thanks for the patch - I actually just committed a different patch
with essentially the same effect, but instead of using eval{} it just
doesn't throw the exception in the first place. That exception
should be thrown in compile_c() and link_c(), not in _cbuilder().
-Ken
On Feb 19, 2006, at 10:53 AM, John Peacock wrote:
> This should have the correct behavior on machines without any C
> compiler at all:
>
> === lib/Module/Build/Base.pm
> ==================================================================
> --- lib/Module/Build/Base.pm (revision 1834)
> +++ lib/Module/Build/Base.pm (local)
> @@ -3497,7 +3497,8 @@
> return $p->{have_compiler} if defined $p->{have_compiler};
>
> $self->log_verbose("Checking if compiler tools configured... ");
> - my $have = $self->_cbuilder->have_compiler;
> + my $have = eval { $self->_cbuilder->have_compiler };
> + $have = 0 if $@; # no compiler support possible
> $self->log_verbose($have ? "ok.\n" : "failed.\n");
> return $p->{have_compiler} = $have;
> }
>
> It's kind of not fair to provide a function testing whether there
> is an
> effective C compiler available and then die if there isn't (and no
> fallback
> either). :(
|