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