forked from enlightenment/efl
eina: move builtin detection to eina_config.h
Summary: this means we don't need to handle this in the buildtool at all. Reviewers: vtorri, zmike Reviewed By: zmike Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D8553
This commit is contained in:
parent
5ea0195661
commit
1f0ae2e349
|
@ -23,6 +23,14 @@
|
||||||
# include <Exotic.h>
|
# include <Exotic.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __has_builtin
|
||||||
|
# define EINA_HAS_BUILTIN(x) __has_builtin(x)
|
||||||
|
#elif (defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)))
|
||||||
|
# define EINA_HAS_BUILTIN(x) 1
|
||||||
|
#else
|
||||||
|
# define EINA_HAS_BUILTIN(x) 0 // Compatibility for the rest of the world
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef EINA_MAGIC_DEBUG
|
#ifdef EINA_MAGIC_DEBUG
|
||||||
# undef EINA_MAGIC_DEBUG
|
# undef EINA_MAGIC_DEBUG
|
||||||
#endif
|
#endif
|
||||||
|
@ -90,17 +98,23 @@
|
||||||
#ifdef EINA_HAVE_BSWAP16
|
#ifdef EINA_HAVE_BSWAP16
|
||||||
# undef EINA_HAVE_BSWAP16
|
# undef EINA_HAVE_BSWAP16
|
||||||
#endif
|
#endif
|
||||||
@EINA_CONFIGURE_HAVE_BSWAP16@
|
#if EINA_HAS_BUILTIN(__builtin_bswap16)
|
||||||
|
# define EINA_HAVE_BSWAP16
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef EINA_HAVE_BSWAP32
|
#ifdef EINA_HAVE_BSWAP32
|
||||||
# undef EINA_HAVE_BSWAP32
|
# undef EINA_HAVE_BSWAP32
|
||||||
#endif
|
#endif
|
||||||
@EINA_CONFIGURE_HAVE_BSWAP32@
|
#if EINA_HAS_BUILTIN(__builtin_bswap32)
|
||||||
|
# define EINA_HAVE_BSWAP32
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef EINA_HAVE_BSWAP64
|
#ifdef EINA_HAVE_BSWAP64
|
||||||
# undef EINA_HAVE_BSWAP64
|
# undef EINA_HAVE_BSWAP64
|
||||||
#endif
|
#endif
|
||||||
@EINA_CONFIGURE_HAVE_BSWAP64@
|
#if EINA_HAS_BUILTIN(__builtin_bswap64)
|
||||||
|
# define EINA_HAVE_BSWAP64
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef EINA_HAVE_BYTESWAP_H
|
#ifdef EINA_HAVE_BYTESWAP_H
|
||||||
# undef EINA_HAVE_BYTESWAP_H
|
# undef EINA_HAVE_BYTESWAP_H
|
||||||
|
|
|
@ -27,18 +27,10 @@
|
||||||
# include <byteswap.h>
|
# include <byteswap.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __has_builtin
|
|
||||||
# define EINA_HAS_BUILTIN(x) __has_builtin(x)
|
|
||||||
#elif (defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)))
|
|
||||||
# define EINA_HAS_BUILTIN(x) 1
|
|
||||||
#else
|
|
||||||
# define EINA_HAS_BUILTIN(x) 0 // Compatibility for the rest of the world
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static inline unsigned short
|
static inline unsigned short
|
||||||
eina_swap16(unsigned short x)
|
eina_swap16(unsigned short x)
|
||||||
{
|
{
|
||||||
#if defined EINA_HAVE_BSWAP16 && EINA_HAS_BUILTIN(__builtin_bswap16)
|
#if defined EINA_HAVE_BSWAP16
|
||||||
return __builtin_bswap16(x);
|
return __builtin_bswap16(x);
|
||||||
#elif defined _MSC_VER /* Windows. Apparently in <stdlib.h>. */
|
#elif defined _MSC_VER /* Windows. Apparently in <stdlib.h>. */
|
||||||
return _byteswap_ushort(x);
|
return _byteswap_ushort(x);
|
||||||
|
|
|
@ -326,18 +326,6 @@ if cc.has_header('byteswap.h')
|
||||||
eina_config.set('EINA_HAVE_BYTESWAP_H', '1')
|
eina_config.set('EINA_HAVE_BYTESWAP_H', '1')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if cc.has_header_symbol('byteswap.h', 'bswap_16')
|
|
||||||
eina_config.set('EINA_HAVE_BSWAP16', '1')
|
|
||||||
endif
|
|
||||||
|
|
||||||
if cc.has_header_symbol('byteswap.h', 'bswap_32')
|
|
||||||
eina_config.set('EINA_HAVE_BSWAP32', '1')
|
|
||||||
endif
|
|
||||||
|
|
||||||
if cc.has_header_symbol('byteswap.h', 'bswap_64')
|
|
||||||
eina_config.set('EINA_HAVE_BSWAP64', '1')
|
|
||||||
endif
|
|
||||||
|
|
||||||
if cc.has_header_symbol('pthread.h', 'pthread_spin_init')
|
if cc.has_header_symbol('pthread.h', 'pthread_spin_init')
|
||||||
eina_config.set('EINA_HAVE_POSIX_SPINLOCK', '1')
|
eina_config.set('EINA_HAVE_POSIX_SPINLOCK', '1')
|
||||||
endif
|
endif
|
||||||
|
|
Loading…
Reference in New Issue