Skip to content
Newer
Older
100644 937 lines (711 sloc) 22 KB
11b744f @simoncozens Configure system from Brent Dax <brentdax@cpan.org>
simoncozens authored
1 #!/usr/bin/perl -w
a3cd162 Build enhancements. Originally to support building shared libraries, …
Gregor N. Purdy authored
2 #
3 # Configure.pl
4 #
5 # $Id$
6 #
7 # Author: Brent Dax
8 #
11b744f @simoncozens Configure system from Brent Dax <brentdax@cpan.org>
simoncozens authored
9
10 use strict;
c1dafb2 @rspier Add './lib' to our @INC because Parrot/* moved.
rspier authored
11 use lib 'lib';
a3cd162 Build enhancements. Originally to support building shared libraries, …
Gregor N. Purdy authored
12
11b744f @simoncozens Configure system from Brent Dax <brentdax@cpan.org>
simoncozens authored
13 use Config;
205f653 @brentdax Win32 compatibility, Configure hints, 5.005 compatibility, MANIFEST c…
brentdax authored
14 use Getopt::Long;
59345b3 @brentdax Fix issues with ivsize and nvsize
brentdax authored
15 use ExtUtils::Manifest qw(manicheck);
6b3e60e Patch from Jason Diamond to make win32 platform stuff work:
Gregor N. Purdy authored
16 use File::Copy;
19fa0d4 @tomhughes Stop Configure trying to make op_info.c and op.h as op_info.c no longer
tomhughes authored
17
a3cd162 Build enhancements. Originally to support building shared libraries, …
Gregor N. Purdy authored
18 use Parrot::BuildUtil;
19
20 #
21 # Read the array and scalar forms of the version.
22 # from the VERSION file.
23 #
24
25 my $parrot_version = parrot_version();
26 my @parrot_version = parrot_version();
27
28
29 #
30 # Handle options:
31 #
32
c15d8e5 Added 'reconfig' make target and corresponding --reconfig option to
Gregor N. Purdy authored
33 my $reconfig = 0;
34
be6f835 Made GCC ever so much pickier.
Dan Sugalski authored
35 my($opt_debugging, $opt_defaults, $opt_version, $opt_help) = (0, 0, 0, 0);
59345b3 @brentdax Fix issues with ivsize and nvsize
brentdax authored
36 my(%opt_defines);
c15d8e5 Added 'reconfig' make target and corresponding --reconfig option to
Gregor N. Purdy authored
37
38 if (@ARGV and $ARGV[0] eq '--reconfig') {
39 print STDERR "Configure.pl: Reconfiguring based on config.opt file...\n";
40 open OPTS, "<config.opt" or die "Can't --reconfig. Could not open config.opt for reading!";
41
42 foreach my $opt (<OPTS>) {
43 chomp $opt;
44
45 if ($opt =~ m/^\s*debugging\s*$/) {
46 $opt_debugging = 1;
47 $opt = 'debugging';
48 }
49 elsif ($opt =~ m/^\s*defaults\s*$/) {
50 $opt_defaults = 1;
51 $opt = 'defaults';
52 }
53 elsif ($opt =~ m/^\s*define\s+(.*)\s*=\s*(.*)\s*$/) {
54 $opt_defines{$1} = $2;
55 $opt = "define $1=$2";
56 }
57 else {
58 die "Unrecognized option in config.opt: '$opt'!";
59 }
60
61 print " $opt\n";
62 }
63
64 close OPTS;
65 $reconfig = 1;
66 }
67
19fa0d4 @tomhughes Stop Configure trying to make op_info.c and op.h as op_info.c no longer
tomhughes authored
68 my $result = GetOptions(
a3cd162 Build enhancements. Originally to support building shared libraries, …
Gregor N. Purdy authored
69 'debugging!' => \$opt_debugging,
70 'defaults!' => \$opt_defaults,
71 'version' => \$opt_version,
72 'help' => \$opt_help,
73 'define=s' => \%opt_defines,
205f653 @brentdax Win32 compatibility, Configure hints, 5.005 compatibility, MANIFEST c…
brentdax authored
74 );
75
59345b3 @brentdax Fix issues with ivsize and nvsize
brentdax authored
76 if($opt_version) {
a3cd162 Build enhancements. Originally to support building shared libraries, …
Gregor N. Purdy authored
77 print "Parrot Version $parrot_version Configure\n";
78 print '$Id$' . "\n";
79 exit;
205f653 @brentdax Win32 compatibility, Configure hints, 5.005 compatibility, MANIFEST c…
brentdax authored
80 }
81
59345b3 @brentdax Fix issues with ivsize and nvsize
brentdax authored
82 if($opt_help) {
a3cd162 Build enhancements. Originally to support building shared libraries, …
Gregor N. Purdy authored
83 print <<"EOT";
205f653 @brentdax Win32 compatibility, Configure hints, 5.005 compatibility, MANIFEST c…
brentdax authored
84 $0 - Parrot Configure
85 Options:
c15d8e5 Added 'reconfig' make target and corresponding --reconfig option to
Gregor N. Purdy authored
86 --reconfig Reconfigure with saved options
205f653 @brentdax Win32 compatibility, Configure hints, 5.005 compatibility, MANIFEST c…
brentdax authored
87 --debugging Enable debugging
88 --defaults Accept all default values
89 --define name=value Defines value name as value
90 --help This text
a3cd162 Build enhancements. Originally to support building shared libraries, …
Gregor N. Purdy authored
91 --version Show version
205f653 @brentdax Win32 compatibility, Configure hints, 5.005 compatibility, MANIFEST c…
brentdax authored
92 EOT
a3cd162 Build enhancements. Originally to support building shared libraries, …
Gregor N. Purdy authored
93 exit;
205f653 @brentdax Win32 compatibility, Configure hints, 5.005 compatibility, MANIFEST c…
brentdax authored
94 }
11b744f @simoncozens Configure system from Brent Dax <brentdax@cpan.org>
simoncozens authored
95
c15d8e5 Added 'reconfig' make target and corresponding --reconfig option to
Gregor N. Purdy authored
96
97 #
98 # If we didn't just reconfig, store the config options out to config.opt.
99 #
100
101 if (!$reconfig) {
102 open OPTS, ">config.opt" or die "Could not open config.opt for writing!";
103 print OPTS "debugging\n" if $opt_debugging;
104 print OPTS "defaults\n" if $opt_defaults;
105 print(OPTS map { sprintf "define %s=%s\n", $_, $opt_defines{$_}; } keys %opt_defines) if %opt_defines;
106 close OPTS;
107 }
108
109
110 #
111 #
112 #
113
1d93957 @simoncozens Configure now generates Makefile
simoncozens authored
114 my($DDOK)=undef;
115 eval {
a3cd162 Build enhancements. Originally to support building shared libraries, …
Gregor N. Purdy authored
116 require Data::Dumper;
117 Data::Dumper->import();
118 $DDOK=1;
1d93957 @simoncozens Configure now generates Makefile
simoncozens authored
119 };
120
a3cd162 Build enhancements. Originally to support building shared libraries, …
Gregor N. Purdy authored
121 #
122 # print the header
123 #
124
11b744f @simoncozens Configure system from Brent Dax <brentdax@cpan.org>
simoncozens authored
125 print <<"END";
a3cd162 Build enhancements. Originally to support building shared libraries, …
Gregor N. Purdy authored
126 Parrot Version $parrot_version Configure
127 Copyright (C) 2001-2002 Yet Another Society
11b744f @simoncozens Configure system from Brent Dax <brentdax@cpan.org>
simoncozens authored
128
129 Since you're running this script, you obviously have
130 Perl 5--I'll be pulling some defaults from its configuration.
131
a3cd162 Build enhancements. Originally to support building shared libraries, …
Gregor N. Purdy authored
132 Checking the MANIFEST to make sure you have a complete Parrot kit...
11b744f @simoncozens Configure system from Brent Dax <brentdax@cpan.org>
simoncozens authored
133 END
134
59345b3 @brentdax Fix issues with ivsize and nvsize
brentdax authored
135 check_manifest();
205f653 @brentdax Win32 compatibility, Configure hints, 5.005 compatibility, MANIFEST c…
brentdax authored
136
a3cd162 Build enhancements. Originally to support building shared libraries, …
Gregor N. Purdy authored
137 #
138 # Some versions don't seem to have ivtype or nvtype--provide
139 # defaults for them.
140 # XXX Figure out better defaults
141 #
88663c9 Initial JIT implementation.
Gregor N. Purdy authored
142
729af11 Attempt to fix Win32 builds.
Gregor N. Purdy authored
143 my ($archname, $cpuarch, $osname);
ee77a0a Both test_parrot (via test_main.c) and the intepreter itself (via
Gregor N. Purdy authored
144 my ($jitarchname, $jitcpuarch, $jitosname, $jitcapable);
88663c9 Initial JIT implementation.
Gregor N. Purdy authored
145
729af11 Attempt to fix Win32 builds.
Gregor N. Purdy authored
146 $archname = $Config{archname};
147 ($cpuarch, $osname) = split('-', $archname);
a3ee23b Fix a warning when there's no - in an architecture
Dan Sugalski authored
148 if (!defined $osname) {
149 ($osname, $cpuarch) = ($cpuarch, "");
150 }
729af11 Attempt to fix Win32 builds.
Gregor N. Purdy authored
151
55f5eb2 Make jitarch calculation not get tripped up by extra components to
Gregor N. Purdy authored
152 $jitarchname = "$cpuarch-$osname";
c43e508 Detect if we can use "objdump".
Daniel Grunblatt authored
153 $jitarchname =~ s/i[456]86/i386/i;
729af11 Attempt to fix Win32 builds.
Gregor N. Purdy authored
154 $jitarchname =~ s/-(net|free|open)bsd$/-bsd/i;
c43e508 Detect if we can use "objdump".
Daniel Grunblatt authored
155 $jitcapable = 0;
ee77a0a Both test_parrot (via test_main.c) and the intepreter itself (via
Gregor N. Purdy authored
156
ae993d1 @rspier Updates related to moving files around
rspier authored
157 if (-e "lib/Parrot/Jit/$jitarchname.pm") {
1cd7751 Use dis intead of objdump.
Daniel Grunblatt authored
158 $jitcapable = 1;
ee77a0a Both test_parrot (via test_main.c) and the intepreter itself (via
Gregor N. Purdy authored
159 }
c43e508 Detect if we can use "objdump".
Daniel Grunblatt authored
160
43a606a This patch allows parrot to mostly-build with tcc. It allows one to skip
Dan Sugalski authored
161 $jitcapable = $opt_defines{jitcapable} if exists $opt_defines{jitcapable};
162
c43e508 Detect if we can use "objdump".
Daniel Grunblatt authored
163 unless($jitcapable){
ee77a0a Both test_parrot (via test_main.c) and the intepreter itself (via
Gregor N. Purdy authored
164 $jitarchname = 'i386-nojit';
165 }
729af11 Attempt to fix Win32 builds.
Gregor N. Purdy authored
166
167 ($jitcpuarch, $jitosname) = split('-', $jitarchname);
88663c9 Initial JIT implementation.
Gregor N. Purdy authored
168
11b744f @simoncozens Configure system from Brent Dax <brentdax@cpan.org>
simoncozens authored
169 my(%c)=(
a3cd162 Build enhancements. Originally to support building shared libraries, …
Gregor N. Purdy authored
170 iv => ($Config{ivtype} || 'long'),
171 intvalsize => undef,
172
173 nv => ($Config{nvtype} || 'double'),
174 numvalsize => undef,
175
176 opcode_t => ($Config{ivtype} || 'long'),
177 longsize => undef,
178
fe31287 This patch adds macros to the config.h file for INTVAL and NUMVAL printf
Dan Sugalski authored
179 intvalfmt => '%ld',
3e12d79 Change NUMVAL_FMT to FLOATVAL_FMT.
Dan Sugalski authored
180 floatvalfmt => '%f',
fe31287 This patch adds macros to the config.h file for INTVAL and NUMVAL printf
Dan Sugalski authored
181
a3cd162 Build enhancements. Originally to support building shared libraries, …
Gregor N. Purdy authored
182 cc => $Config{cc},
183
184 #
185 # ADD C COMPILER FLAGS HERE
186 #
187
188 ccflags => $Config{ccflags},
29678fb Make GCC pickier by default.
Dan Sugalski authored
189 cc_inc => "-I./include",
a3cd162 Build enhancements. Originally to support building shared libraries, …
Gregor N. Purdy authored
190 libs => $Config{libs},
191 cc_debug => '-g',
29678fb Make GCC pickier by default.
Dan Sugalski authored
192 cc_warn => '',
a3cd162 Build enhancements. Originally to support building shared libraries, …
Gregor N. Purdy authored
193 o => '.o', # object files extension
1a991cb Fixes to get things configuring and building on Win32 Native.
Dan Sugalski authored
194 exe => $Config{_exe}, # executable files extension
195 cc_o_out => '-o ', # cc object output file
196 cc_exe_out => '-o ', # cc executable output file (different on Win32)
c81bf80 Makes config's building of the test programs happier.
Dan Sugalski authored
197
198 cc_ldflags => '', # prefix for ldflags (necessary for Win32)
199
200 cc_ldflags => '', # prefix for ldflags (necessary for Win32)
a3cd162 Build enhancements. Originally to support building shared libraries, …
Gregor N. Purdy authored
201
202 ld => $Config{ld},
7ae03f5 Add link flags as separate things
Dan Sugalski authored
203 ldflags => $Config{ldflags},
a3cd162 Build enhancements. Originally to support building shared libraries, …
Gregor N. Purdy authored
204 ld_out => '-o ', # ld output file
205 ld_debug => '', # include debug info in executable
903e423 A few more things are now configable, so we are closer to win32 shared
Gregor N. Purdy authored
206 ld_shared => '-shared',
a3cd162 Build enhancements. Originally to support building shared libraries, …
Gregor N. Purdy authored
207
208 perl => $^X,
f6b381b Fixed linking to use linker.
Dan Sugalski authored
209 test_prog => 'test_parrot',
a3cd162 Build enhancements. Originally to support building shared libraries, …
Gregor N. Purdy authored
210 debugging => $opt_debugging,
211 rm_f => 'rm -f',
a6357f6 Makes cleanup better on non-Unix platforms
Dan Sugalski authored
212 rm_rf => 'rm -rf',
cd97417 Updated 64-bit patch
Dan Sugalski authored
213 stacklow => '(~0xfffu)',
214 intlow => '(~0xfffu)',
215 numlow => '(~0xfffu)',
216 strlow => '(~0xfffu)',
217 pmclow => '(~0xfffu)',
a3cd162 Build enhancements. Originally to support building shared libraries, …
Gregor N. Purdy authored
218 make => $Config{make},
219 make_set_make => $Config{make_set_make},
220
221 platform => $^O,
222
223 cpuarch => $cpuarch,
224 osname => $osname,
225 archname => $archname,
226
227 jitcpuarch => $jitcpuarch,
228 jitosname => $jitosname,
229 jitarchname => $jitarchname,
230 jitcapable => $jitcapable,
7286545 Link jit.o only on supported plataforms
Daniel Grunblatt authored
231 cc_hasjit => '',
232 jit_h => '',
233 jit_struct_h => '',
234 jit_o => '',
a3cd162 Build enhancements. Originally to support building shared libraries, …
Gregor N. Purdy authored
235
236 cp => 'cp',
237 slash => '/',
238
bc2ee1d @brentdax Minor cleanup and enhancements.
brentdax authored
239 VERSION => $parrot_version,
240 MAJOR => $parrot_version[0],
241 MINOR => $parrot_version[1],
242 PATCH => $parrot_version[2],
243 DEVEL => (-e 'DEVELOPING' ? '-devel' : ''),
633d178 It adds a prompt to Configure asking for a list of opcode files
Dan Sugalski authored
244
bc2ee1d @brentdax Minor cleanup and enhancements.
brentdax authored
245 ops => "",
c14863c @brentdax Far more informative panic messages.
brentdax authored
246
247 configdate => scalar localtime,
11b744f @simoncozens Configure system from Brent Dax <brentdax@cpan.org>
simoncozens authored
248 );
249
179a33f Added in a platform-independent quote substitution for the makefiles.
Dan Sugalski authored
250 # What's the platform shell quote character?
3639e32 Minor Windows tweak
Dan Sugalski authored
251 if ($^O eq 'VMS' || $^O =~ /MSWin/i) {
179a33f Added in a platform-independent quote substitution for the makefiles.
Dan Sugalski authored
252 $c{PQ} = '"';
253 } else {
254 $c{PQ} = "'";
255 }
a3cd162 Build enhancements. Originally to support building shared libraries, …
Gregor N. Purdy authored
256
73aa2c3 Get the ccname from either ccname or just cc config var.
Gregor N. Purdy authored
257 #
29678fb Make GCC pickier by default.
Dan Sugalski authored
258 # If using gcc, crank up its warnings as much as possible and make it behave
259 # ansi-ish.
73aa2c3 Get the ccname from either ccname or just cc config var.
Gregor N. Purdy authored
260 #
261 # Some Perl versions put this in Config variable 'ccname', others in 'cc'. We
262 # prefer the former, but accept the latter.
263 #
264
265 my $ccname = $Config{ccname} || $Config{cc};
266
43a606a This patch allows parrot to mostly-build with tcc. It allows one to skip
Dan Sugalski authored
267 # Make one more check before allowing the use of the JIT code.
268 # make sure that their choice of compiler and cflags will allow our JIT's
269 # non-ansi use of function pointers.
270 #
271
7286545 Link jit.o only on supported plataforms
Daniel Grunblatt authored
272 # Add the -DHAS_JIT if we're jitcapable
273 if ($jitcapable) {
d5ea0c2 - Added support for ALPHA, by now linux and bsd.
Daniel Grunblatt authored
274 $c{cc_hasjit} = " -DHAS_JIT -D" . uc $jitcpuarch;
7286545 Link jit.o only on supported plataforms
Daniel Grunblatt authored
275 $c{jit_h} = "\$(INC)/jit.h";
276 $c{jit_struct_h} = "\$(INC)/jit_struct.h";
277 $c{jit_o} = "jit\$(O)";
278 }
29678fb Make GCC pickier by default.
Dan Sugalski authored
279
a3cd162 Build enhancements. Originally to support building shared libraries, …
Gregor N. Purdy authored
280 #
281 # Copy the things from --define foo=bar
282 #
283
5cac2b3 @brentdax Cleaner VMS support, more info for Parrot::Config to remember, more f…
brentdax authored
284 @c{keys %opt_defines}=values %opt_defines;
205f653 @brentdax Win32 compatibility, Configure hints, 5.005 compatibility, MANIFEST c…
brentdax authored
285
a3cd162 Build enhancements. Originally to support building shared libraries, …
Gregor N. Purdy authored
286
287 #
288 # Set up default values
289 #
290
59345b3 @brentdax Fix issues with ivsize and nvsize
brentdax authored
291 my $hints = "hints/" . lc($^O) . ".pl";
292 if(-f $hints) {
a3cd162 Build enhancements. Originally to support building shared libraries, …
Gregor N. Purdy authored
293 local($/);
294 open HINT, "< $hints" or die "Unable to open hints file '$hints'";
295 my $hint = <HINT>;
296 close HINT;
c350c37 Stupid thinko fix
Dan Sugalski authored
297 eval $hint; die "Error in hints file $hints: '$@/$!'" if $@;
205f653 @brentdax Win32 compatibility, Configure hints, 5.005 compatibility, MANIFEST c…
brentdax authored
298 }
299
a3cd162 Build enhancements. Originally to support building shared libraries, …
Gregor N. Purdy authored
300
301 #
302 # Ask questions
303 #
304
1d93957 @simoncozens Configure now generates Makefile
simoncozens authored
305 prompt("What C compiler do you want to use?", 'cc');
205f653 @brentdax Win32 compatibility, Configure hints, 5.005 compatibility, MANIFEST c…
brentdax authored
306 prompt("How about your linker?", 'ld');
1d93957 @simoncozens Configure now generates Makefile
simoncozens authored
307 prompt("What flags would you like passed to your C compiler?", 'ccflags');
7ae03f5 Add link flags as separate things
Dan Sugalski authored
308 prompt("What flags would you like passed to your linker?", 'ldflags');
1d93957 @simoncozens Configure now generates Makefile
simoncozens authored
309 prompt("Which libraries would you like your C compiler to include?", 'libs');
11b744f @simoncozens Configure system from Brent Dax <brentdax@cpan.org>
simoncozens authored
310 prompt("How big would you like integers to be?", 'iv');
205f653 @brentdax Win32 compatibility, Configure hints, 5.005 compatibility, MANIFEST c…
brentdax authored
311 prompt("And your floats?", 'nv');
7af7b70 Changed opcode_t from a union to a configurable type.
Tanton Gibbs authored
312 prompt("What is your native opcode type?", 'opcode_t');
11b744f @simoncozens Configure system from Brent Dax <brentdax@cpan.org>
simoncozens authored
313
633d178 It adds a prompt to Configure asking for a list of opcode files
Dan Sugalski authored
314
315 {
316 my(@ops)=glob("*.ops");
317
318 $c{ops}=join ' ', sort {
319 if ($a eq 'core.ops') { -1 }
320 elsif($b eq 'core.ops') { 1 }
321 else { $a cmp $b }
d676d4c This patch cleans up most of the MSVC-warnings when using warning lev…
Dan Sugalski authored
322 } grep {!/obscure\.ops/ && !/vtable\.ops/} @ops;
633d178 It adds a prompt to Configure asking for a list of opcode files
Dan Sugalski authored
323
324 my $msg;
325
326 chomp($msg=<<"END");
327
328 Now I have to find out what opcode files you would like to compile into your
329 Parrot.
330
331 The following opcode files are available:
332 @ops
333
334 WARNING: Bad Things may happen if the first file on the list isn't core.ops.
335
336 WARNING: These file names will not be checked for spelling, and typing them
337 wrong will force you to run Configure again.
338
339 WARNING: I worry way too much about Configure users.
340
341 Which opcode files would you like?
342 END
343
344 prompt($msg, 'ops');
345 }
346
347
1458b5b Better GCC detection (and version detection) with really cranky
Dan Sugalski authored
348 print <<"END";
349
350 Determining if your C compiler is actually gcc (this could take a while):
351
352 END
353
354 {
355 my %gnuc;
356
357 compiletestc("test_gnuc");
43a606a This patch allows parrot to mostly-build with tcc. It allows one to skip
Dan Sugalski authored
358 %gnuc=eval(runtestc("test_gnuc")) or die "Can't run the test program: $!";
359 cleantestc("test_gnuc");
1458b5b Better GCC detection (and version detection) with really cranky
Dan Sugalski authored
360
361 unless (exists $gnuc{__GNUC__}) {
633d178 It adds a prompt to Configure asking for a list of opcode files
Dan Sugalski authored
362 print <<'END';
1458b5b Better GCC detection (and version detection) with really cranky
Dan Sugalski authored
363
364 The test program didn't give the expected result - assuming your compiler is
365 not gcc.
366
367 END
368
369 } else {
370 my $major = $gnuc{__GNUC__};
371 my $minor = $gnuc{__GNUC_MINOR__};
372 unless (defined $major) {
633d178 It adds a prompt to Configure asking for a list of opcode files
Dan Sugalski authored
373 print <<'END';
1458b5b Better GCC detection (and version detection) with really cranky
Dan Sugalski authored
374
375 Your C compiler is not gcc.
376
377 END
378 } else {
379 print "Your C compiler reports itself as gcc, major version $major";
380 print ", minor version $minor" if defined $minor;
199d784 Fix for non-gcc systems
Dan Sugalski authored
381
382 print ".\n\n";
383 if ($major =~ tr/0-9//c) {
384 print "major version '$major' is not an integer",
385 " - I don't think that this is gcc.";
386 undef $major; # Don't use it
387 }
388 if (defined $minor and $minor =~ tr/0-9//c) {
389 print "minor version '$minor' is not an integer.";
390 undef $minor; # Don't use it
391 }
392 if (defined $major) {
393 $c{gccversion} = $major;
394 $c{gccversion} .= ".$minor" if defined $minor;
395 }
1458b5b Better GCC detection (and version detection) with really cranky
Dan Sugalski authored
396 }
397 }
398 }
399
400 if ($c{gccversion}) {
401 # If using gcc, crank up its warnings as much as possible and make it
402 # behave ansi-ish.
403 # Here's an attempt at a list of nasty things we can use for a given
404 # version of gcc. The earliest documentation I currently have access to is
405 # for 2.95, so I don't know what version everything came in at. If it turns
406 # out that you're using 2.7.2 and -Wfoo isn't recognised there, move it up
407 # into the next version becone (2.8)
408
4535860 I think the optimal fix here is simply to remove -ansi -pedantic.
Dan Sugalski authored
409 # Don't use -ansi -pedantic. It makes it much harder to compile
410 # using the system headers, which may well be tuned to a
411 # non-strict environment -- especially since we are using perl5
412 # compilation flags determined in a non-strict environment.
413 # An example is Solaris 8.
414
1458b5b Better GCC detection (and version detection) with really cranky
Dan Sugalski authored
415 my @opt_and_vers =
b6a6f3e Turns out we were using a warning flag which doesn't exist on
Dan Sugalski authored
416 (0 => "-Wall -Wstrict-prototypes -Wmissing-prototypes -Winline -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -Wconversion -Waggregate-return -Winline -W -Wno-unused",
1458b5b Better GCC detection (and version detection) with really cranky
Dan Sugalski authored
417 # others; ones we might like marked with ?
418 # ? -Wundef for undefined idenfiers in #if
419 # ? -Wbad-function-cast
420 # Warn whenever a function call is cast to a non-matching type
421 # ? -Wmissing-declarations
422 # Warn if a global function is defined without a previous declaration
423 # -Wmissing-noreturn
424 # ? -Wredundant-decls
425 # Warn if anything is declared more than once in the same scope,
426 # ? -Wnested-externs
427 # Warn if an `extern' declaration is encountered within an function.
428 # -Wlong-long
429 # Ha. this is the default! with -pedantic.
430 # -Wno-long-long for the nicest bit of C99
431 2.7 => "",
b6a6f3e Turns out we were using a warning flag which doesn't exist on
Dan Sugalski authored
432 2.8 => "-Wsign-compare",
1458b5b Better GCC detection (and version detection) with really cranky
Dan Sugalski authored
433 2.95 => "",
434 3.0 => "-Wformat-nonliteral -Wformat-security -Wpacked -Wpadded -Wdisabled-optimization",
435 # -Wsequence-point is part of -Wall
436 # -Wfloat-equal may not be what we want
437 # We shouldn't be using __packed__, but I doubt -Wpacked will harm us
438 # -Wpadded may prove interesting, or even noisy.
439 # -Wunreachable-code might be useful in a non debugging version
440 );
a37a105 Add -Wno-shadow, as Darwin's headers can't cope with this. Darwin-only
Dan Sugalski authored
441 my $warns = "";
1458b5b Better GCC detection (and version detection) with really cranky
Dan Sugalski authored
442 while (my ($vers, $opt) = splice @opt_and_vers, 0, 2) {
443 last if $vers > $c{gccversion};
444 next unless $opt; # Ignore blank lines
a37a105 Add -Wno-shadow, as Darwin's headers can't cope with this. Darwin-only
Dan Sugalski authored
445 $warns .= " $opt";
1458b5b Better GCC detection (and version detection) with really cranky
Dan Sugalski authored
446 }
a37a105 Add -Wno-shadow, as Darwin's headers can't cope with this. Darwin-only
Dan Sugalski authored
447 $c{cc_warn} = $warns . " " . $c{cc_warn};
448
1458b5b Better GCC detection (and version detection) with really cranky
Dan Sugalski authored
449 prompt("What gcc warning flags do you want to use?", 'cc_warn');
450 }
a3cd162 Build enhancements. Originally to support building shared libraries, …
Gregor N. Purdy authored
451
452 #
971ed20 Made things a bit more platform-independent. Makefile still
Dan Sugalski authored
453 # Copy the appropriate platform-specific file over
a3cd162 Build enhancements. Originally to support building shared libraries, …
Gregor N. Purdy authored
454 #
455
971ed20 Made things a bit more platform-independent. Makefile still
Dan Sugalski authored
456 if (-e "platforms/$c{platform}.h") {
457 copy("platforms/$c{platform}.h", "include/parrot/platform.h");
458 copy("platforms/$c{platform}.c", "platform.c");
459 }
460 else {
461 copy("platforms/generic.h", "include/parrot/platform.h");
462 copy("platforms/generic.c", "platform.c");
463 }
464
ff7fa37 Force the time on some copied files to be 'now' to make the Win builds
Dan Sugalski authored
465 my $now = time;
466 utime $now, $now, "include/parrot/platform.h", "platform.c";
467
205f653 @brentdax Win32 compatibility, Configure hints, 5.005 compatibility, MANIFEST c…
brentdax authored
468 unless( $c{debugging} ) {
a3cd162 Build enhancements. Originally to support building shared libraries, …
Gregor N. Purdy authored
469 $c{ld_debug} = ' ';
470 $c{cc_debug} = ' ';
205f653 @brentdax Win32 compatibility, Configure hints, 5.005 compatibility, MANIFEST c…
brentdax authored
471 }
11b744f @simoncozens Configure system from Brent Dax <brentdax@cpan.org>
simoncozens authored
472
473 print <<"END";
474
a3cd162 Build enhancements. Originally to support building shared libraries, …
Gregor N. Purdy authored
475 Probing Perl 5's configuration to determine which headers you have (this could
476 take a while on slow machines)...
11b744f @simoncozens Configure system from Brent Dax <brentdax@cpan.org>
simoncozens authored
477 END
478
a3cd162 Build enhancements. Originally to support building shared libraries, …
Gregor N. Purdy authored
479
480 #
481 # Set up HAS_HEADER_
482 #
483
11b744f @simoncozens Configure system from Brent Dax <brentdax@cpan.org>
simoncozens authored
484 foreach(grep {/^i_/} keys %Config) {
a3cd162 Build enhancements. Originally to support building shared libraries, …
Gregor N. Purdy authored
485 $c{$_}=$Config{$_};
486 $c{headers}.=defineifdef((/^i_(.*)$/));
11b744f @simoncozens Configure system from Brent Dax <brentdax@cpan.org>
simoncozens authored
487 }
488
1d93957 @simoncozens Configure now generates Makefile
simoncozens authored
489 print <<"END";
11b744f @simoncozens Configure system from Brent Dax <brentdax@cpan.org>
simoncozens authored
490
a3cd162 Build enhancements. Originally to support building shared libraries, …
Gregor N. Purdy authored
491 Determining C data type sizes by compiling and running a small C program (this
492 could take a while):
493
59345b3 @brentdax Fix issues with ivsize and nvsize
brentdax authored
494 END
495
5cac2b3 @brentdax Cleaner VMS support, more info for Parrot::Config to remember, more f…
brentdax authored
496 {
a3cd162 Build enhancements. Originally to support building shared libraries, …
Gregor N. Purdy authored
497 my %newc;
19fa0d4 @tomhughes Stop Configure trying to make op_info.c and op.h as op_info.c no longer
tomhughes authored
498
a3cd162 Build enhancements. Originally to support building shared libraries, …
Gregor N. Purdy authored
499 buildfile("test_c");
43a606a This patch allows parrot to mostly-build with tcc. It allows one to skip
Dan Sugalski authored
500 compiletestc("test");
501 %newc=eval(runtestc("test")) or die "Can't run the test program: $!";
5cac2b3 @brentdax Cleaner VMS support, more info for Parrot::Config to remember, more f…
brentdax authored
502
a3cd162 Build enhancements. Originally to support building shared libraries, …
Gregor N. Purdy authored
503 @c{keys %newc}=values %newc;
5cac2b3 @brentdax Cleaner VMS support, more info for Parrot::Config to remember, more f…
brentdax authored
504
43a606a This patch allows parrot to mostly-build with tcc. It allows one to skip
Dan Sugalski authored
505 cleantestc("test");
506 unlink('test.c');
4c1a2b9 VMS tweaks
Dan Sugalski authored
507 }
59345b3 @brentdax Fix issues with ivsize and nvsize
brentdax authored
508
509 print <<"END";
510
a3cd162 Build enhancements. Originally to support building shared libraries, …
Gregor N. Purdy authored
511 Figuring out the formats to pass to pack() for the various Parrot internal
512 types...
6fba438 @simoncozens Abstract the argument and opcode packing types and functions out into
simoncozens authored
513 END
514
e5cb406 @brentdax More changes for 64-bit compatibility
brentdax authored
515
a3cd162 Build enhancements. Originally to support building shared libraries, …
Gregor N. Purdy authored
516 #
9a97be1 @simoncozens The Great Renaming.
simoncozens authored
517 # Alas perl5.7.2 doesn't have an INTVAL flag for pack().
6fba438 @simoncozens Abstract the argument and opcode packing types and functions out into
simoncozens authored
518 # The ! modifier only works for perl 5.6.x or greater.
a3cd162 Build enhancements. Originally to support building shared libraries, …
Gregor N. Purdy authored
519 #
520
9a97be1 @simoncozens The Great Renaming.
simoncozens authored
521 foreach ('intvalsize', 'opcode_t_size') {
522 my $which = $_ eq 'intvalsize' ? 'packtype_i' : 'packtype_op';
51ff847 Quad updates.
Dan Sugalski authored
523 my $format;
c499a4e Allow 64-bit build of parrot on systems with a mixed 32/64 bit perl
Dan Sugalski authored
524 if (($] >= 5.006) && ($c{$_} == $c{longsize}) && ($c{$_} == $Config{longsize}) ) {
51ff847 Quad updates.
Dan Sugalski authored
525 $format = 'l!';
e5cb406 @brentdax More changes for 64-bit compatibility
brentdax authored
526 }
527 elsif ($c{$_} == 4) {
51ff847 Quad updates.
Dan Sugalski authored
528 $format = 'l';
e5cb406 @brentdax More changes for 64-bit compatibility
brentdax authored
529 }
d5ea0c2 - Added support for ALPHA, by now linux and bsd.
Daniel Grunblatt authored
530 elsif ($c{$_} == 8 || $Config{use64bitint} eq 'define') {
51ff847 Quad updates.
Dan Sugalski authored
531 # pp_pack is annoying, and this won't work unless sizeof(UV) >= 8
532 $format = 'q';
e5cb406 @brentdax More changes for 64-bit compatibility
brentdax authored
533 }
51ff847 Quad updates.
Dan Sugalski authored
534 die "Configure.pl: Unable to find a suitable packtype for $_.\n"
535 unless $format;
536
537 my $test = eval {pack $format, 0};
538 unless (defined $test) {
539 die <<"AARGH"
540 Configure.pl: Unable to find a functional packtype for $_.
541 '$format' failed: $@
542 AARGH
543 }
544 unless (length $test == $c{$_}) {
545 die sprintf <<"AARGH", $c{$_}, length $test;
546 Configure.pl: Unable to find a functional packtype for $_.
547 Need a format for %d bytes, but '$format' gave %d bytes.
548 AARGH
549 }
550 $c{$which} = $format;
6fba438 @simoncozens Abstract the argument and opcode packing types and functions out into
simoncozens authored
551 }
552
553 $c{packtype_n} = 'd';
554
cd97417 Updated 64-bit patch
Dan Sugalski authored
555 #
556 # Find out what integer constant type we can use
557 # for pointers.
558 #
559
560 print "Figuring out what integer type we can mix with pointers...\n";
561
562 if ($c{intsize} == $c{ptrsize}) {
563 print "We'll use 'unsigned int'.\n";
564 $c{ptrconst} = "u";
565 } elsif ($c{longsize} == $c{ptrsize}) {
566 print "We'll use 'unsigned long'.\n";
567 $c{ptrconst} = "ul";
568 } else {
569 die <<"AARGH";
570 Configure.pl: Unable to find an integer type that fits a pointer.
571 AARGH
572 }
a3cd162 Build enhancements. Originally to support building shared libraries, …
Gregor N. Purdy authored
573
fe31287 This patch adds macros to the config.h file for INTVAL and NUMVAL printf
Dan Sugalski authored
574 #"
575 # Determine format strings for INTVAL and FLOATVAL.
576 #
577
578 if ($c{iv} eq "int") {
579 $c{intvalfmt} = "%d";
580 } elsif (($c{iv} eq "long") || ($c{iv} eq "long int")) {
581 $c{intvalfmt} = "%ld";
582 } elsif (($c{iv} eq "long long") || ($c{iv} eq "long long int")) {
583 $c{intvalfmt} = "%lld";
584 } else {
585 die "Configure.pl: Can't find a printf-style format specifier for type \"$c{iv}\"\n";
586 }
587
588 if ($c{nv} eq "double") {
3e12d79 Change NUMVAL_FMT to FLOATVAL_FMT.
Dan Sugalski authored
589 $c{floatvalfmt} = "%f";
fe31287 This patch adds macros to the config.h file for INTVAL and NUMVAL printf
Dan Sugalski authored
590 } elsif ($c{nv} eq "long double") {
3e12d79 Change NUMVAL_FMT to FLOATVAL_FMT.
Dan Sugalski authored
591 $c{floatvalfmt} = "%lf";
fe31287 This patch adds macros to the config.h file for INTVAL and NUMVAL printf
Dan Sugalski authored
592 } else {
593 die "Configure.pl: Can't find a printf-style format specifier for type \"$c{nv}\"\n";
594 }
595
a3cd162 Build enhancements. Originally to support building shared libraries, …
Gregor N. Purdy authored
596 #
597 # Build config.h, the Makfefiles and Types.pm:
598 #
599 # Also build Parrot/Config.pm
600 #
601
6fba438 @simoncozens Abstract the argument and opcode packing types and functions out into
simoncozens authored
602 print <<"END";
603
a3cd162 Build enhancements. Originally to support building shared libraries, …
Gregor N. Purdy authored
604 Building a preliminary version of include/parrot/config.h, your Makefiles, and
605 other files:
606
1d93957 @simoncozens Configure now generates Makefile
simoncozens authored
607 END
11b744f @simoncozens Configure system from Brent Dax <brentdax@cpan.org>
simoncozens authored
608
62bace3 Committed some files that were missed in the last *.h moving commmit.
Gregor N. Purdy authored
609 buildfile("config_h", "include/parrot");
a3cd162 Build enhancements. Originally to support building shared libraries, …
Gregor N. Purdy authored
610
1d93957 @simoncozens Configure now generates Makefile
simoncozens authored
611 buildfile("Makefile");
133486e (Hopefully the last time...)
Jeff Goff authored
612 buildfile("classes/Makefile");
a6357f6 Makes cleanup better on non-Unix platforms
Dan Sugalski authored
613 buildfile("docs/Makefile");
38f17ac Added a 'languages' target to the top-level Makefile.in, and modified…
Gregor N. Purdy authored
614 buildfile("languages/Makefile");
615 buildfile("languages/jako/Makefile");
04ce4cd Build tweaks.
Dan Sugalski authored
616 buildfile("languages/miniperl/Makefile");
617 buildfile("languages/scheme/Makefile");
a3cd162 Build enhancements. Originally to support building shared libraries, …
Gregor N. Purdy authored
618
ae993d1 @rspier Updates related to moving files around
rspier authored
619 buildfile("Types_pm", "lib/Parrot");
11b744f @simoncozens Configure system from Brent Dax <brentdax@cpan.org>
simoncozens authored
620
a3cd162 Build enhancements. Originally to support building shared libraries, …
Gregor N. Purdy authored
621 buildconfigpm();
43a606a This patch allows parrot to mostly-build with tcc. It allows one to skip
Dan Sugalski authored
622 print "\n";
623
624
625 if ($jitcapable) {
626 print "Verifying that the compiler supports function pointer casts...\n";
627 eval { compiletestc("testparrotfuncptr"); };
628
bc2ee1d @brentdax Minor cleanup and enhancements.
brentdax authored
629 if ($@ || runtestc("testparrotfuncptr") !~ /OK/) {
630 print <<"END";
631 Although it is not required by the ANSI C standard,
632 Parrot requires the ability to cast from void pointers to function
633 pointers for its JIT support.
634
635 Your compiler does not appear to support this behavior with the
636 flags you have specified. You must adjust your settings in order
637 to use the JIT code.
638
639 If you wish to continue without JIT support, please re-run this script
640 With the '--define jitcapable=0' argument.
641 END
43a606a This patch allows parrot to mostly-build with tcc. It allows one to skip
Dan Sugalski authored
642 exit(-1);
643 }
644 cleantestc("testparrotfuncptr");
645 }
a3cd162 Build enhancements. Originally to support building shared libraries, …
Gregor N. Purdy authored
646
647
648 #
649 # And now we figure out how big our things are
650 #
651
9d000b4 Made the changes to figure out mask bits for various register and stack
Dan Sugalski authored
652 print <<"END";
653
a3cd162 Build enhancements. Originally to support building shared libraries, …
Gregor N. Purdy authored
654 Checking some things by compiling and running another small C program (this
655 could take a while):
656
9d000b4 Made the changes to figure out mask bits for various register and stack
Dan Sugalski authored
657 END
658
659 {
a3cd162 Build enhancements. Originally to support building shared libraries, …
Gregor N. Purdy authored
660 my %newc;
19fa0d4 @tomhughes Stop Configure trying to make op_info.c and op.h as op_info.c no longer
tomhughes authored
661
a3cd162 Build enhancements. Originally to support building shared libraries, …
Gregor N. Purdy authored
662 open NEEDED, ">include/parrot/vtable.h";
cf0e967 @simoncozens Make lcc happier by adding a dummy structure.
simoncozens authored
663 print NEEDED "/* dummy */ struct _vtable { int a; };\n";
a3cd162 Build enhancements. Originally to support building shared libraries, …
Gregor N. Purdy authored
664 close NEEDED;
bc2ee1d @brentdax Minor cleanup and enhancements.
brentdax authored
665
a3cd162 Build enhancements. Originally to support building shared libraries, …
Gregor N. Purdy authored
666 buildfile("testparrotsizes_c");
667 compiletestc("testparrotsizes");
bc2ee1d @brentdax Minor cleanup and enhancements.
brentdax authored
668
43a606a This patch allows parrot to mostly-build with tcc. It allows one to skip
Dan Sugalski authored
669 %newc=eval(runtestc("testparrotsizes"))
670 or die "Can't run the test program: $!";
bc2ee1d @brentdax Minor cleanup and enhancements.
brentdax authored
671
a3cd162 Build enhancements. Originally to support building shared libraries, …
Gregor N. Purdy authored
672 @c{keys %newc}=values %newc;
9d000b4 Made the changes to figure out mask bits for various register and stack
Dan Sugalski authored
673
a3cd162 Build enhancements. Originally to support building shared libraries, …
Gregor N. Purdy authored
674 @c{qw(stacklow intlow numlow strlow pmclow)} = lowbitmask(@c{qw(stackchunk iregchunk nregchunk sregchunk pregchunk)});
9d000b4 Made the changes to figure out mask bits for various register and stack
Dan Sugalski authored
675
43a606a This patch allows parrot to mostly-build with tcc. It allows one to skip
Dan Sugalski authored
676 cleantestc("testparrotsizes");
bc2ee1d @brentdax Minor cleanup and enhancements.
brentdax authored
677
43a606a This patch allows parrot to mostly-build with tcc. It allows one to skip
Dan Sugalski authored
678 unlink('testparrotsizes.c');
bc2ee1d @brentdax Minor cleanup and enhancements.
brentdax authored
679
a3cd162 Build enhancements. Originally to support building shared libraries, …
Gregor N. Purdy authored
680 unlink("include/parrot/vtable.h");
9d000b4 Made the changes to figure out mask bits for various register and stack
Dan Sugalski authored
681 }
682
a3cd162 Build enhancements. Originally to support building shared libraries, …
Gregor N. Purdy authored
683
684 #
685 # Rewrite the config file with the updated info
686 #
687
688 print <<"END";
689
690 Updating include/parrot/config.h:
691
692 END
693
9d000b4 Made the changes to figure out mask bits for various register and stack
Dan Sugalski authored
694 buildfile("config_h", "include/parrot");
695
083fd66 Nuke all object files in the parrot tree that matter when configuring.
Dan Sugalski authored
696 # Toss old .o files
697 foreach my $dir ("./", "classes/", "encodings/", "chartypes/") {
698 foreach my $file (glob($dir . "*". $c{o})) {
699 1 while unlink $file;
700 }
701 }
702
a3cd162 Build enhancements. Originally to support building shared libraries, …
Gregor N. Purdy authored
703
704 #
705 # Wrap up:
706 #
707
11b744f @simoncozens Configure system from Brent Dax <brentdax@cpan.org>
simoncozens authored
708 print <<"END";
709
710 Okay, we're done!
a3cd162 Build enhancements. Originally to support building shared libraries, …
Gregor N. Purdy authored
711
712 You can now use `make' (or your platform's equivalent to `make') to build your
713 Parrot. After that, you can use `make test' to run the test suite.
11b744f @simoncozens Configure system from Brent Dax <brentdax@cpan.org>
simoncozens authored
714
715 Happy Hacking,
a3cd162 Build enhancements. Originally to support building shared libraries, …
Gregor N. Purdy authored
716
717 The Parrot Team
718
11b744f @simoncozens Configure system from Brent Dax <brentdax@cpan.org>
simoncozens authored
719 END
720
a3cd162 Build enhancements. Originally to support building shared libraries, …
Gregor N. Purdy authored
721 exit(0);
722
723
724 ###############################################################################
725 ###############################################################################
726 ##
727 ## Support Subroutines
728 ##
729 ###############################################################################
730 ###############################################################################
731
732
733 #
734 # defineifdef()
735 #
736 # Give us the #define we may need for header X
737 #
738
11b744f @simoncozens Configure system from Brent Dax <brentdax@cpan.org>
simoncozens authored
739 sub defineifdef {
a3cd162 Build enhancements. Originally to support building shared libraries, …
Gregor N. Purdy authored
740 my $thing=shift;
741
742 if($Config{"i_$thing"}) {
743 return "#define HAS_HEADER_\U$thing\E\n";
744 }
745 else {
746 return "#undef HAS_HEADER_\U$thing\E\n"; #XXX do we want this?
747 }
11b744f @simoncozens Configure system from Brent Dax <brentdax@cpan.org>
simoncozens authored
748 }
749
a3cd162 Build enhancements. Originally to support building shared libraries, …
Gregor N. Purdy authored
750
751 #
752 # prompt()
753 #
754 # Prompt for something from the user.
755 #
756
11b744f @simoncozens Configure system from Brent Dax <brentdax@cpan.org>
simoncozens authored
757 sub prompt {
a3cd162 Build enhancements. Originally to support building shared libraries, …
Gregor N. Purdy authored
758 return if $opt_defaults;
205f653 @brentdax Win32 compatibility, Configure hints, 5.005 compatibility, MANIFEST c…
brentdax authored
759
a3cd162 Build enhancements. Originally to support building shared libraries, …
Gregor N. Purdy authored
760 my($message, $field)=(@_);
761 my($input);
762 print "$message [$c{$field}] ";
763 chomp($input=<STDIN>);
633d178 It adds a prompt to Configure asking for a list of opcode files
Dan Sugalski authored
764
71472c5 @simoncozens Gobble the + before catenating.
simoncozens authored
765 if($input =~ s/^\+//) {
fd337a3 @brentdax Fixes the + thing in prompts, plus adds a synonym (:add{foo}) and a n…
brentdax authored
766 $input="$c{$field} $input";
767 }
768 else {
769 if($input =~ s/:rem\{(.*?)\}//) {
770 $c{$field} =~ s/$_//g for split / /, $1;
771 }
772
773 if($input =~ s/:add\{(.*?)\}//) {
774 $input="$c{$field} $1 $input";
775 }
776 }
777
778 $c{$field}=$input||$c{$field};
633d178 It adds a prompt to Configure asking for a list of opcode files
Dan Sugalski authored
779
fd337a3 @brentdax Fixes the + thing in prompts, plus adds a synonym (:add{foo}) and a n…
brentdax authored
780 print "$field=$c{$field}\n";
11b744f @simoncozens Configure system from Brent Dax <brentdax@cpan.org>
simoncozens authored
781 }
782
a3cd162 Build enhancements. Originally to support building shared libraries, …
Gregor N. Purdy authored
783
784 #
785 # buildfile()
786 #
787
1d93957 @simoncozens Configure now generates Makefile
simoncozens authored
788 sub buildfile {
a3cd162 Build enhancements. Originally to support building shared libraries, …
Gregor N. Purdy authored
789 my($source_filename, $path)=@_;
790 $path||='.';
791
792 my $target_filename = $source_filename;
793 $target_filename =~ s/_/./; #config_h => config.h
1d93957 @simoncozens Configure now generates Makefile
simoncozens authored
794
a3cd162 Build enhancements. Originally to support building shared libraries, …
Gregor N. Purdy authored
795 printf " Building %-30s from %s...\n", "$path/$target_filename",
796 "$source_filename.in";
1d93957 @simoncozens Configure now generates Makefile
simoncozens authored
797
a3cd162 Build enhancements. Originally to support building shared libraries, …
Gregor N. Purdy authored
798 local $/;
799 open(IN, "<$source_filename.in") or die "Can't open $source_filename.in: $!";
800 my $text=<IN>;
801 close(IN) or die "Can't close $source_filename.in: $!";
1d93957 @simoncozens Configure now generates Makefile
simoncozens authored
802
a3cd162 Build enhancements. Originally to support building shared libraries, …
Gregor N. Purdy authored
803 $text =~ s/\$\{(\w+)\}/$c{$1}/g;
f2133f9 Minor Win32 tweaks. Tossed -Wtraditional, too
Dan Sugalski authored
804 $text =~ s/\cM//g; # Potental drek on Win32
a3cd162 Build enhancements. Originally to support building shared libraries, …
Gregor N. Purdy authored
805 open(OUT, ">$path/$target_filename") or die "Can't open $path/$target_filename: $!";
806 print OUT $text;
807 close(OUT) or die "Can't close $target_filename: $!";
1d93957 @simoncozens Configure now generates Makefile
simoncozens authored
808 }
809
a3cd162 Build enhancements. Originally to support building shared libraries, …
Gregor N. Purdy authored
810
811 #
812 # buildconfigpm()
813 #
814
1d93957 @simoncozens Configure now generates Makefile
simoncozens authored
815 sub buildconfigpm {
a3cd162 Build enhancements. Originally to support building shared libraries, …
Gregor N. Purdy authored
816 unless($DDOK) {
817 print <<"END";
1d93957 @simoncozens Configure now generates Makefile
simoncozens authored
818
819 Your system doesn't have Data::Dumper installed, so I couldn't
820 build Parrot::Config. If you want Parrot::Config installed,
821 use CPAN.pm to install Data::Dumper and run this script again.
822 END
823
a3cd162 Build enhancements. Originally to support building shared libraries, …
Gregor N. Purdy authored
824 return;
825 }
826
ae993d1 @rspier Updates related to moving files around
rspier authored
827 printf " Building %-30s from %s...\n", "lib/Parrot/Config.pm",
a3cd162 Build enhancements. Originally to support building shared libraries, …
Gregor N. Purdy authored
828 "Config_pm.in";
1d93957 @simoncozens Configure now generates Makefile
simoncozens authored
829
a3cd162 Build enhancements. Originally to support building shared libraries, …
Gregor N. Purdy authored
830 my %C=%c;
831 delete $C{headers};
832 my $dd=new Data::Dumper([\%C]);
833 $dd->Names(['*PConfig']);
1d93957 @simoncozens Configure now generates Makefile
simoncozens authored
834
a3cd162 Build enhancements. Originally to support building shared libraries, …
Gregor N. Purdy authored
835 local $/;
836 open(IN, "<Config_pm.in") or die "Can't open Config_pm.in: $!";
837 my $text=<IN>;
838 close(IN) or die "Can't close Config.pm_in: $!";
1d93957 @simoncozens Configure now generates Makefile
simoncozens authored
839
a3cd162 Build enhancements. Originally to support building shared libraries, …
Gregor N. Purdy authored
840 $text =~ s/#DUMPER OUTPUT HERE/$dd->Dump()/eg;
1d93957 @simoncozens Configure now generates Makefile
simoncozens authored
841
ae993d1 @rspier Updates related to moving files around
rspier authored
842 open(OUT, ">lib/Parrot/Config.pm") or die "Can't open file lib/Parrot/Config.pm: $!";
a3cd162 Build enhancements. Originally to support building shared libraries, …
Gregor N. Purdy authored
843 print OUT $text;
ae993d1 @rspier Updates related to moving files around
rspier authored
844 close(OUT) or die "Can't close file lib/Parrot/Config.pm: $!";
1d93957 @simoncozens Configure now generates Makefile
simoncozens authored
845 }
205f653 @brentdax Win32 compatibility, Configure hints, 5.005 compatibility, MANIFEST c…
brentdax authored
846
a3cd162 Build enhancements. Originally to support building shared libraries, …
Gregor N. Purdy authored
847
848 #
849 # check_manifest()
850 #
851
205f653 @brentdax Win32 compatibility, Configure hints, 5.005 compatibility, MANIFEST c…
brentdax authored
852 sub check_manifest {
a3cd162 Build enhancements. Originally to support building shared libraries, …
Gregor N. Purdy authored
853 print "\n";
205f653 @brentdax Win32 compatibility, Configure hints, 5.005 compatibility, MANIFEST c…
brentdax authored
854
a3cd162 Build enhancements. Originally to support building shared libraries, …
Gregor N. Purdy authored
855 my(@missing)=manicheck();
59345b3 @brentdax Fix issues with ivsize and nvsize
brentdax authored
856
a3cd162 Build enhancements. Originally to support building shared libraries, …
Gregor N. Purdy authored
857 if(@missing) {
858 print <<"END";
205f653 @brentdax Win32 compatibility, Configure hints, 5.005 compatibility, MANIFEST c…
brentdax authored
859
860 Ack, some files were missing! I can't continue running
19fa0d4 @tomhughes Stop Configure trying to make op_info.c and op.h as op_info.c no longer
tomhughes authored
861 without everything here. Please try to find the above
205f653 @brentdax Win32 compatibility, Configure hints, 5.005 compatibility, MANIFEST c…
brentdax authored
862 files and then try running Configure again.
59345b3 @brentdax Fix issues with ivsize and nvsize
brentdax authored
863
205f653 @brentdax Win32 compatibility, Configure hints, 5.005 compatibility, MANIFEST c…
brentdax authored
864 END
59345b3 @brentdax Fix issues with ivsize and nvsize
brentdax authored
865
07a9afe @simoncozens Die on broken manifest.
simoncozens authored
866 exit 1;
a3cd162 Build enhancements. Originally to support building shared libraries, …
Gregor N. Purdy authored
867 }
868 else {
869 print <<"END";
19fa0d4 @tomhughes Stop Configure trying to make op_info.c and op.h as op_info.c no longer
tomhughes authored
870 Okay, we found everything. Next you'll need to answer
633d178 It adds a prompt to Configure asking for a list of opcode files
Dan Sugalski authored
871 a few questions about your system. Defaults are in square
872 brackets, and you can hit enter to accept them. If you
873 don't want the default, type a new value in. If that new
874 value starts with a '+', it will be concatenated to the
875 default value.
205f653 @brentdax Win32 compatibility, Configure hints, 5.005 compatibility, MANIFEST c…
brentdax authored
876
877 END
a3cd162 Build enhancements. Originally to support building shared libraries, …
Gregor N. Purdy authored
878 }
62bace3 Committed some files that were missed in the last *.h moving commmit.
Gregor N. Purdy authored
879 }
5cac2b3 @brentdax Cleaner VMS support, more info for Parrot::Config to remember, more f…
brentdax authored
880
a3cd162 Build enhancements. Originally to support building shared libraries, …
Gregor N. Purdy authored
881
882 #
883 # compiletestc()
884 #
885
5cac2b3 @brentdax Cleaner VMS support, more info for Parrot::Config to remember, more f…
brentdax authored
886 sub compiletestc {
43a606a This patch allows parrot to mostly-build with tcc. It allows one to skip
Dan Sugalski authored
887 my ($name) = @_;
888
d0e4aeb this patch adds support for the freely availabe borland c++ 5.5.1 com…
Dan Sugalski authored
889 my $cmd = "$c{cc} $c{ccflags} -I./include -c $c{ld_out}$name$c{o} $name.c";
43a606a This patch allows parrot to mostly-build with tcc. It allows one to skip
Dan Sugalski authored
890 system($cmd) and die "C compiler died! Command was '$cmd'\n";
891
8f7c169 @simoncozens Placate Tru64.
simoncozens authored
892 $cmd = "$c{ld} $c{ldflags} $name$c{o} $c{cc_exe_out}$name$c{exe} $c{libs}";
43a606a This patch allows parrot to mostly-build with tcc. It allows one to skip
Dan Sugalski authored
893 system($cmd) and die "Linker died! Command was '$cmd'\n";
5cac2b3 @brentdax Cleaner VMS support, more info for Parrot::Config to remember, more f…
brentdax authored
894 }
895
a3cd162 Build enhancements. Originally to support building shared libraries, …
Gregor N. Purdy authored
896
897 #
898 # runtestc()
899 #
900
5cac2b3 @brentdax Cleaner VMS support, more info for Parrot::Config to remember, more f…
brentdax authored
901 sub runtestc {
43a606a This patch allows parrot to mostly-build with tcc. It allows one to skip
Dan Sugalski authored
902 my ($name) = @_;
903
904 my $cmd = "$name$c{exe}";
905 `./$cmd`;
9d000b4 Made the changes to figure out mask bits for various register and stack
Dan Sugalski authored
906 }
907
43a606a This patch allows parrot to mostly-build with tcc. It allows one to skip
Dan Sugalski authored
908 #
909 # cleantestc
910 #
911
912 sub cleantestc {
913 my ($name) = @_;
914
bc2ee1d @brentdax Minor cleanup and enhancements.
brentdax authored
915 unlink(grep {!/\.c$/} glob("$name.*"));