DescriptionFixes for cross-compilation to x86_64-w64-mingw32
1) Include config.hh before cmath
Recently commit 7396a28bde ("Add enabling extension definitions for
`-std=c++11` option") added a few #defines to config.hh to make POSIX
extensions available. Make sure that they are pulled in from config.hh
before cmath is included.
2) Improve cast from pointer to integer
When cross-compiling to x86_64-w64-mingw32, 'long' (32 bit) is smaller
than 'void *' (64 bit). This leads to compiler errors because the cast
truncates. After analysis I think that truncation is actually ok here,
so make this explicit by first casting to a suitable integer and then
truncate to long.
Note that 'suitable integer' is quite a mess: Ideally we would use
intptr_t, but it's optional per the C++ standard. So instead rely on
intmax_t and hope that it works.
3) Use host triple when looking for windres
--host=host-type
the type of system on which the package runs. [...]
The $target variable is meant for compilers. However, it is still needed
for compatibility with GUB / i686-mingw32.
4) Rename DATADIR to CONFIG_DATADIR
The header objidl.h from mingw has an enum called DATADIR. This
conflicts with our definition and results in compilation errors
because the preprocessor replaces the enum name with the configured
string. This is apparently dealt with in mingw-compatibility.hh,
but not in the configure checks. As a result, they return the wrong
answer which leads to further compilation errors down the road.
Patch Set 1 #
Total comments: 3
Patch Set 2 : add FIXME wrt truncation #Patch Set 3 : Rename DATADIR to CONFIG_DATADIR #Patch Set 4 : Use config.hh #Patch Set 5 : fixes for GUB #
MessagesTotal messages: 13
|