Here's a patch to include a 'myconfig' script in the parrot distribution,
similar to the one in perl5's distribution.  The output looks something
like:

Summary of my parrot configuration:
  Platform where perl 5.007002 was built:
    osname=linux, osvers=2.2.17, archname=sparc64-linux-64int
    uname=linux dendrite 2.2.17 #1 tue jul 4 14:22:29 edt 2000 sparc64 unknown 
    byteorder=87654321
  Compiler:
    cc=cc, ccflags=-fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE 
-D_FILE_OFFSET_BITS=64 -I./include
    debugging=0
    intvalsize=8,    packtype_i=q,  intval=long long
    numvalsize=8,    packtype_n=d,  numval=double
    opcode_t_size=8, packtype_op=q, opcode_t=long long
  Linker and Libraries:
    ld=cc
    libs=-lnsl -lndbm -lgdbm -ldbm -ldb -ldl -lm -lc -lposix -lcrypt -lutil



Here's the patch.  Note that I changed Configure.pl and test_c.in to use
the new names 'intval' and 'numval' so that they are reported correctly in
the myconfig output.

The strange structure is so that it works as perl5's myconfig works.  It's
a script, so running ./myconfig works.  It's also a plain text file that
can be mailed and contains the same information.

diff -r -N -u parrot/Configure.pl parrot-andy/Configure.pl
--- parrot/Configure.pl Tue Oct  2 10:01:30 2001
+++ parrot-andy/Configure.pl    Wed Oct  3 16:54:43 2001
@@ -61,10 +61,10 @@
 #defaults for them.
 #XXX Figure out better defaults
 my(%c)=(
-       iv =>                   ($Config{ivtype}   ||'long'),
+       intval =>                       ($Config{ivtype}   ||'long'),
        intvalsize =>       undef,
     
-       nv =>                   ($Config{nvtype}   ||'double'),
+       numval =>                       ($Config{nvtype}   ||'double'),
        numvalsize =>       undef,
 
        opcode_t =>             ($Config{ivtype}   ||'long'),
@@ -105,8 +105,8 @@
 prompt("How about your linker?", 'ld');
 prompt("What flags would you like passed to your C compiler?", 'ccflags');
 prompt("Which libraries would you like your C compiler to include?", 'libs');
-prompt("How big would you like integers to be?", 'iv');
-prompt("And your floats?", 'nv');
+prompt("How big would you like integers to be?", 'intval');
+prompt("And your floats?", 'numval');
 prompt("What is your native opcode type?", 'opcode_t');
 
 unless( $c{debugging} ) {
@@ -182,6 +182,11 @@
 buildconfigpm();
 # and the types file
 buildfile("Types_pm", "Parrot");
+# and ./myconfig
+# This should perhaps be changed into some sort of myconfig_in file to fit in
+# with the rest of the Configure.pl scheme.
+do 'myconfig.PL' or warn("Error generating myconfig.");
+
 
 print <<"END";
 
diff -r -N -u parrot/MANIFEST parrot-andy/MANIFEST
--- parrot/MANIFEST     Sun Sep 30 16:25:22 2001
+++ parrot-andy/MANIFEST        Wed Oct  3 16:54:43 2001
@@ -49,6 +49,7 @@
 little_languages/jakoc
 make_op_header.pl
 memory.c
+myconfig.PL
 opcheck.pl
 opcode_table
 packfile.c
diff -r -N -u parrot/Makefile.in parrot-andy/Makefile.in
--- parrot/Makefile.in  Mon Oct  1 18:00:23 2001
+++ parrot-andy/Makefile.in     Wed Oct  3 16:56:07 2001
@@ -69,6 +69,7 @@
 
 clean:
        $(RM_F) *$(O) *.s basic_opcodes.c $(INC)/interp_guts.h $(INC)/op.h $(TEST_PROG)
+       $(RM_F) myconfig
 
 test:
        $(PERL) t/harness
diff -r -N -u parrot/config_h.in parrot-andy/config_h.in
--- parrot/config_h.in  Tue Oct  2 10:01:30 2001
+++ parrot-andy/config_h.in     Wed Oct  3 16:54:43 2001
@@ -6,8 +6,8 @@
 
 #if !defined(PARROT_CONFIG_H_GUARD)
 #define PARROT_CONFIG_H_GUARD 
-typedef ${iv} INTVAL;
-typedef ${nv} FLOATVAL;
+typedef ${intval} INTVAL;
+typedef ${numval} FLOATVAL;
 
 typedef ${opcode_t} opcode_t;
 
diff -r -N -u parrot/myconfig.PL parrot-andy/myconfig.PL
--- parrot/myconfig.PL  Wed Dec 31 19:00:00 1969
+++ parrot-andy/myconfig.PL     Wed Oct  3 16:55:04 2001
@@ -0,0 +1,55 @@
+#!/usr/local/bin/perl -w
+use strict;
+use Parrot::Config;
+use Config;
+
+my $file = "myconfig";
+open OUT,">$file" or die "Can't create $file: $!";
+print "Extracting $file (with variable substitutions)\n";
+
+print OUT <<"!GROK!THIS!";
+$Config{'startperl'} -w
+    eval 'exec perl -S \$0 "\$@"'
+       if 0;
+!GROK!THIS!
+print OUT <<'NO_SUBS';
+# This script is designed to provide a handy summary of the configuration
+# information being used to build parrot.
+
+# XXX System ID stuff we grab from perl's Configure.  (Note this describes
+# where this perl was built.  It might well have been built on a different
+# system.  Better eventually to determine this sort of stuff during
+# parrot's configuration.)
+
+# XXX Note that the text lines /^Summary of/ .. /^\s*\$/ should perhaps
+# be copied into Parrot::Config.pm, analagously to the way it's done
+# in perl5.
+
+use strict;
+use Parrot::Config;
+use Config;  # Perl5's Config.
+
+NO_SUBS
+
+print OUT <<"!GROK!THIS!";
+print <<'NO_SUBS';
+Summary of my parrot configuration:
+  Platform where perl $] was built:
+    osname=$Config{osname}, osvers=$Config{osvers}, archname=$Config{archname}
+    uname=$Config{myuname}
+    byteorder=$Config{byteorder}
+  Compiler:
+    cc=$PConfig{cc}, ccflags=$PConfig{ccflags}
+    debugging=$PConfig{debugging}
+    intvalsize=$PConfig{intvalsize},    packtype_i=$PConfig{packtype_i},  
+intval=$PConfig{intval}
+    numvalsize=$PConfig{numvalsize},    packtype_n=$PConfig{packtype_n},  
+numval=$PConfig{numval}
+    opcode_t_size=$PConfig{opcode_t_size}, packtype_op=$PConfig{packtype_op}, 
+opcode_t=$PConfig{opcode_t}
+  Linker and Libraries:
+    ld=$PConfig{ld}
+    libs=$PConfig{libs}
+
+NO_SUBS
+!GROK!THIS!
+
+close OUT or die "Can't close $file: $!";
+chmod 0755, $file or die "Can't reset permissions for $file: $!\n";
diff -r -N -u parrot/test_c.in parrot-andy/test_c.in
--- parrot/test_c.in    Mon Oct  1 17:50:59 2001
+++ parrot-andy/test_c.in       Wed Oct  3 16:54:43 2001
@@ -9,7 +9,7 @@
 
 int main(int argc, char **argv) {
        printf("%d/%d/%d/%d", 
-           sizeof(${iv}), sizeof(long), sizeof(${nv}), sizeof(${opcode_t}));
+           sizeof(${intval}), sizeof(long), sizeof(${numval}), sizeof(${opcode_t}));
        return 0;
 }
 


 -- 
    Andy Dougherty              [EMAIL PROTECTED]
    Dept. of Physics
    Lafayette College, Easton PA 18042

Reply via email to