Author: stas
Date: Thu Apr 28 07:05:46 2005
New Revision: 165141
URL: http://svn.apache.org/viewcvs?rev=165141&view=rev
Log:
improving DSO support on cygwin. The problem with cygwin is that it
behaves like windows (it's a posix layer over windows after
all). That's why we need to supply all symbols during linking time
just like on win32, by adding -lapr-0 -laprutil-0 and -lhttpd. On
windows, Apache supplies all the three libraries and it's easy to
link, but on cygwin apache doesn't play nice and doesn't supply
libhttpd.
Submitted by: Nick *** <[EMAIL PROTECTED]>
Modified:
perl/modperl/trunk/Changes
perl/modperl/trunk/lib/Apache2/Build.pm
Modified: perl/modperl/trunk/Changes
URL:
http://svn.apache.org/viewcvs/perl/modperl/trunk/Changes?rev=165141&r1=165140&r2=165141&view=diff
==============================================================================
--- perl/modperl/trunk/Changes (original)
+++ perl/modperl/trunk/Changes Thu Apr 28 07:05:46 2005
@@ -12,6 +12,15 @@
=item 1.999_23-dev
+improving DSO support on cygwin. The problem with cygwin is that it
+behaves like windows (it's a posix layer over windows after
+all). That's why we need to supply all symbols during linking time
+just like on win32, by adding -lapr-0 -laprutil-0 and -lhttpd. On
+windows, Apache supplies all the three libraries and it's easy to
+link, but on cygwin apache doesn't play nice and doesn't supply
+libhttpd. This change adds libapr and libaprutil. [Nick ***
+<[EMAIL PROTECTED]>]
+
improve the diagnostics when detecting mp2 < 1.999022, tell the user
which files and/or dirs need to be removed [Stas]
Modified: perl/modperl/trunk/lib/Apache2/Build.pm
URL:
http://svn.apache.org/viewcvs/perl/modperl/trunk/lib/Apache2/Build.pm?rev=165141&r1=165140&r2=165141&view=diff
==============================================================================
--- perl/modperl/trunk/lib/Apache2/Build.pm (original)
+++ perl/modperl/trunk/lib/Apache2/Build.pm Thu Apr 28 07:05:46 2005
@@ -40,7 +40,7 @@
use constant REQUIRE_ITHREADS => grep { $^O eq $_ } qw(MSWin32);
use constant PERL_HAS_ITHREADS =>
$Config{useithreads} && ($Config{useithreads} eq 'define');
-use constant BUILD_APREXT => WIN32();
+use constant BUILD_APREXT => WIN32() || CYGWIN();
use ModPerl::Code ();
use ModPerl::BuildOptions ();
@@ -464,6 +464,10 @@
$ldopts .= $self->gtop_ldopts;
}
+ if (CYGWIN && $self->is_dynamic) {
+ $ldopts .= join ' ', '', $self->apru_link_flags;
+ }
+
$config->{ldflags} = $ldflags; #reset
# on Irix mod_perl.so needs to see the libperl.so symbols, which
@@ -1050,7 +1054,9 @@
return @apru_link_flags if @apru_link_flags;
- for ($self->apr_config_path, $self->apu_config_path) {
+ # first use apu_config_path and then apr_config_path in order to
+ # resolve the symbols right during linking
+ for ($self->apu_config_path, $self->apr_config_path) {
if (my $link = $_ && -x $_ && qx{$_ --link-ld --libs}) {
chomp $link;
if ($self->httpd_is_source_tree) {
@@ -1538,6 +1544,11 @@
"$self->{cwd}/src/modules/perl/$self->{MP_LIBNAME}.lib";
}
+sub modperl_libs_cygwin {
+ my $self = shift;
+ "-L$self->{cwd}/src/modules/perl -l$self->{MP_LIBNAME}";
+}
+
sub modperl_libs {
my $self = shift;
my $libs = \&{"modperl_libs_$^O"};
@@ -1566,6 +1577,20 @@
return qq{ -L$dir -l$lib };
}
+sub mp_apr_lib_cygwin {
+ my $self = shift;
+ my ($dir, $lib) = $self->mp_apr_blib();
+ $lib =~ s[^lib(\w+)$Config{lib_ext}$][$1];
+ my $libs = "-L$dir -l$lib";
+
+ # This is ugly, but is the only way to prevent the "undefined
+ # symbols" error
+ $libs .= join ' ', '', $self->apru_link_flags,
+ '-L' . catdir($self->perl_config('archlibexp'), 'CORE'), '-lperl';
+
+ $libs;
+}
+
# linking used for the aprext lib used to build APR/APR::*
sub mp_apr_lib {
my $self = shift;
@@ -1798,6 +1823,17 @@
my $self = shift;
my $flags = $self->otherldflags_default;
$flags .= ' -pdb:$(INST_ARCHAUTODIR)\$(BASEEXT).pdb' if $self->{MP_DEBUG};
+ $flags;
+}
+
+sub otherldflags_cygwin {
+ my $self = shift;
+ my $flags = $self->otherldflags_default;
+
+ unless ($self->{MP_STATIC_EXTS}) {
+ $flags .= join ' ', $self->apru_link_flags;
+ }
+
$flags;
}