Author: jkeenan Date: Mon Nov 19 20:01:20 2007 New Revision: 22903 Added: branches/nointer/lib/Parrot/Configure/Initialize/Hints/ branches/nointer/lib/Parrot/Configure/Initialize/Hints.pm (contents, props changed) branches/nointer/lib/Parrot/Configure/Initialize/Hints/aix.pm (contents, props changed) branches/nointer/lib/Parrot/Configure/Initialize/Hints/cygwin.pm (contents, props changed) branches/nointer/lib/Parrot/Configure/Initialize/Hints/darwin.pm (contents, props changed) branches/nointer/lib/Parrot/Configure/Initialize/Hints/dec_osf.pm (contents, props changed) branches/nointer/lib/Parrot/Configure/Initialize/Hints/dragonfly.pm (contents, props changed) branches/nointer/lib/Parrot/Configure/Initialize/Hints/freebsd.pm (contents, props changed) branches/nointer/lib/Parrot/Configure/Initialize/Hints/hpux.pm (contents, props changed) branches/nointer/lib/Parrot/Configure/Initialize/Hints/irix.pm (contents, props changed) branches/nointer/lib/Parrot/Configure/Initialize/Hints/linux.pm (contents, props changed) branches/nointer/lib/Parrot/Configure/Initialize/Hints/mswin32.pm (contents, props changed) branches/nointer/lib/Parrot/Configure/Initialize/Hints/msys.pm (contents, props changed) branches/nointer/lib/Parrot/Configure/Initialize/Hints/netbsd.pm (contents, props changed) branches/nointer/lib/Parrot/Configure/Initialize/Hints/openbsd.pm (contents, props changed) branches/nointer/lib/Parrot/Configure/Initialize/Hints/os2.pm (contents, props changed) branches/nointer/lib/Parrot/Configure/Initialize/Hints/solaris.pm (contents, props changed) branches/nointer/lib/Parrot/Configure/Initialize/Hints/vms.pm (contents, props changed) Modified: branches/nointer/MANIFEST
Log: First draft of Parrot::Configure::Initialize::Hints. Moving hints packages from config/init/hints to lib/Parrot/Configure/Initialize/Hints/; packages not functioning yet. Modified: branches/nointer/MANIFEST ============================================================================== --- branches/nointer/MANIFEST (original) +++ branches/nointer/MANIFEST Mon Nov 19 20:01:20 2007 @@ -1,7 +1,7 @@ # ex: set ro: # $Id$ # -# generated by tools/dev/mk_manifest_and_skip.pl Tue Nov 20 03:47:43 2007 UT +# generated by tools/dev/mk_manifest_and_skip.pl Tue Nov 20 03:59:13 2007 UT # # See tools/dev/install_files.pl for documentation on the # format of this file. @@ -2363,6 +2363,23 @@ lib/Parrot/Configure/Data.pm [devel] lib/Parrot/Configure/Initialize.pm [devel] lib/Parrot/Configure/Initialize/Defaults.pm [devel] +lib/Parrot/Configure/Initialize/Hints.pm [devel] +lib/Parrot/Configure/Initialize/Hints/aix.pm [devel] +lib/Parrot/Configure/Initialize/Hints/cygwin.pm [devel] +lib/Parrot/Configure/Initialize/Hints/darwin.pm [devel] +lib/Parrot/Configure/Initialize/Hints/dec_osf.pm [devel] +lib/Parrot/Configure/Initialize/Hints/dragonfly.pm [devel] +lib/Parrot/Configure/Initialize/Hints/freebsd.pm [devel] +lib/Parrot/Configure/Initialize/Hints/hpux.pm [devel] +lib/Parrot/Configure/Initialize/Hints/irix.pm [devel] +lib/Parrot/Configure/Initialize/Hints/linux.pm [devel] +lib/Parrot/Configure/Initialize/Hints/mswin32.pm [devel] +lib/Parrot/Configure/Initialize/Hints/msys.pm [devel] +lib/Parrot/Configure/Initialize/Hints/netbsd.pm [devel] +lib/Parrot/Configure/Initialize/Hints/openbsd.pm [devel] +lib/Parrot/Configure/Initialize/Hints/os2.pm [devel] +lib/Parrot/Configure/Initialize/Hints/solaris.pm [devel] +lib/Parrot/Configure/Initialize/Hints/vms.pm [devel] lib/Parrot/Configure/Initialize/Install.pm [devel] lib/Parrot/Configure/Initialize/Miniparrot.pm [devel] lib/Parrot/Configure/Interactive.pm [devel] Added: branches/nointer/lib/Parrot/Configure/Initialize/Hints.pm ============================================================================== --- (empty file) +++ branches/nointer/lib/Parrot/Configure/Initialize/Hints.pm Mon Nov 19 20:01:20 2007 @@ -0,0 +1,83 @@ +# Copyright (C) 2001-2006, The Perl Foundation. +# $Id$ +package Parrot::Configure::Initialize::Hints; +use strict; +use warnings; +use lib ( "./lib" ); + +################### SUBROUTINES ################### + +sub init_hints { + my $self = shift; + my $verbose = $self->{verbose}; + + my $hints_used = 0; + + my $hints = "Initialize::Hints::" . lc($^O); + + print "[ $hints " if $verbose; + + eval "use $hints"; + die $@ if $@; + + # Call the runstep method if it exists. + # Otherwise the step must have done its work when it was loaded. + $hints->runstep( $self, @_ ) if $hints->can('runstep'); + $hints_used++; + + $hints = "Initialize::Hints::Local"; + print "$hints " if $verbose; + eval "use $hints"; + + unless ($@) { + $hints->runstep( $self, @_ ) if $hints->can('runstep'); + $hints_used++; + } + + if ( $hints_used == 0 and $verbose ) { + print "(no hints) "; + } + + print "]" if $verbose; +} + +1; + +#################### DOCUMENTATION #################### + +=head1 NAME + +Parrot::Configure::Initialize::Hints - Hints configuration + +=head1 SYNOPSIS + + use Parrot::Configure::Initialize::Hints; + +=head1 DESCRIPTION + +Modifies settings to match hints (ANSI C Parrot)'s needs. This step +primarily overwrites a lot of settings in the Configure database to disable +JIT and match ANSI characteristics. + +Centralizing these settings will (hopefully) allow for an eventual move away +from using Configure at all for hints builds. + +=head1 SUBROUTINES + +=head1 NOTES + +The functionality in this package was transferred from the former +C<init::hints> configuration steps by Jim Keenan. + +=head1 SEE ALSO + +F<Configure.pl>. Parrot::Configure. Parrot::Configure::Initialize. + +=cut + +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 100 +# End: +# vim: expandtab shiftwidth=4: Added: branches/nointer/lib/Parrot/Configure/Initialize/Hints/aix.pm ============================================================================== --- (empty file) +++ branches/nointer/lib/Parrot/Configure/Initialize/Hints/aix.pm Mon Nov 19 20:01:20 2007 @@ -0,0 +1,26 @@ +# Copyright (C) 2005, The Perl Foundation. +# $Id$ + +package init::hints::aix; + +use strict; +use warnings; + +sub runstep { + my ( $self, $conf ) = @_; + + $conf->data->set( + cc => 'cc_r', + link => 'cc_r', + platform_asm => 1, + ); +} + +1; + +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 100 +# End: +# vim: expandtab shiftwidth=4: Added: branches/nointer/lib/Parrot/Configure/Initialize/Hints/cygwin.pm ============================================================================== --- (empty file) +++ branches/nointer/lib/Parrot/Configure/Initialize/Hints/cygwin.pm Mon Nov 19 20:01:20 2007 @@ -0,0 +1,57 @@ +# Copyright (C) 2005, The Perl Foundation. +# $Id$ + +package init::hints::cygwin; + +use strict; +use warnings; + +sub runstep { + my ( $self, $conf ) = @_; + + # cygwin's perl is compiled with -lutil, which for some reason is not + # in the standard installation, so we get rid of it + my $libs = $conf->data->get('libs'); + $libs =~ s/-lutil\b//g; + + my $build_dir = $conf->data->get('build_dir'); + $build_dir =~ s/ /\\ /g; + + # A note about building shared libraries: Perl5 uses the 'ld2' tool, which + # is installed as part of the perl5 installation. So far, it appears + # parrot can get by with simply using gcc -shared, so we override the + # perl5 Configure defaults and use 'gcc -shared' instead of 'ld2'. + # If this later causes problems, it might be worth revisiting. + # A. Dougherty 9/9/2002 + $conf->data->set( + build_dir => $build_dir, + ld => 'gcc', + ld_share_flags => '-shared', + ld_load_flags => '-shared', + libs => $libs, + has_static_linking => 0, + has_dynamic_linking => 1, + parrot_is_shared => 1, + sym_export => '__declspec(dllexport)', + sym_import => '__declspec(dllimport)' + ); + + # inet_aton needs to be defined on Cygwin. + my $define = $conf->options->get('define'); + unless ($define) { + $define = 'inet_aton'; + } + elsif ( $define !~ /inet_[ap]ton/ ) { + $define = join( ',', 'inet_aton', $define ); + } + $conf->options->set( define => $define ); +} + +1; + +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 100 +# End: +# vim: expandtab shiftwidth=4: Added: branches/nointer/lib/Parrot/Configure/Initialize/Hints/darwin.pm ============================================================================== --- (empty file) +++ branches/nointer/lib/Parrot/Configure/Initialize/Hints/darwin.pm Mon Nov 19 20:01:20 2007 @@ -0,0 +1,66 @@ +# Copyright (C) 2005, The Perl Foundation. +# $Id$ + +package init::hints::darwin; + +use strict; +use warnings; + +sub runstep { + my ( $self, $conf ) = @_; + + my ( $ccflags, $ldflags, $libs ) = $conf->data->get(qw(ccflags ldflags libs)); + + my $OSVers = `uname -r`; + chomp $OSVers; + { + local $^W; + $OSVers =~ /(\d+)/; + if ( $1 >= 7 ) { + $libs =~ s/-ldl//; + } + } + + $ldflags .= " -L" . $conf->data->get('build_dir') . "/blib/lib"; + $ccflags .= " -pipe -fno-common -Wno-long-double "; + $ccflags =~ s/-flat_namespace\s*//; + $ldflags =~ s/-flat_namespace\s*//; + $ldflags .= " -flat_namespace "; + + $conf->data->set( + darwin => 1, + ccflags => $ccflags, + ldflags => $ldflags, + ccwarn => "-Wno-shadow", + libs => $libs, + share_ext => '.dylib', + load_ext => '.bundle', + link => 'c++', + ld => 'c++', + ld_share_flags => '-dynamiclib -undefined suppress', + ld_load_flags => '-bundle -undefined suppress', + memalign => 'some_memalign', + has_dynamic_linking => 1, + + # RT#43147 when built against a dynamic libparrot installable_parrot records + # the path to the blib version of the library + parrot_is_shared => 0, + libparrot_shared => 'libparrot.$(SOVERSION)$(SHARE_EXT)', + libparrot_shared_alias => 'libparrot$(SHARE_EXT)', + rpath => "-L", + libparrot_soname => "-install_name " + . $conf->data->get('lib_dir') + . $conf->data->get('slash') + . "libparrot" + . $conf->data->get('share_ext') + ); +} + +1; + +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 100 +# End: +# vim: expandtab shiftwidth=4: Added: branches/nointer/lib/Parrot/Configure/Initialize/Hints/dec_osf.pm ============================================================================== --- (empty file) +++ branches/nointer/lib/Parrot/Configure/Initialize/Hints/dec_osf.pm Mon Nov 19 20:01:20 2007 @@ -0,0 +1,60 @@ +# Copyright (C) 2005, The Perl Foundation. +# $Id$ + +package init::hints::dec_osf; + +use strict; +use warnings; + +sub runstep { + my ( $self, $conf ) = @_; + + # Tru64 + my $ccflags = $conf->data->get('ccflags'); + if ( $ccflags !~ /-pthread/ ) { + $ccflags .= ' -pthread'; + } + if ( $ccflags !~ /-D_XOPEN_SOURCE=/ ) { + + # Request all POSIX visible (not automatic for cxx, as it is for cc) + $ccflags .= ' -D_XOPEN_SOURCE=500'; + } + $conf->data->set( ccflags => $ccflags ); + + my $libs = $conf->data->get('libs'); + if ( $libs !~ /-lpthread/ ) { + $libs .= ' -lpthread'; + } + if ( $libs !~ /-laio/ ) { + $libs .= ' -laio'; + } + $conf->data->set( libs => $libs ); + + for my $ldflags (qw(ld_load_flags ld_share_flags)) { + my $f = $conf->data->get($ldflags); + if ( $f =~ s/ -s / / ) { + $conf->data->set( $ldflags => $f ); + } + } + + my $linkflags = $conf->data->get('linkflags'); + if ( $linkflags !~ /-expect_unresolved/ ) { + $linkflags = "-expect_unresolved '*' -O4 -msym -std $linkflags"; + $conf->data->set( linkflags => $linkflags ); + } + + # Required because of ICU using c++. + $conf->data->set( link => "cxx" ); + + # Perl 5 hasn't been compiled with this visible. + $conf->data->set( has_socklen_t => 1 ); +} + +1; + +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 100 +# End: +# vim: expandtab shiftwidth=4: Added: branches/nointer/lib/Parrot/Configure/Initialize/Hints/dragonfly.pm ============================================================================== --- (empty file) +++ branches/nointer/lib/Parrot/Configure/Initialize/Hints/dragonfly.pm Mon Nov 19 20:01:20 2007 @@ -0,0 +1,36 @@ +# Copyright (C) 2007, The Perl Foundation. +# $Id $ + +package init::hints::dragonfly; + +use strict; +use warnings; + +sub runstep { + my ( $self, $conf ) = @_; + + my $libs = $conf->data->get('libs'); + + $libs .= ' -pthread' unless $libs =~ /pthread/; + + $conf->data->set( + libs => $libs, + link => 'g++', + rpath => '-Wl,-R', + + has_dynamic_linking => 1, + parrot_is_shared => 1, + libparrot_shared => 'libparrot$(SHARE_EXT).$(SOVERSION)', + libparrot_shared_alias => 'libparrot$(SHARE_EXT)', + libparrot_soname => '-Wl,-soname=libparrot$(SHARE_EXT).$(SOVERSION)', + ); +} + +1; + +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 100 +# End: +# vim: expandtab shiftwidth=4: Added: branches/nointer/lib/Parrot/Configure/Initialize/Hints/freebsd.pm ============================================================================== --- (empty file) +++ branches/nointer/lib/Parrot/Configure/Initialize/Hints/freebsd.pm Mon Nov 19 20:01:20 2007 @@ -0,0 +1,51 @@ +# Copyright (C) 2005, The Perl Foundation. +# $Id$ + +package init::hints::freebsd; + +use strict; +use warnings; + +sub runstep { + my ( $self, $conf ) = @_; + + my $libs = $conf->data->get('libs'); + + # get rid of old pthread-stuff, if any + $libs =~ s/(-lpthreads|-lc_r)\b\s*//g; + + # The following test is from FreeBSD's /usr/ports/Mk/bsd.port.mk, + # which must be assumed to do the right thing. + + my $osversion; + if ( -e "/sbin/sysctl" ) { + $osversion = `/sbin/sysctl -n kern.osreldate`; + } + else { + $osversion = `/usr/sbin/sysctl -n kern.osreldate`; + } + chomp $osversion; + + $libs .= ' -pthread'; + + $conf->data->set( + libs => $libs, + link => 'g++', + rpath => '-Wl,-R', + + has_dynamic_linking => 1, + parrot_is_shared => 1, + libparrot_shared => 'libparrot$(SHARE_EXT).$(SOVERSION)', + libparrot_shared_alias => 'libparrot$(SHARE_EXT)', + libparrot_soname => '-Wl,-soname=libparrot$(SHARE_EXT).$(SOVERSION)', + ); +} + +1; + +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 100 +# End: +# vim: expandtab shiftwidth=4: Added: branches/nointer/lib/Parrot/Configure/Initialize/Hints/hpux.pm ============================================================================== --- (empty file) +++ branches/nointer/lib/Parrot/Configure/Initialize/Hints/hpux.pm Mon Nov 19 20:01:20 2007 @@ -0,0 +1,27 @@ +# Copyright (C) 2005, The Perl Foundation. +# $Id$ + +package init::hints::hpux; + +use strict; +use warnings; + +sub runstep { + my ( $self, $conf ) = @_; + + my $libs = $conf->data->get('libs'); + if ( $libs !~ /-lpthread/ ) { + $libs .= ' -lpthread'; + } + + $conf->data->set( libs => $libs ); +} + +1; + +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 100 +# End: +# vim: expandtab shiftwidth=4: Added: branches/nointer/lib/Parrot/Configure/Initialize/Hints/irix.pm ============================================================================== --- (empty file) +++ branches/nointer/lib/Parrot/Configure/Initialize/Hints/irix.pm Mon Nov 19 20:01:20 2007 @@ -0,0 +1,52 @@ +# Copyright (C) 2005, The Perl Foundation. +# $Id$ + +package init::hinits::irix; + +use strict; +use warnings; + +sub runstep { + my ( $self, $conf ) = @_; + + my $ccflags = $conf->data->get('ccflags') || ""; + + # 1185 An enumerated type is mixed with another type. + if ( $ccflags =~ /-woff / ) { + $ccflags =~ s/-woff (?:\d+,)*\d+/-woff 1185/; + } + else { + $ccflags .= ' -woff 1185'; + } + $conf->data->set( ccflags => $ccflags ); + + my $libs = $conf->data->get('libs'); + if ( $libs !~ /-lpthread/ ) { + $libs .= ' -lpthread'; + } + $conf->data->set( libs => $libs ); + + my $cc = $conf->data->get('cc'); + my $cxx = $conf->data->get('cxx'); + my $ld = $conf->data->get('ld'); + my $link = $conf->data->get('link'); + if ( $cc =~ /cc -64/ ) { + $cxx = 'CC -64'; + $ld = 'CC -64'; + $link = 'CC -64'; + $conf->data->set( + cxx => $cxx, + ld => $ld, + link => $link, + ); + } +} + +1; + +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 100 +# End: +# vim: expandtab shiftwidth=4: Added: branches/nointer/lib/Parrot/Configure/Initialize/Hints/linux.pm ============================================================================== --- (empty file) +++ branches/nointer/lib/Parrot/Configure/Initialize/Hints/linux.pm Mon Nov 19 20:01:20 2007 @@ -0,0 +1,163 @@ +# Copyright (C) 2005-2007, The Perl Foundation. +# $Id$ + +package init::hints::linux; + +use strict; +use warnings; + +use Config; + +our $verbose; + +sub runstep { + my ( $self, $conf ) = @_; + + my $libs = $conf->option_or_data('libs'); + my $ccflags = $conf->option_or_data('ccflags'); + my $cc = $conf->option_or_data('cc'); + my $linkflags = $conf->option_or_data('linkflags'); + + $verbose = $conf->options->get('verbose'); + print $/ if $verbose; + + # should find g++ in most cases + my $link = $conf->data->get('link') || 'c++'; + + if ( $libs !~ /-lpthread/ ) { + $libs .= ' -lpthread'; + } + my $ld_share_flags = $conf->data->get('ld_share_flags'); + my $cc_shared = $conf->data->get('cc_shared'); + + if ( $cc =~ /icc/ ) { + + # Intel C++ compiler has the same name as its C compiler + $link = $cc; + + # suppress sprintf warnings that don't apply + $ccflags .= ' -wd269'; + + # suppress remarks about floating point comparisons + $ccflags .= ' -wd1572'; + + # suppress remarks about hiding of parameter declarations + $ccflags .= ' -wd1599'; + + # suppress remarks about "argument is incompatible with corresponding + # format string conversion" + $ccflags .= ' -wd181'; + + # gcc is currently not looking for unused variables, so should icc + # for the time being (this will reduce the noise somewhat) + $ccflags .= ' -wd869'; + + # ignore "operands are evaluated in unspecified order" warning + $ccflags .= ' -wd981'; + + # ignore "external declaration in primary source file" + # (only done temporarily to reduce noise) + $ccflags .= ' -wd1419'; + + # ignore "function 'xxx' was declared but never referenced" + # (only done temporarily to reduce noise) + $ccflags .= ' -wd117'; + + # ignore "conversion from "" to "" may lose significant bits" + # warnings (only done temporarily to reduce noise) + $ccflags .= ' -wd810'; + + # ignore "function "" was declared but never referenced" + # warnings (only done temporarily to reduce noise) + $ccflags .= ' -wd177'; + + # ignore warnings springing from problems with computed goto + # statements. If someone can find out how to make icc play nicely + # in these situations, that would be good. + $ccflags .= ' -wd1296'; + + $ccflags .= ' -Wall -Wcheck -w2'; + + $ccflags .= ' -Wabi'; + $ccflags .= ' -Wcomment'; + $ccflags .= ' -Wdeprecated'; + $ccflags .= ' -Wmain'; + $ccflags .= ' -Wmissing-prototypes'; + + #$ccflags .= ' -Wp64'; + $ccflags .= ' -Wpointer-arith'; + $ccflags .= ' -Wreturn-type'; + $ccflags .= ' -Wstrict-prototypes'; + + #$ccflags .= ' -Wtrigraphs'; + $ccflags .= ' -Wuninitialized'; + $ccflags .= ' -Wunknown-pragmas'; + $ccflags .= ' -Wunused-function'; + $ccflags .= ' -Wunused-variable'; + + $ld_share_flags = ' -shared -g -pipe -fexceptions -fPIC'; + $cc_shared .= ' -fPIC'; + + $verbose and print " ccflags: $ccflags\n"; + } + elsif ( $cc =~ /suncc/ ) { + $link = 'sunCC'; + if ( $ld_share_flags !~ /-KPIC/ ) { + $ld_share_flags = '-KPIC'; + } + if ( $cc_shared !~ /-KPIC/ ) { + $cc_shared = '-KPIC'; + } + } + else { + if ( $ld_share_flags !~ /-fPIC/ ) { + $ld_share_flags .= ' -fPIC'; + } + if ( $cc_shared !~ /-fPIC/ ) { + $cc_shared .= ' -fPIC'; + } + + # --export-dynamic, s. info gcc, ld + $linkflags .= ' -Wl,-E'; + } + + if ( $ccflags !~ /-D_GNU_SOURCE/ ) { + + # Request visibility of all POSIX symbols + # _XOPEN_SOURCE=600 doesn't work with glibc 2.1.3 + # _XOPEN_SOURCE=500 gives 2 undefined warns (setenv, unsetenv) on 2.1.3 + $ccflags .= ' -D_GNU_SOURCE'; + } + + $conf->data->set( + ccflags => $ccflags, + libs => $libs, + ld_share_flags => $ld_share_flags, + ld_load_flags => $ld_share_flags, + i_lib_pthread => 1, # RT#43149 fake a header entry + linkflags => $linkflags, + link => $link, + cc_shared => $cc_shared, + rpath => '-Wl,-rpath=', + + has_dynamic_linking => 1, + parrot_is_shared => 1, + libparrot_shared => 'libparrot$(SHARE_EXT).$(SOVERSION)', + libparrot_shared_alias => 'libparrot$(SHARE_EXT)', + libparrot_soname => '-Wl,-soname=libparrot$(SHARE_EXT).$(SOVERSION)', + ); + + if ( ( split( '-', $Config{archname} ) )[0] eq 'ia64' ) { + $conf->data->set( platform_asm => 1 ); + } + return; +} + +1; + +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 100 +# End: +# vim: expandtab shiftwidth=4: Added: branches/nointer/lib/Parrot/Configure/Initialize/Hints/mswin32.pm ============================================================================== --- (empty file) +++ branches/nointer/lib/Parrot/Configure/Initialize/Hints/mswin32.pm Mon Nov 19 20:01:20 2007 @@ -0,0 +1,242 @@ +# Copyright (C) 2005-2007, The Perl Foundation. +# $Id$ + +package init::hints::mswin32; + +use strict; +use warnings; +use Win32; + +sub runstep { + my ( $self, $conf ) = @_; + + my $libs = $conf->option_or_data('libs'); + my $ccflags = $conf->option_or_data('ccflags'); + my $cc = $conf->option_or_data('cc'); + + # Later in the Parrot::Configure::RunSteps->runsteps process, + # inter/progs.pl will merge the command-line overrides with the defaults. + # We do one bit of its work early here, because we need the result now. + $cc = $conf->options->get('cc') if defined $conf->options->get('cc'); + + my $is_msvc = grep { $cc eq $_ } (qw(cl cl.exe)); + my $is_intel = grep { $cc eq $_ } (qw(icl icl.exe)); + my $is_mingw = grep { $cc eq $_ } (qw(gcc gcc.exe)); + my $is_bcc = grep { $cc eq $_ } (qw(bcc32 bcc32.exe)); + + $conf->data->set( + win32 => 1, + PQ => '"', + make_c => '$(PERL) -e "chdir shift @ARGV; system \'$(MAKE)\', @ARGV; exit $$? >> 8;"', + ncilib_link_extra => '-def:src/libnci_test.def', + ); + + my $build_dir = $conf->data->get('build_dir'); + + if ( $build_dir =~ /\s/ ) { + $conf->data->set( build_dir => Win32::GetShortPathName($build_dir) ); + } + + if ($is_msvc) { + + # Check the output of cl.exe to see if it contains the + # string 'Standard' and remove the -O1 option if it does. + # This will prevent the 'optimization is not available in the + # standard edition compiler' warning each time we compile. + # The logo gets printed to STDERR; hence the redirection. + my $cc_output = `$cc /? 2>&1` || ''; + $ccflags =~ s/-O1 // if $cc_output =~ m/Standard/ || $cc_output =~ m{/ZI}; + $ccflags =~ s/-Gf/-GF/ if $cc_output =~ m/Version (\d+)/ && $1 >= 13; + + # override perl's warnings level + $ccflags =~ s/-W\d/-W4/; + + my $ccwarn = ''; + + # disable certain very noisy warnings + $ccwarn .= "-wd4127 "; # conditional expression is constant + $ccwarn .= "-wd4054 "; # type cast from function ptr to data ptr + $ccwarn .= "-wd4310 "; # cast truncates constant value + + $conf->data->set( + share_ext => '.dll', + load_ext => '.dll', + a => '.lib', + o => '.obj', + cc_o_out => '-Fo', + cc_exe_out => '-out:', + cc_ldflags => '/link', + + make_c => q{$(PERL) -e "chdir shift @ARGV;} + . q{system '$(MAKE)', '-nologo', @ARGV; exit $$? >> 8;"}, + make => 'nmake', + + # ZI messes with __LINE__ + cc_debug => '-Zi', + ld_debug => '-debug', + ld_share_flags => '-dll', + ld_load_flags => '-dll', + ld_out => '-out:', + ldflags => '-nologo -nodefaultlib', + libs => 'kernel32.lib ws2_32.lib msvcrt.lib oldnames.lib ', + libparrot_static => 'libparrot' . $conf->data->get('a'), + libparrot_shared => 'libparrot$(SHARE_EXT)', + ar_flags => '', + ar_out => '-out:', + slash => '\\', + blib_dir => 'blib\\lib', + ccflags => $ccflags, + ccwarn => $ccwarn, + has_dynamic_linking => 1, + parrot_is_shared => 1, + + sym_export => '__declspec(dllexport)', + sym_import => '__declspec(dllimport)' + ); + + # If we are building shared, need to include dynamic libparrot.lib, otherwise + # the static libparrot.lib. + if ( $conf->data->get('parrot_is_shared') ) { + $conf->data->set( libparrot_ldflags => 'libparrot.lib' ); + } + + # 'link' needs to be link.exe, not cl.exe. + # This makes 'link' and 'ld' the same. + $conf->data->set( link => $conf->data->get('ld') ); + + # We can't use -opt: and -debug together. + if ( $conf->data->get('ld_debug') =~ /-debug/ ) { + my $linkflags = $conf->option_or_data('linkflags'); + $linkflags =~ s/-opt:\S+//; + $conf->data->set( linkflags => $linkflags ); + } + } + elsif ($is_intel) { + $conf->data->set( + share_ext => '.dll', + load_ext => '.dll', + a => '.lib', + o => '.obj', + cc_o_out => '-Fo', + cc_exe_out => '-out:', + cc_ldflags => '/link', + + # ZI messes with __LINE__ + cc_debug => '-Zi', + libs => "$libs libircmt.lib", + ld => 'xilink', + ld_debug => '-debug', + ld_share_flags => '-dll', + ld_load_flags => '-dll', + ld_out => '-out:', + ldflags => '-nologo -nodefaultlib', + ar => 'xilib', + ar_flags => '', + ar_out => '-out:', + slash => '\\', + blib_dir => 'blib\\lib', + ccflags => $ccflags, + ccwarn => '', + has_dynamic_linking => 1 + ); + + # 'link' needs to be xilink.exe, not icl.exe. + # This makes 'link' and 'ld' the same. + $conf->data->set( link => $conf->data->get('ld') ); + + # We can't use -opt: and -debug together. + if ( $conf->data->get('ld_debug') =~ /-debug/ ) { + my $linkflags = $conf->option_or_data('linkflags'); + $linkflags =~ s/-opt:\S+//; + $conf->data->set( linkflags => $linkflags ); + } + } + elsif ($is_bcc) { + $conf->data->set( + o => '.obj', + a => '.lib', + share_ext => '.dll', + load_ext => '.dll', + cc => ${cc}, + ccflags => + '-O2 -w-8066 -DWIN32 -DNO_STRICT -DNDEBUG -D_CONSOLE -w-par -w-aus -w-ccc -w-rch', + cc_o_out => '-o', + cc_exe_out => '-e', + cc_debug => '-v', + + ld => ${cc}, + ldflags => '', + ld_out => '-e', + cc_ldflags => '', + ld_debug => '-v', + ld_share_flags => '-WD', + ld_load_flags => '-WD', + libs => 'import32.lib cw32.lib', + + link => ${cc}, + linkflags => '', + + ar => 'tlib /a /P128', + ar_flags => '', + ar_out => '', + ar_extra => '', + slash => '\\', + blib_dir => 'blib\\lib', + make_and => "\n\t", + ); + } + elsif ($is_mingw) { + my $make = $conf->data->get(qw(make)); + if ( $make =~ /nmake/i ) { + + # ActiveState Perl or PXPerl + $conf->data->set( + a => '.a', + ar => 'ar', + cc => 'gcc', + ccflags => '-DWIN32 ', + ld => 'g++', + ldflags => '', + libs => +'-lmsvcrt -lmoldname -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr -lwinmm -lversion ', + link => 'gcc', + linkflags => '', + o => '.o', + blib_dir => 'blib\\lib', + ); + if ( $conf->data->get(qw(optimize)) eq "1" ) { + $conf->data->set( optimize => '-O2' ); + } + } + elsif ( $make =~ /dmake/i ) { + + # mingw Perl + } + else { + warn "unknown configuration"; + } + + $conf->data->set( + parrot_is_shared => 1, + has_dynamic_linking => 1, + ld_load_flags => '-shared ', + ld_share_flags => '-shared ', + libparrot_ldflags => $conf->data->get('build_dir') . '/libparrot.dll', + ncilib_link_extra => 'src/libnci_test.def', + sym_export => '__declspec(dllexport)', + sym_import => '__declspec(dllimport)', + make => 'mingw32-make', + make_c => 'mingw32-make -C', + slash => '\\', + ); + } +} + +1; + +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 100 +# End: +# vim: expandtab shiftwidth=4: Added: branches/nointer/lib/Parrot/Configure/Initialize/Hints/msys.pm ============================================================================== --- (empty file) +++ branches/nointer/lib/Parrot/Configure/Initialize/Hints/msys.pm Mon Nov 19 20:01:20 2007 @@ -0,0 +1,29 @@ +# Copyright (C) 2005-2007, The Perl Foundation. +# $Id$ + +package init::hints::msys; + +use strict; +use warnings; + +sub runstep { + my ( $self, $conf ) = @_; + + $conf->data->set( + ld => '$(PERL) /bin/perlld', + ld_load_flags => '-shared ', + libs => +'-lmsvcrt -lmoldname -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr -lwinmm -lversion -lodbc32 ', + ncilib_link_extra => 'src/libnci_test.def', + has_socklen_t => 0, + ); +} + +1; + +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 100 +# End: +# vim: expandtab shiftwidth=4: Added: branches/nointer/lib/Parrot/Configure/Initialize/Hints/netbsd.pm ============================================================================== --- (empty file) +++ branches/nointer/lib/Parrot/Configure/Initialize/Hints/netbsd.pm Mon Nov 19 20:01:20 2007 @@ -0,0 +1,32 @@ +# Copyright (C) 2006-2007, The Perl Foundation. +# $Id$ + +package init::hints::netbsd; + +use strict; +use warnings; + +sub runstep { + my ( $self, $conf ) = @_; + + my $ccflags = $conf->data->get('ccflags'); + if ( $ccflags !~ /-pthread/ ) { + $ccflags .= ' -pthread'; + } + $conf->data->set( ccflags => $ccflags ); + + my $libs = $conf->data->get('libs'); + if ( $libs !~ /-lpthread/ ) { + $libs .= ' -lpthread'; + } + $conf->data->set( libs => $libs ); +} + +1; + +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 100 +# End: +# vim: expandtab shiftwidth=4: Added: branches/nointer/lib/Parrot/Configure/Initialize/Hints/openbsd.pm ============================================================================== --- (empty file) +++ branches/nointer/lib/Parrot/Configure/Initialize/Hints/openbsd.pm Mon Nov 19 20:01:20 2007 @@ -0,0 +1,38 @@ +# Copyright (C) 2005, The Perl Foundation. +# $Id$ + +package init::hints::openbsd; + +use strict; +use warnings; +use Config; + +sub runstep { + my ( $self, $conf ) = @_; + + my $ccflags = $conf->data->get('ccflags'); + if ( $ccflags !~ /-pthread/ ) { + $ccflags .= ' -pthread'; + } + $conf->data->set( ccflags => $ccflags ); + + my $libs = $conf->data->get('libs'); + if ( $libs !~ /-lpthread/ ) { + $libs .= ' -lpthread'; + } + $conf->data->set( libs => $libs ); + + if ( ( split( '-', $Config{archname} ) )[0] eq 'powerpc' ) { + $conf->data->set( as => 'as -mregnames' ); + } + +} + +1; + +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 100 +# End: +# vim: expandtab shiftwidth=4: Added: branches/nointer/lib/Parrot/Configure/Initialize/Hints/os2.pm ============================================================================== --- (empty file) +++ branches/nointer/lib/Parrot/Configure/Initialize/Hints/os2.pm Mon Nov 19 20:01:20 2007 @@ -0,0 +1,33 @@ +# Copyright (C) 2005, The Perl Foundation. +# $Id$ + +package init::hints::os2; + +use strict; +use warnings; + +sub runstep { + my ( $self, $conf ) = @_; + + # This hints file is very specific to a particular os/2 configuration. + # A more general one would be appreciated, should anyone actually be + # using OS/2 + $conf->data->set( + libs => "-lm -lsocket -lcExt -lbsd", + iv => "long", + nv => "double", + opcode_t => "long", + ccflags => "-I. -fno-strict-aliasing -mieee-fp -I./include", + ldflags => "-Zexe", + perl => "perl" # avoids case-mangling in make + ); +} + +1; + +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 100 +# End: +# vim: expandtab shiftwidth=4: Added: branches/nointer/lib/Parrot/Configure/Initialize/Hints/solaris.pm ============================================================================== --- (empty file) +++ branches/nointer/lib/Parrot/Configure/Initialize/Hints/solaris.pm Mon Nov 19 20:01:20 2007 @@ -0,0 +1,109 @@ +# Copyright (C) 2005, The Perl Foundation. +# $Id$ + +package init::hints::solaris; + +use strict; +use warnings; + +use Parrot::Configure::Step qw(cc_gen cc_run); + +sub runstep { + my ( $self, $conf ) = @_; + + my $libs = $conf->data->get('libs'); + if ( $libs !~ /-lpthread/ ) { + $libs .= ' -lpthread'; + } + if ( $libs !~ /-lrt\b/ ) { + $libs .= ' -lrt'; # Needed for sched_yield. + } + $conf->data->set( libs => $libs ); + + ################################################################ + # If we're going to be using ICU (or any other C++-compiled library) we + # need to use the c++ compiler as a linker. As soon as the user + # selects a compiler, we will run the gccversion test. (If we were to + # wait till it's normally run, the linker question would have already + # been asked.) + my $solaris_link_cb = sub { + use Carp; + my ( $key, $cc ) = @_; + my %gnuc; + my $link = $conf->data->get('link'); + cc_gen("config/auto/gcc/test_c.in"); + + # Can't call cc_build since we haven't set all the flags yet. + # This should suffice for this test. + my $cc_inc = $conf->data->get('cc_inc'); + Parrot::Configure::Step::_run_command( "$cc -o test test.c $cc_inc", + 'test.cco', 'test.cco' ) + and confess "C compiler failed (see test.cco)"; + %gnuc = eval cc_run() or die "Can't run the test program: $!"; + if ( defined $gnuc{__GNUC__} ) { + $link = 'g++'; + } + else { + $link =~ s/\bcc\b/CC/; + } + $conf->data->set( link => $link ); + $conf->data->deltrigger( "cc", "solaris_link" ); + }; + $conf->data->settrigger( "cc", "solaris_link", $solaris_link_cb ); + + ################################################################ + # cc_shared: Flags to instruct the compiler to use position-independent + # code for use in shared libraries. -KPIC for Sun's compiler, -fPIC for + # gcc. We don't know which compiler we're using till after the + # gccversion test. + # RT#43150 Should this go into the shlibs.pl Configure.pl unit instead? + my $solaris_cc_shared_cb = sub { + my ( $key, $gccversion ) = @_; + + if ($gccversion) { + $conf->data->set( cc_shared => '-fPIC' ); + } + else { + $conf->data->set( cc_shared => '-KPIC' ); + } + $conf->data->deltrigger( "gccversion", "solaris_cc_shared" ); + }; + $conf->data->settrigger( "gccversion", "solaris_cc_shared", $solaris_cc_shared_cb ); + + ################################################################ + # Parrot usually aims for IEEE-754 compliance. + # For Solaris 8/Sun Workshop Pro 4, both + # atan2( 0.0, -0.0) and atan2(-0.0, -0.0) + # return 0, when they should return +PI and -PI respectively. + # For Sun's compilers, fix this with the -xlibmieee flag. + # I don't know of an equivalent flag for gcc. + # (Alternatively, and more generally, perhahs we should run an + # ieee-conformance test and then call back into a hints-file trigger + # to set platform-specific flags. + # A. Dougherty 7 March 2005 + # We don't know which compiler we're using till after the gccversion test. + my $solaris_ieee_cb = sub { + my ( $key, $gccversion ) = @_; + + if ($gccversion) { + + # Don't know how to do this for gcc. + } + else { + my $linkflags = $conf->data->get('linkflags'); + $conf->data->add( ' ', linkflags => '-xlibmieee' ) + unless $linkflags =~ /-xlibmieee/; + } + $conf->data->deltrigger( "gccversion", "solaris_ieee" ); + }; + $conf->data->settrigger( "gccversion", "solaris_ieee", $solaris_ieee_cb ); +} + +1; + +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 100 +# End: +# vim: expandtab shiftwidth=4: Added: branches/nointer/lib/Parrot/Configure/Initialize/Hints/vms.pm ============================================================================== --- (empty file) +++ branches/nointer/lib/Parrot/Configure/Initialize/Hints/vms.pm Mon Nov 19 20:01:20 2007 @@ -0,0 +1,40 @@ +# Copyright (C) 2005, The Perl Foundation. +# $Id$ + +package init::hints::vms; + +use strict; +use warnings; + +sub runstep { + my ( $self, $conf ) = @_; + + $conf->data->set( + ccflags => qq{/Prefix=All/Obj=.obj/NoList/include="./include"/nowarn}, + perl => "MCR $^X", + exe => ".exe" + ); + + { + local $^W; # no warnings on redefinition + + *Parrot::Configure::Step::cc_build = sub { + my ( $cc, $ccflags ) = $conf->data->get(qw(cc ccflags)); + system("$cc $ccflags test.c") and die "C compiler died!"; + system("link/exe=test test") and die "Link failed!"; + }; + + *Parrot::Configure::Step::cc_run = sub { + `mcr []test`; + }; + } +} + +1; + +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 100 +# End: +# vim: expandtab shiftwidth=4: