File: configure.ac

package info (click to toggle)
brltty 5.6-10~bpo9+1
  • links: PTS, VCS
  • area: main
  • in suites: stretch-backports
  • size: 25,116 kB
  • sloc: ansic: 117,871; sh: 6,590; java: 4,785; xml: 3,451; makefile: 1,973; tcl: 1,499; awk: 611; ml: 293; python: 250; lisp: 52
file content (1956 lines) | stat: -rw-r--r-- 56,284 bytes parent folder | download | duplicates (3)
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
dnl Process this file with autoconf 2.53 to produce a configure script.
###############################################################################
# BRLTTY - A background process providing access to the console screen (when in
#          text mode) for a blind person using a refreshable braille display.
#
# Copyright (C) 1995-2018 by The BRLTTY Developers.
#
# BRLTTY comes with ABSOLUTELY NO WARRANTY.
#
# This is free software, placed under the terms of the
# GNU Lesser General Public License, as published by the Free Software
# Foundation; either version 2.1 of the License, or (at your option) any
# later version. Please see the file LICENSE-LGPL for details.
#
# Web Page: http://brltty.com/
#
# This software is maintained by Dave Mielke <dave@mielke.cc>.
###############################################################################

AC_PREREQ([2.64])
AC_INIT([BRLTTY], [5.6], [brltty@brltty.com], [brltty], [http://brltty.com/])
AC_CONFIG_SRCDIR([Programs/brltty.c])

AC_SUBST([api_major], [0])
AC_SUBST([api_minor], [6])
AC_SUBST([api_revision], [7])

AC_SUBST([api_version], [${api_major}.${api_minor}])
AC_SUBST([api_release], [${api_version}.${api_revision}])

AC_DEFINE_UNQUOTED([BRLAPI_RELEASE], ["${api_release}"],
                   [Define this to be a string containing the API library version.])
AC_DEFINE_UNQUOTED([BRLAPI_MAJOR], [${api_major}],
                   [Define this to be the API library major version number.])
AC_DEFINE_UNQUOTED([BRLAPI_MINOR], [${api_minor}],
                   [Define this to be the API library minor version number.])
AC_DEFINE_UNQUOTED([BRLAPI_REVISION], [${api_revision}],
                   [Define this to be the API library revision number.])

BRLTTY_SUMMARY_BEGIN
brltty_build_directories=". Programs Documents Messages Android/Core Android/Application"
brltty_source_directory="`dirname "${0}"`"
brltty_manual_directories=""

for brltty_autostart_directory in `(cd "${brltty_source_directory}" && echo Autostart/*)`
do
   test -f "${brltty_source_directory}/${brltty_autostart_directory}/Makefile.in" && {
      brltty_build_directories="${brltty_build_directories} ${brltty_autostart_directory}"
   }
done

for brltty_manual_directory in `(cd "${brltty_source_directory}" && echo Documents/Manual-*/*)`
do
   test -f "${brltty_source_directory}/${brltty_manual_directory}/Makefile.in" && {
      brltty_manual_directories="${brltty_manual_directories} ${brltty_manual_directory}"
   }
done

AC_SUBST([brltty_manual_directories])
brltty_build_directories="${brltty_build_directories} ${brltty_manual_directories}"

AC_CONFIG_HEADER([config.h])
AC_CONFIG_HEADER([Programs/brlapi.h])
AC_PREFIX_DEFAULT([])
AC_CONFIG_AUX_DIR([acdir])
AC_CANONICAL_SYSTEM

brltty_default_execute_root="/${PACKAGE_TARNAME}-${PACKAGE_VERSION}"
BRLTTY_ARG_WITH(
   [execute-root], [DIRECTORY],
   [where the package is to be anchored at run-time],
   [execute_root], [""]
)
if test "${execute_root}" = "no"
then
   execute_root=""
elif test "${execute_root}" = "yes"
then
   execute_root="${brltty_default_execute_root}"
fi
AC_SUBST([execute_root])
BRLTTY_SUMMARY_ITEM([execute-root], [execute_root])

brltty_default_install_root="/tmp/${PACKAGE_TARNAME}-${PACKAGE_VERSION}"
BRLTTY_ARG_WITH(
   [install-root], [DIRECTORY],
   [where to install the package],
   [install_root], ["${execute_root}"]
)
if test "${install_root}" = "no"
then
   install_root="${execute_root}"
elif test "${install_root}" = "yes"
then
   install_root="${brltty_default_install_root}"
fi
AC_SUBST([install_root])
BRLTTY_SUMMARY_ITEM([install-root], [install_root])

BRLTTY_ARG_WITH(
   [configuration-file], [FILE],
   [name of configuration file],
   [CONFIGURATION_FILE], ["${PACKAGE_TARNAME}.conf"]
)
AC_SUBST([CONFIGURATION_FILE])
BRLTTY_DEFINE_EXPANDED([CONFIGURATION_FILE], ["${CONFIGURATION_FILE}"],
                       [Define this to be a string containing the name of the default configuration file.])

AC_SUBST([PREFERENCES_FILE], ["${PACKAGE_TARNAME}.prefs"])
BRLTTY_DEFINE_EXPANDED([PREFERENCES_FILE], ["${PREFERENCES_FILE}"],
                       [Define this to be a string containing the name of the default preferences file.])

BRLTTY_PORTABLE_DIRECTORY([includedir], [/usr])
BRLTTY_PORTABLE_DIRECTORY([datarootdir], [/usr])
BRLTTY_PORTABLE_DIRECTORY([localstatedir], [])

BRLTTY_SUMMARY_ITEM([libdir], [libdir])
BRLTTY_SUMMARY_ITEM([sysconfdir], [sysconfdir])

BRLTTY_ARG_REQUIRED(
   [program-directory], [DIRECTORY],
   [path to directory containing executables],
   [program_directory], ["${bindir}"]
)

BRLTTY_ARG_REQUIRED(
   [drivers-directory], [DIRECTORY],
   [path to directory containing drivers],
   [drivers_directory], ["${libdir}/${PACKAGE_TARNAME}"]
)

BRLTTY_ARG_WITH(
   [writable-directory], [DIRECTORY],
   [path to directory which can be written to],
   [writable_directory], ["yes"]
)
if test "${writable_directory}" = "no"
then
   writable_directory=""
elif test "${writable_directory}" = "yes"
then
   writable_directory="${localstatedir}/run/${PACKAGE_TARNAME}"
fi
AC_SUBST([writable_directory])
BRLTTY_SUMMARY_ITEM([writable-directory], [writable_directory])

BRLTTY_ARG_REQUIRED(
   [tables-directory], [DIRECTORY],
   [path to directory containing data files],
   [tables_directory], ["${sysconfdir}/${PACKAGE_TARNAME}"]
)

BRLTTY_DEFINE_STRING([TEXT_TABLES_SUBDIRECTORY], [Text], [the subdirectory for text tables])
BRLTTY_DEFINE_STRING([ATTRIBUTES_TABLES_SUBDIRECTORY], [Attributes], [the subdirectory for attributes tables])
BRLTTY_DEFINE_STRING([CONTRACTION_TABLES_SUBDIRECTORY], [Contraction], [the subdirectory for contraction tables])
BRLTTY_DEFINE_STRING([KEYBOARD_TABLES_SUBDIRECTORY], [Keyboard], [the subdirectory for keyboard key tables])
BRLTTY_DEFINE_STRING([INPUT_TABLES_SUBDIRECTORY], [Input], [the subdirectory for braille device key tables])

BRLTTY_DEFINE_STRING([TEXT_TABLE_EXTENSION], [.ttb], [the extension for text tables])
BRLTTY_DEFINE_STRING([TEXT_SUBTABLE_EXTENSION], [.tti], [the extension for text subtables])

BRLTTY_DEFINE_STRING([ATTRIBUTES_TABLE_EXTENSION], [.atb], [the extension for attributes tables])
BRLTTY_DEFINE_STRING([ATTRIBUTES_SUBTABLE_EXTENSION], [.ati], [the extension for attributes subtables])

BRLTTY_DEFINE_STRING([CONTRACTION_TABLE_EXTENSION], [.ctb], [the extension for contraction tables])
BRLTTY_DEFINE_STRING([CONTRACTION_SUBTABLE_EXTENSION], [.cti], [the extension for contraction subtables])

BRLTTY_DEFINE_STRING([KEY_TABLE_EXTENSION], [.ktb], [the extension for key tables])
BRLTTY_DEFINE_STRING([KEY_SUBTABLE_EXTENSION], [.kti], [the extension for key subtables])
BRLTTY_DEFINE_STRING([KEY_HELP_EXTENSION], [.txt], [the extension for key help files])

BRLTTY_DEFINE_STRING([PROFILES_SUBDIRECTORY], [Profiles], [the subdirectory for profiles])
BRLTTY_DEFINE_STRING([LANGUAGE_PROFILE_EXTENSION], [.lpf], [the extension for language profiles])

BRLTTY_ARG_REQUIRED(
   [manpage-directory], [DIRECTORY],
   [path to directory containing manual pages],
   [manpage_directory], ["${mandir}"]
)

BRLTTY_ARG_REQUIRED(
   [include-directory], [DIRECTORY],
   [path to directory containing header files],
   [include_directory], ["${includedir}/${PACKAGE_TARNAME}"]
)

brltty_default_init_path=/sbin/init_real
BRLTTY_ARG_WITH(
   [init-path], [FILE],
   [path to real init program],
   [init_path], [""]
)
if test "${init_path}" = "no"
then
   init_path=""
elif test "${init_path}" = "yes"
then
   init_path="${brltty_default_init_path}"
fi
if test -n "${init_path}"
then
   AC_DEFINE_UNQUOTED([INIT_PATH], ["${init_path}"],
                      [Define this if BRLTTY is to be run as init.])
fi
BRLTTY_SUMMARY_ITEM([init-path], [init_path])

brltty_default_stderr_path=/tmp/brltty.log
BRLTTY_ARG_WITH(
   [stderr-path], [FILE],
   [path to standard error log file],
   [stderr_path], [""]
)
if test "${stderr_path}" = "no"
then
   stderr_path=""
elif test "${stderr_path}" = "yes"
then
   stderr_path="${brltty_default_stderr_path}"
fi
if test -n "${stderr_path}"
then
   AC_DEFINE_UNQUOTED([STDERR_PATH], ["${stderr_path}"],
                      [Define this if standard error is to be redirected to a file.])
fi
BRLTTY_SUMMARY_ITEM([stderr-path], [stderr_path])

AC_PROG_MAKE_SET

AC_PROG_CC
if test -z "${CXX}"
then
   if test "${GCC}" = "yes"
   then
      AC_SEARCH_LIBS([__cxa_pure_virtual], [supc++])
      AC_CACHE_CHECK([if the C compiler can compile C++], [brltty_cv_prog_cc_cxx], [dnl
      brltty_save_ac_ext="${ac_ext}"
      ac_ext="cc"
      AC_TRY_LINK([], [class c {};],
                  [brltty_cv_prog_cc_cxx="yes"],
                  [brltty_cv_prog_cc_cxx="no"])
      ac_ext="${brltty_save_ac_ext}"])
      test "${brltty_cv_prog_cc_cxx}" = "yes" && CXX="${CC}"
   fi
fi
AC_PROG_CXX

brltty_gcc_cflags="-std=gnu99 -Wall -Werror=format-security"
brltty_gcc_cppflags=""

case "${host_os}"
in
   darwin*)
      brltty_gcc_cflags="${brltty_gcc_cflags} -Wno-initializer-overrides -Wno-unused-const-variable -Wno-pointer-bool-conversion"
      ;;
   elf*)
      brltty_gcc_cppflags="${brltty_gcc_cppflags} -ffreestanding -nostdinc -nostdlib"
      CPPFLAGS="${CPPFLAGS} -DGRUB_RUNTIME -DGRUB_FILE=__FILE__ -DNESTED_FUNC_ATTR="

      brltty_include_directory=`$CC -print-file-name=include`
      CPPFLAGS="${CPPFLAGS} -isystem $brltty_include_directory"

      brltty_grub_root="`pwd`/grub-root"
      test -d $brltty_grub_root || {
         AC_MSG_ERROR([symbolic link not found: $brltty_grub_root])
      }
      CPPFLAGS="${CPPFLAGS} -I$brltty_grub_root -I$brltty_grub_root/grub-core/lib/posix_wrap/include -I$brltty_grub_root/include"
      ;;
esac

test "${GCC}" = "yes" && {
   CFLAGS="${CFLAGS} ${brltty_gcc_cflags}"
   CPPFLAGS="${CPPFLAGS} ${brltty_gcc_cppflags}"
}

test "${GXX}" = "yes" && {
   CXXFLAGS="${CXXFLAGS} ${brltty_gcc_cflags}"
}

case "${host_os}"
in
   linux*|gnu*|kfreebsd*)
      brltty_prog_cc_sysflags="-D_DEFAULT_SOURCE -D_POSIX_C_SOURCE=2 -D_BSD_SOURCE -D_XOPEN_SOURCE=500 -D_XOPEN_SOURCE_EXTENDED -D_GNU_SOURCE"
      ;;
   solaris2.1?*) # Solaris 10 & 11 require _XOPEN_SOURCE=600 if using C99
      brltty_prog_cc_sysflags="-D_XOPEN_SOURCE=600 -D__EXTENSIONS__"
      ;;
   solaris*)
      brltty_prog_cc_sysflags="-D_XOPEN_SOURCE=500 -D__EXTENSIONS__"
      ;;
   hpux*)
      brltty_prog_cc_sysflags="-D_XOPEN_SOURCE_EXTENDED -D_HPUX_SOURCE"
      ;;
   osf*)
      brltty_prog_cc_sysflags="-D_XOPEN_SOURCE=500 -D_POSIX_C_SOURCE -D_OSF_SOURCE"
      ;;
   cygwin*)
      brltty_prog_cc_sysflags="-D_XOPEN_SOURCE_EXTENDED"
      ;;
   *)
      brltty_prog_cc_sysflags=""
      ;;
esac
CPPFLAGS="${CPPFLAGS} ${brltty_prog_cc_sysflags}"

if test "${GCC}" = "yes"
then
   case "${host_os}"
   in
      cygwin*|mingw*)
         LIBCFLAGS=""
         ;;
      msdos*)
         LIBCFLAGS=""
         ;;
      darwin*)
         LIBCFLAGS=""
         ;;
      *)
         LIBCFLAGS="-fPIC"
         ;;
   esac
else
   case "${host_os}"
   in
      *)
         LIBCFLAGS=""
         AC_MSG_WARN([library flags not configured for ${host_os}])
         ;;
   esac
fi
AC_SUBST([LIBCFLAGS])

if test "$GXX" = "yes"
then
   LIBCXXFLAGS="-fPIC"
else
   case "${host_os}"
   in
      *)
         LIBCXXFLAGS=""
         ;;
   esac
fi
AC_SUBST([LIBCXXFLAGS])

AC_PATH_TOOL([LD], [ld])
AC_PATH_TOOL([STRIP], [strip])
AC_PATH_TOOL([RANLIB], [ranlib])

AC_PROG_AWK
AC_PROG_LN_S

AC_PATH_PROG([PKG_CONFIG], [pkg-config], [false])

AC_PATH_PROG([MSGMERGE], [msgmerge], [false])
AC_PATH_PROG([MSGFMT], [msgfmt], [false])

AC_PATH_PROG([LINUXDOC], [linuxdoc], [false])
AC_PATH_PROG([DOXYGEN], [doxygen], [false])

case "${host_os}"
in
   cygwin*  ) LDFLAGS_DYNAMIC="--export-all-symbols --enable-auto-import";;
   darwin*  ) LDFLAGS_DYNAMIC="";;
   elf*     ) LDFLAGS_DYNAMIC="";;
   freebsd* ) LDFLAGS_DYNAMIC="-export-dynamic";;
   gnu*     ) LDFLAGS_DYNAMIC="-export-dynamic";;
   hpux*    ) LDFLAGS_DYNAMIC="-E +s";;
   kfreebsd*) LDFLAGS_DYNAMIC="-export-dynamic";;
   linux*   ) LDFLAGS_DYNAMIC="-export-dynamic";;
   mingw*   ) LDFLAGS_DYNAMIC="--export-all-symbols --enable-auto-import";;
   msdos*   ) LDFLAGS_DYNAMIC="";;
   netbsd*  ) LDFLAGS_DYNAMIC="-export-dynamic";;
   openbsd* ) LDFLAGS_DYNAMIC="-export-dynamic";;
   osf*     ) LDFLAGS_DYNAMIC="";;
   *qnx*    ) LDFLAGS_DYNAMIC="-export-dynamic";;
   solaris* ) LDFLAGS_DYNAMIC="";;
   *) AC_MSG_ERROR([dynamic linkage not supported for ${host_os}]);;
esac
LDFLAGS_DYNAMIC="${LDFLAGS} BRLTTY_OPTIONS_LD2CC([${LDFLAGS_DYNAMIC}])"

if test "${GCC}" = "yes"
then
   LDFLAGS_STATIC="-static"
else
   case "${host_os}"
   in
      cygwin*  ) LDFLAGS_STATIC="-static";;
      elf*     ) LDFLAGS_STATIC="-static";;
      freebsd* ) LDFLAGS_STATIC="-static";;
      gnu*     ) LDFLAGS_STATIC="-static";;
      hpux*    ) LDFLAGS_STATIC="-Bstatic";;
      kfreebsd*) LDFLAGS_STATIC="-static";;
      linux*   ) LDFLAGS_STATIC="-static";;
      mingw*   ) LDFLAGS_STATIC="-static";;
      netbsd*  ) LDFLAGS_STATIC="-Bstatic";;
      openbsd* ) LDFLAGS_STATIC="-static";;
      osf*     ) LDFLAGS_STATIC="-non_shared";;
      *qnx*    ) LDFLAGS_STATIC="-static";;
      solaris* ) LDFLAGS_STATIC="-dn";;
      *) AC_MSG_ERROR([static linkage not supported for ${host_os}]);;
   esac
   LDFLAGS_STATIC="BRLTTY_OPTIONS_LD2CC([${LDFLAGS_STATIC}])"
fi

pkgconfig_flags_libs="--libs"
BRLTTY_ARG_ENABLE(
   [standalone-programs],
   [statically linked executables],
   [],
[dnl
   LDFLAGS="${LDFLAGS} ${LDFLAGS_STATIC}"
   brltty_standalone_programs="yes"
   pkgconfig_flags_libs="${pkgconfig_flags_libs} --static"
], [dnl
   LDFLAGS="${LDFLAGS} ${LDFLAGS_DYNAMIC}"

   AC_DEFINE([ENABLE_SHARED_OBJECTS], [1],
             [Define this if shared object support is to be included.])
])

AC_PROG_INSTALL
BRLTTY_EXECUTABLE_PATH([INSTALL])

test "${LINUXDOC}" = "false" && can_make_manual=no || can_make_manual=yes
AC_SUBST([can_make_manual])

test "${DOXYGEN}" = "false" && can_make_BrlAPIref=no || can_make_BrlAPIref=yes
AC_SUBST([can_make_BrlAPIref])

AC_CACHE_CHECK([for shared object creation command], [brltty_cv_prog_make_object_shared], [dnl
case "${host_os}"
in
   linux*|gnu*|openbsd*|freebsd*|kfreebsd*|netbsd*|*qnx*|cygwin*|mingw*|elf*)
      brltty_mkshr_ld_make="-shared"
      ;;
   solaris*)
      brltty_mkshr_ld_make="-G"
      ;;
   hpux*)
      brltty_mkshr_ld_make="-b"
      ;;
   osf*)
      brltty_mkshr_ld_make="-shared"
      ;;
   darwin*)
      brltty_mkshr_ld_make="-bundle"
      brltty_mkshr_ld_options="-flat_namespace -undefined suppress"
      brltty_mkshr_gcc_make="-bundle"
      ;;
   msdos*)
      brltty_mkshr_ld_make="not_supported_on_msdos"
      brltty_mkshr_ld_options="not_supported_on_msdos"
      brltty_mkshr_gcc_make="not_supported_on_msdos"
      ;;
   *)
      AC_MSG_ERROR([loadable module creation command not configured for ${host_os}])
      ;;
esac
if test "${GCC}" = "yes"
then
   brltty_cv_prog_make_object_shared="\$(CC) ${brltty_mkshr_gcc_make=-shared} BRLTTY_OPTIONS_LD2CC([${brltty_mkshr_ld_options}]) -o"
else
   brltty_cv_prog_make_object_shared="\$(LD) ${brltty_mkshr_ld_make} ${brltty_mkshr_ld_options} -o"
fi])
AC_SUBST([MKSHR], ["${brltty_cv_prog_make_object_shared}"])

AC_CACHE_CHECK([for make relocatable object command], [brltty_cv_prog_make_object_relocatable], [dnl
case "${host_os}"
in
   *)
      brltty_cv_prog_make_object_relocatable="\$(LD) -r -o"
      ;;
esac])
MKREL="${brltty_cv_prog_make_object_relocatable}"
AC_SUBST([MKREL])

AC_CACHE_CHECK([for dynamic library creation command], [brltty_cv_prog_mklib], [dnl
case "${host_os}"
in
   linux*|gnu*|openbsd*|freebsd*|kfreebsd*|netbsd*|*qnx*|elf*)
      brltty_mklib_ld_make="-shared"
      brltty_mklib_ld_options="-soname"
      ;;
   solaris*)
      brltty_mklib_ld_make="-G"
      brltty_mklib_ld_options="-h"
      ;;
   hpux*)
      brltty_mklib_ld_make="-b"
      brltty_mklib_ld_options="+h"
      ;;
   osf*)
      brltty_mklib_ld_make="-shared"
      brltty_mklib_ld_options="-expect_unresolved '*' -soname"
      ;;
   cygwin*|mingw*)
      brltty_mklib_ld_make="-shared"
      brltty_mklib_ld_options="--out-implib implib.a --output-def lib.def -soname"
      ;;
   msdos*)
      brltty_mklib_ld_make="not_supported_on_msdos"
      brltty_mklib_ld_options="not_supported_on_msdos"
      brltty_mklib_gcc_make="not_supported_on_msdos"
      ;;
   darwin*)
      dylibFound=false
      dylibPath=/usr/lib/dylib1.o
      set -- "${dylibPath}"

      sdkRootPrefix="/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX"
      sdkRootSuffix=".sdk/${dylibPath}"
      sdkVersion=`sw_vers -productVersion`

      while true
      do
         set -- "${@}" "${sdkRootPrefix}${sdkVersion}${sdkRootSuffix}"
         sdkNext="${sdkVersion%.*}"
         test "${sdkNext}" != "${sdkVersion}" || break
         sdkVersion="${sdkNext}"
      done

      set -- "${@}" "${sdkRootPrefix}"*"${sdkRootSuffix}"
      for sdkPath
      do
         test ! -f "${sdkPath}" || {
            dylibPath="${sdkPath}"
            dylibFound=true
            break
         }
      done
      "${dylibFound}" || AC_MSG_WARN([cannot find ${dylibPath}])

      brltty_mklib_ld_make="-dylib"
      brltty_mklib_ld_options="${dylibPath} -single_module -install_name"
      brltty_mklib_gcc_make="-dynamiclib"
      ;;
   *)
      AC_MSG_ERROR([dynamic library creation command not configured for ${host_os}])
      ;;
esac
if test "${GCC}" = "yes"
then
   brltty_cv_prog_mklib="\$(CC) ${brltty_mklib_gcc_make=-shared} BRLTTY_OPTIONS_LD2CC([${brltty_mklib_ld_options+${brltty_mklib_ld_options} <name>}]) -o"
else
   brltty_cv_prog_mklib="\$(LD) ${brltty_mklib_ld_make} ${brltty_mklib_ld_options+${brltty_mklib_ld_options} <name>} -o"
fi])
AC_SUBST([MKLIB], ["${brltty_cv_prog_mklib}"])

AC_CACHE_CHECK([for configure shared object directory command], [brltty_cv_prog_conflibdir], [dnl
case "${host_os}"
in
   linux*|gnu*|kfreebsd*|elf*)
      brltty_cv_prog_conflibdir="/sbin/ldconfig -n"
      ;;
   *)
      brltty_cv_prog_conflibdir=":"
      ;;
esac])
AC_SUBST([CONFLIBDIR], ["${brltty_cv_prog_conflibdir}"])

case "${host_os}"
in
   mingw*)
      BRLTTY_HAVE_WINDOWS_LIBRARY([ws2_32])
      BRLTTY_HAVE_WINDOWS_LIBRARY([gdi32])
      BRLTTY_HAVE_WINDOWS_LIBRARY([winmm])
      ;;
   cygwin*)
      BRLTTY_HAVE_WINDOWS_LIBRARY([gdi32])
      ;;
   *)
      AC_SEARCH_LIBS([socket], [socket])
      AC_SEARCH_LIBS([inet_ntoa], [nsl])
      ;;
esac

install_messages=
BRLTTY_ARG_DISABLE(
   [i18n],
   [support for internationalization],
   [],
[dnl
   test "${MSGMERGE}" = "false" || {
      install_messages=install-messages

      AC_CHECK_HEADER([libintl.h], [dnl
         AC_HAVE_LIBRARY([intl])
         AC_DEFINE([ENABLE_I18N_SUPPORT], [1],
                   [Define this if internationalization support is to be included.])
      ])
   }
])
AC_SUBST([install_messages])

AC_CHECK_FUNC([wcslen], [AC_CHECK_HEADERS([wchar.h], [dnl
   AC_CHECK_FUNCS([wcwidth])
])])

icu_includes=""
icu_libs=""
BRLTTY_ARG_DISABLE(
   [icu],
   [support for Unicode-based internationalization],
   [],
[dnl
   BRLTTY_HAVE_PACKAGE([icu], [icu-uc], [dnl
      AC_DEFINE_UNQUOTED([HAVE_ICU], [1],
                         [Define this if Unicode-based internationalization support is to be included.])

      if test "${brltty_standalone_programs}" = "yes"
      then
         icu_libs="`echo ${icu_libs} | sed -e 's/\(-l\)\(icu\)/\1s\2/g'`"
      fi
   ])
])
AC_SUBST([icu_includes])
AC_SUBST([icu_libs])

BRLTTY_ARG_DISABLE(
   [iconv],
   [support for character encoding conversion],
   [],
[dnl
   AC_CHECK_HEADERS([iconv.h], [
      AC_HAVE_LIBRARY([iconv])
   ])
])

BRLTTY_ARG_DISABLE(
   [polkit],
   [support for the Polkit authorization manager],
   [],
[dnl
   BRLTTY_HAVE_PACKAGE([polkit], [polkit-gobject-1], [dnl
      AC_DEFINE(USE_POLKIT, 1, [if the Polkit authorization manager should be used])
   ])
])

BRLTTY_ARG_DISABLE(
   [api],
   [the application programming interface],
   [],
[dnl
   BRLTTY_IF_PTHREADS([dnl
      AC_DEFINE([ENABLE_API], [1],
                [Define this if the application programming interface is to be included.])
      BRLTTY_ARG_PARAMETERS([api], [application programming interface])

      api_server_objects='brlapi_server.$O brlapi_keyranges.$O auth.$O'
      api_libraries="${LIBS}"

      all_api="all-api"
      build_api="api"
      install_api="install-api"
      api_ref='$(API_LIBS)'

      api_dynamic_library="api-dynamic-library"
      install_api_libraries="install-api-libraries"
      uninstall_api_libraries="uninstall-api-libraries"
      default_api_socket_path="${localstatedir}/lib/BrlAPI"

      case "${host_os}"
      in
         cygwin*|mingw*)
            AC_DEFINE([BRLAPI_WIN32], [1],
                      [Define this if the Win32 programming interface is available.])
	    default_api_socket_path='\\\\\\\\.\\\\pipe\\\\BrlAPI'
            api_dynamic_library="api-dynamic-library-windows"
            install_api_libraries="install-api-libraries-windows"
            uninstall_api_libraries="uninstall-api-libraries-windows"
            ;;
      esac

      BRLTTY_ARG_WITH(
          [api-socket-path], [PATH],
          [where local sockets for teh api are stored],
          [api_socket_path], [${default_api_socket_path}]
      )

      BRLTTY_BINDINGS([Java])
      BRLTTY_BINDINGS([Lisp])
      BRLTTY_BINDINGS([OCaml])
      BRLTTY_BINDINGS([Python])
      BRLTTY_BINDINGS([Tcl])

      test -n "${api_bindings}" && {
         for brltty_bindings_directory in ${api_bindings}
         do
            brltty_build_directories="${brltty_build_directories} Bindings/${brltty_bindings_directory}"
         done

         all_api_bindings="all-api-bindings"
         install_api_bindings="install-api-bindings"
      }
   ])
])
AC_SUBST([api_server_objects])
AC_SUBST([api_libraries])
AC_SUBST([api_bindings])
AC_SUBST([all_api_bindings])
AC_SUBST([install_api_bindings])
AC_SUBST([all_api])
AC_SUBST([build_api])
AC_SUBST([install_api])
AC_SUBST([api_ref])
AC_SUBST([api_dynamic_library])
AC_SUBST([install_api_libraries])
AC_SUBST([uninstall_api_libraries])
AC_SUBST([api_authkeyfile], [brlapi.key])
AC_SUBST([api_socket_path])
BRLTTY_SUMMARY_ITEM([api-socket-path], [api_socket_path])
BRLTTY_DEFINE_EXPANDED([BRLAPI_AUTHKEYFILE], ["${api_authkeyfile}"],
                       [Define this to be a string containing the name of the file containing the authorization key.])

brltty_curses_libs_save="${LIBS}"
BRLTTY_PACKAGE_CHOOSE([curses],
   [ncursesw ncursesw/ncurses.h],
   [pdcursesw curses.h],
   [ncurses ncurses.h],
   [pdcursesu curses.h],
   [curses curses.h],
   [pdcurses curses.h])
if test -n "${curses_package}"
then
   AC_CHECK_LIB([tinfo], [intrflush])
fi
curses_libs="${LIBS%${brltty_curses_libs_save}}"
LIBS="${brltty_curses_libs_save}"
AC_SUBST([curses_libs])

xkb_libs=""
xtk_libs=""
all_xbrlapi=""
install_xbrlapi=""
BRLTTY_ARG_DISABLE(
   [x],
   [support for X11],
   [],
[dnl
   BRLTTY_HAVE_PACKAGE([x11], [x11], [dnl
      all_xbrlapi="all-xbrlapi"
      install_xbrlapi="install-xbrlapi"

      AC_CHECK_HEADERS([X11/keysym.h])

      BRLTTY_HAVE_PACKAGE([xext], [xext], [dnl
         xkb_libs="${xext_libs} ${xkb_libs}"

         BRLTTY_HAVE_PACKAGE([xtst], [xtst], [dnl
            xkb_libs="${xtst_libs} ${xkb_libs}"
             
            AC_CHECK_HEADERS([X11/extensions/XTest.h])
            AC_CHECK_HEADERS([X11/extensions/XKB.h])
         ])
      ])

      BRLTTY_HAVE_PACKAGE([xt], [xt], [dnl
         xtk_libs="${xt_libs} ${xtk_libs}"

         brltty_cppflags_save="${CPPFLAGS}"
         CPPFLAGS="${CPPFLAGS} ${x11_includes}"

         brltty_libs_save="${LIBS}"
         LIBS="${xtk_libs} ${x11_libs} ${LIBS}"

         BRLTTY_PACKAGE_CHOOSE([gui_toolkit],
            [Xaw X11/Xaw/Form.h X11/Xaw/Paned.h X11/Xaw/Label.h X11/Xaw/Command.h X11/Xaw/Repeater.h],
            [Xaw3d X11/Xaw3d/Form.h X11/Xaw3d/Paned.h X11/Xaw3d/Label.h X11/Xaw3d/Command.h X11/Xaw3d/Repeater.h],
            [neXtaw X11/neXtaw/Form.h X11/neXtaw/Paned.h X11/neXtaw/Label.h X11/neXtaw/Command.h X11/neXtaw/Repeater.h],
            [XawPlus X11/XawPlus/Form.h X11/XawPlus/Paned.h X11/XawPlus/Label.h X11/XawPlus/Command.h X11/XawPlus/Repeater.h],
            [Xm Xm/Xm.h Xm/Form.h Xm/PanedW.h Xm/Label.h Xm/PushB.h])

         xtk_libs="${LIBS%${x11_libs} ${brltty_libs_save}}"

         CPPFLAGS="${brltty_cppflags_save}"
         LIBS="${brltty_libs_save}"
      ])
   ])
])
AC_SUBST([xkb_libs])
AC_SUBST([xtk_libs])
AC_SUBST([all_xbrlapi])
AC_SUBST([install_xbrlapi])

test -z "$gui_toolkit_package" && {
   case "${host_os}"
   in
      cygwin*|mingw*)
         gui_toolkit_package="windows"
         ;;
   esac
}

AC_CHECK_FUNCS([time stime gettimeofday settimeofday nanosleep])
BRLTTY_CHECK_FUNCTION([clock_gettime], [time.h], [rt])
BRLTTY_CHECK_FUNCTION([clock_settime], [time.h], [rt])

BRLTTY_CHECK_FUNCTION([pthread_getname_np], [pthread.h], [pthread])

AC_CHECK_DECLS([localtime_r], [], [], [dnl
#include <time.h>
])

AC_CHECK_HEADERS([sys/poll.h sys/select.h sys/wait.h])
AC_CHECK_FUNCS([select])

AC_CHECK_HEADERS([signal.h sys/signalfd.h])
AC_CHECK_FUNCS([sigaction])

AC_CHECK_HEADERS([alloca.h getopt.h glob.h langinfo.h regex.h])
AC_CHECK_HEADERS([syslog.h execinfo.h])
AC_CHECK_HEADERS([sys/file.h sys/socket.h])
AC_CHECK_HEADERS([pwd.h grp.h])
AC_CHECK_HEADERS([sys/io.h sys/modem.h machine/speaker.h dev/speaker/speaker.h linux/vt.h])
AC_CHECK_HEADERS([sdkddkver.h])

AC_CHECK_HEADERS([linux/input.h], [
   AC_CHECK_HEADERS([linux/uinput.h], [], [], [
#include <linux/input.h>
])])

AC_CHECK_FUNCS([getopt_long hstrerror realpath vsyslog])
AC_CHECK_FUNCS([pause])
AC_CHECK_FUNCS([fchdir fchmod])
AC_CHECK_FUNCS([shmget shm_open])
AC_CHECK_FUNCS([getpeereid getpeerucred getzoneid])
AC_CHECK_FUNCS([mempcpy wmempcpy])

case "${host_os}"
in
   cygwin*|mingw*)
      if test "${brltty_cv_dll_ws2_32}" = "yes"
      then
         BRLTTY_HAVE_WINDOWS_FUNCTION([getaddrinfo], [ws2_32])
         BRLTTY_HAVE_WINDOWS_FUNCTION([getnameinfo], [ws2_32])
         AC_CHECK_FUNCS([gai_strerror])
      fi
      AC_CHECK_TYPES([PROCESS_INFORMATION_CLASS], [], [], [
#include <windows.h>
])
      AC_CHECK_DECLS([ProcessUserModeIOPL], [], [], [
#include <windows.h>
])
      ;;
   *)
      AC_CHECK_FUNCS([gai_strerror getaddrinfo getnameinfo])
      ;;
esac

AC_CHECK_SIZEOF([wchar_t], [], [
#include <wchar.h>
])
AC_DEFINE_UNQUOTED([SIZEOF_WCHAR_T_STR], ["${ac_cv_sizeof_wchar_t}"],
                   [Define this to be a string containing the size of the wchar_t type.])

BRLTTY_IF_PTHREADS([dnl
   AC_DEFINE([HAVE_POSIX_THREADS], [1],
             [Define this if posix threads are supported.])
])

AC_C_BIGENDIAN
AC_C_CONST
AC_C_INLINE
AC_OBJEXT
AC_EXEEXT

AC_CACHE_CHECK(
   [if the compiler understands the __alignof__ operator],
   [brltty_cv_c_operator_alignof],
   [AC_TRY_COMPILE([
int a;
int b = __alignof__(a);
],
[],
[brltty_cv_c_operator_alignof=yes],
[brltty_cv_c_operator_alignof=no])])
if test "${brltty_cv_c_operator_alignof}" = "yes"
then
   AC_DEFINE([HAVE_OPERATOR_ALIGNOF],  [1],
             [Define this if the __alignof__ operator is supported.])
fi

AC_CACHE_CHECK(
   [if the compiler understands __attribute__((format(__printf__)))],
   [brltty_cv_c_attribute_format_printf],
   [AC_TRY_COMPILE([
extern void conf_attribute_format_printf(const char *format, ...)
       __attribute__((format(__printf__, 1, 2)));
],
[],
[brltty_cv_c_attribute_format_printf=yes],
[brltty_cv_c_attribute_format_printf=no])])
if test "${brltty_cv_c_attribute_format_printf}" = "yes"
then
   AC_DEFINE([HAVE_ATTRIBUTE_FORMAT_PRINTF], [1],
             [Define this if the printf format attribute is supported.])
fi

AC_CACHE_CHECK(
   [if the compiler understands __attribute__((noreturn))],
   [brltty_cv_c_attribute_noreturn],
   [AC_TRY_COMPILE([
extern void conf_attribute_noreturn(void)
       __attribute__((noreturn));
],
[],
[brltty_cv_c_attribute_noreturn=yes],
[brltty_cv_c_attribute_noreturn=no])])
if test "${brltty_cv_c_attribute_noreturn}" = "yes"
then
   AC_DEFINE([HAVE_ATTRIBUTE_NORETURN], [1],
             [Define this if the noreturn attribute is supported.])
fi

