Philip M. Gollucci wrote: > Philippe M. Chiasson wrote: > >> A better patch might be to first check if we already have that option >> from Perl, >> otherwise, try and figure out if it's safe to add it ourselves. > > Okay, as requested, I've functionalized this and added a check to make sure > $ccopts doesn't already contain this compile flag. > > Index: lib/Apache2/Build.pm > =================================================================== > --- lib/Apache2/Build.pm (revision 234145) > +++ lib/Apache2/Build.pm (working copy) > @@ -523,6 +523,11 @@ > $ccopts .= " $Wall -DAP_DEBUG"; > $ccopts .= " -DAP_HAVE_DESIGNATED_INITIALIZER"; > } > + > + if ($self->has_gcc_version('3.3.2') && > + $ccopts !~ /declaration-after-statement/) { > + $ccopts .= " -Wdeclaration-after-statement"; > + } > } > > if ($self->{MP_COMPAT_1X}) { > @@ -555,6 +560,28 @@ > $ccopts; > } > > +sub has_gcc_version { > + > + my $self = shift; > + my $requested_version = shift; > + > + my $has_version = $self->perl_config('gccversion'); > + > + return 0 unless $has_version;
Isn't "return;" the more canonical way of returning false ? > + my ($has_major, $has_minor, $has_patch) = split /\./, $has_version, 3; > + my ($r_major, $r_minor, $r_patch) = split /\./, $requested_version, 3; Minor nit, but wouldn't my @tuples = split /\./, $has_version; my @r_tuples = split /\./, $requested_version; return cmp_tuples([EMAIL PROTECTED], [EMAIL PROTECTED]) == 1; sub cmp_tuples { my ($a, $b) = @_; while(@$a && @$b) { my $cmp = shift @$a <=> shift @$b; return $cmp if $cmp; } return @$a <=> @$b; } Be a more generic approach that would also work if there is ever a gcc-4.0.0.1 and could possibly be used to refactor some more version comparaisons ? > + if ($has_major > $r_major || > + ($has_major == $r_major && $has_minor > $r_minor) || > + ($has_major == $r_major && $has_minor == $r_minor > + && $has_patch >= $r_patch)) { > + return 1; > + } > + else { > + return 0; > + } > +} > + > sub perl_ccopts { > my $self = shift; -------------------------------------------------------------------------------- Philippe M. Chiasson m/gozer\@(apache|cpan|ectoplasm)\.org/ GPG KeyID : 88C3A5A5 http://gozer.ectoplasm.org/ F9BF E0C2 480E 7680 1AE5 3631 CB32 A107 88C3A5A5
signature.asc
Description: OpenPGP digital signature