Author: jhoblitt
Date: Tue Nov 15 23:43:24 2005
New Revision: 10016
Added:
trunk/config/inter/make.pm
Modified:
trunk/MANIFEST
trunk/lib/Parrot/Configure/RunSteps.pm
Log:
add config/auto/make.pm to probe for make. The first step towards doing away
with $(MAKE_C) in Makefiles.
Modified: trunk/MANIFEST
==============================================================================
--- trunk/MANIFEST (original)
+++ trunk/MANIFEST Tue Nov 15 23:43:24 2005
@@ -327,6 +327,7 @@ config/init/optimize.pm
config/inter/charset.pm []
config/inter/encoding.pm []
config/inter/exp.pm []
+config/inter/make.pm []
config/inter/ops.pm []
config/inter/pmc.pm []
config/inter/shlibs.pm []
Added: trunk/config/inter/make.pm
==============================================================================
--- (empty file)
+++ trunk/config/inter/make.pm Tue Nov 15 23:43:24 2005
@@ -0,0 +1,78 @@
+# Copyright: 2001-2005 The Perl Foundation. All Rights Reserved.
+# $Id$
+
+=head1 NAME
+
+config/auto/make.pm - make utility
+
+=head1 DESCRIPTION
+
+Determines whether C<make> is installed and if it's actually GNU C<make>.
+
+=cut
+
+package Configure::Step;
+
+use strict;
+
+use vars qw( $description @args $prompt $util );
+use Parrot::Configure::Step qw( :inter capture_output check_progs );
+
+$util = 'make';
+$description = "Determining whether $util is installed";
+$prompt = "Do you have a make utility like 'gmake' or 'make'?";
[EMAIL PROTECTED] = qw( make ask );
+
+sub runstep {
+ my %args;
+ @[EMAIL PROTECTED]@_;
+
+ # undef means we don't have GNU make... default to not having it
+ Parrot::Configure::Data->set(gmake_version => undef);
+
+ my $prog;
+ # precedence of sources for the program:
+ # default -> probe -> environment -> option -> ask
+ $prog ||= $args{$util};
+ $prog ||= $ENV{uc($util)};
+
+ # never override the user. If a non-existent program is specified then
+ # the user is responsible for the consequences.
+ if (defined $prog) {
+ Parrot::Configure::Data->set($util => $prog);
+ $Configure::Step::result = 'yes';
+ return undef;
+ }
+
+ $prog = check_progs(['gmake', 'make']);
+
+ unless ($prog) {
+ # fall back to default
+ $Configure::Step::result = 'no';
+ return undef;
+ }
+
+ if ($args{ask}) {
+ $prog = prompt($prompt, $prog ? $prog :
Parrot::Configure::Data->get($util));
+ }
+
+ my ($stdout, $stderr, $ret) = capture_output($prog, '--version');
+
+ # don't override the user even if the program they provided appears to be
+ # broken
+ if ($ret == -1 and ! $args{ask}) {
+ # fall back to default
+ $Configure::Step::result = 'no';
+ return undef;
+ }
+
+ # if '--version' returns a string assume that this is gmake.
+ if ($stdout =~ /GNU \s+ Make \s+ (\d+) \. (\d+)/x) {
+ Parrot::Configure::Data->set(gmake_version => "$1.$2");
+ }
+
+ Parrot::Configure::Data->set($util => $prog);
+ $Configure::Step::result = 'yes';
+}
+
+1;
Modified: trunk/lib/Parrot/Configure/RunSteps.pm
==============================================================================
--- trunk/lib/Parrot/Configure/RunSteps.pm (original)
+++ trunk/lib/Parrot/Configure/RunSteps.pm Tue Nov 15 23:43:24 2005
@@ -33,6 +33,7 @@ use Parrot::Configure::Data;
init/hints.pm
init/headers.pm
inter/progs.pm
+ inter/make.pm
inter/lex.pm
inter/yacc.pm
auto/gcc.pm