summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMarcel Hollerbach <mail@marcel-hollerbach.de>2019-05-21 12:28:47 -0400
committerMike Blumenkrantz <zmike@samsung.com>2019-05-21 12:28:47 -0400
commit1f0ae2e349b7fba7ca12c492cd451391eb0ced14 (patch)
tree74ca97c9e46411d7159f906f952992ab47941b55 /src
parent5ea0195661e88395ee3e7384db7acc3f03d52dc1 (diff)
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
Diffstat (limited to 'src')
-rw-r--r--src/lib/eina/eina_config.h.in20
-rw-r--r--src/lib/eina/eina_inline_cpu.x10
-rw-r--r--src/lib/eina/meson.build12
3 files changed, 18 insertions, 24 deletions
diff --git a/src/lib/eina/eina_config.h.in b/src/lib/eina/eina_config.h.in
index c040cc5341..7f81542a36 100644
--- a/src/lib/eina/eina_config.h.in
+++ b/src/lib/eina/eina_config.h.in
@@ -23,6 +23,14 @@
23# include <Exotic.h> 23# include <Exotic.h>
24#endif 24#endif
25 25
26#ifdef __has_builtin
27# define EINA_HAS_BUILTIN(x) __has_builtin(x)
28#elif (defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)))
29# define EINA_HAS_BUILTIN(x) 1
30#else
31# define EINA_HAS_BUILTIN(x) 0 // Compatibility for the rest of the world
32#endif
33
26#ifdef EINA_MAGIC_DEBUG 34#ifdef EINA_MAGIC_DEBUG
27# undef EINA_MAGIC_DEBUG 35# undef EINA_MAGIC_DEBUG
28#endif 36#endif
@@ -90,17 +98,23 @@
90#ifdef EINA_HAVE_BSWAP16 98#ifdef EINA_HAVE_BSWAP16
91# undef EINA_HAVE_BSWAP16 99# undef EINA_HAVE_BSWAP16
92#endif 100#endif
93@EINA_CONFIGURE_HAVE_BSWAP16@ 101#if EINA_HAS_BUILTIN(__builtin_bswap16)
102# define EINA_HAVE_BSWAP16
103#endif
94 104
95#ifdef EINA_HAVE_BSWAP32 105#ifdef EINA_HAVE_BSWAP32
96# undef EINA_HAVE_BSWAP32 106# undef EINA_HAVE_BSWAP32
97#endif 107#endif
98@EINA_CONFIGURE_HAVE_BSWAP32@ 108#if EINA_HAS_BUILTIN(__builtin_bswap32)
109# define EINA_HAVE_BSWAP32
110#endif
99 111
100#ifdef EINA_HAVE_BSWAP64 112#ifdef EINA_HAVE_BSWAP64
101# undef EINA_HAVE_BSWAP64 113# undef EINA_HAVE_BSWAP64
102#endif 114#endif
103@EINA_CONFIGURE_HAVE_BSWAP64@ 115#if EINA_HAS_BUILTIN(__builtin_bswap64)
116# define EINA_HAVE_BSWAP64
117#endif
104 118
105#ifdef EINA_HAVE_BYTESWAP_H 119#ifdef EINA_HAVE_BYTESWAP_H
106# undef EINA_HAVE_BYTESWAP_H 120# undef EINA_HAVE_BYTESWAP_H
diff --git a/src/lib/eina/eina_inline_cpu.x b/src/lib/eina/eina_inline_cpu.x
index d26bdcce7c..035e5b188b 100644
--- a/src/lib/eina/eina_inline_cpu.x
+++ b/src/lib/eina/eina_inline_cpu.x
@@ -27,18 +27,10 @@
27# include <byteswap.h> 27# include <byteswap.h>
28#endif 28#endif
29 29
30#ifdef __has_builtin
31# define EINA_HAS_BUILTIN(x) __has_builtin(x)
32#elif (defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)))
33# define EINA_HAS_BUILTIN(x) 1
34#else
35# define EINA_HAS_BUILTIN(x) 0 // Compatibility for the rest of the world
36#endif
37
38static inline unsigned short 30static inline unsigned short
39eina_swap16(unsigned short x) 31eina_swap16(unsigned short x)
40{ 32{
41#if defined EINA_HAVE_BSWAP16 && EINA_HAS_BUILTIN(__builtin_bswap16) 33#if defined EINA_HAVE_BSWAP16
42 return __builtin_bswap16(x); 34 return __builtin_bswap16(x);
43#elif defined _MSC_VER /* Windows. Apparently in <stdlib.h>. */ 35#elif defined _MSC_VER /* Windows. Apparently in <stdlib.h>. */
44 return _byteswap_ushort(x); 36 return _byteswap_ushort(x);
diff --git a/src/lib/eina/meson.build b/src/lib/eina/meson.build
index bfb484e877..e4bce4fc96 100644
--- a/src/lib/eina/meson.build
+++ b/src/lib/eina/meson.build
@@ -326,18 +326,6 @@ if cc.has_header('byteswap.h')
326 eina_config.set('EINA_HAVE_BYTESWAP_H', '1') 326 eina_config.set('EINA_HAVE_BYTESWAP_H', '1')
327endif 327endif
328 328
329if cc.has_header_symbol('byteswap.h', 'bswap_16')
330 eina_config.set('EINA_HAVE_BSWAP16', '1')
331endif
332
333if cc.has_header_symbol('byteswap.h', 'bswap_32')
334 eina_config.set('EINA_HAVE_BSWAP32', '1')
335endif
336
337if cc.has_header_symbol('byteswap.h', 'bswap_64')
338 eina_config.set('EINA_HAVE_BSWAP64', '1')
339endif
340
341if cc.has_header_symbol('pthread.h', 'pthread_spin_init') 329if cc.has_header_symbol('pthread.h', 'pthread_spin_init')
342 eina_config.set('EINA_HAVE_POSIX_SPINLOCK', '1') 330 eina_config.set('EINA_HAVE_POSIX_SPINLOCK', '1')
343endif 331endif