simon 01/09/11 02:44:01
Modified: . MANIFEST Makefile
Added: . Configure.pl config.h.in
Removed: . config.h
Log:
Configure system from Brent Dax <[EMAIL PROTECTED]>
Revision Changes Path
1.5 +2 -1 parrot/MANIFEST
Index: MANIFEST
===================================================================
RCS file: /home/perlcvs/parrot/MANIFEST,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -w -r1.4 -r1.5
--- MANIFEST 2001/09/10 22:20:36 1.4
+++ MANIFEST 2001/09/11 09:43:59 1.5
@@ -1,3 +1,4 @@
+Configure.in
MANIFEST
Makefile
README
@@ -7,7 +8,7 @@
build_interp_starter.pl
bytecode.c
bytecode.h
-config.h
+config.h.in
disassemble.pl
docs/opcodes.pod
docs/overview.pod
1.7 +3 -0 parrot/Makefile
Index: Makefile
===================================================================
RCS file: /home/perlcvs/parrot/Makefile,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -w -r1.6 -r1.7
--- Makefile 2001/09/10 21:26:08 1.6
+++ Makefile 2001/09/11 09:44:00 1.7
@@ -43,5 +43,8 @@
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
1.1 parrot/Configure.pl
Index: Configure.pl
===================================================================
#!/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};
}
1.1 parrot/config.h.in
Index: config.h.in
===================================================================
/* config.h
*
* Platform-specific config file
*
*/
#if !defined(PARROT_CONFIG_H_GUARD)
#define PARROT_CONFIG_H_GUARD
typedef ${iv} IV;
typedef ${iv} double NV;
typedef struct _vtable VTABLE;
typedef void DPOINTER;
typedef void SYNC;
//typedef IV *(*opcode_funcs)(void *, void *) OPFUNC;
#define FRAMES_PER_CHUNK 16
#define FRAMES_PER_PMC_REG_CHUNK FRAMES_PER_CHUNK
#define FRAMES_PER_NUM_REG_CHUNK FRAMES_PER_CHUNK
#define FRAMES_PER_INT_REG_CHUNK FRAMES_PER_CHUNK
#define FRAMES_PER_STR_REG_CHUNK FRAMES_PER_CHUNK
#define MASK_CHUNK_LOW_BITS 0xfffff000
${headers}
#endif