Permalink
Newer
Older
100644 705 lines (461 sloc) 16.3 KB
3
# Copyright (C) 2001-2009, Parrot Foundation.
6
use strict;
7
use warnings;
8
use lib 'lib';
9
10
use Parrot::Configure;
11
use Parrot::Configure::Options qw( process_options );
12
use Parrot::Configure::Options::Test;
13
use Parrot::Configure::Options::Test::Prepare qw(
14
get_preconfiguration_tests
15
get_postconfiguration_tests
16
);
17
use Parrot::Configure::Messages qw(
18
print_introduction
19
print_conclusion
20
);
21
use Parrot::Revision;
22
23
$| = 1; # $OUTPUT_AUTOFLUSH = 1;
24
25
# Install Option text was taken from:
26
#
27
# autoconf (GNU Autoconf) 2.59
28
# Written by David J. MacKenzie and Akim Demaille.
29
#
30
# Copyright (C) 2003 Free Software Foundation, Inc.
31
# This is free software; see the source for copying conditions. There is NO
32
# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
33
34
# from Parrot::Configure::Options
35
my ($args, $steps_list_ref) = process_options(
37
mode => (defined $ARGV[0] and $ARGV[0] =~ /^--file=/)
40
argv => [@ARGV],
41
}
42
);
43
exit(1) unless defined $args;
44
Reini Urban
[GH #833] preload configure steps
Sep 17, 2012
45
# preload all steps for debugging because some Windows systems cannot
46
# do "b postpone stepname"
Reini Urban
[GH #833] preload only when debugging perl via -d
Sep 18, 2012
47
if (defined &DB::DB) {
48
for my $step_name (@{ $steps_list_ref } ) {
49
eval "use $step_name;"; ## no critic (BuiltinFunctions::ProhibitStringyEval)
50
die $@ if $@;
Reini Urban
[GH #833] preload only when debugging perl via -d
Sep 18, 2012
51
}
Reini Urban
[GH #833] preload configure steps
Sep 17, 2012
52
}
53
54
my $opttest = Parrot::Configure::Options::Test->new($args);
55
56
# configuration tests will only be run if you requested them
57
# as command-line option
58
$opttest->run_configure_tests( get_preconfiguration_tests() );
59
60
my $parrot_version = $Parrot::Configure::Options::Conf::parrot_version;
61
62
# from Parrot::Configure::Messages
63
print_introduction($parrot_version)
64
unless $args->{silent};
66
# Update revision number if needed
67
Parrot::Revision::update();
68
Feb 10, 2008
69
my $conf = Parrot::Configure->new();
71
$conf->add_steps( @{ $steps_list_ref } );
72
73
# from Parrot::Configure::Data
74
$conf->options->set( %{$args} );
75
# save the command-line for make reconfig
76
$conf->data->set(configure_args => @ARGV
77
? '"'.join("\" \"", map {qq($_)} @ARGV).'"'
78
: '');
Reini Urban
[GH #890] Generate MANIFEST.generate, remove MANIFEST_configure.gener…
Dec 22, 2012
80
# Log files created by Configure.pl in MANIFEST.generated
81
$conf->{active_configuration} = 1;
Reini Urban
[GH #910] make -s clean at perl Configure.pl to ensure fresh install
Jan 7, 2013
82
83
# Create a fresh MANIFEST for make install
Reini Urban
[GH #890] Generate MANIFEST.generate, remove MANIFEST_configure.gener…
Dec 22, 2012
84
unlink 'MANIFEST.generated';
Reini Urban
[GH #910] make -s clean at perl Configure.pl to ensure fresh install
Jan 7, 2013
85
if (do 'lib/Parrot/Config/Generated.pm') {
86
my $make = $Parrot::Config::Generated::PConfig{make};
87
if ($make and -f 'Makefile') {
Reini Urban
[GH #910] make clean on linux|darwin even without lib/Parrot/Config/G…
Jan 7, 2013
88
$Parrot::Config::Generated::PConfig{gmake_version}
89
? system ($make, '-s', 'clean') : system ($make, 'clean');
Reini Urban
[GH #910] make -s clean at perl Configure.pl to ensure fresh install
Jan 7, 2013
90
}
91
}
Reini Urban
[GH #910] make clean on linux|darwin even without lib/Parrot/Config/G…
Jan 7, 2013
92
elsif (-f 'Makefile' and $^O =~ /(linux|darwin)/) {
93
system ('make', '-s', 'clean');
94
}
95
96
# Run the actual steps from Parrot::Configure
97
$conf->runsteps or exit(1);
98
99
# build tests will only be run if you requested them
100
# as command-line option
101
$opttest->run_build_tests( get_postconfiguration_tests() );
102
103
my $make = $conf->data->get('make');
104
# from Parrot::Configure::Messages
105
( print_conclusion( $conf, $make, $args ) ) ? exit 0 : exit 1;
106
107
################### DOCUMENTATION ###################
108
109
=head1 NAME
111
Configure.pl - Parrot's configuration script
113
=head1 SYNOPSIS
115
% perl Configure.pl [options]
Leopold Toetsch
Oct 28, 2003
116
117
or:
118
119
% perl Configure.pl --file=/path/to/configuration/directives
120
121
=head1 DESCRIPTION
123
This is Parrot's configuration program. It should be run to create
124
the necessary system-specific files before building Parrot.
126
We now offer two interfaces to configuration:
127
128
=over 4
129
130
=item * Command-Line Interface
132
All configuration options are placed on the command-line. You may request
133
interactive configuration with the C<--ask> option. You may not use the
134
C<--file> option, as that is reserved for the Configuration-File interface.
136
=item * Configuration-File Interface
137
138
All configuration options are placed in a special configuration file whose
139
full path is invoked on the command-line as
140
C<--file=/path/to/configuration/directives> as the sole command-line option.
141
You may not request interactive configuration. For specific instructions, see
142
L</"CONFIGURATION-FILE INTERFACE"> below.
143
144
=back
145
146
=head2 General Options
147
148
=over 4
150
=item C<--help>
152
Prints out a description of the options and exits.
154
=item C<--version>
May 24, 2002
155
156
Prints out the version number of Configure.pl and exits.
158
=item C<--verbose>
160
Tells Configure.pl to output extra information about the configuration data it
161
is setting.
165
Tells Configure.pl to output information about i<every> setting added or
168
=item C<--verbose-step={N|regex}>
170
Run C<--verbose=2> for step number C<N> or matching description.
172
=item C<--fatal>
173
174
Tells Configure.pl to halt completely if any configuration step fails.
175
176
=item C<--fatal-step={init::alpha,inter::beta,auto::gamma}>
177
178
Tells Configure.pl to halt completely if any configuration step in
179
comma-delimited string individually fails.
180
181
=item C<--nomanicheck>
183
Tells Configure.pl not to run the MANIFEST check.
185
=item C<--prefix>
186
187
Sets the location where parrot will be installed.
188
191
This turns on the user prompts during configuration. Available only in
192
Command-Line interface. Not available in Configuration-File interface.
194
=item C<--test>
195
196
Run certain tests along with F<Configure.pl>:
197
198
=over 4
199
200
=item C<--test=configure>
201
202
Run tests found in F<t/configure/> I<before> beginning configuration. These
203
tests demonstrate that Parrot's configuration tools will work properly once
204
configuration has begun.
205
206
=item C<--test=build>
207
208
Run tests found in F<t/steps/>, F<t/postconfigure/> and F<t/pharness>.
209
210
=item C<--test>
211
212
Run the tests described in C<--test=configure>, conduct configuration, then
213
run the tests described in C<--test=build>.
214
215
=back
216
217
=item C<--configure_trace>
218
219
Store the results of each configuration step in a Storable F<.sto> file on
220
disk, for later analysis by F<Parrot::Configure::Trace> methods.
221
222
=item C<--coveragedir>
223
224
In preparation for calling C<make cover> to perform coverage analysis,
225
provide a user-specified directory for top level of HTML output.
226
227
=item Operating system-specific configuration options
228
229
=over 4
230
231
=item C<--hintsfile=filename>
232
233
Use filename as the hints file.
234
235
=item C<--darwin_no_fink>
236
237
On Darwin, do not probe for Fink libraries.
238
239
=item C<--darwin_no_macports>
240
241
On Darwin, do not probe for Macports libraries.
242
243
=back
244
245
=back
251
=item C<--debugging=0>
253
Debugging is turned on by default. Use this to disable it.
255
=item C<--parrot_is_shared>
256
257
Link parrot dynamically.
258
259
=item C<--m=32>
260
261
Create a 32-bit executable on 64-architectures like x86_64. This
262
option appends C<-m32> to compiler and linker programs and does
263
C<s/lib64/lib/g> on link flags.
264
265
This option is experimental. See F<config/init/defaults.pm> for more.
266
267
=item C<--profile>
268
269
Turn on profiled compile (gcc only for now)
270
271
=item C<--cage>
272
273
[CAGE] compile includes many additional warnings
274
275
=item C<--optimize>
277
Add Perl 5's C<$Config{optimize}> to the compiler flags.
278
279
=item C<--optimize=flags>
280
281
Add C<flags> to the compiler flags.
282
283
=item C<--inline>
284
285
Tell Configure that the compiler supports C<inline>.
286
287
=item C<--cc=(compiler)>
288
289
Specify which C compiler to use.
290
291
=item C<--cxx=(compiler)>
292
293
Specify which C++ compiler to use.
294
295
=item C<--ccflags=(flags)>
296
297
Use the given compiler flags.
298
299
=item C<--ccwarn=(flags)>
300
301
Use the given compiler warning flags.
302
303
=item C<--libs=(libs)>
304
305
Use the given libraries.
306
307
=item C<--link=(linker)>
308
309
Specify which linker to use.
310
311
=item C<--linkflags=(flags)>
312
313
Use the given linker flags
314
315
=item C<--ar=(archiver)>
316
317
Specify which librarian to use for static libraries
318
319
=item C<--arflags=(flags)>
320
321
Use the given librarian flags for static libraris
322
323
=item C<--ld=(linker)>
324
325
Specify which loader to use for shared libraries.
326
327
=item C<--ldflags=(flags)>
328
329
Use the given loader flags for shared libraries
330
331
=item C<--disable-rpath>
332
333
Specify that rpath should not be included in linking flags. With this
334
configuration option, you must append the library build directory
335
(usually blib/lib) to the LD_LIBRARY_PATH environment variable (or your
336
platform equivalent). This option is primarily used for building Linux
337
packages.
338
339
=item C<--lex=(lexer)>
340
341
Specify which lexer to use.
342
343
=item C<--yacc=(parser)>
344
345
Specify which parser to use.
Leopold Toetsch
Feb 28, 2004
346
347
=item C<--define=val1[,val2]>
348
349
Generate "#define PARROT_DEF_VAL1 1" ... entries in has_header.h. Currently
350
needed to use inet_aton for systems that lack inet_pton:
354
=item C<--no-line-directives>
355
356
Disables the creation of C #line directives when generating C from PMCs and
357
ops. Useful when debugging internals.
365
=item C<--intval=(type)>
366
367
Use the given type for C<INTVAL>.
368
369
=item C<--floatval=(type)>
370
371
Use the given type for C<FLOATVAL>.
372
373
=item C<--opcode=(type)>
374
375
Use the given type for opcodes.
376
377
=item C<--ops=(files)>
378
379
Use the given ops files.
380
381
=back
382
383
=head2 International Components For Unicode (ICU) Options
387
=item C<--icu-config=/path/to/icu-config>
388
389
Use the specified icu-config script to determine the necessary ICU options.
391
Use --icu-config=none to disable the autodetect feature. Parrot will then be
392
build without ICU.
394
B<Note:> If you specify another ICU option than --icu-config, the autodetection
395
functionality will be disabled.
397
=item C<--icushared=(linkeroption)>
398
Leopold Toetsch
Dec 14, 2005
399
Linker command to link against ICU library.
400
401
E.g.
402
403
--icushared='-L /opt/openoffice/program -licudata -licuuc'
404
405
(The libs in openoffice are actually version 2.2 and do not work)
406
407
=item C<--icuheaders=(header_dir)>
408
409
Location of ICU header files without the /unicode suffix.
410
411
E.g.
412
413
--icuheaders='/home/lt/icu/'
414
415
=back
416
423
Use this option if you want imcc's parser and lexer files to be generated.
424
Needs a working parser and lexer.
426
=item C<--with-llvm>
427
428
Use this option if you have a recent version of LLVM installed and wish Parrot
429
to link to it.
430
May 24, 2002
431
=back
433
=head1 CONFIGURATION-FILE INTERFACE
434
435
In the Configuration-File interface, unlike the Command-Line interface, you
436
may delete configuration steps or run them in an order different from that
437
listed in Parrot::Configure::Step::List.
438
439
A configuration file is a plain-text file located somewhere in or under your
440
top-level Parrot directory. Unless indicated otherwise, all lines in this
441
file must have no leading whitespace. As in Perl 5, lines beginning with C<#>
442
marks are comments and are ignored during parsing of the file. Unlike Perl 5,
443
you may not begin comments in the middle of a line.
444
445
The configuration file must contain these three sections:
446
447
=over 4
448
449
=item * variables
450
451
=over 4
452
453
=item *
454
455
Section begins with line C<=variables> and must be followed by at least one
456
blank line. All other content in this section is optional.
457
458
=item *
459
460
Section may contain one or more I<key=value> pairs which assign strings to
461
variables much in the way that you would do in a shell script wrapping around
462
F<Configure.pl>.
463
464
=variables
465
466
CC=/usr/bin/gcc
467
CX=/usr/bin/g++
468
469
So if you typically invoked F<Configure.pl> by wrapping it in a shell script
470
for the purpose of setting environmental variables used in options, like this:
471
472
CC="/usr/bin/gcc"
473
CX="/usr/bin/g++"
474
/usr/local/bin/perl Configure.pl \
475
--cc="$CC" \
476
--link="$CX" \
477
--ld="$CX"
478
479
... you would now place the assignments to C<CC> and C<CX> in the
480
I<=variables> section of the configuration file (as above).
481
482
In addition, should you wish to use an option whose value contains whitespace
483
and would, if presented on the command-line, require quoting, you may
484
assign that string to a variable and then use the variable in the C<general>
485
section below.
486
487
LONGLONG=long long
488
489
=back
490
491
=item * general
492
493
=over 4
494
495
=item *
496
497
Section begins with line C<=general> and must be followed by at least one
498
blank line. All other content in this section is optional.
499
500
=item *
501
502
This section is the location recommended for listing options whose impact is
503
not conceptually limited to a single step. It is also the location where the
504
variables defined in the I<=variables> section are assigned to particular
505
Parrot configuration options. Entries in this section must be either
506
I<option=value> pairs or be options which will be assigned a true value.
507
508
cc=$CC
509
link=$CX
510
ld=/usr/bin/g++
511
verbose
512
513
Note that when the value is a variable defined in the I<=variables> section,
514
it must be preceded by a C<$> sign.
515
518
Alternatively, if assignment of a value to an option on the command-line would
519
require quoting due to the presence of whitespace in the value, you may assign
520
it to a value in the I<=general> section by double-quoting the value.
521
522
intval="long long"
523
524
=item *
525
526
You I<may> list options here which are I<conceptually> limited to a single
527
configuration step. For example, if you wished to skip validation of the
528
F<MANIFEST> during configuration and to configure without ICU, you I<could>,
529
in this section, say:
530
531
nomanicheck
532
without-icu
533
534
However, as we shall quickly see, it's conceptually clearer to place these
535
values next to those configuration steps that actually use them.
536
537
=back
538
539
=item * steps
540
541
=over 4
542
543
=item *
544
545
Section begins with line C<=steps> and must be followed by at least one
546
blank line, in turn followed by the list of configuration steps, followed by
547
another blank line followed by a line C<=cut> (just like POD).
548
549
=item *
550
551
The order in which you list the steps is the order in which they will be
552
executed. If you delete a step from the canonical list or comment a step out,
553
it will not be executed.
554
555
...
556
auto::snprintf
557
# auto::perldoc
558
auto::ctags
559
...
560
561
In the above example, step C<auto::perldoc> will be completely skipped. You
562
will not see it listed as C<....skipped> in F<Configure.pl>'s output; it will
563
simply not be there at all.
564
565
=item *
566
567
This is the recommended location to call options whose impact is
568
I<conceptually> limited to a single configuration step. Type the
569
configuration step's name, type a whitespace, type the option (with no leading
570
C<-->) and repeat as needed for additional step-specific options.
571
572
init::manifest nomanicheck
573
...
574
575
=item *
576
577
This is also the location to call options whose impact is limited to one step
578
at a time but which may be applied to more than one configuration step. The
579
C<fatal-step> and C<verbose-step> options are the best examples of this case.
580
Rather than requesting verbose output from all configuration steps, you may,
581
for example, wish to designate only a few steps for verbose output:
582
583
...
584
init::hints verbose-step
586
inter::progs fatal-step
587
...
588
auto::gcc verbose-step
589
...
590
591
In the above example, F<Configure.pl> will grind to a halt if C<inter::progs>
592
does not complete successfully. You will get verbose output only from
593
C<init::hints> and C<auto::gcc>; the other 60+ steps will be terse.
594
595
=item *
596
597
Nothing prevents you from listing general options anywhere in this section.
598
599
init::manifest nomanicheck cc=$CC ld=/usr/bin/g++ verbose
600
init::defaults
601
...
602
603
That will work -- but why would you want to do something that messy?
604
605
=back
606
607
=back
608
609
=head2 Example
610
611
Ignoring leading whitespace, this is an example of a correctly formed
612
configuration file.
613
614
=variables
615
616
CC=/usr/bin/gcc
617
CX=/usr/bin/g++
618
619
=general
620
621
cc=$CC
622
link=$CX
623
ld=/usr/bin/g++
624
625
=steps
626
627
init::manifest nomanicheck
628
init::defaults
629
init::install
630
init::hints verbose-step
631
inter::progs
632
inter::make
633
inter::lex
634
inter::yacc
635
auto::gcc
636
auto::glibc
637
auto::backtrace
638
auto::fink
639
auto::macports
640
auto::msvc
641
auto::attributes
642
auto::warnings
643
init::optimize
644
inter::shlibs
645
inter::libparrot
646
inter::types
647
auto::ops
648
auto::alignptrs
649
auto::headers
650
auto::sizes
651
auto::byteorder
652
auto::va_ptr
653
auto::format
654
auto::isreg
655
auto::arch
656
auto::jit
657
auto::cpu
658
auto::inline
659
auto::gc
660
auto::memalign
661
auto::signal
662
auto::socklen_t
663
auto::env
664
auto::gmp
665
auto::readline
666
auto::pcre
667
auto::opengl
668
auto::gettext
669
auto::snprintf
670
# auto::perldoc
671
auto::ctags
672
auto::revision
673
auto::icu
674
auto::platform
675
gen::config_h
676
gen::core_pmcs
677
gen::opengl
678
gen::makefiles
679
gen::config_pm
680
681
=cut
682
683
You may see how this works in practice by calling:
684
685
perl Configure.pl --file=examples/config/file/configcompiler
689
perl Configure.pl --file=examples/config/file/configwithfatalstep
691
=head1 SEE ALSO
692
693
F<lib/Parrot/Configure.pm>,
694
F<lib/Parrot/Configure/Step.pm>, F<docs/configuration.pod>
695
696
=cut
698
# Local Variables:
699
# mode: cperl
700
# cperl-indent-level: 4
701
# fill-column: 100
702
# End:
703
# vim: expandtab shiftwidth=4: