Annotation of OpenXM_contrib/gmp/doc/configuration, Revision 1.1.1.1
1.1 maekawa 1: /* doc/configuration (in Emacs -*-outline-*- format). */
2:
3: * How to add a new file
4:
5: ** A file in the `mpn' subdirectory
6:
7: The way we build libmpn (in the `mpn' subdirectory) is quite special.
8:
9: There is (currently) only one ``generic'' file, one that is truly
10: target independent. That is `mp_bases.c'. All other files are kept
11: in subdirectories of `mpn' with the subdirectory names indicating the
12: target processor. For example, in the `alpha' subdirectory, code
13: specific to the Alpha processor is found.
14:
15: When running `configure', a bunch of symbolic links are made in the
16: `mpn' subdirectory. If the the build host doesn't support symlinks
17: then either hard links or copying is used.
18:
19: There are four types of mpn source files.
20:
21: .asm Assembly code preprocessed with m4
22: .S Assembly code preprocessed with CPP
23: .s Assembly code not preprocessed at all
24: .c C code
25:
26: There are two types of .asm files.
27:
28: i) ``Normal'' files containing one function, possibly with more than
29: one entry point.
30:
31: ii) Multi-function files that generate one of a set of functions
32: according to build options.
33:
34:
35: When adding a new implementation of an existing function,
36:
37: i) Put it in the appropriate mpn subdirectory. It'll be detected and
38: used.
39:
40: ii) If it's a .asm or .S, be sure to have a PROLOGUE(func) entry
41: point since configure greps for that to set up the
42: HAVE_NATIVE_func defines in config.h.
43:
44: When adding a new implementation using a multi-function file, in
45: addition do the following,
46:
47: i) Use a MULFUNC_PROLOGUE(func1 func2 ...) in the .asm, declaring
48: all the functions implemented, including carry-in variants.
49:
50: If there's a separate PROLOGUE(func) for each possible function,
51: then MULFUNC_PROLOGUE isn't necessary (but this is usually not
52: the case).
53:
54: When adding a new style of multi-function file, in addition do the
55: following,
56:
57: i) Add to the "case" statement in configure.in which lists each
58: multi-function filename and what function files it can provide.
59:
60: When adding a completely new mpn function file, do the following,
61:
62: i) Add it to configure.in under one of the following
63:
64: a) `gmp_mpn_functions' if it exists for every target. This means
65: there must be a C version in mpn/generic. (Eg. add_n)
66:
67: b) `gmp_mpn_functions_optional' if it's a standard function, but
68: doesn't need to exist for every target. Code wanting to use
69: this will test HAVE_NATIVE_func to see if it's available.
70: (Eg. copyi)
71:
72: c) `extra_functions' for some targets, if it's a special function
73: that only ever needs to exist for certain targets. Code
74: wanting to use it will generally look for the target, but
75: HAVE_NATIVE_func can be used if desired.
76:
77: ii) If you want `HAVE_NATIVE_func' defined in config.h, add
78: `#undef HAVE_NATIVE_func' to acconfig.h.
79:
80: iii) If the function can be provided by a multi-function file,
81: then follow the directions above for them too.
82:
83: ** Add a file in any other directory
84:
85: When adding a top-level file,
86:
87: i) Add it to libgmp_la_SOURCES in Makefile.am.
88:
89: ii) If libmp.la needs it, then add it to libmp_la_SOURCES too.
90:
91: When adding an mpz file,
92:
93: i) Add file.c to libmpz_la_SOURCES in mpz/Makefile.am.
94:
95: ii) Add mpz/file.lo to MPZ_OBJECTS in the top-level Makefile.am.
96:
97: If a multi-function mpz file is being added,
98:
99: i) In mpz/Makefile.am,
100:
101: a) Add the file to EXTRA_DIST.
102:
103: b) Add rules copying the file at build time to duplicates with
104: appropriate names.
105:
106: c) Add each such func.c to nodist_libmpz_la_SOURCES.
107:
108: ii) Add each c) above also as mpz/func.lo in MPZ_OBJECTS in the
109: top-level Makefile.am.
110:
111: iii) In the multi-function file, expect a preprocessor symbol
112: OPERATION_func to indicate what form is being compiled.
113:
114: The same applies to mpf and mpq (except that multi-function support
115: doesn't exist in mpq/Makefile.am at the moment).
116:
117: See mpz/mul_siui.c or mpf/integer.c for example multi-function files.
118:
119: * Selecting compiler and its flags by hand
120:
121: Specifying CC on the configure command line, will result in a default
122: set of compiler flags, CFLAGS; `-g' for all compilers plus `-O2' for
123: gcc. Specify CFLAGS to set better flags.
124:
125: Example
126:
127: $ configure CC=my-gcc
128:
129: will give
130:
131: CFLAGS = -g -O2
132:
133: Specifying CC on the configure command line will make configure
134: believe it's a 32-bit compiler and not choose a source path with
135: 64-bit assembly code. Specify CC64 as well as CC to make configure
136: pick 64-bit assembly code.
137:
138: $ configure CC=my64bit-cc CC64=my64bit-cc CFLAGS="-my -flags"
139:
140: * The configure system
141:
142: ** What we use
143: We use the tools in <ftp://ftp.swox.com/pub/gmp/infrastructure/>.
144:
145: ** How to install new versions of Autoconf / Automake / Libtool
146:
147: *** Build Libtool
148: With a fresh CVS checkout, run the bootstrap script with released
149: versions (not CVS versions) of Autoconf and Automake in PATH.
150:
151: *** Update gmp directory
152: gmp$ rm ltconfig ltmain.sh
153: gmp$ libtoolize --copy
154: gmp$ automake --add-missing --copy
155:
156: ** How it works
157: During development:
158:
159: Input files Tool Output files
160: ------------------------------------------
161: aclocal
162: acinclude.m4 --------------> aclocal.m4
163:
164: autoconf
165: configure.in \ -------------> configure
166: aclocal.m4 /
167:
168: automake
169: Makefile.am \ -------------> Makefile.in
170: configure.in /
171:
172: autoheader
173: configure.in \ -------------> config.in
174: acconfig.h /
175:
176:
177: At build time:
178:
179: Input files Tool Output files
180: ------------------------------------------
181:
182: configure
183: Makefile.in \ -------------> / Makefile
184: config.in / | config.h
185: \ config.m4
186:
187: /* eof doc/configuration */
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>