[vlc-devel] [PATCH] configure: check the C compiler needs -latomic to support atomics

Rémi Denis-Courmont remi at remlab.net
Mon Jan 13 15:12:28 CET 2020


Hi,

Most likely that library should only be linked in some target binaries, otherwise packaging system will whine. Same as thread and socket stuff.

Le 13 janvier 2020 14:50:49 GMT+02:00, Steve Lhomme <robux4 at ycbcr.xyz> a écrit :
>At least gcc 8 for the Raspberry Pi needs it.
>---
> configure.ac | 17 +++++++++++++++++
> 1 file changed, 17 insertions(+)
>
>diff --git a/configure.ac b/configure.ac
>index c2a2a231cee..a7cf39d2174 100644
>--- a/configure.ac
>+++ b/configure.ac
>@@ -70,6 +70,23 @@ AC_C_INLINE
> AC_C_RESTRICT
> AX_CXX_COMPILE_STDCXX_14([noext], [mandatory])
> 
>+dnl Check the compiler supports atomics in C
>+AC_MSG_CHECKING([C atomics])
>+AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <stdatomic.h>],[
>+atomic_uintmax_t test;
>+atomic_init(&test, 0);
>+atomic_fetch_add_explicit(&test, 2u, memory_order_relaxed);
>+])], [AC_MSG_RESULT([built-in])], [
>+  LDFLAGS="$LDFLAGS -latomic"
>+  AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <stdatomic.h>],[
>+atomic_uintmax_t test;
>+atomic_init(&test, 0);
>+atomic_fetch_add_explicit(&test, 2u, memory_order_relaxed);
>+])],[AC_MSG_RESULT([using -latomic])],[
>+  AC_MSG_ERROR([VLC requires atomics support])
>+  ])
>+])
>+
> dnl Extend the --help string at the current spot.
> AC_DEFUN([EXTEND_HELP_STRING], [m4_divert_once([HELP_ENABLE], [$1])])
> 
>-- 
>2.17.1
>
>_______________________________________________
>vlc-devel mailing list
>To unsubscribe or modify your subscription options:
>https://mailman.videolan.org/listinfo/vlc-devel

-- 
Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20200113/590fdd33/attachment.html>


More information about the vlc-devel mailing list