AC_CACHE_CHECK(
   [if the compiler understands __attribute__((packed))],
   [brltty_cv_c_attribute_packed],
   [AC_TRY_COMPILE([
typedef struct {
  char c;
  int i;
} __attribute__((packed)) conf_attribute_packed;
],
[],
[brltty_cv_c_attribute_packed=yes],
[brltty_cv_c_attribute_packed=no])])
if test "${brltty_cv_c_attribute_packed}" = "yes"
then
   AC_DEFINE([HAVE_ATTRIBUTE_PACKED], [1],
             [Define this if the packed attribute is supported.])
fi

AC_CACHE_CHECK(
   [if the compiler understands __attribute__((unused))],
   [brltty_cv_c_attribute_unused],
   [AC_TRY_COMPILE([
static void conf_attribute_unused (void)
       __attribute__((unused));
],
[],
[brltty_cv_c_attribute_unused=yes],
[brltty_cv_c_attribute_unused=no])])
if test "${brltty_cv_c_attribute_unused}" = "yes"
then
   AC_DEFINE([HAVE_ATTRIBUTE_UNUSED], [1],
             [Define this if the unused attribute is supported.])
fi

AC_CACHE_CHECK(
   [if the compiler supports thread-local variables],
   [brltty_cv_c_thread_local],
   [
      brltty_cv_c_thread_local=""
      for thread_local_qualifier in "_Thread_local" "__thread" "__declspec(thread)"
      do
         AC_TRY_COMPILE([
static ${thread_local_qualifier} int i;
],
            [],
            [brltty_cv_c_thread_local="${thread_local_qualifier}"; break])
      done
   ]
)
if test -n "${brltty_cv_c_thread_local}"
then
   AC_DEFINE_UNQUOTED([THREAD_LOCAL], [${brltty_cv_c_thread_local}],
                      [Define this if thread-local variables are supported.])
fi

AC_SUBST([archive_prefix], [lib])
AC_SUBST([archive_extension], [a])

case "${host_os}"
in
   cygwin*)
      library_prefix="cyg"
      ;;
   mingw*)
      library_prefix=""
      ;;
   *)
      library_prefix="${archive_prefix}"
      ;;
esac
AC_SUBST([library_prefix])

case "${host_os}"
in
   hpux*)
      library_extension="sl"
      ;;
   cygwin*|mingw*)
      library_extension="dll"
      ;;
   darwin*)
      library_extension="dylib"
      ;;
   *)
      library_extension="so"
      ;;
esac
AC_SUBST([library_extension])
AC_DEFINE_UNQUOTED([LIBRARY_EXTENSION], ["${library_extension}"],
                   [Define this to be a string containing the library extension.])

AC_SUBST([module_name], ["${library_prefix}${PACKAGE_TARNAME}"])
AC_DEFINE_UNQUOTED([MODULE_NAME], ["${module_name}"],
                   [Define this to be a string containing the base module name.])

case "${host_os}"
in
   darwin*)
      module_extension="bundle"
      ;;
   *)
      module_extension="${library_extension}"
      ;;
esac
AC_SUBST([module_extension])
AC_DEFINE_UNQUOTED([MODULE_EXTENSION], ["${module_extension}"],
                   [Define this to be a string containing the module extension.])

AC_CACHE_CHECK([for static archive extension], [brltty_cv_ext_arc], [dnl
case "${host_os}"
in
   *)
      brltty_cv_ext_arc="a"
      ;;
esac])
archive_extension="${brltty_cv_ext_arc}"
AC_SUBST([archive_extension])

AC_CACHE_CHECK([for shared object run-time search path environment variable], [brltty_cv_env_libsearch], [dnl
case "${host_os}"
in
   hpux*)
      brltty_cv_env_libsearch="SHLIB_PATH"
      ;;
   darwin*)
      brltty_cv_env_libsearch="DYLD_LIBRARY_PATH"
      ;;
   *)
      brltty_cv_env_libsearch="LD_LIBRARY_PATH"
      ;;
esac])
libsearch_variable="${brltty_cv_env_libsearch}"
AC_SUBST([libsearch_variable])

BRLTTY_ARG_PACKAGE([system], [base system], [], [dnl
   *android*)
      system_package="java"
      system_libs="-llog"
      ;;
   *qnx*)
      AC_CHECK_LIB([asound], [snd_pcm_open])
      ;;
   cygwin*)
      system_package="windows"
      ;;
   darwin*)
      system_package="darwin"
      system_includes="-x objective-c"
      system_libs="-framework IOKit -framework Foundation -framework CoreFoundation -lobjc"
      ;;
   hpux*)
      if test -d /opt/audio/include
      then
         CPPFLAGS="${CPPFLAGS} -I/opt/audio/include"
         system_libs="-L/opt/audio/lib -lAlib"
         AC_DEFINE([HAVE_HPUX_AUDIO], [1],
                   [Define this if HP-UX audio support is available.])
      fi
      ;;
   linux*)
      system_package="linux"
      ;;
   mingw*)
      system_package="windows"
      ;;
   msdos*)
      system_package="msdos"
      system_libs="-ldbg"
      ;;
])

BRLTTY_ARG_DISABLE(
   [contracted-braille],
   [in-line contracted braille],
   [],
[dnl
   AC_DEFINE([ENABLE_CONTRACTED_BRAILLE], [1],
             [Define this to include contraction table support.])

   all_brltty_ctb="all-brltty-ctb"
   install_brltty_ctb="install-brltty-ctb"

   contracted_braille_objects='ctb_compile.$O ctb_translate.$O ctb_native.$O ctb_external.$O'
   install_contraction_tables=install-contraction-tables

   louis_includes=""
   louis_libs=""
   BRLTTY_ARG_DISABLE(
      [liblouis],
      [support for LibLouis-based contracted braille],
      [],
   [dnl
      BRLTTY_HAVE_PACKAGE([louis], [liblouis], [dnl
         louisTablesDirectory=`${PKG_CONFIG} --variable=tablesdir liblouis`
         if test -n "${louisTablesDirectory}"
         then
            AC_DEFINE_UNQUOTED([LOUIS_TABLES_DIRECTORY], ["${louisTablesDirectory}"],
                               [Define this to be a string containing the path to the LibLouis tables directory.])
            contracted_braille_objects="${contracted_braille_objects} ctb_louis.\$O"
         fi
      ])
   ])
   AC_SUBST([louis_includes])
   AC_SUBST([louis_libs])
])
AC_SUBST([all_brltty_ctb])
AC_SUBST([install_brltty_ctb])
AC_SUBST([contracted_braille_objects])
AC_SUBST([install_contraction_tables])

BRLTTY_ARG_DISABLE(
   [gpm],
   [mouse tracking via GPM],
   [],
[dnl
   AC_CHECK_LIB([gpm], [Gpm_Open])
])

case "${host_os}"
in
   hpux*)
      BRLTTY_SEARCH_LIBS([shl_load], [dld])
      ;;
   *)
      ;;
esac

BRLTTY_ARG_PACKAGE([pgmpath], [program path], [], [dnl
   cygwin*)
      pgmpath_package="windows"
      ;;
   linux*)
      pgmpath_package="linux"
      ;;
   mingw*)
      pgmpath_package="windows"
      ;;
   solaris*)
      pgmpath_package="solaris"
      ;;
])

BRLTTY_ARG_PACKAGE([service], [system service], [libsystemd], [dnl
   mingw*)
      service_package="windows"
      ;;
])

AC_SUBST([SYSTEMD_SERVICE_TYPE], ["forking"])
AC_SUBST([SYSTEMD_SERVICE_ARGUMENTS], [""])

case "${service_package}"
in
   libsystemd)
      SYSTEMD_SERVICE_TYPE="notify"
      SYSTEMD_SERVICE_ARGUMENTS="-n"
      ;;
esac

BRLTTY_ARG_PACKAGE([params], [boot parameters], [], [dnl
   linux*)
      params_package="linux"
      ;;
])

BRLTTY_ARG_PACKAGE([dynld], [dynamic loading], [dlfcn dyld], [dnl
   elf*)
      dynld_package="grub"
      ;;
   hpux*)
      dynld_package="shl"
      ;;
   mingw*)
      dynld_package="windows"
      ;;
], [dnl
   dlfcn)
      AC_CHECK_HEADERS([dlfcn.h], [
         AC_SEARCH_LIBS([dlopen], [dl], [dnl
            dynld_package="dlfcn"
         ])
      ])
      ;;
   dyld)
      AC_CHECK_HEADERS([mach-o/dyld.h], [
         dynld_package="dyld"
      ])
      ;;
])

BRLTTY_ARG_PACKAGE([charset], [character set], [iconv], [dnl
   elf*)
      charset_package=grub
      ;;
   mingw*)
      charset_package=windows
      ;;
   msdos*)
      charset_package=msdos
      ;;
], [dnl
   iconv)
      if test "${brltty_enabled_iconv}" = "yes"
      then
         AC_CHECK_HEADER([iconv.h], [dnl
            charset_package=iconv
         ])
      fi
      ;;
])

BRLTTY_ARG_PACKAGE([hostcmd], [host command], [unix], [dnl
   mingw*)
      hostcmd_package=windows
      ;;
], [dnl
   unix)
      AC_CHECK_DECL([fork], [dnl
         AC_CHECK_HEADER([signal.h], [dnl
            AC_CHECK_DECL([SIGCHLD], [dnl
               hostcmd_package=unix
            ], [], [dnl
#include <signal.h>
            ])
         ])
      ])
      ;;
])

BRLTTY_ARG_PACKAGE([mntpt], [mount point], [mntent mnttab], [dnl
], [dnl
   mntent)
      AC_CHECK_HEADER([mntent.h], [dnl
         AC_CHECK_FUNC([setmntent], [dnl
            mntpt_package=mntent
            AC_CHECK_FUNCS([addmntent])
         ])
      ])
      ;;
   mnttab)
      AC_CHECK_HEADER([sys/mnttab.h], [dnl
         mntpt_package=mnttab
      ])
      ;;
])

BRLTTY_ARG_PACKAGE([mntfs], [mount file system], [], [dnl
   linux*)
      mntfs_package="linux"
      ;;
])

BRLTTY_ARG_PACKAGE([kbd], [keyboard], [], [dnl
   *android*) kbd_package="android";;
   linux*) kbd_package="linux";;
])

BRLTTY_ARG_PACKAGE([bell], [console bell], [], [dnl
   linux*)
      bell_package="linux"
      ;;
])

BRLTTY_ARG_PACKAGE([leds], [keyboard LEDs], [], [dnl
   linux*)
      leds_package="linux"
      ;;
])

BRLTTY_ARG_PACKAGE([beep], [beeper], [], [dnl
   *android*)
      beep_package="none"
      ;;
   cygwin*)
      beep_package="windows"
      ;;
   freebsd*)
      beep_package="spkr"
      ;;
   kfreebsd*)
      beep_package="spkr"
      ;;
   linux*)
      beep_package="linux"
      ;;
   mingw*)
      beep_package="windows"
      ;;
   msdos*)
      beep_package="msdos"
      ;;
   netbsd*)
      beep_package="wskbd"
      ;;
   openbsd*)
      beep_package="wskbd"
      ;;
   solaris*)
      beep_package="solaris"
      ;;
])

BRLTTY_ARG_PACKAGE([pcm], [PCm], [alsa oss], [dnl
   *android*)
      pcm_package="android"
      ;;
   *qnx*)
      pcm_package="qsa"
      ;;
   hpux*)
      pcm_package="hpux"
      ;;
   mingw*)
      pcm_package="windows"
      ;;
   msdos*)
      pcm_package="none"
      ;;
   netbsd*)
      pcm_package="audio"
      ;;
   openbsd*)
      pcm_package="audio"
      ;;
   solaris*)
      pcm_package="audio"
      ;;
], [dnl
   oss)
      AC_CHECK_HEADER([sys/soundcard.h], [dnl
         pcm_package="oss"
      ])
      ;;
])

BRLTTY_ARG_PACKAGE([midi], [MIDI], [alsa oss], [dnl
   darwin*)
      midi_package="darwin"
      midi_libs="-framework AudioUnit -framework AudioToolbox"
      ;;
   mingw*)
      midi_package="windows"
      ;;
   msdos*)
      midi_package="none"
      ;;
], [dnl
   oss)
      AC_CHECK_HEADER([sys/soundcard.h], [dnl
         midi_package="oss"
      ])
      ;;
])

BRLTTY_ARG_PACKAGE([fm], [FM], [adlib], [dnl
], [dnl
   adlib)
      fm_package="adlib"
      ;;
])

BRLTTY_ARG_PACKAGE([serial], [serial I/O], [termios], [dnl
   elf*)
      serial_package="grub"
      ;;
   mingw*)
      serial_package="windows"
      ;;
   msdos*)
      serial_package="msdos"
      ;;
], [dnl
   termios)
      AC_CHECK_HEADER([termios.h], [dnl
         serial_package="termios"
         AC_CHECK_FUNCS([tcdrain])
      ])
      ;;
])

BRLTTY_ARG_PACKAGE([usb], [USB I/O], [libusb-1.0 libusb], [dnl
   *android*)
      usb_package="android"
      ;;
   darwin*)
      usb_package="darwin"
      usb_includes="-x objective-c"
      ;;
   elf*)
      usb_package="grub"
      ;;
   freebsd*)
      usb_package="freebsd"
      ;;
   kfreebsd*)
      usb_package="kfreebsd"
      AC_CHECK_HEADERS([legacy/dev/usb/usb.h])
      ;;
   linux*)
      usb_package="linux"
      ;;
   netbsd*)
      usb_package="netbsd"
      ;;
   openbsd*)
      usb_package="openbsd"
      ;;
   solaris*)
      usb_package="solaris"
      AC_HAVE_LIBRARY([aio])
      AC_HAVE_LIBRARY([rt])
      ;;
], [dnl
   libusb)
      AC_CHECK_HEADER([usb.h], [dnl
         usb_package="libusb"
         usb_libs="-lusb"
      ], [], [-])
      ;;
])

BRLTTY_ARG_PACKAGE([bluetooth], [Bluetooth I/O], [], [dnl
   *android*)
      bluetooth_package="android"
      ;;
   darwin*)
      bluetooth_package="darwin"
      bluetooth_includes="-x objective-c"
      bluetooth_libs="-framework IOBluetooth"
      ;;
   cygwin*|mingw*)
      AC_CHECK_HEADER([ws2bth.h], [dnl
         bluetooth_package="windows"
         bluetooth_libs="-lbthprops -lws2_32"
      ], , [[#include <windows.h>]])
      ;;
   linux*)
      AC_CHECK_HEADER([bluetooth/bluetooth.h], [dnl
         bluetooth_package="linux"
         AC_HAVE_LIBRARY([bluetooth])

         BRLTTY_HAVE_PACKAGE([dbus], ["dbus-1 >= 1.0"], [dnl
            bluetooth_includes="${dbus_includes}"
            bluetooth_libs="${dbus_libs}"
         ])
      ])
      ;;
])

BRLTTY_ARG_PACKAGE([ports], [I/O ports], [], [dnl
   cygwin*)
      ports_package="windows"
      ;;
   elf*)
      ports_package="grub"
      ;;
   gnu*)
      ports_package="glibc"
      ;;
   kfreebsd*)
      ports_package="kfreebsd"
      ;;
   linux*)
      AC_CHECK_FUNC([ioperm], [
         ports_package="glibc"
      ])
      ;;
   mingw*)
      ports_package="windows"
      ;;
   msdos*)
      ports_package="msdos"
      ;;
])

BRLTTY_BRAILLE_DRIVER([al], [Alva])
BRLTTY_BRAILLE_DRIVER([at], [Albatross])
test -n "${api_server_objects}" && {
   BRLTTY_BRAILLE_DRIVER([ba], [BrlAPI], [$(API_LIBS)])
}
BRLTTY_BRAILLE_DRIVER([bc], [BrailComm])
BRLTTY_BRAILLE_DRIVER([bd], [Braudi])
BRLTTY_BRAILLE_DRIVER([bl], [BrailleLite])
BRLTTY_BRAILLE_DRIVER([bm], [Baum])
BRLTTY_BRAILLE_DRIVER([bn], [BrailleNote])
BRLTTY_BRAILLE_DRIVER([cb], [CombiBraille])
BRLTTY_BRAILLE_DRIVER([ce], [Cebra])
BRLTTY_BRAILLE_DRIVER([ec], [EcoBraille])
BRLTTY_BRAILLE_DRIVER([eu], [EuroBraille])
BRLTTY_BRAILLE_DRIVER([fs], [FreedomScientific])
BRLTTY_BRAILLE_DRIVER([hd], [Hedo])
BRLTTY_BRAILLE_DRIVER([hm], [HIMS])
BRLTTY_BRAILLE_DRIVER([ht], [HandyTech])
BRLTTY_BRAILLE_DRIVER([hw], [HumanWare])
BRLTTY_BRAILLE_DRIVER([ir], [Iris])
BRLTTY_BRAILLE_DRIVER([ic], [Inceptor])
BRLTTY_IF_PACKAGE([Libbraille], [libbraille], [include/braille.h], [dnl
   BRLTTY_BRAILLE_DRIVER([lb], [Libbraille], [-L$(LIBBRAILLE_ROOT)/lib -lbraille])
])
BRLTTY_BRAILLE_DRIVER([lt], [LogText])
BRLTTY_BRAILLE_DRIVER([mb], [MultiBraille])
BRLTTY_BRAILLE_DRIVER([md], [MDV])
BRLTTY_BRAILLE_DRIVER([mm], [BrailleMemo])
BRLTTY_BRAILLE_DRIVER([mn], [MiniBraille])
BRLTTY_BRAILLE_DRIVER([mt], [Metec])
BRLTTY_BRAILLE_DRIVER([np], [NinePoint])
BRLTTY_BRAILLE_DRIVER([pg], [Pegasus])
BRLTTY_BRAILLE_DRIVER([pm], [Papenmeier])
BRLTTY_BRAILLE_DRIVER([sk], [Seika])
BRLTTY_BRAILLE_DRIVER([tn], [TechniBraille])
BRLTTY_BRAILLE_DRIVER([ts], [TSI])
BRLTTY_BRAILLE_DRIVER([tt], [TTY], [$(CURSES_LIBS)])
BRLTTY_BRAILLE_DRIVER([vd], [VideoBraille])
BRLTTY_BRAILLE_DRIVER([vo], [Voyager])
BRLTTY_BRAILLE_DRIVER([vr], [Virtual])
BRLTTY_BRAILLE_DRIVER([vs], [VisioBraille])
test -n "${gui_toolkit_package}" && {
   BRLTTY_BRAILLE_DRIVER([xw], [XWindow], [$(XTK_LIBS) $(X11_LIBS)])
}
case "${host_os}"
in
   linux*)
      BRLTTY_BRAILLE_DRIVER([bg], [B2G])
      ;;
   *) ;;
esac
BRLTTY_ARG_DRIVER([braille], [Braille])

AC_CACHE_CHECK([for device directory], [brltty_cv_device_directory], [dnl
case "${host_os}"
in
   mingw*)
      brltty_cv_device_directory="//."
      ;;
   elf*|msdos*)
      brltty_cv_device_directory=""
      ;;
   *)
      brltty_cv_device_directory="/dev"
      ;;
