I've modified Configure.pl to take defaults from a previous build (if
there was one).  This should play nicely with hints, and '--defaults'
by doing the Right Thing.  I've added a '--nopolicy' option to disable
this.

Patch below sig.

Alex Gough
-- 
W.W- "A little nonsense now and then is relished by the wisest men."

##########
Index: Configure.pl
===================================================================
RCS file: /home/perlcvs/parrot/Configure.pl,v
retrieving revision 1.23
diff -u -r1.23 Configure.pl
--- Configure.pl        2001/10/04 20:19:38     1.23
+++ Configure.pl        2001/10/06 14:07:16
@@ -8,9 +8,11 @@
 use Getopt::Long;
 use ExtUtils::Manifest qw(manicheck);
  
-my($opt_debugging, $opt_defaults, $opt_version, $opt_help) = (0, 0, 0, 0);
+my($opt_debugging, $opt_defaults, $opt_version,
+   $opt_help, $opt_nopolicy) = (0) x 5;
 my(%opt_defines);
 my $result = GetOptions( 
+       'nopolicy'     => \$opt_nopolicy,
        'debugging!' => \$opt_debugging,
        'defaults!'  => \$opt_defaults,
        'version'    => \$opt_version,
@@ -29,6 +31,7 @@
 Options:
    --debugging          Enable debugging
    --defaults           Accept all default values
+   --nopolicy           Do not take values from previous build
    --define name=value  Defines value name as value
    --help               This text
    --version            Show assembler version
@@ -60,25 +63,39 @@
 #Some versions don't seem to have ivtype or nvtype--provide 
 #defaults for them.
 #XXX Figure out better defaults
+my %policy;
+unless ($opt_nopolicy) {
+    eval '
+       require Parrot::Config;
+       %policy = %Parrot::Config::PConfig;
+    ';
+    if ($@) {
+       print "No policy available, using defaults\n";
+    }
+    else {
+       print "Using defaults from earlier build\n";
+       $policy{__have_policy} = 1;
+    }
+}
 my(%c)=(
-       iv =>                   ($Config{ivtype}   ||'long'),
+       iv =>          ($policy{ivtype} || $Config{ivtype}   ||'long'),
        intvalsize =>       undef,
     
-       nv =>                   ($Config{nvtype}   ||'double'),
+       nv =>          ($policy{nvtype} || $Config{nvtype}   ||'double'),
        numvalsize =>       undef,
 
-       opcode_t =>             ($Config{ivtype}   ||'long'),
+       opcode_t =>    ($policy{ivtype} || $Config{ivtype}   ||'long'),
        longsize =>             undef,
     
-       cc =>                   $Config{cc},
+       cc =>          ($policy{cc} || $Config{cc}),
        #ADD C COMPILER FLAGS HERE
-       ccflags =>              $Config{ccflags}." -I./include",
-       libs =>                 $Config{libs},
+       ccflags =>     ($policy{ccflags}||$Config{ccflags}." -I./include"),
+       libs =>        ($policy{libs}   ||$Config{libs}),
        cc_debug =>             '-g',
        o =>                    '.o',           # object files extension
-       exe =>                  $Config{_exe},
+       exe =>         ($policy{exe} || $Config{_exe}),
 
-       ld =>                   $Config{ld},
+       ld =>          ($policy{ld}  || $Config{ld}),
        ld_out =>               '-o ',          # ld output file
        ld_debug =>     '',                     # include debug info in executable
 
@@ -91,8 +108,9 @@
 @c{keys %opt_defines}=@opt_defines{keys %opt_defines};
 
 # set up default values
+# don't need these if previously complied, can take from Parrot::Config
 my $hints = "hints/" . lc($^O) . ".pl";
-if(-f $hints) {
+if(!$policy{__have_policy} && -f $hints) {
        local($/);
        open HINT, "< $hints" or die "Unable to open hints file '$hints'";
        my $hint = <HINT>;

Reply via email to