0003-configure.ac-check-if-libatomic-is-needed.patch 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. From 8eaf14a17244aaf000b4d19e4fde4a637576939f Mon Sep 17 00:00:00 2001
  2. From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
  3. Date: Sun, 7 Feb 2016 21:40:47 +0100
  4. Subject: [PATCH] configure.ac: check if libatomic is needed
  5. The mpd source code uses the C++11 <atomic> functionality, which
  6. internally is implemented using the __atomic_*() gcc built-ins. On
  7. certain architectures, the __atomic_*() built-ins are implemented in
  8. the libatomic library that comes with the rest of the gcc runtime. Due
  9. to this, code using <atomic> might need to link against libatomic,
  10. otherwise one hits build issues such as:
  11. GlobalEvents.cxx:(.text._ZN12GlobalEvents4EmitENS_5EventE+0x14): undefined reference to `__atomic_fetch_or_4'
  12. on an architecture like SPARC.
  13. To solve this, a configure.ac check is added to know if we need to
  14. link against libatomic or not.
  15. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
  16. ---
  17. configure.ac | 2 ++
  18. 1 file changed, 2 insertions(+)
  19. diff --git a/configure.ac b/configure.ac
  20. index 107b45a..8e6fab7 100644
  21. --- a/configure.ac
  22. +++ b/configure.ac
  23. @@ -233,6 +233,8 @@ if test x$have_pthread_setname_np = xyes; then
  24. AC_DEFINE(HAVE_PTHREAD_SETNAME_NP, 1, [Is pthread_setname_np() available?])
  25. fi
  26. +AC_SEARCH_LIBS([__atomic_load_4], [atomic])
  27. +
  28. dnl ---------------------------------------------------------------------------
  29. dnl Event loop selection
  30. dnl ---------------------------------------------------------------------------
  31. --
  32. 2.6.4