1 README for newlib-1.17.0 release
2 (mostly cribbed from the README in the gdb-4.13 release)
4 This is `newlib', a simple ANSI C library, math library, and collection
5 of board support packages.
7 The newlib and libgloss subdirectories are a collection of software from
8 several sources, each wi6h their own copyright and license. See the file
9 COPYING.NEWLIB for details. The rest of the release tree is under either
10 the GNU GPL or LGPL licenses.
12 THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
13 IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
14 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
17 Unpacking and Installation -- quick overview
18 ==========================
20 When you unpack the newlib-1.17.0.tar.gz file, you'll find a directory
21 called `newlib-1.17.0', which contains:
23 COPYING config/ install-sh* mpw-configure
24 COPYING.LIB config-ml.in libgloss/ mpw-install
25 COPYING.NEWLIB config.guess* mkinstalldirs* newlib/
26 CYGNUS config.sub* move-if-change* symlink-tree*
27 ChangeLog configure* mpw-README texinfo/
28 Makefile.in configure.in mpw-build.in
29 README etc/ mpw-config.in
31 To build NEWLIB, you must follow the instructions in the section entitled
34 This will configure and build all the libraries and crt0 (if one exists).
35 If `configure' can't determine your host system type, specify one as its
36 argument, e.g., sun4 or sun4sol2. NEWLIB is most often used in cross
39 NOTE THAT YOU MUST HAVE ALREADY BUILT AND INSTALLED GCC and BINUTILS.
45 Newlib documentation is available on the net via:
46 http://sources.redhat.com/newlib/docs.html
48 All the documentation for NEWLIB comes as part of the machine-readable
49 distribution. The documentation is written in Texinfo format, which is
50 a documentation system that uses a single source file to produce both
51 on-line information and a printed manual. You can use one of the Info
52 formatting commands to create the on-line version of the documentation
53 and TeX (or `texi2roff') to typeset the printed version.
55 If you want to format these Info files yourself, you need one of the
56 Info formatting programs, such as `texinfo-format-buffer' or `makeinfo'.
58 If you want to typeset and print copies of this manual, you need TeX,
59 a program to print its DVI output files, and `texinfo.tex', the Texinfo
62 TeX is a typesetting program; it does not print files directly, but
63 produces output files called DVI files. To print a typeset document,
64 you need a program to print DVI files. If your system has TeX
65 installed, chances are it has such a program. The precise command to
66 use depends on your system; `lpr -d' is common; another (for PostScript
67 devices) is `dvips'. The DVI print command may require a file name
68 without any extension or a `.dvi' extension.
70 TeX also requires a macro definitions file called `texinfo.tex'.
71 This file tells TeX how to typeset a document written in Texinfo
72 format. On its own, TeX cannot read, much less typeset a Texinfo file.
73 `texinfo.tex' is distributed with NEWLIB and is located in the
74 `newlib-VERSION-NUMBER/texinfo' directory.
81 To compile NEWLIB, you must build it in a directory separate from
82 the source directory. If you want to run NEWLIB versions for several host
83 or target machines, you need a different `newlib' compiled for each combination
84 of host and target. `configure' is designed to make this easy by allowing
85 you to generate each configuration in a separate subdirectory.
86 If your `make' program handles the `VPATH' feature correctly (like GNU `make')
87 running `make' in each of these directories builds the `newlib' libraries
90 To build `newlib' in a specific directory, run `configure' with the
91 `--srcdir' option to specify where to find the source. (You also need
92 to specify a path to find `configure' itself from your working
93 directory. If the path to `configure' would be the same as the
94 argument to `--srcdir', you can leave out the `--srcdir' option; it
97 For example, with version 1.17.0, you can build NEWLIB in a separate
98 directory for a Sun 4 cross m68k-aout environment like this:
101 mkdir ../newlib-m68k-aout
102 cd ../newlib-m68k-aout
103 ../newlib-1.17.0/configure --host=sun4 --target=m68k-aout
106 When `configure' builds a configuration using a remote source
107 directory, it creates a tree for the binaries with the same structure
108 (and using the same names) as the tree under the source directory. In
109 the example, you'd find the Sun 4 library `libiberty.a' in the
110 directory `newlib-m68k-aout/libiberty', and NEWLIB itself in
111 `newlib-m68k-aout/newlib'.
113 When you run `make' to build a program or library, you must run it
114 in a configured directory--whatever directory you were in when you
115 called `configure' (or one of its subdirectories).
117 The `Makefile' that `configure' generates in each source directory
118 also runs recursively. If you type `make' in a source directory such
119 as `newlib-1.17.0' (or in a separate configured directory configured with
120 `--srcdir=PATH/newlib-1.17.0'), you will build all the required libraries.
122 When you have multiple hosts or targets configured in separate
123 directories, you can run `make' on them in parallel (for example, if
124 they are NFS-mounted on each of the hosts); they will not interfere
128 Specifying names for hosts and targets
129 ======================================
131 The specifications used for hosts and targets in the `configure'
132 script are based on a three-part naming scheme, but some short
133 predefined aliases are also supported. The full naming scheme encodes
134 three pieces of information in the following pattern:
136 ARCHITECTURE-VENDOR-OS
138 For example, you can use the alias `sun4' as a HOST argument or in a
139 `--target=TARGET' option. The equivalent full name is
142 The `configure' script accompanying NEWLIB does not provide any query
143 facility to list all supported host and target names or aliases.
144 `configure' calls the Bourne shell script `config.sub' to map
145 abbreviations to full names; you can read the script, if you wish, or
146 you can use it to test your guesses on abbreviations--for example:
152 % sh config.sub decstation
154 % sh config.sub hp300bsd
156 % sh config.sub i386v
158 % sh config.sub i786v
159 Invalid configuration `i786v': machine `i786v' not recognized
161 The Build, Host and Target Concepts in newlib
162 =============================================
164 The build, host and target concepts are defined for gcc as follows:
166 build: the platform on which gcc is built.
167 host: the platform on which gcc is run.
168 target: the platform for which gcc generates code.
170 Since newlib is a library, the target concept does not apply to it, and the
171 build, host, and target options given to the top-level configure script must
172 be changed for newlib's use.
174 The options are shifted according to these correspondences:
176 gcc's build platform has no equivalent in newlib.
177 gcc's host platform is newlib's build platform.
178 gcc's target platform is newlib's host platform.
179 and as mentioned before, newlib has no concept of target.
184 Here is a summary of the `configure' options and arguments that are
185 most often useful for building NEWLIB. `configure' also has several other
186 options not listed here.
191 [--target=TARGET] HOST
193 You may introduce options with a single `-' rather than `--' if you
194 prefer; but you may abbreviate option names if you use `--'.
197 Display a quick summary of how to invoke `configure'.
200 Configure the source to install programs and files in directory
204 Configure the source to install host-dependent files in directory
208 *Warning: using this option requires GNU `make', or another `make'
209 that compatibly implements the `VPATH' feature.
210 Use this option to make configurations in directories separate
211 from the NEWLIB source directories. Among other things, you can use
212 this to build (or maintain) several configurations simultaneously,
213 in separate directories. `configure' writes configuration
214 specific files in the current directory, but arranges for them to
215 use the source in the directory PATH. `configure' will create
216 directories under the working directory in parallel to the source
217 directories below PATH.
220 Configure only the directory level where `configure' is executed;
221 do not propagate configuration to subdirectories.
224 Configure NEWLIB for running on the specified TARGET.
226 There is no convenient way to generate a list of all available
230 Configure NEWLIB to be built using a cross compiler running on
233 There is no convenient way to generate a list of all available
236 Running the Testsuite
237 =====================
239 To run newlib's testsuite, you'll need a site.exp in your home
240 directory which points dejagnu to the proper baseboards directory and
241 the proper exp file for your target.
243 Before running make check-target-newlib, set the DEJAGNU environment
244 variable to point to ~/site.exp.
246 Here is a sample site.exp:
248 # Make sure we look in the right place for the board description files.
249 if ![info exists boards_dir] {
252 lappend boards_dir "your dejagnu/baseboards here"
254 verbose "Global Config File: target_triplet is $target_triplet" 2
257 case "$target_triplet" in {
260 set target_list "mips-sim"
264 set target_list { "unix" }
268 mips-sim refers to an exp file in the baseboards directory. You'll
269 need to add the other targets you're testing to the case statement.
271 Now type make check-target-newlib in the top-level build directory to
277 newlib uses libtool when it is being compiled natively (with
278 --target=i[34567]86-pc-linux-gnu) on an i[34567]86-pc-linux-gnu
279 host. This allows newlib to be compiled as a shared library.
281 To configure newlib, do the following from your build directory:
283 $(source_dir)/src/configure --with-newlib --prefix=$(install_dir)
285 configure will recognize that host == target ==
286 i[34567]86-pc-linux-gnu, so it will tell newlib to compile itself using
287 libtool. By default, libtool will build shared and static versions of
290 To compile a program against shared newlib, do the following (where
291 target_install_dir = $(install_dir)/i[34567]86-pc-linux-gnu):
293 gcc -nostdlib $(target_install_dir)/lib/crt0.o progname.c -I $(target_install_dir)/include -L $(target_install_dir)/lib -lc -lm -lgcc
295 To run the program, make sure that $(target_install_dir)/lib is listed
296 in the LD_LIBRARY_PATH environment variable.
298 To create a static binary linked against newlib, do the following:
300 gcc -nostdlib -static $(target_install_dir)/lib/crt0.o progname.c -I $(target_install_dir)/include -L $(target_install_dir)/lib -lc -lm
302 libtool can be instructed to produce only static libraries. To build
303 newlib as a static library only, do the following from your build
306 $(source_dir)/src/configure --with-newlib --prefix=$(install_dir) --disable-shared
308 Regenerating Configuration Files
309 ================================
311 At times you will need to make changes to configure.in and Makefile.am files.
312 This will mean that configure and Makefile.in files will need to be
315 At the top level of newlib is the file: acinclude.m4. This file contains
316 the definition of the NEWLIB_CONFIGURE macro which is used by all configure.in
317 files in newlib. You will notice that each directory in newlib containing
318 a configure.in file also contains an aclocal.m4 file. This file is
319 generated by issuing: aclocal -I${relative_path_to_toplevel_newlib_dir}
320 -I${relative_path_to_toplevel_src_dir}
321 The first relative directory is to access acinclude.m4. The second relative
322 directory is to access libtool information in the top-level src directory.
324 For example, to regenerate aclocal.m4 in newlib/libc/machine/arm:
326 aclocal -I ../../.. -I ../../../..
328 Note that if the top level acinclude.m4 is altered, every aclocal.m4 file
329 in newlib should be regenerated.
331 If the aclocal.m4 file is regenerated due to a change in acinclude.m4 or
332 if a configure.in file is modified, the corresponding configure file in the
333 directory must be regenerated using autoconf. No parameters are necessary.
334 In the previous example, we would issue:
338 from the newlib/libc/machine/arm directory.
340 If you have regenerated a configure file or if you have modified a Makefile.am
341 file, you will need to regenerate the appropriate Makefile.in file(s).
342 For newlib, automake is a bit trickier. First of all, all Makefile.in
343 files in newlib (and libgloss) are generated using the --cygnus option
346 Makefile.in files are generated from the nearest directory up the chain
347 which contains a configure.in file. In most cases, this is the same
348 directory containing configure.in, but there are exceptions.
349 For example, the newlib/libc directory has a number of
350 subdirectories that do not contain their own configure.in files (e.g. stdio).
351 For these directories, you must issue the automake command from newlib/libc
352 which is the nearest parent directory that contains a configure.in.
353 When you issue the automake command, you specify the subdirectory for
354 the Makefile.in you are regenerating. For example:
356 automake --cygnus stdio/Makefile stdlib/Makefile
358 Note how multiple Makefile.in files can be created in the same step. You
359 would not specify machine/Makefile or sys/Makefile in the previous example
360 because both of these subdirectories contain their own configure.in files.
361 One would change to each of these subdirectories and in turn issue:
363 automake --cygnus Makefile
365 Let's say you create a new machine directory XXXX off of newlib/libc/machine.
366 After creating a new configure.in and Makefile.am file, you would issue:
370 automake --cygnus Makefile
372 from newlib/libc/machine/XXXX
374 It is strongly advised that you use an adequate version of autotools.
375 For this latest release, this would be: autoconf 2.59, aclocal 1.9.6, and
381 The correct address for reporting bugs found in NEWLIB is
382 "newlib@sources.redhat.com". Please email all bug reports to that
383 address. Please include the NEWLIB version number (e.g., newlib-1.17.0),
384 and how you configured it (e.g., "sun4 host and m68k-aout target").
385 Since NEWLIB supports many different configurations, it is important
386 that you be precise about this.
388 Archives of the newlib mailing list are on-line, see
389 http://sources.redhat.com/ml/newlib/