3 # Copyright (C) 2001-2008, The Perl Foundation.
10 use Data
::Dumper
;$Data::Dumper
::Indent
= 1;
12 use Parrot
::Configure
;
13 use Parrot
::Configure
::Options
qw( process_options );
14 use Parrot
::Configure
::Options
::Test
;
15 use Parrot
::Configure
::Options
::Test
::Prepare
qw(
16 get_preconfiguration_tests
17 get_postconfiguration_tests
19 use Parrot
::Configure
::Messages
qw(
25 $| = 1; # $OUTPUT_AUTOFLUSH = 1;
27 # Install Option text was taken from:
29 # autoconf (GNU Autoconf) 2.59
30 # Written by David J. MacKenzie and Akim Demaille.
32 # Copyright (C) 2003 Free Software Foundation, Inc.
33 # This is free software; see the source for copying conditions. There is NO
34 # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
36 # from Parrot::Configure::Options
37 my ($args, $steps_list_ref) = process_options
(
39 mode
=> (defined $ARGV[0] and $ARGV[0] =~ /^--file=/)
45 #print STDERR Dumper ($args, $steps_list_ref);
46 exit(1) unless defined $args;
48 my $opttest = Parrot
::Configure
::Options
::Test
->new($args);
50 # configuration tests will only be run if you requested them
51 # as command-line option
52 $opttest->run_configure_tests( get_preconfiguration_tests
() );
54 my $parrot_version = $Parrot::Configure
::Options
::Conf
::parrot_version
;
56 # from Parrot::Configure::Messages
57 print_introduction
($parrot_version);
59 # Update revision number if needed
60 Parrot
::Revision
::update
();
62 my $conf = Parrot
::Configure
->new();
64 $conf->add_steps( @
{ $steps_list_ref } );
66 # from Parrot::Configure::Data
67 $conf->options->set( %{$args} );
69 # Log files created by Configure.pl in MANIFEST.configure.generated
70 $conf->{active_configuration
} = 1;
71 unlink 'MANIFEST.configure.generated';
73 # Run the actual steps from Parrot::Configure
74 $conf->runsteps or exit(1);
76 # build tests will only be run if you requested them
77 # as command-line option
78 $opttest->run_build_tests( get_postconfiguration_tests
() );
80 my $make = $conf->data->get('make');
81 # from Parrot::Configure::Messages
82 ( print_conclusion
( $conf, $make ) ) ?
exit 0 : exit 1;
84 ################### DOCUMENTATION ###################
88 Configure.pl - Parrot's configuration script
92 % perl Configure.pl [options]
96 % perl Configure.pl --file=/path/to/configuration/directives
100 This is Parrot's configuration program. It should be run to create
101 the necessary system-specific files before building Parrot.
103 We now offer two interfaces to configuration:
107 =item * Command-Line Interface
109 All configuration options are placed on the command-line. You may request
110 interactive configuration with the C<--ask> option. You may not use the
111 C<--file> option, as that is reserved for the Configuration-File interface.
113 =item * Configuration-File Interface
115 All configuration options are placed in a special configuration file whose
116 full path is invoked on the command-line as
117 C<--file=/path/to/configuration/directives> as the sole command-line option.
118 You may not request interactive configuration. For specific instructions, see
119 L</"CONFIGURATION-FILE INTERFACE"> below.
123 =head2 General Options
129 Prints out a description of the options and exits.
133 Prints out the version number of Configure.pl and exits.
137 Tells Configure.pl to output extra information about the configuration data it
142 Tells Configure.pl to output information about i<every> setting added or
145 =item C<--verbose-step={N|regex}>
147 Run C<--verbose=2> for step number C<N> or matching description.
151 Tells Configure.pl to halt completely if any configuration step fails.
153 =item C<--fatal-step={init::alpha,inter::beta,auto::gamma}>
155 Tells Configure.pl to halt completely if any configuration step in
156 comma-delimited string individually fails.
158 =item C<--nomanicheck>
160 Tells Configure.pl not to run the MANIFEST check.
164 Sets the location where parrot will be installed.
166 =item C<--languages="list of languages">
168 Specify a list of languages to process (space separated.)
169 Used in combination with C<--step=gen::languages> to regenerate makefiles.
173 This turns on the user prompts during configuraion. Available only in
174 Command-Line interface. Not available in Configuration-File interface.
178 Run certain tests along with F<Configure.pl>:
182 =item C<--test=configure>
184 Run tests found in F<t/configure/> I<before> beginning configuration. These
185 tests demonstrate that Parrot's configuration tools will work properly once
186 configuration has begun.
188 =item C<--test=build>
190 Run tests found in F<t/postconfigure/>, F<t/tools/pmc2cutils/>,
191 F<t/tools/ops2cutils/> and F<t/tools/ops2pmutils/> I<after> configuration has
192 completed. These tests demonstrate (a) that certain of Parrot's configuration
193 tools are working properly post-configuration; and (b) that certain of
194 Parrot's build tools will work properly once you call F<make>.
198 Run the tests described in C<--test=configure>, conduct configuration, then
199 run the tests described in C<--test=build>.
205 =head2 Compile Options
209 =item C<--debugging=0>
211 Debugging is turned on by default. Use this to disable it.
213 =item C<--parrot_is_shared>
215 Link parrot dynamically.
219 Create a 32-bit executable on 64-architectures like x86_64. This
220 option appends -m32 to compiler and linker programs and does
221 s/lib64/lib/g on link flags.
223 This option is experimental. See F<config/init/defaults.pm> for more.
227 Turn on profiled compile (gcc only for now)
231 [CAGE] compile includes many additional warnings
235 Add perl5's $Config{optimize} to the compiler flags.
237 =item C<--optimize=flags>
239 Add C<flags> to the compiler flags.
243 Tell Configure that the compiler supports C<inline>.
245 =item C<--cc=(compiler)>
247 Specify which compiler to use.
249 =item C<--ccflags=(flags)>
251 Use the given compiler flags.
253 =item C<--ccwarn=(flags)>
255 Use the given compiler warning flags.
257 =item C<--cxx=(compiler)>
259 Specify which C++ compiler to use (for ICU).
261 =item C<--libs=(libs)>
263 Use the given libraries.
265 =item C<--link=(linker)>
267 Specify which linker to use.
269 =item C<--linkflags=(flags)>
271 Use the given linker flags
273 =item C<--ld=(linker)>
275 Specify which loader to use for shared libraries.
277 =item C<--ldflags=(flags)>
279 Use the given loader flags for shared libraries
281 =item C<--lex=(lexer)>
283 Specify which lexer to use.
285 =item C<--yacc=(parser)>
287 Specify which parser to use.
289 =item C<--define=val1[,val2]>
291 Generate "#define PARROT_DEF_VAL1 1" ... entries in has_header.h. Currently
292 needed to use inet_aton for systems that lack inet_pton:
298 =head2 Parrot Options
302 =item C<--intval=(type)>
304 Use the given type for C<INTVAL>.
306 =item C<--floatval=(type)>
308 Use the given type for C<FLOATVAL>.
310 =item C<--opcode=(type)>
312 Use the given type for opcodes.
314 =item C<--ops=(files)>
316 Use the given ops files.
318 =item C<--pmc=(files)>
320 Use the given PMC files.
324 Don't build cgoto core. This is recommended when you are short of memory.
326 =item C<--jitcapable>
330 =item C<--execcapable>
332 Use JIT to emit a native executable.
336 Determine the type of garbage collection. The value for C<type> should be one
337 of: C<gc>, C<libc>, C<malloc> or C<malloc-trace>. The default is C<gc>.
341 =head2 International Components For Unicode (ICU) Options
345 =item C<--icu-config=/path/to/icu-config>
347 Use the specified icu-config script to determine the necessary ICU options.
349 Use --icu-config=none to disable the autodetect feature. Parrot will then be
352 B<Note:> If you specify another ICU option than --icu-config, the autodetection
353 functionality will be disabled.
355 =item C<--icushared=(linkeroption)>
357 Linker command to link against ICU library.
361 --icushared='-L /opt/openoffice/program -licudata -licuuc'
363 (The libs in openoffice are actually version 2.2 and do not work)
365 =item C<--icuheaders=(header_dir)>
367 Location of ICU header files without the /unicode suffix.
371 --icuheaders='/home/lt/icu/'
379 =item C<--maintainer>
381 Use this option if you want imcc's parser and lexer files to be generated.
382 Needs a working parser and lexer.
384 =item C<--miniparrot>
386 Build parrot assuming only pure ANSI C is available.
390 =head1 CONFIGURATION-FILE INTERFACE
392 In the Configuration-File interface, unlike the Command-Line interface, you
393 may delete configuration steps or run them in an order different from that
394 listed in Parrot::Configure::Step::List.
396 A configuration file is a plain-text file located somewhere in or under your
397 top-level Parrot directory. Unless indicated otherwise, all lines in this
398 file must have no leading whitespace. As in Perl 5, lines beginning with C<#>
399 marks are comments and are ignored during parsing of the file. Unlike Perl 5,
400 you may not begin comments in the middle of a line.
402 The configuration file must contain these three sections:
412 Section begins with line C<=variables> and must be followed by at least one
413 blank line. All other content in this section is optional.
417 Section may contain one or more I<key=value> pairs which assign strings to
418 variables much in the way that you would do in a shell script wrapping around
426 So if you typically invoked F<Configure.pl> by wrapping it in a shell script
427 for the purpose of setting environmental variables used in options, like this:
431 /usr/local/bin/perl Configure.pl \
437 ... you would now place the assignments to C<CC> and C<CX> in the
438 I<=variables> section of the configuration file (as above).
448 Section begins with line C<=general> and must be followed by at least one
449 blank line. All other content in this section is optional.
453 This section is the location recommended for listing options whose impact is
454 not conceptually limited to a single step. It is also the location where the
455 variables defined in the I<=variables> section are assigned to particular
456 Parrot configuration options. Entries in this section must be either
457 I<option=value> pairs or be options which will be assigned a true value.
465 Note that when the value is a variable defined in the I<=variables> section,
466 it must be preceded by a C<$> sign.
470 You I<may> list options here which are I<conceptually> limited to a single
471 configuration step. For example, if you wished to skip validation of the
472 F<MANIFEST> during configuration and to configure without ICU, you I<could>,
473 in this section, say:
478 However, as we shall quickly see, it's conceptually clearer to place these
479 values next to those configuration steps that actually use them.
489 Section begins with line C<=steps> and must be followed by at least one
490 blank line, in turn followed by the list of configuration steps, followed by
491 another blank line followed by a line C<=cut> (just like POD).
495 The order in which you list the steps is the order in which they will be
496 executed. If you delete a step from the canonical list or comment a step out,
497 it will not be executed.
505 In the above example, step C<auto::perldoc> will be completely skipped. You
506 will not see it listed as C<....skipped> in F<Configure.pl>'s output; it will
507 simply not be there at all.
511 This is the recommended location to call options whose impact is
512 I<conceptually> limited to a single configuration step. Type the
513 configuration step's name, type a whitespace, type the option (with no leading
514 C<-->) and repeat as needed for additional step-specific options.
516 init::manifest nomanicheck
521 This is also the location to call options whose impact is limited to one step
522 at a time but which may be applied to more than one configuration step. The
523 C<fatal-step> and C<verbose-step> options are the best examples of this case.
524 Rather than requesting verbose output from all configuration steps, you may,
525 for example, wish to designate only a few steps for verbose output:
528 init::hints verbose-step
530 inter::progs fatal-step
532 auto::gcc verbose-step
535 In the above example, F<Configure.pl> will grind to a halt if C<inter::progs>
536 does not complete successfully. You will get verbose output only from
537 C<init::hints> and C<auto::gcc>; the other 60+ steps will be terse.
541 Nothing prevents you from listing general options anywhere in this section.
543 init::manifest nomanicheck cc=$CC ld=/usr/bin/g++ verbose
547 That will work -- but why would you want to do something that messy?
555 Ignoring leading whitespace, this is an example of a correctly formed
572 init::manifest nomanicheck
576 init::hints verbose-step
642 You may see how this works in practice by calling:
644 perl Configure.pl --file=xconf/samples/yourfoobar
648 perl Configure.pl --file=xconf/samples/testfoobar
652 F<config/init/data.pl>, F<lib/Parrot/Configure.pm>,
653 F<lib/Parrot/Configure/Step.pm>, F<docs/configuration.pod>
659 # cperl-indent-level: 4
662 # vim: expandtab shiftwidth=4: