It's inherently not portable to do so, because the mapping from library names to files on the file system (whose existence can be checked) is not exposed by R6RS.  So you'd need one implementation of that mapping per functioning R6RS system: some subset of Chez, Guile, IronScheme, Larceny, Loko, Mosh, Racket, Sagittarius, Vicare, Ypsilon.  The general framework is straightforward enough: stringify the module name (usually by infixing "/" but not always, plus adding some suffix) and search some directory path, which may involve an environment variable and some hard-coded parts.

On Fri, Feb 14, 2020 at 8:45 AM Lassi Kortela <xxxxxx@lassi.io> wrote:
> You can use (library (scheme complex)) and (library (scheme inexact)) to
> determine the presence of complex and inexact numbers, which is why
> there are no features for them.

That's nice for R7RS code, but doesn't work for non-R7RS implementations
which can also make use of cond-expand.

Then again, not all R6RS implementations even have cond-expand out of
the box. Since R6RS has a library system largely compatible with R7RS,
it ought to be reasonably simple to support the (library ...) clause in
a R6RS cond-expand implementation.