(* -*- tuareg -*- *)

let maybe_threads =
  if Jbuild_plugin.V1.ocaml_version < "5" then "threads.posix" else ""

let () =
  Jbuild_plugin.V1.send
  @@ {|

 (include_subdirs unqualified)

(library
 (name saturn)
 (public_name saturn)
 (modules_without_implementation htbl_intf bounded_queue_intf spsc_queue_intf michael_scott_queue_intf)
 (libraries backoff multicore-magic |}
  ^ maybe_threads
  ^ {| ))

(rule
 (enabled_if
  (< %{ocaml_version} 5.0.0))
 (action
  (copy domain.ocaml4.ml domain.ml)))

(rule
 (enabled_if
  (< %{ocaml_version} 4.14.0))
 (action
  (copy seq.ocaml4.13.ml seq.ml)))

(rule
 (enabled_if
  (< %{ocaml_version} 5.2.0))
 (action
  (copy atomic.without_contended.ml atomic.ml))) 

(mdx
 (package saturn)
 (enabled_if
  (and
   (<> %{os_type} Win32)
   (>= %{ocaml_version} 5.0.0)))
 (libraries saturn)
 (files treiber_stack.mli bounded_stack.mli ws_deque.mli mpsc_queue.mli skiplist.mli bag.mli))
|}
