For Development HEAD DRAFTSearch (procedure/syntax/module):

Next: , Previous: , Up: Gaucheでのプログラミング   [Contents][Index]

3.7 補助プログラム

When you install Gauche, you’ll get several auxiliary programs that help developing Gauche applications.

gauche-config

This program can be used to query various configuation parameters of installed Gauche.

gauche-package

Extension package manager. It can be used to install extension packages and query their parameters. You can also use this to start writing your own extensions.

gauche-install

An alternative install program. Gauche extensions can use this instead of system’s install command, so that they don’t need to worry about differences among platforms.

gauche-compile-r7rs

This program can be used to create an executable binary from Gauche scripts.

gauche-cesconv

Additionally, if you configure Gauche with --enable-shared-commands, the following programs are also installed.

scheme-r7rs
scheme-srfi-0
scheme-srfi-7

Those are the names of Scheme interpreter suggeted by SRFI-22. They are symlinked to gosh.

compile-r7rs

This is the name of Scheme compiler recommended by SRFI-138. It is symlinked to gauche-compile-r7rs.


3.7.1 gauche-config - 設定を問い合わせる

Program: gauche-config [option]

Without options, prints the command usage. With an option, prints the string associated to the option, which is determined at configuration time.

Here are some examples. Note that output may vary on your platform.

  • Print the running architecture:
    $ gauche-config --arch
    x86_64-pc-linux-gnu
    
  • Print the library flags required to link programs using Gauche:
    $ gauche-config -l
    -lgauche-0.98 -lmbedtls -lcrypt -lrt -lm  -lpthread
    
  • Print the include path flags required to comple Gauche extension.
    $ gauche-config -I
    -I/usr/lib/gauche-0.98/0.9.15/include
    

The command accepts the following arguments. You can only give at most one.

General parameter:

-V

The current Gauche version.

Parameters to compile applications using Gauche:

-I

Include path options required to compile programs using Gauche (Note: This doesn’t work if Gauche installation directory path contains whitespaces. See –incdirs below.)

-L

Library path options required to link programs using Gauche (Note: This doesn’t work if Gauche installation directory path contains whitespaces. See –archdirs below.)

-l

Link library options required to link programs using Gauche.

--cc

The name of the compiler used to compile this Gacuhe.

--cpp

The command to run the C preprocessor.

--ac

The directory that contains Gauche-specific autoconf macros.

--reconfigure

The command line used to configure the current installation.

--arch

The autoconf-style architecture signature (cpu-vendor-kernel-os).

--incdirs
--archdirs

The list of directory names to be looked for include files and libraries, respectively. Each directory name may be quoted if it contains whitespaces, and separated by ’:’ on Unix platforms, or by ’;’ on Windows platforms.

--local-incdir
--local-libdir

These are ’-I’ and ’-L’ flags for additional local headers/libraries to search, given by ’–with-local’ configure flags. Note that those are also included in ’-I’, ’-L’, ’–incdirs’, and ’–archdirs’.

Parameters to install files:

--prefix

The directory prefix set by configure.

--sysincdir
--siteincdir
--pkgincdir

Directories where system|site|package header files of extensions go.

--syslibdir
--sitelibdir
--pkglibdir

Directories where system|site|package scheme files go.

--sysarchdir
--sitearchdir
--pkgarchdir

Directories where system|site|package DSO files go.

--mandir
--infodir

Directories where gauche manpage and info docs are installed.

Parameters to help building extensions:

--object-suffix

The extension of the compiled objects (e.g. ’o’ or ’obj).

--executable-suffix

The extension of the executable including a period (empty on Unix systems, ’.exe’ on Windows.

--so-suffix

The extension for dynamically loadable (dlopen-able) modules (e.g. ’so’).

--so-cflags

Additional CFLAGS to create dynamically loadable modules.

--so-ldflags

Additional LDFLAGS to create dynamically loadable modules.

--so-libs

Additional libraries required to create dynamically loadable modules.

--dylib-suffix

The extension for dynamically linked libraries (as opposed to dlopen()ed) Usually the same as –so-suffix, but OSX wants ’dylib’.

--dylib-ldflags

LDFLAGS to create dynamically linked libraries.

--rpath-flag

Compiler flag(s) to embed RPATH

--default-cflags

This is the CFLAGS used to compile Gauche, and to be used to compile extensions as well.

--cppflags

Compiler flag(s) passed to C preprocessor

--static-libs

List of library link flags (’-llib’) required to link Gauche statically. Similar to ’-l’, but this includes the libraries that are used for extension modules, and also the static library itself, that is -lgauche-static-X.X.

--libgauche-so

The base name of dynamically linked libgauche.


3.7.2 gauche-package - 拡張パッケージの管理

Program: gauche-package command [arg …]

This command can be used to build and install Gauche extensions, query installed ones, and help start building new ones. It has several subcommands, which can be listed with gauche-package help.


3.7.3 gauche-install - ファイルのインストール

Program: gauche-install [options] file dest
Program: gauche-install [options] file … dir
Program: gauche-install -d [options] dir …
Program: gauche-install -T dir [options] file …
Program: gauche-install -U dir [options] file …

This command can be used to install files. It is upper-compatible to BSD install command and can be used as drop-in replacement. Notably, the first three command invocation format are compatible with BSD install. It has several more features that keeps Makefile concise.

The first and second invocation format copies file(s) to dest (a file pathname) or dir (an existing directory). You can specify permissons, owners, etc. Basically it’s a fancier cp.

The third format creates dir(s) if they don’t exist. Basically it’s a fancier mkdir -p.

The fourth format copies file … to dir. It differs from the second format in the sense that relative pathname of file is preserved. That is, if you run the following command:

gauche-install -T /usr/local/mytool foo.scm bar/baz.scm

It creates /usr/local/mytool/foo.scm and /usr/local/mytool/bar/baz.scm. With the second format, the subdirectory bar won’t be created. This format is handy when you want to install a bunch of subtrees.

The fifth format uninstall files which would be installed with -T option. Simply change -T option to -U option and you’ll clean the files.

The following command-line arguments are recognized.

-C
--canonical-suffix

If installed file has a suffix .sci, replace it for .scm. This is Gauche specific convention.

-T dir
--target dir

Installs files to the dir, creating paths if needed. Partial path of files are preserved. (4th format only)

-U dir
--uninstall dir

Reverse the effect of -T, e.g. removes files from its destination dir.

-S dir
--srcdir dir

Look for file … within dir; useful if VPATH is used.

--shebang path

Adds #!path before the file contents. Useful to install scripts.

-d
--directory

Creates directories. (3rd format only).

-m mode
--mode mode

Change mode of the installed file.

-p prefix
--strip-prefix prefix

Strip prefix dirs from file … before installation. (4th/5th format only).

-o owner
--owner owner

Change owner of the installed file(s).

-g group
--group group

Change group of the installed file(s).

-v
--verbose

Work verbosely

-d
--dry-run

Just prints what actions are to be done, but won’t execute them.


3.7.4 gauche-compie-r7rs - スクリプトのコンパイル

For Gauche-specific programs, we have tools/build-standalone Scheme script (see スタンドアロン実行可能ファイルの作成). We recommend that script, for it is more featureful.

The gauche-compile-r7rs and compile-r7rs script is provided so that you can invoke a ’Scheme compiler’ with a standardized manner. It may be handy if other tools (e.g. IDE) need to invoke a Scheme compiler as a subprocess.

This interface is defined in SRFI-138, which also suggests the name compile-r7rs. We only install gauche-compile-r7rs by default so that we won’t accidentally clobber other implementation’s program, but if you give --enable-shared-commands option to configure script, a symbolic link compile-r7rs is created.

Program: gauche-compile-r7rs [options] script.scm
Program: compile-r7rs [options] script.scm

Compile a Scheme source file script.scm and produce an executable binary. The compile-r7rs is only installed if Gauche is configured with --enable-shared-commands.

Note: SRFI-138 states that if the environment variable COMPILE_R7RS is defined, it is assumed to a pathname of another program and is executed instead of Gauche’s compile-r7rs. We think the feature is rather confusing than convenient, so we don’t support it. If you want to run alternative implementation’s compiler, there are more explicit means such as running it directly or change PATH.

The following command-line arguments are recognized.

-I path
-A path

Prepend or append path to the path list the referenced libraries are searched. These options can be specified multiple times.

-o outfile

Specifies output executable filename. When omitted, a.out (on POSIX systems) or a.exe (on Windows) are used.

-D feature-id

Adds feature-id to the list of feature identifiers. This is to switch code conditionally in the source with cond-expand. This option can be specified multiple times.

Note that this does not enable certain features. So you shouldn’t specify system-reserved feature identifiers (see プラットフォーム依存の機能). This is also different from -D option of tools/build-standalone.


Next: , Previous: , Up: Gaucheでのプログラミング   [Contents][Index]


For Development HEAD DRAFTSearch (procedure/syntax/module):
DRAFT