This file is indexed.

/usr/share/doc/glibc-doc/html/libc_37.html is in glibc-doc 2.15-0ubuntu10.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html401/loose.dtd">
<html>
<!-- This file documents the GNU C library.

This is Edition 0.13, last updated 2011-07-19,
of The GNU C Library Reference Manual, for version
2.14 (Ubuntu EGLIBC 2.15-0ubuntu10) .

Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2001, 2002,
2003, 2007, 2008, 2010, 2011 Free Software Foundation, Inc.

Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being "Free Software Needs Free Documentation"
and "GNU Lesser General Public License", the Front-Cover texts being
"A GNU Manual", and with the Back-Cover Texts as in (a) below.  A
copy of the license is included in the section entitled "GNU Free
Documentation License".

(a) The FSF's Back-Cover Text is: "You have the freedom to
copy and modify this GNU manual.  Buying copies from the FSF
supports it in developing GNU and promoting software freedom."
 -->
<!-- Created on April 20, 2012 by texi2html 1.82
texi2html was written by: 
            Lionel Cons <Lionel.Cons@cern.ch> (original author)
            Karl Berry  <karl@freefriends.org>
            Olaf Bachmann <obachman@mathematik.uni-kl.de>
            and many others.
Maintained by: Many creative people.
Send bugs and suggestions to <texi2html-bug@nongnu.org>
-->
<head>
<title>The GNU C Library: D. Library Maintenance</title>

<meta name="description" content="The GNU C Library: D. Library Maintenance">
<meta name="keywords" content="The GNU C Library: D. Library Maintenance">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="texi2html 1.82">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.smallquotation {font-size: smaller}
pre.display {font-family: serif}
pre.format {font-family: serif}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: serif; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: serif; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.roman {font-family:serif; font-weight:normal;}
span.sansserif {font-family:sans-serif; font-weight:normal;}
ul.toc {list-style: none}
-->
</style>


</head>

<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">

<a name="Maintenance"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="libc_36.html#Reporting-Bugs" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Source-Layout" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="libc_36.html#Installation" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="libc.html#Top" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="libc_38.html#Contributors" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="libc.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="libc_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="libc_42.html#Concept-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="libc_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Library-Maintenance"></a>
<h1 class="appendix">D. Library Maintenance</h1>

<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top"><a href="#Source-Layout">D.1 Adding New Functions</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">         How to add new functions or header files
                             to the GNU C library.
</td></tr>
<tr><td align="left" valign="top"><a href="#Porting">D.2 Porting the GNU C Library</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">               How to port the GNU C library to
                             a new machine or operating system.
</td></tr>
</table>

<hr size="6">
<a name="Source-Layout"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Maintenance" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Porting" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Maintenance" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Maintenance" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="libc_38.html#Contributors" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="libc.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="libc_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="libc_42.html#Concept-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="libc_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Adding-New-Functions"></a>
<h2 class="appendixsec">D.1 Adding New Functions</h2>

<p>The process of building the library is driven by the makefiles, which
make heavy use of special features of GNU <code>make</code>.  The makefiles
are very complex, and you probably don&rsquo;t want to try to understand them.
But what they do is fairly straightforward, and only requires that you
define a few variables in the right places.
</p>
<p>The library sources are divided into subdirectories, grouped by topic.
</p>
<p>The &lsquo;<tt>string</tt>&rsquo; subdirectory has all the string-manipulation
functions, &lsquo;<tt>math</tt>&rsquo; has all the mathematical functions, etc.
</p>
<p>Each subdirectory contains a simple makefile, called &lsquo;<tt>Makefile</tt>&rsquo;,
which defines a few <code>make</code> variables and then includes the global
makefile &lsquo;<tt>Rules</tt>&rsquo; with a line like:
</p>
<table><tr><td>&nbsp;</td><td><pre class="smallexample">include ../Rules
</pre></td></tr></table>

<p>The basic variables that a subdirectory makefile defines are:
</p>
<dl compact="compact">
<dt> <code>subdir</code></dt>
<dd><p>The name of the subdirectory, for example &lsquo;<tt>stdio</tt>&rsquo;.
This variable <strong>must</strong> be defined.
</p>
</dd>
<dt> <code>headers</code></dt>
<dd><p>The names of the header files in this section of the library,
such as &lsquo;<tt>stdio.h</tt>&rsquo;.
</p>
</dd>
<dt> <code>routines</code></dt>
<dt> <code>aux</code></dt>
<dd><p>The names of the modules (source files) in this section of the library.
These should be simple names, such as &lsquo;<samp>strlen</samp>&rsquo; (rather than
complete file names, such as &lsquo;<tt>strlen.c</tt>&rsquo;).  Use <code>routines</code> for
modules that define functions in the library, and <code>aux</code> for
auxiliary modules containing things like data definitions.  But the
values of <code>routines</code> and <code>aux</code> are just concatenated, so there
really is no practical difference.
</p>
</dd>
<dt> <code>tests</code></dt>
<dd><p>The names of test programs for this section of the library.  These
should be simple names, such as &lsquo;<samp>tester</samp>&rsquo; (rather than complete file
names, such as &lsquo;<tt>tester.c</tt>&rsquo;).  &lsquo;<samp>make tests</samp>&rsquo; will build and
run all the test programs.  If a test program needs input, put the test
data in a file called &lsquo;<tt><var>test-program</var>.input</tt>&rsquo;; it will be given to
the test program on its standard input.  If a test program wants to be
run with arguments, put the arguments (all on a single line) in a file
called &lsquo;<tt><var>test-program</var>.args</tt>&rsquo;.  Test programs should exit with
zero status when the test passes, and nonzero status when the test
indicates a bug in the library or error in building.
</p>
</dd>
<dt> <code>others</code></dt>
<dd><p>The names of &ldquo;other&rdquo; programs associated with this section of the
library.  These are programs which are not tests per se, but are other
small programs included with the library.  They are built by
&lsquo;<samp>make others</samp>&rsquo;.
</p>
</dd>
<dt> <code>install-lib</code></dt>
<dt> <code>install-data</code></dt>
<dt> <code>install</code></dt>
<dd><p>Files to be installed by &lsquo;<samp>make install</samp>&rsquo;.  Files listed in
&lsquo;<samp>install-lib</samp>&rsquo; are installed in the directory specified by
&lsquo;<samp>libdir</samp>&rsquo; in &lsquo;<tt>configparms</tt>&rsquo; or &lsquo;<tt>Makeconfig</tt>&rsquo;
(see section <a href="libc_36.html#Installation">Installing the GNU C Library</a>).  Files listed in <code>install-data</code> are
installed in the directory specified by &lsquo;<samp>datadir</samp>&rsquo; in
&lsquo;<tt>configparms</tt>&rsquo; or &lsquo;<tt>Makeconfig</tt>&rsquo;.  Files listed in <code>install</code>
are installed in the directory specified by &lsquo;<samp>bindir</samp>&rsquo; in
&lsquo;<tt>configparms</tt>&rsquo; or &lsquo;<tt>Makeconfig</tt>&rsquo;.
</p>
</dd>
<dt> <code>distribute</code></dt>
<dd><p>Other files from this subdirectory which should be put into a
distribution tar file.  You need not list here the makefile itself or
the source and header files listed in the other standard variables.
Only define <code>distribute</code> if there are files used in an unusual way
that should go into the distribution.
</p>
</dd>
<dt> <code>generated</code></dt>
<dd><p>Files which are generated by &lsquo;<tt>Makefile</tt>&rsquo; in this subdirectory.
These files will be removed by &lsquo;<samp>make clean</samp>&rsquo;, and they will
never go into a distribution.
</p>
</dd>
<dt> <code>extra-objs</code></dt>
<dd><p>Extra object files which are built by &lsquo;<tt>Makefile</tt>&rsquo; in this
subdirectory.  This should be a list of file names like &lsquo;<tt>foo.o</tt>&rsquo;;
the files will actually be found in whatever directory object files are
being built in.  These files will be removed by &lsquo;<samp>make clean</samp>&rsquo;.
This variable is used for secondary object files needed to build
<code>others</code> or <code>tests</code>.
</p></dd>
</dl>

