[svn:parrot] r47170 - in branches/tt1452_configure_debug: config/auto config/gen config/init config/inter lib/Parrot

jkeenan at svn.parrot.org jkeenan at svn.parrot.org
Sun May 30 21:21:32 UTC 2010


Author: jkeenan
Date: Sun May 30 21:21:31 2010
New Revision: 47170
URL: https://trac.parrot.org/parrot/changeset/47170

Log:
Begin to implement Parrot::Configure::debug().

Modified:
   branches/tt1452_configure_debug/config/auto/arch.pm
   branches/tt1452_configure_debug/config/auto/attributes.pm
   branches/tt1452_configure_debug/config/auto/cpu.pm
   branches/tt1452_configure_debug/config/auto/ctags.pm
   branches/tt1452_configure_debug/config/auto/env.pm
   branches/tt1452_configure_debug/config/auto/gc.pm
   branches/tt1452_configure_debug/config/auto/gcc.pm
   branches/tt1452_configure_debug/config/auto/gettext.pm
   branches/tt1452_configure_debug/config/auto/gmp.pm
   branches/tt1452_configure_debug/config/auto/headers.pm
   branches/tt1452_configure_debug/config/auto/icu.pm
   branches/tt1452_configure_debug/config/auto/inline.pm
   branches/tt1452_configure_debug/config/auto/msvc.pm
   branches/tt1452_configure_debug/config/auto/opengl.pm
   branches/tt1452_configure_debug/config/auto/pcre.pm
   branches/tt1452_configure_debug/config/auto/readline.pm
   branches/tt1452_configure_debug/config/auto/signal.pm
   branches/tt1452_configure_debug/config/auto/snprintf.pm
   branches/tt1452_configure_debug/config/auto/thread.pm
   branches/tt1452_configure_debug/config/auto/warnings.pm
   branches/tt1452_configure_debug/config/auto/zlib.pm
   branches/tt1452_configure_debug/config/gen/platform.pm
   branches/tt1452_configure_debug/config/init/hints.pm
   branches/tt1452_configure_debug/config/init/optimize.pm
   branches/tt1452_configure_debug/config/inter/progs.pm
   branches/tt1452_configure_debug/lib/Parrot/Configure.pm

Modified: branches/tt1452_configure_debug/config/auto/arch.pm
==============================================================================
--- branches/tt1452_configure_debug/config/auto/arch.pm	Sun May 30 21:06:38 2010	(r47169)
+++ branches/tt1452_configure_debug/config/auto/arch.pm	Sun May 30 21:21:31 2010	(r47170)
@@ -42,8 +42,7 @@
 sub runstep {
     my ( $self, $conf ) = @_;
 
-    my $verbose = $conf->options->get('verbose');
-    $verbose and print "\n";
+    $conf->debug("\n");
 
     my $archname = $conf->data->get('archname');
     # This was added to convert IA64.ARCHREV_0 on HP-UX, TT #645, TT #653
@@ -51,10 +50,10 @@
     my ( $cpuarch, $osname ) = split( /-/, $archname );
 
 
-    if ($verbose) {
-        print "determining operating system and cpu architecture\n";
-        print "archname: $archname\n";
-    }
+    $conf->debug(
+        "determining operating system and cpu architecture\n",
+        "archname: $archname\n")
+    ;
 
     if ( !defined $osname ) {
         ( $osname, $cpuarch ) = ( $cpuarch, q{} );
@@ -127,12 +126,11 @@
 
 sub _report_verbose {
     my ($conf) = @_;
-    my $verbose = $conf->options->get( 'verbose' );
-    if ( $verbose ) {
-        print "osname:   ", $conf->data->get('osname'), "\n";
-        print "cpuarch:  ", $conf->data->get('cpuarch'), "\n";
-        print "platform: ", $conf->data->get('platform'), "\n";
-    }
+    $conf->debug(
+        "osname:   ", $conf->data->get('osname'), "\n",
+        "cpuarch:  ", $conf->data->get('cpuarch'), "\n",
+        "platform: ", $conf->data->get('platform'), "\n",
+    );
     return 1;
 }
 

Modified: branches/tt1452_configure_debug/config/auto/attributes.pm
==============================================================================
--- branches/tt1452_configure_debug/config/auto/attributes.pm	Sun May 30 21:06:38 2010	(r47169)
+++ branches/tt1452_configure_debug/config/auto/attributes.pm	Sun May 30 21:21:31 2010	(r47170)
@@ -49,21 +49,20 @@
 sub runstep {
     my ( $self, $conf ) = @_;
 
-    my $verbose = $conf->options->get('verbose');
-    print "\n" if $verbose;
+    $conf->debug("\n");
 
     for my $maybe_attr (@potential_attributes) {
-        $self->try_attr( $conf, $maybe_attr, $verbose );
+        $self->try_attr( $conf, $maybe_attr);
     }
     return 1;
 }
 
 sub try_attr {
-    my ( $self, $conf, $attr, $verbose ) = @_;
+    my ( $self, $conf, $attr ) = @_;
 
     my $output_file = 'test.cco';
 
-    $verbose and print "trying attribute '$attr'\n";
+    $conf->debug("trying attribute '$attr'\n");
 
     my $cc = $conf->option_or_data('cc');
     $conf->cc_gen('config/auto/attributes/test_c.in');
@@ -79,29 +78,29 @@
     my $tryflags = "$ccflags -D$attr $disable_warnings";
 
     my $command_line = Parrot::Configure::Utils::_build_compile_command( $cc, $tryflags );
-    $verbose and print "  ", $command_line, "\n";
+    $conf->debug("  ", $command_line, "\n");
 
     # Don't use cc_build, because failure is expected.
     my $exit_code =
         Parrot::Configure::Utils::_run_command( $command_line, $output_file, $output_file );
-    $verbose and print "  exit code: $exit_code\n";
+    $conf->debug("  exit code: $exit_code\n");
 
     $conf->cc_clean();
     $conf->data->set( $attr => !$exit_code | 0 );
 
     if ($exit_code) {
         unlink $output_file or die "Unable to unlink $output_file: $!";
-        $verbose and print "Rejecting bogus attribute:  $attr\n";
+        $conf->debug("Rejecting bogus attribute:  $attr\n");
         return;
     }
 
     my $output = Parrot::BuildUtil::slurp_file($output_file);
-    $verbose and print "  output: $output\n";
+    $conf->debug("  output: $output\n");
 
     if ( $output !~ /error|warning/i ) {
         $conf->data->set( ccflags => $tryflags );
         my $ccflags = $conf->data->get("ccflags");
-        $verbose and print "  ccflags: $ccflags\n";
+        $conf->debug("  ccflags: $ccflags\n");
     }
     unlink $output_file or die "Unable to unlink $output_file: $!";
 

Modified: branches/tt1452_configure_debug/config/auto/cpu.pm
==============================================================================
--- branches/tt1452_configure_debug/config/auto/cpu.pm	Sun May 30 21:06:38 2010	(r47169)
+++ branches/tt1452_configure_debug/config/auto/cpu.pm	Sun May 30 21:21:31 2010	(r47170)
@@ -32,20 +32,18 @@
 sub runstep {
     my ( $self, $conf ) = @_;
 
-    my $verbose = $conf->options->get('verbose');
-
     $conf->data->add( ' ', TEMP_atomic_o => '' );    # assure a default
 
     my $hints = "auto::cpu::" . $conf->data->get('cpuarch') . "::auto";
 
-    print "\t(cpu hints = '$hints') " if $verbose;
+    $conf->debug("\t(cpu hints = '$hints') ");
 
     eval "use $hints";
     unless ($@) {
         $hints->runstep( $conf, @_ );
     }
     else {
-        print "(no cpu specific hints)" if $verbose;
+        $conf->debug("(no cpu specific hints)");
     }
 
     return 1;

Modified: branches/tt1452_configure_debug/config/auto/ctags.pm
==============================================================================
--- branches/tt1452_configure_debug/config/auto/ctags.pm	Sun May 30 21:06:38 2010	(r47169)
+++ branches/tt1452_configure_debug/config/auto/ctags.pm	Sun May 30 21:21:31 2010	(r47170)
@@ -40,11 +40,10 @@
 sub runstep {
     my ( $self, $conf ) = @_;
 
-    my $verbose = $conf->options->get( 'verbose' );
-    print "\n" if $verbose;
+    $conf->debug("\n");
 
     my ($ctags, $has_ctags) =
-        _probe_for_ctags($conf, [ @ctags_variations ], $verbose);
+        _probe_for_ctags($conf, [ @ctags_variations ]);
     $self->_evaluate_ctags($conf, $ctags, $has_ctags);
     return 1;
 }
@@ -52,12 +51,11 @@
 sub _probe_for_ctags {
     my $conf = shift;
     my $variations_ref = shift;
-    my $verbose = shift;
     my ($ctags, $has_ctags);
     while (defined (my $t = shift(@$variations_ref))) {
         my $output = capture_output( $t, '--version' ) || '';
-        print $output, "\n" if $verbose;
-        $has_ctags = _probe_for_ctags_output($output, $verbose);
+        $conf->debug("$output\n");
+        $has_ctags = _probe_for_ctags_output($conf, $output);
         $ctags = $t if $has_ctags;
         last if $has_ctags;
     }
@@ -65,9 +63,9 @@
 }
 
 sub _probe_for_ctags_output {
-    my ($output, $verbose) = @_;
+    my ($conf, $output) = @_;
     my $has_ctags = ( $output =~ m/Exuberant Ctags/ ) ? 1 : 0;
-    print $has_ctags, "\n" if $verbose;
+    $conf->debug("$has_ctags\n");
     return $has_ctags;
 }
 

Modified: branches/tt1452_configure_debug/config/auto/env.pm
==============================================================================
--- branches/tt1452_configure_debug/config/auto/env.pm	Sun May 30 21:06:38 2010	(r47169)
+++ branches/tt1452_configure_debug/config/auto/env.pm	Sun May 30 21:21:31 2010	(r47170)
@@ -57,26 +57,25 @@
 
 sub _evaluate_env {
     my ($self, $conf, $setenv, $unsetenv) = @_;
-    my $verbose = $conf->options->get('verbose');
     $conf->data->set(
         setenv   => $setenv,
         unsetenv => $unsetenv
     );
 
     if ( $setenv && $unsetenv ) {
-        print " (both) " if $verbose;
+        $conf->debug(" (both) ");
         $self->set_result('both');
     }
     elsif ($setenv) {
-        print " (setenv) " if $verbose;
+        $conf->debug(" (setenv) ");
         $self->set_result('setenv');
     }
     elsif ($unsetenv) {
-        print " (unsetenv) " if $verbose;
+        $conf->debug(" (unsetenv) ");
         $self->set_result('unsetenv');
     }
     else {
-        print " (no) " if $verbose;
+        $conf->debug(" (no) ");
         $self->set_result('no');
     }
 }

Modified: branches/tt1452_configure_debug/config/auto/gc.pm
==============================================================================
--- branches/tt1452_configure_debug/config/auto/gc.pm	Sun May 30 21:06:38 2010	(r47169)
+++ branches/tt1452_configure_debug/config/auto/gc.pm	Sun May 30 21:21:31 2010	(r47170)
@@ -50,7 +50,7 @@
         TEMP_gc_o => "src/gc/alloc_resources\$(O)",
         gc_flag   => '',
     );
-    print(" ($gc) ") if $conf->options->get('verbose');
+    $conf->debug(" ($gc) ");
 
     return 1;
 }

Modified: branches/tt1452_configure_debug/config/auto/gcc.pm
==============================================================================
--- branches/tt1452_configure_debug/config/auto/gcc.pm	Sun May 30 21:06:38 2010	(r47169)
+++ branches/tt1452_configure_debug/config/auto/gcc.pm	Sun May 30 21:21:31 2010	(r47170)
@@ -62,9 +62,8 @@
     my $minor = $gnucref->{__GNUC_MINOR__};
     my $intel = $gnucref->{__INTEL_COMPILER};
 
-    my $verbose = $conf->options->get('verbose');
     if ( defined $intel || !defined $major ) {
-        print " (no) " if $verbose;
+        $conf->debug(" (no) ");
         $self->set_result('no');
         $conf->data->set( gccversion => undef );
         return 1;
@@ -76,7 +75,7 @@
         undef $minor;    # Don't use it
     }
     if ( ! defined $major ) {
-        print " (no) " if $verbose;
+        $conf->debug(" (no) ");
         $self->set_result('no');
         $conf->data->set( gccversion => undef );
         return 1;

Modified: branches/tt1452_configure_debug/config/auto/gettext.pm
==============================================================================
--- branches/tt1452_configure_debug/config/auto/gettext.pm	Sun May 30 21:06:38 2010	(r47169)
+++ branches/tt1452_configure_debug/config/auto/gettext.pm	Sun May 30 21:21:31 2010	(r47170)
@@ -37,12 +37,7 @@
 sub runstep {
     my ( $self, $conf ) = @_;
 
-    my ( $verbose, $without ) = $conf->options->get(
-        qw|
-            verbose
-            without-gettext
-        |
-    );
+    my $without = $conf->options->get( qw| without-gettext | );
 
     if ($without) {
         $conf->data->set( has_gettext => 0 );
@@ -66,10 +61,10 @@
     my $has_gettext = 0;
     if ( !$@ ) {
         my $test = $conf->cc_run();
-        $has_gettext = $self->_evaluate_cc_run($test, $verbose);
+        $has_gettext = $self->_evaluate_cc_run($conf, $test);
     }
     if ($has_gettext) {
-        _handle_gettext($conf, $verbose, $extra_libs);
+        _handle_gettext($conf, $extra_libs);
     }
     $conf->data->set( HAS_GETTEXT => $has_gettext );
 
@@ -77,22 +72,21 @@
 }
 
 sub _evaluate_cc_run {
-    my $self = shift;
-    my ($test, $verbose) = @_;
+    my ($self, $conf, $test) = @_;
     my $has_gettext = 0;
     if ( $test eq "Hello, world!\n" ) {
         $has_gettext = 1;
-        print " (yes) " if $verbose;
+        $conf->debug(" (yes) ");
         $self->set_result('yes');
     }
     return $has_gettext;
 }
 
 sub _handle_gettext {
-    my ($conf, $verbose, $libs) = @_;
+    my ($conf, $libs) = @_;
     $conf->data->add( ' ', ccflags => "-DHAS_GETTEXT" );
     $conf->data->add( ' ', libs => $libs );
-    $verbose and print "\n  ccflags: ", $conf->data->get("ccflags"), "\n";
+    $conf->debug("\n  ccflags: ", $conf->data->get("ccflags"), "\n");
     return 1;
 }
 

Modified: branches/tt1452_configure_debug/config/auto/gmp.pm
==============================================================================
--- branches/tt1452_configure_debug/config/auto/gmp.pm	Sun May 30 21:06:38 2010	(r47169)
+++ branches/tt1452_configure_debug/config/auto/gmp.pm	Sun May 30 21:21:31 2010	(r47170)
@@ -43,12 +43,7 @@
 sub runstep {
     my ( $self, $conf ) = @_;
 
-    my ( $verbose, $without ) = $conf->options->get(
-        qw|
-            verbose
-            without-gmp
-        |
-    );
+    my $without = $conf->options->get( qw| without-gmp | );
 
     if ($without) {
         $conf->data->set( has_gmp => 0 );
@@ -71,7 +66,7 @@
     my $has_gmp = 0;
     if ( !$@ ) {
         my $test = $conf->cc_run();
-        $has_gmp = $self->_evaluate_cc_run( $conf, $test, $has_gmp, $verbose );
+        $has_gmp = $self->_evaluate_cc_run( $conf, $test, $has_gmp );
     }
     if ($has_gmp) {
         $conf->data->add( ' ', libs => $extra_libs );
@@ -82,10 +77,10 @@
 }
 
 sub _evaluate_cc_run {
-    my ($self, $conf, $test, $has_gmp, $verbose) = @_;
+    my ($self, $conf, $test, $has_gmp) = @_;
     if ( $test eq $self->{cc_run_expected} ) {
         $has_gmp = 1;
-        print " (yes) " if $verbose;
+        $conf->debug(" (yes) ");
         $self->set_result('yes');
 
         $conf->data->set(

Modified: branches/tt1452_configure_debug/config/auto/headers.pm
==============================================================================
--- branches/tt1452_configure_debug/config/auto/headers.pm	Sun May 30 21:06:38 2010	(r47169)
+++ branches/tt1452_configure_debug/config/auto/headers.pm	Sun May 30 21:21:31 2010	(r47170)
@@ -64,7 +64,7 @@
         my $flag = "i_$header";
         $flag =~ s/\.h$//g;
         $flag =~ s/\///g;
-        print "$flag: $pass\n" if defined $conf->options->get('verbose');
+        $conf->debug("$flag: $pass\n");
         $conf->data->set( $flag => $pass ? 'define' : undef );
     }
 

Modified: branches/tt1452_configure_debug/config/auto/icu.pm
==============================================================================
--- branches/tt1452_configure_debug/config/auto/icu.pm	Sun May 30 21:06:38 2010	(r47169)
+++ branches/tt1452_configure_debug/config/auto/icu.pm	Sun May 30 21:21:31 2010	(r47170)
@@ -114,8 +114,7 @@
     # 2nd possible return point
     if ( $without ) {
         $self->_set_no_configure_with_icu($conf, q{no icu-config});
-        print "Could not locate an icu-config program\n"
-            if $verbose;
+        $conf->debug("Could not locate an icu-config program\n");
         return 1;
     }
 

Modified: branches/tt1452_configure_debug/config/auto/inline.pm
==============================================================================
--- branches/tt1452_configure_debug/config/auto/inline.pm	Sun May 30 21:06:38 2010	(r47169)
+++ branches/tt1452_configure_debug/config/auto/inline.pm	Sun May 30 21:21:31 2010	(r47170)
@@ -79,13 +79,12 @@
 
 sub _evaluate_inline {
     my ($self, $conf, $test) = @_;
-    my $verbose = $conf->options->get(qw(verbose));
     if ($test) {
-        print " ($test) " if $verbose;
+        $conf->debug(" ($test) ");
         $self->set_result('yes');
     }
     else {
-        print " no " if $verbose;
+        $conf->debug(" no ");
         $self->set_result('no');
         $test = '';
     }

Modified: branches/tt1452_configure_debug/config/auto/msvc.pm
==============================================================================
--- branches/tt1452_configure_debug/config/auto/msvc.pm	Sun May 30 21:06:38 2010	(r47169)
+++ branches/tt1452_configure_debug/config/auto/msvc.pm	Sun May 30 21:21:31 2010	(r47170)
@@ -33,8 +33,7 @@
     my ( $self, $conf ) = ( shift, shift );
 
     if ($conf->data->get('gccversion')) {
-        my $verbose = $conf->options->get('verbose');
-        print " (skipped) " if $verbose;
+        $conf->debug(" (skipped) ");
         $self->set_result('skipped');
         $conf->data->set( msvcversion => undef );
         return 1;
@@ -57,7 +56,6 @@
 
 sub _evaluate_msvc {
     my ($self, $conf, $msvcref) = @_;
-    my $verbose = $conf->options->get('verbose');
     # Set msvcversion to undef.  This will also trigger any hints-file
     # callbacks that depend on knowing whether or not we're using Visual C++.
 
@@ -73,10 +71,10 @@
 
     my $major = int( $msvcref->{_MSC_VER} / 100 );
     my $minor = $msvcref->{_MSC_VER} % 100;
-    my $status = $self->_handle_not_msvc($conf, $major, $minor, $verbose);
+    my $status = $self->_handle_not_msvc($conf, $major, $minor);
     return 1 if $status;
 
-    my $msvcversion = $self->_compose_msvcversion($major, $minor, $verbose);
+    my $msvcversion = $self->_compose_msvcversion($major, $minor);
 
     $conf->data->set( msvcversion => $msvcversion );
 
@@ -96,10 +94,10 @@
 
 sub _handle_not_msvc {
     my $self = shift;
-    my ($conf, $major, $minor, $verbose) = @_;
+    my ($conf, $major, $minor) = @_;
     my $status;
     unless ( defined $major && defined $minor ) {
-        print " (no) " if $verbose;
+        $conf->debug(" (no) ");
         $self->set_result('no');
         $conf->data->set( msvcversion => undef );
         $status++;
@@ -109,7 +107,7 @@
 
 sub _compose_msvcversion {
     my $self = shift;
-    my ($major, $minor, $verbose) = @_;
+    my ($major, $minor) = @_;
     my $msvcversion = "$major.$minor";
     $self->set_result("yes, $msvcversion");
     return $msvcversion;

Modified: branches/tt1452_configure_debug/config/auto/opengl.pm
==============================================================================
--- branches/tt1452_configure_debug/config/auto/opengl.pm	Sun May 30 21:06:38 2010	(r47169)
+++ branches/tt1452_configure_debug/config/auto/opengl.pm	Sun May 30 21:21:31 2010	(r47170)
@@ -158,12 +158,7 @@
 sub runstep {
     my ( $self, $conf ) = @_;
 
-    my ( $verbose, $without ) = $conf->options->get(
-        qw|
-            verbose
-            without-opengl
-        |
-    );
+    my $without = $conf->options->get( qw| without-opengl | );
 
     return $self->_handle_no_opengl($conf) if $without;
 
@@ -192,15 +187,15 @@
     }
     else {
         my $test = $conf->cc_run();
-        return _handle_glut($conf, $extra_libs, $self->_evaluate_cc_run($test, $verbose));
+        return _handle_glut($conf, $extra_libs, $self->_evaluate_cc_run($conf, $test));
     }
 }
 
 sub _evaluate_cc_run {
-    my ($self, $test, $verbose) = @_;
+    my ($self, $conf, $test) = @_;
     my ($glut_api_version, $glut_brand) = split ' ', $test;
 
-    print " (yes, $glut_brand API version $glut_api_version) " if $verbose;
+    $conf->debug(" (yes, $glut_brand API version $glut_api_version) ");
     $self->set_result("yes, $glut_brand $glut_api_version");
 
     return ($glut_api_version, $glut_brand);

Modified: branches/tt1452_configure_debug/config/auto/pcre.pm
==============================================================================
--- branches/tt1452_configure_debug/config/auto/pcre.pm	Sun May 30 21:06:38 2010	(r47169)
+++ branches/tt1452_configure_debug/config/auto/pcre.pm	Sun May 30 21:21:31 2010	(r47170)
@@ -33,12 +33,7 @@
 sub runstep {
     my ( $self, $conf ) = @_;
 
-    my ( $verbose, $without ) = $conf->options->get(
-        qw|
-            verbose
-            without-pcre
-        |
-    );
+    my $without = $conf->options->get( qw| without-pcre | );
 
     if ($without) {
         $conf->data->set( HAS_PCRE => 0 );
@@ -61,7 +56,7 @@
     my $has_pcre = 0;
     if ( !$@ ) {
         my $test = $conf->cc_run();
-        $has_pcre = $self->_evaluate_cc_run($test, $verbose);
+        $has_pcre = $self->_evaluate_cc_run($test, $conf);
     }
     $conf->data->set( HAS_PCRE => $has_pcre);
 
@@ -70,12 +65,12 @@
 
 sub _evaluate_cc_run {
     my $self = shift;
-    my ($test, $verbose) = @_;
+    my ($test, $conf) = @_;
     my $has_pcre = 0;
     if ( $test =~ /pcre (\d+\.\d+)/ ) {
         my $pcre_version = $1;
         $has_pcre = 1;
-        print " (yes, $pcre_version) " if $verbose;
+        $conf->debug(" (yes, $pcre_version) ");
         $self->set_result("yes, $pcre_version");
     }
     return $has_pcre;

Modified: branches/tt1452_configure_debug/config/auto/readline.pm
==============================================================================
--- branches/tt1452_configure_debug/config/auto/readline.pm	Sun May 30 21:06:38 2010	(r47169)
+++ branches/tt1452_configure_debug/config/auto/readline.pm	Sun May 30 21:21:31 2010	(r47170)
@@ -36,8 +36,6 @@
 sub runstep {
     my ( $self, $conf ) = @_;
 
-    my $verbose = $conf->options->get('verbose');
-
     my $cc     = $conf->data->get('cc');
     my $osname = $conf->data->get('osname');
 
@@ -54,7 +52,7 @@
     eval { $conf->cc_build( q{}, $extra_libs ) };
     if ( !$@ ) {
         if ( $conf->cc_run() ) {
-            $has_readline = $self->_evaluate_cc_run($verbose);
+            $has_readline = $self->_evaluate_cc_run($conf);
         }
         _handle_readline($conf, $extra_libs);
     }
@@ -71,7 +69,7 @@
         eval { $conf->cc_build( q{}, $extra_libs) };
         if ( !$@ ) {
             if ( $conf->cc_run() ) {
-                $has_readline = $self->_evaluate_cc_run($verbose);
+                $has_readline = $self->_evaluate_cc_run($conf);
             }
             _handle_readline($conf, $extra_libs);
         }
@@ -83,9 +81,9 @@
 }
 
 sub _evaluate_cc_run {
-    my ($self, $verbose) = @_;
+    my ($self, $conf) = @_;
     my $has_readline = 1;
-    print " (yes) " if $verbose;
+    $conf->debug(" (yes) ");
     $self->set_result('yes');
     return $has_readline;
 }

Modified: branches/tt1452_configure_debug/config/auto/signal.pm
==============================================================================
--- branches/tt1452_configure_debug/config/auto/signal.pm	Sun May 30 21:06:38 2010	(r47169)
+++ branches/tt1452_configure_debug/config/auto/signal.pm	Sun May 30 21:21:31 2010	(r47170)
@@ -39,26 +39,24 @@
         has_setitimer      => undef
     );
 
-    my $verbose = $conf->options->get('verbose');
-
     $conf->cc_gen('config/auto/signal/test1_c.in');
     eval { $conf->cc_build(); };
     unless ( $@ || $conf->cc_run() !~ /ok/ ) {
-        _handle__sighandler_t($conf, $verbose);
+        _handle__sighandler_t($conf);
     }
     $conf->cc_clean();
 
     $conf->cc_gen('config/auto/signal/test2_c.in');
     eval { $conf->cc_build(); };
     unless ( $@ || $conf->cc_run() !~ /ok/ ) {
-        _handle_sigaction($conf, $verbose);
+        _handle_sigaction($conf);
     }
     $conf->cc_clean();
 
     $conf->cc_gen('config/auto/signal/test_itimer_c.in');
     eval { $conf->cc_build(); };
     unless ( $@ || $conf->cc_run() !~ /ok/ ) {
-        _handle_setitimer($conf, $verbose);
+        _handle_setitimer($conf);
     }
     $conf->cc_clean();
 
@@ -70,26 +68,26 @@
 }
 
 sub _handle__sighandler_t {
-    my ($conf, $verbose) = @_;
+    my ($conf) = @_;
     $conf->data->set( has___sighandler_t => 'define' );
-    print " (__sighandler_t)" if $verbose;
+    $conf->debug(" (__sighandler_t)");
     return 1;
 }
 
 sub _handle_sigaction {
-    my ($conf, $verbose) = @_;
+    my ($conf) = @_;
     $conf->data->set( has_sigaction => 'define' );
-    print " (sigaction)" if $verbose;
+    $conf->debug(" (sigaction)");
     return 1;
 }
 
 sub _handle_setitimer {
-    my ($conf, $verbose) = @_;
+    my ($conf) = @_;
     $conf->data->set(
         has_setitimer    => 'define',
         has_sig_atomic_t => 'define',
     );
-    print " (setitimer) " if $verbose;
+    $conf->debug(" (setitimer) ");
     return 1;
 }
 

Modified: branches/tt1452_configure_debug/config/auto/snprintf.pm
==============================================================================
--- branches/tt1452_configure_debug/config/auto/snprintf.pm	Sun May 30 21:06:38 2010	(r47169)
+++ branches/tt1452_configure_debug/config/auto/snprintf.pm	Sun May 30 21:21:31 2010	(r47170)
@@ -56,7 +56,7 @@
     elsif ( $res =~ /^old snprintf/ ) {
         $conf->data->set( HAS_OLD_SNPRINTF => 1 );
     }
-    print " ($res) " if $conf->options->get('verbose');
+    $conf->debug(" ($res) ");
     return 1;
 }
 

Modified: branches/tt1452_configure_debug/config/auto/thread.pm
==============================================================================
--- branches/tt1452_configure_debug/config/auto/thread.pm	Sun May 30 21:06:38 2010	(r47169)
+++ branches/tt1452_configure_debug/config/auto/thread.pm	Sun May 30 21:21:31 2010	(r47170)
@@ -31,12 +31,7 @@
 sub runstep {
     my ( $self, $conf ) = @_;
 
-    my ( $verbose, $without ) = $conf->options->get(
-        qw|
-            verbose
-            without-threads
-        |
-    );
+    my $without = $conf->options->get( qw| without-threads |);
 
     if ($without) {
         $conf->data->set( HAS_THREADS => 0 );

Modified: branches/tt1452_configure_debug/config/auto/warnings.pm
==============================================================================
--- branches/tt1452_configure_debug/config/auto/warnings.pm	Sun May 30 21:06:38 2010	(r47169)
+++ branches/tt1452_configure_debug/config/auto/warnings.pm	Sun May 30 21:21:31 2010	(r47170)
@@ -274,8 +274,7 @@
 sub runstep {
     my ( $self, $conf ) = @_;
 
-    my $verbose = $conf->options->get('verbose');
-    print "\n" if $verbose;
+    $conf->debug("\n");
 
     my $compiler = '';
     if ( defined $conf->data->get('gccversion') ) {
@@ -289,8 +288,7 @@
     }
 
     if ($compiler eq '') {
-        print "We do not (yet) probe for warnings for your compiler\n"
-            if $verbose;
+        $conf->debug("We do not (yet) probe for warnings for your compiler\n");
         $self->set_result('skipped');
         return 1;
     }
@@ -357,12 +355,10 @@
 sub valid_warning {
     my ( $self, $conf, $warning ) = @_;
 
-    my $verbose = $conf->options->get('verbose');
-
     # This should be using a temp file name.
     my $output_file = 'test.cco';
 
-    $verbose and print "trying attribute '$warning'\n";
+    $conf->debug("trying attribute '$warning'\n");
 
     my $cc = $conf->option_or_data('cc');
     $conf->cc_gen('config/auto/warnings/test_c.in');
@@ -372,7 +368,7 @@
     my $tryflags = "$ccflags $warnings $warning";
 
     my $command_line = Parrot::Configure::Utils::_build_compile_command( $cc, $tryflags );
-    $verbose and print '  ', $command_line, "\n";
+    $conf->debug("  ", $command_line, "\n");
 
     # Don't use cc_build, because failure is expected.
     my $exit_code = Parrot::Configure::Utils::_run_command(
@@ -390,15 +386,15 @@
     my $output = Parrot::BuildUtil::slurp_file($output_file);
     unlink $output_file or die "Unable to unlink $output_file: $!";
 
-    $verbose and print "  output: $output\n";
+    $conf->debug("  output: $output\n");
 
     if ( $output !~ /\berror|warning|not supported|ignoring (unknown )?option\b/i ) {
         push @{$self->{'validated'}}, $warning;
-        $verbose and print "    valid warning: '$warning'\n";
+        $conf->debug("    valid warning: '$warning'\n");
         return 1;
     }
     else {
-        $verbose and print "  invalid warning: '$warning'\n";
+        $conf->debug("  invalid warning: '$warning'\n");
         return 0;
     }
 }

Modified: branches/tt1452_configure_debug/config/auto/zlib.pm
==============================================================================
--- branches/tt1452_configure_debug/config/auto/zlib.pm	Sun May 30 21:06:38 2010	(r47169)
+++ branches/tt1452_configure_debug/config/auto/zlib.pm	Sun May 30 21:21:31 2010	(r47170)
@@ -32,12 +32,7 @@
 sub runstep {
     my ( $self, $conf ) = @_;
 
-    my ( $verbose, $without ) = $conf->options->get(
-        qw|
-            verbose
-            without-zlib
-        |
-    );
+    my $without = $conf->options->get( qw| without-zlib | );
 
     if ($without) {
         $conf->data->set( has_zlib => 0 );
@@ -60,7 +55,7 @@
     my $has_zlib = 0;
     if ( !$@ ) {
         my $test = $conf->cc_run();
-        $has_zlib = $self->_evaluate_cc_run($conf, $test, $has_zlib, $verbose);
+        $has_zlib = $self->_evaluate_cc_run($conf, $test, $has_zlib);
     }
     $conf->data->set( has_zlib => $has_zlib );
     $self->set_result($has_zlib ? 'yes' : 'no');
@@ -70,11 +65,11 @@
 
 sub _evaluate_cc_run {
     my $self = shift;
-    my ($conf, $test, $has_zlib, $verbose) = @_;
+    my ($conf, $test, $has_zlib) = @_;
     if ( $test =~ m/^(\d\.\d\.\d)/ ) {
         my $version = $1;
         $has_zlib = 1;
-        print " (yes) " if $verbose;
+        $conf->debug(" (yes) ");
         $self->set_result("yes, $version");
     }
     return $has_zlib;

Modified: branches/tt1452_configure_debug/config/gen/platform.pm
==============================================================================
--- branches/tt1452_configure_debug/config/gen/platform.pm	Sun May 30 21:06:38 2010	(r47169)
+++ branches/tt1452_configure_debug/config/gen/platform.pm	Sun May 30 21:21:31 2010	(r47170)
@@ -39,35 +39,32 @@
 sub runstep {
     my ( $self, $conf ) = @_;
 
-    my $verbose     = $conf->options->get('verbose');
-    my $generated   = $self->_get_generated($conf, $verbose);
-
+    my $generated   = $self->_get_generated($conf);
 
     # headers are merged into platform.h
-    $self->_set_headers($conf, $verbose, $generated);
+    $self->_set_headers($conf, $generated);
 
     # implementation files are merged into platform.c
-    $self->_set_implementations($conf, $verbose, $generated);
+    $self->_set_implementations($conf, $generated);
 
     $self->_handle_asm($conf);
 
-    $self->_set_limits($conf, $verbose);
+    $self->_set_limits($conf);
 
     return 1;
 }
 
 sub _get_generated {
-    my $self = shift;
-    my ($conf, $verbose) = @_;
+    my ($self, $conf) = @_;
     my $generated = $conf->data->get('TEMP_generated');
     $generated = '' unless defined $generated;
-    print " ($generated) " if $verbose;
+    $conf->debug(" ($generated) ");
     return $generated;
 }
 
 sub _set_headers {
     my $self = shift;
-    my ($conf, $verbose, $generated) = @_;
+    my ($conf, $generated) = @_;
     my $platform = $conf->data->get('platform');
     my @headers = qw/
         io.h
@@ -112,7 +109,7 @@
 
         if ( -e $header_file ) {
             local $/ = undef;
-            print("\t$header_file\n") if $verbose;
+            $conf->debug("\t$header_file\n");
             open my $IN_H, "<", "$header_file"
                 or die "Can't open $header_file: $!";
 
@@ -144,7 +141,7 @@
     for my $h (@headers) {
         if ( -e $h ) {
             local $/ = undef;
-            print("\t$h\n") if $verbose;
+            $conf->debug("\t$h\n");
             open my $IN_H, "<", $h or die "Can't open $h: $!";
             print {$PLATFORM_H} <<"END_HERE";
 /*
@@ -186,7 +183,7 @@
 
 sub _set_implementations {
     my $self = shift;
-    my ($conf, $verbose, $generated) = @_;
+    my ($conf, $generated) = @_;
     my $platform = $conf->data->get('platform');
     my @impls = qw/
         time.c
@@ -238,7 +235,7 @@
 
         if ( -e $impl_file ) {
             local $/ = undef;
-            print("\t$impl_file\n") if $verbose;
+            $conf->debug("\t$impl_file\n");
             open my $IN_C, "<", $impl_file or die "Can't open $impl_file: $!";
 
             # slurp in the C file
@@ -263,7 +260,7 @@
     for my $im (@impls) {
         if ( -e $im ) {
             local $/ = undef;
-            print("\t$im\n") if $verbose;
+            $conf->debug("\t$im\n");
             open my $IN_C, "<", $im or die "Can't open $im: $!";
             print {$PLATFORM_C} <<"END_HERE";
 /*

Modified: branches/tt1452_configure_debug/config/init/hints.pm
==============================================================================
--- branches/tt1452_configure_debug/config/init/hints.pm	Sun May 30 21:06:38 2010	(r47169)
+++ branches/tt1452_configure_debug/config/init/hints.pm	Sun May 30 21:21:31 2010	(r47170)
@@ -31,8 +31,7 @@
 sub runstep {
     my ( $self, $conf ) = @_;
 
-    my $verbose = $conf->options->get('verbose');
-    print "\n[ " if $verbose;
+    $conf->debug("\n[ ");
 
     my $hints_used = 0;
     my $hints_file;
@@ -46,7 +45,7 @@
     if ( -f $hints_file ) {
         my $hints_pkg = "init::hints::" . $hints_file_name;
 
-        print "$hints_pkg " if $verbose;
+        $conf->debug("$hints_pkg ");
 
         eval "use $hints_pkg";
         die $@ if $@;
@@ -57,7 +56,7 @@
         $hints_used++;
 
         $hints_pkg = "init::hints::local";
-        print "$hints_pkg " if $verbose;
+        $conf->debug("$hints_pkg ");
         eval "use $hints_pkg";
 
         unless ($@) {
@@ -66,14 +65,14 @@
         }
     }
     else {
-        print "No $hints_file found.  " if $verbose;
+        $conf->debug("No $hints_file found.  ");
     }
 
-    if ( $hints_used == 0 and $verbose ) {
-        print "(no hints) ";
+    if ( $hints_used == 0 ) {
+        $conf->debug("(no hints) ");
     }
 
-    print "]" if $verbose;
+    $conf->debug("]");
 
     return 1;
 }

Modified: branches/tt1452_configure_debug/config/init/optimize.pm
==============================================================================
--- branches/tt1452_configure_debug/config/init/optimize.pm	Sun May 30 21:06:38 2010	(r47169)
+++ branches/tt1452_configure_debug/config/init/optimize.pm	Sun May 30 21:21:31 2010	(r47170)
@@ -27,16 +27,12 @@
     };
 }
 
-our $verbose;
-
 sub runstep {
     my ( $self, $conf ) = @_;
 
-    $verbose = $conf->options->get( 'verbose' );
-    print "\n" if $verbose;
+    $conf->debug("\n");
 
-    print "(optimization options: init::optimize)\n"
-        if $verbose;
+    $conf->debug("(optimization options: init::optimize)\n");
 
     # A plain --optimize means use perl5's $Config{optimize}.  If an argument
     # is given, however, use that instead.
@@ -44,7 +40,7 @@
 
     if (! defined $optimize) {
         $self->set_result('no');
-        print "(none requested) " if $conf->options->get('verbose');
+        $conf->debug("(none requested) ");
         return 1;
     }
 
@@ -68,7 +64,7 @@
 
     # save the options, however we got them.
     $conf->data->set( optimize => $options );
-    print "optimize options: ", $options, "\n" if $verbose;
+    $conf->debug("optimize options: ", $options, "\n");
 
     # disable debug flags.
     $conf->data->set( cc_debug => '' );

Modified: branches/tt1452_configure_debug/config/inter/progs.pm
==============================================================================
--- branches/tt1452_configure_debug/config/inter/progs.pm	Sun May 30 21:06:38 2010	(r47169)
+++ branches/tt1452_configure_debug/config/inter/progs.pm	Sun May 30 21:21:31 2010	(r47170)
@@ -100,7 +100,7 @@
         if $ask;
     $conf->data->set( ccflags => $ccflags );
 
-    $conf->options->get('verbose') and print "\nccflags: $ccflags\n";
+    $conf->debug("\nccflags: $ccflags\n");
 
     $linkflags = $conf->data->get('linkflags');
     $linkflags =~ s/-libpath:\S+//g;    # TT #854: No idea why.

Modified: branches/tt1452_configure_debug/lib/Parrot/Configure.pm
==============================================================================
--- branches/tt1452_configure_debug/lib/Parrot/Configure.pm	Sun May 30 21:06:38 2010	(r47169)
+++ branches/tt1452_configure_debug/lib/Parrot/Configure.pm	Sun May 30 21:21:31 2010	(r47170)
@@ -21,6 +21,7 @@
 
     $conf->add_steps(@steps);
     $conf->runsteps;
+    $conf->debug(@messages);
 
 =head1 DESCRIPTION
 
@@ -554,6 +555,22 @@
     return;
 }
 
+=item * C<debug()>
+
+When C<--verbose> is requested, or when a particular configuration step is
+specified in C<--verbose-step>, this method prints its arguments as a string
+on STDOUT.
+
+=cut
+
+sub debug {
+    my ($conf, @messages) = @_;
+    if ($conf->options->get('verbose')) {
+        print join('' => @messages);
+    }
+    return 1;
+}
+
 =back
 
 =head1 CREDITS


More information about the parrot-commits mailing list