Permalink
Browse files

Configure system from Brent Dax <brentdax@cpan.org>

git-svn-id: https://svn.parrot.org/parrot/trunk@48 d31e2699-5ff4-0310-a27c-f18f2fbe73fe
  • Loading branch information...
1 parent 75bbcd3 commit 11b744f312f12c9c2487f7b31a0a53f4ae34a6ed @simoncozens simoncozens committed Sep 11, 2001
Showing with 104 additions and 3 deletions.
  1. +93 −0 Configure.pl
  2. +2 −1 MANIFEST
  3. +3 −0 Makefile
  4. +6 −2 config.h → config.h.in
View
@@ -0,0 +1,93 @@
+#!/usr/bin/perl -w
+#so we get -w
+
+#Configre.pl, written by Brent Dax
+
+use strict;
+use Config;
+
+#print the header
+print <<"END";
+Parrot Configure
+Copyright (C) 2001 Yet Another Society
+
+Since you're running this script, you obviously have
+Perl 5--I'll be pulling some defaults from its configuration.
+
+Rules are the same as Perl 5's Configure--defaults are in
+square brackets, and you can hit enter to accept them.
+END
+
+#Some versions don't seem to have ivtype or nvtype--provide
+#defaults for them.
+#XXX Figure out better defaults
+my(%c)=(
+ iv => ($Config{ivtype}||'long'),
+ nv => ($Config{nvtype}||'long double')
+);
+
+#inquire about numeric sizes
+prompt("How big would you like integers to be?", 'iv');
+prompt("How about your floats?", 'nv');
+
+
+print <<"END";
+
+Okay. Now I'm gonna probe Perl 5's configuration to see
+what headers you have around. This could take a bit on slow
+machines...
+END
+
+#set up HAS_HEADER_
+foreach(grep {/^i_/} keys %Config) {
+ $c{headers}.=defineifdef((/^i_(.*)$/));
+}
+
+#now let's assemble the config.h file
+my $config_h;
+{
+ local $/;
+ open(CONFIG_HT, "<config.h.in") or die $!;
+ $config_h=<CONFIG_HT>;
+ close CONFIG_HT;
+}
+
+# ${field} is replaced with $c{field}
+$config_h =~ s/\$\{(\w+)\}/$c{$1}/g;
+
+#write out the config.h file
+open(CONFIG_H, ">config.h");
+print CONFIG_H $config_h;
+close CONFIG_H;
+
+print <<"END";
+
+Okay, we're done!
+You can now use `make test_prog' (or your platform's equivalent to `make')
+to build your Parrot.
+
+Happy Hacking,
+ The Parrot Team
+END
+
+#give us the #define we may need for header X
+sub defineifdef {
+ my $thing=shift;
+
+ if($Config{"i_$thing"}) {
+ return "#define HAS_HEADER_\U$thing\E\n";
+ }
+ else {
+ return "#undef HAS_HEADER_\U$thing\E\n"; #XXX do we want this?
+ }
+}
+
+#prompt for something from the user
+sub prompt {
+ my($message, $field)=(@_);
+ my($input);
+ print "$message [$c{$field}] ";
+ chomp($input=<STDIN>);
+ $c{$field}=$input||$c{$field};
+}
+
View
@@ -1,3 +1,4 @@
+Configure.in
MANIFEST
Makefile
README
@@ -7,7 +8,7 @@ basic_opcodes.ops
build_interp_starter.pl
bytecode.c
bytecode.h
-config.h
+config.h.in
disassemble.pl
docs/opcodes.pod
docs/overview.pod
View
@@ -43,5 +43,8 @@ basic_opcodes.c: basic_opcodes.ops process_opfunc.pl interp_guts.h
op.h: opcode_table make_op_header.pl
perl make_op_header.pl opcode_table > op.h
+config.h: Configure.pl config.h.in
+ perl Configure.pl
+
clean:
rm -f *$(O) *.s basic_opcodes.c interp_guts.h op.h test_prog
View
@@ -6,8 +6,8 @@
#if !defined(PARROT_CONFIG_H_GUARD)
#define PARROT_CONFIG_H_GUARD
-typedef long IV;
-typedef long double NV;
+typedef ${iv} IV;
+typedef ${iv} double NV;
typedef struct _vtable VTABLE;
typedef void DPOINTER;
@@ -24,4 +24,8 @@ typedef void SYNC;
#define MASK_CHUNK_LOW_BITS 0xfffff000
+
+${headers}
+
+
#endif

0 comments on commit 11b744f

Please sign in to comment.