Hi Bruno.

The javaversion module includes configmake.h, which typically contains
something like:

#define DATADIR "/usr/local/share"

This does not work well under mingw, because Windows has a data type
called DATADIR, see:

http://msdn.microsoft.com/en-us/library/ms680661(VS.85).aspx

It is defined in objidl.h as:

typedef enum tagDATADIR 
{ 
    DATADIR_GET            = 1, 
    DATADIR_SET            = 2 
} DATADIR; 

Compiling javaversion.c, you'll get warnings like:

In file included from 
/usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/../../../../i586-mingw32msvc/include/objbase.h:73,
                 from 
/usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/../../../../i586-mingw32msvc/include/ole2.h:9,
                 from 
/usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/../../../../i586-mingw32msvc/include/windows.h:114,
                 from 
/usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/../../../../i586-mingw32msvc/include/winsock2.h:22,
                 from ./unistd.h:49,
                 from ./getopt.h:37,
                 from 
/usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/../../../../i586-mingw32msvc/include/unistd.h:14,
                 from ./unistd.h:27,
                 from pipe.h:23,
                 from javaversion.c:37:
/usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/../../../../i586-mingw32msvc/include/objidl.h:95:
 error: expected identifier or ‘(’ before string constant

Comparing this with the localcharset module, which also uses
configmake.h, it seems configmake.h is included later, which doesn't
trigger the problem.  The patch below works around the problem in
javaversion.c too.

Possibly we could also just remove the DATADIR definition from
configmake.h.

/Simon

diff --git a/lib/javaversion.c b/lib/javaversion.c
index 003919e..4098966 100644
--- a/lib/javaversion.c
+++ b/lib/javaversion.c
@@ -30,15 +30,15 @@
 # define relocate(pathname) (pathname)
 #endif
 
-/* Get PKGDATADIR.  */
-#include "configmake.h"
-
 #include "javaexec.h"
 #include "pipe.h"
 #include "wait-process.h"
 #include "error.h"
 #include "gettext.h"
 
+/* Get PKGDATADIR.  */
+#include "configmake.h"
+
 #define _(str) gettext (str)
 
 


Reply via email to