# New Ticket Created by Aldo Calpini
# Please include the string: [perl #41597]
# in the subject line of all future correspondence about this issue.
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=41597 >
this patch adds an 'osname' key to Parrot's own $conf->data, which is
used in the configure process instead of $^O (and $Config{osname}).
this patch does not affect the current configuration process. in the
long term, an --osname parameter (along with --arch and others,
probably) will be added to Configure.pl, to provide support for
cross-compilation.
as of now, the value of $conf->data->get('osname') ALWAYS returns $^O.
cheers,
Aldo
diff -ur --exclude=.svn parrot-0.4.9/config/auto/alignptrs.pm
parrot-new/config/auto/alignptrs.pm
--- parrot-0.4.9/config/auto/alignptrs.pm 2007-02-22 14:41:12.000000000
+0100
+++ parrot-new/config/auto/alignptrs.pm 2007-02-23 12:26:33.353248400 +0100
@@ -40,7 +40,7 @@
$align = $conf->data->get('ptr_alignment');
$self->set_result("configured: ");
}
- elsif ( $^O eq 'hpux' && $Config{ccflags} !~ /DD64/ ) {
+ elsif ( $conf->data->get('osname') eq 'hpux' && $Config{ccflags} !~ /DD64/
) {
# HP-UX 10.20/32 hangs in this test.
$align = 4;
diff -ur --exclude=.svn parrot-0.4.9/config/auto/gcc.pm
parrot-new/config/auto/gcc.pm
--- parrot-0.4.9/config/auto/gcc.pm 2007-02-22 14:41:12.000000000 +0100
+++ parrot-new/config/auto/gcc.pm 2007-02-23 12:27:02.021820400 +0100
@@ -260,7 +260,7 @@
);
$conf->data->set( HAS_aligned_funcptr => 0 )
- if $^O eq 'hpux';
+ if $conf->data->get('osname') eq 'hpux';
return $self;
}
diff -ur --exclude=.svn parrot-0.4.9/config/auto/gdbm.pm
parrot-new/config/auto/gdbm.pm
--- parrot-0.4.9/config/auto/gdbm.pm 2007-02-22 14:41:12.000000000 +0100
+++ parrot-new/config/auto/gdbm.pm 2007-02-23 13:23:20.882530800 +0100
@@ -43,7 +43,7 @@
my $linkflags = $conf->data->get('linkflags');
my $ccflags = $conf->data->get('ccflags');
- my $osname = $Config{osname};
+ my $osname = $conf->data->get('osname');
# On OS X check the presence of the gdbm header in the standard
# Fink location. TODO: Need a more generalized way for finding
@@ -57,7 +57,7 @@
}
cc_gen('config/auto/gdbm/gdbm.in');
- if ( $^O =~ /mswin32/i ) {
+ if ( $conf->data->get('osname') =~ /mswin32/i ) {
if ( $cc =~ /^gcc/i ) {
eval { cc_build( '', '-llibgdbm' ); };
}
diff -ur --exclude=.svn parrot-0.4.9/config/auto/gmp.pm
parrot-new/config/auto/gmp.pm
--- parrot-0.4.9/config/auto/gmp.pm 2007-02-22 14:41:12.000000000 +0100
+++ parrot-new/config/auto/gmp.pm 2007-02-23 13:24:26.546840400 +0100
@@ -41,7 +41,7 @@
my $libs = $conf->data->get('libs');
my $linkflags = $conf->data->get('linkflags');
my $ccflags = $conf->data->get('ccflags');
- if ( $^O =~ /mswin32/i ) {
+ if ( $conf->data->get('osname') =~ /mswin32/i ) {
if ( $cc =~ /^gcc/i ) {
$conf->data->add( ' ', libs => '-lgmp' );
}
@@ -53,7 +53,7 @@
$conf->data->add( ' ', libs => '-lgmp' );
}
- my $osname = $Config{osname};
+ my $osname = $conf->data->get('osname');
# On OS X check the presence of the gmp header in the standard
# Fink location. TODO: Need a more generalized way for finding
diff -ur --exclude=.svn parrot-0.4.9/config/auto/headers.pm
parrot-new/config/auto/headers.pm
--- parrot-0.4.9/config/auto/headers.pm 2007-02-22 14:41:12.000000000 +0100
+++ parrot-new/config/auto/headers.pm 2007-02-23 13:25:09.776234800 +0100
@@ -60,7 +60,7 @@
sys/stat.h sysexit.h limits.h);
# more extra_headers needed on mingw/msys; *BSD fails if they are present
- if ( $^O eq "msys" ) {
+ if ( $conf->data->get('osname') eq "msys" ) {
push @extra_headers, qw(sysmman.h netdb.h);
}
my @found_headers;
diff -ur --exclude=.svn parrot-0.4.9/config/auto/readline.pm
parrot-new/config/auto/readline.pm
--- parrot-0.4.9/config/auto/readline.pm 2007-02-22 14:41:12.000000000
+0100
+++ parrot-new/config/auto/readline.pm 2007-02-23 13:26:28.767134000 +0100
@@ -35,7 +35,7 @@
my $libs = $conf->data->get('libs');
my $linkflags = $conf->data->get('linkflags');
my $ccflags = $conf->data->get('ccflags');
- if ( $^O =~ /mswin32/i ) {
+ if ( $conf->data->get('osname') =~ /mswin32/i ) {
if ( $cc =~ /^gcc/i ) {
$conf->data->add( ' ',
libs => '-lreadline -lgw32c -lole32 -luuid -lwsock32
-lmsvcp60' );
@@ -44,14 +44,14 @@
$conf->data->add( ' ', libs => 'readline.lib' );
}
}
- elsif ( $^O =~ /linux/i ) {
+ elsif ( $conf->data->get('osname') =~ /linux/i ) {
$conf->data->add( ' ', libs => '-lreadline -lncurses' );
}
else {
$conf->data->add( ' ', libs => '-lreadline' );
}
- my $osname = $Config{osname};
+ my $osname = $conf->data->get('osname');
# On OS X check the presence of the readline header in the standard
# Fink/macports location. TODO: Need a more generalized way for finding
diff -ur --exclude=.svn parrot-0.4.9/config/gen/config_h.pm
parrot-new/config/gen/config_h.pm
--- parrot-0.4.9/config/gen/config_h.pm 2007-02-22 14:41:12.000000000 +0100
+++ parrot-new/config/gen/config_h.pm 2007-02-23 13:27:14.683718800 +0100
@@ -72,7 +72,7 @@
}
}
- print {$HH} "\n#define BUILD_OS_NAME \"$^O\"\n";
+ print {$HH} "\n#define BUILD_OS_NAME \"".$conf->data->get('osname')."\"\n";
my $define = $conf->options->get('define');
diff -ur --exclude=.svn parrot-0.4.9/config/gen/makefiles/dynoplibs_pl.in
parrot-new/config/gen/makefiles/dynoplibs_pl.in
--- parrot-0.4.9/config/gen/makefiles/dynoplibs_pl.in 2007-02-22
14:41:12.000000000 +0100
+++ parrot-new/config/gen/makefiles/dynoplibs_pl.in 2007-02-23
13:31:45.293166000 +0100
@@ -36,7 +36,7 @@
# Here comes some stuff for Win32.
our $PATHQUOTE = q[];
-if ($^O eq 'MSWin32') {
+if ('@osname@' eq 'MSWin32') {
# Paths need quoting as they may contain spaces.
$PATHQUOTE = q["];
@@ -75,7 +75,7 @@
my ($target, $libs, $sources) = @_;
my $liblist;
- if ($^O =~ /mswin32/i) {
+ if ('@osname@' =~ /mswin32/i) {
# Need to put various libraries in the link line.
$liblist = join( ' ', map { "$_.lib" } keys %$libs );
if ($CC =~ /gcc/i) {
@@ -140,7 +140,7 @@
# Execute permissions on libraries is especially important on
# some platforms
- if ($^O eq 'hpux' or $^O eq 'cygwin') {
+ if ('@osname@' eq 'hpux' or '@osname@' eq 'cygwin') {
chmod 0755, "[EMAIL PROTECTED]@$src";
}
}
diff -ur --exclude=.svn parrot-0.4.9/config/gen/makefiles/dynpmc_pl.in
parrot-new/config/gen/makefiles/dynpmc_pl.in
--- parrot-0.4.9/config/gen/makefiles/dynpmc_pl.in 2007-02-22
14:41:12.000000000 +0100
+++ parrot-new/config/gen/makefiles/dynpmc_pl.in 2007-02-23
13:32:09.884082800 +0100
@@ -36,7 +36,7 @@
# Here comes some stuff for Win32.
our $PATHQUOTE = '';
-if ($^O eq 'MSWin32') {
+if ('@osname@' eq 'MSWin32') {
# Paths need quoting as they may contain spaces.
$PATHQUOTE = '"';
@@ -67,7 +67,7 @@
my ($target, $libs, $sources) = @_;
my $liblist;
- if ($^O =~ /mswin32/i) {
+ if ('@osname@' =~ /mswin32/i) {
# Need to put various libraries in the link line.
$liblist = join( ' ', map { "$_.lib" } keys %$libs );
if ($CC =~ /gcc/i) {
@@ -167,7 +167,7 @@
# Execute permissions on libraries is especially important on
# some platforms
- if ($^O eq 'hpux' or $^O eq 'cygwin') {
+ if ('@osname@' eq 'hpux' or '@osname@' eq 'cygwin') {
chmod 0755, "[EMAIL PROTECTED]@$_$LOAD_EXT";
}
@@ -194,7 +194,7 @@
# there can be many libs
my %libs = %{ $class->{flags}{lib} || {} };
- if ($^O eq 'MSWin32' && $CC =~ /^gcc/i) {
+ if ('@osname@' eq 'MSWin32' && $CC =~ /^gcc/i) {
my %newlibs = ();
$newlibs{"lib$_"} = $libs{$_} for keys %libs;
%libs = %newlibs;
diff -ur --exclude=.svn parrot-0.4.9/config/init/defaults.pm
parrot-new/config/init/defaults.pm
--- parrot-0.4.9/config/init/defaults.pm 2007-02-22 14:41:08.000000000
+0100
+++ parrot-new/config/init/defaults.pm 2007-02-23 12:25:40.078136400 +0100
@@ -39,6 +39,10 @@
verbose => $conf->options->get('verbose'),
build_dir => abs_path($FindBin::Bin),
+ # OSNAME and architecture -- defaults to Perl's own
+ # (unless we are cross-compiling)
+ osname => $conf->options->get('osname') || $^O,
+
# Compiler -- used to turn .c files into object files.
# (Usually cc or cl, or something like that.)
cc => $Config{cc},
diff -ur --exclude=.svn parrot-0.4.9/config/init/hints.pm
parrot-new/config/init/hints.pm
--- parrot-0.4.9/config/init/hints.pm 2007-02-22 14:41:08.000000000 +0100
+++ parrot-new/config/init/hints.pm 2007-02-23 13:32:34.162535600 +0100
@@ -33,7 +33,7 @@
my $hints_used = 0;
- my $hints = "init::hints::" . lc($^O);
+ my $hints = "init::hints::" . lc($conf->data->get('osname'));
print "[ $hints " if $verbose;
diff -ur --exclude=.svn parrot-0.4.9/config/inter/progs.pm
parrot-new/config/inter/progs.pm
--- parrot-0.4.9/config/inter/progs.pm 2007-02-22 14:41:08.000000000 +0100
+++ parrot-new/config/inter/progs.pm 2007-02-23 13:33:30.281070000 +0100
@@ -101,7 +101,7 @@
$conf->data->set( ldflags => $ldflags );
$libs = $conf->data->get('libs');
- $libs = join ' ', grep { $^O =~ /VMS|MSWin/ ||
!/^-l(c|gdbm(_compat)?|dbm|ndbm|db)$/ }
+ $libs = join ' ', grep { $conf->data->get('osname') =~ /VMS|MSWin/ ||
!/^-l(c|gdbm(_compat)?|dbm|ndbm|db)$/ }
split( ' ', $libs );
$libs = integrate( $libs, $conf->options->get('libs') );
$libs = prompt( "What libraries should your C compiler use?", $libs ) if
$ask;