On 2010-06-17 17:13-0400 Mike Kaplinskiy wrote:
On Thu, Jun 17, 2010 at 4:56 PM, Alan W. Irwin irwin@beluga.phys.uvic.ca wrote:
According to some old discussion (http://www.mail-archive.com/wine-devel@winehq.com/msg15669.html) on wine-devel it appears that __WINE__ was going to be the macro used to identify the Wine platform,
[...]
Is the lack of a macro to identify the wine platform a bug I should report or am I missing something?
You're compiling _under_ wine, and since wine attempts to be windows, gcc will think you're on windows. If you want to compile a winelib program/dll (i.e. a dll built specifically for wine and not windows) you use winegcc which defines __WINE__. winegcc -E -dM foo.c should contain #define __WINE__ 1.
On 2010-06-17 21:30-0000 Hin-Tak Leung wrote:
You seems to have made one mistake - it is "winegcc", (without space) not
"wine gcc". winegcc does define __WINE__ .
To Mike and Hin-Tak:
As alluded to by Mike, what I am doing is building software under wine using the Windows versions of MinGW, CMake, and MinGW make. I was aware of __WINE__ being defined for winegcc, but from the man page it appears to me that winegcc is a cross-compiler which is a technique I want to avoid. Note, that cmake configures MinGW make not only to build applications but also to test them. You cannot do the test part with just a cross compiler, and although I think it may be technically possible with CMake, it appears somewhat complicated to me to cross-compile from Linux to wine using Linux CMake, and then switch to the Wine platform for testing of the result using Windows CMake. Anyhow, to keep my build and test life simple, I just want to do everything on Wine. Furthermore, I would like to be free to choose any of the large variety of different versions of MinGW compilers. These considerations appear to rule out winegcc as a _general_ solution to the platform identification issue for those building software on Wine.
I take Mike's point that currently Wine mimics Microsoft Windows so well that MinGW gcc thinks it is building on Microsoft Windows. In fact, that is an excellent statement of the problem. Because it is so useful to distinguish platforms when building software (the excellent motivation for this, e.g., to work around Wine bugs, is discussed in the mailing-list thread referenced above), I hope a general solution can be found for this problem.
I am not familiar at all with run-time configuration of compilers, but my understanding is that compilers must be quite flexible about such configuration. Thus, is there not some standard means that could be used for wine to tell the various MinGW compilers built on Microsoft Windows but run under wine to always #define __WINE__?
Alan __________________________ Alan W. Irwin
Astronomical research affiliation with Department of Physics and Astronomy, University of Victoria (astrowww.phys.uvic.ca).
Programming affiliations with the FreeEOS equation-of-state implementation for stellar interiors (freeeos.sf.net); PLplot scientific plotting software package (plplot.org); the libLASi project (unifont.org/lasi); the Loads of Linux Links project (loll.sf.net); and the Linux Brochure Project (lbproject.sf.net). __________________________
Linux-powered Science __________________________