Debian Codegraph @

doc/HOWTO-gc.adoc

raw
1 # Use of bdwgc in Gauche
2
3 Gauche adopts link:https://github.com/ivmai/bdwgc[Boehm-Demers-Weiser GC (bdwgc)].
4 We have a copy of source tree and build it as a part of `libgauche`,
5 instead of linking it as an external library.
6
7 ## Why don't we just link an external `libgc`?
8
9 Bdwgc has several compile-time configuration options, and Gauche needs
10 them to be set in a specific way. Separately compiled `libgc` may not have
11 been compiled with the same configuration.
12
13 Some package maintainers may not like this for security reasons. If a serious
14 security vulnerability is found in bdwgc, they want to distribute updates
15 for `libgc` only and expect the issue to be addressed. If Gauche has
16 an embedded bdwgc, the security update must be created separately for Gauche.
17
18 It is a difficult issue, for using `libgc` compiled with different
19 configuration may cause serious performance degradation, or even crashes.
20 An idea is to check the system `libgc` configuration at Gauche's `configure`
21 and use the system's whenever possible.
22
23
24 ## How is `gc/` configured?
25
26 We take advantage of autoconf's `configure.gnu` hook.
27 Autoconf-generated `configure` script runs `configure.gnu` script if
28 there exists one.
29
30 When you run the toplevel `configure`, it recurse down to `gc/configure`.
31 We install a tailored `gc/configure.gnu`, which invokes a script
32 `gc/configure.gnu-gauche`. It is a wrapper to call `gc/configure`
33 with tailored configuration options.
34
35 The sources of `gc/configure.gnu` and `gc/configure.gnu-gauche` are
36 under `tools/` directory. The former is copied to `gc/` by
37 `./DIST gen` script. The latter is processed in the toplevel `configure`
38 script to produce `gc/configure.gnu-gauche`. With this mechanism,
39 we don't need to modify GC source tree when it is updated to the
40 newer releases.
41
42
43 ## How to update `gc/` source tree
44
45 When a new version of bdwgc is released, you can just remove `gc/` and
46 replace the source tree with the new one.
47
48 However, the current bdwgc uses some deprecated autoconf macros (as of
49 8.2.8, it has `AC_PREREQ(2.61)`, which is pretty old.), and you see
50 a bunch of warnings.
51
52 Gauche already requires autoconf 2.71 or later, so there's no reason to
53 keep `gc/configure.ac` compatible with older autotools.
54
55 You can update `gc/configure.ac` with `autoreconf`, but there's a caveat.
56 It doesn't handle nested `AC_TRY_COMPLE`/`AC_TRY_LINK`, and produces
57 some artifacts. You need to manually edit it and repeat `autoreconf` until
58 all the nested old macros are processed.