Fix, modernize and document check for existing modules

Fixes:
- Use unambiguous truth values (Closes: #134)
- When checking with pkg-config, look for the dependency rather than the last
  module from the list of found modules

Modernizations:
- Scope variables
- Use a simple `if` rather than a loop to check for presence of a depency in
  list of existing modules
- Make sure the function does not depend on the status of the `-e` option, or
  whether it is called from within the condition of an `if` or a `||` or `&&`.

Documentation:
- Document calling convention for the function and assumptions on the
  parameters.
7 jobs for duneproject-check-deps in 6 minutes and 36 seconds (queued for 1 second)
Status Job ID Name Coverage
  Test
passed #76681
duneci
debian:10 clang-7-libcpp-17

00:02:02

passed #76686
duneci iset:avx allowed to fail
debian:10 gcc-7-14--expensive

00:06:36

passed #76680
duneci
debian:10 gcc-8-noassert-17

00:06:18

passed #76683
duneci
debian:9 clang-3.8-14

00:01:58

passed #76682
duneci
debian:9 gcc-6-14

00:05:35

passed #76684
duneci
ubuntu:16.04 gcc-5-14

00:05:08

passed #76685
duneci
ubuntu:18.04 clang-6-17

00:02:30