<hr size="6">
<a name="Porting"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Source-Layout" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Hierarchy-Conventions" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Maintenance" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Maintenance" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="libc_38.html#Contributors" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="libc.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="libc_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="libc_42.html#Concept-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="libc_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Porting-the-GNU-C-Library"></a>
<h2 class="appendixsec">D.2 Porting the GNU C Library</h2>

<p>The GNU C library is written to be easily portable to a variety of
machines and operating systems.  Machine- and operating system-dependent
functions are well separated to make it easy to add implementations for
new machines or operating systems.  This section describes the layout of
the library source tree and explains the mechanisms used to select
machine-dependent code to use.
</p>
<p>All the machine-dependent and operating system-dependent files in the
library are in the subdirectory &lsquo;<tt>sysdeps</tt>&rsquo; under the top-level
library source directory.  This directory contains a hierarchy of
subdirectories (see section <a href="#Hierarchy-Conventions">Layout of the &lsquo;<tt>sysdeps</tt>&rsquo; Directory Hierarchy</a>).
</p>
<p>Each subdirectory of &lsquo;<tt>sysdeps</tt>&rsquo; contains source files for a
particular machine or operating system, or for a class of machine or
operating system (for example, systems by a particular vendor, or all
machines that use IEEE 754 floating-point format).  A configuration
specifies an ordered list of these subdirectories.  Each subdirectory
implicitly appends its parent directory to the list.  For example,
specifying the list &lsquo;<tt>unix/bsd/vax</tt>&rsquo; is equivalent to specifying the
list &lsquo;<tt>unix/bsd/vax unix/bsd unix</tt>&rsquo;.  A subdirectory can also specify
that it implies other subdirectories which are not directly above it in
the directory hierarchy.  If the file &lsquo;<tt>Implies</tt>&rsquo; exists in a
subdirectory, it lists other subdirectories of &lsquo;<tt>sysdeps</tt>&rsquo; which are
appended to the list, appearing after the subdirectory containing the
&lsquo;<tt>Implies</tt>&rsquo; file.  Lines in an &lsquo;<tt>Implies</tt>&rsquo; file that begin with a
&lsquo;<samp>#</samp>&rsquo; character are ignored as comments.  For example,
&lsquo;<tt>unix/bsd/Implies</tt>&rsquo; contains:
</p><table><tr><td>&nbsp;</td><td><pre class="smallexample"># BSD has Internet-related things.
unix/inet
</pre></td></tr></table>
<p>and &lsquo;<tt>unix/Implies</tt>&rsquo; contains:
</p><table><tr><td>&nbsp;</td><td><pre class="smallexample">posix
</pre></td></tr></table>

<p>So the final list is &lsquo;<tt>unix/bsd/vax unix/bsd unix/inet unix posix</tt>&rsquo;.
</p>
<p>&lsquo;<tt>sysdeps</tt>&rsquo; has a &ldquo;special&rdquo; subdirectory called &lsquo;<tt>generic</tt>&rsquo;.  It
is always implicitly appended to the list of subdirectories, so you
needn&rsquo;t put it in an &lsquo;<tt>Implies</tt>&rsquo; file, and you should not create any
subdirectories under it intended to be new specific categories.
&lsquo;<tt>generic</tt>&rsquo; serves two purposes.  First, the makefiles do not bother
to look for a system-dependent version of a file that&rsquo;s not in
&lsquo;<tt>generic</tt>&rsquo;.  This means that any system-dependent source file must
have an analogue in &lsquo;<tt>generic</tt>&rsquo;, even if the routines defined by that
file are not implemented on other platforms.  Second, the &lsquo;<tt>generic</tt>&rsquo;
version of a system-dependent file is used if the makefiles do not find
a version specific to the system you&rsquo;re compiling for.
</p>
<p>If it is possible to implement the routines in a &lsquo;<tt>generic</tt>&rsquo; file in
machine-independent C, using only other machine-independent functions in
the C library, then you should do so.  Otherwise, make them stubs.  A
<em>stub</em> function is a function which cannot be implemented on a
particular machine or operating system.  Stub functions always return an
error, and set <code>errno</code> to <code>ENOSYS</code> (Function not implemented).
See section <a href="libc_2.html#Error-Reporting">Error Reporting</a>.  If you define a stub function, you must place
the statement <code>stub_warning(<var>function</var>)</code>, where <var>function</var>
is the name of your function, after its definition; also, you must
include the file <code>&lt;stub-tag.h&gt;</code> into your file.  This causes the
function to be listed in the installed <code>&lt;gnu/stubs.h&gt;</code>, and
makes GNU ld warn when the function is used.
</p>
<p>Some rare functions are only useful on specific systems and aren&rsquo;t
defined at all on others; these do not appear anywhere in the
system-independent source code or makefiles (including the
&lsquo;<tt>generic</tt>&rsquo; directory), only in the system-dependent &lsquo;<tt>Makefile</tt>&rsquo;
in the specific system&rsquo;s subdirectory.
</p>
<p>If you come across a file that is in one of the main source directories
(&lsquo;<tt>string</tt>&rsquo;, &lsquo;<tt>stdio</tt>&rsquo;, etc.), and you want to write a machine- or
operating system-dependent version of it, move the file into
&lsquo;<tt>sysdeps/generic</tt>&rsquo; and write your new implementation in the
appropriate system-specific subdirectory.  Note that if a file is to be
system-dependent, it <strong>must not</strong> appear in one of the main source
directories.
</p>
<p>There are a few special files that may exist in each subdirectory of
&lsquo;<tt>sysdeps</tt>&rsquo;:
</p>
<dl compact="compact">
<dt> &lsquo;<tt>Makefile</tt>&rsquo;</dt>
<dd>
<p>A makefile for this machine or operating system, or class of machine or
operating system.  This file is included by the library makefile
&lsquo;<tt>Makerules</tt>&rsquo;, which is used by the top-level makefile and the
subdirectory makefiles.  It can change the variables set in the
including makefile or add new rules.  It can use GNU <code>make</code>
conditional directives based on the variable &lsquo;<samp>subdir</samp>&rsquo; (see above) to
select different sets of variables and rules for different sections of
the library.  It can also set the <code>make</code> variable
&lsquo;<samp>sysdep-routines</samp>&rsquo;, to specify extra modules to be included in the
library.  You should use &lsquo;<samp>sysdep-routines</samp>&rsquo; rather than adding
modules to &lsquo;<samp>routines</samp>&rsquo; because the latter is used in determining
what to distribute for each subdirectory of the main source tree.
</p>
<p>Each makefile in a subdirectory in the ordered list of subdirectories to
be searched is included in order.  Since several system-dependent
makefiles may be included, each should append to &lsquo;<samp>sysdep-routines</samp>&rsquo;
rather than simply setting it:
</p>
<table><tr><td>&nbsp;</td><td><pre class="smallexample">sysdep-routines := $(sysdep-routines) foo bar
</pre></td></tr></table>

</dd>
<dt> &lsquo;<tt>Subdirs</tt>&rsquo;</dt>
<dd>
<p>This file contains the names of new whole subdirectories under the
top-level library source tree that should be included for this system.
These subdirectories are treated just like the system-independent
subdirectories in the library source tree, such as &lsquo;<tt>stdio</tt>&rsquo; and
&lsquo;<tt>math</tt>&rsquo;.
</p>
<p>Use this when there are completely new sets of functions and header
files that should go into the library for the system this subdirectory
of &lsquo;<tt>sysdeps</tt>&rsquo; implements.  For example,
&lsquo;<tt>sysdeps/unix/inet/Subdirs</tt>&rsquo; contains &lsquo;<tt>inet</tt>&rsquo;; the &lsquo;<tt>inet</tt>&rsquo;
directory contains various network-oriented operations which only make
sense to put in the library on systems that support the Internet.
</p>
</dd>
<dt> &lsquo;<tt>configure</tt>&rsquo;</dt>
<dd>
<p>This file is a shell script fragment to be run at configuration time.
The top-level &lsquo;<tt>configure</tt>&rsquo; script uses the shell <code>.</code> command to
read the &lsquo;<tt>configure</tt>&rsquo; file in each system-dependent directory
chosen, in order.  The &lsquo;<tt>configure</tt>&rsquo; files are often generated from
&lsquo;<tt>configure.in</tt>&rsquo; files using Autoconf.
</p>
<p>A system-dependent &lsquo;<tt>configure</tt>&rsquo; script will usually add things to
the shell variables &lsquo;<samp>DEFS</samp>&rsquo; and &lsquo;<samp>config_vars</samp>&rsquo;; see the
top-level &lsquo;<tt>configure</tt>&rsquo; script for details.  The script can check for
&lsquo;<samp>--with-<var>package</var></samp>&rsquo; options that were passed to the
top-level &lsquo;<tt>configure</tt>&rsquo;.  For an option
&lsquo;<samp>--with-<var>package</var>=<var>value</var></samp>&rsquo; &lsquo;<tt>configure</tt>&rsquo; sets the
shell variable &lsquo;<samp>with_<var>package</var></samp>&rsquo; (with any dashes in
<var>package</var> converted to underscores) to <var>value</var>; if the option is
just &lsquo;<samp>--with-<var>package</var></samp>&rsquo; (no argument), then it sets
&lsquo;<samp>with_<var>package</var></samp>&rsquo; to &lsquo;<samp>yes</samp>&rsquo;.
</p>
</dd>
<dt> &lsquo;<tt>configure.in</tt>&rsquo;</dt>
<dd>
<p>This file is an Autoconf input fragment to be processed into the file
&lsquo;<tt>configure</tt>&rsquo; in this subdirectory.  See <a href="../autoconf/Introduction.html#Introduction">(autoconf.info)Introduction</a> section &lsquo;Introduction&rsquo; in <cite>Autoconf: Generating Automatic Configuration Scripts</cite>,
for a description of Autoconf.  You should write either &lsquo;<tt>configure</tt>&rsquo;
or &lsquo;<tt>configure.in</tt>&rsquo;, but not both.  The first line of
&lsquo;<tt>configure.in</tt>&rsquo; should invoke the <code>m4</code> macro
&lsquo;<samp>GLIBC_PROVIDES</samp>&rsquo;.  This macro does several <code>AC_PROVIDE</code> calls
for Autoconf macros which are used by the top-level &lsquo;<tt>configure</tt>&rsquo;
script; without this, those macros might be invoked again unnecessarily
by Autoconf.
</p></dd>
</dl>

<p>That is the general system for how system-dependencies are isolated.
</p>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top"><a href="#Hierarchy-Conventions">D.2.1 Layout of the &lsquo;<tt>sysdeps</tt>&rsquo; Directory Hierarchy</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">       The layout of the &lsquo;<tt>sysdeps</tt>&rsquo; hierarchy.
</td></tr>
<tr><td align="left" valign="top"><a href="#Porting-to-Unix">D.2.2 Porting the GNU C Library to Unix Systems</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">             Porting the library to an average
                                   Unix-like system.
