Ruby wstring - only include endian.h on linux
This file is not always available on other systems. See #1801
This commit is contained in:
parent
034a6d54ee
commit
58ffbe616f
1 changed files with 13 additions and 2 deletions
|
|
@ -1,4 +1,15 @@
|
|||
%{
|
||||
#if defined(__linux__)
|
||||
#include <endian.h>
|
||||
#if BYTE_ORDER == LITTLE_ENDIAN
|
||||
#define SWIG_RUBY_ENDIAN "LE"
|
||||
#elif BYTE_ORDER == BIG_ENDIAN
|
||||
#define SWIG_RUBY_ENDIAN "BE"
|
||||
#endif
|
||||
#else
|
||||
#define SWIG_RUBY_ENDIAN "LE"
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
|
@ -15,9 +26,9 @@ extern "C" {
|
|||
#ifndef SWIG_RUBY_WSTRING_ENCODING
|
||||
|
||||
#if WCHAR_MAX == 0x7fff || WCHAR_MAX == 0xffff
|
||||
#define SWIG_RUBY_WSTRING_ENCODING "UTF-16LE"
|
||||
#define SWIG_RUBY_WSTRING_ENCODING "UTF-16" SWIG_RUBY_ENDIAN
|
||||
#elif WCHAR_MAX == 0x7fffffff || WCHAR_MAX == 0xffffffff
|
||||
#define SWIG_RUBY_WSTRING_ENCODING "UTF-32LE"
|
||||
#define SWIG_RUBY_WSTRING_ENCODING "UTF-32" SWIG_RUBY_ENDIAN
|
||||
#else
|
||||
#error unsupported wchar_t size. SWIG_RUBY_WSTRING_ENCODING must be given.
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue