> Sorry for all the spam. Here is a patch that doesn't use your
> have_library function and only uses Devel-CheckLib.
>
> It should work
> for everybody.
Thanks! However this patch is not in unfied diff format, and so I find
it delightfully hard to follow. Please include a patch in that format -
you can use gnudiff -u to generate it. You can find gnudiff in cygwin or
in
(old version,
but should work fine).
As an alternative, you can send me a Bitbcuket pull request. Finally, I
should note that it is possible you are listing all the headers and
other parameters for check_lib() twice. If os, please extract them into
a function or a variable.
Regards,
Shlomi Fish
>
>
> *** Makefile.PL.orig 2012-10-13 16:30:39.000000000
> -0400
> --- Makefile.PL 2012-10-17 09:13:57.972500000 -0400
> ***************
> *** 286,292 ****
> #
> --------------------------------------------------------------------------
> #
> # fix the ld flags
> #
> --------------------------------------------------------------------------
> #
> ! if ($config{LIBS} !~ /\-l(?:lib)?xml2\b/) {
> # in this case
> we are not able to run xml2-config. therefore we need to
> #
> expand the libz as well.
> if ($is_Win32) {
> --- 286,292 ----
> #
> --------------------------------------------------------------------------
> #
> # fix the ld flags
> #
> --------------------------------------------------------------------------
> #
> ! if (!defined $config{LIBS} || $config{LIBS} !~ /\-
> l(?:lib)?xml2\b/) {
> # in this case we are not able to run xml2-
> config. therefore we need to
> # expand the libz as well.
> if
> ($is_Win32) {
> ***************
> *** 327,365 ****
> # if the Build
> Target is set correctly. Otherwise we have to set it by
> # hand
> - #
> --------------------------------------------------------------------------
> #
> -
> - #
> --------------------------------------------------------------------------
> #
> - # test if the libraries are really installed!
> - unless
> (have_library("xml2") or have_library("libxml2")) {
> - print
> STDERR <<"DEATH";
> - libxml2, zlib, and/or the Math library (-lm) have
> not been found.
> - Try setting LIBS and INC values on the command line
> - Or get libxml2 from
> -
http://xmlsoft.org/
> - If you install via
> RPMs, make sure you also install the -devel
> - RPMs, as this is where
> the headers (.h files) are.
> -
> - Also, you may try to run perl
> Makefile.PL with the DEBUG=1 parameter
> - to see the exact reason why
> the detection of libxml2 installation
> - failed or why Makefile.PL was
> not able to compile a test program.
> - DEATH
> - exit 0; # 0
> recommended by
http://cpantest.grango.org (Notes for CPAN Authors)
> -
> }
> - #
> --------------------------------------------------------------------------
> #
> -
> - #
> --------------------------------------------------------------------------
> #
> - # _NOW_ write the Makefile
> -
> my $ldflags = delete
> $config{LDFLAGS};
> if ($ldflags) {
> $config{dynamic_lib} = {
> OTHERLDFLAGS => " $ldflags " };
> }
>
> ! my $incpath =
> $config{INC};
> $incpath =~ s#(\A|\s)\s*-I#$1#g;
>
> !
> check_lib_or_exit(
> # fill in what you prompted the user for
> here
> lib => [qw(xml2)],
> incpath =>
> [split(/\s/,$incpath)],
> --- 327,344 ----
> # if the Build Target is
> set correctly. Otherwise we have to set it by
> # hand
>
> my
> $ldflags = delete $config{LDFLAGS};
> if ($ldflags) {
> $config{dynamic_lib} = { OTHERLDFLAGS => " $ldflags " };
> }
>
> !
> my $incpath = $config{INC} || "";
> $incpath =~ s#(\A|\s)\s*-I#$1#g;
> !
> ! print "Checking for ability to link against xml2...";
> ! if(
> !
> check_lib(
> # fill in what you prompted the user for here
> lib => [qw(xml2)],
> incpath => [split(/\s/,$incpath)],
> ***************
> *** 389,395 ****
> 'libxml/xpath.h',
> 'libxml/xpathInternals.h',
> ],
> ! );
>
> WriteMakefile(
> %INFOS,
> --- 368,430 ----
> 'libxml/xpath.h',
> 'libxml/xpathInternals.h',
> ],
> ! )) {
> ! print "yes\n";
> !
> } else {
> ! print "no\n";
> ! print "Checking for ability to link
> against libxml2...";
> ! if(
> ! check_lib(
> ! # fill in
> what you prompted the user for here
> ! lib => [qw(libxml2)],
> !
> incpath => [split(/\s/,$incpath)],
> ! header =>
> ! [
> !
> 'libxml/c14n.h',
> ! 'libxml/catalog.h',
> !
> 'libxml/entities.h',
> ! 'libxml/globals.h',
> !
> 'libxml/HTMLparser.h',
> ! 'libxml/HTMLtree.h',
> !
> 'libxml/parser.h',
> ! 'libxml/parserInternals.h',
> !
> 'libxml/pattern.h',
> ! 'libxml/relaxng.h',
> !
> 'libxml/tree.h',
> ! 'libxml/uri.h',
> !
> 'libxml/valid.h',
> ! 'libxml/xinclude.h',
> !
> 'libxml/xmlerror.h',
> ! 'libxml/xmlIO.h',
> !
> 'libxml/xmlmemory.h',
> ! 'libxml/xmlreader.h',
> !
> 'libxml/xmlregexp.h',
> ! 'libxml/xmlschemas.h',
> !
> 'libxml/xmlversion.h',
> ! 'libxml/xpath.h',
> !
> 'libxml/xpathInternals.h',
> ! ],
> ! )) {
> ! print
> "yes\n";
> ! } else {
> ! print STDERR <<"DEATH";
> ! libxml2,
> zlib, and/or the Math library (-lm) have not been found.
> ! Try
> setting LIBS and INC values on the command line
> ! Or get libxml2 from
> !
http://xmlsoft.org/
> ! If you install via RPMs, make sure you also
> install the -devel
> ! RPMs, as this is where the headers (.h files)
> are.
> !
> ! Also, you may try to run perl Makefile.PL with the DEBUG=1
> parameter
> ! to see the exact reason why the detection of libxml2
> installation
> ! failed or why Makefile.PL was not able to compile a
> test program.
> ! DEATH
> ! exit 0; # 0 recommended by
>
http://cpantest.grango.org (Notes for CPAN Authors)
> ! }
> ! }
> !
> !
> #
> --------------------------------------------------------------------------
> #
> ! # _NOW_ write the Makefile
>
> WriteMakefile(
> %INFOS,
> ***************
> *** 681,732 ****
> return $result;
> }
> - sub have_library {
> - my ($lib, $func) = (@_, "blank");
> -
> printf("checking for %s() in -l%s... ", $func, $lib) if $func ne
> "blank";
> - printf("looking for -l%s... ", $lib) if $func eq
> "blank";
> -
> - my $result;
> - if ($func) {
> - my
> $libs = $is_Win32 ? " $lib.lib " : "-l$lib";
> - # my $libs =
> "-l$lib";
> - if ($is_Win32) {
> - $result =
> try_link(<<"SRC", undef);
> - #include <windows.h>
> - #include
> <winsock.h>
> - blank() { return 0; }
> - int t() { ${func}(); return 0;
> }
> - SRC
> - unless ($result) {
> - $result
> = try_link(<<"SRC", undef);
> - #include <windows.h>
> - #include
> <winsock.h>
> - blank() { return 0; }
> - int t() { void ((*p)()); p =
> (void ((*)()))${func}; return 0; }
> - SRC
> - }
> -
> }
> - else {
> - $result = try_link(<<"SRC", undef);
> - blank() { return 0; }
> - int t() { ${func}(); return 0; }
> - SRC
> -
> }
> - }
> -
> - unless ($result) {
> - print "no\n";
> -
> return 0;
> - }
> -
> - if ($func ne "main") {
> -
> $config{DEFINE} .= uc(" -Dhave_$func");
> - }
> -
> - print
> "yes\n";
> - return 1;
> - }
> -
> #
> --------------------------------------------------------------------------
> #
> # try_libconfig class a generic config file and requests
> --version, --libs and
> # --cflags
> --- 716,721 ----
>
>
> --
> Dez.
> -----Original Message-----
> From: Shlomi Fish via RT [mailto:bug-XML-
> LibXML@rt.cpan.org]
> Sent: Tuesday, October 16, 2012 6:03 PM
> To:
> Desmond Daignault
> Subject: [rt.cpan.org #80229] Fails to create
> Makefile on windows due to include path having spaces
>
> <URL:
>
https://rt.cpan.org/Ticket/Display.html?id=80229 >
>
> Hi Desmond,
> On Tue Oct 16 16:44:49 2012, desmond.daignault@oneil.com wrote:
> > On
> Windows, check_lib_or_exit always fails. No matter what I set INC=
> >
> to be on the command line.
> >
>
> Devel::CheckLib should support
> Microsoft Visual C++ (CL.EXE) pretty well, and so you should see where
> this is going wrong and fix it. You can use perl -d (the perl
> debugger) to assist you.
>
> > When using Visual Studio, it looks at
> the environment variable INCLUDE
> > to find include headers and the
> environment variable LIB to find
> > library files.
>
> Well, UNIX
> compilers are using different variables (see the gcc man page). The
> question is which env vars CL.EXE supports.
>
> >
> > eg:
> >
> INCLUDE=C:\project\win32\install\include;C:\Program Files\Microsoft
> >
> Visual Studio 9.0\VC\ATLMFC\INCLUDE;C:\Program Files\Microsoft
> >
> Visual Studio 9.0\VC\INCLUDE;C:\Program Files\\Microsoft
> >
> SDKs\Windows\v6.0A\include;
> >
> LIB=C:\project\win32\install\lib;C:\Program Files\Microsoft Visual
> >
> Studio 9.0\VC\ATLMFC\LIB;C:\Program Files\Microsoft Visual Studio
> >
> 9.0\VC\LIB;C:\P
> > rogram Files\\Microsoft SDKs\Windows\v6.0A\lib;
> >
> > In the example above, the libxml2 library was installed in
> >
> c:\project\win32\install\lib and c:\project\win32\install\include.
> >
> > If I remove the check_lib_or_exit function from Makefile.PL it
> builds
> > just fine when the environment has INCLUDE and LIB set
> correctly.
> >
> > Additionally a warning can be removed when checking
> to see if LIBS was
> > passed on the command line.
> >
>
> the
> check_lib_or_exit call was added to prevent cases where the shared
> library can be found, but the headers cannot be found, which makes the
> build fails later. I'd rather not avoid it anywhere.
>
> >
> > patch
> follows:
> >
>
> The patch has two issues:
>
> 1. It is not in unified
> format - use diff -u next time (you can also send us a bitbucket pull
> request).
>
> 2. The second is:
>
> >
> >
> **********************************************************************
> > Confidentiality Notice
> > The information contained in this e-mail
> is confidential and intended
> > for use only by the person(s) or
> organization listed in the
> > address. If you have received this
> communication in error, please
> > contact the sender at O'Neil &
> Associates, Inc., immediately. Any
> > copying, dissemination, or
> distribution of this communication,
> > other than by the intended
> recipient, is strictly prohibited.
> >
> **********************************************************************
> >
>
> this disclaimer prevents us from using the patch for our FOSS
> project.
>
> Regards,
>
> -- Shlomi Fish