GNOME Bugzilla – Bug 56531
win32 compilation fixes
Last modified: 2009-08-15 18:40:50 UTC
Changes to compile under windows: * in numbers.c do the same protection agains duplicate definition of isnan () and isinf() as is in libxml\xpath.c * in xsltconfig.h the same trick as in libxml to include either win32config.h (from libxml) or config.h * in xsltproc.c needs to define gettimeofday() and include winsock2.h, the same code as in xmllint.c * add MSVC project files (*dsp, *dsw, *def). Those assume that libxml is in sibling to libxslt directory called gnome-xml. For different layouts path will have to be changed manually. I've tested this patch by doing clean checkout out of CVS, applying patches, ./autogen.sh, copying files to win machine and compiling. I've also compiled under RedHat Linux 6.2 To fully work they require my other patches for libxml to compile under Win and expose all necessary symbols that libxslt uses. I've put both patch and project files (too big to include inline) here: http://acs-misc.sourceforge.net/wiki/index.php?PatchForLibxslt I can also e-mail them. Patch is as follows: Index: libxslt/numbers.c =================================================================== RCS file: /cvs/gnome/libxslt/libxslt/numbers.c,v retrieving revision 1.17 diff -u -r1.17 numbers.c --- libxslt/numbers.c 2001/06/21 22:13:02 1.17 +++ libxslt/numbers.c 2001/06/22 11:15:57 @@ -83,7 +83,9 @@ } } -#ifndef isnan +#ifndef isnan +#ifndef HAVE_ISNAN + /* * NaN (Not-A-Number) * @@ -101,9 +103,11 @@ { return (!(number < 0.0 || number > 0.0) && (number != 0.0)); } -#endif +#endif /* !HAVE_ISNAN */ +#endif /* !isnan */ -#ifndef isinf +#ifndef isinf +#ifndef HAVE_ISINF /* * Infinity (positive and negative) * @@ -118,7 +122,8 @@ return FALSE; # endif } -#endif +#endif /* !HAVE_ISINF */ +#endif /* !isinf */ static void xsltNumberFormatDecimal(xmlBufferPtr buffer, Index: libxslt/xsltconfig.h.in =================================================================== RCS file: /cvs/gnome/libxslt/libxslt/xsltconfig.h.in,v retrieving revision 1.7 diff -u -r1.7 xsltconfig.h.in --- libxslt/xsltconfig.h.in 2001/06/17 11:25:09 1.7 +++ libxslt/xsltconfig.h.in 2001/06/22 11:12:30 @@ -9,7 +9,11 @@ #ifndef __XML_XSLTCONFIG_H__ #define __XML_XSLTCONFIG_H__ +#ifdef WIN32 +#include <win32config.h> +#else #include "config.h" +#endif #ifdef __cplusplus extern "C" { Index: libxslt/xsltproc.c =================================================================== RCS file: /cvs/gnome/libxslt/libxslt/xsltproc.c,v retrieving revision 1.32 diff -u -r1.32 xsltproc.c --- libxslt/xsltproc.c 2001/06/17 11:25:09 1.32 +++ libxslt/xsltproc.c 2001/06/22 11:13:57 @@ -37,6 +37,16 @@ #include <libxslt/xsltInternals.h> #include <libxslt/transform.h> #include <libxslt/xsltutils.h> + +#ifdef WIN32 +#ifdef _MSC_VER +#include <winsock2.h> +#pragma comment(lib, "ws2_32.lib") +#define gettimeofday(p1,p2) +#endif /* _MS_VER */ +#else /* WIN32 */ +#include <sys/time.h> +#endif /* WIN32 */ extern int xmlLoadExtDtdDefaultValue;
Okay applied. i just removed a few ^M added when patching the files on Windows and created a new libxslt/win32config.h dedicated to libxslt. I added the new resources to the Makefiles but didn't checked yet the result when building a new distribution. thanks a lot for your contribution, Daniel
I just checked out fresh libxslt copy from CVS and win32 directory with project files isn't there (despite the comment in Changelog that says it has been added). Also, could you generate xsltconfig.h for the same reason as xmlversion.h in libxml, i.e., you can't compile under windows without having this file and it's not possible to generate this file under win (without using cygwin).
I have tried to fix the last reported problems. it should have propagated in anoncvs now and is also in the latest release. Please reopen the bug if this is not the case, thanks, Daniel
It's almost there but still needs a few fixes. Basically, a xsltconfig.h needs to be generated for Win (like xmlwin32version.h in libxml; I guess it would be named xsltwin32config.h). Then places that include xsltconfig.h would have to be modified to #ifdef _MSC_VER #include "xsltwin32config.h" #else #include "xsltconfig.h" #endif Also, in a few places <libxml/xmlversion.h> is included. All those places need also be wrapped with: #ifdef _MSC_VER #include <libxml/xmlwin32version.h> #else #include <libxml/xmlversion.h> #endif
Okay i have done something along those lines, creating a new windows config file, and encapsilating all call to configs from a single libxslt.h (like for libxml), I hope this will fix the problem, Daniel
Okay this too should be closed in last release, Daniel