diff --git a/config/auto/gcc.pm b/config/auto/gcc.pm index 4877a74e75..c9d5cbf726 100644 --- a/config/auto/gcc.pm +++ b/config/auto/gcc.pm @@ -83,20 +83,20 @@ sub _evaluate_gcc { $gccversion .= ".$minor" if defined $minor; $self->set_result("yes, $gccversion"); - if ($^O eq 'MSWin32') { - $conf->data->set( - cc_shared => '', - ld_share_flags => '-shared', - ld_load_flags => '-shared', - ); - } - else { - $conf->data->set( - cc_shared => '-fPIC', - ld_share_flags => '-shared -fPIC', - ld_load_flags => '-shared -fPIC', - ); - } +# if ($^O eq 'MSWin32') { +# $conf->data->set( +# cc_shared => '', +# ld_share_flags => '-shared', +# ld_load_flags => '-shared', +# ); +# } +# else { +# $conf->data->set( +# cc_shared => '-fPIC', +# ld_share_flags => '-shared -fPIC', +# ld_load_flags => '-shared -fPIC', +# ); +# } $conf->data->set( noinline => '__attribute__ ((noinline))' ); diff --git a/config/init/defaults.pm b/config/init/defaults.pm index 71de9f0e5e..7ce8cfcb3b 100644 --- a/config/init/defaults.pm +++ b/config/init/defaults.pm @@ -176,7 +176,10 @@ sub runstep { # libparrot library names libparrot_static => 'libparrot.a', + # libparrot_shared and libparrot_soname may be overwritten in + # OS-specific hints files libparrot_shared => 'libparrot.so', + libparrot_soname => '', # does the system know about static/dynamic linking? has_static_linking => 1, @@ -185,8 +188,6 @@ sub runstep { # default behaviour for linking parrot to a static or shared libparrot parrot_is_shared => 0, - #avoid a warning during Configure.pl - libparrot_soname => '', perl => $^X, test_prog => 'parrot', @@ -201,21 +202,20 @@ sub runstep { rm_rf => '$(PERL) -MExtUtils::Command -e rm_rf', touch => '$(PERL) -MExtUtils::Command -e touch', - ar => 'ar', - arflags => 'cr', - # tar is currently used only in 'make release'. - tar => which('tar') || '', - + ranlib => ':', + ar => 'ar', + arflags => 'cr', # for Win32 - ar_out => '', - + ar_out => '', # for Borland C - ar_extra => '', - ranlib => ':', - rpath => '', - make => $Config{make}, - make_set_make => $Config{make_set_make}, - make_and => '&&', + ar_extra => '', + + # tar is currently used only in 'make release'. + tar => which('tar') || '', + rpath => '', + make => $Config{make}, + make_set_make => $Config{make_set_make}, + make_and => '&&', # make_c: Command to emulate GNU make's C<-C directory> option: chdir # to C before executing $(MAKE) diff --git a/config/init/hints/darwin.pm b/config/init/hints/darwin.pm index bae5836cb6..68c113a3d9 100644 --- a/config/init/hints/darwin.pm +++ b/config/init/hints/darwin.pm @@ -21,7 +21,7 @@ our %defaults = ( sub runstep { my ( $self, $conf ) = @_; - my $share_ext = $conf->option_or_data('share_ext'); + my $share_ext = '.dylib'; my $version = $conf->option_or_data('VERSION'); # The hash referenced by $flagsref is the list of options that have -arch @@ -63,7 +63,7 @@ sub runstep { my $osvers = `/usr/sbin/sysctl -n kern.osrelease`; chomp $osvers; - $conf->data->set( + my %darwin_hints = ( darwin => 1, osx_version => $deploy_target, osvers => $osvers, @@ -71,7 +71,7 @@ sub runstep { ldflags => $flagsref->{ldflags}, ccwarn => "-Wno-shadow", libs => $libs, - share_ext => '.dylib', + share_ext => $share_ext, load_ext => '.bundle', link => 'c++', linkflags => $flagsref->{linkflags}, @@ -80,22 +80,30 @@ sub runstep { ld_load_flags => '-undefined dynamic_lookup -bundle', memalign => 'some_memalign', has_dynamic_linking => 1, + ranlib => 'ranlib', # TT #344: When built against a dynamic libparrot, # installable_parrot records the path to the blib version # of the library. + rpath => "-L", parrot_is_shared => 1, libparrot_shared => "libparrot.$version$share_ext", libparrot_shared_alias => "libparrot$share_ext", - rpath => "-L", libparrot_soname => "-install_name " . '"' . $conf->data->get('libdir') . '/libparrot' - . $conf->data->get('share_ext') - . '"' + . $share_ext + . '"', ); + $conf->data->set( %darwin_hints ); + my $verbose_message = ''; + foreach my $k (sort keys %darwin_hints) { + $verbose_message .= sprintf(" %-24s => %s\n" => + ($k, $darwin_hints{$k})); + } + $conf->debug($verbose_message); } #################### INTERNAL SUBROUTINES #################### diff --git a/config/init/hints/linux.pm b/config/init/hints/linux.pm index fdfc1c5247..1c13443abd 100644 --- a/config/init/hints/linux.pm +++ b/config/init/hints/linux.pm @@ -26,8 +26,9 @@ sub runstep { if ( $libs !~ /-lrt\b/ ) { $libs .= ' -lrt'; } - my $ld_share_flags = $conf->data->get('ld_share_flags'); my $cc_shared = $conf->data->get('cc_shared'); + my $ld_share_flags = $conf->data->get('ld_share_flags'); + my $ld_load_flags = $ld_share_flags;; if ( $cc =~ /icc/ ) { @@ -46,6 +47,11 @@ sub runstep { $cc_shared = '-KPIC'; } } + elsif ( $cc =~ /g(c|\+){2}/ ) { + $cc_shared = '-fPIC', + $ld_share_flags = '-shared -fPIC', + $ld_load_flags = '-shared -fPIC', + } if ( $ccflags !~ /-D_GNU_SOURCE/ ) { @@ -61,11 +67,11 @@ sub runstep { $conf->data->set( ccflags => $ccflags, libs => $libs, + cc_shared => $cc_shared, ld_share_flags => $ld_share_flags, - ld_load_flags => $ld_share_flags, + ld_load_flags => $ld_load_flags, linkflags => $linkflags, link => $link, - cc_shared => $cc_shared, rpath => '-Wl,-rpath=', osvers => $osvers, diff --git a/config/init/optimize.pm b/config/init/optimize.pm index 7cba9f73ec..c0d49bc447 100644 --- a/config/init/optimize.pm +++ b/config/init/optimize.pm @@ -54,8 +54,10 @@ sub runstep { $conf->debug("optimize options: ", $optimization_level, "\n"); # disable debug flags. - $conf->data->set( cc_debug => '' ); - $conf->data->add( ' ', ccflags => "-DDISABLE_GC_DEBUG=1 -DNDEBUG" ); + if ($conf->data->get('optimize')) { + $conf->data->set( cc_debug => '' ); + $conf->data->add( ' ', ccflags => "-DDISABLE_GC_DEBUG=1 -DNDEBUG" ); + } # TT #405 if ($conf->data->get('cpuarch') eq 'amd64') {