perl-modperl-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From steve...@apache.org
Subject svn commit: r1733566 - in /perl/modperl/trunk: README lib/Apache2/Build.pm
Date Fri, 04 Mar 2016 08:36:08 GMT
Author: stevehay
Date: Fri Mar  4 08:36:07 2016
New Revision: 1733566

URL: http://svn.apache.org/viewvc?rev=1733566&view=rev
Log:
Automatic compiler flags for gcc 5 and clang

To make compilation easier on gcc5/clang hosts, this patch automatically selects the appropriate
c89 option, when modperl is being built with either gcc 5 or clang.

Tested by the author on Ubuntu 15.10 (with gcc 5.2.1), Fedora 23 (with gcc 5.3.1) and FreeBSD
10.2 (with clang).

Thanks to Klaus S. Madsen <ksm@jobindex.dk> for the patch.

Modified:
    perl/modperl/trunk/README
    perl/modperl/trunk/lib/Apache2/Build.pm

Modified: perl/modperl/trunk/README
URL: http://svn.apache.org/viewvc/perl/modperl/trunk/README?rev=1733566&r1=1733565&r2=1733566&view=diff
==============================================================================
--- perl/modperl/trunk/README (original)
+++ perl/modperl/trunk/README Fri Mar  4 08:36:07 2016
@@ -25,14 +25,6 @@ Perl:
   configurations) are currently believed to work, but this is not
   guaranteed to be the case, either now or in the future.
 
-C compiler:
-  The mod_perl source currently uses GNU89 inline semantics on GCC, but
-  GCC 5 defaults to newer C99 semantics.  If you see MP_INLINE related
-  warnings during the build and missing symbols when starting the test
-  suite, adding "-fgnu89-inline" to MP_CCOPTS may help.
-  There are also some reports of this happening with the Clang compiler,
-  where the corresponding option to try is "-std=gnu89".
-
 *** Status ***
 
 mod_perl is currently considered stable.

Modified: perl/modperl/trunk/lib/Apache2/Build.pm
URL: http://svn.apache.org/viewvc/perl/modperl/trunk/lib/Apache2/Build.pm?rev=1733566&r1=1733565&r2=1733566&view=diff
==============================================================================
--- perl/modperl/trunk/lib/Apache2/Build.pm (original)
+++ perl/modperl/trunk/lib/Apache2/Build.pm Fri Mar  4 08:36:07 2016
@@ -611,6 +611,14 @@ sub ap_ccopts {
         $ccopts .= " -DMP_TRACE";
     }
 
+    if ($self->has_gcc_version('5.0.0') && $ccopts !~ /-fgnu89-inline/) {
+        $ccopts .= " -fgnu89-inline";
+    }
+
+    if ($self->has_clang && $ccopts !~ /-std=gnu89/) {
+        $ccopts .= " -std=gnu89";
+    }
+
     # make sure apr.h can be safely included
     # for example Perl's included -D_GNU_SOURCE implies
     # -D_LARGEFILE64_SOURCE on linux, but this won't happen on
@@ -641,6 +649,16 @@ sub has_gcc_version {
     return cmp_tuples(\@tuples, \@r_tuples) == 1;
 }
 
+sub has_clang {
+    my $self = shift;
+
+    my $has_version = $self->perl_config('gccversion');
+
+    return 0 unless $has_version;
+
+    return $has_version =~ m/Clang/;
+}
+
 sub cmp_tuples {
     my ($num_a, $num_b) = @_;
 



Mime
View raw message