perl-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Randy Kobes <ra...@theoryx5.uwinnipeg.ca>
Subject Re: [mp2] MP_HAVE_APR_LIBS?
Date Wed, 05 Nov 2003 06:06:09 GMT
On Tue, 4 Nov 2003, Stas Bekman wrote:

> Randy Kobes wrote:
> > Hi,
> >     It'll probably be obvious, but I've been trying to see
> > how MP_HAVE_APR_LIBS gets defined for use in xs/APR/APR.xs,
> > in order to see if a working version can be done for Win32.
> > Could someone point me in the general direction? Thanks.
>
> It happens in top-level Makefile.PL:

Thanks, Stas! I don't know how I missed that ... Anyway, for
Win32, the reason this didn't work (assuming the existence
of the (apr|apu)-config scripts, is that a '.bat' extension
is needed in the -x test. The following:

===========================================================
Index: Makefile.PL
===================================================================
RCS file: /home/cvs/modperl-2.0/Makefile.PL,v
retrieving revision 1.126
diff -u -r1.126 Makefile.PL
--- Makefile.PL	29 Oct 2003 00:42:47 -0000	1.126
+++ Makefile.PL	5 Nov 2003 05:39:44 -0000
@@ -95,8 +95,9 @@
     # overrides any local definition, not sure what's the right fix, for
     # now just define it here (should it define PASTHRU_DEFINE instead?)
     if (my $apr_bindir = $build->apr_bindir()) {
+        my $ext = WIN32 ? 'bat' : '';
         my @apr_libs = grep $_, map { -x $_ && qx{$_ --link-ld} }
-            map { qq{$apr_bindir/$_-config} } qw(apr apu);
+            map { qq{$apr_bindir/$_-config.$ext} } qw(apr apu);
         $opt_define = '-DMP_HAVE_APR_LIBS' if @apr_libs;
     }

Index: xs/APR/APR/Makefile.PL
===================================================================
RCS file: /home/cvs/modperl-2.0/xs/APR/APR/Makefile.PL,v
retrieving revision 1.17
diff -u -r1.17 Makefile.PL
--- xs/APR/APR/Makefile.PL	22 Aug 2003 19:16:50 -0000	1.17
+++ xs/APR/APR/Makefile.PL	5 Nov 2003 05:39:44 -0000
@@ -3,18 +3,26 @@

 use lib qw(../lib);
 use ModPerl::BuildMM ();
+use Apache::Build ();
 use Config;

+use constant WIN32 => Apache::Build::WIN32;
+
 my $libs = '';
 if (my $apr_bindir = ModPerl::BuildMM::build_config()->apr_bindir()) {

-    # XXX: this works only with libapr 0.9.2+ (not on win32)
+    # XXX: this works only with libapr 0.9.2+
+    my $ext = WIN32 ? 'bat' : '';
     my @libs = grep $_, map { -x $_ && qx{$_ --link-ld --libs} }
-        map { qq{$apr_bindir/$_-config} } qw(apr apu);
+        map { qq{$apr_bindir/$_-config.$ext} } qw(apr apu);
     chomp @libs;
     $libs = join ' ', @libs;
 }

+if (WIN32) {
+    $libs =~ s{/libpath:}{-L}g;
+    $libs =~ s{(\w+)\.lib}{-l$1}g;
+}

 ModPerl::BuildMM::WriteMakefile(
     'NAME'	   => 'APR',

====================================================================
sets both the MP_HAVE_APR_LIBS define and also adjusts the
$libs in xs/APR/APR/Makefile.PL to something that
ExtUtils::MakeMaker understands (the reason for this is
that, eg, (apr|apu)-config --link-ld gives
/libpath:"/Path/to/Apache2", which is of a form needed to
build c-modules, but ExtUtils::MakeMaker expects it to be
-L"/Path/to/Apache2").

However, when I use this, I get an error from
xs/APR/APR/APR.xs:
=========================================================
	cd "src/modules/perl" && NMAKE -f Makefile.modperl

	cl -c -IC:/MyFiles/MODPER~1.0/src/modules/perl
-IC:/MyFiles/MODPER~1.0/xs -IC:/Apache2/include
-IC:\Apache2/include -nologo -Gf -W3 -MD -DNDEBUG -O1
-DWIN32 -D_CONSOLE -DNO_STRICT -DHAVE_DES_FCRYPT
-DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO
-DPERL_MSVCRT_READFIX -DMOD_PERL -DMP_COMPAT_1X -MD -DNDEBUG
-O1 -DVERSION=\"0.01\"  -DXS_VERSION=\"0.01\"
"-IC:\Perl\lib\CORE"  -DMP_HAVE_APR_LIBS APR.c APR.c

APR.xs(22) : error C2065: 'my_perl' : undeclared identifier
APR.xs(22) : warning C4047: 'function' : 'struct interpreter
*' differs in levels of indirection from 'int '
APR.xs(22) : warning C4024: 'Perl_IStdIO_ptr' : different
types for formal and actual parameter 1
APR.xs(22) : warning C4047: 'function' : 'struct interpreter
*' differs in levels of indirection from 'int '
APR.xs(22) : warning C4024: 'Perl_IStdIO_ptr' : different
types for formal and actual parameter 1

============================================================
coming from the fprintf(stderr, ...) call. I'm not
sure what the fix is - I tried
   PerlIO_printf(PerlIO_stderr(), ...)
but came up against another error:
============================================================
	cd "src/modules/perl" && NMAKE -f Makefile.modperl
	cl -c -IC:/MyFiles/MODPER~1.0/src/modules/perl
-IC:/MyFiles/MODPER~1.0/xs -IC:/Apache2/include
-IC:\Apache2/include -nologo -Gf -W3 -MD -DNDEBUG -O1
-DWIN32 -D_CONSOLE -DNO_STRICT -DHAVE_DES_FCRYPT
-DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO
-DPERL_MSVCRT_READFIX -DMOD_PERL -DMP_COMPAT_1X -MD -DNDEBUG
-O1 -DVERSION=\"0.01\"  -DXS_VERSION=\"0.01\"
"-IC:\Perl\lib\CORE"  -DMP_HAVE_APR_LIBS APR.c APR.c

APR.xs(22) : error C2065: 'my_perl' : undeclared identifier
APR.xs(22) : warning C4047: 'function' : 'struct interpreter
*' differs in levels of indirection from 'int '
APR.xs(22) : warning C4024: 'Perl_PerlIO_stderr' : different
types for formal and actual parameter 1
=====================================================================
I noticed that in src/modules/perl/* that the
fprintf(stderr, ...) calls are commented out - is that
related to this problem? Thanks.

-- 
best regards,
randy

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Mime
View raw message