1
0
Fork 0
mirror of https://gitlab.alpinelinux.org/alpine/aports.git synced 2025-07-22 18:55:29 +03:00
aports/community/cmus/c11-atomics-check.patch
info@mobile-stream.com f068acfb28 community/cmus: fix build on mips{el} (-latomic)
This adds generic -latomic check so likely covers all architectures
without 64-bit atomic built-ins (e.g. armel too).
2018-11-30 12:52:52 +00:00

57 lines
1.3 KiB
Diff

--- a/Makefile
+++ b/Makefile
@@ -21,7 +21,7 @@
FFMPEG_CFLAGS += $(shell pkg-config --cflags libswresample)
FFMPEG_LIBS += $(shell pkg-config --libs libswresample)
-CMUS_LIBS = $(PTHREAD_LIBS) $(NCURSES_LIBS) $(ICONV_LIBS) $(DL_LIBS) $(DISCID_LIBS) \
+CMUS_LIBS = $(ATOMIC_LIBS) $(PTHREAD_LIBS) $(NCURSES_LIBS) $(ICONV_LIBS) $(DL_LIBS) $(DISCID_LIBS) \
-lm $(COMPAT_LIBS) $(LIBSYSTEMD_LIBS)
input.o main.o ui_curses.o op/pulse.lo: .version
--- a/configure
+++ b/configure
@@ -39,7 +39,35 @@
return 1
}
+readonly atomic_code="
+#include <stdatomic.h>
+int main(int argc, char *argv[])
+{
+ static atomic_llong x = ATOMIC_VAR_INIT(1);
+ return atomic_fetch_add_explicit(&x, argc, memory_order_relaxed) == 2;
+}
+"
+
+check_atomic()
+{
+ msg_checking "if -latomic is needed for C11 atomics"
+ if try_compile_link "$atomic_code"
+ then
+ msg_result "no"
+ ATOMIC_LIBS=
+ elif try_compile_link "$atomic_code" -latomic
+ then
+ msg_result "yes"
+ ATOMIC_LIBS=-latomic
+ else
+ msg_result "no C11 atomics?!"
+ return 1
+ fi
+ makefile_vars ATOMIC_LIBS
+ return 0
+}
+
check_compat()
{
COMPAT_LIBS=
@@ -517,6 +545,7 @@
check check_cflags
check check_cc_depgen
check check_endianness
+check check_atomic
check check_compat
check check_dl
check check_pthread