chickadee » feature-test » register-foreign-features

(register-foreign-features FEATURE1 FEATURE2 ...)syntax

For each feature F, accesses the corresponding boolean #define in C, usually generated by declare-foreign-features. Then, generates code to register or unregister the feature for future compiles.

The boolean define is prefixed with the current declaration-prefix, and the registered feature will be prefixed with the registration-prefix.

For example:

(declaration-prefix "HAVE_")
(registration-prefix "MYEGG_")
(register-foreign-features AF_UNIX)

will expand to code like:

(declare-foreign-variable HAVE_AF_UNIX bool "HAVE_AF_UNIX")
(if HAVE_AF_UNIX (emit-register!   'MYEGG_AF_UNIX)
                 (emit-unregister! 'MYEGG_AF_UNIX))

And when compiled and executed, the following is printed to standard output

(register-feature! 'MYEGG_AF_UNIX)     ;; if AF_UNIX was defined
(unregister-feature! 'MYEGG_AF_UNIX)   ;; if AF_UNIX was not defined