[svn:mod_parrot] r336 - in mod_parrot/branches/configure: . config config/directives lib/ModParrot lib/ModParrot/Configure
[email protected] Sat, 17 May 2008 10:56:14 -0700 (PDT)
| Newsgroups | perl.cvs.mod_parrot |
|---|---|
| Message-ID | <[email protected]> |
Author: particle
Date: Sat May 17 10:56:13 2008
New Revision: 336
Added:
mod_parrot/branches/configure/config/
mod_parrot/branches/configure/config/directives/
mod_parrot/branches/configure/config/directives/configure.op
mod_parrot/branches/configure/config/directives/core.op
mod_parrot/branches/configure/config/directives/intro.op
mod_parrot/branches/configure/config/directives/io.op
mod_parrot/branches/configure/lib/ModParrot/BuildUtil.pm
mod_parrot/branches/configure/lib/ModParrot/Configure/
mod_parrot/branches/configure/lib/ModParrot/Configure/Messages.pm
mod_parrot/branches/configure/lib/ModParrot/Configure/Options.pm
Modified:
mod_parrot/branches/configure/Configure.pl
Log:
[configure] first take at revamped mod_parrot configuration engine... only 'introduction' runs so far
Modified: mod_parrot/branches/configure/Configure.pl
==============================================================================
--- mod_parrot/branches/configure/Configure.pl (original)
+++ mod_parrot/branches/configure/Configure.pl Sat May 17 10:56:13 2008
@@ -16,9 +16,243 @@
# mod_parrot configuration script
+use 5.008;
+use strict;
+use warnings;
+
+use Carp;
+use Data::Dumper; $Data::Dumper::Indent = 1;
+use File::Spec::Functions qw( catdir catfile );
+use FindBin qw( $Bin );
+
+## XXX needed here?
use Getopt::Long;
-# parts stolen from mod_perl
+## used in tasks to find mod_parrot libraries
+use lib 'lib';
+
+
+main( @ARGV ) unless caller;
+
+
+sub main {
+ ## data store for directory operations
+ my $dirstack= [];
+
+ ## data store
+ ## TODO should this be backed by dbm::deep or something?
+ my $DS= {
+ DIRS => $dirstack,
+ MODPARROT => {
+ argv => [ @ARGV ],
+ script => $0,
+ svnid => '$Id$',
+ },
+ user => {},
+ };
+
+ my $actions= {
+ include => \&read_config,
+ define => \&define_config_directive,
+ _DEFAULT_ => \&no_such_directive,
+ DUMP => sub{ print Dumper \@_ },
+ };
+
+ my $ddir= catdir $Bin, 'config', 'directives';
+
+ ## define io commands, which operate on the directory stack
+ read_config( catfile( $ddir, 'io.op'), $actions, $dirstack );
+
+ ## define commands which operate on the data store
+ for my $f (qw/ core intro /)
+ {
+ read_config( catfile( $ddir, $f . '.op'), $actions, $DS );
+ }
+
+ ## process the list of configure directives
+ ## TODO allow the --script=s option to override this
+ read_config( catfile( $ddir, 'configure.op' ), $actions, $DS );
+}
+
+
+
+exit;
+
+
+
+sub read_config
+{
+ my( $filename, $actions, $userparam )= @_;
+ open my($CF) => $filename
+ or carp $!;
+
+ LINE: while(<$CF>)
+ {
+ chomp;
+ ## skip blank lines and comments
+ next if m/^\s*$/ || m/\s*#/;
+
+ my( $directive, $rest )= split /\s+/ => $_, 2;
+
+ ## deal with heredocs
+ ## heredoc delimeters can be any non-space chars following '<<'
+ ## and optional spaces (eg. '<< %END!' or '<<DESC')
+ $rest= read_heredoc( $CF, $1, $filename )
+ if( $rest && $rest =~ m/^<< \s* (\S*)$/x );
+
+ ## resolve the action
+ ## first try user-defined, otherwise default
+ my $action= $actions->{$directive}
+ || $actions->{_DEFAULT_};
+ if( $action )
+ {
+ $action->( $directive, $rest, $actions, $userparam );
+ }
+ else
+ {
+ die "unrecognized directive '$directive'"
+ . " at line $. of $filename; aborting";
+ }
+ }
+ return 1;
+}
+
+
+sub read_heredoc
+{
+ my( $CF, $marker, $filename )= @_;
+ my $line_num= $.;
+
+ my $rest= '';
+ while( my $buffer= <$CF>)
+ {
+ die "runaway heredoc on line $line_num of $filename; aborting"
+ unless defined $buffer;
+ last if $buffer =~ m/^$marker$/;
+ $rest .= $buffer;
+ }
+ return $rest;
+}
+
+
+sub define_config_directive
+{
+ my( $directive, $rest, $dispatch )= @_;
+ $rest =~ s/^\s+//;
+ my( $new_directive, $def_text )= split /\s+/ => $rest, 2;
+
+ if( exists $dispatch->{$new_directive} )
+ {
+ warn "$new_directive already defined; skipping.\n";
+ return;
+ }
+
+ my $def= eval "sub { $def_text }";
+ if( not defined $def )
+ {
+ warn "could not compile definition for '$new_directive':"
+ . "$@; skipping.\n";
+ return;
+ }
+
+ $dispatch->{$new_directive}= $def;
+}
+
+
+## handles missing directives
+sub no_such_directive
+{
+ my( $directive )= @_;
+ $directive ||= ''; $. ||= 0;
+ warn "unrecognized directive '$directive' at line $.; ignoring.\n";
+}
+
+
+## XXX fix passed arguments processing... it defaults to space-sep which is wrong TODO
+sub process_opts
+{
+ require ModParrot::Configure::Options;
+
+ my( $var, $val, undef, $stash )= @_;
+ my $args = ModParrot::Configure::Options::process_options( {
+ argv => [ defined $val ? $val : @ARGV ],
+ script => $0,
+ mod_parrot_version => $stash->{MODPARROT}{mod_parrot_version},
+ svnid => '$Id$',
+ } );
+ # XXX really? just exit? it should give a friendly message
+ exit unless defined $args;
+
+ set_mod_parrot_var( args => $args, undef, $stash );
+}
+
+
+## sets a mod_parrot variable to a value
+sub set_mod_parrot_var
+{
+ my( $var, $val, undef, $stash )= @_;
+ $stash->{MODPARROT}{$var}= $val;
+}
+
+
+## sets a user variable to a value
+sub set_user_var
+{
+ my( $var, $val, undef, $stash )= @_;
+ $stash->{user}{$var}= $val;
+}
+
+
+## sets a configuration variable to a value
+sub set_conf_var
+{
+ my( $var, $val, undef, $stash )= @_;
+ $stash->{user}{conf}->data->set($var, $val);
+}
+
+
+## gets a mod_parrot variable
+sub get_mod_parrot_var { $_[3]->{MODPARROT}{$_[0]} }
+
+
+## gets a user variable
+sub get_user_var { $_[3]->{user}{$_[0]} }
+
+
+## gets a value from the configuration
+sub get_conf_var { $_[3]->{user}{conf}->data->get($_[0]) }
+
+
+## resets all mod_parrot variables
+sub reset_mod_parrot_vars
+{
+ my( undef, undef, undef, $stash )= @_;
+ delete $stash->{MODPARROT};
+ $stash->{MODPARROT}= {};
+}
+
+
+## resets all user variables
+sub reset_user_vars
+{
+ my( $var, undef, undef, $stash )= @_;
+ delete $stash->{user};
+ $stash->{user}= {};
+}
+
+
+## quit
+sub quit { exit 0 }
+
+
+$_ ^=~ { AUTHOR => 'particle' };
+
+
+# vim: et sw=4:
+__END__
+
+
+## parts stolen from mod_perl
my %threaded_mpms = map { $_ => 1}
qw(worker winnt beos mpmt_os2 netware leader perchild threadpool);
Added: mod_parrot/branches/configure/config/directives/configure.op
==============================================================================
--- (empty file)
+++ mod_parrot/branches/configure/config/directives/configure.op Sat May 17 10:56:13 2008
@@ -0,0 +1,86 @@
+## get the mod_parrot version (or override it by passing an optional value)
+mod_parrot_version
+
+## here i'm overriding the command-line vars passed to Configure.pl
+#process_opts --test=configure
+process_opts
+
+### that will cause this op to run, since $args{test} eq 'configure'
+#test configure
+
+## print the intro
+introduction
+
+### TODO do we really want this here, or should it exist by default?
+#configure_new
+#configure_set_args
+#
+### run the configuration steps
+#run init::manifest
+#run init::defaults
+#run init::install
+#run init::miniparrot
+#run init::hints
+#run init::headers
+#run inter::progs
+#run inter::make
+#run inter::lex
+#run inter::yacc
+#run auto::gcc
+#run auto::msvc
+#run init::optimize
+#run inter::shlibs
+#run inter::libparrot
+#run inter::charset
+#run inter::encoding
+#run inter::types
+#run inter::ops
+### pass options to a specific config step
+##run inter::pmc --ask
+#run inter::pmc
+#run auto::alignptrs
+#run auto::headers
+#run auto::sizes
+#run auto::byteorder
+#run auto::va_ptr
+#run auto::pack
+#run auto::format
+#run auto::isreg
+#run auto::jit
+#run gen::cpu
+#run auto::funcptr
+#run auto::cgoto
+#run auto::inline
+#run auto::gc
+#run auto::memalign
+#run auto::signal
+#run auto::socklen_t
+#run auto::env
+#run auto::aio
+#run auto::gmp
+#run auto::readline
+#run auto::gdbm
+#run auto::snprintf
+#run auto::perldoc
+### look, i can easily disable one or more config steps now
+##run auto::python
+##run auto::m4
+#run auto::cpu
+#run gen::icu
+#run gen::revision
+#run gen::config_h
+#run gen::core_pmcs
+#run gen::parrot_include
+#run gen::languages
+#run gen::makefiles
+#run gen::platform
+#run gen::config_pm
+
+
+#test build
+
+#conclusion
+
+## dump the entire structure at any time for easy debugging
+#DUMP
+
Added: mod_parrot/branches/configure/config/directives/core.op
==============================================================================
--- (empty file)
+++ mod_parrot/branches/configure/config/directives/core.op Sat May 17 10:56:13 2008
@@ -0,0 +1,120 @@
+## core commands
+
+## set the mod_parrot version to the value in the VERSION file
+## override the default behavior by passing in a value
+## e.g. "mod_parrot_version a.b.c"
+define <<PARROT_VERSION
+mod_parrot_version
+ require ModParrot::BuildUtil;
+ my( $var, $val, $actions, $stash )= @_;
+ set_mod_parrot_var(
+ mod_parrot_version => $val || scalar &ModParrot::BuildUtil::mod_parrot_version(),
+ $actions, $stash
+ );
+PARROT_VERSION
+
+
+## process command-line options
+## this is defined in Configure.pl for now
+## since it's easier to get some variable values there
+define process_opts &process_opts
+
+
+## create the configure object
+define <<CONFIGURE_NEW
+configure_new
+ require ModParrot::Configure;
+ set_user_var( conf => ModParrot::Configure->new, @_[2,3] );
+CONFIGURE_NEW
+
+
+## add the command-line options to the configure object
+define <<CONFIGURE_SET_ARGS
+configure_set_args
+ my( $var, $val, undef, $stash )= @_;
+ my $conf = $stash->{user}{conf};
+ $conf->options->set( %{$stash->{PARROT}{args}} );
+CONFIGURE_SET_ARGS
+
+
+## add steps to perform during configure
+## XXX params are space-separated now, make sure this is okay
+## CURRENTLY UNUSED, see 'run'
+define <<ADD_STEP
+add_step
+ my( $var, $val, undef, $stash )= @_;
+ my $conf = $stash->{user}{conf};
+ my( $step, @params )= split /\s+/ => $val;
+ $conf->add_step($step, @params);
+ADD_STEP
+
+
+## add the command-line options to the configure object
+## CURRENTLY UNUSED, see 'run'
+define <<CONFIGURE_RUN
+configure_run
+ my( $var, $val, undef, $stash )= @_;
+ my $conf = $stash->{user}{conf};
+ my $args = $stash->{PARROT}{args};
+ my %args = %$args;
+
+ if ( exists $args{step} ) {
+ # from ModParrot::Configure::Data
+ $conf->data()->slurp();
+ # from ModParrot::Configure
+ $conf->runstep( $args{step} );
+ print "\n";
+ }
+ else {
+ # Run the actual steps
+ # from ModParrot::Configure
+ $conf->runsteps or exit(1);
+ }
+CONFIGURE_RUN
+
+
+## add a step to the configure process and run it
+## XXX params are space-separated now, make sure this is okay
+## XXX it seems --step=foo is broken! TODO
+define <<RUN
+run
+ my( $var, $val, undef, $stash )= @_;
+ my $conf = $stash->{user}{conf};
+ my $args = $stash->{PARROT}{args};
+ my %args = %$args;
+
+ my( $step, @params )= split /\s+/ => $val;
+
+ if( exists $args{step} ) {
+ return unless $args{step} eq $step;
+ }
+
+ $conf->add_step($step, @params);
+# $conf->data()->slurp();
+ $conf->runstep( $step );
+RUN
+
+
+## testing directives
+define <<TEST
+test
+ require ModParrot::Configure::Options::Test;
+ my( $var, $val, undef, $stash )= @_;
+ my $args = $stash->{PARROT}{args};
+ my $opttest = ModParrot::Configure::Options::Test->new($args);
+ # tests will only be run if you requested them
+ # as command-line option
+ my $method = 'run_' . $_[1] . '_tests';
+ $opttest->$method();
+TEST
+
+
+## XXX this is for debugging
+define reset_mod_parrot &reset_mod_parrot_vars
+define reset_user &reset_user_vars
+
+
+## TODO write a 'script' task to pass in a script to execute
+## this will help support cross-compilation and multiple configurations
+
+# vim: et sw=4:
Added: mod_parrot/branches/configure/config/directives/intro.op
==============================================================================
--- (empty file)
+++ mod_parrot/branches/configure/config/directives/intro.op Sat May 17 10:56:13 2008
@@ -0,0 +1,23 @@
+## introduction and conclusion commands
+
+define <<INTRODUCTION
+introduction
+ require ModParrot::Configure::Messages;
+ my( $var, $val, undef, $stash )= @_;
+ print ModParrot::Configure::Messages::introduction(
+ $stash->{MODPARROT}{mod_parrot_version}
+ );
+INTRODUCTION
+
+define <<CONCLUSION
+conclusion
+ require ModParrot::Configure::Messages;
+ my( $var, $val, undef, $stash )= @_;
+ my $conf = $stash->{user}{conf};
+ print ModParrot::Configure::Messages::conclusion(
+ $conf->data->get('make')
+ );
+CONCLUSION
+
+
+# vim: et sw=4
Added: mod_parrot/branches/configure/config/directives/io.op
==============================================================================
--- (empty file)
+++ mod_parrot/branches/configure/config/directives/io.op Sat May 17 10:56:13 2008
@@ -0,0 +1,30 @@
+## io-related commands
+
+## printing
+define say defined $_[1] ? print STDOUT $_[1], $/ : print $/
+define print defined $_[1] ? print STDOUT $_[1] : 1
+define printerr defined $_[1] ? print STDERR $_[1] : 1
+
+## changing dirs
+define <<PUSHDIR
+pushdir
+ use Cwd; use File::Spec::Functions;
+ push @{$_[3]} => canonpath(cwd);
+ chdir canonpath $_[1]
+PUSHDIR
+define popdir chdir pop @{$_[3]};
+
+## debugging
+define <<DUMP
+dump
+ use Data::Dumper;
+ $Data::Dumper::Indent= 1;
+ print Data::Dumper->Dump( [ $_[3]->{$_[1]} ], [ $_[1] ] );
+DUMP
+
+## XXX - not working
+## quit
+define quit &quit;
+
+
+# vim: et sw=4
Added: mod_parrot/branches/configure/lib/ModParrot/BuildUtil.pm
==============================================================================
--- (empty file)
+++ mod_parrot/branches/configure/lib/ModParrot/BuildUtil.pm Sat May 17 10:56:13 2008
@@ -0,0 +1,74 @@
+# Copyright (C) 2008, Jeff Horwitz.
+# $Id$
+
+=head1 NAME
+
+lib/ModParrot/BuildUtil.pm - Utilities for building mod_parrot
+
+=head1 DESCRIPTION
+
+This package contains miscellaneous build utilities.
+
+=cut
+
+package ModParrot::BuildUtil;
+use strict;
+use warnings;
+
+
+=head2 SUBROUTINES
+
+=over 4
+
+=item C<mod_parrot_version()>
+
+Determines the current version number for mod_parrot from the VERSION file
+and returns it in a context-appropriate manner.
+
+ $mod_parrot_version = ModParrot::BuildUtil::mod_parrot_version();
+ # $mod_parrot_version is '0.4.11'
+
+ @mod_parrot_version = ModParrot::BuildUtil::mod_parrot_version();
+ # @mod_parrot_version is (0, 4, 11)
+
+=back
+
+=cut
+
+# cache for repeated calls
+my ( $mod_parrot_version, @mod_parrot_version );
+
+sub mod_parrot_version {
+ if ( defined $mod_parrot_version ) {
+ return wantarray ? @mod_parrot_version : $mod_parrot_version;
+ }
+
+ # Obtain the official version number from the VERSION file.
+ open my $VERSION, '<', 'VERSION' or die "Could not open VERSION file!";
+ chomp( $mod_parrot_version = <$VERSION> );
+ close $VERSION;
+
+ $mod_parrot_version =~ s/\s+//g;
+ @mod_parrot_version = split( /\./, $mod_parrot_version );
+
+ if ( scalar(@mod_parrot_version) < 2 ) {
+ die "Too few components to VERSION file contents: '$mod_parrot_version' (should be 2 or 3)!";
+ }
+
+ if ( scalar(@mod_parrot_version) > 3 ) {
+ die "Too many components to VERSION file contents: '$mod_parrot_version' (should be 2 or 3)!";
+ }
+
+ foreach my $component (@mod_parrot_version) {
+ die "Illegal version component: '$component' in VERSION file!"
+ unless $component =~ m/^\d+$/;
+ }
+
+ $mod_parrot_version = join( '.', @mod_parrot_version );
+ return wantarray ? @mod_parrot_version : $mod_parrot_version;
+}
+
+
+$_ ^=~ { AUTHOR => 'particle' };
+
+# vim: expandtab shiftwidth=4:
Added: mod_parrot/branches/configure/lib/ModParrot/Configure/Messages.pm
==============================================================================
--- (empty file)
+++ mod_parrot/branches/configure/lib/ModParrot/Configure/Messages.pm Sat May 17 10:56:13 2008
@@ -0,0 +1,88 @@
+# Copyright (C) 2008, Jeff Horwitz.
+# $Id$
+package ModParrot::Configure::Messages;
+use strict;
+use warnings;
+use base qw( Exporter );
+our @EXPORT_OK = qw( introduction conclusion );
+
+
+=head1 NAME
+
+ModParrot::Configure::Messages - Messages for the
+mod_parrot configuration process
+
+=head1 SYNOPSIS
+
+ use ModParrot::Configure::Messages qw( introduction conclusion );
+ print introduction($parrot_version);
+ print conclusion($make_version);
+
+=head1 DESCRIPTION
+
+ModParrot::Configure::Messages exports subroutines which return
+messages suitable for printing when F<Configure.pl> is run.
+
+=head1 SUBROUTINES
+
+=head2 C<introduction()>
+
+Returns a string containing the mod_parrot version,
+the version of F<Configure.pl>, the copyright notice
+and a message introducing the mod_parrot configuration process.
+
+Takes one string argument, containing the mod_parrot version number.
+
+=cut
+
+sub introduction {
+ my $parrot_version = shift;
+ return <<INTRODUCTION;
+mod_parrot Version $parrot_version Configure 1.0
+Copyright (C) 2008, Jeff Horwitz.
+
+Hello, I'm Configure. My job is to poke and prod your system to figure out
+how to build mod_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.
+INTRODUCTION
+}
+
+
+=head2 C<conclusion()>
+
+Returns a string containing the concluding message of
+the mod_parrot configuration process and instructing the user to run F<make>.
+
+Takes one string argument, containing the name of the F<make> engine
+located by the configuration process.
+
+=cut
+
+sub conclusion {
+ my $make = shift;
+ return <<CONCLUSION;
+
+Okay, we're done!
+
+You can now use `$make' to build your mod_parrot.
+After that, you can use `$make test' to run the test suite.
+
+Happy Hacking,
+ The mod_parrot Team
+
+CONCLUSION
+}
+
+
+=head1 SEE ALSO
+
+F<Configure.pl>.
+
+=cut
+
+
+$_ ^=~ { AUTHOR => 'particle' };
+
+
+# vim: expandtab shiftwidth=4:
Added: mod_parrot/branches/configure/lib/ModParrot/Configure/Options.pm
==============================================================================
--- (empty file)
+++ mod_parrot/branches/configure/lib/ModParrot/Configure/Options.pm Sat May 17 10:56:13 2008
@@ -0,0 +1,315 @@
+# Copyright (C) 2008, Jeff Horwitz.
+# $Id$
+package ModParrot::Configure::Options;
+use strict;
+use warnings;
+use base qw( Exporter );
+our @EXPORT_OK = qw(
+ process_options
+ get_valid_options
+);
+
+sub get_valid_options {
+ return 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 make maintainer mandir miniparrot nomanicheck
+ oldincludedir opcode ops optimize parrot_is_shared pmc prefix profile
+ sbindir sharedstatedir step sysconfdir test verbose verbose-step
+ version without-gdbm without-gmp without-icu yacc);
+}
+
+sub process_options {
+ my $optionsref = shift;
+ my @valid_opts = get_valid_options();
+ $optionsref->{argv} = []
+ unless defined $optionsref->{argv};
+ $optionsref->{script} = q{Configure.pl}
+ unless defined $optionsref->{script};
+ die "Must provide argument 'mod_parrot_version'"
+ unless $optionsref->{mod_parrot_version};
+ die "Must provide argument 'svnid'"
+ unless $optionsref->{svnid};
+ my %args;
+ for ( @{ $optionsref->{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) {
+ if ( $key =~ m/version/ ) {
+ print_version_info($optionsref);
+ return;
+ }
+
+ if ( $key =~ m/help/ ) {
+ print_help($optionsref);
+ return;
+ }
+ $args{$key} = $value;
+ }
+ }
+
+ $args{debugging} = 1
+ unless ( ( exists $args{debugging} ) && !$args{debugging} );
+ $args{maintainer} = 1 if defined $args{lex} or defined $args{yacc};
+ return \%args;
+}
+
+################### SUBROUTINES ###################
+
+sub print_version_info {
+ my $argsref = shift;
+ print "mod_parrot Version $argsref->{mod_parrot_version} Configure 2.0\n";
+ print "$argsref->{svnid}\n";
+ return 1;
+}
+
+sub print_help {
+ my $argsref = shift;
+ print <<"EOT";
+$argsref->{script} - mod_parrot Configure 1.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
+ --test=configure Run tests of configuration tools before configuring
+ --test=build Run tests of build tools after configuring but before
+ calling 'make'
+ --test Run configuration tools tests, configure, then run
+ build tools tests
+
+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
+ --make=(make tool) Use the given make utility
+ --yacc=(parser) Use the given parser generator
+
+ --define=inet_aton Quick hack to use inet_aton instead of inet_pton
+
+mod_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 your 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
+ return 1;
+}
+
+1;
+
+#################### DOCUMENTATION ####################
+
+=head1 NAME
+
+ModParrot::Configure::Options - Process command-line options to F<Configure.pl>
+
+=head1 SYNOPSIS
+
+ use ModParrot::Configure::Options qw( process_options );
+
+ $args = process_options( {
+ argv => [ @ARGV ],
+ script => $0,
+ mod_parrot_version => $mod_parrot_version,
+ svnid =>
+ '$Id: Options.pm 18995 2007-06-14 03:30:24Z jkeenan $',
+ } );
+
+ @valid_options = get_valid_options();
+
+=head1 DESCRIPTION
+
+ModParrot::Configure::Options exports on demand two subroutines:
+C<process_options()>, which processes the command-line options provided to
+F<Configure.pl>; and C<get_valid_options()>, which returns the list of
+currently valid options.
+
+If you provide F<Configure.pl> with either C<--help> or C<--version>,
+C<process_options()> will print out the appropriate message and perform a
+bare C<return>, I<i.e.>, the return value will be C<undef>. The calling
+script -- whether F<Configure.pl> or a test file -- can then check for the
+definedness of C<process_options()>'s return value and proceed appropriately.
+
+An array of valid command-line option names stored internally is consulted;
+the program will die if an invalid option is called.
+
+=head1 SUBROUTINES
+
+=head2 C<process_options()>
+
+=over 4
+
+=item * Purpose
+
+Process command-line options provided to F<Configure.pl> and proceed
+appropriately.
+
+=item * Arguments
+
+One argument: Reference to a hash holding the following key-value pairs:
+
+ argv : reference to @ARGV; defaults to []
+ script : Perl's $0: the calling program;
+ defaults to 'Configure.pl'
+ mod_parrot_version : string holding mod_parrot version number
+ (currently supplied by
+ ModParrot::BuildUtil::mod_parrot_version())
+ svnid : string holding Subversion Id string
+
+=item * Return Value
+
+=over 4
+
+=item * C<--version> or C<--help>
+
+Bare return (C<undef>).
+
+=item * All other options
+
+Reference to a hash of option names and values.
+
+=back
+
+=item * Comment
+
+=back
+
+=head2 C<get_valid_options()>
+
+=over 4
+
+=item * Purpose
+
+Get a list of options currently valid for F<Configure.pl>.
+
+=item * Arguments
+
+None.
+
+=item * Return Value
+
+List of currently valid options.
+
+=item * Comment
+
+=back
+
+=head1 NOTES
+
+The functionality in this package was transferred from F<Configure.pl> by Jim
+Keenan.
+
+=head1 SEE ALSO
+
+F<Configure.pl>.
+
+=cut
+
+# Local Variables:
+# mode: cperl
+# cperl-indent-level: 4
+# fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4: