fix codetest failure - ASSERT_ARGS does not have a ; after and
[parrot.git] / Configure.pl
blobecfc8a8a25b7e37d66a9aa39e21abb7a1215b562
1 #! perl
3 # Copyright (C) 2001-2009, Parrot Foundation.
4 # $Id$
6 use 5.008;
7 use strict;
8 use warnings;
9 use lib 'lib';
11 use Parrot::Configure;
12 use Parrot::Configure::Options qw( process_options );
13 use Parrot::Configure::Options::Test;
14 use Parrot::Configure::Options::Test::Prepare qw(
15 get_preconfiguration_tests
16 get_postconfiguration_tests
18 use Parrot::Configure::Messages qw(
19 print_introduction
20 print_conclusion
22 use Parrot::Revision;
24 $| = 1; # $OUTPUT_AUTOFLUSH = 1;
26 # Install Option text was taken from:
28 # autoconf (GNU Autoconf) 2.59
29 # Written by David J. MacKenzie and Akim Demaille.
31 # Copyright (C) 2003 Free Software Foundation, Inc.
32 # This is free software; see the source for copying conditions. There is NO
33 # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
35 # from Parrot::Configure::Options
36 my ($args, $steps_list_ref) = process_options(
38 mode => (defined $ARGV[0] and $ARGV[0] =~ /^--file=/)
39 ? 'file'
40 : 'configure',
41 argv => [@ARGV],
44 exit(1) unless defined $args;
46 my $opttest = Parrot::Configure::Options::Test->new($args);
48 # configuration tests will only be run if you requested them
49 # as command-line option
50 $opttest->run_configure_tests( get_preconfiguration_tests() );
52 my $parrot_version = $Parrot::Configure::Options::Conf::parrot_version;
54 # from Parrot::Configure::Messages
55 print_introduction($parrot_version);
57 # Update revision number if needed
58 Parrot::Revision::update();
60 my $conf = Parrot::Configure->new();
62 $conf->add_steps( @{ $steps_list_ref } );
64 # from Parrot::Configure::Data
65 $conf->options->set( %{$args} );
66 # save the command-line for make reconfig
67 $conf->data->set(configure_args => @ARGV ? '"'.join("\" \"", map {qq($_)} @ARGV).'"'
68 : '');
70 # Log files created by Configure.pl in MANIFEST.configure.generated
71 $conf->{active_configuration} = 1;
72 unlink 'MANIFEST.configure.generated';
74 # Run the actual steps from Parrot::Configure
75 $conf->runsteps or exit(1);
77 # build tests will only be run if you requested them
78 # as command-line option
79 $opttest->run_build_tests( get_postconfiguration_tests() );
81 my $make = $conf->data->get('make');
82 # from Parrot::Configure::Messages
83 ( print_conclusion( $conf, $make ) ) ? exit 0 : exit 1;
85 ################### DOCUMENTATION ###################
87 =head1 NAME
89 Configure.pl - Parrot's configuration script
91 =head1 SYNOPSIS
93 % perl Configure.pl [options]
95 or:
97 % perl Configure.pl --file=/path/to/configuration/directives
99 =head1 DESCRIPTION
101 This is Parrot's configuration program. It should be run to create
102 the necessary system-specific files before building Parrot.
104 We now offer two interfaces to configuration:
106 =over 4
108 =item * Command-Line Interface
110 All configuration options are placed on the command-line. You may request
111 interactive configuration with the C<--ask> option. You may not use the
112 C<--file> option, as that is reserved for the Configuration-File interface.
114 =item * Configuration-File Interface
116 All configuration options are placed in a special configuration file whose
117 full path is invoked on the command-line as
118 C<--file=/path/to/configuration/directives> as the sole command-line option.
119 You may not request interactive configuration. For specific instructions, see
120 L</"CONFIGURATION-FILE INTERFACE"> below.
122 =back
124 =head2 General Options
126 =over 4
128 =item C<--help>
130 Prints out a description of the options and exits.
132 =item C<--version>
134 Prints out the version number of Configure.pl and exits.
136 =item C<--verbose>
138 Tells Configure.pl to output extra information about the configuration data it
139 is setting.
141 =item C<--verbose=2>
143 Tells Configure.pl to output information about i<every> setting added or
144 changed.
146 =item C<--verbose-step={N|regex}>
148 Run C<--verbose=2> for step number C<N> or matching description.
150 =item C<--fatal>
152 Tells Configure.pl to halt completely if any configuration step fails.
154 =item C<--fatal-step={init::alpha,inter::beta,auto::gamma}>
156 Tells Configure.pl to halt completely if any configuration step in
157 comma-delimited string individually fails.
159 =item C<--nomanicheck>
161 Tells Configure.pl not to run the MANIFEST check.
163 =item C<--prefix>
165 Sets the location where parrot will be installed.
167 =item C<--ask>
169 This turns on the user prompts during configuration. Available only in
170 Command-Line interface. Not available in Configuration-File interface.
172 =item C<--test>
174 Run certain tests along with F<Configure.pl>:
176 =over 4
178 =item C<--test=configure>
180 Run tests found in F<t/configure/> I<before> beginning configuration. These
181 tests demonstrate that Parrot's configuration tools will work properly once
182 configuration has begun.
184 =item C<--test=build>
186 Run tests found in F<t/steps/>, F<t/postconfigure/> and F<t/pharness>.
188 =item C<--test>
190 Run the tests described in C<--test=configure>, conduct configuration, then
191 run the tests described in C<--test=build>.
193 =back
195 =item C<--configure_trace>
197 Store the results of each configuration step in a Storable F<.sto> file on
198 disk, for later analysis by F<Parrot::Configure::Trace> methods.
200 =item Operating system-specific configuration options
202 =over 4
204 =item C<--hintsfile=filename>
206 Use filename as the hints file.
208 =item C<--darwin_no_fink>
210 On Darwin, do not probe for Fink libraries.
212 =item C<--darwin_no_macports>
214 On Darwin, do not probe for Macports libraries.
216 =back
218 =back
220 =head2 Compile Options
222 =over 4
224 =item C<--debugging=0>
226 Debugging is turned on by default. Use this to disable it.
228 =item C<--parrot_is_shared>
230 Link parrot dynamically.
232 =item C<--m=32>
234 Create a 32-bit executable on 64-architectures like x86_64. This
235 option appends C<-m32> to compiler and linker programs and does
236 C<s/lib64/lib/g> on link flags.
238 This option is experimental. See F<config/init/defaults.pm> for more.
240 =item C<--profile>
242 Turn on profiled compile (gcc only for now)
244 =item C<--cage>
246 [CAGE] compile includes many additional warnings
248 =item C<--optimize>
250 Add Perl 5's C<$Config{optimize}> to the compiler flags.
252 =item C<--optimize=flags>
254 Add C<flags> to the compiler flags.
256 =item C<--inline>
258 Tell Configure that the compiler supports C<inline>.
260 =item C<--cc=(compiler)>
262 Specify which compiler to use.
264 =item C<--ccflags=(flags)>
266 Use the given compiler flags.
268 =item C<--ccwarn=(flags)>
270 Use the given compiler warning flags.
272 =item C<--cxx=(compiler)>
274 Specify which C++ compiler to use (for ICU).
276 =item C<--libs=(libs)>
278 Use the given libraries.
280 =item C<--link=(linker)>
282 Specify which linker to use.
284 =item C<--linkflags=(flags)>
286 Use the given linker flags
288 =item C<--ld=(linker)>
290 Specify which loader to use for shared libraries.
292 =item C<--ldflags=(flags)>
294 Use the given loader flags for shared libraries
296 =item C<--disable-rpath>
298 Specify that rpath should not be included in linking flags. With this
299 configuration option, you must append the library build directory
300 (usually blib/lib) to the LD_LIBRARY_PATH environment variable (or your
301 platform equivalent). This option is primarily used for building Linux
302 packages.
304 =item C<--lex=(lexer)>
306 Specify which lexer to use.
308 =item C<--yacc=(parser)>
310 Specify which parser to use.
312 =item C<--define=val1[,val2]>
314 Generate "#define PARROT_DEF_VAL1 1" ... entries in has_header.h. Currently
315 needed to use inet_aton for systems that lack inet_pton:
317 --define=inet_aton
319 =item C<--no-line-directives>
321 Disables the creation of C #line directives when generating C from PMCs and
322 ops. Useful when debugging internals.
324 =back
326 =head2 Parrot Options
328 =over 4
330 =item C<--intval=(type)>
332 Use the given type for C<INTVAL>.
334 =item C<--floatval=(type)>
336 Use the given type for C<FLOATVAL>.
338 =item C<--opcode=(type)>
340 Use the given type for opcodes.
342 =item C<--ops=(files)>
344 Use the given ops files.
346 =item C<--jitcapable>
348 Use JIT system.
350 =item C<--buildframes>
352 Dynamically build NCI call frames.
354 =item C<--execcapable>
356 Use JIT to emit a native executable.
358 =back
360 =head2 International Components For Unicode (ICU) Options
362 =over 4
364 =item C<--icu-config=/path/to/icu-config>
366 Use the specified icu-config script to determine the necessary ICU options.
368 Use --icu-config=none to disable the autodetect feature. Parrot will then be
369 build without ICU.
371 B<Note:> If you specify another ICU option than --icu-config, the autodetection
372 functionality will be disabled.
374 =item C<--icushared=(linkeroption)>
376 Linker command to link against ICU library.
378 E.g.
380 --icushared='-L /opt/openoffice/program -licudata -licuuc'
382 (The libs in openoffice are actually version 2.2 and do not work)
384 =item C<--icuheaders=(header_dir)>
386 Location of ICU header files without the /unicode suffix.
388 E.g.
390 --icuheaders='/home/lt/icu/'
392 =back
394 =head2 Other Options
396 =over 4
398 =item C<--maintainer>
400 Use this option if you want imcc's parser and lexer files to be generated.
401 Needs a working parser and lexer.
403 =back
405 =head1 CONFIGURATION-FILE INTERFACE
407 In the Configuration-File interface, unlike the Command-Line interface, you
408 may delete configuration steps or run them in an order different from that
409 listed in Parrot::Configure::Step::List.
411 A configuration file is a plain-text file located somewhere in or under your
412 top-level Parrot directory. Unless indicated otherwise, all lines in this
413 file must have no leading whitespace. As in Perl 5, lines beginning with C<#>
414 marks are comments and are ignored during parsing of the file. Unlike Perl 5,
415 you may not begin comments in the middle of a line.
417 The configuration file must contain these three sections:
419 =over 4
421 =item * variables
423 =over 4
425 =item *
427 Section begins with line C<=variables> and must be followed by at least one
428 blank line. All other content in this section is optional.
430 =item *
432 Section may contain one or more I<key=value> pairs which assign strings to
433 variables much in the way that you would do in a shell script wrapping around
434 F<Configure.pl>.
436 =variables
438 CC=/usr/bin/gcc
439 CX=/usr/bin/g++
441 So if you typically invoked F<Configure.pl> by wrapping it in a shell script
442 for the purpose of setting environmental variables used in options, like this:
444 CC="/usr/bin/gcc"
445 CX="/usr/bin/g++"
446 /usr/local/bin/perl Configure.pl \
447 --cc="$CC" \
448 --cxx="$CX" \
449 --link="$CX" \
450 --ld="$CX"
452 ... you would now place the assignments to C<CC> and C<CX> in the
453 I<=variables> section of the configuration file (as above).
455 =back
457 =item * general
459 =over 4
461 =item *
463 Section begins with line C<=general> and must be followed by at least one
464 blank line. All other content in this section is optional.
466 =item *
468 This section is the location recommended for listing options whose impact is
469 not conceptually limited to a single step. It is also the location where the
470 variables defined in the I<=variables> section are assigned to particular
471 Parrot configuration options. Entries in this section must be either
472 I<option=value> pairs or be options which will be assigned a true value.
474 cc=$CC
475 cxx=$CX
476 link=$CX
477 ld=/usr/bin/g++
478 verbose
480 Note that when the value is a variable defined in the I<=variables> section,
481 it must be preceded by a C<$> sign.
483 =item *
485 You I<may> list options here which are I<conceptually> limited to a single
486 configuration step. For example, if you wished to skip validation of the
487 F<MANIFEST> during configuration and to configure without ICU, you I<could>,
488 in this section, say:
490 nomanicheck
491 without-icu
493 However, as we shall quickly see, it's conceptually clearer to place these
494 values next to those configuration steps that actually use them.
496 =back
498 =item * steps
500 =over 4
502 =item *
504 Section begins with line C<=steps> and must be followed by at least one
505 blank line, in turn followed by the list of configuration steps, followed by
506 another blank line followed by a line C<=cut> (just like POD).
508 =item *
510 The order in which you list the steps is the order in which they will be
511 executed. If you delete a step from the canonical list or comment a step out,
512 it will not be executed.
515 auto::snprintf
516 # auto::perldoc
517 auto::ctags
520 In the above example, step C<auto::perldoc> will be completely skipped. You
521 will not see it listed as C<....skipped> in F<Configure.pl>'s output; it will
522 simply not be there at all.
524 =item *
526 This is the recommended location to call options whose impact is
527 I<conceptually> limited to a single configuration step. Type the
528 configuration step's name, type a whitespace, type the option (with no leading
529 C<-->) and repeat as needed for additional step-specific options.
531 init::manifest nomanicheck
534 =item *
536 This is also the location to call options whose impact is limited to one step
537 at a time but which may be applied to more than one configuration step. The
538 C<fatal-step> and C<verbose-step> options are the best examples of this case.
539 Rather than requesting verbose output from all configuration steps, you may,
540 for example, wish to designate only a few steps for verbose output:
543 init::hints verbose-step
544 init::headers
545 inter::progs fatal-step
547 auto::gcc verbose-step
550 In the above example, F<Configure.pl> will grind to a halt if C<inter::progs>
551 does not complete successfully. You will get verbose output only from
552 C<init::hints> and C<auto::gcc>; the other 60+ steps will be terse.
554 =item *
556 Nothing prevents you from listing general options anywhere in this section.
558 init::manifest nomanicheck cc=$CC ld=/usr/bin/g++ verbose
559 init::defaults
562 That will work -- but why would you want to do something that messy?
564 =back
566 =back
568 =head2 Example
570 Ignoring leading whitespace, this is an example of a correctly formed
571 configuration file.
573 =variables
575 CC=/usr/bin/gcc
576 CX=/usr/bin/g++
578 =general
580 cc=$CC
581 cxx=$CX
582 link=$CX
583 ld=/usr/bin/g++
585 =steps
587 init::manifest nomanicheck
588 init::defaults
589 init::install
590 init::hints verbose-step
591 init::headers
592 inter::progs
593 inter::make
594 inter::lex
595 inter::yacc
596 auto::gcc
597 auto::glibc
598 auto::backtrace
599 auto::fink
600 auto::macports
601 auto::msvc
602 auto::attributes
603 auto::warnings
604 init::optimize
605 inter::shlibs
606 inter::libparrot
607 inter::types
608 auto::ops
609 auto::alignptrs
610 auto::headers
611 auto::sizes
612 auto::byteorder
613 auto::va_ptr
614 auto::format
615 auto::isreg
616 auto::arch
617 auto::jit
618 auto::frames
619 auto::cpu
620 auto::inline
621 auto::gc
622 auto::memalign
623 auto::signal
624 auto::socklen_t
625 auto::env
626 auto::extra_nci_thunks
627 auto::gmp
628 auto::readline
629 auto::pcre
630 auto::opengl
631 auto::gettext
632 auto::snprintf
633 # auto::perldoc
634 auto::ctags
635 auto::revision
636 auto::icu
637 gen::config_h
638 gen::core_pmcs
639 gen::opengl
640 gen::makefiles
641 gen::platform
642 gen::config_pm
644 =cut
646 You may see how this works in practice by calling:
648 perl Configure.pl --file=examples/config/file/configcompiler
652 perl Configure.pl --file=examples/config/file/configwithfatalstep
654 =head1 SEE ALSO
656 F<lib/Parrot/Configure.pm>,
657 F<lib/Parrot/Configure/Step.pm>, F<docs/configuration.pod>
659 =cut
661 # Local Variables:
662 # mode: cperl
663 # cperl-indent-level: 4
664 # fill-column: 100
665 # End:
666 # vim: expandtab shiftwidth=4: