[pro] library configuration

Pascal Costanza pc at p-cos.net
Tue Jun 28 17:38:00 UTC 2011


On 28 Jun 2011, at 17:49, Zach Beane wrote:

> Faré <fahree at gmail.com> writes:
> 
>>> I am looking for a portable way to specify configuration for a library
>>> before/during loading with ASDF2.  It would be sufficient if the user
>>> could specify an ALIST (or something similar) somewhere and I could read/
>>> use it when the library is loaded.  Does ASDF2 have a "standard"
>>> mechanism for library config files (eg where they are, how to handle them
>>> etc), or should I use something else?  I thought of using *features*, but
>>> I need actual values instead of merely checking for the presence of
>>> symbols.
>>> 
>> ASDF (1 or 2) does not handle C libraries. Extensions to ASDF do.
> 
> The question is not about C libraries, but how to express and manage
> configuration options that must be initialized before the library is
> built.
> 
> I think the answer for ASDF is "there is no way to express or manage any
> library configuration decisions."
> 
> Hunchentoot also has this issue regarding building with SSL, and manages
> it by checking for :hunchentoot-no-ssl in cl:*features*. For a
> non-boolean option, that's not a workable approach.

One could use a global variable that stores one's own configuration option, for example as a plist or alist. This would have to be in the common-lisp-user package, and theoretically clashes with other such variables. However, this is not substantially worse than potential clashes of keyword symbols in *features*. Just use a name that is unlikely to be used by others (for example, by using the ASDF/package name with an -OPTIONS suffix, or some such).

boundp is your friend to check whether the variable is actually defined, which could either yield a warning, or assume default options.

Pascal

--
Pascal Costanza
The views expressed in this email are my own, and not those of my employer.







More information about the pro mailing list