From: Jarkko Hietaniemi Date: Sat, 27 Apr 2002 22:17:57 +0000 (+0000) Subject: More NetBSD patches from Johnny Lam. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=30afd0dc34ec4b8eed82e154a076dbd7781b549e;p=p5sagit%2Fp5-mst-13.2.git More NetBSD patches from Johnny Lam. Remove the need for a $prefix setting that was added in the previous patch I sent. Also add the proper rpath options to the linker flags depending on whether we're on a ELF or a.out platform. These were tested both in a non-pkgsrc and pkgsrc build. Append to $libs instead of overwriting its value. This was causing $(LDLOADLIBS) to not get added to the dynamic_libs link command on NetBSD systems and was the cause of the GDBM problems reported. Also use '$(LDLOADLIBS)' instead of expanding its value so that it is more easily overridden in the Makefile by "make all LDLOADLIBS=...". Remove "-L/usr/local/lib" because the location of libgdbm.so is already added during the Configure process, and this spurious addition may cause the wrong libgdbm.so to be linked against as a result. p4raw-id: //depot/perl@16233 --- diff --git a/ext/GDBM_File/Makefile.PL b/ext/GDBM_File/Makefile.PL index c0824c7..ad19467 100644 --- a/ext/GDBM_File/Makefile.PL +++ b/ext/GDBM_File/Makefile.PL @@ -2,7 +2,7 @@ use ExtUtils::MakeMaker; use ExtUtils::Constant 0.11 'WriteConstants'; WriteMakefile( NAME => 'GDBM_File', - LIBS => ["-L/usr/local/lib -lgdbm", "-ldbm"], + LIBS => ["-lgdbm", "-ldbm"], MAN3PODS => {}, # Pods will be built by installman. XSPROTOARG => '-noprototypes', # XXX remove later? VERSION_FROM => 'GDBM_File.pm', diff --git a/hints/netbsd.sh b/hints/netbsd.sh index a2a0843..8f79edf 100644 --- a/hints/netbsd.sh +++ b/hints/netbsd.sh @@ -18,8 +18,6 @@ case "$osvers" in usedl="$undef" ;; *) - # Note that we use the value of $prefix in this block. The user - # should specify -Dprefix=... to the Configure script. if [ -f /usr/libexec/ld.elf_so ]; then d_dlopen=$define d_dlerror=$define @@ -27,7 +25,7 @@ case "$osvers" in # needs __eh_alloc, __pure_virtual, and others. # XXX This should be obsoleted by gcc-3.0. ccdlflags="-Wl,-whole-archive -lgcc -Wl,-no-whole-archive \ - -Wl,-E -Wl,-R$prefix/lib $ccdlflags" + -Wl,-E $ccdlflags" cccdlflags="-DPIC -fPIC $cccdlflags" lddlflags="--whole-archive -shared $lddlflags" elif [ "`uname -m`" = "pmax" ]; then @@ -40,7 +38,6 @@ case "$osvers" in elif [ -f /usr/libexec/ld.so ]; then d_dlopen=$define d_dlerror=$define - ccdlflags="-Wl,-R$prefix/lib $ccdlflags" # we use -fPIC here because -fpic is *NOT* enough for some of the # extensions like Tk on some netbsd platforms (the sparc is one) cccdlflags="-DPIC -fPIC $cccdlflags" @@ -97,6 +94,10 @@ EOCBU # GDBM might be here, pth might be there. if test -d /usr/pkg/lib; then loclibpth="$loclibpth /usr/pkg/lib" - ldflags="$ldflags -R/usr/pkg/lib" + if [ -f /usr/libexec/ld.elf_so ]; then + ldflags="$ldflags -Wl,-R/usr/pkg/lib" + else + ldflags="$ldflags -R/usr/pkg/lib" + fi fi test -d /usr/pkg/include && locincpth="$locincpth /usr/pkg/include" diff --git a/lib/ExtUtils/MM_Unix.pm b/lib/ExtUtils/MM_Unix.pm index 9a8c4dc..a31d56c 100644 --- a/lib/ExtUtils/MM_Unix.pm +++ b/lib/ExtUtils/MM_Unix.pm @@ -1004,7 +1004,7 @@ $(INST_DYNAMIC): $(OBJECT) $(MYEXTLIB) $(BOOTSTRAP) $(INST_ARCHAUTODIR)/.exists push(@m,' $(RM_F) $@ '); - my $libs = $self->{LDLOADLIBS} || ''; + my $libs = '$(LDLOADLIBS)'; if ($^O eq 'netbsd') { # Use nothing on static perl platforms, and to the flags needed @@ -1013,9 +1013,9 @@ $(INST_DYNAMIC): $(OBJECT) $(MYEXTLIB) $(BOOTSTRAP) $(INST_ARCHAUTODIR)/.exists # or -R to add paths to the run-time library search path. if ($Config{'useshrplib'}) { if ($Config{'lddlflags'} =~ /-Wl,-R/) { - $libs = '-L$(PERL_INC) -Wl,-R$(INSTALLARCHLIB)/CORE -lperl'; + $libs .= ' -L$(PERL_INC) -Wl,-R$(INSTALLARCHLIB)/CORE -lperl'; } elsif ($Config{'lddlflags'} =~ /-R/) { - $libs = '-L$(PERL_INC) -R$(INSTALLARCHLIB)/CORE -lperl'; + $libs .= ' -L$(PERL_INC) -R$(INSTALLARCHLIB)/CORE -lperl'; } } }