</td></tr>
</table>

<hr size="6">
<a name="Hierarchy-Conventions"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Porting" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Porting-to-Unix" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Maintenance" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Porting" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="libc_38.html#Contributors" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="libc.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="libc_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="libc_42.html#Concept-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="libc_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Layout-of-the-sysdeps-Directory-Hierarchy"></a>
<h3 class="appendixsubsec">D.2.1 Layout of the &lsquo;<tt>sysdeps</tt>&rsquo; Directory Hierarchy</h3>

<p>A GNU configuration name has three parts: the CPU type, the
manufacturer&rsquo;s name, and the operating system.  &lsquo;<tt>configure</tt>&rsquo; uses
these to pick the list of system-dependent directories to look for.  If
the &lsquo;<samp>--nfp</samp>&rsquo; option is <em>not</em> passed to &lsquo;<tt>configure</tt>&rsquo;, the
directory &lsquo;<tt><var>machine</var>/fpu</tt>&rsquo; is also used.  The operating system
often has a <em>base operating system</em>; for example, if the operating
system is &lsquo;<samp>Linux</samp>&rsquo;, the base operating system is &lsquo;<samp>unix/sysv</samp>&rsquo;.
The algorithm used to pick the list of directories is simple:
&lsquo;<tt>configure</tt>&rsquo; makes a list of the base operating system,
manufacturer, CPU type, and operating system, in that order.  It then
concatenates all these together with slashes in between, to produce a
directory name; for example, the configuration &lsquo;<samp>i686-linux-gnu</samp>&rsquo;
results in &lsquo;<tt>unix/sysv/linux/i386/i686</tt>&rsquo;.  &lsquo;<tt>configure</tt>&rsquo; then
tries removing each element of the list in turn, so
&lsquo;<tt>unix/sysv/linux</tt>&rsquo; and &lsquo;<tt>unix/sysv</tt>&rsquo; are also tried, among others.
Since the precise version number of the operating system is often not
important, and it would be very inconvenient, for example, to have
identical &lsquo;<tt>irix6.2</tt>&rsquo; and &lsquo;<tt>irix6.3</tt>&rsquo; directories,
&lsquo;<tt>configure</tt>&rsquo; tries successively less specific operating system names
by removing trailing suffixes starting with a period.
</p>
<p>As an example, here is the complete list of directories that would be
tried for the configuration &lsquo;<samp>i686-linux-gnu</samp>&rsquo; (with the
&lsquo;<tt>crypt</tt>&rsquo; and &lsquo;<tt>linuxthreads</tt>&rsquo; add-on):
</p>
<table><tr><td>&nbsp;</td><td><pre class="smallexample">sysdeps/i386/elf
crypt/sysdeps/unix
linuxthreads/sysdeps/unix/sysv/linux
linuxthreads/sysdeps/pthread
linuxthreads/sysdeps/unix/sysv
linuxthreads/sysdeps/unix
linuxthreads/sysdeps/i386/i686
linuxthreads/sysdeps/i386
linuxthreads/sysdeps/pthread/no-cmpxchg
sysdeps/unix/sysv/linux/i386
sysdeps/unix/sysv/linux
sysdeps/gnu
sysdeps/unix/common
sysdeps/unix/mman
sysdeps/unix/inet
sysdeps/unix/sysv/i386/i686
sysdeps/unix/sysv/i386
sysdeps/unix/sysv
sysdeps/unix/i386
sysdeps/unix
sysdeps/posix
sysdeps/i386/i686
sysdeps/i386/i486
sysdeps/libm-i387/i686
sysdeps/i386/fpu
sysdeps/libm-i387
sysdeps/i386
sysdeps/wordsize-32
sysdeps/ieee754
sysdeps/libm-ieee754
sysdeps/generic
</pre></td></tr></table>

<p>Different machine architectures are conventionally subdirectories at the
top level of the &lsquo;<tt>sysdeps</tt>&rsquo; directory tree.  For example,
&lsquo;<tt>sysdeps/sparc</tt>&rsquo; and &lsquo;<tt>sysdeps/m68k</tt>&rsquo;.  These contain
files specific to those machine architectures, but not specific to any
particular operating system.  There might be subdirectories for
specializations of those architectures, such as
&lsquo;<tt>sysdeps/m68k/68020</tt>&rsquo;. Code which is specific to the
floating-point coprocessor used with a particular machine should go in
&lsquo;<tt>sysdeps/<var>machine</var>/fpu</tt>&rsquo;.
</p>
<p>There are a few directories at the top level of the &lsquo;<tt>sysdeps</tt>&rsquo;
hierarchy that are not for particular machine architectures.
</p>
<dl compact="compact">
<dt> &lsquo;<tt>generic</tt>&rsquo;</dt>
<dd><p>As described above (see section <a href="#Porting">Porting the GNU C Library</a>), this is the subdirectory
that every configuration implicitly uses after all others.
</p>
</dd>
<dt> &lsquo;<tt>ieee754</tt>&rsquo;</dt>
<dd><p>This directory is for code using the IEEE 754 floating-point format,
where the C type <code>float</code> is IEEE 754 single-precision format, and
<code>double</code> is IEEE 754 double-precision format.  Usually this
directory is referred to in the &lsquo;<tt>Implies</tt>&rsquo; file in a machine
architecture-specific directory, such as &lsquo;<tt>m68k/Implies</tt>&rsquo;.
</p>
</dd>
<dt> &lsquo;<tt>libm-ieee754</tt>&rsquo;</dt>
<dd><p>This directory contains an implementation of a mathematical library
usable on platforms which use IEEE 754 conformant floating-point
arithmetic.
</p>
</dd>
<dt> &lsquo;<tt>libm-i387</tt>&rsquo;</dt>
<dd><p>This is a special case.  Ideally the code should be in
&lsquo;<tt>sysdeps/i386/fpu</tt>&rsquo; but for various reasons it is kept aside.
</p>
</dd>
<dt> &lsquo;<tt>posix</tt>&rsquo;</dt>
<dd><p>This directory contains implementations of things in the library in
terms of <small>POSIX.1</small> functions.  This includes some of the <small>POSIX.1</small>
functions themselves.  Of course, <small>POSIX.1</small> cannot be completely
implemented in terms of itself, so a configuration using just
&lsquo;<tt>posix</tt>&rsquo; cannot be complete.
</p>
</dd>
<dt> &lsquo;<tt>unix</tt>&rsquo;</dt>
<dd><p>This is the directory for Unix-like things.  See section <a href="#Porting-to-Unix">Porting the GNU C Library to Unix Systems</a>.
&lsquo;<tt>unix</tt>&rsquo; implies &lsquo;<tt>posix</tt>&rsquo;.  There are some special-purpose
subdirectories of &lsquo;<tt>unix</tt>&rsquo;:
</p>
<dl compact="compact">
<dt> &lsquo;<tt>unix/common</tt>&rsquo;</dt>
<dd><p>This directory is for things common to both BSD and System V release 4.
Both &lsquo;<tt>unix/bsd</tt>&rsquo; and &lsquo;<tt>unix/sysv/sysv4</tt>&rsquo; imply &lsquo;<tt>unix/common</tt>&rsquo;.
</p>
</dd>
<dt> &lsquo;<tt>unix/inet</tt>&rsquo;</dt>
<dd><p>This directory is for <code>socket</code> and related functions on Unix systems.
&lsquo;<tt>unix/inet/Subdirs</tt>&rsquo; enables the &lsquo;<tt>inet</tt>&rsquo; top-level subdirectory.
&lsquo;<tt>unix/common</tt>&rsquo; implies &lsquo;<tt>unix/inet</tt>&rsquo;.
</p></dd>
</dl>

</dd>
<dt> &lsquo;<tt>mach</tt>&rsquo;</dt>
<dd><p>This is the directory for things based on the Mach microkernel from CMU
(including the GNU operating system).  Other basic operating systems
(VMS, for example) would have their own directories at the top level of
the &lsquo;<tt>sysdeps</tt>&rsquo; hierarchy, parallel to &lsquo;<tt>unix</tt>&rsquo; and &lsquo;<tt>mach</tt>&rsquo;.
</p></dd>
</dl>

<hr size="6">
<a name="Porting-to-Unix"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Hierarchy-Conventions" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="libc_38.html#Contributors" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#Maintenance" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Porting" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="libc_38.html#Contributors" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="libc.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="libc_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="libc_42.html#Concept-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="libc_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Porting-the-GNU-C-Library-to-Unix-Systems"></a>
<h3 class="appendixsubsec">D.2.2 Porting the GNU C Library to Unix Systems</h3>

<p>Most Unix systems are fundamentally very similar.  There are variations
between different machines, and variations in what facilities are
provided by the kernel.  But the interface to the operating system
facilities is, for the most part, pretty uniform and simple.
</p>
<p>The code for Unix systems is in the directory &lsquo;<tt>unix</tt>&rsquo;, at the top
level of the &lsquo;<tt>sysdeps</tt>&rsquo; hierarchy.  This directory contains
subdirectories (and subdirectory trees) for various Unix variants.
</p>
<p>The functions which are system calls in most Unix systems are
implemented in assembly code, which is generated automatically from
specifications in files named &lsquo;<tt>syscalls.list</tt>&rsquo;.  There are several
such files, one in &lsquo;<tt>sysdeps/unix</tt>&rsquo; and others in its subdirectories.
Some special system calls are implemented in files that are named with a
suffix of &lsquo;<samp>.S</samp>&rsquo;; for example, &lsquo;<tt>_exit.S</tt>&rsquo;.  Files ending in
&lsquo;<samp>.S</samp>&rsquo; are run through the C preprocessor before being fed to the
assembler.
</p>
<p>These files all use a set of macros that should be defined in
&lsquo;<tt>sysdep.h</tt>&rsquo;.  The &lsquo;<tt>sysdep.h</tt>&rsquo; file in &lsquo;<tt>sysdeps/unix</tt>&rsquo;
partially defines them; a &lsquo;<tt>sysdep.h</tt>&rsquo; file in another directory must
finish defining them for the particular machine and operating system
variant.  See &lsquo;<tt>sysdeps/unix/sysdep.h</tt>&rsquo; and the machine-specific
&lsquo;<tt>sysdep.h</tt>&rsquo; implementations to see what these macros are and what
they should do.
</p>
<p>The system-specific makefile for the &lsquo;<tt>unix</tt>&rsquo; directory
(&lsquo;<tt>sysdeps/unix/Makefile</tt>&rsquo;) gives rules to generate several files
from the Unix system you are building the library on (which is assumed
to be the target system you are building the library <em>for</em>).  All
the generated files are put in the directory where the object files are
kept; they should not affect the source tree itself.  The files
generated are &lsquo;<tt>ioctls.h</tt>&rsquo;, &lsquo;<tt>errnos.h</tt>&rsquo;, &lsquo;<tt>sys/param.h</tt>&rsquo;, and
&lsquo;<tt>errlist.c</tt>&rsquo; (for the &lsquo;<tt>stdio</tt>&rsquo; section of the library).
</p>
<hr size="6">
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Maintenance" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="libc_38.html#Contributors" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="libc.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="libc_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="libc_42.html#Concept-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="libc_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<p>
 <font size="-1">
  This document was generated by <em>root</em> on <em>April 20, 2012</em> using <a href="http://www.nongnu.org/texi2html/"><em>texi2html 1.82</em></a>.
 </font>
 <br>

</p>
</body>
</html>