summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlessandro Ghedini <alessandro@ghedini.me>2013-12-30 16:30:30 +0100
committerwm4 <wm4@nowhere>2014-01-01 20:57:06 +0100
commit773db053aabfddb72134a363ecb31c1dac0b8c75 (patch)
treeec2e0439fcc73ebbb22d6f1d81bc31565b8e8ef1
parenta8c09d003f3a9d6e00c03fbfa19e0271fcb05d88 (diff)
downloadmpv-773db053aabfddb72134a363ecb31c1dac0b8c75.tar.bz2
mpv-773db053aabfddb72134a363ecb31c1dac0b8c75.tar.xz
build: check for libatomic and __atomic operations
Add check in old-configure as well. Reformat the check to use a maximum of 80 columns in the wscript. Signed-off-by: Stefano Pigozzi <stefano.pigozzi@gmail.com>
-rwxr-xr-xold-configure16
-rw-r--r--wscript7
2 files changed, 23 insertions, 0 deletions
diff --git a/old-configure b/old-configure
index 5a7f1880d7..34c553695b 100755
--- a/old-configure
+++ b/old-configure
@@ -1329,6 +1329,21 @@ if test "$_pthreads" = no ; then
die "Unable to find pthreads support."
fi
+
+echocheck "compiler support for __atomic built-ins"
+_atomic=no
+for _ld_tmp in "" "-latomic" ; do
+ statement_check stdint.h 'int64_t test = 0; test = __atomic_add_fetch(&test, 1, __ATOMIC_SEQ_CST)' $_ld_tmp &&
+ libs_mplayer="$libs_mplayer $_ld_tmp" && _atomic=yes && break
+done
+if test "$_atomic" = yes ; then
+ def_atomic="#define HAVE_ATOMIC_BUILTINS 1"
+else
+ def_atomic="#define HAVE_ATOMIC_BUILTINS 0"
+fi
+echores "$_atomic"
+
+
if test "$_pthreads" = yes ; then
# Cargo-cult for -lrt, which is needed on not so recent glibc version for
@@ -3521,6 +3536,7 @@ $def_avresample_has_set_channel_mapping
$def_fast_64bit
$def_pthreads
+$def_atomic
#define HAVE_INLINE_ASM 1
diff --git a/wscript b/wscript
index 0e23e57560..7a6ee4fb02 100644
--- a/wscript
+++ b/wscript
@@ -99,6 +99,13 @@ main_dependencies = [
'req': True,
'fmsg': 'Unable to find pthreads support.'
}, {
+ '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': 'librt',
'desc': 'linking with -lrt',
'deps': [ 'pthreads' ],