Skip to content
This repository
tag: RELEASE_0_4_10
Fetching contributors…

Cannot retrieve contributors at this time

file 566 lines (387 sloc) 13.937 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566
#! perl

# Copyright (C) 2001-2006, The Perl Foundation.
# $Id$

=head1 NAME

Configure.pl - Parrot's Configuration Script

=head1 SYNOPSIS

% perl Configure.pl [options]

=head1 DESCRIPTION

This is Parrot's configuration program. It should be run to create
the necessary system-specific files before building Parrot.

=head2 Command-line Options

General Options

=over

=item C<--help>

Prints out a description of the options and exits.

=item C<--version>

Prints out the version number of Configure.pl and exits.

=item C<--verbose>

Tells Configure.pl to output extra information about the configuration data it
is setting.

=item C<--verbose=2>

Tells Configure.pl to output information about i<every> setting added or
changed.

=item C<--verbose-step={N|regex}>

Run C<--verbose=2> for step number C<N> or matching description.

=item C<--nomanicheck>

Tells Configure.pl not to run the MANIFEST check.

=item C<--prefix>

Sets the location where parrot will be installed.

=item C<--step==>

execute a single configure step

=item C<--ask>

This turns on the user prompts.

=back

Compile Options

=over

=item C<--debugging=0>

Debugging is turned on by default. Use this to disable it.

=item C<--parrot_is_shared>

Link parrot dynamically.

=item C<--m=32>

Create a 32-bit executable on 64-architectures like x86_64. This
option appends -m32 to compiler and linker programs and does
s/lib64/lib/g on link flags.

This option is experimental. See F<config/init/defaults.pm> for more.

=item C<--profile>

Turn on profiled compile (gcc only for now)

=item C<--cage>

[CAGE] compile includes many additional warnings

=item C<--optimize>

Add perl5's $Config{optimize} to the compiler flags.

=item C<--optimize=flags>

Add C<flags> to the compiler flags.

=item C<--inline>

Tell Configure that the compiler supports C<inline>.

=item C<--cc=(compiler)>

Specify which compiler to use.

=item C<--ccflags=(flags)>

Use the given compiler flags.

=item C<--ccwarn=(flags)>

Use the given compiler warning flags.

=item C<--cxx=(compiler)>

Specify which C++ compiler to use (for ICU).

=item C<--libs=(libs)>

Use the given libraries.

=item C<--link=(linker)>

Specify which linker to use.

=item C<--linkflags=(flags)>

Use the given linker flags

=item C<--ld=(linker)>

Specify which loader to use for shared libraries.

=item C<--ldflags=(flags)>

Use the given loader flags for shared libraries

=item C<--lex=(lexer)>

Specify which lexer to use.

=item C<--flex_required=X.Y.Z>

Override the minimum acceptable flex version.

=item C<--yacc=(parser)>

Specify which parser to use.

=item C<--bison_required=X.Y>

Override the minimum acceptable bison version.

=item C<--define=val1[,val2]>

Generate "#define PARROT_DEF_VAL1 1" ... entries in has_header.h. Currently
needed to use inet_aton for systems that lack inet_pton:

--define=inet_aton

=back

Parrot Options

=over

=item C<--intval=(type)>

Use the given type for C<INTVAL>.

=item C<--floatval=(type)>

Use the given type for C<FLOATVAL>.

=item C<--opcode=(type)>

Use the given type for opcodes.

=item C<--ops=(files)>

Use the given ops files.

=item C<--pmc=(files)>

Use the given PMC files.

=item C<--cgoto=0>

Don't build cgoto core. This is recommended when you are short of memory.

=item C<--jitcapable>

Use JIT system.

=item C<--execcapable>

Use JIT to emit a native executable.

=item C<--gc=(type)>

Determine the type of garbage collection. The value for C<type> should be one
of: C<gc>, C<libc>, C<malloc> or C<malloc-trace>. The default is C<gc>.

=back

International Components For Unicode (ICU) Options

=over

=item C<--icu-config=/path/to/icu-config>

Use the specified icu-config script to determine the necessary ICU options.

Use --icu-config=none to disable the autodetect feature. Parrot will then be
build without ICU.

B<Note:> If you specify another ICU option than --icu-config, the autodetection
functionality will be disabled.

=item C<--icushared=(linkeroption)>

Linker command to link against ICU library.

E.g.

--icushared='-L /opt/openoffice/program -licudata -licuuc'

(The libs in openoffice are actually version 2.2 and do not work)

=item C<--icuheaders=(header_dir)>

