fixed bug #1370179 - endianness problem with FIX_ENDIAN_INT32_INPLACE
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@4444 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
2822e9a3ab
commit
47b2ca9bcb
1 changed files with 30 additions and 0 deletions
|
@ -210,6 +210,36 @@ if conf.CheckPThread():
|
|||
makensis_env.Append(LINKFLAGS = '-pthread')
|
||||
conf.Finish()
|
||||
|
||||
#
|
||||
# GCC doesn't define __BIG_ENDIAN__ or __LITTLE_ENDIAN__, so manually check
|
||||
# for the endianess and define __BIG_ENDIAN__ if needed.
|
||||
#
|
||||
|
||||
def check_big_endian(ctx):
|
||||
ctx.Message('Checking for __BIG_ENDIAN__... ')
|
||||
|
||||
test = """
|
||||
int main() {
|
||||
#ifdef __BIG_ENDIAN__
|
||||
// already defined, no need to define again
|
||||
return 0;
|
||||
#else
|
||||
int i = 1;
|
||||
char *c = (char *) &i;
|
||||
return c[0] != 1;
|
||||
#endif
|
||||
}
|
||||
"""
|
||||
|
||||
result = not ctx.TryRun(test, '.c')[0]
|
||||
ctx.Result(result)
|
||||
return result
|
||||
|
||||
conf = defenv.Configure(custom_tests = { 'CheckBigEndian' : check_big_endian })
|
||||
if conf.CheckBigEndian():
|
||||
makensis_env.Append(CPPFLAGS = ['__BIG_ENDIAN__'])
|
||||
conf.Finish()
|
||||
|
||||
### return
|
||||
|
||||
Return('stub_env makensis_env plugin_env util_env cp_util_env')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue