(Tips for Installtion): New section.
[glibc.git] / manual / maint.texi
bloba9de90adf1f1032f2e7d75e0075211d8c1864545
1 @c \input /gd/gnu/doc/texinfo
2 @c This is for making the `INSTALL' file for the distribution.
3 @c Makeinfo ignores it when processing the file from the include.
4 @setfilename INSTALL
6 @node Maintenance, Copying, Library Summary, Top
7 @appendix Library Maintenance
9 @menu
10 * Installation::          How to configure, compile and
11                              install the GNU C library.
12 * Reporting Bugs::        How to report bugs (if you want to
13                              get them fixed) and other troubles
14                              you may have with the GNU C library.
15 * Source Layout::         How to add new functions or header files
16                              to the GNU C library.
17 * Porting::               How to port the GNU C library to
18                              a new machine or operating system.
19 * Contributors::          Contributors to the GNU C Library.
20 @end menu
22 @node Installation
23 @appendixsec How to Install the GNU C Library
24 @cindex installing the library
26 Installation of the GNU C library is relatively simple, but usually
27 requires several GNU tools to be installed already.
28 @iftex
29 (@pxref{Tools for Installation}, below.)
30 @end iftex
32 @menu
33 * Tools for Installation::      We recommend using these tools to build.
34 * Supported Configurations::    What systems the GNU C library runs on.
35 * Tips for Installtion::        Useful hints for the installation.
36 @end menu
38 To configure the GNU C library for your system, run the shell script
39 @file{configure} with @code{sh}.  Use an argument which is the
40 conventional GNU name for your system configuration---for example,
41 @samp{sparc-sun-sunos4.1}, for a Sun 4 running SunOS 4.1.
42 @xref{Installation, Installation, Installing GNU CC, gcc.info, Using and
43 Porting GNU CC}, for a full description of standard GNU configuration
44 names.  If you omit the configuration name, @file{configure} will try to
45 guess one for you by inspecting the system it is running on.  It may or
46 may not be able to come up with a guess, and the its guess might be
47 wrong.  @file{configure} will tell you the canonical name of the chosen
48 configuration before proceeding.
50 Here are some options that you should specify (if appropriate) when
51 you run @code{configure}:
53 @table @samp
54 @item --with-gnu-ld
55 Use this option if you plan to use GNU @code{ld} to link programs with
56 the GNU C Library.  (We strongly recommend that you do.)  This option
57 enables use of features that exist only in GNU @code{ld}; so if you
58 configure for GNU @code{ld} you must use GNU @code{ld} @emph{every time}
59 you link with the GNU C Library, and when building it.
61 @item --with-gnu-as
62 Use this option if you plan to use the GNU assembler, @code{gas}, when
63 building the GNU C Library.  On some systems, the library may not build
64 properly if you do @emph{not} use @code{gas}.
66 @item --with-gnu-binutils
67 This option implies both @w{@samp{--with-gnu-ld}} and @w{@samp{--with-gnu-as}}.
68 On systems where GNU tools are the system tools, there is no need to
69 specify this option.  These include GNU, GNU/Linux, and free BSD systems.
71 @c extra blank line makes it look better
72 @item --without-fp
73 @itemx --nfp
75 Use this option if your computer lacks hardware floating-point support.
77 @item --prefix=@var{directory}
78 Install machine-independent data files in subdirectories of
79 @file{@var{directory}}.  (You can also set this in @file{configparms};
80 see below.)
82 @item --exec-prefix=@var{directory}
83 Install the library and other machine-dependent files in subdirectories
84 of @file{@var{directory}}.  (You can also set this in
85 @file{configparms}; see below.)
87 @item --enable-shared
88 @itemx --disable-shared
89 Enable or disable building of an ELF shared library on systems that
90 support it.  The default is to build the shared library on systems using
91 ELF when the GNU @code{binutils} are available.
93 @item --enable-profile
94 @itemx --disable-profile
95 Enable or disable building of the profiled C library, @samp{-lc_p}.  The
96 default is to build the profiled library.  You may wish to disable it if
97 you don't plan to do profiling, because it doubles the build time of
98 compiling just the unprofiled static library.
100 @item --enable-omitfp
101 Enable building a highly-optimized but possibly undebuggable static C
102 library.  This causes the normal static and shared (if enabled) C
103 libraries to be compiled with maximal optimization, including the
104 @samp{-fomit-frame-pointer} switch that makes debugging impossible on
105 many machines, and without debugging information (which makes the
106 binaries substantially smaller).  An additional static library is
107 compiled with no optimization and full debugging information, and
108 installed as @samp{-lc_g}.
109 @end table
111 The simplest way to run @code{configure} is to do it in the directory
112 that contains the library sources.  This prepares to build the library
113 in that very directory.
115 You can prepare to build the library in some other directory by going
116 to that other directory to run @code{configure}.  In order to run
117 configure, you will have to specify a directory for it, like this:
119 @smallexample
120 mkdir sun4
121 cd sun4
122 ../configure sparc-sun-sunos4.1
123 @end smallexample
125 @noindent
126 @code{configure} looks for the sources in whatever directory you
127 specified for finding @code{configure} itself.  It does not matter where
128 in the file system the source and build directories are---as long as you
129 specify the source directory when you run @code{configure}, you will get
130 the proper results.
132 This feature lets you keep sources and binaries in different
133 directories, and that makes it easy to build the library for several
134 different machines from the same set of sources.  Simply create a
135 build directory for each target machine, and run @code{configure} in
136 that directory specifying the target machine's configuration name.
138 The library has a number of special-purpose configuration parameters.
139 These are defined in the file @file{Makeconfig}; see the comments in
140 that file for the details.
142 But don't edit the file @file{Makeconfig} yourself---instead, create a
143 file @file{configparms} in the directory where you are building the
144 library, and define in that file the parameters you want to specify.
145 @file{configparms} should @strong{not} be an edited copy of
146 @file{Makeconfig}; specify only the parameters that you want to
147 override.  To see how to set these parameters, find the section of
148 @file{Makeconfig} that says ``These are the configuration variables.''
149 Then for each parameter that you want to change, copy the definition
150 from @file{Makeconfig} to your new @file{configparms} file, and change
151 the value as appropriate for your system.
153 It is easy to configure the GNU C library for cross-compilation by
154 setting a few variables in @file{configparms}.  Set @code{CC} to the
155 cross-compiler for the target you configured the library for; it is
156 important to use this same @code{CC} value when running
157 @code{configure}, like this: @samp{CC=@var{target}-gcc configure
158 @var{target}}.  Set @code{BUILD_CC} to the compiler to use for for
159 programs run on the build system as part of compiling the library.  You
160 may need to set @code{AR} and @code{RANLIB} to cross-compiling versions
161 of @code{ar} and @code{ranlib} if the native tools are not configured to
162 work with object files for the target you configured for.
164 Some of the machine-dependent code for some machines uses extensions in
165 the GNU C compiler, so you may need to compile the library with GCC.
166 (In fact, all of the existing complete ports require GCC.)
169 To build the library and related programs, type @code{make}.  This will
170 produce a lot of output, some of which may look like errors from
171 @code{make} (but isn't).  Look for error messages from @code{make}
172 containing @samp{***}.  Those indicate that something is really wrong.
174 To build and run some test programs which exercise some of the library
175 facilities, type @code{make check}.  This will produce several files
176 with names like @file{@var{program}.out}.
178 To format the @cite{GNU C Library Reference Manual} for printing, type
179 @w{@code{make dvi}}.  You need a working TeX installation to do this.
181 To install the library and its header files, and the Info files of the
182 manual, type @code{make install}.  This will build things if necessary,
183 before installing them.  If you want to install the files in a different
184 place than the one specified at configuration time you can specify a
185 value for the Makefile variable @code{install_root} on the command line.
186 This is useful to create chroot'ed environment or to prepare binary
187 releases.@refill
189 @node Tools for Installation
190 @appendixsubsec Recommended Tools to Install the GNU C Library
191 @cindex installation tools
192 @cindex tools, for installing library
194 We recommend installing the following GNU tools before attempting to
195 build the GNU C library:
197 @itemize @bullet
198 @item
199 @code{make} 3.75
201 You need the latest version of GNU @code{make}.  Modifying the GNU C
202 Library to work with other @code{make} programs would be so hard that we
203 recommend you port GNU @code{make} instead.  @strong{Really.}
204 We recommend version GNU @code{make} version 3.75.  Versions 3.76 and
205 3.76.1 are known to have bugs which only show up in big projects like
206 GNU @code{libc}.
208 @item
209 GCC 2.7.2
211 On most platforms, the GNU C library can only be compiled with the GNU C
212 compiler.  We recommend GCC version 2.7.2 or later; earlier versions may
213 have problems.
215 @item
216 @code{binutils} 2.8.1
218 Using the GNU @code{binutils} (assembler, linker, and related tools) is
219 preferable when possible, and they are required to build an ELF shared C
220 library.  We recommend @code{binutils} version 2.8 or later; earlier
221 versions are known to have problems or to not support all architectures.
223 @item
224 @code{texinfo} 3.11
226 To correctly translate and install the Texinfo documentation you need
227 this version of the @code{texinfo} package.  Former versions did not
228 understand all the tags used in the document and also the installation
229 mechanisms for the info files was not present or worked differently.
231 On some Debian Linux based systems the used @code{install-info} program
232 works differently.  Here you have to run make like this:
234 @smallexample
235 make INSTALL_INFO=/path/to/GNU/install-info install
236 @end smallexample
237 @end itemize
239 @node Supported Configurations
240 @appendixsubsec Supported Configurations
241 @cindex configurations, all supported
243 The GNU C Library currently supports configurations that match the
244 following patterns:
246 @smallexample
247 alpha-@var{anything}-linux
248 i@var{x}86-@var{anything}-gnu
249 i@var{x}86-@var{anything}-linux
250 m68k-@var{anything}-linux
251 @end smallexample
253 Former releases of this library (version 1.09.1 and perhaps earlier
254 versions) used to run on the following configurations:
256 @smallexample
257 alpha-dec-osf1
258 i@var{x}86-@var{anything}-bsd4.3
259 i@var{x}86-@var{anything}-isc2.2
260 i@var{x}86-@var{anything}-isc3.@var{n}
261 i@var{x}86-@var{anything}-sco3.2
262 i@var{x}86-@var{anything}-sco3.2v4
263 i@var{x}86-@var{anything}-sysv
264 i@var{x}86-@var{anything}-sysv4
265 i@var{x}86-force_cpu386-none
266 i@var{x}86-sequent-bsd
267 i960-nindy960-none
268 m68k-hp-bsd4.3
269 m68k-mvme135-none
270 m68k-mvme136-none
271 m68k-sony-newsos3
272 m68k-sony-newsos4
273 m68k-sun-sunos4.@var{n}
274 mips-dec-ultrix4.@var{n}
275 mips-sgi-irix4.@var{n}
276 sparc-sun-solaris2.@var{n}
277 sparc-sun-sunos4.@var{n}
278 @end smallexample
280 Since no one has volunteered to test and fix the above configurations,
281 these are not supported at the moment.  It's expected that these don't
282 work anymore.  Porting the library is not hard.  If you are interested
283 in doing a port, please contact the glibc maintainers by sending
284 electronic mail to @email{bug-glibc@@gnu.org}.
286 Each case of @samp{i@var{x}86} can be @samp{i386}, @samp{i486},
287 @samp{i586}, or @samp{i686}.  All of those configurations produce a
288 library that can run on any of these processors.  The library will be
289 optimized for the specified processor, but will not use instructions not
290 available on all of them.
292 While no other configurations are supported, there are handy aliases for
293 these few.  (These aliases work in other GNU software as well.)
295 @smallexample
296 decstation
297 hp320-bsd4.3 hp300bsd
298 i486-gnu
299 i586-linux
300 i386-sco
301 i386-sco3.2v4
302 i386-sequent-dynix
303 i386-svr4
304 news
305 sun3-sunos4.@var{n} sun3
306 sun4-solaris2.@var{n} sun4-sunos5.@var{n}
307 sun4-sunos4.@var{n} sun4
308 @end smallexample
310 @node Tips for Installtion
311 @appendixsubsec Useful hints for the installation
313 There are a some more or less obvious methods one should know when
314 compiling GNU libc:
316 @itemize @bullet
317 @item
318 Better never compile in the source directory.  Create a new directory
319 and run the @file{configure} from there.  Everything should happen
320 automagically.
322 @item
323 You can use the @code{-j} option of GNU make by changing the line
324 specifying @code{PARALLELMAKE} in the Makefile generated during the
325 configuration.
327 It is not useful to start the @code{make} process using the @code{-j}
328 option since this option is not propagated down to the sub-@code{make}s.
330 @item
331 If you made some changes after a complete build and only want to check
332 these changes run @code{make} while specifying the list of subdirs it
333 has to visit.
335 @smallexample
336 make subdirs="nss elf"
337 @end smallexample
339 The above build run will only visit the subdirectories @file{nss} and
340 @file{elf}.  Beside this it updates the @file{libc} files itself.
341 @end itemize
343 @node Reporting Bugs
344 @appendixsec Reporting Bugs
345 @cindex reporting bugs
346 @cindex bugs, reporting
348 There are probably bugs in the GNU C library.  There are certainly
349 errors and omissions in this manual.  If you report them, they will get
350 fixed.  If you don't, no one will ever know about them and they will
351 remain unfixed for all eternity, if not longer.
353 To report a bug, first you must find it.  Hopefully, this will be the
354 hard part.  Once you've found a bug, make sure it's really a bug.  A
355 good way to do this is to see if the GNU C library behaves the same way
356 some other C library does.  If so, probably you are wrong and the
357 libraries are right (but not necessarily).  If not, one of the libraries
358 is probably wrong.
360 Once you're sure you've found a bug, try to narrow it down to the
361 smallest test case that reproduces the problem.  In the case of a C
362 library, you really only need to narrow it down to one library
363 function call, if possible.  This should not be too difficult.
365 The final step when you have a simple test case is to report the bug.
366 When reporting a bug, send your test case, the results you got, the
367 results you expected, what you think the problem might be (if you've
368 thought of anything), your system type, and the version of the GNU C
369 library which you are using.  Also include the files
370 @file{config.status} and @file{config.make} which are created by running
371 @file{configure}; they will be in whatever directory was current when
372 you ran @file{configure}.
374 If you think you have found some way in which the GNU C library does not
375 conform to the ISO and POSIX standards (@pxref{Standards and
376 Portability}), that is definitely a bug.  Report it!@refill
378 Send bug reports to the Internet address
379 @email{bug-glibc@@gnu.og}.  If you have other problems
380 with installation or use, please report those as well.@refill
382 If you are not sure how a function should behave, and this manual
383 doesn't tell you, that's a bug in the manual.  Report that too!  If the
384 function's behavior disagrees with the manual, then either the library
385 or the manual has a bug, so report the disagreement.  If you find any
386 errors or omissions in this manual, please report them to the Internet
387 address @email{bug-glibc-manual@@prep.ai.mit.edu}.
389 @node Source Layout
390 @appendixsec Adding New Functions
392 The process of building the library is driven by the makefiles, which
393 make heavy use of special features of GNU @code{make}.  The makefiles
394 are very complex, and you probably don't want to try to understand them.
395 But what they do is fairly straightforward, and only requires that you
396 define a few variables in the right places.
398 The library sources are divided into subdirectories, grouped by topic.
400 The @file{string} subdirectory has all the string-manipulation
401 functions, @file{math} has all the mathematical functions, etc.
403 Each subdirectory contains a simple makefile, called @file{Makefile},
404 which defines a few @code{make} variables and then includes the global
405 makefile @file{Rules} with a line like:
407 @smallexample
408 include ../Rules
409 @end smallexample
411 @noindent
412 The basic variables that a subdirectory makefile defines are:
414 @table @code
415 @item subdir
416 The name of the subdirectory, for example @file{stdio}.
417 This variable @strong{must} be defined.
419 @item headers
420 The names of the header files in this section of the library,
421 such as @file{stdio.h}.
423 @item routines
424 @itemx aux
425 The names of the modules (source files) in this section of the library.
426 These should be simple names, such as @samp{strlen} (rather than
427 complete file names, such as @file{strlen.c}).  Use @code{routines} for
428 modules that define functions in the library, and @code{aux} for
429 auxiliary modules containing things like data definitions.  But the
430 values of @code{routines} and @code{aux} are just concatenated, so there
431 really is no practical difference.@refill
433 @item tests
434 The names of test programs for this section of the library.  These
435 should be simple names, such as @samp{tester} (rather than complete file
436 names, such as @file{tester.c}).  @w{@samp{make tests}} will build and
437 run all the test programs.  If a test program needs input, put the test
438 data in a file called @file{@var{test-program}.input}; it will be given to
439 the test program on its standard input.  If a test program wants to be
440 run with arguments, put the arguments (all on a single line) in a file
441 called @file{@var{test-program}.args}.  Test programs should exit with
442 zero status when the test passes, and nonzero status when the test
443 indicates a bug in the library or error in building.
445 @item others
446 The names of ``other'' programs associated with this section of the
447 library.  These are programs which are not tests per se, but are other
448 small programs included with the library.  They are built by
449 @w{@samp{make others}}.@refill
451 @item install-lib
452 @itemx install-data
453 @itemx install
454 Files to be installed by @w{@samp{make install}}.  Files listed in
455 @samp{install-lib} are installed in the directory specified by
456 @samp{libdir} in @file{configparms} or @file{Makeconfig}
457 (@pxref{Installation}).  Files listed in @code{install-data} are
458 installed in the directory specified by @samp{datadir} in
459 @file{configparms} or @file{Makeconfig}.  Files listed in @code{install}
460 are installed in the directory specified by @samp{bindir} in
461 @file{configparms} or @file{Makeconfig}.@refill
463 @item distribute
464 Other files from this subdirectory which should be put into a
465 distribution tar file.  You need not list here the makefile itself or
466 the source and header files listed in the other standard variables.
467 Only define @code{distribute} if there are files used in an unusual way
468 that should go into the distribution.
470 @item generated
471 Files which are generated by @file{Makefile} in this subdirectory.
472 These files will be removed by @w{@samp{make clean}}, and they will
473 never go into a distribution.
475 @item extra-objs
476 Extra object files which are built by @file{Makefile} in this
477 subdirectory.  This should be a list of file names like @file{foo.o};
478 the files will actually be found in whatever directory object files are
479 being built in.  These files will be removed by @w{@samp{make clean}}.
480 This variable is used for secondary object files needed to build
481 @code{others} or @code{tests}.
482 @end table
484 @node Porting
485 @appendixsec Porting the GNU C Library
487 The GNU C library is written to be easily portable to a variety of
488 machines and operating systems.  Machine- and operating system-dependent
489 functions are well separated to make it easy to add implementations for
490 new machines or operating systems.  This section describes the layout of
491 the library source tree and explains the mechanisms used to select
492 machine-dependent code to use.
494 All the machine-dependent and operating system-dependent files in the
495 library are in the subdirectory @file{sysdeps} under the top-level
496 library source directory.  This directory contains a hierarchy of
497 subdirectories (@pxref{Hierarchy Conventions}).
499 Each subdirectory of @file{sysdeps} contains source files for a
500 particular machine or operating system, or for a class of machine or
501 operating system (for example, systems by a particular vendor, or all
502 machines that use IEEE 754 floating-point format).  A configuration
503 specifies an ordered list of these subdirectories.  Each subdirectory
504 implicitly appends its parent directory to the list.  For example,
505 specifying the list @file{unix/bsd/vax} is equivalent to specifying the
506 list @file{unix/bsd/vax unix/bsd unix}.  A subdirectory can also specify
507 that it implies other subdirectories which are not directly above it in
508 the directory hierarchy.  If the file @file{Implies} exists in a
509 subdirectory, it lists other subdirectories of @file{sysdeps} which are
510 appended to the list, appearing after the subdirectory containing the
511 @file{Implies} file.  Lines in an @file{Implies} file that begin with a
512 @samp{#} character are ignored as comments.  For example,
513 @file{unix/bsd/Implies} contains:@refill
514 @smallexample
515 # BSD has Internet-related things.
516 unix/inet
517 @end smallexample
518 @noindent
519 and @file{unix/Implies} contains:
520 @need 300
521 @smallexample
522 posix
523 @end smallexample
525 @noindent
526 So the final list is @file{unix/bsd/vax unix/bsd unix/inet unix posix}.
528 @file{sysdeps} has two ``special'' subdirectories, called @file{generic}
529 and @file{stub}.  These two are always implicitly appended to the list
530 of subdirectories (in that order), so you needn't put them in an
531 @file{Implies} file, and you should not create any subdirectories under
532 them intended to be new specific categories.  @file{generic} is for
533 things that can be implemented in machine-independent C, using only
534 other machine-independent functions in the C library.  @file{stub} is
535 for @dfn{stub} versions of functions which cannot be implemented on a
536 particular machine or operating system.  The stub functions always
537 return an error, and set @code{errno} to @code{ENOSYS} (Function not
538 implemented).  @xref{Error Reporting}.
540 A source file is known to be system-dependent by its having a version in
541 @file{generic} or @file{stub}; every generally-available function whose
542 implementation is system-dependent in should have either a generic or
543 stub implementation (there is no point in having both).  Some rare functions
544 are only useful on specific systems and aren't defined at all on others;
545 these do not appear anywhere in the system-independent source code or makefiles
546 (including the @file{generic} and @file{stub} directories), only in the
547 system-dependent @file{Makefile} in the specific system's subdirectory.
549 If you come across a file that is in one of the main source directories
550 (@file{string}, @file{stdio}, etc.), and you want to write a machine- or
551 operating system-dependent version of it, move the file into
552 @file{sysdeps/generic} and write your new implementation in the
553 appropriate system-specific subdirectory.  Note that if a file is to be
554 system-dependent, it @strong{must not} appear in one of the main source
555 directories.@refill
557 There are a few special files that may exist in each subdirectory of
558 @file{sysdeps}:
560 @comment Blank lines after items make the table look better.
561 @table @file
562 @item Makefile
564 A makefile for this machine or operating system, or class of machine or
565 operating system.  This file is included by the library makefile
566 @file{Makerules}, which is used by the top-level makefile and the
567 subdirectory makefiles.  It can change the variables set in the
568 including makefile or add new rules.  It can use GNU @code{make}
569 conditional directives based on the variable @samp{subdir} (see above) to
570 select different sets of variables and rules for different sections of
571 the library.  It can also set the @code{make} variable
572 @samp{sysdep-routines}, to specify extra modules to be included in the
573 library.  You should use @samp{sysdep-routines} rather than adding
574 modules to @samp{routines} because the latter is used in determining
575 what to distribute for each subdirectory of the main source tree.@refill
577 Each makefile in a subdirectory in the ordered list of subdirectories to
578 be searched is included in order.  Since several system-dependent
579 makefiles may be included, each should append to @samp{sysdep-routines}
580 rather than simply setting it:
582 @smallexample
583 sysdep-routines := $(sysdep-routines) foo bar
584 @end smallexample
586 @need 1000
587 @item Subdirs
589 This file contains the names of new whole subdirectories under the
590 top-level library source tree that should be included for this system.
591 These subdirectories are treated just like the system-independent
592 subdirectories in the library source tree, such as @file{stdio} and
593 @file{math}.
595 Use this when there are completely new sets of functions and header
596 files that should go into the library for the system this subdirectory
597 of @file{sysdeps} implements.  For example,
598 @file{sysdeps/unix/inet/Subdirs} contains @file{inet}; the @file{inet}
599 directory contains various network-oriented operations which only make
600 sense to put in the library on systems that support the Internet.@refill
602 @item Dist
604 This file contains the names of files (relative to the subdirectory of
605 @file{sysdeps} in which it appears) which should be included in the
606 distribution.  List any new files used by rules in the @file{Makefile}
607 in the same directory, or header files used by the source files in that
608 directory.  You don't need to list files that are implementations
609 (either C or assembly source) of routines whose names are given in the
610 machine-independent makefiles in the main source tree.
612 @item configure
614 This file is a shell script fragment to be run at configuration time.
615 The top-level @file{configure} script uses the shell @code{.} command to
616 read the @file{configure} file in each system-dependent directory
617 chosen, in order.  The @file{configure} files are often generated from
618 @file{configure.in} files using Autoconf.
620 A system-dependent @file{configure} script will usually add things to
621 the shell variables @samp{DEFS} and @samp{config_vars}; see the
622 top-level @file{configure} script for details.  The script can check for
623 @w{@samp{--with-@var{package}}} options that were passed to the
624 top-level @file{configure}.  For an option
625 @w{@samp{--with-@var{package}=@var{value}}} @file{configure} sets the
626 shell variable @w{@samp{with_@var{package}}} (with any dashes in
627 @var{package} converted to underscores) to @var{value}; if the option is
628 just @w{@samp{--with-@var{package}}} (no argument), then it sets
629 @w{@samp{with_@var{package}}} to @samp{yes}.
631 @item configure.in
633 This file is an Autoconf input fragment to be processed into the file
634 @file{configure} in this subdirectory.  @xref{Introduction,,,
635 autoconf.info, Autoconf: Generating Automatic Configuration Scripts},
636 for a description of Autoconf.  You should write either @file{configure}
637 or @file{configure.in}, but not both.  The first line of
638 @file{configure.in} should invoke the @code{m4} macro
639 @samp{GLIBC_PROVIDES}.  This macro does several @code{AC_PROVIDE} calls
640 for Autoconf macros which are used by the top-level @file{configure}
641 script; without this, those macros might be invoked again unnecessarily
642 by Autoconf.
643 @end table
645 That is the general system for how system-dependencies are isolated.
646 @iftex
647 The next section explains how to decide what directories in
648 @file{sysdeps} to use.  @ref{Porting to Unix}, has some tips on porting
649 the library to Unix variants.
650 @end iftex
652 @menu
653 * Hierarchy Conventions::       The layout of the @file{sysdeps} hierarchy.
654 * Porting to Unix::             Porting the library to an average
655                                    Unix-like system.
656 @end menu
658 @node Hierarchy Conventions
659 @appendixsubsec Layout of the @file{sysdeps} Directory Hierarchy
661 A GNU configuration name has three parts: the CPU type, the
662 manufacturer's name, and the operating system.  @file{configure} uses
663 these to pick the list of system-dependent directories to look for.  If
664 the @samp{--nfp} option is @emph{not} passed to @file{configure}, the
665 directory @file{@var{machine}/fpu} is also used.  The operating system
666 often has a @dfn{base operating system}; for example, if the operating
667 system is @samp{sunos4.1}, the base operating system is @samp{unix/bsd}.
668 The algorithm used to pick the list of directories is simple:
669 @file{configure} makes a list of the base operating system,
670 manufacturer, CPU type, and operating system, in that order.  It then
671 concatenates all these together with slashes in between, to produce a
672 directory name; for example, the configuration @w{@samp{sparc-sun-sunos4.1}}
673 results in @file{unix/bsd/sun/sparc/sunos4.1}.  @file{configure} then
674 tries removing each element of the list in turn, so
675 @file{unix/bsd/sparc} and @file{sun/sparc} are also tried, among others.
676 Since the precise version number of the operating system is often not
677 important, and it would be very inconvenient, for example, to have
678 identical @file{sunos4.1.1} and @file{sunos4.1.2} directories,
679 @file{configure} tries successively less specific operating system names
680 by removing trailing suffixes starting with a period.
682 As an example, here is the complete list of directories that would be
683 tried for the configuration @w{@samp{sparc-sun-sunos4.1}} (without the
684 @w{@samp{--nfp}} option):
686 @smallexample
687 sparc/fpu
688 unix/bsd/sun/sunos4.1/sparc
689 unix/bsd/sun/sunos4.1
690 unix/bsd/sun/sunos4/sparc
691 unix/bsd/sun/sunos4
692 unix/bsd/sun/sunos/sparc
693 unix/bsd/sun/sunos
694 unix/bsd/sun/sparc
695 unix/bsd/sun
696 unix/bsd/sunos4.1/sparc
697 unix/bsd/sunos4.1
698 unix/bsd/sunos4/sparc
699 unix/bsd/sunos4
700 unix/bsd/sunos/sparc
701 unix/bsd/sunos
702 unix/bsd/sparc
703 unix/bsd
704 unix/sun/sunos4.1/sparc
705 unix/sun/sunos4.1
706 unix/sun/sunos4/sparc
707 unix/sun/sunos4
708 unix/sun/sunos/sparc
709 unix/sun/sunos
710 unix/sun/sparc
711 unix/sun
712 unix/sunos4.1/sparc
713 unix/sunos4.1
714 unix/sunos4/sparc
715 unix/sunos4
716 unix/sunos/sparc
717 unix/sunos
718 unix/sparc
719 unix
720 sun/sunos4.1/sparc
721 sun/sunos4.1
722 sun/sunos4/sparc
723 sun/sunos4
724 sun/sunos/sparc
725 sun/sunos
726 sun/sparc
728 sunos4.1/sparc
729 sunos4.1
730 sunos4/sparc
731 sunos4
732 sunos/sparc
733 sunos
734 sparc
735 @end smallexample
737 Different machine architectures are conventionally subdirectories at the
738 top level of the @file{sysdeps} directory tree.  For example,
739 @w{@file{sysdeps/sparc}} and @w{@file{sysdeps/m68k}}.  These contain
740 files specific to those machine architectures, but not specific to any
741 particular operating system.  There might be subdirectories for
742 specializations of those architectures, such as
743 @w{@file{sysdeps/m68k/68020}}. Code which is specific to the
744 floating-point coprocessor used with a particular machine should go in
745 @w{@file{sysdeps/@var{machine}/fpu}}.
747 There are a few directories at the top level of the @file{sysdeps}
748 hierarchy that are not for particular machine architectures.
750 @table @file
751 @item generic
752 @itemx stub
753 As described above (@pxref{Porting}), these are the two subdirectories
754 that every configuration implicitly uses after all others.
756 @item ieee754
757 This directory is for code using the IEEE 754 floating-point format,
758 where the C type @code{float} is IEEE 754 single-precision format, and
759 @code{double} is IEEE 754 double-precision format.  Usually this
760 directory is referred to in the @file{Implies} file in a machine
761 architecture-specific directory, such as @file{m68k/Implies}.
763 @item posix
764 This directory contains implementations of things in the library in
765 terms of @sc{POSIX.1} functions.  This includes some of the @sc{POSIX.1}
766 functions themselves.  Of course, @sc{POSIX.1} cannot be completely
767 implemented in terms of itself, so a configuration using just
768 @file{posix} cannot be complete.
770 @item unix
771 This is the directory for Unix-like things.  @xref{Porting to Unix}.
772 @file{unix} implies @file{posix}.  There are some special-purpose
773 subdirectories of @file{unix}:
775 @table @file
776 @item unix/common
777 This directory is for things common to both BSD and System V release 4.
778 Both @file{unix/bsd} and @file{unix/sysv/sysv4} imply @file{unix/common}.
780 @item unix/inet
781 This directory is for @code{socket} and related functions on Unix systems.
782 The @file{inet} top-level subdirectory is enabled by @file{unix/inet/Subdirs}.
783 @file{unix/common} implies @file{unix/inet}.
784 @end table
786 @item mach
787 This is the directory for things based on the Mach microkernel from CMU
788 (including the GNU operating system).  Other basic operating systems
789 (VMS, for example) would have their own directories at the top level of
790 the @file{sysdeps} hierarchy, parallel to @file{unix} and @file{mach}.
791 @end table
793 @node Porting to Unix
794 @appendixsubsec Porting the GNU C Library to Unix Systems
796 Most Unix systems are fundamentally very similar.  There are variations
797 between different machines, and variations in what facilities are
798 provided by the kernel.  But the interface to the operating system
799 facilities is, for the most part, pretty uniform and simple.
801 The code for Unix systems is in the directory @file{unix}, at the top
802 level of the @file{sysdeps} hierarchy.  This directory contains
803 subdirectories (and subdirectory trees) for various Unix variants.
805 The functions which are system calls in most Unix systems are
806 implemented in assembly code in files in @file{sysdeps/unix}.  These
807 files are named with a suffix of @samp{.S}; for example,
808 @file{__open.S}.  Files ending in @samp{.S} are run through the C
809 preprocessor before being fed to the assembler.
811 These files all use a set of macros that should be defined in
812 @file{sysdep.h}.  The @file{sysdep.h} file in @file{sysdeps/unix}
813 partially defines them; a @file{sysdep.h} file in another directory must
814 finish defining them for the particular machine and operating system
815 variant.  See @file{sysdeps/unix/sysdep.h} and the machine-specific
816 @file{sysdep.h} implementations to see what these macros are and what
817 they should do.@refill
819 The system-specific makefile for the @file{unix} directory (that is, the
820 file @file{sysdeps/unix/Makefile}) gives rules to generate several files
821 from the Unix system you are building the library on (which is assumed
822 to be the target system you are building the library @emph{for}).  All
823 the generated files are put in the directory where the object files are
824 kept; they should not affect the source tree itself.  The files
825 generated are @file{ioctls.h}, @file{errnos.h}, @file{sys/param.h}, and
826 @file{errlist.c} (for the @file{stdio} section of the library).
828 @ignore
829 @c This section might be a good idea if it is finished,
830 @c but there's no point including it as it stands. --rms
831 @c @appendixsec Compatibility with Traditional C
833 @c ??? This section is really short now.  Want to keep it? --roland
835 Although the GNU C library implements the @w{ISO C} library facilities, you
836 @emph{can} use the GNU C library with traditional, ``pre-ISO'' C
837 compilers.  However, you need to be careful because the content and
838 organization of the GNU C library header files differs from that of
839 traditional C implementations.  This means you may need to make changes
840 to your program in order to get it to compile.
841 @end ignore
843 @node Contributors
844 @appendixsec Contributors to the GNU C Library
846 The GNU C library was written originally by Roland McGrath.  Some parts
847 of the library were contributed or worked on by other people.
849 @itemize @bullet
850 @item
851 The @code{getopt} function and related code were written by
852 Richard Stallman, @w{David J. MacKenzie}, and @w{Roland McGrath}.
854 @item
855 The merge sort function @code{qsort} was written by Michael J. Haertel.
857 @item
858 The quick sort function used as a fallback by @code{qsort} was written
859 by Douglas C. Schmidt.
861 @item
862 The memory allocation functions @code{malloc}, @code{realloc} and
863 @code{free} and related code were written by Michael J. Haertel.
865 @comment tege's name has an umlaut.
866 @tex
867 \xdef\SETtege{Torbj\"orn Granlund}
868 @end tex
869 @ifinfo
870 @set tege Torbjorn Granlund
871 @end ifinfo
872 @item
873 Fast implementations of many of the string functions (@code{memcpy},
874 @code{strlen}, etc.) were written by @value{tege}.
876 @item
877 The @file{tar.h} header file was written by David J. MacKenzie.
879 @item
880 The port to the MIPS DECStation running Ultrix 4
881 (@code{mips-dec-ultrix4})
882 was contributed by Brendan Kehoe and Ian Lance Taylor.
884 @item
885 The DES encryption function @code{crypt} and related functions were
886 contributed by Michael Glad.
888 @item
889 The @code{ftw} function was contributed by Ian Lance Taylor.
891 @item
892 The startup code to support SunOS shared libraries was contributed by
893 Tom Quinn.
895 @item
896 The @code{mktime} function was contributed by Paul Eggert.
898 @item
899 The port to the Sequent Symmetry running Dynix version 3
900 (@code{i386-sequent-bsd}) was contributed by Jason Merrill.
902 @item
903 The timezone support code is derived from the public-domain timezone
904 package by Arthur David Olson and his many contributors.
906 @item
907 The port to the DEC Alpha running OSF/1 (@code{alpha-dec-osf1}) was
908 contributed by Brendan Kehoe, using some code written by Roland McGrath.
910 @item
911 The port to SGI machines running Irix 4 (@code{mips-sgi-irix4}) was
912 contributed by Tom Quinn.
914 @item
915 The port of the Mach and Hurd code to the MIPS architecture
916 (@code{mips-@var{anything}-gnu}) was contributed by Kazumoto Kojima.
918 @item
919 The floating-point printing function used by @code{printf} and friends
920 and the floating-point reading function used by @code{scanf},
921 @code{strtod} and friends were written by Ulrich Drepper.  The
922 multi-precision integer functions used in those functions are taken from
923 GNU MP, which was contributed by @value{tege}.
925 @item
926 The internationalization support in the library, and the support
927 programs @code{locale} and @code{localedef}, were written by Ulrich
928 Drepper.  Ulrich Drepper adapted the support code for message catalogs
929 (@file{libintl.h}, etc.) from the GNU @code{gettext} package, which he
930 also wrote.  He also contributed the @code{catgets} support and the
931 entire suite of multi-byte and wide-character support functions
932 (@file{wctype.h}, @file{wchar.h}, etc.).
934 @item
935 The implementations of the @file{nsswitch.conf} mechanism and the files
936 and DNS backends for it were designed and written by Ulrich Drepper and
937 Roland McGrath, based on a backend interface defined by Peter Eriksson.
939 @item
940 The port to Linux i386/ELF (@code{i386-@var{anything}-linux}) was
941 contributed by Ulrich Drepper, based in large part on work done in
942 Hongjiu Lu's Linux version of the GNU C Library.
944 @item
945 The port to Linux/m68k (@code{m68k-@var{anything}-linux}) was
946 contributed by Andreas Schwab.
948 @item
949 Richard Henderson contributed the ELF dynamic linking code and other
950 support for the Alpha processor.
952 @item
953 David Mosberger-Tang contributed the port to Linux/Alpha
954 (@code{alpha-@var{anything}-linux}).
956 @item
957 Stephen R. van den Berg contributed a highly-optimized @code{strstr} function.
959 @item
960 Ulrich Drepper contributed the @code{hsearch} and @code{drand48}
961 families of functions; reentrant @samp{@dots{}@code{_r}} versions of the
962 @code{random} family; System V shared memory and IPC support code; and
963 several highly-optimized string functions for i@var{x}86 processors.
965 @item
966 The math functions are taken from @code{fdlibm-5.1} by Sun
967 Microsystems, as modified by J.T. Conklin, Ian Lance Taylor,
968 Ulrich Drepper, Andreas Schwab, and Roland McGrath.
970 @item
971 The @code{libio} library used to implement @code{stdio} functions on
972 some platforms was written by Per Bothner and modified by Ulrich Drepper.
974 @item
975 The Internet-related code (most of the @file{inet} subdirectory) and
976 several other miscellaneous functions and header files have been
977 included from 4.4 BSD with little or no modification.
979 All code incorporated from 4.4 BSD is under the following copyright:
981 @quotation
982 @display
983 Copyright @copyright{} 1991 Regents of the University of California.
984 All rights reserved.
985 @end display
987 Redistribution and use in source and binary forms, with or without
988 modification, are permitted provided that the following conditions
989 are met:
991 @enumerate
992 @item
993 Redistributions of source code must retain the above copyright
994 notice, this list of conditions and the following disclaimer.
995 @item
996 Redistributions in binary form must reproduce the above copyright
997 notice, this list of conditions and the following disclaimer in the
998 documentation and/or other materials provided with the distribution.
999 @item
1000 All advertising materials mentioning features or use of this software
1001 must display the following acknowledgement:
1002 @quotation
1003 This product includes software developed by the University of
1004 California, Berkeley and its contributors.
1005 @end quotation
1006 @item
1007 Neither the name of the University nor the names of its contributors
1008 may be used to endorse or promote products derived from this software
1009 without specific prior written permission.
1010 @end enumerate
1012 @sc{this software is provided by the regents and contributors ``as is'' and
1013 any express or implied warranties, including, but not limited to, the
1014 implied warranties of merchantability and fitness for a particular purpose
1015 are disclaimed.  in no event shall the regents or contributors be liable
1016 for any direct, indirect, incidental, special, exemplary, or consequential
1017 damages (including, but not limited to, procurement of substitute goods
1018 or services; loss of use, data, or profits; or business interruption)
1019 however caused and on any theory of liability, whether in contract, strict
1020 liability, or tort (including negligence or otherwise) arising in any way
1021 out of the use of this software, even if advised of the possibility of
1022 such damage.}
1023 @end quotation
1025 @item
1026 The random number generation functions @code{random}, @code{srandom},
1027 @code{setstate} and @code{initstate}, which are also the basis for the
1028 @code{rand} and @code{srand} functions, were written by Earl T. Cohen
1029 for the University of California at Berkeley and are copyrighted by the
1030 Regents of the University of California.  They have undergone minor
1031 changes to fit into the GNU C library and to fit the @w{ISO C} standard,
1032 but the functional code is Berkeley's.@refill
1034 @item
1035 The Internet resolver code is taken directly from BIND 4.9.5, which is
1036 under both the Berkeley copyright above and also:
1038 @quotation
1039 Portions Copyright @copyright{} 1993 by Digital Equipment Corporation.
1041 Permission to use, copy, modify, and distribute this software for any
1042 purpose with or without fee is hereby granted, provided that the above
1043 copyright notice and this permission notice appear in all copies, and
1044 that the name of Digital Equipment Corporation not be used in
1045 advertising or publicity pertaining to distribution of the document or
1046 software without specific, written prior permission.
1048 @sc{the software is provided ``as is'' and digital equipment corp.
1049 disclaims all warranties with regard to this software, including all
1050 implied warranties of merchantability and fitness.  in no event shall
1051 digital equipment corporation be liable for any special, direct,
1052 indirect, or consequential damages or any damages whatsoever resulting
1053 from loss of use, data or profits, whether in an action of contract,
1054 negligence or other tortious action, arising out of or in connection
1055 with the use or performance of this software.}
1056 @end quotation
1058 @item
1059 The code to support Sun RPC is taken verbatim from Sun's
1060 @w{@sc{rpcsrc-4.0}} distribution, and is covered by this copyright:
1062 @quotation
1063 @display
1064 Copyright @copyright{} 1984, Sun Microsystems, Inc.
1065 @end display
1067 Sun RPC is a product of Sun Microsystems, Inc. and is provided for
1068 unrestricted use provided that this legend is included on all tape media
1069 and as a part of the software program in whole or part.  Users may copy
1070 or modify Sun RPC without charge, but are not authorized to license or
1071 distribute it to anyone else except as part of a product or program
1072 developed by the user.
1074 @sc{sun rpc is provided as is with no warranties of any kind including the
1075 warranties of design, merchantibility and fitness for a particular
1076 purpose, or arising from a course of dealing, usage or trade practice.}
1078 Sun RPC is provided with no support and without any obligation on the
1079 part of Sun Microsystems, Inc. to assist in its use, correction,
1080 modification or enhancement.
1082 @sc{sun microsystems, inc. shall have no liability with respect to the
1083 infringement of copyrights, trade secrets or any patents by sun rpc
1084 or any part thereof.}
1086 In no event will Sun Microsystems, Inc. be liable for any lost revenue
1087 or profits or other special, indirect and consequential damages, even if
1088 Sun has been advised of the possibility of such damages.
1090 @display
1091 Sun Microsystems, Inc.
1092 2550 Garcia Avenue
1093 Mountain View, California  94043
1094 @end display
1095 @end quotation
1097 @item
1098 Some of the support code for Mach is taken from Mach 3.0 by CMU,
1099 and is under the following copyright terms:
1101 @quotation
1102 @display
1103 Mach Operating System
1104 Copyright @copyright{} 1991,1990,1989 Carnegie Mellon University
1105 All Rights Reserved.
1106 @end display
1108 Permission to use, copy, modify and distribute this software and its
1109 documentation is hereby granted, provided that both the copyright
1110 notice and this permission notice appear in all copies of the
1111 software, derivative works or modified versions, and any portions
1112 thereof, and that both notices appear in supporting documentation.
1114 @sc{carnegie mellon allows free use of this software in its ``as is''
1115 condition.  carnegie mellon disclaims any liability of any kind for
1116 any damages whatsoever resulting from the use of this software.}
1118 Carnegie Mellon requests users of this software to return to
1120 @display
1121  Software Distribution Coordinator
1122  School of Computer Science
1123  Carnegie Mellon University
1124  Pittsburgh PA 15213-3890
1125 @end display
1127 @noindent
1128 or @email{Software.Distribution@@CS.CMU.EDU} any improvements or
1129 extensions that they make and grant Carnegie Mellon the rights to
1130 redistribute these changes.
1131 @end quotation
1133 @end itemize
1135 @c @bye