Author: leo
Date: Thu Sep 15 03:04:31 2005
New Revision: 9195

Added:
   branches/leo-ctx5/config/inter/shlibs.pl
      - copied unchanged from r9194, trunk/config/inter/shlibs.pl
Modified:
   branches/leo-ctx5/Configure.pl
   branches/leo-ctx5/MANIFEST
   branches/leo-ctx5/config/init/data.pl
   branches/leo-ctx5/config/init/hints/solaris.pl
   branches/leo-ctx5/config/init/optimize.pl
   branches/leo-ctx5/config/inter/progs.pl
   branches/leo-ctx5/lib/Parrot/Configure/RunSteps.pm
   branches/leo-ctx5/lib/Parrot/Configure/Step.pm
Log:
merge -r9191:9194 from trunk

Modified: branches/leo-ctx5/Configure.pl
==============================================================================
--- branches/leo-ctx5/Configure.pl      (original)
+++ branches/leo-ctx5/Configure.pl      Thu Sep 15 03:04:31 2005
@@ -76,7 +76,11 @@ Turn on profiled compile (gcc only for n
 
 =item C<--optimize>
 
-Tell the compiler to do an optimization phase.
+Add perl5's $Config{optimize} to the compiler flags.
+
+=item C<--optimize=flags>
+
+Add C<flags> to the compiler flags.
 
 =item C<--inline>
 
@@ -314,6 +318,7 @@ e.g. : --ccflags="rem{-g} :add{-O2}"
    --debugging=0        Disable debugging, default = 1
    --profile            Turn on profiled compile (gcc only for now)
    --optimize           Optimized compile
+   --optimize=flags     Add given optimizer flags
    --inline             Compiler supports inline
 
    --cc=(compiler)      Use the given compiler

Modified: branches/leo-ctx5/MANIFEST
==============================================================================
--- branches/leo-ctx5/MANIFEST  (original)
+++ branches/leo-ctx5/MANIFEST  Thu Sep 15 03:04:31 2005
@@ -309,6 +309,7 @@ config/inter/encoding.pl                
 config/inter/exp.pl                               []
 config/inter/ops.pl                               []
 config/inter/pmc.pl                               []
+config/inter/shlibs.pl                            []
 config/inter/progs.pl                             []
 config/inter/types.pl                             []
 docs/ROADMAP                                      [devel]doc

Modified: branches/leo-ctx5/config/init/data.pl
==============================================================================
--- branches/leo-ctx5/config/init/data.pl       (original)
+++ branches/leo-ctx5/config/init/data.pl       Thu Sep 15 03:04:31 2005
@@ -37,7 +37,10 @@ sub runstep {
 
   my(%c)=(
     debugging     => $debugging ? 1 : 0,
-    optimize      => $optimize ? $Config{optimize} : '',
+    # A plain --optimize means use perl5's $Config{optimize}.  If an argument 
is
+    # given, however, use that instead.  This logic really belongs in the 
optimize
+    # unit.
+    optimize      => $optimize ? ($optimize eq "1" ? $Config{optimize} : 
$optimize) : '',
     verbose       => $verbose,
 
     build_dir     => $FindBin::Bin,

Modified: branches/leo-ctx5/config/init/hints/solaris.pl
==============================================================================
--- branches/leo-ctx5/config/init/hints/solaris.pl      (original)
+++ branches/leo-ctx5/config/init/hints/solaris.pl      Thu Sep 15 03:04:31 2005
@@ -1,5 +1,6 @@
 # Copyright: 2005 The Perl Foundation.  All Rights Reserved.
 # $Id$
+use Parrot::Configure::Step qw(cc_gen cc_run);
 
 my $libs = Configure::Data->get('libs');
 if ( $libs !~ /-lpthread/ ) {
@@ -13,24 +14,51 @@ Configure::Data->set(
 );
 
 ################################################################
-my $link = Configure::Data->get('link');
-# Going to assume Sun's compiler
-# In which case we need to link with the C++ compiler (CC) rather than the
-# C compiler (cc)
-$link =~ s/\bcc\b/CC/;
-Configure::Data->set('link', $link);
-
-# if it turns out we're using gcc, then we need to make sure we're linking
-# with g++, not gcc.  We can't make this decision until the gccversion test
-# has been run.
+# If we're going to be using ICU (or any other C++-compiled library) we
+# need to use the c++ compiler as a linker.  As soon as the user
+# selects a compiler, we will run the gccversion test.  (If we were to
+# wait till it's normally run, the linker question would have already
+# been asked.)
 my $solaris_link_cb = sub {
-  my ($key, $gccversion) = @_;
-  if ($gccversion) {
-    Configure::Data->set('link', 'g++');
-    Configure::Data->deltrigger("gccversion", "solaris_link");
-  }
+    use Carp;
+    my ($key, $cc) = @_;
+    my %gnuc;
+    my $link = Configure::Data->get('link');
+    cc_gen("config/auto/gcc/test_c.in");
+    # Can't call cc_build since we haven't set all the flags yet.
+    # This should suffice for this test.
+    Parrot::Configure::Step::_run_command("$cc -o test test.c", 'test.cco', 
'test.cco')
+        and confess "C compiler failed (see test.cco)";
+    %gnuc=eval cc_run() or die "Can't run the test program: $!";
+    if (defined $gnuc{__GNUC__}) {
+       $link = 'g++';
+    }
+    else {
+       $link =~ s/\bcc\b/CC/;
+    }
+    Configure::Data->set('link', $link);
+    Configure::Data->deltrigger("cc", "solaris_link");
+};
+Configure::Data->settrigger("cc", "solaris_link", $solaris_link_cb);
+
+################################################################
+# cc_shared:  Flags to instruct the compiler to use position-independent
+# code for use in shared libraries.  -KPIC for Sun's compiler, -fPIC for
+# gcc.  We don't know which compiler we're using till after the
+# gccversion test.
+# XXX Should this go into the shlibs.pl Configure.pl unit instead?
+my $solaris_cc_shared_cb = sub {
+    my ($key, $gccversion) = @_;
+    if ($gccversion) {
+       Configure::Data->set('cc_shared', '-fPIC');
+    }
+    else {
+       Configure::Data->set('cc_shared', '-KPIC');
+    }
+    Configure::Data->deltrigger("gccversion", "solaris_cc_shared");
 };
-Configure::Data->settrigger("gccversion", "solaris_link", $solaris_link_cb);
+Configure::Data->settrigger("gccversion", "solaris_cc_shared", 
+                       $solaris_cc_shared_cb);
 
 ################################################################
 # Parrot usually aims for IEEE-754 compliance.

Modified: branches/leo-ctx5/config/init/optimize.pl
==============================================================================
--- branches/leo-ctx5/config/init/optimize.pl   (original)
+++ branches/leo-ctx5/config/init/optimize.pl   Thu Sep 15 03:04:31 2005
@@ -1,4 +1,4 @@
-# Copyright: 2001-2003 The Perl Foundation.  All Rights Reserved.
+# Copyright: 2001-2005 The Perl Foundation.  All Rights Reserved.
 # $Id$
 
 =head1 NAME
@@ -9,6 +9,7 @@ config/init/optimize.pl - Optimization
 
 Enables optimization by adding the appropriate flags for the local
 platform to the C<CCFLAGS>.
+Should this be part of config/inter/progs.pl ? XXX
 
 =cut
 
@@ -20,9 +21,10 @@ use Parrot::Configure::Step;
 
 $description="Enabling optimization...";
 
[EMAIL PROTECTED](verbose);
[EMAIL PROTECTED](verbose optimize);
 
 sub runstep {
+  my ($verbose, $optimize) = @_;
   if (Configure::Data->get('optimize')) {
     my($ccflags, $optimize) =
       Configure::Data->get(qw(ccflags optimize));
@@ -33,7 +35,7 @@ sub runstep {
                         );
   }
   else {
-    print "(none requested) " if $_[0];
+    print "(none requested) " if $verbose;
   }
 }
 

Modified: branches/leo-ctx5/config/inter/progs.pl
==============================================================================
--- branches/leo-ctx5/config/inter/progs.pl     (original)
+++ branches/leo-ctx5/config/inter/progs.pl     Thu Sep 15 03:04:31 2005
@@ -1,4 +1,4 @@
-# Copyright: 2001-2003 The Perl Foundation.  All Rights Reserved.
+# Copyright: 2001-2005 The Perl Foundation.  All Rights Reserved.
 # $Id$
 
 =head1 NAME
@@ -29,20 +29,9 @@ sub runstep {
   @[EMAIL PROTECTED]@_;
 
   my($cc, $cxx, $link, $ld, $ccflags, $ccwarn, $linkflags, $ldflags, $libs, 
$lex,
-     $yacc) =
-       Configure::Data->get(qw(cc cxx link ld ccflags ccwarn linkflags ldflags
-                              libs lex yacc));
-  $ccflags =~ s/-D((PERL|HAVE)_\w+\s*|USE_PERLIO)//g;
-  $ccflags =~ s/-fno-strict-aliasing//g;
-  $ccflags =~ s/-fnative-struct//g;
-  $linkflags =~ s/-libpath:\S+//g;
-  $ldflags =~ s/-libpath:\S+//g;
-  my $debug='n';
-
-  $libs=join ' ',
-  grep { $^O=~/VMS|MSWin/ || !/^-l(c|gdbm(_compat)?|dbm|ndbm|db)$/ }
-  split(' ', $libs);
+     $yacc);
 
+  # Find a working version of a program:
   # Try each alternative, until one works.
   # If none work, then set to null command.
   # XXX need config support for a null command.
@@ -54,20 +43,6 @@ sub runstep {
     }
     return $null;
   };
-  if ($args{'maintainer'}) {
-    $lex  = &$first_working($lex,  'flex', 'lex'                 );
-    $yacc = &$first_working($yacc, 'bison -v -y', 'yacc', 'byacc');
-  }
-  else {
-    $lex = $yacc = $null;
-  }
-
-  for my $var(qw(cc cxx link ld ccflags linkflags ldflags libs ccwarn lex 
yacc)) {
-    #Symrefs to lexicals are a no-no, so we have to use eval STRING.  %MY, 
anyone?
-    eval qq{ \$$var=integrate(\$$var, \$args{$var}) if defined \$args{$var} };
-  }
-
-  $debug='y'              if $args{debugging};
 
   if($args{ask}) {
     print <<'END';
@@ -80,20 +55,74 @@ sub runstep {
     configuration.
 
 END
+    }
 
-    $cc=prompt("What C compiler do you want to use?", $cc);
-    $link=prompt("How about your linker?", $link);
-    $ld=prompt("What program do you want to use to build shared libraries?",
-    $ld);
-    $ccflags=prompt("What flags should your C compiler receive?", $ccflags);
-    $linkflags=prompt("And your linker?", $linkflags);
-    $ldflags=prompt("And your $ld for building shared libraries?", $ldflags);
-    $libs=prompt("What libraries should your C compiler use?", $libs);
-    $cxx=prompt("What C++ compiler do you want to use?", $cxx);
-    $debug=prompt("Do you want a debugging build of Parrot?", $debug);
-    $lex=prompt("Do you have a lexical analyzer generator, like flex or 
lex?",$lex);
-    $yacc=prompt("Do you have a parser generator, like bison or yacc?",$yacc);
-  }
+    # Set each variable individually so that hints files can use them as
+    # triggers to help pick the correct defaults for later answers.
+
+    $cc = integrate(Configure::Data->get('cc'), $args{cc});
+    $cc = prompt("What C compiler do you want to use?", $cc) if $args{ask};
+    Configure::Data->set(cc =>  $cc);
+
+    $link = integrate(Configure::Data->get('link'), $args{link});
+    $link = prompt("How about your linker?", $link) if $args{ask};
+    Configure::Data->set(link =>  $link);
+
+    $ld = integrate(Configure::Data->get('ld'), $args{ld});
+    $ld = prompt("What program do you want to use to build shared libraries?", 
$ld) if $args{ask};
+    Configure::Data->set(ld =>  $ld);
+
+    $ccflags = Configure::Data->get('ccflags');
+    # Remove some perl5-isms.
+    $ccflags =~ s/-D((PERL|HAVE)_\w+\s*|USE_PERLIO)//g;
+    $ccflags =~ s/-fno-strict-aliasing//g;
+    $ccflags =~ s/-fnative-struct//g;
+    $ccflags = integrate($ccflags, $args{ccflags});
+    $ccflags = prompt("What flags should your C compiler receive?", $ccflags) 
if $args{ask};
+    Configure::Data->set(ccflags =>  $ccflags);
+
+    $linkflags = Configure::Data->get('linkflags');
+    $linkflags =~ s/-libpath:\S+//g;  # XXX No idea why.
+    $linkflags = integrate($linkflags, $args{linkflags});
+    $linkflags = prompt("And your linker?", $linkflags) if $args{ask};
+    Configure::Data->set(linkflags =>  $linkflags);
+
+    $ldflags = Configure::Data->get('ldflags');
+    $ldflags =~ s/-libpath:\S+//g;  # XXX No idea why.
+    $ldflags = integrate($ldflags, $args{ldflags});
+    $ldflags = prompt("And your $ld for building shared libraries?", $ldflags) 
if $args{ask};
+    Configure::Data->set(ldflags =>  $ldflags);
+
+    $libs = Configure::Data->get('libs');
+    $libs=join ' ',
+       grep { $^O=~/VMS|MSWin/ || !/^-l(c|gdbm(_compat)?|dbm|ndbm|db)$/ }
+           split(' ', $libs);
+    $libs = integrate($libs, $args{libs});
+    $libs = prompt("What libraries should your C compiler use?", $libs) if 
$args{ask};
+    Configure::Data->set(libs =>  $libs);
+
+    $cxx = integrate(Configure::Data->get('cxx'), $args{cxx});
+    $cxx = prompt("What C++ compiler do you want to use?", $cxx) if $args{ask};
+    Configure::Data->set(cxx =>  $cxx);
+
+    my $debug='n';
+    $debug='y'  if $args{debugging};
+    $debug = prompt("Do you want a debugging build of Parrot?", $debug) if 
$args{ask};
+
+    if ($args{'maintainer'}) {
+       $lex = integrate(Configure::Data->get('lex'), $args{lex});
+       $lex  = &$first_working($lex,  'flex', 'lex');
+       $yacc = integrate(Configure::Data->get('yacc'), $args{yacc});
+       $yacc = &$first_working($yacc, 'bison -v -y', 'yacc', 'byacc');
+    }
+    else {
+       $lex = $yacc = $null;
+    }
+    $lex = prompt("Do you have a lexical analyzer generator, like flex or 
lex?",$lex) if $args{ask};
+    Configure::Data->set(lex =>  $lex);
+
+    $yacc = prompt("Do you have a parser generator, like bison or 
yacc?",$yacc) if $args{ask};
+    Configure::Data->set(yacc =>  $yacc);
 
   if(!$debug || $debug =~ /n/i) {
     Configure::Data->set(
@@ -103,19 +132,9 @@ END
     );
   }
 
-  Configure::Data->set(
-    cc      => $cc,
-    cxx      => $cxx,
-    link    => $link,
-    ld      => $ld,
-    ccflags => $ccflags,
-    linkflags => $linkflags,
-    ldflags => $ldflags,
-    libs    => $libs,
-    ccwarn => $ccwarn,
-    lex     => $lex,
-    yacc    => $yacc,
-  );
+  # This one isn't prompted for above.  I don't know why.
+  $ccwarn = integrate(Configure::Data->get('ccwarn'), $args{ccwarn});
+  Configure::Data->set(ccwarn => $ccwarn);
 }
 
 1;

Modified: branches/leo-ctx5/lib/Parrot/Configure/RunSteps.pm
==============================================================================
--- branches/leo-ctx5/lib/Parrot/Configure/RunSteps.pm  (original)
+++ branches/leo-ctx5/lib/Parrot/Configure/RunSteps.pm  Thu Sep 15 03:04:31 2005
@@ -33,6 +33,7 @@ use vars qw(@steps);
     inter/progs.pl
     auto/gcc.pl
     init/optimize.pl
+    inter/shlibs.pl
     inter/charset.pl
     inter/encoding.pl
     inter/types.pl

Modified: branches/leo-ctx5/lib/Parrot/Configure/Step.pm
==============================================================================
--- branches/leo-ctx5/lib/Parrot/Configure/Step.pm      (original)
+++ branches/leo-ctx5/lib/Parrot/Configure/Step.pm      Thu Sep 15 03:04:31 2005
@@ -49,7 +49,8 @@ use vars qw(@ISA @EXPORT @EXPORT_OK %EXP
 
 =item C<integrate($orig, $new)>
 
-Integrates C<$new> into C<$orig>.
+Integrates C<$new> into C<$orig>.  Returns C<$orig> if C<$new>
+is undefined.
 
 =cut
 
@@ -57,7 +58,11 @@ sub integrate {
     my($orig, $new) = @_;
 
     unless(defined $new) {
-        warn "String to be integrated in to '$orig' undefined";
+       # Rather than sprinkling "if defined(...)", everywhere,
+       # config/inter/progs.pl just passes in potentially undefined
+       # strings.  Just pass back the original in that case.  Don't
+       # bother warning.  --AD, 12 Sep 2005
+        # warn "String to be integrated in to '$orig' undefined";
         return $orig;
     }
 

Reply via email to