mirror of
https://github.com/mpv-player/mpv
synced 2024-12-22 23:02:37 +00:00
build: make configure fail if both __atomic and __sync are not available
This commit is contained in:
parent
faf68f3b8e
commit
e568299c2c
@ -24,7 +24,9 @@
|
||||
#if HAVE_ATOMIC_BUILTINS
|
||||
# define mp_memory_barrier() __atomic_thread_fence(__ATOMIC_SEQ_CST)
|
||||
# define mp_atomic_add_and_fetch(a, b) __atomic_add_fetch(a, b,__ATOMIC_SEQ_CST)
|
||||
#else
|
||||
#elif HAVE_SYNC_BUILTINS
|
||||
# define mp_memory_barrier() __sync_synchronize()
|
||||
# define mp_atomic_add_and_fetch(a, b) __sync_add_and_fetch(a, b)
|
||||
#else
|
||||
# error "this should have been a configuration error, report a bug please"
|
||||
#endif
|
||||
|
@ -1343,6 +1343,23 @@ else
|
||||
fi
|
||||
echores "$_atomic"
|
||||
|
||||
if test "$_atomic" = no ; then
|
||||
echocheck "compiler support for __sync built-ins"
|
||||
_sync=no
|
||||
statement_check stdint.h 'int64_t test = 0; test = __sync_add_and_fetch(&test, 1)' && _sync=yes
|
||||
if test "$_sync" = yes ; then
|
||||
def_sync="#define HAVE_SYNC_BUILTINS 1"
|
||||
else
|
||||
def_sync="#define HAVE_SYNC_BUILTINS 0"
|
||||
fi
|
||||
echores "$_sync"
|
||||
else
|
||||
def_sync="#define HAVE_SYNC_BUILTINS 0"
|
||||
fi
|
||||
|
||||
if test "$_atomic" = no && test "$_sync" = no ; then
|
||||
die "your compiler must support either __atomic or __aync bult-ins."
|
||||
fi
|
||||
|
||||
if test "$_pthreads" = yes ; then
|
||||
|
||||
@ -3537,6 +3554,7 @@ $def_avresample_has_set_channel_mapping
|
||||
$def_fast_64bit
|
||||
$def_pthreads
|
||||
$def_atomic
|
||||
$def_sync
|
||||
|
||||
#define HAVE_INLINE_ASM 1
|
||||
|
||||
|
18
wscript
18
wscript
@ -77,7 +77,7 @@ main_dependencies = [
|
||||
'desc': 'linker support for --nxcompat --no-seh --dynamicbase',
|
||||
'func': check_cc(linkflags=['-Wl,--nxcompat', '-Wl,--no-seh', '-Wl,--dynamicbase'])
|
||||
}, {
|
||||
'name': 'ebx_available',
|
||||
'name': 'ebx-available',
|
||||
'desc': 'ebx availability',
|
||||
'func': check_cc(fragment=load_fragment('ebx.c'))
|
||||
} , {
|
||||
@ -99,12 +99,26 @@ main_dependencies = [
|
||||
'req': True,
|
||||
'fmsg': 'Unable to find pthreads support.'
|
||||
}, {
|
||||
'name': 'atomic_builtins',
|
||||
'name': 'atomic-builtins',
|
||||
'desc': 'compiler support for __atomic built-ins',
|
||||
'func': check_libs(['atomic'],
|
||||
check_statement('stdint.h',
|
||||
'int64_t test = 0;'
|
||||
'test = __atomic_add_fetch(&test, 1, __ATOMIC_SEQ_CST)'))
|
||||
}, {
|
||||
'name': 'sync-builtins',
|
||||
'desc': 'compiler support for __sync built-ins',
|
||||
'func': check_statement('stdint.h',
|
||||
'int64_t test = 0;'
|
||||
'test = __sync_add_and_fetch(&test, 1)'),
|
||||
'deps_neg': [ 'atomic-builtins' ],
|
||||
}, {
|
||||
'name': 'thread-synchronization-builtins',
|
||||
'desc': 'compiler support for usable thread synchronization built-ins',
|
||||
'func': check_true,
|
||||
'deps_any': ['atomic-builtins', 'sync-builtins'],
|
||||
'req': True,
|
||||
'fmsg': 'your compiler must support either __atomic or __aync bult-ins',
|
||||
}, {
|
||||
'name': 'librt',
|
||||
'desc': 'linking with -lrt',
|
||||
|
Loading…
Reference in New Issue
Block a user