configure.info
110 KB
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
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
This is configure.info, produced by makeinfo version 4.6 from
./configure.texi.
INFO-DIR-SECTION GNU admin
START-INFO-DIR-ENTRY
* configure: (configure). The GNU configure and build system
END-INFO-DIR-ENTRY
This file documents the GNU configure and build system.
Copyright (C) 1998 Cygnus Solutions.
Permission is granted to make and distribute verbatim copies of this
manual provided the copyright notice and this permission notice are
preserved on all copies.
Permission is granted to copy and distribute modified versions of
this manual under the conditions for verbatim copying, provided that
the entire resulting derived work is distributed under the terms of a
permission notice identical to this one.
Permission is granted to copy and distribute translations of this
manual into another language, under the above conditions for modified
versions, except that this permission notice may be stated in a
translation approved by the Foundation.
File: configure.info, Node: Top, Next: Introduction, Up: (dir)
GNU configure and build system
******************************
The GNU configure and build system.
* Menu:
* Introduction:: Introduction.
* Getting Started:: Getting Started.
* Files:: Files.
* Configuration Names:: Configuration Names.
* Cross Compilation Tools:: Cross Compilation Tools.
* Canadian Cross:: Canadian Cross.
* Cygnus Configure:: Cygnus Configure.
* Multilibs:: Multilibs.
* FAQ:: Frequently Asked Questions.
* Index:: Index.
File: configure.info, Node: Introduction, Next: Getting Started, Prev: Top, Up: Top
Introduction
************
This document describes the GNU configure and build systems. It
describes how autoconf, automake, libtool, and make fit together. It
also includes a discussion of the older Cygnus configure system.
This document does not describe in detail how to use each of the
tools; see the respective manuals for that. Instead, it describes
which files the developer must write, which files are machine generated
and how they are generated, and where certain common problems should be
addressed.
This document draws on several sources, including the autoconf
manual by David MacKenzie (*note autoconf overview: (autoconf)Top.),
the automake manual by David MacKenzie and Tom Tromey (*note automake
overview: (automake)Top.), the libtool manual by Gordon Matzigkeit
(*note libtool overview: (libtool)Top.), and the Cygnus configure
manual by K. Richard Pixley.
* Menu:
* Goals:: Goals.
* Tools:: The tools.
* History:: History.
* Building:: Building.
File: configure.info, Node: Goals, Next: Tools, Up: Introduction
Goals
=====
The GNU configure and build system has two main goals.
The first is to simplify the development of portable programs. The
system permits the developer to concentrate on writing the program,
simplifying many details of portability across Unix and even Windows
systems, and permitting the developer to describe how to build the
program using simple rules rather than complex Makefiles.
The second is to simplify the building of programs distributed as
source code. All programs are built using a simple, standardized, two
step process. The program builder need not install any special tools in
order to build the program.
File: configure.info, Node: Tools, Next: History, Prev: Goals, Up: Introduction
Tools
=====
The GNU configure and build system is comprised of several different
tools. Program developers must build and install all of these tools.
People who just want to build programs from distributed sources
normally do not need any special tools beyond a Unix shell, a make
program, and a C compiler.
autoconf
provides a general portability framework, based on testing the
features of the host system at build time.
automake
a system for describing how to build a program, permitting the
developer to write a simplified `Makefile'.
libtool
a standardized approach to building shared libraries.
gettext
provides a framework for translation of text messages into other
languages; not really discussed in this document.
m4
autoconf requires the GNU version of m4; the standard Unix m4 does
not suffice.
perl
automake requires perl.
File: configure.info, Node: History, Next: Building, Prev: Tools, Up: Introduction
History
=======
This is a very brief and probably inaccurate history.
As the number of Unix variants increased during the 1980s, it became
harder to write programs which could run on all variants. While it was
often possible to use `#ifdef' to identify particular systems,
developers frequently did not have access to every system, and the
characteristics of some systems changed from version to version.
By 1992, at least three different approaches had been developed:
* The Metaconfig program, by Larry Wall, Harlan Stenn, and Raphael
Manfredi.
* The Cygnus configure script, by K. Richard Pixley, and the gcc
configure script, by Richard Stallman. These use essentially the
same approach, and the developers communicated regularly.
* The autoconf program, by David MacKenzie.
The Metaconfig program is still used for Perl and a few other
programs. It is part of the Dist package. I do not know if it is
being developed.
In 1994, David MacKenzie and others modified autoconf to incorporate
all the features of Cygnus configure. Since then, there has been a
slow but steady conversion of GNU programs from Cygnus configure to
autoconf. gcc has been converted, eliminating the gcc configure script.
GNU autoconf was regularly maintained until late 1996. As of this
writing in June, 1998, it has no public maintainer.
Most programs are built using the make program, which requires the
developer to write Makefiles describing how to build the programs.
Since most programs are built in pretty much the same way, this led to a
lot of duplication.
The X Window system is built using the imake tool, which uses a
database of rules to eliminate the duplication. However, building a
tool which was developed using imake requires that the builder have
imake installed, violating one of the goals of the GNU system.
The new BSD make provides a standard library of Makefile fragments,
which permits developers to write very simple Makefiles. However, this
requires that the builder install the new BSD make program.
In 1994, David MacKenzie wrote the first version of automake, which
permitted writing a simple build description which was converted into a
Makefile which could be used by the standard make program. In 1995, Tom
Tromey completely rewrote automake in Perl, and he continues to enhance
it.
Various free packages built libraries, and by around 1995 several
included support to build shared libraries on various platforms.
However, there was no consistent approach. In early 1996, Gordon
Matzigkeit began working on libtool, which provided a standardized
approach to building shared libraries. This was integrated into
automake from the start.
The development of automake and libtool was driven by the GNITS
project, a group of GNU maintainers who designed standardized tools to
help meet the GNU coding standards.
File: configure.info, Node: Building, Prev: History, Up: Introduction
Building
========
Most readers of this document should already know how to build a tool by
running `configure' and `make'. This section may serve as a quick
introduction or reminder.
Building a tool is normally as simple as running `configure'
followed by `make'. You should normally run `configure' from an empty
directory, using some path to refer to the `configure' script in the
source directory. The directory in which you run `configure' is called
the "object directory".
In order to use a object directory which is different from the source
directory, you must be using the GNU version of `make', which has the
required `VPATH' support. Despite this restriction, using a different
object directory is highly recommended:
* It keeps the files generated during the build from cluttering up
your sources.
* It permits you to remove the built files by simply removing the
entire build directory.
* It permits you to build from the same sources with several sets of
configure options simultaneously.
If you don't have GNU `make', you will have to run `configure' in
the source directory. All GNU packages should support this; in
particular, GNU packages should not assume the presence of GNU `make'.
After running `configure', you can build the tools by running `make'.
To install the tools, run `make install'. Installing the tools will
copy the programs and any required support files to the "installation
directory". The location of the installation directory is controlled
by `configure' options, as described below.
In the Cygnus tree at present, the info files are built and
installed as a separate step. To build them, run `make info'. To
install them, run `make install-info'.
All `configure' scripts support a wide variety of options. The most
interesting ones are `--with' and `--enable' options which are
generally specific to particular tools. You can usually use the
`--help' option to get a list of interesting options for a particular
configure script.
The only generic options you are likely to use are the `--prefix'
and `--exec-prefix' options. These options are used to specify the
installation directory.
The directory named by the `--prefix' option will hold machine
independent files such as info files.
The directory named by the `--exec-prefix' option, which is normally
a subdirectory of the `--prefix' directory, will hold machine dependent
files such as executables.
The default for `--prefix' is `/usr/local'. The default for
`--exec-prefix' is the value used for `--prefix'.
The convention used in Cygnus releases is to use a `--prefix' option
of `/usr/cygnus/RELEASE', where RELEASE is the name of the release, and
to use a `--exec-prefix' option of `/usr/cygnus/RELEASE/H-HOST', where
HOST is the configuration name of the host system (*note Configuration
Names::).
Do not use either the source or the object directory as the
installation directory. That will just lead to confusion.
File: configure.info, Node: Getting Started, Next: Files, Prev: Introduction, Up: Top
Getting Started
***************
To start using the GNU configure and build system with your software
package, you must write three files, and you must run some tools to
manually generate additional files.
* Menu:
* Write configure.in:: Write configure.in.
* Write Makefile.am:: Write Makefile.am.
* Write acconfig.h:: Write acconfig.h.
* Generate files:: Generate files.
* Getting Started Example:: Example.
File: configure.info, Node: Write configure.in, Next: Write Makefile.am, Up: Getting Started
Write configure.in
==================
You must first write the file `configure.in'. This is an autoconf
input file, and the autoconf manual describes in detail what this file
should look like.
You will write tests in your `configure.in' file to check for
conditions that may change from one system to another, such as the
presence of particular header files or functions.
For example, not all systems support the `gettimeofday' function.
If you want to use the `gettimeofday' function when it is available,
and to use some other function when it is not, you would check for this
by putting `AC_CHECK_FUNCS(gettimeofday)' in `configure.in'.
When the configure script is run at build time, this will arrange to
define the preprocessor macro `HAVE_GETTIMEOFDAY' to the value 1 if the
`gettimeofday' function is available, and to not define the macro at
all if the function is not available. Your code can then use `#ifdef'
to test whether it is safe to call `gettimeofday'.
If you have an existing body of code, the `autoscan' program may
help identify potential portability problems, and hence configure tests
that you will want to use. *Note Invoking autoscan: (autoconf)Invoking
autoscan.
Another handy tool for an existing body of code is `ifnames'. This
will show you all the preprocessor conditionals that the code already
uses. *Note Invoking ifnames: (autoconf)Invoking ifnames.
Besides the portability tests which are specific to your particular
package, every `configure.in' file should contain the following macros.
`AC_INIT'
This macro takes a single argument, which is the name of a file in
your package. For example, `AC_INIT(foo.c)'.
`AC_PREREQ(VERSION)'
This macro is optional. It may be used to indicate the version of
`autoconf' that you are using. This will prevent users from
running an earlier version of `autoconf' and perhaps getting an
invalid `configure' script. For example, `AC_PREREQ(2.12)'.
`AM_INIT_AUTOMAKE'
This macro takes two arguments: the name of the package, and a
version number. For example, `AM_INIT_AUTOMAKE(foo, 1.0)'. (This
macro is not needed if you are not using automake).
`AM_CONFIG_HEADER'
This macro names the header file which will hold the preprocessor
macro definitions at run time. Normally this should be
`config.h'. Your sources would then use `#include "config.h"' to
include it.
This macro may optionally name the input file for that header
file; by default, this is `config.h.in', but that file name works
poorly on DOS filesystems. Therefore, it is often better to name
it explicitly as `config.in'.
This is what you should normally put in `configure.in':
AM_CONFIG_HEADER(config.h:config.in)
(If you are not using automake, use `AC_CONFIG_HEADER' rather than
`AM_CONFIG_HEADER').
`AM_MAINTAINER_MODE'
This macro always appears in Cygnus configure scripts. Other
programs may or may not use it.
If this macro is used, the `--enable-maintainer-mode' option is
required to enable automatic rebuilding of generated files used by
the configure system. This of course requires that developers be
aware of, and use, that option.
If this macro is not used, then the generated files will always be
rebuilt automatically. This will cause problems if the wrong
versions of autoconf, automake, or others are in the builder's
`PATH'.
(If you are not using automake, you do not need to use this macro).
`AC_EXEEXT'
Either this macro or `AM_EXEEXT' always appears in Cygnus configure
files. Other programs may or may not use one of them.
This macro looks for the executable suffix used on the host
system. On Unix systems, this is the empty string. On Windows
systems, this is `.exe'. This macro directs automake to use the
executable suffix as appropriate when creating programs. This
macro does not take any arguments.
The `AC_EXEEXT' form is new, and is part of a Cygnus patch to
autoconf to support compiling with Visual C++. Older programs use
`AM_EXEEXT' instead.
(Programs which do not use automake use neither `AC_EXEEXT' nor
`AM_EXEEXT').
`AC_PROG_CC'
If you are writing C code, you will normally want to use this
macro. It locates the C compiler to use. It does not take any
arguments.
However, if this `configure.in' file is for a library which is to
be compiled by a cross compiler which may not fully work, then you
will not want to use `AC_PROG_CC'. Instead, you will want to use a
variant which does not call the macro `AC_PROG_CC_WORKS'. Examples
can be found in various `configure.in' files for libraries that are
compiled with cross compilers, such as libiberty or libgloss.
This is essentially a bug in autoconf, and there will probably be
a better workaround at some point.
`AC_PROG_CXX'
If you are writing C++ code, you will want to use this macro. It
locates the C++ compiler to use. It does not take any arguments.
The same cross compiler comments apply as for `AC_PROG_CC'.
`AM_PROG_LIBTOOL'
If you want to build libraries, and you want to permit them to be
shared, or you want to link against libraries which were built
using libtool, then you will need this macro. This macro is
required in order to use libtool.
By default, this will cause all libraries to be built as shared
libraries. To prevent this-to change the default-use
`AM_DISABLE_SHARED' before `AM_PROG_LIBTOOL'. The configure
options `--enable-shared' and `--disable-shared' may be used to
override the default at build time.
`AC_DEFINE(_GNU_SOURCE)'
GNU packages should normally include this line before any other
feature tests. This defines the macro `_GNU_SOURCE' when
compiling, which directs the libc header files to provide the
standard GNU system interfaces including all GNU extensions. If
this macro is not defined, certain GNU extensions may not be
available.
`AC_OUTPUT'
This macro takes a list of file names which the configure process
should produce. This is normally a list of one or more `Makefile'
files in different directories. If your package lives entirely in
a single directory, you would use simply `AC_OUTPUT(Makefile)'.
If you also have, for example, a `lib' subdirectory, you would use
`AC_OUTPUT(Makefile lib/Makefile)'.
If you want to use locally defined macros in your `configure.in'
file, then you will need to write a `acinclude.m4' file which defines
them (if not using automake, this file is called `aclocal.m4').
Alternatively, you can put separate macros in an `m4' subdirectory, and
put `ACLOCAL_AMFLAGS = -I m4' in your `Makefile.am' file so that the
`aclocal' program will be able to find them.
The different macro prefixes indicate which tool defines the macro.
Macros which start with `AC_' are part of autoconf. Macros which start
with `AM_' are provided by automake or libtool.
File: configure.info, Node: Write Makefile.am, Next: Write acconfig.h, Prev: Write configure.in, Up: Getting Started
Write Makefile.am
=================
You must write the file `Makefile.am'. This is an automake input file,
and the automake manual describes in detail what this file should look
like.
The automake commands in `Makefile.am' mostly look like variable
assignments in a `Makefile'. automake recognizes special variable
names, and automatically add make rules to the output as needed.
There will be one `Makefile.am' file for each directory in your
package. For each directory with subdirectories, the `Makefile.am'
file should contain the line
SUBDIRS = DIR DIR ...
where each DIR is the name of a subdirectory.
For each `Makefile.am', there should be a corresponding `Makefile'
in the `AC_OUTPUT' macro in `configure.in'.
Every `Makefile.am' written at Cygnus should contain the line
AUTOMAKE_OPTIONS = cygnus
This puts automake into Cygnus mode. See the automake manual for
details.
You may to include the version number of `automake' that you are
using on the `AUTOMAKE_OPTIONS' line. For example,
AUTOMAKE_OPTIONS = cygnus 1.3
This will prevent users from running an earlier version of `automake'
and perhaps getting an invalid `Makefile.in'.
If your package builds a program, then in the directory where that
program is built you will normally want a line like
bin_PROGRAMS = PROGRAM
where PROGRAM is the name of the program. You will then want a line
like
PROGRAM_SOURCES = FILE FILE ...
where each FILE is the name of a source file to link into the program
(e.g., `foo.c').
If your package builds a library, and you do not want the library to
ever be built as a shared library, then in the directory where that
library is built you will normally want a line like
lib_LIBRARIES = libNAME.a
where `libNAME.a' is the name of the library. You will then want a
line like
libNAME_a_SOURCES = FILE FILE ...
where each FILE is the name of a source file to add to the library.
If your package builds a library, and you want to permit building the
library as a shared library, then in the directory where that library is
built you will normally want a line like
lib_LTLIBRARIES = libNAME.la
The use of `LTLIBRARIES', and the `.la' extension, indicate a
library to be built using libtool. As usual, you will then want a line
like
libNAME_la_SOURCES = FILE FILE ...
The strings `bin' and `lib' that appear above in `bin_PROGRAMS' and
`lib_LIBRARIES' are not arbitrary. They refer to particular
directories, which may be set by the `--bindir' and `--libdir' options
to `configure'. If those options are not used, the default values are
based on the `--prefix' or `--exec-prefix' options to `configure'. It
is possible to use other names if the program or library should be
installed in some other directory.
The `Makefile.am' file may also contain almost anything that may
appear in a normal `Makefile'. automake also supports many other
special variables, as well as conditionals.
See the automake manual for more information.
File: configure.info, Node: Write acconfig.h, Next: Generate files, Prev: Write Makefile.am, Up: Getting Started
Write acconfig.h
================
If you are generating a portability header file, (i.e., you are using
`AM_CONFIG_HEADER' in `configure.in'), then you will have to write a
`acconfig.h' file. It will have to contain the following lines.
/* Name of package. */
#undef PACKAGE
/* Version of package. */
#undef VERSION
This requirement is really a bug in the system, and the requirement
may be eliminated at some later date.
The `acconfig.h' file will also similar comment and `#undef' lines
for any unusual macros in the `configure.in' file, including any macro
which appears in a `AC_DEFINE' macro.
In particular, if you are writing a GNU package and therefore include
`AC_DEFINE(_GNU_SOURCE)' in `configure.in' as suggested above, you will
need lines like this in `acconfig.h':
/* Enable GNU extensions. */
#undef _GNU_SOURCE
Normally the `autoheader' program will inform you of any such
requirements by printing an error message when it is run. However, if
you do anything particular odd in your `configure.in' file, you will
have to make sure that the right entries appear in `acconfig.h', since
otherwise the results of the tests may not be available in the
`config.h' file which your code will use.
(Thee `PACKAGE' and `VERSION' lines are not required if you are not
using automake, and in that case you may not need a `acconfig.h' file
at all).
File: configure.info, Node: Generate files, Next: Getting Started Example, Prev: Write acconfig.h, Up: Getting Started
Generate files
==============
Once you have written `configure.in', `Makefile.am', `acconfig.h', and
possibly `acinclude.m4', you must use autoconf and automake programs to
produce the first versions of the generated files. This is done by
executing the following sequence of commands.
aclocal
autoconf
autoheader
automake
The `aclocal' and `automake' commands are part of the automake
package, and the `autoconf' and `autoheader' commands are part of the
autoconf package.
If you are using a `m4' subdirectory for your macros, you will need
to use the `-I m4' option when you run `aclocal'.
If you are not using the Cygnus tree, use the `-a' option when
running `automake' command in order to copy the required support files
into your source directory.
If you are using libtool, you must build and install the libtool
package with the same `--prefix' and `--exec-prefix' options as you
used with the autoconf and automake packages. You must do this before
running any of the above commands. If you are not using the Cygnus
tree, you will need to run the `libtoolize' program to copy the libtool
support files into your directory.
Once you have managed to run these commands without getting any
errors, you should create a new empty directory, and run the `configure'
script which will have been created by `autoconf' with the
`--enable-maintainer-mode' option. This will give you a set of
Makefiles which will include rules to automatically rebuild all the
generated files.
After doing that, whenever you have changed some of the input files
and want to regenerated the other files, go to your object directory
and run `make'. Doing this is more reliable than trying to rebuild the
files manually, because there are complex order dependencies and it is
easy to forget something.
File: configure.info, Node: Getting Started Example, Prev: Generate files, Up: Getting Started
Example
=======
Let's consider a trivial example.
Suppose we want to write a simple version of `touch'. Our program,
which we will call `poke', will take a single file name argument, and
use the `utime' system call to set the modification and access times of
the file to the current time. We want this program to be highly
portable.
We'll first see what this looks like without using autoconf and
automake, and then see what it looks like with them.
* Menu:
* Getting Started Example 1:: First Try.
* Getting Started Example 2:: Second Try.
* Getting Started Example 3:: Third Try.
* Generate Files in Example:: Generate Files.
File: configure.info, Node: Getting Started Example 1, Next: Getting Started Example 2, Up: Getting Started Example
First Try
---------
Here is our first try at `poke.c'. Note that we've written it without
ANSI/ISO C prototypes, since we want it to be highly portable.
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <utime.h>
int
main (argc, argv)
int argc;
char **argv;
{
if (argc != 2)
{
fprintf (stderr, "Usage: poke file\n");
exit (1);
}
if (utime (argv[1], NULL) < 0)
{
perror ("utime");
exit (1);
}
exit (0);
}
We also write a simple `Makefile'.
CC = gcc
CFLAGS = -g -O2
all: poke
poke: poke.o
$(CC) -o poke $(CFLAGS) $(LDFLAGS) poke.o
So far, so good.
Unfortunately, there are a few problems.
On older Unix systems derived from BSD 4.3, the `utime' system call
does not accept a second argument of `NULL'. On those systems, we need
to pass a pointer to `struct utimbuf' structure. Unfortunately, even
older systems don't define that structure; on those systems, we need to
pass an array of two `long' values.
The header file `stdlib.h' was invented by ANSI C, and older systems
don't have a copy. We included it above to get a declaration of `exit'.
We can find some of these portability problems by running
`autoscan', which will create a `configure.scan' file which we can use
as a prototype for our `configure.in' file. I won't show the output,
but it will notice the potential problems with `utime' and `stdlib.h'.
In our `Makefile', we don't provide any way to install the program.
This doesn't matter much for such a simple example, but a real program
will need an `install' target. For that matter, we will also want a
`clean' target.
File: configure.info, Node: Getting Started Example 2, Next: Getting Started Example 3, Prev: Getting Started Example 1, Up: Getting Started Example
Second Try
----------
Here is our second try at this program.
We modify `poke.c' to use preprocessor macros to control what
features are available. (I've cheated a bit by using the same macro
names which autoconf will use).
#include <stdio.h>
#ifdef STDC_HEADERS
#include <stdlib.h>
#endif
#include <sys/types.h>
#ifdef HAVE_UTIME_H
#include <utime.h>
#endif
#ifndef HAVE_UTIME_NULL
#include <time.h>
#ifndef HAVE_STRUCT_UTIMBUF
struct utimbuf
{
long actime;
long modtime;
};
#endif
static int
utime_now (file)
char *file;
{
struct utimbuf now;
now.actime = now.modtime = time (NULL);
return utime (file, &now);
}
#define utime(f, p) utime_now (f)
#endif /* HAVE_UTIME_NULL */
int
main (argc, argv)
int argc;
char **argv;
{
if (argc != 2)
{
fprintf (stderr, "Usage: poke file\n");
exit (1);
}
if (utime (argv[1], NULL) < 0)
{
perror ("utime");
exit (1);
}
exit (0);
}
Here is the associated `Makefile'. We've added support for the
preprocessor flags we use. We've also added `install' and `clean'
targets.
# Set this to your installation directory.
bindir = /usr/local/bin
# Uncomment this if you have the standard ANSI/ISO C header files.
# STDC_HDRS = -DSTDC_HEADERS
# Uncomment this if you have utime.h.
# UTIME_H = -DHAVE_UTIME_H
# Uncomment this if utime (FILE, NULL) works on your system.
# UTIME_NULL = -DHAVE_UTIME_NULL
# Uncomment this if struct utimbuf is defined in utime.h.
# UTIMBUF = -DHAVE_STRUCT_UTIMBUF
CC = gcc
CFLAGS = -g -O2
ALL_CFLAGS = $(STDC_HDRS) $(UTIME_H) $(UTIME_NULL) $(UTIMBUF) $(CFLAGS)
all: poke
poke: poke.o
$(CC) -o poke $(ALL_CFLAGS) $(LDFLAGS) poke.o
.c.o:
$(CC) -c $(ALL_CFLAGS) poke.c
install: poke
cp poke $(bindir)/poke
clean:
rm poke poke.o
Some problems with this approach should be clear.
Users who want to compile poke will have to know how `utime' works
on their systems, so that they can uncomment the `Makefile' correctly.
The installation is done using `cp', but many systems have an
`install' program which may be used, and which supports optional
features such as stripping debugging information out of the installed
binary.
The use of `Makefile' variables like `CC', `CFLAGS' and `LDFLAGS'
follows the requirements of the GNU standards. This is convenient for
all packages, since it reduces surprises for users. However, it is
easy to get the details wrong, and wind up with a slightly nonstandard
distribution.
File: configure.info, Node: Getting Started Example 3, Next: Generate Files in Example, Prev: Getting Started Example 2, Up: Getting Started Example
Third Try
---------
For our third try at this program, we will write a `configure.in'
script to discover the configuration features on the host system, rather
than requiring the user to edit the `Makefile'. We will also write a
`Makefile.am' rather than a `Makefile'.
The only change to `poke.c' is to add a line at the start of the
file:
#include "config.h"
The new `configure.in' file is as follows.
AC_INIT(poke.c)
AM_INIT_AUTOMAKE(poke, 1.0)
AM_CONFIG_HEADER(config.h:config.in)
AC_PROG_CC
AC_HEADER_STDC
AC_CHECK_HEADERS(utime.h)
AC_EGREP_HEADER(utimbuf, utime.h, AC_DEFINE(HAVE_STRUCT_UTIMBUF))
AC_FUNC_UTIME_NULL
AC_OUTPUT(Makefile)
The first four macros in this file, and the last one, were described
above; see *Note Write configure.in::. If we omit these macros, then
when we run `automake' we will get a reminder that we need them.
The other macros are standard autoconf macros.
`AC_HEADER_STDC'
Check for standard C headers.
`AC_CHECK_HEADERS'
Check whether a particular header file exists.
`AC_EGREP_HEADER'
Check for a particular string in a particular header file, in this
case checking for `utimbuf' in `utime.h'.
`AC_FUNC_UTIME_NULL'
Check whether `utime' accepts a NULL second argument to set the
file change time to the current time.
See the autoconf manual for a more complete description.
The new `Makefile.am' file is as follows. Note how simple this is
compared to our earlier `Makefile'.
bin_PROGRAMS = poke
poke_SOURCES = poke.c
This means that we should build a single program name `poke'. It
should be installed in the binary directory, which we called `bindir'
earlier. The program `poke' is built from the source file `poke.c'.
We must also write a `acconfig.h' file. Besides `PACKAGE' and
`VERSION', which must be mentioned for all packages which use automake,
we must include `HAVE_STRUCT_UTIMBUF', since we mentioned it in an
`AC_DEFINE'.
/* Name of package. */
#undef PACKAGE
/* Version of package. */
#undef VERSION
/* Whether utime.h defines struct utimbuf. */
#undef HAVE_STRUCT_UTIMBUF
File: configure.info, Node: Generate Files in Example, Prev: Getting Started Example 3, Up: Getting Started Example
Generate Files
--------------
We must now generate the other files, using the following commands.
aclocal
autoconf
autoheader
automake
When we run `autoheader', it will remind us of any macros we forgot
to add to `acconfig.h'.
When we run `automake', it will want to add some files to our
distribution. It will add them automatically if we use the
`--add-missing' option.
By default, `automake' will run in GNU mode, which means that it
will want us to create certain additional files; as of this writing, it
will want `NEWS', `README', `AUTHORS', and `ChangeLog', all of which
are files which should appear in a standard GNU distribution. We can
either add those files, or run `automake' with the `--foreign' option.
Running these tools will generate the following files, all of which
are described in the next chapter.
* `aclocal.m4'
* `configure'
* `config.in'
* `Makefile.in'
* `stamp-h.in'
File: configure.info, Node: Files, Next: Configuration Names, Prev: Getting Started, Up: Top
Files
*****
As was seen in the previous chapter, the GNU configure and build system
uses a number of different files. The developer must write a few files.
The others are generated by various tools.
The system is rather flexible, and can be used in many different
ways. In describing the files that it uses, I will describe the common
case, and mention some other cases that may arise.
* Menu:
* Developer Files:: Developer Files.
* Build Files:: Build Files.
* Support Files:: Support Files.
File: configure.info, Node: Developer Files, Next: Build Files, Up: Files
Developer Files
===============
This section describes the files written or generated by the developer
of a package.
* Menu:
* Developer Files Picture:: Developer Files Picture.
* Written Developer Files:: Written Developer Files.
* Generated Developer Files:: Generated Developer Files.
File: configure.info, Node: Developer Files Picture, Next: Written Developer Files, Up: Developer Files
Developer Files Picture
-----------------------
Here is a picture of the files which are written by the developer, the
generated files which would be included with a complete source
distribution, and the tools which create those files. The file names
are plain text and the tool names are enclosed by `*' characters (e.g.,
`autoheader' is the name of a tool, not the name of a file).