xref: /OK3568_Linux_fs/external/chromium/licenses/README (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun                        README for newlib-2.0.0 release
2*4882a593Smuzhiyun           (mostly cribbed from the README in the gdb-4.13 release)
3*4882a593Smuzhiyun
4*4882a593SmuzhiyunThis is `newlib', a simple ANSI C library, math library, and collection
5*4882a593Smuzhiyunof board support packages.
6*4882a593Smuzhiyun
7*4882a593SmuzhiyunThe newlib and libgloss subdirectories are a collection of software from
8*4882a593Smuzhiyunseveral sources, each wi6h their own copyright and license.  See the file
9*4882a593SmuzhiyunCOPYING.NEWLIB for details.  The rest of the release tree is under either
10*4882a593Smuzhiyunthe GNU GPL or LGPL licenses.
11*4882a593Smuzhiyun
12*4882a593SmuzhiyunTHIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
13*4882a593SmuzhiyunIMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
14*4882a593SmuzhiyunWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
15*4882a593Smuzhiyun
16*4882a593Smuzhiyun
17*4882a593SmuzhiyunUnpacking and Installation -- quick overview
18*4882a593Smuzhiyun==========================
19*4882a593Smuzhiyun
20*4882a593SmuzhiyunWhen you unpack the newlib-2.0.0.tar.gz file, you'll find a directory
21*4882a593Smuzhiyuncalled `newlib-2.0.0', which contains:
22*4882a593Smuzhiyun
23*4882a593SmuzhiyunCOPYING          config/          install-sh*      mpw-configure
24*4882a593SmuzhiyunCOPYING.LIB      config-ml.in     libgloss/        mpw-install
25*4882a593SmuzhiyunCOPYING.NEWLIB   config.guess*    mkinstalldirs*   newlib/
26*4882a593SmuzhiyunCYGNUS           config.sub*      move-if-change*  symlink-tree*
27*4882a593SmuzhiyunChangeLog        configure*       mpw-README       texinfo/
28*4882a593SmuzhiyunMakefile.in      configure.in     mpw-build.in
29*4882a593SmuzhiyunREADME           etc/             mpw-config.in
30*4882a593Smuzhiyun
31*4882a593SmuzhiyunTo build NEWLIB, you must follow the instructions in the section entitled
32*4882a593Smuzhiyun"Compiling NEWLIB".
33*4882a593Smuzhiyun
34*4882a593SmuzhiyunThis will configure and build all the libraries and crt0 (if one exists).
35*4882a593SmuzhiyunIf `configure' can't determine your host system type, specify one as its
36*4882a593Smuzhiyunargument, e.g., sun4 or sun4sol2.  NEWLIB is most often used in cross
37*4882a593Smuzhiyunenvironments.
38*4882a593Smuzhiyun
39*4882a593SmuzhiyunNOTE THAT YOU MUST HAVE ALREADY BUILT AND INSTALLED GCC and BINUTILS.
40*4882a593Smuzhiyun
41*4882a593Smuzhiyun
42*4882a593SmuzhiyunMore Documentation
43*4882a593Smuzhiyun==================
44*4882a593Smuzhiyun
45*4882a593Smuzhiyun   Newlib documentation is available on the net via:
46*4882a593Smuzhiyun   http://sourceware.org/newlib/docs.html
47*4882a593Smuzhiyun
48*4882a593Smuzhiyun   All the documentation for NEWLIB comes as part of the machine-readable
49*4882a593Smuzhiyundistribution.  The documentation is written in Texinfo format, which is
50*4882a593Smuzhiyuna documentation system that uses a single source file to produce both
51*4882a593Smuzhiyunon-line information and a printed manual.  You can use one of the Info
52*4882a593Smuzhiyunformatting commands to create the on-line version of the documentation
53*4882a593Smuzhiyunand TeX (or `texi2roff') to typeset the printed version.
54*4882a593Smuzhiyun
55*4882a593Smuzhiyun   If you want to format these Info files yourself, you need one of the
56*4882a593SmuzhiyunInfo formatting programs, such as `texinfo-format-buffer' or `makeinfo'.
57*4882a593Smuzhiyun
58*4882a593Smuzhiyun   If you want to typeset and print copies of this manual, you need TeX,
59*4882a593Smuzhiyuna program to print its DVI output files, and `texinfo.tex', the Texinfo
60*4882a593Smuzhiyundefinitions file.
61*4882a593Smuzhiyun
62*4882a593Smuzhiyun   TeX is a typesetting program; it does not print files directly, but
63*4882a593Smuzhiyunproduces output files called DVI files.  To print a typeset document,
64*4882a593Smuzhiyunyou need a program to print DVI files.  If your system has TeX
65*4882a593Smuzhiyuninstalled, chances are it has such a program.  The precise command to
66*4882a593Smuzhiyunuse depends on your system; `lpr -d' is common; another (for PostScript
67*4882a593Smuzhiyundevices) is `dvips'.  The DVI print command may require a file name
68*4882a593Smuzhiyunwithout any extension or a `.dvi' extension.
69*4882a593Smuzhiyun
70*4882a593Smuzhiyun   TeX also requires a macro definitions file called `texinfo.tex'.
71*4882a593SmuzhiyunThis file tells TeX how to typeset a document written in Texinfo
72*4882a593Smuzhiyunformat.  On its own, TeX cannot read, much less typeset a Texinfo file.
73*4882a593Smuzhiyun`texinfo.tex' is distributed with NEWLIB and is located in the
74*4882a593Smuzhiyun`newlib-VERSION-NUMBER/texinfo' directory.
75*4882a593Smuzhiyun
76*4882a593Smuzhiyun
77*4882a593Smuzhiyun
78*4882a593SmuzhiyunCompiling NEWLIB
79*4882a593Smuzhiyun================
80*4882a593Smuzhiyun
81*4882a593Smuzhiyun   To compile NEWLIB, you must build it in a directory separate from
82*4882a593Smuzhiyunthe source directory.  If you want to run NEWLIB versions for several host
83*4882a593Smuzhiyunor target machines, you need a different `newlib' compiled for each combination
84*4882a593Smuzhiyunof host and target.  `configure' is designed to make this easy by allowing
85*4882a593Smuzhiyunyou to generate each configuration in a separate subdirectory.
86*4882a593SmuzhiyunIf your `make' program handles the `VPATH' feature correctly (like GNU `make')
87*4882a593Smuzhiyunrunning `make' in each of these directories builds the `newlib' libraries
88*4882a593Smuzhiyunspecified there.
89*4882a593Smuzhiyun
90*4882a593Smuzhiyun   To build `newlib' in a specific directory, run `configure' with the
91*4882a593Smuzhiyun`--srcdir' option to specify where to find the source. (You also need
92*4882a593Smuzhiyunto specify a path to find `configure' itself from your working
93*4882a593Smuzhiyundirectory.  If the path to `configure' would be the same as the
94*4882a593Smuzhiyunargument to `--srcdir', you can leave out the `--srcdir' option; it
95*4882a593Smuzhiyunwill be assumed.)
96*4882a593Smuzhiyun
97*4882a593Smuzhiyun   For example, with version 2.0.0, you can build NEWLIB in a separate
98*4882a593Smuzhiyundirectory for a Sun 4 cross m68k-aout environment like this:
99*4882a593Smuzhiyun
100*4882a593Smuzhiyun     cd newlib-2.0.0
101*4882a593Smuzhiyun     mkdir ../newlib-m68k-aout
102*4882a593Smuzhiyun     cd ../newlib-m68k-aout
103*4882a593Smuzhiyun     ../newlib-2.0.0/configure --host=sun4 --target=m68k-aout
104*4882a593Smuzhiyun     make
105*4882a593Smuzhiyun
106*4882a593Smuzhiyun   When `configure' builds a configuration using a remote source
107*4882a593Smuzhiyundirectory, it creates a tree for the binaries with the same structure
108*4882a593Smuzhiyun(and using the same names) as the tree under the source directory.  In
109*4882a593Smuzhiyunthe example, you'd find the Sun 4 library `libiberty.a' in the
110*4882a593Smuzhiyundirectory `newlib-m68k-aout/libiberty', and NEWLIB itself in
111*4882a593Smuzhiyun`newlib-m68k-aout/newlib'.
112*4882a593Smuzhiyun
113*4882a593Smuzhiyun   When you run `make' to build a program or library, you must run it
114*4882a593Smuzhiyunin a configured directory--whatever directory you were in when you
115*4882a593Smuzhiyuncalled `configure' (or one of its subdirectories).
116*4882a593Smuzhiyun
117*4882a593Smuzhiyun   The `Makefile' that `configure' generates in each source directory
118*4882a593Smuzhiyunalso runs recursively.  If you type `make' in a source directory such
119*4882a593Smuzhiyunas `newlib-2.0.0' (or in a separate configured directory configured with
120*4882a593Smuzhiyun`--srcdir=PATH/newlib-2.0.0'), you will build all the required libraries.
121*4882a593Smuzhiyun
122*4882a593Smuzhiyun   When you have multiple hosts or targets configured in separate
123*4882a593Smuzhiyundirectories, you can run `make' on them in parallel (for example, if
124*4882a593Smuzhiyunthey are NFS-mounted on each of the hosts); they will not interfere
125*4882a593Smuzhiyunwith each other.
126*4882a593Smuzhiyun
127*4882a593Smuzhiyun
128*4882a593SmuzhiyunSpecifying names for hosts and targets
129*4882a593Smuzhiyun======================================
130*4882a593Smuzhiyun
131*4882a593Smuzhiyun   The specifications used for hosts and targets in the `configure'
132*4882a593Smuzhiyunscript are based on a three-part naming scheme, but some short
133*4882a593Smuzhiyunpredefined aliases are also supported.  The full naming scheme encodes
134*4882a593Smuzhiyunthree pieces of information in the following pattern:
135*4882a593Smuzhiyun
136*4882a593Smuzhiyun     ARCHITECTURE-VENDOR-OS
137*4882a593Smuzhiyun
138*4882a593Smuzhiyun   For example, you can use the alias `sun4' as a HOST argument or in a
139*4882a593Smuzhiyun`--target=TARGET' option.  The equivalent full name is
140*4882a593Smuzhiyun`sparc-sun-sunos4'.
141*4882a593Smuzhiyun
142*4882a593Smuzhiyun   The `configure' script accompanying NEWLIB does not provide any query
143*4882a593Smuzhiyunfacility to list all supported host and target names or aliases.
144*4882a593Smuzhiyun`configure' calls the Bourne shell script `config.sub' to map
145*4882a593Smuzhiyunabbreviations to full names; you can read the script, if you wish, or
146*4882a593Smuzhiyunyou can use it to test your guesses on abbreviations--for example:
147*4882a593Smuzhiyun
148*4882a593Smuzhiyun     % sh config.sub sun4
149*4882a593Smuzhiyun     sparc-sun-sunos4.1.1
150*4882a593Smuzhiyun     % sh config.sub sun3
151*4882a593Smuzhiyun     m68k-sun-sunos4.1.1
152*4882a593Smuzhiyun     % sh config.sub decstation
153*4882a593Smuzhiyun     mips-dec-ultrix4.2
154*4882a593Smuzhiyun     % sh config.sub hp300bsd
155*4882a593Smuzhiyun     m68k-hp-bsd
156*4882a593Smuzhiyun     % sh config.sub i386v
157*4882a593Smuzhiyun     i386-pc-sysv
158*4882a593Smuzhiyun     % sh config.sub i786v
159*4882a593Smuzhiyun     Invalid configuration `i786v': machine `i786v' not recognized
160*4882a593Smuzhiyun
161*4882a593SmuzhiyunThe Build, Host and Target Concepts in newlib
162*4882a593Smuzhiyun=============================================
163*4882a593Smuzhiyun
164*4882a593SmuzhiyunThe build, host and target concepts are defined for gcc as follows:
165*4882a593Smuzhiyun
166*4882a593Smuzhiyunbuild: the platform on which gcc is built.
167*4882a593Smuzhiyunhost: the platform on which gcc is run.
168*4882a593Smuzhiyuntarget: the platform for which gcc generates code.
169*4882a593Smuzhiyun
170*4882a593SmuzhiyunSince newlib is a library, the target concept does not apply to it, and the
171*4882a593Smuzhiyunbuild, host, and target options given to the top-level configure script must
172*4882a593Smuzhiyunbe changed for newlib's use.
173*4882a593Smuzhiyun
174*4882a593SmuzhiyunThe options are shifted according to these correspondences:
175*4882a593Smuzhiyun
176*4882a593Smuzhiyungcc's build platform has no equivalent in newlib.
177*4882a593Smuzhiyungcc's host platform is newlib's build platform.
178*4882a593Smuzhiyungcc's target platform is newlib's host platform.
179*4882a593Smuzhiyunand as mentioned before, newlib has no concept of target.
180*4882a593Smuzhiyun
181*4882a593Smuzhiyun`configure' options
182*4882a593Smuzhiyun===================
183*4882a593Smuzhiyun
184*4882a593Smuzhiyun   Here is a summary of the `configure' options and arguments that are
185*4882a593Smuzhiyunmost often useful for building NEWLIB.  `configure' also has several other
186*4882a593Smuzhiyunoptions not listed here.
187*4882a593Smuzhiyun
188*4882a593Smuzhiyun     configure [--help]
189*4882a593Smuzhiyun               [--prefix=DIR]
190*4882a593Smuzhiyun               [--srcdir=PATH]
191*4882a593Smuzhiyun               [--target=TARGET] HOST
192*4882a593Smuzhiyun
193*4882a593SmuzhiyunYou may introduce options with a single `-' rather than `--' if you
194*4882a593Smuzhiyunprefer; but you may abbreviate option names if you use `--'.
195*4882a593Smuzhiyun
196*4882a593Smuzhiyun`--help'
197*4882a593Smuzhiyun     Display a quick summary of how to invoke `configure'.
198*4882a593Smuzhiyun
199*4882a593Smuzhiyun`--prefix=DIR'
200*4882a593Smuzhiyun     Configure the source to install programs and files in directory
201*4882a593Smuzhiyun     `DIR'.
202*4882a593Smuzhiyun
203*4882a593Smuzhiyun`--exec-prefix=DIR'
204*4882a593Smuzhiyun     Configure the source to install host-dependent files in directory
205*4882a593Smuzhiyun     `DIR'.
206*4882a593Smuzhiyun
207*4882a593Smuzhiyun`--srcdir=PATH'
208*4882a593Smuzhiyun     *Warning: using this option requires GNU `make', or another `make'
209*4882a593Smuzhiyun     that compatibly implements the `VPATH' feature.
210*4882a593Smuzhiyun     Use this option to make configurations in directories separate
211*4882a593Smuzhiyun     from the NEWLIB source directories.  Among other things, you can use
212*4882a593Smuzhiyun     this to build (or maintain) several configurations simultaneously,
213*4882a593Smuzhiyun     in separate directories.  `configure' writes configuration
214*4882a593Smuzhiyun     specific files in the current directory, but arranges for them to
215*4882a593Smuzhiyun     use the source in the directory PATH.  `configure' will create
216*4882a593Smuzhiyun     directories under the working directory in parallel to the source
217*4882a593Smuzhiyun     directories below PATH.
218*4882a593Smuzhiyun
219*4882a593Smuzhiyun`--norecursion'
220*4882a593Smuzhiyun     Configure only the directory level where `configure' is executed;
221*4882a593Smuzhiyun     do not propagate configuration to subdirectories.
222*4882a593Smuzhiyun
223*4882a593Smuzhiyun`--target=TARGET'
224*4882a593Smuzhiyun     Configure NEWLIB for running on the specified TARGET.
225*4882a593Smuzhiyun
226*4882a593Smuzhiyun     There is no convenient way to generate a list of all available
227*4882a593Smuzhiyun     targets.
228*4882a593Smuzhiyun
229*4882a593Smuzhiyun`HOST ...'
230*4882a593Smuzhiyun     Configure NEWLIB to be built using a cross compiler running on
231*4882a593Smuzhiyun     the specified HOST.
232*4882a593Smuzhiyun
233*4882a593Smuzhiyun     There is no convenient way to generate a list of all available
234*4882a593Smuzhiyun     hosts.
235*4882a593Smuzhiyun
236*4882a593SmuzhiyunTo fit diverse usage models, NEWLIB supports a group of configuration
237*4882a593Smuzhiyunoptions so that library features can be turned on/off according to
238*4882a593Smuzhiyuntarget system's requirements.
239*4882a593Smuzhiyun
240*4882a593SmuzhiyunOne feature can be enabled by specifying `--enable-FEATURE=yes' or
241*4882a593Smuzhiyun`--enable-FEATURE'.  Or it can be disable by `--enable-FEATURE=no' or
242*4882a593Smuzhiyun`--disable-FEATURE'.
243*4882a593Smuzhiyun
244*4882a593Smuzhiyun`--enable-newlib-io-pos-args'
245*4882a593Smuzhiyun     Enable printf-family positional arg support.
246*4882a593Smuzhiyun     Disabled by default, but some hosts enable it in configure.host.
247*4882a593Smuzhiyun
248*4882a593Smuzhiyun`--enable-newlib-io-c99-formats'
249*4882a593Smuzhiyun     Enable C99 support in IO functions like printf/scanf.
250*4882a593Smuzhiyun     Disabled by default, but some hosts enable it in configure.host.
251*4882a593Smuzhiyun
252*4882a593Smuzhiyun`--enable-newlib-register-fini'
253*4882a593Smuzhiyun     Enable finalization function registration using atexit.
254*4882a593Smuzhiyun     Disabled by default.
255*4882a593Smuzhiyun
256*4882a593Smuzhiyun`--enable-newlib-io-long-long'
257*4882a593Smuzhiyun     Enable long long type support in IO functions like printf/scanf.
258*4882a593Smuzhiyun     Disabled by default, but many hosts enable it in configure.host.
259*4882a593Smuzhiyun
260*4882a593Smuzhiyun`--enable-newlib-io-long-double'
261*4882a593Smuzhiyun     Enable long double type support in IO functions printf/scanf.
262*4882a593Smuzhiyun     Disabled by default, but some hosts enable it in configure.host.
263*4882a593Smuzhiyun
264*4882a593Smuzhiyun`--enable-newlib-mb'
265*4882a593Smuzhiyun     Enable multibyte support.
266*4882a593Smuzhiyun     Disabled by default.
267*4882a593Smuzhiyun
268*4882a593Smuzhiyun`--enable-newlib-iconv-encodings'
269*4882a593Smuzhiyun     Enable specific comma-separated list of bidirectional iconv
270*4882a593Smuzhiyun     encodings to be built-in.
271*4882a593Smuzhiyun     Disabled by default.
272*4882a593Smuzhiyun
273*4882a593Smuzhiyun`--enable-newlib-iconv-from-encodings'
274*4882a593Smuzhiyun     Enable specific comma-separated list of \"from\" iconv encodings
275*4882a593Smuzhiyun     to be built-in.
276*4882a593Smuzhiyun     Disabled by default.
277*4882a593Smuzhiyun
278*4882a593Smuzhiyun`--enable-newlib-iconv-to-encodings'
279*4882a593Smuzhiyun     Enable specific comma-separated list of \"to\" iconv encodings
280*4882a593Smuzhiyun     to be built-in.
281*4882a593Smuzhiyun     Disabled by default.
282*4882a593Smuzhiyun
283*4882a593Smuzhiyun`--enable-newlib-iconv-external-ccs'
284*4882a593Smuzhiyun     Enable capabilities to load external CCS files for iconv.
285*4882a593Smuzhiyun     Disabled by default.
286*4882a593Smuzhiyun
287*4882a593Smuzhiyun`--disable-newlib-atexit-dynamic-alloc'
288*4882a593Smuzhiyun     Disable dynamic allocation of atexit entries.
289*4882a593Smuzhiyun     Most hosts and targets have it enabled in configure.host.
290*4882a593Smuzhiyun
291*4882a593Smuzhiyun`--enable-newlib-reent-small'
292*4882a593Smuzhiyun     Enable small reentrant struct support.
293*4882a593Smuzhiyun     Disabled by default.
294*4882a593Smuzhiyun
295*4882a593Smuzhiyun`--disable-newlib-fvwrite-in-streamio'
296*4882a593Smuzhiyun     NEWLIB implements the vector buffer mechanism to support stream IO
297*4882a593Smuzhiyun     buffering required by C standard.  This feature is possibly
298*4882a593Smuzhiyun     unnecessary for embedded systems which won't change file buffering
299*4882a593Smuzhiyun     with functions like `setbuf' or `setvbuf'.  The buffering mechanism
300*4882a593Smuzhiyun     still acts as default for STDIN/STDOUT/STDERR even if this option
301*4882a593Smuzhiyun     is specified.
302*4882a593Smuzhiyun     Enabled by default.
303*4882a593Smuzhiyun
304*4882a593Smuzhiyun`--disable-newlib-fseek-optimization'
305*4882a593Smuzhiyun     Disable fseek optimization.  It can decrease code size of application
306*4882a593Smuzhiyun     calling `fseek`.
307*4882a593Smuzhiyun     Enabled by default.
308*4882a593Smuzhiyun
309*4882a593Smuzhiyun`--disable-newlib-wide-orient'
310*4882a593Smuzhiyun     C99 states that each stream has an orientation, wide or byte.  This
311*4882a593Smuzhiyun     feature is possibly unnecessary for embedded systems which only do
312*4882a593Smuzhiyun     byte input/output operations on stream.  It can decrease code size
313*4882a593Smuzhiyun     by disable the feature.
314*4882a593Smuzhiyun     Enabled by default.
315*4882a593Smuzhiyun
316*4882a593Smuzhiyun`--enable-newlib-nano-malloc'
317*4882a593Smuzhiyun     NEWLIB has two implementations of malloc family's functions, one in
318*4882a593Smuzhiyun     `mallocr.c' and the other one in `nano-mallocr.c'.  This options
319*4882a593Smuzhiyun     enables the nano-malloc implementation, which is for small systems
320*4882a593Smuzhiyun     with very limited memory.  Note that this implementation does not
321*4882a593Smuzhiyun     support `--enable-malloc-debugging' any more.
322*4882a593Smuzhiyun     Disabled by default.
323*4882a593Smuzhiyun
324*4882a593Smuzhiyun`--disable-newlib-unbuf-stream-opt'
325*4882a593Smuzhiyun     NEWLIB does optimization when `fprintf to write only unbuffered unix
326*4882a593Smuzhiyun     file'.  It creates a temorary buffer to do the optimization that
327*4882a593Smuzhiyun     increases stack consumption by about `BUFSIZ' bytes.  This option
328*4882a593Smuzhiyun     disables the optimization and saves size of text and stack.
329*4882a593Smuzhiyun     Enabled by default.
330*4882a593Smuzhiyun
331*4882a593Smuzhiyun`--enable-multilib'
332*4882a593Smuzhiyun     Build many library versions.
333*4882a593Smuzhiyun     Enabled by default.
334*4882a593Smuzhiyun
335*4882a593Smuzhiyun`--enable-target-optspace'
336*4882a593Smuzhiyun     Optimize for space.
337*4882a593Smuzhiyun     Disabled by default.
338*4882a593Smuzhiyun
339*4882a593Smuzhiyun`--enable-malloc-debugging'
340*4882a593Smuzhiyun     Indicate malloc debugging requested.
341*4882a593Smuzhiyun     Disabled by default.
342*4882a593Smuzhiyun
343*4882a593Smuzhiyun`--enable-newlib-multithread'
344*4882a593Smuzhiyun     Enable support for multiple threads.
345*4882a593Smuzhiyun     Enabled by default.
346*4882a593Smuzhiyun
347*4882a593Smuzhiyun`--enable-newlib-iconv'
348*4882a593Smuzhiyun     Enable iconv library support.
349*4882a593Smuzhiyun     Disabled by default.
350*4882a593Smuzhiyun
351*4882a593Smuzhiyun`--enable-newlib-elix-level'
352*4882a593Smuzhiyun     Supply desired elix library level (1-4).  Please refer to HOWTO for
353*4882a593Smuzhiyun     more information about this option.
354*4882a593Smuzhiyun     Set to level 0 by default.
355*4882a593Smuzhiyun
356*4882a593Smuzhiyun`--disable-newlib-io-float'
357*4882a593Smuzhiyun     Disable printf/scanf family float support.
358*4882a593Smuzhiyun     Enabled by default.
359*4882a593Smuzhiyun
360*4882a593Smuzhiyun`--disable-newlib-supplied-syscalls'
361*4882a593Smuzhiyun     Disable newlib from supplying syscalls.
362*4882a593Smuzhiyun     Enabled by default.
363*4882a593Smuzhiyun
364*4882a593Smuzhiyun`--enable-lite-exit'
365*4882a593Smuzhiyun     Enable lite exit, a size-reduced implementation of exit that doesn't
366*4882a593Smuzhiyun     invoke clean-up functions such as _fini or global destructors.
367*4882a593Smuzhiyun     Disabled by default.
368*4882a593Smuzhiyun
369*4882a593SmuzhiyunRunning the Testsuite
370*4882a593Smuzhiyun=====================
371*4882a593Smuzhiyun
372*4882a593SmuzhiyunTo run newlib's testsuite, you'll need a site.exp in your home
373*4882a593Smuzhiyundirectory which points dejagnu to the proper baseboards directory and
374*4882a593Smuzhiyunthe proper exp file for your target.
375*4882a593Smuzhiyun
376*4882a593SmuzhiyunBefore running make check-target-newlib, set the DEJAGNU environment
377*4882a593Smuzhiyunvariable to point to ~/site.exp.
378*4882a593Smuzhiyun
379*4882a593SmuzhiyunHere is a sample site.exp:
380*4882a593Smuzhiyun
381*4882a593Smuzhiyun# Make sure we look in the right place for the board description files.
382*4882a593Smuzhiyunif ![info exists boards_dir] {
383*4882a593Smuzhiyun    set boards_dir {}
384*4882a593Smuzhiyun}
385*4882a593Smuzhiyunlappend boards_dir "your dejagnu/baseboards here"
386*4882a593Smuzhiyun
387*4882a593Smuzhiyunverbose "Global Config File: target_triplet is $target_triplet" 2
388*4882a593Smuzhiyun
389*4882a593Smuzhiyunglobal target_list
390*4882a593Smuzhiyuncase "$target_triplet" in {
391*4882a593Smuzhiyun
392*4882a593Smuzhiyun    { "mips-*elf*" } {
393*4882a593Smuzhiyun	set target_list "mips-sim"
394*4882a593Smuzhiyun    }
395*4882a593Smuzhiyun
396*4882a593Smuzhiyun    default {
397*4882a593Smuzhiyun	set target_list { "unix" }
398*4882a593Smuzhiyun    }
399*4882a593Smuzhiyun}
400*4882a593Smuzhiyun
401*4882a593Smuzhiyunmips-sim refers to an exp file in the baseboards directory.  You'll
402*4882a593Smuzhiyunneed to add the other targets you're testing to the case statement.
403*4882a593Smuzhiyun
404*4882a593SmuzhiyunNow type make check-target-newlib in the top-level build directory to
405*4882a593Smuzhiyunrun the testsuite.
406*4882a593Smuzhiyun
407*4882a593SmuzhiyunShared newlib
408*4882a593Smuzhiyun=============
409*4882a593Smuzhiyun
410*4882a593Smuzhiyunnewlib uses libtool when it is being compiled natively (with
411*4882a593Smuzhiyun--target=i[34567]86-pc-linux-gnu) on an i[34567]86-pc-linux-gnu
412*4882a593Smuzhiyunhost. This allows newlib to be compiled as a shared library.
413*4882a593Smuzhiyun
414*4882a593SmuzhiyunTo configure newlib, do the following from your build directory:
415*4882a593Smuzhiyun
416*4882a593Smuzhiyun$(source_dir)/src/configure --with-newlib --prefix=$(install_dir)
417*4882a593Smuzhiyun
418*4882a593Smuzhiyunconfigure will recognize that host == target ==
419*4882a593Smuzhiyuni[34567]86-pc-linux-gnu, so it will tell newlib to compile itself using
420*4882a593Smuzhiyunlibtool. By default, libtool will build shared and static versions of
421*4882a593Smuzhiyunnewlib.
422*4882a593Smuzhiyun
423*4882a593SmuzhiyunTo compile a program against shared newlib, do the following (where
424*4882a593Smuzhiyuntarget_install_dir = $(install_dir)/i[34567]86-pc-linux-gnu):
425*4882a593Smuzhiyun
426*4882a593Smuzhiyungcc -nostdlib $(target_install_dir)/lib/crt0.o progname.c -I $(target_install_dir)/include -L $(target_install_dir)/lib -lc -lm -lgcc
427*4882a593Smuzhiyun
428*4882a593SmuzhiyunTo run the program, make sure that $(target_install_dir)/lib is listed
429*4882a593Smuzhiyunin the LD_LIBRARY_PATH environment variable.
430*4882a593Smuzhiyun
431*4882a593SmuzhiyunTo create a static binary linked against newlib, do the following:
432*4882a593Smuzhiyun
433*4882a593Smuzhiyungcc -nostdlib -static $(target_install_dir)/lib/crt0.o progname.c -I $(target_install_dir)/include -L $(target_install_dir)/lib -lc -lm
434*4882a593Smuzhiyun
435*4882a593Smuzhiyunlibtool can be instructed to produce only static libraries. To build
436*4882a593Smuzhiyunnewlib as a static library only, do the following from your build
437*4882a593Smuzhiyundirectory:
438*4882a593Smuzhiyun
439*4882a593Smuzhiyun$(source_dir)/src/configure --with-newlib --prefix=$(install_dir) --disable-shared
440*4882a593Smuzhiyun
441*4882a593SmuzhiyunRegenerating Configuration Files
442*4882a593Smuzhiyun================================
443*4882a593Smuzhiyun
444*4882a593SmuzhiyunAt times you will need to make changes to configure.in and Makefile.am files.
445*4882a593SmuzhiyunThis will mean that configure and Makefile.in files will need to be
446*4882a593Smuzhiyunregenerated.
447*4882a593Smuzhiyun
448*4882a593SmuzhiyunAt the top level of newlib is the file: acinclude.m4.  This file contains
449*4882a593Smuzhiyunthe definition of the NEWLIB_CONFIGURE macro which is used by all configure.in
450*4882a593Smuzhiyunfiles in newlib.  You will notice that each directory in newlib containing
451*4882a593Smuzhiyuna configure.in file also contains an aclocal.m4 file.  This file is
452*4882a593Smuzhiyungenerated by issuing: aclocal -I${relative_path_to_toplevel_newlib_dir}
453*4882a593Smuzhiyun-I${relative_path_to_toplevel_src_dir}
454*4882a593SmuzhiyunThe first relative directory is to access acinclude.m4.  The second relative
455*4882a593Smuzhiyundirectory is to access libtool information in the top-level src directory.
456*4882a593Smuzhiyun
457*4882a593SmuzhiyunFor example, to regenerate aclocal.m4 in newlib/libc/machine/arm:
458*4882a593Smuzhiyun
459*4882a593Smuzhiyun  aclocal -I ../../.. -I ../../../..
460*4882a593Smuzhiyun
461*4882a593SmuzhiyunNote that if the top level acinclude.m4 is altered, every aclocal.m4 file
462*4882a593Smuzhiyunin newlib should be regenerated.
463*4882a593Smuzhiyun
464*4882a593SmuzhiyunIf the aclocal.m4 file is regenerated due to a change in acinclude.m4 or
465*4882a593Smuzhiyunif a configure.in file is modified, the corresponding configure file in the
466*4882a593Smuzhiyundirectory must be regenerated using autoconf.  No parameters are necessary.
467*4882a593SmuzhiyunIn the previous example, we would issue:
468*4882a593Smuzhiyun
469*4882a593Smuzhiyun  autoconf
470*4882a593Smuzhiyun
471*4882a593Smuzhiyunfrom the newlib/libc/machine/arm directory.
472*4882a593Smuzhiyun
473*4882a593SmuzhiyunIf you have regenerated a configure file or if you have modified a Makefile.am
474*4882a593Smuzhiyunfile, you will need to regenerate the appropriate Makefile.in file(s).
475*4882a593SmuzhiyunFor newlib, automake is a bit trickier.  First of all, all Makefile.in
476*4882a593Smuzhiyunfiles in newlib (and libgloss) are generated using the --cygnus option
477*4882a593Smuzhiyunof automake.
478*4882a593Smuzhiyun
479*4882a593SmuzhiyunMakefile.in files are generated from the nearest directory up the chain
480*4882a593Smuzhiyunwhich contains a configure.in file.  In most cases, this is the same
481*4882a593Smuzhiyundirectory containing configure.in, but there are exceptions.
482*4882a593SmuzhiyunFor example, the newlib/libc directory has a number of
483*4882a593Smuzhiyunsubdirectories that do not contain their own configure.in files (e.g. stdio).
484*4882a593SmuzhiyunFor these directories, you must issue the automake command from newlib/libc
485*4882a593Smuzhiyunwhich is the nearest parent directory that contains a configure.in.
486*4882a593SmuzhiyunWhen you issue the automake command, you specify the subdirectory for
487*4882a593Smuzhiyunthe Makefile.in you are regenerating.  For example:
488*4882a593Smuzhiyun
489*4882a593Smuzhiyun   automake --cygnus stdio/Makefile stdlib/Makefile
490*4882a593Smuzhiyun
491*4882a593SmuzhiyunNote how multiple Makefile.in files can be created in the same step.  You
492*4882a593Smuzhiyunwould not specify machine/Makefile or sys/Makefile in the previous example
493*4882a593Smuzhiyunbecause both of these subdirectories contain their own configure.in files.
494*4882a593SmuzhiyunOne would change to each of these subdirectories and in turn issue:
495*4882a593Smuzhiyun
496*4882a593Smuzhiyun   automake --cygnus Makefile
497*4882a593Smuzhiyun
498*4882a593SmuzhiyunLet's say you create a new machine directory XXXX off of newlib/libc/machine.
499*4882a593SmuzhiyunAfter creating a new configure.in and Makefile.am file, you would issue:
500*4882a593Smuzhiyun
501*4882a593Smuzhiyun   aclocal -I ../../..
502*4882a593Smuzhiyun   autoconf
503*4882a593Smuzhiyun   automake --cygnus Makefile
504*4882a593Smuzhiyun
505*4882a593Smuzhiyunfrom newlib/libc/machine/XXXX
506*4882a593Smuzhiyun
507*4882a593SmuzhiyunIt is strongly advised that you use an adequate version of autotools.
508*4882a593SmuzhiyunFor this latest release, the following were used: autoconf 2.68, aclocal 1.11.6, and
509*4882a593Smuzhiyunautomake 1.11.6.
510*4882a593Smuzhiyun
511*4882a593SmuzhiyunReporting Bugs
512*4882a593Smuzhiyun==============
513*4882a593Smuzhiyun
514*4882a593SmuzhiyunThe correct address for reporting bugs found in NEWLIB is
515*4882a593Smuzhiyun"newlib@sourceware.org".  Please email all bug reports to that
516*4882a593Smuzhiyunaddress.  Please include the NEWLIB version number (e.g., newlib-2.0.0),
517*4882a593Smuzhiyunand how you configured it (e.g., "sun4 host and m68k-aout target").
518*4882a593SmuzhiyunSince NEWLIB supports many different configurations, it is important
519*4882a593Smuzhiyunthat you be precise about this.
520*4882a593Smuzhiyun
521*4882a593SmuzhiyunArchives of the newlib mailing list are on-line, see
522*4882a593Smuzhiyun	http://sourceware.org/ml/newlib/
523