Permalink
Browse files

[config] New Configure.pl option --m=32

* enable 32 bit builds on x86_64
* remove some duplicate config item settings, that did mess up original defaults

This is experimental still, but worksforme.


git-svn-id: https://svn.parrot.org/parrot/trunk@13597 d31e2699-5ff4-0310-a27c-f18f2fbe73fe
  • Loading branch information...
1 parent e905356 commit 2ddc05f470dde14b993f45cfcec4bf3be913e875 Leopold Toetsch committed Jul 27, 2006
Showing with 35 additions and 4 deletions.
  1. +7 −0 Configure.pl
  2. +1 −1 config/auto/jit.pm
  3. +26 −2 config/init/defaults.pm
  4. +1 −1 config/init/hints/linux.pm
View
@@ -70,6 +70,13 @@ =head2 Command-line Options
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)
View
@@ -37,7 +37,7 @@ sub runstep
my $verbose = $conf->options->get('verbose');
my $jitbase = 'src/jit'; # base path for jit sources
- my $archname = $Config{archname};
+ my $archname = $conf->data->get('archname');
my ($cpuarch, $osname) = split(/-/, $archname);
if (!defined $osname) {
@@ -24,7 +24,7 @@ use Parrot::Configure::Step;
$description = q{Setting up Configure's default values};
-@args = qw(debugging optimize profile verbose prefix);
+@args = qw(debugging optimize profile verbose prefix m);
sub runstep
{
@@ -54,7 +54,7 @@ sub runstep
# unset. Ultimately, it should be set to whatever ICU figures
# out, or parrot should look for it and always tell ICU what to
# use.
- cxx => '',
+ cxx => 'c++',
# Linker, used to link object files (plus libraries) into
# an executable. It is usually $cc on Unix-ish systems.
@@ -213,6 +213,30 @@ sub runstep
);
}
+ # adjust archname, cc and libs for e.g. --m=32
+ # TODO this is maybe gcc only
+ my $m = $conf->options->get('m');
+ my $archname = $Config{archname};
+ if ($m) {
+ if ($archname =~ /x86_64/ && $m eq '32') {
+ $archname =~ s/x86_64/i386/;
+
+ # adjust gcc?
+ for my $cc qw(cc cxx link ld) {
+ $conf->data->add(' ', $cc, '-m32');
+ }
+ # and lib flags
+ for my $lib qw(ld_load_flags ld_share_flags ldflags linkflags) {
+ my $item = $conf->data->get($lib);
+ (my $ni = $item) =~ s/lib64/lib/g;
+ $conf->data->set($lib, $ni);
+ }
+ }
+ }
+ # TODO adjust lib install-path /lib64 vs. lib
+ # remember corrected archname - jit.pm was using $Config('archname')
+ $conf->data->set('archname', $archname);
+
return $self;
}
@@ -17,7 +17,7 @@ sub runstep
my $linkflags = $conf->data->get('linkflags');
# should find g++ in most cases
- my $link = 'c++';
+ my $link = $conf->data->get('link') || 'c++';
if ($libs !~ /-lpthread/) {
$libs .= ' -lpthread';

0 comments on commit 2ddc05f

Please sign in to comment.