## 7.1 setup scripts

A setup-script is a normal Scheme-program, which should contain an invocation of the `chicken-setup` macro, like this:

    (chicken-setup (command-line-arguments) SPEC ...)

[syntax] (chicken-setup ARGUMENTS SPEC ...)
  Installs or wraps extension libraries with the specifications `SPEC ...`. `ARGUMENTS` should be a list of strings, where the string may be one of the following:

  - -b -build -build Builds the extension by compiling any provided source files.

  - -i -install -install Installs the extension. You might have to have root-privileges, if the registry of installed extensions is located in a system-directory. The extension will be built, if it isn't already.

  - -w -wrap -wrap Creates an archive from all source files and the setup-script. If the extension contains more than a single source file, then there must exist a directory with the same name as the extension containing all needed files.

  If no argument is given, then the extension will be extracted, built and installed in one step.

  `SPEC` is a setup-specification that describes the structure and attributes of the extension:

      (EXTENSION-NAME
        (ATTRIBUTE ...)
        SUBMODULE ...) )

  - `EXTENSION-NAME` is a symbol naming the extension.

  - `ATTRIBUTE` is a list with one or more elements, where the first element must be a symbol naming an extension attribute.

  - `SUBMODULE` is again an setup-specification of a nested extension-module.

  The following attributes are allowed:

  (author STRING)
    The name of the author of the module.

  (license STRING)
    The type of license this module is distributed under.

  (comment STRING ...)
    Additional comments.

  (syntax)
  (source)
    Marks this module as source, that is, it is not compiled. Use this attribute for syntax/macro modules.

  (file STRING)
    If the module (or sub-module) has a different filename than the module-name, then the actual filename is declared using this property.

  (make STRING-OR-EXP)
    Defines the command used to build the module. This defaults to an invocation of the compiler-script `csc` with the appropriate arguments and options to build the shared library object. The argument may also be a Scheme expression that is evaluated to build the current module.

  (when EXP)
    If the evaluation of `EXP` returns `#f`, then this module will not be built.

  (options STRING ...)
    Sets the compiler options for Scheme files that are to be compiled using `csc`.

  (c-options STRING ...)
    Sets the C-compiler options for Scheme files that are to be compiled using `csc`.

  (link-options STRING ...)
    Sets the linker options for Scheme files that are to be compiled using `csc`.

  (require EXTENSION ...)
    Lists extensions that are required by the current module.

  (require-for-syntax EXTENSION ...)
    Lists extensions that are required at compile-time by the current module.

  (require-at-runtime EXTENSION ...)
    Lists extensions that are required at runtime to support a syntax-extension. This means that an expansion of

  (test EXPRESSION ...)
    If any `EXPRESSION` returns a false result, then building the extension is aborted with an error message.

  (test-command STRING ...)
    If any command `STRING` passed to the shell (via `system`) returns a non-zero exit code, then building the extension is aborted with an error message.

  (test-chicken-version NUMBER)
    If any `NUMBER` is higher than the version-number of the executing Chicken system, then building the extension is aborted with an error message.

        (require-for-syntax EXT)

    where `EXT` is defined with a specification that contains an attribute like

        (require-at-runtime EXTR1 EXTR2)

    will result in this code

        (require 'EXTR1 'EXTR2)

  (provide EXTENSION)
    Declares the given extensions as aliases for the current extension.