esac])
AC_DEFINE_UNQUOTED([DEVICE_DIRECTORY], ["${brltty_cv_device_directory}"],
                   [Define this to be a string containing the path to the directory containing the devices.])

AC_CACHE_CHECK([for first serial device], [brltty_cv_device_serial_first], [dnl
case "${host_os}"
in
   linux*)
      brltty_cv_device_serial_first="ttyS0"
      ;;
   gnu*)
      brltty_cv_device_serial_first="com0"
      ;;
   solaris*)
      brltty_cv_device_serial_first="ttya"
      ;;
   hpux*)
      brltty_cv_device_serial_first="tty0p0"
      ;;
   openbsd*)
      brltty_cv_device_serial_first="cua00"
      ;;
   freebsd*)
      brltty_cv_device_serial_first="cuaa0"
      ;;
   kfreebsd*)
      brltty_cv_device_serial_first="cuaa0"
      ;;
   netbsd*)
      brltty_cv_device_serial_first="dty00"
      ;;
   osf*)
      brltty_cv_device_serial_first="tty00"
      ;;
   *qnx*)
      brltty_cv_device_serial_first="ser1"
      ;;
   cygwin*)
      brltty_cv_device_serial_first="ttyS0"
      ;;
   mingw*|msdos*)
      brltty_cv_device_serial_first="COM1"
      ;;
   elf*)
      brltty_cv_device_serial_first="com0"
      ;;
   *)
      brltty_cv_device_serial_first=""
      AC_MSG_WARN([primary serial device not configured for ${host_os}])
      ;;
esac])
AC_SUBST([serial_first_device], [${brltty_cv_device_serial_first}])
AC_DEFINE_UNQUOTED([SERIAL_FIRST_DEVICE], ["${serial_first_device}"],
                   [Define this to be a string containing the path to the first serial device.])

BRLTTY_ARG_WITH(
   [braille-device], [DEVICE],
   [default braille display device],
   [braille_device], ["yes"]
)
if test "${braille_device}" = "no"
then
   braille_device=""
elif test "${braille_device}" = "yes"
then
   braille_device=""
   test "${usb_package}" != "none" && braille_device="${braille_device},usb:"
   test "${bluetooth_package}" != "none" && braille_device="${braille_device},bluetooth:"

   if test -n "${braille_device}"
   then
      braille_device="${braille_device#,}"
   else
      braille_device="serial:${serial_first_device}"
   fi
fi
AC_SUBST([braille_device])
AC_DEFINE_UNQUOTED([BRAILLE_DEVICE], ["${braille_device}"],
                   [Define this to be a string containing the path to the default braille device.])
BRLTTY_SUMMARY_ITEM([braille-device], [braille_device])

BRLTTY_TEXT_TABLE([auto], [locale-based autoselection])
BRLTTY_TEXT_TABLE([ar], [Arabic (generic)])
BRLTTY_TEXT_TABLE([as], [Assamese])
BRLTTY_TEXT_TABLE([awa], [Awadhi])
BRLTTY_TEXT_TABLE([bg], [Bulgarian])
BRLTTY_TEXT_TABLE([bh], [Bihari])
BRLTTY_TEXT_TABLE([bn], [Bengali])
BRLTTY_TEXT_TABLE([bo], [Tibetan])
BRLTTY_TEXT_TABLE([bra], [Braj])
BRLTTY_TEXT_TABLE([brf], [Braille Ready Format (for viewing .brf files within an editor or pager)])
BRLTTY_TEXT_TABLE([cs], [Czech])
BRLTTY_TEXT_TABLE([cy], [Welsh])
BRLTTY_TEXT_TABLE([da], [Danish])
BRLTTY_TEXT_TABLE([da-1252], [Danish (Svend Thougaard, 2002-11-18)])
BRLTTY_TEXT_TABLE([da-lt], [Danish (LogText)])
BRLTTY_TEXT_TABLE([de], [German])
BRLTTY_TEXT_TABLE([dra], [Dravidian])
BRLTTY_TEXT_TABLE([el], [Greek])
BRLTTY_TEXT_TABLE([en], [English])
BRLTTY_TEXT_TABLE([en_CA], [English (Canada)])
BRLTTY_TEXT_TABLE([en_GB], [English (United Kingdom)])
BRLTTY_TEXT_TABLE([en_US], [English (United States)])
BRLTTY_TEXT_TABLE([en-nabcc], [English (North American Braille Computer Code)])
BRLTTY_TEXT_TABLE([eo], [Esperanto])
BRLTTY_TEXT_TABLE([es], [Spanish])
BRLTTY_TEXT_TABLE([et], [Estonian])
BRLTTY_TEXT_TABLE([fi], [Finnish])
BRLTTY_TEXT_TABLE([fr], [French])
BRLTTY_TEXT_TABLE([fr_CA], [French (Canada)])
BRLTTY_TEXT_TABLE([fr_FR], [French (France)])
BRLTTY_TEXT_TABLE([fr-2007], [French (unified 2007)])
BRLTTY_TEXT_TABLE([fr-cbifs], [French (Code Braille Informatique Fran├žais Standard)])
BRLTTY_TEXT_TABLE([fr-vs], [French (VisioBraille)])
BRLTTY_TEXT_TABLE([ga], [Irish])
BRLTTY_TEXT_TABLE([gd], [Gaelic])
BRLTTY_TEXT_TABLE([gon], [Gondi])
BRLTTY_TEXT_TABLE([gu], [Gujarati])
BRLTTY_TEXT_TABLE([he], [Hebrew])
BRLTTY_TEXT_TABLE([hi], [Hindi])
BRLTTY_TEXT_TABLE([hr], [Croatian])
BRLTTY_TEXT_TABLE([hu], [Hungarian])
BRLTTY_TEXT_TABLE([hy], [Armenian])
BRLTTY_TEXT_TABLE([is], [Icelandic])
BRLTTY_TEXT_TABLE([it], [Italian])
BRLTTY_TEXT_TABLE([kha], [Khasi])
BRLTTY_TEXT_TABLE([kn], [Kannada])
BRLTTY_TEXT_TABLE([kok], [Konkani])
BRLTTY_TEXT_TABLE([kru], [Kurukh])
BRLTTY_TEXT_TABLE([lt], [Lituanian])
BRLTTY_TEXT_TABLE([lv], [Latvian])
BRLTTY_TEXT_TABLE([mg], [Malagasy])
BRLTTY_TEXT_TABLE([mi], [Maori])
BRLTTY_TEXT_TABLE([ml], [Malayalam])
BRLTTY_TEXT_TABLE([mni], [Manipuri])
BRLTTY_TEXT_TABLE([mr], [Marathi])
BRLTTY_TEXT_TABLE([mt], [Maltese])
BRLTTY_TEXT_TABLE([mun], [Munda])
BRLTTY_TEXT_TABLE([mwr], [Marwari])
BRLTTY_TEXT_TABLE([ne], [Nepali])
BRLTTY_TEXT_TABLE([new], [Newari])
BRLTTY_TEXT_TABLE([nl], [Dutch])
BRLTTY_TEXT_TABLE([nl_BE], [Dutch (Belgium)])
BRLTTY_TEXT_TABLE([nl_NL], [Dutch (Netherlands)])
BRLTTY_TEXT_TABLE([no], [Norwegian])
BRLTTY_TEXT_TABLE([no-generic], [Norwegian (with support for other languages)])
BRLTTY_TEXT_TABLE([no-oup], [Norwegian (Offentlig utvalg for punktskrift)])
BRLTTY_TEXT_TABLE([nwc], [Newari (old)])
BRLTTY_TEXT_TABLE([or], [Oriya])
BRLTTY_TEXT_TABLE([pa], [Panjabi])
BRLTTY_TEXT_TABLE([pi], [Pali])
BRLTTY_TEXT_TABLE([pl], [Polish])
BRLTTY_TEXT_TABLE([pt], [Portuguese])
BRLTTY_TEXT_TABLE([ro], [Romanian])
BRLTTY_TEXT_TABLE([ru], [Russian])
BRLTTY_TEXT_TABLE([sa], [Sanskrit])
BRLTTY_TEXT_TABLE([sat], [Santali])
BRLTTY_TEXT_TABLE([sd], [Sindhi])
BRLTTY_TEXT_TABLE([sk], [Slovak])
BRLTTY_TEXT_TABLE([sl], [Slovenian])
BRLTTY_TEXT_TABLE([sv], [Swedish])
BRLTTY_TEXT_TABLE([sv-1989], [Swedish (1989 standard)])
BRLTTY_TEXT_TABLE([sv-1996], [Swedish (1996 standard)])
BRLTTY_TEXT_TABLE([sw], [Swahili])
BRLTTY_TEXT_TABLE([ta], [Tamil])
BRLTTY_TEXT_TABLE([te], [Telugu])
BRLTTY_TEXT_TABLE([tr], [Turkish])
BRLTTY_TEXT_TABLE([uk], [Ukrainian])
BRLTTY_TEXT_TABLE([vi], [Vietnamese])
BRLTTY_ARG_TABLE([text], [en-nabcc], [ttb])

BRLTTY_ATTRIBUTES_TABLE([left_right], [foreground colour in the left column and background colour in the right column])
BRLTTY_ATTRIBUTES_TABLE([invleft_right], [inverse foreground colour in the left column and background colour in the right column])
BRLTTY_ATTRIBUTES_TABLE([upper_lower], [foreground colour in the upper square and background colour in the lower square])
BRLTTY_ARG_TABLE([attributes], [left_right], [atb])

