* include/parrot/sub.h:
[parrot.git] / Configure.pl
blob97fcc909ba2a3d9633037e673b773cdc13443540
1 #! perl
3 # Copyright (C) 2001-2006, The Perl Foundation.
4 # $Id$
6 =head1 NAME
8 Configure.pl - Parrot's Configuration Script
10 =head1 SYNOPSIS
12 % perl Configure.pl [options]
14 =head1 DESCRIPTION
16 This is Parrot's configuration program. It should be run to create
17 the necessary system-specific files before building Parrot.
19 =head2 Command-line Options
21 General Options
23 =over
25 =item C<--help>
27 Prints out a description of the options and exits.
29 =item C<--version>
31 Prints out the version number of Configure.pl and exits.
33 =item C<--verbose>
35 Tells Configure.pl to output extra information about the configuration data it
36 is setting.
38 =item C<--verbose=2>
40 Tells Configure.pl to output information about i<every> setting added or
41 changed.
43 =item C<--verbose-step={N|regex}>
45 Run C<--verbose=2> for step number C<N> or matching description.
47 =item C<--nomanicheck>
49 Tells Configure.pl not to run the MANIFEST check.
51 =item C<--prefix>
53 Sets the location where parrot will be installed.
55 =item C<--ask>
57 This turns on the user prompts.
59 =back
61 Compile Options
63 =over
65 =item C<--debugging=0>
67 Debugging is turned on by default. Use this to disable it.
69 =item C<--parrot_is_shared>
71 Link parrot dynamically.
73 =item C<--m=32>
75 Create a 32-bit executable on 64-architectures like x86_64. This
76 option appends -m32 to compiler and linker programs and does
77 s/lib64/lib/g on link flags.
79 This option is experimental. See F<config/init/defaults.pm> for more.
81 =item C<--profile>
83 Turn on profiled compile (gcc only for now)
85 =item C<--optimize>
87 Add perl5's $Config{optimize} to the compiler flags.
89 =item C<--optimize=flags>
91 Add C<flags> to the compiler flags.
93 =item C<--inline>
95 Tell Configure that the compiler supports C<inline>.
97 =item C<--cc=(compiler)>
99 Specify which compiler to use.
101 =item C<--ccflags=(flags)>
103 Use the given compiler flags.
105 =item C<--ccwarn=(flags)>
107 Use the given compiler warning flags.
109 =item C<--cxx=(compiler)>
111 Specify which C++ compiler to use (for ICU).
113 =item C<--libs=(libs)>
115 Use the given libraries.
117 =item C<--link=(linker)>
119 Specify which linker to use.
121 =item C<--linkflags=(flags)>
123 Use the given linker flags
125 =item C<--ld=(linker)>
127 Specify which loader to use for shared libraries.
129 =item C<--ldflags=(flags)>
131 Use the given loader flags for shared libraries
133 =item C<--lex=(lexer)>
135 Specify which lexer to use.
137 =item C<--flex_required=X.Y.Z>
139 Override the minimum acceptable flex version.
141 =item C<--yacc=(parser)>
143 Specify which parser to use.
145 =item C<--bison_required=X.Y>
147 Override the minimum acceptable bison version.
149 =item C<--define=val1[,val2]>
151 Generate "#define PARROT_DEF_VAL1 1" ... entries in has_header.h. Currently
152 needed to use inet_aton for systems that lack inet_pton:
154 --define=inet_aton
156 =back
158 Parrot Options
160 =over
162 =item C<--intval=(type)>
164 Use the given type for C<INTVAL>.
166 =item C<--floatval=(type)>
168 Use the given type for C<FLOATVAL>.
170 =item C<--opcode=(type)>
172 Use the given type for opcodes.
174 =item C<--ops=(files)>
176 Use the given ops files.
178 =item C<--pmc=(files)>
180 Use the given PMC files.
182 =item C<--cgoto=0>
184 Don't build cgoto core. This is recommended when you are short of memory.
186 =item C<--jitcapable>
188 Use JIT system.
190 =item C<--execcapable>
192 Use JIT to emit a native executable.
194 =item C<--gc=(type)>
196 Determine the type of garbage collection. The value for C<type> should be one
197 of: C<gc>, C<libc>, C<malloc> or C<malloc-trace>. The default is C<gc>.
199 =back
201 ICU Options
203 =over
205 =item C<--icu-config=/path/to/icu-config>
207 Use the specified icu-config script to determine the necessary ICU options.
209 Use --icu-config=none to disable the autodetect feature. Parrot will then be
210 build without ICU.
212 B<Note:> If you specify another ICU option than --icu-config, the autodetection
213 functionality will be disabled.
215 =item C<--icushared=(linkeroption)>
217 Linker command to link against ICU library.
219 E.g.
221 --icushared='-L /opt/openoffice/program -licudata -licuuc'
223 (The libs in openoffice are actually version 2.2 and do not work)
225 =item C<--icuheaders=(header_dir)>
227 Location of ICU header files without the /unicode suffix.
229 E.g.
231 --icuheaders='/home/lt/icu/'
233 =back
235 Other Options
237 =over
239 =item C<--maintainer>
241 Use this option if you want imcc's parser and lexer files to be generated.
242 Needs a working parser and lexer.
244 =item C<--miniparrot>
246 Build parrot assuming only pure ANSI C is available.
248 =back
250 =head1 SEE ALSO
252 F<config/init/data.pl>, F<lib/Parrot/Configure/RunSteps.pm>,
253 F<lib/Parrot/Configure/Step.pm>, F<docs/configuration.pod>
255 =cut
257 use 5.006_001;
258 use strict;
259 use warnings;
260 use lib 'lib';
262 use English qw( -no_match_vars );
263 use Parrot::BuildUtil;
264 use Parrot::Configure;
266 # These globals are accessed in config/init/defaults.pm
267 our $parrot_version = Parrot::BuildUtil::parrot_version();
268 our @parrot_version = Parrot::BuildUtil::parrot_version();
270 $OUTPUT_AUTOFLUSH = 1;
272 # Install Option text was taken from:
274 # autoconf (GNU Autoconf) 2.59
275 # Written by David J. MacKenzie and Akim Demaille.
277 # Copyright (C) 2003 Free Software Foundation, Inc.
278 # This is free software; see the source for copying conditions. There is NO
279 # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
280 # Installation directories:
283 # Handle options
284 my %args;
285 for (@ARGV) {
286 my($key, $value) = m/--([-\w]+)(?:=(.*))?/;
287 $key = 'help' unless defined $key;
288 $value = 1 unless defined $value;
290 for ($key) {
291 m/version/ && do {
292 my $svnid = '$Id$';
293 print <<"END";
294 Parrot Version $parrot_version Configure 2.0
295 $svnid
297 exit;
300 m/help/ && do {
301 print <<"EOT";
302 $0 - Parrot Configure 2.0
304 General Options:
306 --help Show this text
307 --version Show version information
308 --verbose Output extra information
309 --verbose=2 Output every setting change
310 --verbose-step=N Set verbose for step N only
311 --verbose-step=regex Set verbose for step matching description
312 --nomanicheck Don't check the MANIFEST
314 --ask Have Configure ask for commonly-changed info
316 Compile Options:
318 --debugging=0 Disable debugging, default = 1
319 --inline Compiler supports inline
320 --optimize Optimized compile
321 --optimize=flags Add given optimizer flags
322 --parrot_is_shared Link parrot dynamically
323 --m=32 Build 32bit executable on 64-bit architecture.
324 --profile Turn on profiled compile (gcc only for now)
326 --cc=(compiler) Use the given compiler
327 --ccflags=(flags) Use the given compiler flags
328 --ccwarn=(flags) Use the given compiler warning flags
329 --cxx=(compiler) Use the given C++ compiler
330 --libs=(libs) Use the given libraries
331 --link=(linker) Use the given linker
332 --linkflags=(flags) Use the given linker flags
333 --ld=(linker) Use the given loader for shared libraries
334 --ldflags=(flags) Use the given loader flags for shared libraries
335 --lex=(lexer) Use the given lexical analyzer generator
336 --yacc=(parser) Use the given parser generator
338 --define=inet_aton Quick hack to use inet_aton instead of inet_pton
340 Parrot Options:
342 --intval=(type) Use the given type for INTVAL
343 --floatval=(type) Use the given type for FLOATVAL
344 --opcode=(type) Use the given type for opcodes
345 --ops=(files) Use the given ops files
346 --pmc=(files) Use the given PMC files
348 --cgoto=0 Don't build cgoto core - recommended when short of mem
349 --jitcapable Use JIT
350 --execcapable Use JIT to emit a native executable
351 --gc=(type) Determine the type of garbage collection
352 type=(gc|libc|malloc|malloc-trace) default is gc
354 ICU Options:
356 For using a system ICU, these options can be used:
358 --icu-config=/path/to/icu-config
359 Location of the script used for ICU autodetection.
360 You just need to specify this option if icu-config
361 is not in you PATH.
363 --icu-config=none can be used to disable the autodetection feature.
364 It will also be disabled if you specify any other
365 of the following ICU options.
367 If you do not have a full ICU installation:
369 --without-icu Build parrot without ICU support
370 --icuheaders=(path) Location of ICU headers without /unicode
371 --icushared=(flags) Full linker command to create shared libraries
372 --icudatadir=(path) Directory to locate ICU's data file(s)
374 Other Options (may not be implemented):
376 --maintainer Create imcc's parser and lexer files. Needs a working
377 parser and lexer.
378 --miniparrot Build parrot assuming only pure ANSI C is available
380 Install Options:
382 --prefix=PREFIX install architecture-independent files in PREFIX
383 [/usr/local]
384 --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
385 [PREFIX]
387 By default, `make install' will install all the files in
388 `/usr/local/bin', `/usr/local/lib' etc. You can specify
389 an installation prefix other than `/usr/local' using `--prefix',
390 for instance `--prefix=\$HOME'.
392 For better control, use the options below.
394 Fine tuning of the installation directories:
395 --bindir=DIR user executables [EPREFIX/bin]
396 --sbindir=DIR system admin executables [EPREFIX/sbin]
397 --libexecdir=DIR program executables [EPREFIX/libexec]
398 --datadir=DIR read-only architecture-independent data [PREFIX/share]
399 --sysconfdir=DIR read-only single-machine data [PREFIX/etc]
400 --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
401 --localstatedir=DIR modifiable single-machine data [PREFIX/var]
402 --libdir=DIR object code libraries [EPREFIX/lib]
403 --includedir=DIR C header files [PREFIX/include]
404 --oldincludedir=DIR C header files for non-gcc [/usr/include]
405 --infodir=DIR info documentation [PREFIX/info]
406 --mandir=DIR man documentation [PREFIX/man]
409 exit;
411 $args{$key} = $value;
415 $args{debugging} = 1 unless ((exists $args{debugging}) && !$args{debugging});
416 $args{maintainer} = 1 if defined $args{lex} or defined $args{yacc};
418 print <<"END";
419 Parrot Version $parrot_version Configure 2.0
420 Copyright (C) 2001-2006, The Perl Foundation.
422 Hello, I'm Configure. My job is to poke and prod your system to figure out
423 how to build Parrot. The process is completely automated, unless you passed in
424 the `--ask' flag on the command line, in which case it'll prompt you for a few
425 pieces of info.
427 Since you're running this program, you obviously have Perl 5--I'll be pulling
428 some defaults from its configuration.
431 # EDIT HERE TO ADD NEW TESTS
432 my @steps = qw(
433 init::manifest
434 init::defaults
435 init::install
436 init::miniparrot
437 init::hints
438 init::headers
439 inter::progs
440 inter::make
441 inter::lex
442 inter::yacc
443 auto::gcc
444 auto::msvc
445 init::optimize
446 inter::shlibs
447 inter::libparrot
448 inter::charset
449 inter::encoding
450 inter::types
451 inter::ops
452 inter::pmc
453 auto::alignptrs
454 auto::headers
455 auto::sizes
456 auto::byteorder
457 auto::va_ptr
458 auto::pack
459 auto::format
460 auto::isreg
461 auto::jit
462 gen::cpu
463 auto::funcptr
464 auto::cgoto
465 auto::inline
466 auto::gc
467 auto::memalign
468 auto::signal
469 auto::socklen_t
470 auto::env
471 auto::aio
472 auto::gmp
473 auto::readline
474 auto::gdbm
475 auto::snprintf
476 auto::perldoc
477 auto::python
478 auto::bc
479 auto::m4
480 auto::cpu
481 gen::icu
482 gen::revision
483 gen::config_h
484 gen::core_pmcs
485 gen::parrot_include
486 gen::languages
487 gen::makefiles
488 gen::platform
489 gen::config_pm
492 my $conf = Parrot::Configure->new;
494 # XXX $Parrot::Configure::Step::conf is a temporty hack
495 no warnings qw(once);
496 $Parrot::Configure::Step::conf = $conf;
498 $conf->add_steps(@steps);
499 $conf->options->set(%args);
500 # Run the actual steps
501 $conf->runsteps or exit(1);
503 # tell users what to do next
504 my $make = $conf->data->get('make');
506 print <<"END";
508 Okay, we're done!
510 You can now use `$make' to build your Parrot.
511 (NOTE: do not use `$make -j <n>'!)
512 After that, you can use `$make test' to run the test suite.
514 Happy Hacking,
515 The Parrot Team
519 exit(0);
521 # Local Variables:
522 # mode: cperl
523 # cperl-indent-level: 4
524 # fill-column: 100
525 # End:
526 # vim: expandtab shiftwidth=4: