(library
 (name eio_unix)
 (public_name eio.unix)
 (public_headers include/fork_action.h include/eio_unix_stubs.h)
 (foreign_stubs
  (language c)
  (include_dirs include)
  (names fork_action eio_unix_stubs cap pty))
 (libraries eio eio.utils unix threads mtime.clock.os))

(rule
 (package eio)
 (enabled_if %{bin-available:lintcstubs_arity_cmt})
 (action
  (with-stdout-to
   primitives.h.new
   (run %{bin:lintcstubs_arity_cmt}
        %{dep:.eio_unix.objs/byte/eio_unix__Fd.cmt}
        %{dep:.eio_unix.objs/byte/eio_unix__Private.cmt}
        %{dep:.eio_unix.objs/byte/eio_unix__Cap.cmt}
        %{dep:.eio_unix.objs/byte/eio_unix__Fork_action.cmt}
        %{dep:.eio_unix.objs/byte/eio_unix__Pty.cmt}))))

(rule
 (package eio)
 (enabled_if %{bin-available:lintcstubs_arity_cmt})
 (alias runtest)
 (action
  (diff primitives.h primitives.h.new)))

(rule
 (targets config.ml)
 (enabled_if (= %{os_type} "Unix"))
 (action (run ./include/discover.exe)))

(rule
 (enabled_if (<> %{os_type} "Unix"))
 (action (copy config.ml.windows config.ml)))
