You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by ma...@apache.org on 2010/01/25 21:10:08 UTC

svn commit: r902964 - /lucene/lucy/trunk/perl/buildlib/Lucy/Build.pm

Author: marvin
Date: Mon Jan 25 20:10:07 2010
New Revision: 902964

URL: http://svn.apache.org/viewvc?rev=902964&view=rev
Log:
Consolidate GCC version grokking code withing Lucy::Build.  Add -D_GNU_SOURCE
to persuade glibc headers to be more liberal.  Add -fno-inline-functions in an
attempt to make the Valgrind suppressions file more portable to different
versions of GCC with differing levels of optimization being performed.

Modified:
    lucene/lucy/trunk/perl/buildlib/Lucy/Build.pm

Modified: lucene/lucy/trunk/perl/buildlib/Lucy/Build.pm
URL: http://svn.apache.org/viewvc/lucene/lucy/trunk/perl/buildlib/Lucy/Build.pm?rev=902964&r1=902963&r2=902964&view=diff
==============================================================================
--- lucene/lucy/trunk/perl/buildlib/Lucy/Build.pm (original)
+++ lucene/lucy/trunk/perl/buildlib/Lucy/Build.pm Mon Jan 25 20:10:07 2010
@@ -48,16 +48,20 @@
 
 sub extra_ccflags {
     my $self          = shift;
-    my $debug_env_var = "LUCY_DEBUG";
+    my $extra_ccflags = defined $ENV{CFLAGS} ? "$ENV{CFLAGS} " : "";
+    my $gcc_version 
+        = $ENV{REAL_GCC_VERSION}
+        || $Config{gccversion}
+        || undef;
+    if ( defined $gcc_version ) {
+        $gcc_version =~ /^(\d+(\.\d+))/
+            or die "Invalid GCC version: $gcc_version";
+        $gcc_version = $1;
+    }
 
-    my $extra_ccflags = "";
-    if ( defined $ENV{$debug_env_var} ) {
-        $extra_ccflags .= "-D$debug_env_var ";
-        # Allow override when Perl was compiled with an older version.
-        my $gcc_version = $ENV{REAL_GCC_VERSION} || $Config{gccversion};
+    if ( defined $ENV{LUCY_DEBUG} ) {
         if ( defined $gcc_version ) {
-            $gcc_version =~ /^(\d+(\.\d+)?)/ or die "no match";
-            $gcc_version = $1;
+            $extra_ccflags .= "-DLUCY_DEBUG ";
             $extra_ccflags .= "-DPERL_GCC_PEDANTIC -std=c99 -pedantic -Wall ";
             $extra_ccflags .= "-Wextra " if $gcc_version >= 3.4;    # correct
             $extra_ccflags .= "-Wno-variadic-macros "
@@ -65,21 +69,25 @@
         }
     }
 
+    if ( $ENV{LUCY_VALGRIND} and defined $gcc_version ) {
+        $extra_ccflags .= "-fno-inline-functions ";
+    }
+
     # Compile as C++ under MSVC.
     if ( $Config{cc} eq 'cl' ) {
         $extra_ccflags .= '/TP ';
     }
-
-    # Tell GCC explicitly to run with C99 compatability.
-    my $gcc_version = $ENV{REAL_GCC_VERSION} || $Config{gccversion};
+    
     if ( defined $gcc_version ) {
-        $gcc_version =~ /^(\d+(\.\d+)?)/ or die "no match";
-        $gcc_version = $1;
+        # Tell GCC explicitly to run with C99 compatability.
         if ($extra_ccflags !~ m/-std=c99/) {
             $extra_ccflags .= "-std=c99 ";
         }  
+        if ($extra_ccflags !~ m/-D_GNU_SOURCE/) {
+            $extra_ccflags .= "-D_GNU_SOURCE ";
+        } 
     }
-
+    
     return $extra_ccflags;
 }