Location of ICU header files without the /unicode suffix.

E.g.

--icuheaders='/home/lt/icu/'

=back

Other Options

=over

=item C<--maintainer>

Use this option if you want imcc's parser and lexer files to be generated.
Needs a working parser and lexer.

=item C<--miniparrot>

Build parrot assuming only pure ANSI C is available.

=back

=head1 SEE ALSO

F<config/init/data.pl>, F<lib/Parrot/Configure/RunSteps.pm>,
F<lib/Parrot/Configure/Step.pm>, F<docs/configuration.pod>

=cut

use 5.006_001;
use strict;
use warnings;
use lib 'lib';

use English qw( -no_match_vars );
use Parrot::BuildUtil;
use Parrot::Configure;

# These globals are accessed in config/init/defaults.pm
our $parrot_version = Parrot::BuildUtil::parrot_version();
our @parrot_version = Parrot::BuildUtil::parrot_version();

$OUTPUT_AUTOFLUSH = 1;

# Install Option text was taken from:
#
# autoconf (GNU Autoconf) 2.59
# Written by David J. MacKenzie and Akim Demaille.
#
# Copyright (C) 2003 Free Software Foundation, Inc.
# This is free software; see the source for copying conditions. There is NO
# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# Installation directories:

# Handle options

my @valid_opts = qw(ask bindir cage cc ccflags ccwarn cgoto cxx datadir
debugging define exec-prefix execcapable floatval gc help icu-config
icudatadir icuheaders icushared includedir infodir inline intval
jitcapable ld ldflags lex libdir libexecdir libs link linkflags
localstatedir m maintainer mandir miniparrot nomanicheck oldincludedir
opcode ops optimize parrot_is_shared pmc prefix profile sbindir
sharedstatedir step sysconfdir verbose verbose-step=N version without-gdbm
without-gmp without-icu yacc);

my %args;
for (@ARGV) {
    my ( $key, $value ) = m/--([-\w]+)(?:=(.*))?/;
    $key = 'help' unless defined $key;
    $value = 1 unless defined $value;

    unless ( grep $key eq $_, @valid_opts ) {
        die qq/Invalid option $key. See "perl Configure.pl --help" for valid options\n/;
    }

    for ($key) {
        m/version/ && do {
            my $svnid = '$Id$';
            print <<"END";
Parrot Version $parrot_version Configure 2.0
$svnid
END
            exit;
        };

        m/help/ && do {
            print <<"EOT";
$0 - Parrot Configure 2.0

General Options:

--help Show this text
--version Show version information
--verbose Output extra information
--verbose=2 Output every setting change
--verbose-step=N Set verbose for step N only
--verbose-step=regex Set verbose for step matching description
--nomanicheck Don't check the MANIFEST
--step=(gen::languages)
Execute a single configure step

--ask Have Configure ask for commonly-changed info

Compile Options:

--debugging=0 Disable debugging, default = 1
--inline Compiler supports inline
--optimize Optimized compile
--optimize=flags Add given optimizer flags
--parrot_is_shared Link parrot dynamically
--m=32 Build 32bit executable on 64-bit architecture.
--profile Turn on profiled compile (gcc only for now)
--cage [CAGE] compile includes many additional warnings

--cc=(compiler) Use the given compiler
--ccflags=(flags) Use the given compiler flags
--ccwarn=(flags) Use the given compiler warning flags
--cxx=(compiler) Use the given C++ compiler
--libs=(libs) Use the given libraries
--link=(linker) Use the given linker
--linkflags=(flags) Use the given linker flags
--ld=(linker) Use the given loader for shared libraries
--ldflags=(flags) Use the given loader flags for shared libraries
--lex=(lexer) Use the given lexical analyzer generator
--yacc=(parser) Use the given parser generator

--define=inet_aton Quick hack to use inet_aton instead of inet_pton

Parrot Options:

--intval=(type) Use the given type for INTVAL
--floatval=(type) Use the given type for FLOATVAL
--opcode=(type) Use the given type for opcodes
--ops=(files) Use the given ops files
--pmc=(files) Use the given PMC files

--cgoto=0 Don't build cgoto core - recommended when short of mem
--jitcapable Use JIT
--execcapable Use JIT to emit a native executable
--gc=(type) Determine the type of garbage collection
type=(gc|libc|malloc|malloc-trace) default is gc

External Library Options:

--without-gmp Build parrot without GMP support
--without-gdbm Build parrot without GDBM support

ICU Options:

For using a system ICU, these options can be used:

--icu-config=/path/to/icu-config
Location of the script used for ICU autodetection.
You just need to specify this option if icu-config
is not in you PATH.

--icu-config=none can be used to disable the autodetection feature.
It will also be disabled if you specify any other
of the following ICU options.

If you do not have a full ICU installation:

--without-icu Build parrot without ICU support
--icuheaders=(path) Location of ICU headers without /unicode
--icushared=(flags) Full linker command to create shared libraries
--icudatadir=(path) Directory to locate ICU's data file(s)

Other Options (may not be implemented):

--maintainer Create imcc's parser and lexer files. Needs a working
parser and lexer.
--miniparrot Build parrot assuming only pure ANSI C is available

Install Options:

--prefix=PREFIX install architecture-independent files in PREFIX
[/usr/local]
--exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
[PREFIX]

By default, `make install' will install all the files in
`/usr/local/bin', `/usr/local/lib' etc. You can specify
an installation prefix other than `/usr/local' using `--prefix',
for instance `--prefix=\$HOME'.

For better control, use the options below.

Fine tuning of the installation directories:
--bindir=DIR user executables [EPREFIX/bin]
--sbindir=DIR system admin executables [EPREFIX/sbin]
--libexecdir=DIR program executables [EPREFIX/libexec]
--datadir=DIR read-only architecture-independent data [PREFIX/share]
--sysconfdir=DIR read-only single-machine data [PREFIX/etc]
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
--localstatedir=DIR modifiable single-machine data [PREFIX/var]
--libdir=DIR object code libraries [EPREFIX/lib]
--includedir=DIR C header files [PREFIX/include]
--oldincludedir=DIR C header files for non-gcc [/usr/include]
--infodir=DIR info documentation [PREFIX/info]
--mandir=DIR man documentation [PREFIX/man]

EOT
            exit;
        };
        $args{$key} = $value;
    }
}

$args{debugging} = 1 unless ( ( exists $args{debugging} ) && !$args{debugging} );
$args{maintainer} = 1 if defined $args{lex} or defined $args{yacc};

print <<"END";
Parrot Version $parrot_version Configure 2.0
Copyright (C) 2001-2007, The Perl Foundation.

Hello, I'm Configure. My job is to poke and prod your system to figure out
how to build Parrot. The process is completely automated, unless you passed in
the `--ask' flag on the command line, in which case it'll prompt you for a few
pieces of info.

Since you're running this program, you obviously have Perl 5--I'll be pulling
some defaults from its configuration.
END

# EDIT HERE TO ADD NEW TESTS
my @steps = qw(
init::manifest
init::defaults
init::install
init::miniparrot
init::hints
init::headers
inter::progs
inter::make
inter::lex
inter::yacc
auto::gcc
auto::msvc
init::optimize
inter::shlibs
inter::libparrot
inter::charset
inter::encoding
inter::types
inter::ops
inter::pmc
auto::alignptrs
auto::headers
auto::sizes
auto::byteorder
auto::va_ptr
auto::pack
auto::format
auto::isreg
auto::jit
gen::cpu
auto::funcptr
auto::cgoto
auto::inline
auto::gc
auto::memalign
auto::signal
auto::socklen_t
auto::env
auto::aio
auto::gmp
auto::readline
auto::gdbm
auto::snprintf
auto::perldoc
auto::python
auto::bc
auto::m4
auto::cpu
gen::icu
gen::revision
gen::config_h
gen::core_pmcs
gen::parrot_include
gen::languages
gen::makefiles
gen::platform
gen::config_pm
);

my $conf = Parrot::Configure->new;
{

    # RT#41201 $Parrot::Configure::Step::conf is a temporary hack
    no warnings qw(once);
    $Parrot::Configure::Step::conf = $conf;
}
$conf->add_steps(@steps);
$conf->options->set(%args);

if ( exists $args{step} ) {
    $conf->data()->slurp();
    $conf->runstep( $args{step} );
    print "\n";
    exit(0);
}
else {

    # Run the actual steps
    $conf->runsteps or exit(1);
}

# tell users what to do next
my $make = $conf->data->get('make');

print <<"END";

Okay, we're done!

You can now use `$make' to build your Parrot.
(NOTE: do not use `$make -j <n>'!)
After that, you can use `$make test' to run the test suite.

Happy Hacking,
The Parrot Team

END

exit(0);

# Local Variables:
# mode: cperl
# cperl-indent-level: 4
# fill-column: 100
# End:
# vim: expandtab shiftwidth=4:
Something went wrong with that request. Please try again.