File: 07_libatomic.patch

package info (click to toggle)
capnproto 1.1.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 10,388 kB
  • sloc: cpp: 22,665; sh: 4,660; ansic: 720; makefile: 551; xml: 275
file content (59 lines) | stat: -rw-r--r-- 1,915 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
Description: link against libatomic
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1005066
Author: Tom Lee <debian@tomlee.co>

--- a/configure.ac
+++ b/configure.ac
@@ -16,6 +16,11 @@
 
 AM_INIT_AUTOMAKE([tar-ustar])
 
+AC_ARG_WITH([libatomic],
+  [AS_HELP_STRING([--with-libatomic],
+    [build by linking against libatomic @<:@default=check@:>@])],
+  [],[with_libatomic=check])
+
 AC_ARG_WITH([external-capnp],
   [AS_HELP_STRING([--with-external-capnp],
     [use the system capnp binary (or the one specified with $CAPNP) instead of compiling a new
@@ -260,10 +265,21 @@
   CXXFLAGS="$CXXFLAGS -DKJ_USE_FIBERS=0"
 ])
 
+AS_IF([test "$with_libatomic" = check], [
+  AC_SEARCH_LIBS([__atomic_load_8], [atomic], [with_libatomic=yes], [with_libatomic=no])
+], [
+  AS_IF([test "$with_libatomic" = yes], [
+    AC_SEARCH_LIBS([__atomic_load_8], [atomic], [:], [
+      AC_MSG_ERROR([could not find libatomic])
+    ])
+  ])
+])
+
 # CapnProtoConfig.cmake.in needs these variables,
 # we force them to NO because we don't need the CMake dependency for them,
 # the dependencies are provided by the .pc files.
 AC_SUBST(WITH_OPENSSL, NO)
+AC_SUBST(WITH_LIBATOMIC, $with_libatomic)
 AC_SUBST(_WITH_LIBUCONTEXT, NO)
 
 AM_CONDITIONAL([HAS_FUZZING_ENGINE], [test "x$LIB_FUZZING_ENGINE" != "x"])
--- a/cmake/CapnProtoConfig.cmake.in
+++ b/cmake/CapnProtoConfig.cmake.in
@@ -99,6 +99,16 @@
   pkg_check_modules(libucontext IMPORTED_TARGET ${forwarded_config_flags} libucontext)
 endif()
 
+if (@WITH_LIBATOMIC@)  # WITH_LIBATOMIC
+  include(CheckLibraryExists)
+  check_library_exists(atomic __atomic_load_8 "" FOUND_LIBATOMIC)
+  if (FOUND_LIBATOMIC)
+    list(APPEND CMAKE_REQUIRED_LIBRARIES "atomic")
+  else()
+    message(FATAL_ERROR "libatomic not found")
+  endif()
+endif()
+
 include("${CMAKE_CURRENT_LIST_DIR}/CapnProtoTargets.cmake")
 include("${CMAKE_CURRENT_LIST_DIR}/CapnProtoMacros.cmake")