]> git.sesse.net Git - ffmpeg/commitdiff
configure: prettify atomics handling.
authorAnton Khirnov <anton@khirnov.net>
Wed, 27 Mar 2013 18:26:19 +0000 (19:26 +0100)
committerAnton Khirnov <anton@khirnov.net>
Wed, 3 Apr 2013 07:22:31 +0000 (09:22 +0200)
Add simpler names and a shorthand for native atomics (as opposed to
pthreads fallback).

configure
libavutil/Makefile
libavutil/atomic.c
libavutil/atomic.h

index 1326c448efcc10fabca4784f7a765c369fba9cf8..7f77b007e6760748b4e34c935b0cc18260c0bff4 100755 (executable)
--- a/configure
+++ b/configure
@@ -1122,6 +1122,12 @@ THREADS_LIST='
     w32threads
 '
 
+ATOMICS_LIST='
+    atomics_gcc
+    atomics_win32
+    atomics_suncc
+'
+
 ARCH_LIST='
     aarch64
     alpha
@@ -1226,6 +1232,7 @@ HAVE_LIST="
     $HAVE_LIST_CMDLINE
     $HAVE_LIST_PUB
     $THREADS_LIST
+    $ATOMICS_LIST
     $MATH_FUNCS
     aligned_malloc
     aligned_stack
@@ -1234,6 +1241,7 @@ HAVE_LIST="
     arpa_inet_h
     asm_mod_q
     asm_mod_y
+    atomics_native
     attribute_may_alias
     attribute_packed
     cdio_paranoia_h
@@ -3528,6 +3536,10 @@ for thread in $THREADS_LIST; do
     fi
 done
 
+enabled sync_val_compare_and_swap && enable atomics_gcc
+enabled machine_rw_barrier && enable atomics_suncc
+enabled MemoryBarrier && enable atomics_win32
+
 check_lib math.h sin -lm && LIBM="-lm"
 enabled vaapi && require vaapi va/va.h vaInitialize -lva
 
@@ -3791,6 +3803,7 @@ case $target_os in
 esac
 
 enabled_any $THREADS_LIST      && enable threads
+enabled_any $ATOMICS_LIST      && enable atomics_native
 
 enabled asm || { arch=c; disable $ARCH_LIST $ARCH_EXT_LIST; }
 
index 68a8386751d4260060e2948bd8b7783acfc4ec47..8a7e680ab3df33daf1e9891f545216c3e17e02d9 100644 (file)
@@ -103,9 +103,9 @@ OBJS += $(COMPAT_OBJS:%=../compat/%)
 
 SKIPHEADERS          = old_pix_fmts.h
 
-SKIPHEADERS-$(HAVE_MACHINE_RW_BARRIER)          += atomic_suncc.h
-SKIPHEADERS-$(HAVE_MEMORYBARRIER)               += atomic_win32.h
-SKIPHEADERS-$(HAVE_SYNC_VAL_COMPARE_AND_SWAP)   += atomic_gcc.h
+SKIPHEADERS-$(HAVE_ATOMICS_SUNCC)      += atomic_suncc.h
+SKIPHEADERS-$(HAVE_ATOMICS_WIN32)      += atomic_win32.h
+SKIPHEADERS-$(HAVE_ATOMICS_GCC)        += atomic_gcc.h
 
 TESTPROGS = adler32                                                     \
             aes                                                         \
index 37e796f05fe110bb13f893bf5d604a1a0db902d1..add489a26e724c979a4629b0b48d0117e5aa2620 100644 (file)
@@ -20,7 +20,7 @@
 
 #include "atomic.h"
 
-#if !HAVE_MEMORYBARRIER && !HAVE_SYNC_VAL_COMPARE_AND_SWAP && !HAVE_MACHINE_RW_BARRIER
+#if !HAVE_ATOMICS_NATIVE
 
 #if HAVE_PTHREADS
 
index 773c5df1bd8e1f1774c3328bfd637e0ac0e8ceb3..a5c5fe86bf9690107a800648d1e84eab7e65fe3a 100644 (file)
 
 #include "config.h"
 
-#if HAVE_SYNC_VAL_COMPARE_AND_SWAP
+#if HAVE_ATOMICS_GCC
 #include "atomic_gcc.h"
-#elif HAVE_MEMORYBARRIER
+#elif HAVE_ATOMICS_WIN32
 #include "atomic_win32.h"
-#elif HAVE_MACHINE_RW_BARRIER
+#elif HAVE_ATOMICS_SUNCC
 #include "atomic_suncc.h"
 #else