* src/inter_call.c:
[parrot.git] / Configure.pl
blobe3622fab4120cc7517418ab93f3075e4cd0f6e88
1 #! perl -w
2 # Copyright: 2001-2006 The Perl Foundation. All Rights Reserved.
3 # $Id$
5 =head1 NAME
7 Configure.pl - Parrot's Configuration Script
9 =head1 SYNOPSIS
11 % perl Configure.pl [options]
13 =head1 DESCRIPTION
15 This is Parrot's configuration script. It should be run to create the necessary
16 system-specific files before building Parrot.
18 =head2 Command-line Options
20 General Options
22 =over
24 =item C<--help>
26 Prints out a description of the options and exits.
28 =item C<--version>
30 Prints out the version number of Configure.pl and exits.
32 =item C<--verbose>
34 Tells Configure.pl to output extra information about the configuration data it
35 is setting.
37 =item C<--verbose=2>
39 Tells Configure.pl to output information about i<every> setting added or
40 changed.
42 =item C<--verbose-step={N|regex}>
44 Run C<--verbose=2> for step number C<N> or matching description.
46 =item C<--nomanicheck>
48 Tells Configure.pl not to run the MANIFEST check.
50 =item C<--prefix>
52 Sets the location where parrot will be installed.
54 =item C<--ask>
56 This turns on the user prompts.
58 =back
60 Compile Options
62 =over
64 =item C<--debugging=0>
66 Debugging is turned on by default. Use this to disable it.
68 =item C<--parrot_is_shared>
70 Link parrot dynamically.
72 =item C<--profile>
74 Turn on profiled compile (gcc only for now)
76 =item C<--optimize>
78 Add perl5's $Config{optimize} to the compiler flags.
80 =item C<--optimize=flags>
82 Add C<flags> to the compiler flags.
84 =item C<--inline>
86 Tell Configure that the compiler supports C<inline>.
88 =item C<--cc=(compiler)>
90 Specify which compiler to use.
92 =item C<--ccflags=(flags)>
94 Use the given compiler flags.
96 =item C<--ccwarn=(flags)>
98 Use the given compiler warning flags.
100 =item C<--cxx=(compiler)>
102 Specify which C++ compiler to use (for ICU).
104 =item C<--libs=(libs)>
106 Use the given libraries.
108 =item C<--link=(linker)>
110 Specify which linker to use.
112 =item C<--linkflags=(flags)>
114 Use the given linker flags
116 =item C<--ld=(linker)>
118 Specify which loader to use for shared libraries.
120 =item C<--ldflags=(flags)>
122 Use the given loader flags for shared libraries
124 =item C<--lex=(lexer)>
126 Specify which lexer to use.
128 =item C<--yacc=(parser)>
130 Specify which parser to use.
132 =item C<--define=val1[,val2]>
134 Generate "#define PARROT_DEF_VAL1 1" ... entries in has_header.h. Currently
135 needed to use inet_aton for systems that lack inet_pton:
137 --define=inet_aton
139 =back
141 Parrot Options
143 =over
145 =item C<--intval=(type)>
147 Use the given type for C<INTVAL>.
149 =item C<--floatval=(type)>
151 Use the given type for C<FLOATVAL>.
153 =item C<--opcode=(type)>
155 Use the given type for opcodes.
157 =item C<--ops=(files)>
159 Use the given ops files.
161 =item C<--pmc=(files)>
163 Use the given PMC files.
165 =item C<--cgoto=0>
167 Don't build cgoto core. This is recommended when you are short of memory.
169 =item C<--jitcapable>
171 Use JIT system.
173 =item C<--execcapable>
175 Use JIT to emit a native executable.
177 =item C<--gc=(type)>
179 Determine the type of garbage collection. The value for C<type> should be one
180 of: C<gc>, C<libc>, C<malloc> or C<malloc-trace>. The default is C<gc>.
182 =back
184 ICU Options
186 =over
188 =item C<--icu-config=/path/to/icu-config>
190 Use the specified icu-config script to determine the necessary ICU options.
192 Use --icu-config=none to disable the autodetect feature. Parrot will then be
193 build without ICU.
195 B<Note:> If you specify another ICU option than --icu-config, the autodetection
196 functionality will be disabled.
198 =item C<--icushared=(linkeroption)>
200 Linker command to link against ICU library.
202 E.g.
204 --icushared='-L /opt/openoffice/program -licudata -licuuc'
206 (The libs in openoffice are actually version 2.2 and do not work)
208 =item C<--icuheaders=(header_dir)>
210 Location of ICU header files without the /unicode suffix.
212 E.g.
214 --icuheaders='/home/lt/icu/'
216 =back
218 Other Options
220 =over
222 =item C<--maintainer>
224 Use this option if you want imcc's parser and lexer files to be generated.
225 Needs a working parser and lexer.
227 =item C<--miniparrot>
229 Build parrot assuming only pure ANSI C is available.
231 =item C<--expnetwork>
233 Enable experimental networking. This is an unused option and should probably be
234 removed.
236 =back
238 =head1 SEE ALSO
240 F<config/init/data.pl>, F<lib/Parrot/Configure/RunSteps.pm>,
241 F<lib/Parrot/Configure/Step.pm>, F<docs/configuration.pod>
243 =cut
245 use 5.005_02;
247 use strict;
248 use vars qw($parrot_version @parrot_version);
249 use lib 'lib';
251 use Parrot::BuildUtil;
252 use Parrot::Configure;
254 $| = 1;
256 $parrot_version = parrot_version();
257 @parrot_version = parrot_version();
259 # Handle options
261 my %args;
263 for (@ARGV) {
264 my($key, $value) = m/--([-\w]+)(?:=(.*))?/;
265 $key = 'help' unless defined $key;
266 $value = 1 unless defined $value;
268 for ($key) {
269 m/version/ && do {
270 my $cvsid='$Id$';
271 print <<"END";
272 Parrot Version $parrot_version Configure 2.0
273 $cvsid
275 exit;
278 m/help/ && do {
279 print <<"EOT";
280 $0 - Parrot Configure 2.0
282 General Options:
284 --help Show this text
285 --version Show version information
286 --verbose Output extra information
287 --verbose=2 Output every setting change
288 --verbose-step=N Set verbose for step N only
289 --verbose-step=regex Set verbose for step matching description
290 --nomanicheck Don't check the MANIFEST
291 --prefix Set the installation prefix
293 --ask Have Configure ask for commonly-changed info
295 Compile Options:
297 You can add and remove option values with :rem{<opt>} and :add{<opt>}
298 e.g. : --ccflags=":rem{-g} :add{-O2}"
300 --debugging=0 Disable debugging, default = 1
301 --inline Compiler supports inline
302 --optimize Optimized compile
303 --optimize=flags Add given optimizer flags
304 --parrot_is_shared Link parrot dynamically
305 --profile Turn on profiled compile (gcc only for now)
307 --cc=(compiler) Use the given compiler
308 --ccflags=(flags) Use the given compiler flags
309 --ccwarn=(flags) Use the given compiler warning flags
310 --cxx=(compiler) Use the given C++ compiler
311 --libs=(libs) Use the given libraries
312 --link=(linker) Use the given linker
313 --linkflags=(flags) Use the given linker flags
314 --ld=(linker) Use the given loader for shared libraries
315 --ldflags=(flags) Use the given loader flags for shared libraries
316 --lex=(lexer) Use the given lexical analyzer generator
317 --yacc=(parser) Use the given parser generator
319 --define=inet_aton Quick hack to use inet_aton instead of inet_pton
321 Parrot Options:
323 --intval=(type) Use the given type for INTVAL
324 --floatval=(type) Use the given type for FLOATVAL
325 --opcode=(type) Use the given type for opcodes
326 --ops=(files) Use the given ops files
327 --pmc=(files) Use the given PMC files
329 --cgoto=0 Don't build cgoto core - recommended when short of mem
330 --jitcapable Use JIT
331 --execcapable Use JIT to emit a native executable
332 --gc=(type) Determine the type of garbage collection
333 type=(gc|libc|malloc|malloc-trace) default is gc
335 ICU Options:
337 For using a system ICU, these options can be used:
339 --icu-config=/path/to/icu-config
340 Location of the script used for ICU autodetection.
341 You just need to specify this option if icu-config
342 is not in you PATH.
344 --icu-config=none can be used to disable the autodetection feature.
345 It will also be disabled if you specify any other
346 of the following ICU options.
348 If you do not have a full ICU installation:
350 --without-icu Build parrot without ICU support
351 --icuheaders=(path) Location of ICU headers without /unicode
352 --icushared=(flags) Full linker command to create shared libraries
353 --icudatadir=(path) Directory to locate ICU's data file(s)
355 Other Options (may not be implemented):
357 --maintainer Create imcc's parser and lexer files. Needs a working
358 parser and lexer.
359 --miniparrot Build parrot assuming only pure ANSI C is available
360 --expnetwork Enable experimental networking (unused)
363 exit;
365 $args{$key} = $value;
369 $args{debugging} = 1 unless ((exists $args{debugging}) && !$args{debugging});
370 $args{maintainer} = 1 if defined $args{lex} or defined $args{yacc};
372 print <<"END";
373 Parrot Version $parrot_version Configure 2.0
374 Copyright (C) 2001-2006 The Perl Foundation. All Rights Reserved.
376 Hello, I'm Configure. My job is to poke and prod your system to figure out
377 how to build Parrot. The process is completely automated, unless you passed in
378 the `--ask' flag on the command line, in which case it'll prompt you for a few
379 pieces of info.
381 Since you're running this script, you obviously have Perl 5--I'll be pulling
382 some defaults from its configuration.
385 # EDIT HERE TO ADD NEW TESTS
386 my @steps = qw(
387 init::manifest
388 init::defaults
389 init::miniparrot
390 init::hints
391 init::headers
392 inter::progs
393 inter::make
394 inter::lex
395 inter::yacc
396 auto::gcc
397 auto::msvc
398 init::optimize
399 inter::shlibs
400 inter::libparrot
401 inter::charset
402 inter::encoding
403 inter::types
404 inter::ops
405 inter::exp
406 inter::pmc
407 auto::alignptrs
408 auto::headers
409 auto::sizes
410 auto::byteorder
411 auto::va_ptr
412 auto::pack
413 auto::format
414 auto::isreg
415 auto::jit
416 gen::cpu
417 auto::funcptr
418 auto::cgoto
419 auto::inline
420 auto::gc
421 auto::memalign
422 auto::signal
423 auto::env
424 auto::aio
425 auto::gmp
426 auto::readline
427 auto::gdbm
428 auto::snprintf
429 auto::perldoc
430 auto::python
431 auto::bc
432 auto::m4
433 gen::icu
434 gen::revision
435 gen::config_h
436 gen::core_pmcs
437 gen::parrot_include
438 gen::makefiles
439 gen::platform
440 gen::config_pm
443 my $conf = Parrot::Configure->new;
445 # XXX $Parrot::Configure::Step::conf is a temporty hack
446 no warnings qw(once);
447 $Parrot::Configure::Step::conf = $conf;
449 $conf->add_steps(@steps);
450 $conf->options->set(%args);
451 # Run the actual steps
452 $conf->runsteps or exit(1);
454 # tell users what to do next
455 my $make = $conf->data->get('make');
457 print <<"END";
459 Okay, we're done!
461 You can now use `$make' to build your Parrot. After that,
462 you can use `$make test' to run the test suite.
464 Happy Hacking,
465 The Parrot Team
469 exit(0);