1 | README for newlib-3.0.0 release |
---|
2 | (mostly cribbed from the README in the gdb-4.13 release) |
---|
3 | |
---|
4 | This is `newlib', a simple ANSI C library, math library, and collection |
---|
5 | of board support packages. |
---|
6 | |
---|
7 | Prior to the 3.0.0 release, newlib supported both ANSI and K&R-style |
---|
8 | compilers. As of 3.0.0, K&R is no longer supported. |
---|
9 | |
---|
10 | The newlib and libgloss subdirectories are a collection of software from |
---|
11 | several sources, each with their own copyright and license. See the file |
---|
12 | COPYING.NEWLIB for details. The rest of the release tree is under either |
---|
13 | the GNU GPL or LGPL licenses. |
---|
14 | |
---|
15 | THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR |
---|
16 | IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED |
---|
17 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
---|
18 | |
---|
19 | |
---|
20 | Unpacking and Installation -- quick overview |
---|
21 | ========================== |
---|
22 | |
---|
23 | When you unpack the newlib-3.0.0.tar.gz file, you'll find a directory |
---|
24 | called `newlib-3.0.0', which contains: |
---|
25 | |
---|
26 | COPYING config/ install-sh* mpw-configure |
---|
27 | COPYING.LIB config-ml.in libgloss/ mpw-install |
---|
28 | COPYING.NEWLIB config.guess* mkinstalldirs* newlib/ |
---|
29 | CYGNUS config.sub* move-if-change* symlink-tree* |
---|
30 | ChangeLog configure* mpw-README texinfo/ |
---|
31 | Makefile.in configure.in mpw-build.in |
---|
32 | README etc/ mpw-config.in |
---|
33 | |
---|
34 | To build NEWLIB, you must follow the instructions in the section entitled |
---|
35 | "Compiling NEWLIB". |
---|
36 | |
---|
37 | This will configure and build all the libraries and crt0 (if one exists). |
---|
38 | If `configure' can't determine your host system type, specify one as its |
---|
39 | argument, e.g., sun4 or sun4sol2. NEWLIB is most often used in cross |
---|
40 | environments. |
---|
41 | |
---|
42 | NOTE THAT YOU MUST HAVE ALREADY BUILT AND INSTALLED GCC and BINUTILS. |
---|
43 | |
---|
44 | |
---|
45 | More Documentation |
---|
46 | ================== |
---|
47 | |
---|
48 | Newlib documentation is available on the net via: |
---|
49 | http://sourceware.org/newlib/docs.html |
---|
50 | |
---|
51 | All the documentation for NEWLIB comes as part of the machine-readable |
---|
52 | distribution. The documentation is written in Texinfo format, which is |
---|
53 | a documentation system that uses a single source file to produce both |
---|
54 | on-line information and a printed manual. You can use one of the Info |
---|
55 | formatting commands to create the on-line version of the documentation |
---|
56 | and TeX (or `texi2roff') to typeset the printed version. |
---|
57 | |
---|
58 | If you want to format these Info files yourself, you need one of the |
---|
59 | Info formatting programs, such as `texinfo-format-buffer' or `makeinfo'. |
---|
60 | |
---|
61 | If you want to typeset and print copies of this manual, you need TeX, |
---|
62 | a program to print its DVI output files, and `texinfo.tex', the Texinfo |
---|
63 | definitions file. |
---|
64 | |
---|
65 | TeX is a typesetting program; it does not print files directly, but |
---|
66 | produces output files called DVI files. To print a typeset document, |
---|
67 | you need a program to print DVI files. If your system has TeX |
---|
68 | installed, chances are it has such a program. The precise command to |
---|
69 | use depends on your system; `lpr -d' is common; another (for PostScript |
---|
70 | devices) is `dvips'. The DVI print command may require a file name |
---|
71 | without any extension or a `.dvi' extension. |
---|
72 | |
---|
73 | TeX also requires a macro definitions file called `texinfo.tex'. |
---|
74 | This file tells TeX how to typeset a document written in Texinfo |
---|
75 | format. On its own, TeX cannot read, much less typeset a Texinfo file. |
---|
76 | `texinfo.tex' is distributed with NEWLIB and is located in the |
---|
77 | `newlib-VERSION-NUMBER/texinfo' directory. |
---|
78 | |
---|
79 | |
---|
80 | |
---|
81 | Compiling NEWLIB |
---|
82 | ================ |
---|
83 | |
---|
84 | To compile NEWLIB, you must build it in a directory separate from |
---|
85 | the source directory. If you want to run NEWLIB versions for several host |
---|
86 | or target machines, you need a different `newlib' compiled for each combination |
---|
87 | of host and target. `configure' is designed to make this easy by allowing |
---|
88 | you to generate each configuration in a separate subdirectory. |
---|
89 | If your `make' program handles the `VPATH' feature correctly (like GNU `make') |
---|
90 | running `make' in each of these directories builds the `newlib' libraries |
---|
91 | specified there. |
---|
92 | |
---|
93 | To build `newlib' in a specific directory, run `configure' with the |
---|
94 | `--srcdir' option to specify where to find the source. (You also need |
---|
95 | to specify a path to find `configure' itself from your working |
---|
96 | directory. If the path to `configure' would be the same as the |
---|
97 | argument to `--srcdir', you can leave out the `--srcdir' option; it |
---|
98 | will be assumed.) |
---|
99 | |
---|
100 | For example, with version 3.0.0, you can build NEWLIB in a separate |
---|
101 | directory for a Sun 4 cross m68k-aout environment like this: |
---|
102 | |
---|
103 | cd newlib-3.0.0 |
---|
104 | mkdir ../newlib-m68k-aout |
---|
105 | cd ../newlib-m68k-aout |
---|
106 | ../newlib-3.0.0/configure --host=sun4 --target=m68k-aout |
---|
107 | make |
---|
108 | |
---|
109 | When `configure' builds a configuration using a remote source |
---|
110 | directory, it creates a tree for the binaries with the same structure |
---|
111 | (and using the same names) as the tree under the source directory. In |
---|
112 | the example, you'd find the Sun 4 library `libiberty.a' in the |
---|
113 | directory `newlib-m68k-aout/libiberty', and NEWLIB itself in |
---|
114 | `newlib-m68k-aout/newlib'. |
---|
115 | |
---|
116 | When you run `make' to build a program or library, you must run it |
---|
117 | in a configured directory--whatever directory you were in when you |
---|
118 | called `configure' (or one of its subdirectories). |
---|
119 | |
---|
120 | The `Makefile' that `configure' generates in each source directory |
---|
121 | also runs recursively. If you type `make' in a source directory such |
---|
122 | as `newlib-3.0.0' (or in a separate configured directory configured with |
---|
123 | `--srcdir=PATH/newlib-3.0.0'), you will build all the required libraries. |
---|
124 | |
---|
125 | When you have multiple hosts or targets configured in separate |
---|
126 | directories, you can run `make' on them in parallel (for example, if |
---|
127 | they are NFS-mounted on each of the hosts); they will not interfere |
---|
128 | with each other. |
---|
129 | |
---|
130 | |
---|
131 | Specifying names for hosts and targets |
---|
132 | ====================================== |
---|
133 | |
---|
134 | The specifications used for hosts and targets in the `configure' |
---|
135 | script are based on a three-part naming scheme, but some short |
---|
136 | predefined aliases are also supported. The full naming scheme encodes |
---|
137 | three pieces of information in the following pattern: |
---|
138 | |
---|
139 | ARCHITECTURE-VENDOR-OS |
---|
140 | |
---|
141 | For example, you can use the alias `sun4' as a HOST argument or in a |
---|
142 | `--target=TARGET' option. The equivalent full name is |
---|
143 | `sparc-sun-sunos4'. |
---|
144 | |
---|
145 | The `configure' script accompanying NEWLIB does not provide any query |
---|
146 | facility to list all supported host and target names or aliases. |
---|
147 | `configure' calls the Bourne shell script `config.sub' to map |
---|
148 | abbreviations to full names; you can read the script, if you wish, or |
---|
149 | you can use it to test your guesses on abbreviations--for example: |
---|
150 | |
---|
151 | % sh config.sub sun4 |
---|
152 | sparc-sun-sunos4.1.1 |
---|
153 | % sh config.sub sun3 |
---|
154 | m68k-sun-sunos4.1.1 |
---|
155 | % sh config.sub decstation |
---|
156 | mips-dec-ultrix4.2 |
---|
157 | % sh config.sub hp300bsd |
---|
158 | m68k-hp-bsd |
---|
159 | % sh config.sub i386v |
---|
160 | i386-pc-sysv |
---|
161 | % sh config.sub i786v |
---|
162 | Invalid configuration `i786v': machine `i786v' not recognized |
---|
163 | |
---|
164 | The Build, Host and Target Concepts in newlib |
---|
165 | ============================================= |
---|
166 | |
---|
167 | The build, host and target concepts are defined for gcc as follows: |
---|
168 | |
---|
169 | build: the platform on which gcc is built. |
---|
170 | host: the platform on which gcc is run. |
---|
171 | target: the platform for which gcc generates code. |
---|
172 | |
---|
173 | Since newlib is a library, the target concept does not apply to it, and the |
---|
174 | build, host, and target options given to the top-level configure script must |
---|
175 | be changed for newlib's use. |
---|
176 | |
---|
177 | The build system shifts the options according to these correspondences: |
---|
178 | |
---|
179 | gcc's build platform has no equivalent in newlib. |
---|
180 | gcc's host platform is newlib's build platform. |
---|
181 | gcc's target platform is newlib's host platform. |
---|
182 | and as mentioned before, newlib has no concept of target. |
---|
183 | |
---|
184 | In summary: the --target=TARGET switch to the top-level configure |
---|
185 | script configures newlib's host platform. |
---|
186 | |
---|
187 | `configure' options |
---|
188 | =================== |
---|
189 | |
---|
190 | Here is a summary of the `configure' options and arguments that are |
---|
191 | most often useful for building NEWLIB. `configure' also has several other |
---|
192 | options not listed here. |
---|
193 | |
---|
194 | configure [--help] |
---|
195 | [--prefix=DIR] |
---|
196 | [--srcdir=PATH] |
---|
197 | [--target=TARGET] HOST |
---|
198 | |
---|
199 | You may introduce options with a single `-' rather than `--' if you |
---|
200 | prefer; but you may abbreviate option names if you use `--'. |
---|
201 | |
---|
202 | `--help' |
---|
203 | Display a quick summary of how to invoke `configure'. |
---|
204 | |
---|
205 | `--prefix=DIR' |
---|
206 | Configure the source to install programs and files in directory |
---|
207 | `DIR'. |
---|
208 | |
---|
209 | `--exec-prefix=DIR' |
---|
210 | Configure the source to install host-dependent files in directory |
---|
211 | `DIR'. |
---|
212 | |
---|
213 | `--srcdir=PATH' |
---|
214 | *Warning: using this option requires GNU `make', or another `make' |
---|
215 | that compatibly implements the `VPATH' feature. |
---|
216 | Use this option to make configurations in directories separate |
---|
217 | from the NEWLIB source directories. Among other things, you can use |
---|
218 | this to build (or maintain) several configurations simultaneously, |
---|
219 | in separate directories. `configure' writes configuration |
---|
220 | specific files in the current directory, but arranges for them to |
---|
221 | use the source in the directory PATH. `configure' will create |
---|
222 | directories under the working directory in parallel to the source |
---|
223 | directories below PATH. |
---|
224 | |
---|
225 | `--norecursion' |
---|
226 | Configure only the directory level where `configure' is executed; |
---|
227 | do not propagate configuration to subdirectories. |
---|
228 | |
---|
229 | `--target=TARGET' |
---|
230 | Configure NEWLIB for running on the specified TARGET. |
---|
231 | |
---|
232 | There is no convenient way to generate a list of all available |
---|
233 | targets. |
---|
234 | |
---|
235 | `HOST ...' |
---|
236 | Configure NEWLIB to be built using a cross compiler running on |
---|
237 | the specified HOST. |
---|
238 | |
---|
239 | There is no convenient way to generate a list of all available |
---|
240 | hosts. |
---|
241 | |
---|
242 | To fit diverse usage models, NEWLIB supports a group of configuration |
---|
243 | options so that library features can be turned on/off according to |
---|
244 | target system's requirements. |
---|
245 | |
---|
246 | One feature can be enabled by specifying `--enable-FEATURE=yes' or |
---|
247 | `--enable-FEATURE'. Or it can be disable by `--enable-FEATURE=no' or |
---|
248 | `--disable-FEATURE'. |
---|
249 | |
---|
250 | `--enable-newlib-io-pos-args' |
---|
251 | Enable printf-family positional arg support. |
---|
252 | Disabled by default, but some hosts enable it in configure.host. |
---|
253 | |
---|
254 | `--enable-newlib-io-c99-formats' |
---|
255 | Enable C99 support in IO functions like printf/scanf. |
---|
256 | Disabled by default, but some hosts enable it in configure.host. |
---|
257 | |
---|
258 | `--enable-newlib-register-fini' |
---|
259 | Enable finalization function registration using atexit. |
---|
260 | Disabled by default. |
---|
261 | |
---|
262 | `--enable-newlib-io-long-long' |
---|
263 | Enable long long type support in IO functions like printf/scanf. |
---|
264 | Disabled by default, but many hosts enable it in configure.host. |
---|
265 | |
---|
266 | `--enable-newlib-io-long-double' |
---|
267 | Enable long double type support in IO functions printf/scanf. |
---|
268 | Disabled by default, but some hosts enable it in configure.host. |
---|
269 | |
---|
270 | `--enable-newlib-mb' |
---|
271 | Enable multibyte support. |
---|
272 | Disabled by default. |
---|
273 | |
---|
274 | `--enable-newlib-iconv-encodings' |
---|
275 | Enable specific comma-separated list of bidirectional iconv |
---|
276 | encodings to be built-in. |
---|
277 | Disabled by default. |
---|
278 | |
---|
279 | `--enable-newlib-iconv-from-encodings' |
---|
280 | Enable specific comma-separated list of \"from\" iconv encodings |
---|
281 | to be built-in. |
---|
282 | Disabled by default. |
---|
283 | |
---|
284 | `--enable-newlib-iconv-to-encodings' |
---|
285 | Enable specific comma-separated list of \"to\" iconv encodings |
---|
286 | to be built-in. |
---|
287 | Disabled by default. |
---|
288 | |
---|
289 | `--enable-newlib-iconv-external-ccs' |
---|
290 | Enable capabilities to load external CCS files for iconv. |
---|
291 | Disabled by default. |
---|
292 | |
---|
293 | `--disable-newlib-atexit-dynamic-alloc' |
---|
294 | Disable dynamic allocation of atexit entries. |
---|
295 | Most hosts and targets have it enabled in configure.host. |
---|
296 | |
---|
297 | `--enable-newlib-global-atexit' |
---|
298 | Enable atexit data structure as global variable. By doing so it is |
---|
299 | move out of _reent structure, and can be garbage collected if atexit |
---|
300 | is not referenced. |
---|
301 | Disabled by default. |
---|
302 | |
---|
303 | `--enable-newlib-global-stdio-streams' |
---|
304 | Enable to move the stdio stream FILE objects out of struct _reent and make |
---|
305 | them global. The stdio stream pointers of struct _reent are initialized |
---|
306 | to point to the global stdio FILE stream objects. |
---|
307 | Disabled by default. |
---|
308 | |
---|
309 | `--enable-newlib-reent-small' |
---|
310 | Enable small reentrant struct support. |
---|
311 | Disabled by default. |
---|
312 | |
---|
313 | `--disable-newlib-fvwrite-in-streamio' |
---|
314 | NEWLIB implements the vector buffer mechanism to support stream IO |
---|
315 | buffering required by C standard. This feature is possibly |
---|
316 | unnecessary for embedded systems which won't change file buffering |
---|
317 | with functions like `setbuf' or `setvbuf'. The buffering mechanism |
---|
318 | still acts as default for STDIN/STDOUT/STDERR even if this option |
---|
319 | is specified. |
---|
320 | Enabled by default. |
---|
321 | |
---|
322 | `--disable-newlib-fseek-optimization' |
---|
323 | Disable fseek optimization. It can decrease code size of application |
---|
324 | calling `fseek`. |
---|
325 | Enabled by default. |
---|
326 | |
---|
327 | `--disable-newlib-wide-orient' |
---|
328 | C99 states that each stream has an orientation, wide or byte. This |
---|
329 | feature is possibly unnecessary for embedded systems which only do |
---|
330 | byte input/output operations on stream. It can decrease code size |
---|
331 | by disable the feature. |
---|
332 | Enabled by default. |
---|
333 | |
---|
334 | `--enable-newlib-nano-malloc' |
---|
335 | NEWLIB has two implementations of malloc family's functions, one in |
---|
336 | `mallocr.c' and the other one in `nano-mallocr.c'. This options |
---|
337 | enables the nano-malloc implementation, which is for small systems |
---|
338 | with very limited memory. Note that this implementation does not |
---|
339 | support `--enable-malloc-debugging' any more. |
---|
340 | Disabled by default. |
---|
341 | |
---|
342 | `--disable-newlib-unbuf-stream-opt' |
---|
343 | NEWLIB does optimization when `fprintf to write only unbuffered unix |
---|
344 | file'. It creates a temorary buffer to do the optimization that |
---|
345 | increases stack consumption by about `BUFSIZ' bytes. This option |
---|
346 | disables the optimization and saves size of text and stack. |
---|
347 | Enabled by default. |
---|
348 | |
---|
349 | `--enable-newlib-long-time_t' |
---|
350 | Define time_t to long. On platforms with a 32-bit long type, this gives |
---|
351 | raise to the year 2038 problem. The default type for time_t is a signed |
---|
352 | 64-bit integer on most systems. |
---|
353 | Disabled by default. |
---|
354 | |
---|
355 | `--enable-multilib' |
---|
356 | Build many library versions. |
---|
357 | Enabled by default. |
---|
358 | |
---|
359 | `--enable-target-optspace' |
---|
360 | Optimize for space. |
---|
361 | Disabled by default. |
---|
362 | |
---|
363 | `--enable-malloc-debugging' |
---|
364 | Indicate malloc debugging requested. |
---|
365 | Disabled by default. |
---|
366 | |
---|
367 | `--enable-newlib-multithread' |
---|
368 | Enable support for multiple threads. |
---|
369 | Enabled by default. |
---|
370 | |
---|
371 | `--enable-newlib-iconv' |
---|
372 | Enable iconv library support. |
---|
373 | Disabled by default. |
---|
374 | |
---|
375 | `--enable-newlib-elix-level' |
---|
376 | Supply desired elix library level (1-4). Please refer to HOWTO for |
---|
377 | more information about this option. |
---|
378 | Set to level 0 by default. |
---|
379 | |
---|
380 | `--disable-newlib-io-float' |
---|
381 | Disable printf/scanf family float support. |
---|
382 | Enabled by default. |
---|
383 | |
---|
384 | `--disable-newlib-supplied-syscalls' |
---|
385 | Disable newlib from supplying syscalls. |
---|
386 | Enabled by default. |
---|
387 | |
---|
388 | `--enable-lite-exit' |
---|
389 | Enable lite exit, a size-reduced implementation of exit that doesn't |
---|
390 | invoke clean-up functions such as _fini or global destructors. |
---|
391 | Disabled by default. |
---|
392 | |
---|
393 | `--enable-newlib-nano-formatted-io' |
---|
394 | This builds NEWLIB with a special implementation of formatted I/O |
---|
395 | functions, designed to lower the size of application on small systems |
---|
396 | with size constraint issues. This option does not affect wide-char |
---|
397 | formatted I/O functions. Some notes about the feature: |
---|
398 | 1) The non-wide-char formatted I/O functions only support the C89 |
---|
399 | standard. The only exception is the configuration option provides |
---|
400 | limited support for long double. Internally, the nano formatted I/O |
---|
401 | functions use double so accuracy is only guaranteed to double |
---|
402 | precision. |
---|
403 | 2) Floating-point support is split out of the formatted I/O code into |
---|
404 | weak functions which are not linked by default. Programs that need |
---|
405 | floating-point I/O support must explicitly request linking of one or |
---|
406 | both of the floating-point functions: _printf_float or _scanf_float. |
---|
407 | This can be done at link time using the -u option which can be passed |
---|
408 | to either gcc or ld. The -u option forces the link to resolve those |
---|
409 | function references. Floating-point format specifiers are recognized |
---|
410 | by default, but if the floating-point functions are not explicitly |
---|
411 | linked in, this may result in undefined behavior for programs that |
---|
412 | need floating-point I/O support. |
---|
413 | 3) Integer-only versions of the formatted I/O functions (the iprintf/ |
---|
414 | iscanf family) simply alias their regular counter-parts. |
---|
415 | The affected functions are: |
---|
416 | |
---|
417 | diprintf vdiprintf |
---|
418 | |
---|
419 | siprintf fiprintf iprintf sniprintf asiprintf asniprintf |
---|
420 | |
---|
421 | siscanf fiscanf iscanf |
---|
422 | |
---|
423 | viprintf vfiprintf vsiprintf vsniprintf vasiprintf vasniprintf |
---|
424 | |
---|
425 | viscanf vfiscanf vsiscanf |
---|
426 | |
---|
427 | _diprintf_r _vdiprintf_r |
---|
428 | |
---|
429 | _siprintf_r _fiprintf_r _iprintf_r _sniprintf_r _asiprintf_r |
---|
430 | _asniprintf_r |
---|
431 | |
---|
432 | _siscanf_r _fiscanf_r _iscanf_r |
---|
433 | |
---|
434 | _viprintf_r _vfiprintf_r _vsiprintf_r _asniprintf_r _vasiprintf_r |
---|
435 | _vasniprintf_r |
---|
436 | |
---|
437 | _viscanf_r _vfiscanf_r _vsiscanf_r |
---|
438 | |
---|
439 | 4) As mentioned, the option does not affect wide-char formatted I/O. |
---|
440 | The following configuration options are ignored for non-wide-char |
---|
441 | formatted I/O functions, and can be thought of as disabled. |
---|
442 | |
---|
443 | enable-newlib-io-pos-args |
---|
444 | enable-newlib-io-c99-formats |
---|
445 | enable-newlib-io-long-long |
---|
446 | enable-newlib-io-long-double |
---|
447 | enable-newlib-mb |
---|
448 | |
---|
449 | Additionally, "enable/disable-newlib-io-float" is supported in |
---|
450 | this specific implementation, one can use "disable-newlib-io-float" |
---|
451 | to further reduce code size. In this case, the floating-point |
---|
452 | specifiers will not be recognized or handled, and the -u option |
---|
453 | will not work either. |
---|
454 | |
---|
455 | 5) As a rule, no features from outside of C89 standard will be |
---|
456 | considered in this implementation. |
---|
457 | |
---|
458 | Disabled by default. |
---|
459 | |
---|
460 | Running the Testsuite |
---|
461 | ===================== |
---|
462 | |
---|
463 | To run newlib's testsuite, you'll need a site.exp in your home |
---|
464 | directory which points dejagnu to the proper baseboards directory and |
---|
465 | the proper exp file for your target. |
---|
466 | |
---|
467 | Before running make check-target-newlib, set the DEJAGNU environment |
---|
468 | variable to point to ~/site.exp. |
---|
469 | |
---|
470 | Here is a sample site.exp: |
---|
471 | |
---|
472 | # Make sure we look in the right place for the board description files. |
---|
473 | if ![info exists boards_dir] { |
---|
474 | set boards_dir {} |
---|
475 | } |
---|
476 | lappend boards_dir "your dejagnu/baseboards here" |
---|
477 | |
---|
478 | verbose "Global Config File: target_triplet is $target_triplet" 2 |
---|
479 | |
---|
480 | global target_list |
---|
481 | case "$target_triplet" in { |
---|
482 | |
---|
483 | { "mips-*elf*" } { |
---|
484 | set target_list "mips-sim" |
---|
485 | } |
---|
486 | |
---|
487 | default { |
---|
488 | set target_list { "unix" } |
---|
489 | } |
---|
490 | } |
---|
491 | |
---|
492 | mips-sim refers to an exp file in the baseboards directory. You'll |
---|
493 | need to add the other targets you're testing to the case statement. |
---|
494 | |
---|
495 | Now type make check-target-newlib in the top-level build directory to |
---|
496 | run the testsuite. |
---|
497 | |
---|
498 | Shared newlib |
---|
499 | ============= |
---|
500 | |
---|
501 | newlib uses libtool when it is being compiled natively (with |
---|
502 | --target=i[34567]86-pc-linux-gnu) on an i[34567]86-pc-linux-gnu |
---|
503 | host. This allows newlib to be compiled as a shared library. |
---|
504 | |
---|
505 | To configure newlib, do the following from your build directory: |
---|
506 | |
---|
507 | $(source_dir)/src/configure --with-newlib --prefix=$(install_dir) |
---|
508 | |
---|
509 | configure will recognize that host == target == |
---|
510 | i[34567]86-pc-linux-gnu, so it will tell newlib to compile itself using |
---|
511 | libtool. By default, libtool will build shared and static versions of |
---|
512 | newlib. |
---|
513 | |
---|
514 | To compile a program against shared newlib, do the following (where |
---|
515 | target_install_dir = $(install_dir)/i[34567]86-pc-linux-gnu): |
---|
516 | |
---|
517 | gcc -nostdlib $(target_install_dir)/lib/crt0.o progname.c -I $(target_install_dir)/include -L $(target_install_dir)/lib -lc -lm -lgcc |
---|
518 | |
---|
519 | To run the program, make sure that $(target_install_dir)/lib is listed |
---|
520 | in the LD_LIBRARY_PATH environment variable. |
---|
521 | |
---|
522 | To create a static binary linked against newlib, do the following: |
---|
523 | |
---|
524 | gcc -nostdlib -static $(target_install_dir)/lib/crt0.o progname.c -I $(target_install_dir)/include -L $(target_install_dir)/lib -lc -lm |
---|
525 | |
---|
526 | libtool can be instructed to produce only static libraries. To build |
---|
527 | newlib as a static library only, do the following from your build |
---|
528 | directory: |
---|
529 | |
---|
530 | $(source_dir)/src/configure --with-newlib --prefix=$(install_dir) --disable-shared |
---|
531 | |
---|
532 | Regenerating Configuration Files |
---|
533 | ================================ |
---|
534 | |
---|
535 | At times you will need to make changes to configure.in and Makefile.am files. |
---|
536 | This will mean that configure and Makefile.in files will need to be |
---|
537 | regenerated. |
---|
538 | |
---|
539 | At the top level of newlib is the file: acinclude.m4. This file contains |
---|
540 | the definition of the NEWLIB_CONFIGURE macro which is used by all configure.in |
---|
541 | files in newlib. You will notice that each directory in newlib containing |
---|
542 | a configure.in file also contains an aclocal.m4 file. This file is |
---|
543 | generated by issuing: aclocal -I${relative_path_to_toplevel_newlib_dir} |
---|
544 | -I${relative_path_to_toplevel_src_dir} |
---|
545 | The first relative directory is to access acinclude.m4. The second relative |
---|
546 | directory is to access libtool information in the top-level src directory. |
---|
547 | |
---|
548 | For example, to regenerate aclocal.m4 in newlib/libc/machine/arm: |
---|
549 | |
---|
550 | aclocal -I ../../.. -I ../../../.. |
---|
551 | |
---|
552 | Note that if the top level acinclude.m4 is altered, every aclocal.m4 file |
---|
553 | in newlib should be regenerated. |
---|
554 | |
---|
555 | If the aclocal.m4 file is regenerated due to a change in acinclude.m4 or |
---|
556 | if a configure.in file is modified, the corresponding configure file in the |
---|
557 | directory must be regenerated using autoconf. No parameters are necessary. |
---|
558 | In the previous example, we would issue: |
---|
559 | |
---|
560 | autoconf |
---|
561 | |
---|
562 | from the newlib/libc/machine/arm directory. |
---|
563 | |
---|
564 | If you have regenerated a configure file or if you have modified a Makefile.am |
---|
565 | file, you will need to regenerate the appropriate Makefile.in file(s). |
---|
566 | For newlib, automake is a bit trickier. First of all, all Makefile.in |
---|
567 | files in newlib (and libgloss) are generated using the --cygnus option |
---|
568 | of automake. |
---|
569 | |
---|
570 | Makefile.in files are generated from the nearest directory up the chain |
---|
571 | which contains a configure.in file. In most cases, this is the same |
---|
572 | directory containing configure.in, but there are exceptions. |
---|
573 | For example, the newlib/libc directory has a number of |
---|
574 | subdirectories that do not contain their own configure.in files (e.g. stdio). |
---|
575 | For these directories, you must issue the automake command from newlib/libc |
---|
576 | which is the nearest parent directory that contains a configure.in. |
---|
577 | When you issue the automake command, you specify the subdirectory for |
---|
578 | the Makefile.in you are regenerating. For example: |
---|
579 | |
---|
580 | automake --cygnus stdio/Makefile stdlib/Makefile |
---|
581 | |
---|
582 | Note how multiple Makefile.in files can be created in the same step. You |
---|
583 | would not specify machine/Makefile or sys/Makefile in the previous example |
---|
584 | because both of these subdirectories contain their own configure.in files. |
---|
585 | One would change to each of these subdirectories and in turn issue: |
---|
586 | |
---|
587 | automake --cygnus Makefile |
---|
588 | |
---|
589 | Let's say you create a new machine directory XXXX off of newlib/libc/machine. |
---|
590 | After creating a new configure.in and Makefile.am file, you would issue: |
---|
591 | |
---|
592 | aclocal -I ../../.. |
---|
593 | autoconf |
---|
594 | automake --cygnus Makefile |
---|
595 | |
---|
596 | from newlib/libc/machine/XXXX |
---|
597 | |
---|
598 | It is strongly advised that you use an adequate version of autotools. |
---|
599 | For this latest release, the following were used: autoconf 2.69, aclocal 1.13.4, and |
---|
600 | automake 1.13.4. |
---|
601 | |
---|
602 | Reporting Bugs |
---|
603 | ============== |
---|
604 | |
---|
605 | The correct address for reporting bugs found in NEWLIB is |
---|
606 | "newlib@sourceware.org". Please email all bug reports to that |
---|
607 | address. Please include the NEWLIB version number (e.g., newlib-3.0.0), |
---|
608 | and how you configured it (e.g., "sun4 host and m68k-aout target"). |
---|
609 | Since NEWLIB supports many different configurations, it is important |
---|
610 | that you be precise about this. |
---|
611 | |
---|
612 | Archives of the newlib mailing list are on-line, see |
---|
613 | http://sourceware.org/ml/newlib/ |
---|