BRLTTY_ARG_DISABLE(
   [speech-support],
   [support for speech synthesizers and text-to-speech engines],
   [],
[dnl
   AC_DEFINE([ENABLE_SPEECH_SUPPORT], [1],
             [Define this to include speech synthesizer and text-to-speech engine support.])
   speech_support_object='spk.$O'

   BRLTTY_SPEECH_DRIVER([al], [Alva])
   BRLTTY_SPEECH_DRIVER([bl], [BrailleLite])
   BRLTTY_SPEECH_DRIVER([cb], [CombiBraille])

   BRLTTY_IF_PACKAGE([eSpeak], [espeak], [include/espeak/speak_lib.h], [dnl
      BRLTTY_SPEECH_DRIVER([es], [eSpeak], [-L$(ESPEAK_ROOT)/lib -lespeak])
   ])

   BRLTTY_IF_PACKAGE([FestivalLite], [flite], [include/flite/flite.h], [dnl
      BRLTTY_ARG_REQUIRED(
         [flite-language], [LANGUAGE],
         [the FestivalLite language to use],
         [flite_language], ["usenglish"]
      )

      BRLTTY_ARG_REQUIRED(
         [flite-lexicon], [LEXICON],
         [the FestivalLite lexicon to use],
         [flite_lexicon], ["cmulex"]
      )

      BRLTTY_ARG_REQUIRED(
         [flite-voice], [VOICE],
         [the FestivalLite voice to use],
         [flite_voice], ["cmu_us_kal"]
      )

      BRLTTY_SPEECH_DRIVER([fl], [FestivalLite], [-L$(FLITE_ROOT)/lib -lflite_$(FLITE_VOICE) -lflite_$(FLITE_LEXICON) -lflite_$(FLITE_LANGUAGE) -lflite -lm])
   ])

   BRLTTY_SPEECH_DRIVER([fv], [Festival])
   BRLTTY_SPEECH_DRIVER([gs], [GenericSay])

   BRLTTY_IF_PACKAGE([Mikropuhe], [mikropuhe], [mpwrfile.h], [dnl
      BRLTTY_IF_PTHREADS([dnl
         BRLTTY_SPEECH_DRIVER([mp], [Mikropuhe], [-L$(MPLINUX_ROOT) -lmplinux])
      ])
   ])

   BRLTTY_IF_PACKAGE([speech-dispatcher], [speechd], [include/libspeechd.h], [dnl
      BRLTTY_SPEECH_DRIVER([sd], [SpeechDispatcher])
   ], [include], [lib], [speechd])

   BRLTTY_IF_PACKAGE([Swift], [swift], [include/swift.h], [dnl
      BRLTTY_SPEECH_DRIVER([sw], [Swift], [-L$(SWIFT_ROOT)/lib -lswift -lm])
   ])

   BRLTTY_IF_PACKAGE([Theta], [theta], [include/theta.h], [dnl
      BRLTTY_SPEECH_DRIVER([th], [Theta], [-L$(THETA_ROOT)/lib -ltheta])
   ])

   BRLTTY_IF_PACKAGE([ViaVoice], [viavoice], [include/eci.h], [dnl
      BRLTTY_SPEECH_DRIVER([vv], [ViaVoice], [-L$(VIAVOICE_ROOT)/lib -libmeci50])
   ])

   BRLTTY_SPEECH_DRIVER([xs], [ExternalSpeech])

   case "${host_os}"
   in
      *android*)
         BRLTTY_SPEECH_DRIVER([an], [Android])
         ;;
      *) ;;
   esac
])
AC_SUBST([speech_support_object])
BRLTTY_ARG_DRIVER([speech], [Speech])

case "${host_os}"
in
   *android*)
      BRLTTY_SCREEN_DRIVER([an], [Android])
      ;;
   linux*)
      BRLTTY_SCREEN_DRIVER([lx], [Linux])
      ;;
   gnu*)
      BRLTTY_SCREEN_DRIVER([hd], [Hurd])
      ;;
   cygwin*|mingw*)
      BRLTTY_SCREEN_DRIVER([wn], [Windows])
      brltty_build_directories="${brltty_build_directories} Drivers/BrlAPI/WindowEyes"
      ;;
   msdos*)
      BRLTTY_SCREEN_DRIVER([pb], [PcBios])
      ;;
   elf*)
      BRLTTY_SCREEN_DRIVER([gb], [Grub])
      ;;
   *)
      AC_MSG_WARN([no native screen driver for ${host_os}])
      ;;
esac

AC_CHECK_HEADER([sys/shm.h], [dnl
   BRLTTY_SCREEN_DRIVER([sc], [Screen])
])

if test "${brltty_enabled_x}" = "yes"
then
   BRLTTY_HAVE_PACKAGE([cspi], [cspi-1.0], [dnl
      AC_CHECK_HEADER([X11/keysym.h], [dnl
         AC_CHECK_HEADER([X11/Xlib.h], [dnl
            BRLTTY_SCREEN_DRIVER([as], [AtSpi], [$(X11_LIBS) $(CSPI_LIBS)])
         ])
      ])
   ])
fi

BRLTTY_HAVE_PACKAGE([dbus], ["dbus-1 >= 1.0"], [dnl
   AC_CHECK_HEADER([X11/keysym.h], [dnl
      BRLTTY_HAVE_PACKAGE([atspi2], [atspi-2], [dnl
         brltty_cppflags_save="${CPPFLAGS}"
         CPPFLAGS="${CPPFLAGS} ${atspi2_cflags}"

         brltty_libs_save="${LIBS}"
         LIBS="${atspi2_libs} ${LIBS}"

         AC_CHECK_FUNCS([atspi_get_a11y_bus])

         CPPFLAGS="${brltty_cppflags_save}"
         LIBS="${brltty_libs_save}"

         BRLTTY_HAVE_PACKAGE([glib2], [glib-2.0])
      ])

      BRLTTY_SCREEN_DRIVER([a2], [AtSpi2], [$(DBUS_LIBS) $(ATSPI2_LIBS) $(GLIB2_LIBS)])
   ])
])

BRLTTY_ARG_DRIVER([screen], [Screen])
BRLTTY_SUMMARY_ITEM([screen-driver], [default_screen_driver])

BRLTTY_ARG_ENABLE(
   [relocatable-install],
   [installation using paths relative to the program directory])

case "${host_os}"
in
   darwin*)
      INSTALL_OPTION_STRIP=""
      ;;
   *)
      INSTALL_OPTION_STRIP="-s"
      ;;
esac

if test "${cross_compiling}" != "no"
then
   if test -n "${INSTALL_OPTION_STRIP}"
   then
      INSTALL_OPTION_STRIP="${INSTALL_OPTION_STRIP} --strip-program ${STRIP}"
   fi
fi

BRLTTY_ARG_DISABLE(
   [stripping],
   [stripping of executables and shared objects during installation],
   [],
   [],
   [INSTALL_OPTION_STRIP=""]
)
AC_SUBST([INSTALL_OPTION_STRIP])

original_prefix="${prefix}"
test "${prefix}" = "NONE" && prefix=""
original_exec_prefix="${exec_prefix}"
test "${exec_prefix}" = "NONE" && exec_prefix="${prefix}"
BRLTTY_VAR_EXPAND([brltty_reference_directory], [${execute_root}${program_directory}])
BRLTTY_DEFINE_DIRECTORY([LOCALE_DIRECTORY], ["${execute_root}${localedir}"],
                        [Define this to be a string containing the path to the locale directory.])
if test -n "${writable_directory}"
then
   BRLTTY_DEFINE_DIRECTORY([WRITABLE_DIRECTORY], [${writable_directory}],
                           [Define this to be a string containing the path to a writable directory.])
fi
BRLTTY_DEFINE_DIRECTORY([TABLES_DIRECTORY], [${execute_root}${tables_directory}],
                        [Define this to be a string containing the path to the data files directory.])
BRLTTY_DEFINE_DIRECTORY([DRIVERS_DIRECTORY], [${execute_root}${drivers_directory}],
                        [Define this to be a string containing the path to the drivers directory.])
BRLTTY_DEFINE_DIRECTORY([CONFIGURATION_DIRECTORY], [${sysconfdir}],
                        [Define this to be a string containing the path to the configuration directory.])
BRLTTY_DEFINE_DIRECTORY([UPDATABLE_DIRECTORY], [${localstatedir}/lib/${PACKAGE_TARNAME}],
                        [Define this to be a string containing the path to a directory which contains files that can be updated.])
BRLTTY_DEFINE_EXPANDED([BRLAPI_ETCDIR], ["${CONFIGURATION_DIRECTORY}"],
                       [Define this to be a string containing the path to the directory where the authorization key and driver-dependent key names are found.])
BRLTTY_DEFINE_EXPANDED([BRLAPI_SOCKETPATH], ["${api_socket_path}"],
		       [Define this to be a string containing the path to the local sockets.])
BRLTTY_SUBST_EXPANDED([api_socket_directory], ["${api_socket_path}"])
prefix="${original_prefix}"
exec_prefix="${original_exec_prefix}"

AC_SUBST([install_drivers])
BRLTTY_SUMMARY_END

AC_CONFIG_COMMANDS([build-configure], [dnl
   "${srcdir}/mk4build"
])

[brltty_make_files="`echo "${brltty_build_directories}" | sed -e '
s%\([^ ][^ ]*\)%\1/Makefile:prologue.mk:\1/Makefile.in%g
'`"]

AC_OUTPUT([
   config.mk
   brltty.spec
   config.sh
   Documents/brltty.conf
   Documents/brltty.1
   Documents/BrlAPIref.doxy
   Bindings/Lisp/brlapi.lisp
   Bindings/Python/setup.py
   Android/Application/res/values/configured.xml:Android/Application/res.strings.in
   Autostart/Systemd/brltty@.service
   ${brltty_make_files}
])