Blame view

libs/libpcap-1.9.0/configure.ac 59.2 KB
fee2cbd6   amoreau   ajout des librairies
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
  dnl
  dnl Copyright (c) 1994, 1995, 1996, 1997
  dnl	The Regents of the University of California.  All rights reserved.
  dnl
  dnl Process this file with autoconf to produce a configure script.
  dnl
  
  #
  # See
  #
  #	http://ftp.gnu.org/gnu/config/README
  #
  # for the URLs to use to fetch new versions of config.guess and
  # config.sub.
  #
  
  AC_PREREQ(2.64)
  
  AC_INIT(pcap, m4_esyscmd_s([cat VERSION]))
  AC_CONFIG_SRCDIR(pcap.c)
  AC_SUBST(PACKAGE_NAME)
  
  AC_CANONICAL_SYSTEM
  
  AC_LBL_C_INIT_BEFORE_CC(V_CCOPT, V_INCLS)
  #
  # Try to enable as many C99 features as we can.
  # At minimum, we want C++/C99-style // comments.
  #
  AC_PROG_CC_C99
  AC_LBL_C_INIT(V_CCOPT, V_INCLS)
  AC_LBL_SHLIBS_INIT
  AC_LBL_C_INLINE
  
  #
  # Try to arrange for large file support.
  #
  AC_SYS_LARGEFILE
  AC_FUNC_FSEEKO
  
  dnl
  dnl Even if <net/bpf.h> were, on all OSes that support BPF, fixed to
  dnl include <sys/ioccom.h>, and we were to drop support for older
  dnl releases without that fix, so that pcap-bpf.c doesn't need to
  dnl include <sys/ioccom.h>, the test program in "AC_LBL_FIXINCLUDES"
  dnl in "aclocal.m4" uses it, so we would still have to test for it
  dnl and set "HAVE_SYS_IOCCOM_H" if we have it, otherwise
  dnl "AC_LBL_FIXINCLUDES" wouldn't work on some platforms such as Solaris.
  dnl
  AC_CHECK_HEADERS(sys/ioccom.h sys/sockio.h limits.h)
  AC_CHECK_HEADERS(netpacket/packet.h)
  AC_CHECK_HEADERS(net/pfvar.h, , , [#include <sys/types.h>
  #include <sys/socket.h>
  #include <net/if.h>])
  if test "$ac_cv_header_net_pfvar_h" = yes; then
  	#
  	# Check for various PF actions.
  	#
  	AC_MSG_CHECKING(whether net/pfvar.h defines PF_NAT through PF_NORDR)
  	AC_TRY_COMPILE(
  	    [#include <sys/types.h>
  	    #include <sys/socket.h>
  	    #include <net/if.h>
  	    #include <net/pfvar.h>],
  	    [return PF_NAT+PF_NONAT+PF_BINAT+PF_NOBINAT+PF_RDR+PF_NORDR;],
  	    [
  		AC_MSG_RESULT(yes)
  		AC_DEFINE(HAVE_PF_NAT_THROUGH_PF_NORDR, 1,
  		    [define if net/pfvar.h defines PF_NAT through PF_NORDR])
  	    ],
  	    AC_MSG_RESULT(no))
  fi
  
  case "$host_os" in
  linux*|uclinux*)
  	AC_CHECK_HEADERS(linux/sockios.h linux/if_bonding.h,,,
  	[
  #include <sys/socket.h>
  #include <linux/if.h>
  	])
  	;;
  esac
  
  AC_LBL_FIXINCLUDES
  
  AC_CHECK_FUNCS(strerror strerror_r strerror_s strlcpy strlcat)
  
  needsnprintf=no
  AC_CHECK_FUNCS(vsnprintf snprintf,,
  	[needsnprintf=yes])
  if test $needsnprintf = yes; then
  	AC_LIBOBJ([snprintf])
  fi
  
  needstrtok_r=no
  AC_CHECK_FUNCS(strtok_r,,
  	[needstrtok_r=yes])
  if test $needstrtok_r = yes; then
  	AC_LIBOBJ([strtok_r])
  fi
  
  #
  # Do we have ffs(), and is it declared in <strings.h>?
  #
  AC_CHECK_FUNCS(ffs)
  if test "$ac_cv_func_ffs" = yes; then
  	#
  	# We have ffs(); is it declared in <strings.h>?
  	#
  	# This test fails if we don't have <strings.h> or if we do
  	# but it doesn't declare ffs().
  	#
  	AC_CHECK_DECL(ffs,
  	    [
  		AC_DEFINE(STRINGS_H_DECLARES_FFS,,
  		    [Define to 1 if strings.h declares `ffs'])
  	    ],,
  	    [
  #include <strings.h>
  	    ])
  fi
  
  #
  # Do this before checking for ether_hostton(), as it's a
  # "getaddrinfo()-ish function".
  #
  AC_LBL_LIBRARY_NET
  
  #
  # Check for reentrant versions of getnetbyname_r(), as provided by
  # Linux (glibc), Solaris/IRIX, and AIX (with three different APIs!).
  # If we don't find one, we just use getnetbyname(), which uses
  # thread-specific data on many platforms, but doesn't use it on
  # NetBSD or OpenBSD, and may not use it on older versions of other
  # platforms.
  #
  # Only do the check if we have a declaration of getnetbyname_r();
  # without it, we can't check which API it has.  (We assume that
  # if there's a declaration, it has a prototype, so that the API
  # can be checked.)
  #
  AC_CHECK_DECL(getnetbyname_r,
      [
  	AC_MSG_CHECKING([for the Linux getnetbyname_r()])
  	AC_TRY_LINK(
  	    [#include <netdb.h>],
  	    [
  		struct netent netent_buf;
  		char buf[1024];
  		struct netent *resultp;
  		int h_errnoval;
  
  		return getnetbyname_r((const char *)0, &netent_buf, buf, sizeof buf, &resultp, &h_errnoval);
  	    ],
  	    [
  		AC_MSG_RESULT(yes)
  		AC_DEFINE(HAVE_LINUX_GETNETBYNAME_R, 1,
  		    [define if we have the Linux getnetbyname_r()])
  	    ],
  	    [
  		AC_MSG_RESULT(no)
  
  		AC_MSG_CHECKING([for Solaris/IRIX getnetbyname_r()])
  		AC_TRY_LINK(
  		    [#include <netdb.h>],
  		    [
  			struct netent netent_buf;
  			char buf[1024];
  
  			return getnetbyname_r((const char *)0, &netent_buf, buf, (int)sizeof buf) != NULL;
  		    ],
  		    [
  			AC_MSG_RESULT(yes)
  			AC_DEFINE(HAVE_SOLARIS_IRIX_GETNETBYNAME_R, 1,
  			    [define if we have the Solaris/IRIX getnetbyname_r()])
  		    ],
  		    [
  			AC_MSG_RESULT(no)
  
  			AC_MSG_CHECKING([for AIX getnetbyname_r()])
  			AC_TRY_LINK(
  			    [#include <netdb.h>],
  			    [
  				struct netent netent_buf;
  				struct netent_data net_data;
  
  				return getnetbyname_r((const char *)0, &netent_buf, &net_data);
  			    ],
  			    [
  				AC_MSG_RESULT(yes)
  				AC_DEFINE(HAVE_AIX_GETNETBYNAME_R, 1,
  				    [define if we have the AIX getnetbyname_r()])
  			    ],
  			    [
  				AC_MSG_RESULT(no)
  			    ])
  		    ])
  	    ])
      ],,[#include <netdb.h>])
  
  #
  # Check for reentrant versions of getprotobyname_r(), as provided by
  # Linux (glibc), Solaris/IRIX, and AIX (with three different APIs!).
  # If we don't find one, we just use getprotobyname(), which uses
  # thread-specific data on many platforms, but doesn't use it on
  # NetBSD or OpenBSD, and may not use it on older versions of other
  # platforms.
  #
  # Only do the check if we have a declaration of getprotobyname_r();
  # without it, we can't check which API it has.  (We assume that
  # if there's a declaration, it has a prototype, so that the API
  # can be checked.)
  #
  AC_CHECK_DECL(getprotobyname_r,
      [
  	AC_MSG_CHECKING([for the Linux getprotobyname_r()])
  	AC_TRY_LINK(
  	    [#include <netdb.h>],
  	    [
  		struct protoent protoent_buf;
  		char buf[1024];
  		struct protoent *resultp;
  
  		return getprotobyname_r((const char *)0, &protoent_buf, buf, sizeof buf, &resultp);
  	    ],
  	    [
  		AC_MSG_RESULT(yes)
  		AC_DEFINE(HAVE_LINUX_GETPROTOBYNAME_R, 1,
  		    [define if we have the Linux getprotobyname_r()])
  	    ],
  	    [
  		AC_MSG_RESULT(no)
  
  		AC_MSG_CHECKING([for Solaris/IRIX getprotobyname_r()])
  		AC_TRY_LINK(
  		    [#include <netdb.h>],
  		    [
  			struct protoent protoent_buf;
  			char buf[1024];
  
  			return getprotobyname_r((const char *)0, &protoent_buf, buf, (int)sizeof buf) != NULL;
  		    ],
  		    [
  			AC_MSG_RESULT(yes)
  			AC_DEFINE(HAVE_SOLARIS_IRIX_GETPROTOBYNAME_R, 1,
  			    [define if we have the Solaris/IRIX getprotobyname_r()])
  		    ],
  		    [
  			AC_MSG_RESULT(no)
  
  			AC_MSG_CHECKING([for AIX getprotobyname_r()])
  			AC_TRY_LINK(
  			    [#include <netdb.h>],
  			    [
  				struct protoent protoent_buf;
  				struct protoent_data proto_data;
  
  				return getprotobyname_r((const char *)0, &protoent_buf, &proto_data);
  			    ],
  			    [
  				AC_MSG_RESULT(yes)
  				AC_DEFINE(HAVE_AIX_GETPROTOBYNAME_R, 1,
  				    [define if we have the AIX getprotobyname_r()])
  			    ],
  			    [
  				AC_MSG_RESULT(no)
  			    ])
  		    ])
  	    ])
      ],,[#include <netdb.h>])
  
  #
  # You are in a twisty little maze of UN*Xes, all different.
  # Some might not have ether_hostton().
  # Some might have it and declare it in <net/ethernet.h>.
  # Some might have it and declare it in <netinet/ether.h>
  # Some might have it and declare it in <sys/ethernet.h>.
  # Some might have it and declare it in <arpa/inet.h>.
  # Some might have it and declare it in <netinet/if_ether.h>.
  # Some might have it and not declare it in any header file.
  #
  # Before you is a C compiler.
  #
  AC_CHECK_FUNCS(ether_hostton)
  if test "$ac_cv_func_ether_hostton" = yes; then
  	#
  	# OK, we have ether_hostton().  Is it declared in <net/ethernet.h>?
  	#
  	# This test fails if we don't have <net/ethernet.h> or if we do
  	# but it doesn't declare ether_hostton().
  	#
  	AC_CHECK_DECL(ether_hostton,
  	    [
  		AC_DEFINE(NET_ETHERNET_H_DECLARES_ETHER_HOSTTON,,
  		    [Define to 1 if net/ethernet.h declares `ether_hostton'])
  	    ],,
  	    [
  #include <net/ethernet.h>
  	    ])
  	#
  	# Did that succeed?
  	#
  	if test "$ac_cv_have_decl_ether_hostton" != yes; then
  		#
  		# No, how about <netinet/ether.h>, as on Linux?
  		#
  		# This test fails if we don't have <netinet/ether.h>
  		# or if we do but it doesn't declare ether_hostton().
  		#
  		# Unset ac_cv_have_decl_ether_hostton so we don't
  		# treat the previous failure as a cached value and
  		# suppress the next test.
  		#
  		unset ac_cv_have_decl_ether_hostton
  		AC_CHECK_DECL(ether_hostton,
  		    [
  			AC_DEFINE(NETINET_ETHER_H_DECLARES_ETHER_HOSTTON,,
  			    [Define to 1 if netinet/ether.h declares `ether_hostton'])
  		    ],,
  		    [
  #include <netinet/ether.h>
  		    ])
  	fi
  	#
  	# Did that succeed?
  	#
  	if test "$ac_cv_have_decl_ether_hostton" != yes; then
  		#
  		# No, how about <sys/ethernet.h>, as on Solaris 10
  		# and later?
  		#
  		# This test fails if we don't have <sys/ethernet.h>
  		# or if we do but it doesn't declare ether_hostton().
  		#
  		# Unset ac_cv_have_decl_ether_hostton so we don't
  		# treat the previous failure as a cached value and
  		# suppress the next test.
  		#
  		unset ac_cv_have_decl_ether_hostton
  		AC_CHECK_DECL(ether_hostton,
  		    [
  			AC_DEFINE(SYS_ETHERNET_H_DECLARES_ETHER_HOSTTON,,
  			    [Define to 1 if sys/ethernet.h declares `ether_hostton'])
  		    ],,
  		    [
  #include <sys/ethernet.h>
  		    ])
  	fi
  	#
  	# Did that succeed?
  	#
  	if test "$ac_cv_have_decl_ether_hostton" != yes; then
  		#
  		# No, how about <arpa/inet.h>, as in AIX?
  		#
  		# This test fails if we don't have <arpa/inet.h>
  		# (if we have ether_hostton(), we should have
  		# networking, and if we have networking, we should
  		# have <arapa/inet.h>) or if we do but it doesn't
  		# declare ether_hostton().
  		#
  		# Unset ac_cv_have_decl_ether_hostton so we don't
  		# treat the previous failure as a cached value and
  		# suppress the next test.
  		#
  		unset ac_cv_have_decl_ether_hostton
  		AC_CHECK_DECL(ether_hostton,
  		    [
  			AC_DEFINE(ARPA_INET_H_DECLARES_ETHER_HOSTTON,,
  			    [Define to 1 if arpa/inet.h declares `ether_hostton'])
  		    ],,
  		    [
  #include <arpa/inet.h>
  		    ])
  	fi
  	#
  	# Did that succeed?
  	#
  	if test "$ac_cv_have_decl_ether_hostton" != yes; then
  		#
  		# No, how about <netinet/if_ether.h>?
  		# On some platforms, it requires <net/if.h> and
  		# <netinet/in.h>, and we always include it with
  		# both of them, so test it with both of them.
  		#
  		# This test fails if we don't have <netinet/if_ether.h>
  		# and the headers we include before it, or if we do but
  		# <netinet/if_ether.h> doesn't declare ether_hostton().
  		#
  		# Unset ac_cv_have_decl_ether_hostton so we don't
  		# treat the previous failure as a cached value and
  		# suppress the next test.
  		#
  		unset ac_cv_have_decl_ether_hostton
  		AC_CHECK_DECL(ether_hostton,
  		    [
  			AC_DEFINE(NETINET_IF_ETHER_H_DECLARES_ETHER_HOSTTON,,
  			    [Define to 1 if netinet/if_ether.h declares `ether_hostton'])
  		    ],,
  		    [
  #include <sys/types.h>
  #include <sys/socket.h>
  #include <net/if.h>
  #include <netinet/in.h>
  #include <netinet/if_ether.h>
  		    ])
  	fi
  	#
  	# After all that, is ether_hostton() declared?
  	#
  	if test "$ac_cv_have_decl_ether_hostton" = yes; then
  		#
  		# Yes.
  		#
  		AC_DEFINE(HAVE_DECL_ETHER_HOSTTON, 1,
  		    [Define to 1 if you have the declaration of `ether_hostton'])
          else
  		#
  		# No, we'll have to declare it ourselves.
  		# Do we have "struct ether_addr" if we include
  		# <netinet/if_ether.h>?
  		#
  		AC_CHECK_TYPES(struct ether_addr,,,
  		    [
  			#include <sys/types.h>
  			#include <sys/socket.h>
  			#include <net/if.h>
  			#include <netinet/in.h>
  			#include <netinet/if_ether.h>
  		    ])
  	fi
  fi
  
  #
  # For various things that might use pthreads.
  #
  AC_CHECK_HEADER(pthread.h,
      [
  	#
  	# OK, we have pthread.h.  Do we have pthread_create in the
  	# system libraries?
  	#
  	AC_CHECK_FUNC(pthread_create,
  	    [
  		#
  		# Yes.
  		#
  		ac_lbl_have_pthreads="found"
  	    ],
  	    [
  		#
  		# No - do we have it in -lpthreads?
  		#
  		AC_CHECK_LIB(pthreads, pthread_create,
  		    [
  			#
  			# Yes - add -lpthreads.
  			#
  			ac_lbl_have_pthreads="found"
  			PTHREAD_LIBS="$PTHREAD_LIBS -lpthreads"
  		    ],
  		    [
  			#
  			# No - do we have it in -lpthread?
  			#
  			AC_CHECK_LIB(pthread, pthread_create,
  			    [
  				#
  				# Yes - add -lpthread.
  				#
                                  ac_lbl_have_pthreads="found"
  				PTHREAD_LIBS="$PTHREAD_LIBS -lpthread"
  			    ],
  			    [
  				#
  				# No.
  				#
  				ac_lbl_have_pthreads="not found"
  			    ])
  		    ])
  	    ])
      ],
      [
  	#
  	# We didn't find pthread.h.
  	#
  	ac_lbl_have_pthreads="not found"
      ]
  )
  
  dnl to pacify those who hate protochain insn
  AC_MSG_CHECKING(if --disable-protochain option is specified)
  AC_ARG_ENABLE(protochain,
  AC_HELP_STRING([--disable-protochain],[disable \"protochain\" insn]))
  case "x$enable_protochain" in
  xyes)	enable_protochain=enabled	;;
  xno)	enable_protochain=disabled	;;
  x)	enable_protochain=enabled	;;
  esac
  
  if test "$enable_protochain" = "disabled"; then
  	AC_DEFINE(NO_PROTOCHAIN,1,[do not use protochain])
  fi
  AC_MSG_RESULT(${enable_protochain})
  
  #
  # valgrindtest directly uses the native capture mechanism, but
  # only tests with BPF and PF_PACKET sockets; only enable it if
  # we have BPF or PF_PACKET sockets.
  #
  VALGRINDTEST_SRC=
  
  #
  # SITA support is mutually exclusive with native capture support;
  # "--with-sita" selects SITA support.
  #
  AC_ARG_WITH(sita,
  AC_HELP_STRING([--with-sita],[include SITA support]),
  [
  	if test ! "x$withval" = "xno" ; then
  		AC_DEFINE(SITA,1,[include ACN support])
  		AC_MSG_NOTICE(Enabling SITA ACN support)
  		V_PCAP=sita
  	fi
  ],
  [
  AC_ARG_WITH(pcap,
  AC_HELP_STRING([--with-pcap=TYPE],[use packet capture TYPE]))
  if test ! -z "$with_pcap" ; then
  	V_PCAP="$withval"
  else
  	#
  	# Check for a bunch of headers for various packet
  	# capture mechanisms.
  	#
  	AC_CHECK_HEADERS(net/bpf.h)
  	if test "$ac_cv_header_net_bpf_h" = yes; then
  		#
  		# Does it define BIOCSETIF?
  		# I.e., is it a header for an LBL/BSD-style capture
  		# mechanism, or is it just a header for a BPF filter
  		# engine?  Some versions of Arch Linux, for example,
  		# have a net/bpf.h that doesn't define BIOCSETIF;
  		# as it's a Linux, it should use packet sockets,
  		# instead.
  		#
  		# We need:
  		#
  		#  sys/types.h, because FreeBSD 10's net/bpf.h
  		#  requires that various BSD-style integer types
  		#  be defined;
  		#
  		#  sys/ioctl.h and, if we have it, sys/ioccom.h,
  		#  because net/bpf.h defines ioctls;
  		#
  		#  net/if.h, because it defines some structures
  		#  used in ioctls defined by net/bpf.h;
  		#
  		#  sys/socket.h, because OpenBSD 5.9's net/bpf.h
  		#  defines some structure fields as being
  		#  struct sockaddrs;
  		#
  		# and net/bpf.h doesn't necessarily include all
  		# of those headers itself.
  		#
  		AC_MSG_CHECKING(if net/bpf.h defines BIOCSETIF)
  		AC_CACHE_VAL(ac_cv_lbl_bpf_h_defines_biocsetif,
  			AC_TRY_COMPILE(
  [
  #include <sys/types.h>
  #include <sys/ioctl.h>
  #include <sys/socket.h>
  #ifdef HAVE_SYS_IOCCOM_H
  #include <sys/ioccom.h>
  #endif
  #include <net/bpf.h>
  #include <net/if.h>
  ],
  			[u_int i = BIOCSETIF;],
  			ac_cv_lbl_bpf_h_defines_biocsetif=yes,
  			ac_cv_lbl_bpf_h_defines_biocsetif=no))
  		AC_MSG_RESULT($ac_cv_lbl_bpf_h_defines_biocsetif)
  	fi
  	AC_CHECK_HEADERS(net/pfilt.h net/enet.h)
  	AC_CHECK_HEADERS(net/nit.h sys/net/nit.h)
  	AC_CHECK_HEADERS(linux/socket.h net/raw.h sys/dlpi.h)
  
  	if test "$ac_cv_lbl_bpf_h_defines_biocsetif" = yes; then
  		#
  		# BPF.
  		# Check this before DLPI, so that we pick BPF on
  		# Solaris 11 and later.
  		#
  		V_PCAP=bpf
  
  		#
  		# We have BPF, so build valgrindtest with "make test"
  		# on macOS and FreeBSD (add your OS once there's a
  		# valgrind for it).
  		#
  		case "$host_os" in
  
  		freebsd*|darwin*|linux*)
  			VALGRINDTEST_SRC=valgrindtest.c
  			;;
  		esac
  	elif test "$ac_cv_header_linux_socket_h" = yes; then
  		#
  		# No prizes for guessing this one.
  		#
  		V_PCAP=linux
  
  		#
  		# XXX - this won't work with older kernels that have
  		# SOCK_PACKET sockets but not PF_PACKET sockets.
  		#
  		VALGRINDTEST_SRC=valgrindtest.c
  	elif test "$ac_cv_header_net_pfilt_h" = yes; then
  	        #
  	        # DEC OSF/1, Digital UNIX, Tru64 UNIX
          	#
  		V_PCAP=pf
  	elif test "$ac_cv_header_net_enet_h" = yes; then
  		#
  		# Stanford Enetfilter.
  		#
  		V_PCAP=enet
  	elif test "$ac_cv_header_net_nit_h" = yes; then
  		#
  		# SunOS 4.x STREAMS NIT.
  		#
  		V_PCAP=snit
  	elif test "$ac_cv_header_sys_net_nit_h" = yes; then
  		#
  		# Pre-SunOS 4.x non-STREAMS NIT.
  		#
  		V_PCAP=nit
  	elif test "$ac_cv_header_net_raw_h" = yes; then
  		#
  		# IRIX snoop.
  		#
  		V_PCAP=snoop
  	elif test "$ac_cv_header_sys_dlpi_h" = yes; then
  		#
  		# DLPI on pre-Solaris 11 SunOS 5, HP-UX, possibly others.
  		#
  		V_PCAP=dlpi
  	else
  		#
  		# Nothing we support.
  		#
  		V_PCAP=null
  		AC_MSG_WARN(cannot determine packet capture interface)
  		AC_MSG_WARN((see the INSTALL doc for more info))
  	fi
  fi
  AC_MSG_CHECKING(packet capture type)
  AC_MSG_RESULT($V_PCAP)
  AC_SUBST(VALGRINDTEST_SRC)
  
  #
  # Do capture-mechanism-dependent tests.
  #
  case "$V_PCAP" in
  dlpi)
  	#
  	# Needed for common functions used by pcap-[dlpi,libdlpi].c
  	#
   	SSRC="dlpisubs.c"
  
  	#
  	# Checks for some header files.
  	#
  	AC_CHECK_HEADERS(sys/bufmod.h sys/dlpi_ext.h)
  
  	#
  	# Checks to see if Solaris has the public libdlpi(3LIB) library.
  	# Note: The existence of /usr/include/libdlpi.h does not mean it is the
  	# public libdlpi(3LIB) version. Before libdlpi was made public, a
  	# private version also existed, which did not have the same APIs.
  	# Due to a gcc bug, the default search path for 32-bit libraries does
  	# not include /lib, we add it explicitly here.
  	# [http://bugs.opensolaris.org/view_bug.do?bug_id=6619485].
  	# Also, due to the bug above applications that link to libpcap with
  	# libdlpi will have to add "-L/lib" option to "configure".
  	#
  	saved_ldflags=$LDFLAGS
  	LDFLAGS="$LIBS -L/lib"
  	AC_CHECK_LIB(dlpi, dlpi_walk,
  		[
  			LIBS="-ldlpi $LIBS"
  			V_PCAP=libdlpi
  			AC_DEFINE(HAVE_LIBDLPI,1,[if libdlpi exists])
  		],
  		V_PCAP=dlpi)
  	LDFLAGS=$saved_ldflags
  
  	#
  	# Checks whether <sys/dlpi.h> is usable, to catch weird SCO
  	# versions of DLPI.
  	#
  	AC_MSG_CHECKING(whether <sys/dlpi.h> is usable)
  	AC_CACHE_VAL(ac_cv_sys_dlpi_usable,
  		AC_TRY_COMPILE(
  		    [
  			#include <sys/types.h>
  			#include <sys/time.h>
  			#include <sys/dlpi.h>
  		    ],
  		    [int i = DL_PROMISC_PHYS;],
  		    ac_cv_sys_dlpi_usable=yes,
  		    ac_cv_sys_dlpi_usable=no))
  	AC_MSG_RESULT($ac_cv_sys_dlpi_usable)
  	if test $ac_cv_sys_dlpi_usable = no ; then
  		AC_MSG_ERROR(<sys/dlpi.h> is not usable on this system; it probably has a non-standard DLPI)
  	fi
  
  	#
  	# Check to see if Solaris has the dl_passive_req_t struct defined
  	# in <sys/dlpi.h>.
  	# This check is for DLPI support for passive modes.
  	# See dlpi(7P) for more details.
  	#
  	AC_CHECK_TYPES(dl_passive_req_t,,,
  	    [
  		#include <sys/types.h>
  		#include <sys/dlpi.h>
  	    ])
  	;;
  
  linux)
  	#
  	# Do we have the wireless extensions?
  	#
  	AC_CHECK_HEADERS(linux/wireless.h, [], [],
  	[
  #include <sys/socket.h>
  #include <linux/if.h>
  #include <linux/types.h>
  	])
  
  	#
  	# Do we have libnl?
  	#
  	AC_ARG_WITH(libnl,
  	AC_HELP_STRING([--without-libnl],[disable libnl support @<:@default=yes, on Linux, if present@:>@]),
  		with_libnl=$withval,with_libnl=if_available)
  
  	if test x$with_libnl != xno ; then
  		have_any_nl="no"
  
                  incdir=-I/usr/include/libnl3
                  libnldir=
                  case "$with_libnl" in
  
                  yes|if_available)
                    ;;
  
                  *)
                    if test -d $withval; then
                      libnldir=-L${withval}/lib/.libs
                      incdir=-I${withval}/include
                    fi
                    ;;
                  esac
  
  		#
  		# Try libnl 3.x first.
  		#
  		AC_CHECK_LIB(nl-3, nl_socket_alloc,
  		[
  			#
  			# Yes, we have libnl 3.x.
  			#
  			LIBS="${libnldir} -lnl-genl-3 -lnl-3 $LIBS"
  			AC_DEFINE(HAVE_LIBNL,1,[if libnl exists])
  			AC_DEFINE(HAVE_LIBNL_3_x,1,[if libnl exists and is version 3.x])
  			AC_DEFINE(HAVE_LIBNL_NLE,1,[libnl has NLE_FAILURE])
  			AC_DEFINE(HAVE_LIBNL_SOCKETS,1,[libnl has new-style socket api])
  			V_INCLS="$V_INCLS ${incdir}"
  			have_any_nl="yes"
  		],[], ${incdir} ${libnldir} -lnl-genl-3 -lnl-3 )
  
  		if test x$have_any_nl = xno ; then
  			#
  			# Try libnl 2.x
  			#
  			AC_CHECK_LIB(nl, nl_socket_alloc,
  			[
  				#
  				# Yes, we have libnl 2.x.
  				#
  				LIBS="${libnldir} -lnl-genl -lnl $LIBS"
  				AC_DEFINE(HAVE_LIBNL,1,[if libnl exists])
  				AC_DEFINE(HAVE_LIBNL_2_x,1,[if libnl exists and is version 2.x])
  				AC_DEFINE(HAVE_LIBNL_NLE,1,[libnl has NLE_FAILURE])
  				AC_DEFINE(HAVE_LIBNL_SOCKETS,1,[libnl has new-style socket api])
  				have_any_nl="yes"
  			])
  		fi
  
  		if test x$have_any_nl = xno ; then
  			#
  			# No, we don't; do we have libnl 1.x?
  			#
  			AC_CHECK_LIB(nl, nl_handle_alloc,
  			[
  				#
  				# Yes.
  				#
  				LIBS="${libnldir} -lnl $LIBS"
  				AC_DEFINE(HAVE_LIBNL,1,[if libnl exists])
  				have_any_nl="yes"
  			])
  		fi
  
  		if test x$have_any_nl = xno ; then
  			#
  			# No, we don't have libnl at all.
  			#
  			if test x$with_libnl = xyes ; then
  				AC_MSG_ERROR([libnl support requested but libnl not found])
  			fi
  		fi
  	fi
  
  	AC_CHECK_HEADERS(linux/ethtool.h,,,
  	    [
  AC_INCLUDES_DEFAULT
  #include <linux/types.h>
  	    ])
  
  	#
  	# Check to see if struct tpacket_stats is defined in
  	# <linux/if_packet.h>.  If so, then pcap-linux.c can use this
  	# to report proper statistics.
  	#
  	# -Scott Barron
  	#
  	AC_CHECK_TYPES(struct tpacket_stats,,,
  	    [
  		#include <linux/if_packet.h>
  	    ])
  
  	#
  	# Check to see if the tpacket_auxdata struct has a tp_vlan_tci member.
  	#
  	# NOTE: any failure means we conclude that it doesn't have that
  	# member, so if we don't have tpacket_auxdata, we conclude it
  	# doesn't have that member (which is OK, as either we won't be
  	# using code that would use that member, or we wouldn't compile
  	# in any case).
  	AC_CHECK_MEMBERS([struct tpacket_auxdata.tp_vlan_tci],,,
  	    [
  		#include <sys/types.h>
  		#include <linux/if_packet.h>
  	    ])
  	;;
  
  bpf)
  	#
  	# Check whether we have the *BSD-style ioctls.
  	#
  	AC_CHECK_HEADERS(net/if_media.h)
  
  	#
  	# Check whether we have struct BPF_TIMEVAL.
  	#
  	AC_CHECK_TYPES(struct BPF_TIMEVAL,,,
  	    [
  		#include <sys/types.h>
  		#include <sys/ioctl.h>
  		#ifdef HAVE_SYS_IOCCOM_H
  		#include <sys/ioccom.h>
  		#endif
  		#include <net/bpf.h>
  	    ])
  	;;
  
  dag)
  	#
  	# --with-pcap=dag is the only way to get here, and it means
  	# "DAG support but nothing else"
  	#
  	V_DEFS="$V_DEFS -DDAG_ONLY"
  	xxx_only=yes
  	;;
  
  septel)
  	#
  	# --with-pcap=septel is the only way to get here, and it means
  	# "Septel support but nothing else"
  	#
  	V_DEFS="$V_DEFS -DSEPTEL_ONLY"
  	xxx_only=yes
  	;;
  
  snf)
  	#
  	# --with-pcap=snf is the only way to get here, and it means
  	# "SNF support but nothing else"
  	#
  	V_DEFS="$V_DEFS -DSNF_ONLY"
  	xxx_only=yes
  	;;
  
  null)
  	;;
  
  *)
  	AC_MSG_ERROR($V_PCAP is not a valid pcap type)
  	;;
  esac
  
  dnl
  dnl Now figure out how we get a list of interfaces and addresses,
  dnl if we support capturing.  Don't bother if we don't support
  dnl capturing.
  dnl
  if test "$V_PCAP" != null
  then
  	AC_CHECK_FUNC(getifaddrs,[
  		#
  		# We have "getifaddrs()"; make sure we have <ifaddrs.h>
  		# as well, just in case some platform is really weird.
  		#
  		AC_CHECK_HEADER(ifaddrs.h,[
  		    #
  		    # We have the header, so we use "getifaddrs()" to
  		    # get the list of interfaces.
  		    #
  		    V_FINDALLDEVS=fad-getad.c
  		],[
  		    #
  		    # We don't have the header - give up.
  		    # XXX - we could also fall back on some other
  		    # mechanism, but, for now, this'll catch this
  		    # problem so that we can at least try to figure
  		    # out something to do on systems with "getifaddrs()"
  		    # but without "ifaddrs.h", if there is something
  		    # we can do on those systems.
  		    #
  		    AC_MSG_ERROR([Your system has getifaddrs() but doesn't have a usable <ifaddrs.h>.])
  		])
  	],[
  		#
  		# Well, we don't have "getifaddrs()", at least not with the
  		# libraries with which we've decided we need to link
  		# libpcap with, so we have to use some other mechanism.
  		#
  		# Note that this may happen on Solaris, which has
  		# getifaddrs(), but in -lsocket, not in -lxnet, so we
  		# won't find it if we link with -lxnet, which we want
  		# to do for other reasons.
  		#
  		# For now, we use either the SIOCGIFCONF ioctl or the
  		# SIOCGLIFCONF ioctl, preferring the latter if we have
  		# it; the latter is a Solarisism that first appeared
  		# in Solaris 8.  (Solaris's getifaddrs() appears to
  		# be built atop SIOCGLIFCONF; using it directly
  		# avoids a not-all-that-useful middleman.)
  		#
  		AC_MSG_CHECKING(whether we have SIOCGLIFCONF)
  		AC_CACHE_VAL(ac_cv_lbl_have_siocglifconf,
  		    AC_TRY_COMPILE(
  			[#include <sys/param.h>
  			#include <sys/file.h>
  			#include <sys/ioctl.h>
  			#include <sys/socket.h>
  			#include <sys/sockio.h>],
  			[ioctl(0, SIOCGLIFCONF, (char *)0);],
  			ac_cv_lbl_have_siocglifconf=yes,
  			ac_cv_lbl_have_siocglifconf=no))
  		AC_MSG_RESULT($ac_cv_lbl_have_siocglifconf)
  		if test $ac_cv_lbl_have_siocglifconf = yes ; then
  			V_FINDALLDEVS=fad-glifc.c
  		else
  			V_FINDALLDEVS=fad-gifc.c
  		fi
  	])
  fi
  ])
  
  dnl check for hardware timestamp support
  case "$host_os" in
  linux*)
  	AC_CHECK_HEADERS([linux/net_tstamp.h])
  	;;
  *)
  	AC_MSG_NOTICE(no hardware timestamp support implemented for $host_os)
  	;;
  esac
  
  AC_ARG_ENABLE([packet-ring],
  [AC_HELP_STRING([--enable-packet-ring],[enable packet ring support on Linux @<:@default=yes@:>@])],
  ,enable_packet_ring=yes)
  
  if test "x$enable_packet_ring" != "xno" ; then
  	AC_DEFINE(PCAP_SUPPORT_PACKET_RING, 1, [use packet ring capture support on Linux if available])
  	AC_SUBST(PCAP_SUPPORT_PACKET_RING)
  fi
  
  #
  # Check for socklen_t.
  #
  AC_CHECK_TYPES(socklen_t,,,
      [
  	#include <sys/types.h>
  	#include <sys/socket.h>
      ])
  
  AC_ARG_ENABLE(ipv6,
  AC_HELP_STRING([--enable-ipv6],[build IPv6-capable version @<:@default=yes@:>@]),
      [],
      [enable_ipv6=yes])
  if test "$enable_ipv6" != "no"; then
  	#
  	# We've already made sure we have getaddrinfo above in
  	# AC_LBL_LIBRARY_NET.
  	#
  	AC_DEFINE(INET6,1,[IPv6])
  fi
  
  # Check for Endace DAG card support.
  AC_ARG_WITH([dag],
  AC_HELP_STRING([--with-dag@<:@=DIR@:>@],[include Endace DAG support (located in directory DIR, if supplied).  @<:@default=yes, if present@:>@]),
  [
  	if test "$withval" = no
  	then
  		# User doesn't want DAG support.
  		want_dag=no
  	elif test "$withval" = yes
  	then
  		# User wants DAG support but hasn't specified a directory.
  		want_dag=yes
  	else
  		# User wants DAG support and has specified a directory, so use the provided value.
  		want_dag=yes
  		dag_root=$withval
  	fi
  ],[
  	if test "$V_PCAP" = dag; then
  		# User requested DAG-only libpcap, so we'd better have
  		# the DAG API.
  		want_dag=yes
  	elif test "xxx_only" = yes; then
  		# User requested something-else-only pcap, so they don't
  		# want DAG support.
  		want_dag=no
  	else
  		#
  		# Use DAG API if present, otherwise don't
  		#
  		want_dag=ifpresent
  	fi
  ])
  
  AC_ARG_WITH([dag-includes],
  AC_HELP_STRING([--with-dag-includes=IDIR],[Endace DAG include directory, if not DIR/include]),
  [
  	# User wants DAG support and has specified a header directory, so use the provided value.
  	want_dag=yes
  	dag_include_dir=$withval
  ],[])
  
  AC_ARG_WITH([dag-libraries],
  AC_HELP_STRING([--with-dag-libraries=LDIR],[Endace DAG library directory, if not DIR/lib]),
  [
  	# User wants DAG support and has specified a library directory, so use the provided value.
  	want_dag=yes
  	dag_lib_dir=$withval
  ],[])
  
  if test "$want_dag" != no; then
  
  	# If necessary, set default paths for DAG API headers and libraries.
  	if test -z "$dag_root"; then
  		dag_root=/usr/local
  	fi
  
  	if test -z "$dag_include_dir"; then
  		dag_include_dir="$dag_root/include"
  	fi
  
  	if test -z "$dag_lib_dir"; then
  		dag_lib_dir="$dag_root/lib"
  	fi
  
  	V_INCLS="$V_INCLS -I$dag_include_dir"
  
  	AC_CHECK_HEADERS([dagapi.h])
  
  	if test "$ac_cv_header_dagapi_h" = yes; then
  
  		if test $V_PCAP != dag ; then
  			 SSRC="$SSRC pcap-dag.c"
  		fi
  
  		# Check for various DAG API functions.
  		# Don't need to save and restore LIBS to prevent -ldag being
  		# included if there's a found-action (arg 3).
  		saved_ldflags=$LDFLAGS
  		LDFLAGS="-L$dag_lib_dir"
  		AC_CHECK_LIB([dag], [dag_attach_stream],
  		    [],
  		    [AC_MSG_ERROR(DAG library lacks streams support)])
  		AC_CHECK_LIB([dag], [dag_attach_stream64], [dag_large_streams="1"], [dag_large_streams="0"])
  		AC_CHECK_LIB([dag],[dag_get_erf_types], [
  			AC_DEFINE(HAVE_DAG_GET_ERF_TYPES, 1, [define if you have dag_get_erf_types()])])
  		AC_CHECK_LIB([dag],[dag_get_stream_erf_types], [
  			AC_DEFINE(HAVE_DAG_GET_STREAM_ERF_TYPES, 1, [define if you have dag_get_stream_erf_types()])])
  
  		LDFLAGS=$saved_ldflags
  
  		#
  		# We assume that if we have libdag we have libdagconf,
  		# as they're installed at the same time from the same
  		# package.
  		#
  		LIBS="$LIBS -ldag -ldagconf"
  		LDFLAGS="$LDFLAGS -L$dag_lib_dir"
  
  		if test "$dag_large_streams" = 1; then
  			AC_DEFINE(HAVE_DAG_LARGE_STREAMS_API, 1, [define if you have large streams capable DAG API])
  			AC_CHECK_LIB([vdag],[vdag_set_device_info], [ac_dag_have_vdag="1"], [ac_dag_have_vdag="0"])
  			if test "$ac_dag_have_vdag" = 1; then
  				AC_DEFINE(HAVE_DAG_VDAG, 1, [define if you have vdag_set_device_info()])
  				if test "$ac_lbl_have_pthreads" != "found"; then
  					AC_MSG_ERROR([DAG requires pthreads, but we didn't find them])
  				fi
  				LIBS="$LIBS $PTHREAD_LIBS"
  			fi
  		fi
  
  		AC_DEFINE(HAVE_DAG_API, 1, [define if you have the DAG API])
  	else
  
  		if test "$V_PCAP" = dag; then
  			# User requested "dag" capture type but we couldn't
  			# find the DAG API support.
  			AC_MSG_ERROR([DAG support requested with --with-pcap=dag, but the DAG headers weren't found at $dag_include_dir: make sure the DAG support is installed, specify a different path or paths if necessary, or don't request DAG support])
  		fi
  
  		if test "$want_dag" = yes; then
  	        	# User wanted DAG support but we couldn't find it.
  			AC_MSG_ERROR([DAG support requested with --with-dag, but the DAG headers weren't found at $dag_include_dir: make sure the DAG support is installed, specify a different path or paths if necessary, or don't request DAG support])
  		fi
  	fi
  fi
  
  AC_ARG_WITH(septel,
  AC_HELP_STRING([--with-septel@<:@=DIR@:>@],[include Septel support (located in directory DIR, if supplied).  @<:@default=yes, if present@:>@]),
  [
  	if test "$withval" = no
  	then
  		want_septel=no
  	elif test "$withval" = yes
  	then
  		want_septel=yes
  		septel_root=
  	else
  		want_septel=yes
  		septel_root=$withval
  	fi
  ],[
  	if test "$V_PCAP" = septel; then
  		# User requested Septel-only libpcap, so we'd better have
  		# the Septel API.
  		want_septel=yes
  	elif test "xxx_only" = yes; then
  		# User requested something-else-only pcap, so they don't
  		# want Septel support.
  		want_septel=no
  	else
  		#
  		# Use Septel API if present, otherwise don't
  		#
  		want_septel=ifpresent
  	fi
  ])
  
  ac_cv_lbl_septel_api=no
  if test "$with_septel" != no; then
  
  	AC_MSG_CHECKING([whether we have Septel API headers])
  
  	# If necessary, set default paths for Septel API headers and libraries.
  	if test -z "$septel_root"; then
  		septel_root=$srcdir/../septel
  	fi
  
  	septel_tools_dir="$septel_root"
  	septel_include_dir="$septel_root/INC"
  
  	if test -r "$septel_include_dir/msg.h"; then
  		ac_cv_lbl_septel_api=yes
  	fi
  
  	if test "$ac_cv_lbl_septel_api" = yes; then
  		AC_MSG_RESULT([yes ($septel_include_dir)])
  
  		V_INCLS="$V_INCLS -I$septel_include_dir"
  		ADDLOBJS="$ADDLOBJS $septel_tools_dir/asciibin.o $septel_tools_dir/bit2byte.o $septel_tools_dir/confirm.o $septel_tools_dir/fmtmsg.o $septel_tools_dir/gct_unix.o $septel_tools_dir/hqueue.o $septel_tools_dir/ident.o $septel_tools_dir/mem.o $septel_tools_dir/pack.o $septel_tools_dir/parse.o $septel_tools_dir/pool.o $septel_tools_dir/sdlsig.o $septel_tools_dir/strtonum.o $septel_tools_dir/timer.o $septel_tools_dir/trace.o"
  		ADDLARCHIVEOBJS="$ADDLARCHIVEOBJS $septel_tools_dir/asciibin.o $septel_tools_dir/bit2byte.o $septel_tools_dir/confirm.o $septel_tools_dir/fmtmsg.o $septel_tools_dir/gct_unix.o $septel_tools_dir/hqueue.o $septel_tools_dir/ident.o $septel_tools_dir/mem.o $septel_tools_dir/pack.o $septel_tools_dir/parse.o $septel_tools_dir/pool.o $septel_tools_dir/sdlsig.o $septel_tools_dir/strtonum.o $septel_tools_dir/timer.o $septel_tools_dir/trace.o"
  
  		if test "$V_PCAP" != septel ; then
  			 SSRC="$SSRC pcap-septel.c"
  		fi
  
  		AC_DEFINE(HAVE_SEPTEL_API, 1, [define if you have the Septel API])
  	else
  		AC_MSG_RESULT(no)
  
  		if test "$V_PCAP" = septel; then
  			# User requested "septel" capture type but
  			# we couldn't find the Septel API support.
  			AC_MSG_ERROR([Septel support requested with --with-pcap=septel, but the Septel headers weren't found at $septel_include_dir: make sure the Septel support is installed, specify a different path or paths if necessary, or don't request Septel support])
  		fi
  
  		if test "$want_septel" = yes; then
  	        	# User wanted Septel support but we couldn't find it.
  			AC_MSG_ERROR([Septel support requested with --with-septel, but the Septel headers weren't found at $septel_include_dir: make sure the Septel support is installed, specify a different path or paths if necessary, or don't request Septel support])
  		fi
  	fi
  fi
  
  # Check for Myricom SNF support.
  AC_ARG_WITH([snf],
  AC_HELP_STRING([--with-snf@<:@=DIR@:>@],[include Myricom SNF support (located in directory DIR, if supplied).  @<:@default=yes, if present@:>@]),
  [
  	if test "$withval" = no
  	then
  		# User explicitly doesn't want SNF
  		want_snf=no
  	elif test "$withval" = yes
  	then
  		# User wants SNF support but hasn't specified a directory.
  		want_snf=yes
  	else
  		# User wants SNF support with a specified directory.
  		want_snf=yes
  		snf_root=$withval
  	fi
  ],[
  	if test "$V_PCAP" = snf; then
  		# User requested Sniffer-only libpcap, so we'd better have
  		# the Sniffer API.
  		want_snf=yes
  	elif test "xxx_only" = yes; then
  		# User requested something-else-only pcap, so they don't
  		# want SNF support.
  		want_snf=no
  	else
  		#
  		# Use Sniffer API if present, otherwise don't
  		#
  		want_snf=ifpresent
  	fi
  ])
  
  AC_ARG_WITH([snf-includes],
  AC_HELP_STRING([--with-snf-includes=IDIR],[Myricom SNF include directory, if not DIR/include]),
  [
  	# User wants SNF with specific header directory
  	want_snf=yes
  	snf_include_dir=$withval
  ],[])
  
  AC_ARG_WITH([snf-libraries],
  AC_HELP_STRING([--with-snf-libraries=LDIR],[Myricom SNF library directory, if not DIR/lib]),
  [
  	# User wants SNF with specific lib directory
  	want_snf=yes
  	snf_lib_dir=$withval
  ],[])
  
  ac_cv_lbl_snf_api=no
  if test "$with_snf" != no; then
  
  	AC_MSG_CHECKING(whether we have Myricom Sniffer API)
  
  	# If necessary, set default paths for Sniffer headers and libraries.
  	if test -z "$snf_root"; then
  		snf_root=/opt/snf
  	fi
  
  	if test -z "$snf_include_dir"; then
  		snf_include_dir="$snf_root/include"
  	fi
  
  	if test -z "$snf_lib_dir"; then
  		snf_lib_dir="$snf_root/lib"
  	fi
  
  	if test -f "$snf_include_dir/snf.h"; then
  		# We found a header; make sure we can link with the library
  		saved_ldflags=$LDFLAGS
  		LDFLAGS="$LDFLAGS -L$snf_lib_dir"
  		AC_CHECK_LIB([snf], [snf_init], [ac_cv_lbl_snf_api="yes"])
  		LDFLAGS="$saved_ldflags"
  		if test "$ac_cv_lbl_snf_api" = no; then
  			AC_MSG_ERROR(SNF API cannot correctly be linked; check config.log)
  		fi
  	fi
  
  	if test "$ac_cv_lbl_snf_api" = yes; then
  		AC_MSG_RESULT([yes ($snf_root)])
  
  		V_INCLS="$V_INCLS -I$snf_include_dir"
  		LIBS="$LIBS -lsnf"
  		LDFLAGS="$LDFLAGS -L$snf_lib_dir"
  
  		if test "$V_PCAP" != snf ; then
  			SSRC="$SSRC pcap-snf.c"
  		fi
  
  		AC_DEFINE(HAVE_SNF_API, 1, [define if you have the Myricom SNF API])
  	else
  		AC_MSG_RESULT(no)
  
  		if test "$want_snf" = yes; then
  			# User requested "snf" capture type but
  			# we couldn't find the Sniffer API support.
  			AC_MSG_ERROR([Myricom Sniffer support requested with --with-pcap=snf, but the Sniffer headers weren't found at $snf_include_dir: make sure the Sniffer support is installed, specify a different path or paths if necessary, or don't request Sniffer support])
  		fi
  
  		if test "$want_snf" = yes; then
  			AC_MSG_ERROR([Myricom Sniffer support requested with --with-snf, but the Sniffer headers weren't found at $snf_include_dir: make sure the Sniffer support is installed, specify a different path or paths if necessary, or don't request Sniffer support])
  		fi
  	fi
  fi
  
  # Check for Riverbed TurboCap support.
  AC_ARG_WITH([turbocap],
  AC_HELP_STRING([--with-turbocap@<:@=DIR@:>@],[include Riverbed TurboCap support (located in directory DIR, if supplied).  @<:@default=yes, if present@:>@]),
  [
  	if test "$withval" = no
  	then
  		# User explicitly doesn't want TurboCap
  		want_turbocap=no
  	elif test "$withval" = yes
  	then
  		# User wants TurboCap support but hasn't specified a directory.
  		want_turbocap=yes
  	else
  		# User wants TurboCap support with a specified directory.
  		want_turbocap=yes
  		turbocap_root=$withval
  	fi
  ],[
  	if test "xxx_only" = yes; then
  		# User requested something-else-only pcap, so they don't
  		# want TurboCap support.
  		want_turbocap=no
  	else
  		#
  		# Use TurboCap API if present, otherwise don't
  		#
  		want_turbocap=ifpresent
  	fi
  ])
  
  ac_cv_lbl_turbocap_api=no
  if test "$want_turbocap" != no; then
  
  	AC_MSG_CHECKING(whether TurboCap is supported)
  
  	save_CFLAGS="$CFLAGS"
  	save_LIBS="$LIBS"
  	if test ! -z "$turbocap_root"; then
  		TURBOCAP_CFLAGS="-I$turbocap_root/include"
  		TURBOCAP_LIBS="-L$turbocap_root/lib"
  		CFLAGS="$CFLAGS $TURBOCAP_CFLAGS"
  	fi
  
  	AC_TRY_COMPILE(
  	[
  	    #include <TcApi.h>
  	],
  	[
  	    TC_INSTANCE a; TC_PORT b; TC_BOARD c;
  	    TC_INSTANCE i;
  	    (void)TcInstanceCreateByName("foo", &i);
  	],
  	ac_cv_lbl_turbocap_api=yes)
  
  	CFLAGS="$save_CFLAGS"
  	if test $ac_cv_lbl_turbocap_api = yes; then
  		AC_MSG_RESULT(yes)
  
  		SSRC="$SSRC pcap-tc.c"
  		V_INCLS="$V_INCLS $TURBOCAP_CFLAGS"
  		LIBS="$LIBS $TURBOCAP_LIBS -lTcApi -lpthread -lstdc++"
  
  		AC_DEFINE(HAVE_TC_API, 1, [define if you have the TurboCap API])
  	else
  		AC_MSG_RESULT(no)
  
  		if test "$want_turbocap" = yes; then
  	        	# User wanted Turbo support but we couldn't find it.
  			AC_MSG_ERROR([TurboCap support requested with --with-turbocap, but the TurboCap headers weren't found: make sure the TurboCap support is installed or don't request TurboCap support])
  		fi
  	fi
  fi
  
  dnl
  dnl Allow the user to enable remote capture.
  dnl It's off by default, as that increases the attack surface of
  dnl libpcap, exposing it to malicious servers.
  dnl
  AC_MSG_CHECKING([whether to enable remote packet capture])
  AC_ARG_ENABLE(remote,
  [  --enable-remote         enable remote packet capture @<:@default=no@:>@
    --disable-remote        disable remote packet capture],,
     enableval=no)
  case "$enableval" in
  yes)	AC_MSG_RESULT(yes)
  	AC_WARN([Remote packet capture may expose libpcap-based applications])
  	AC_WARN([to attacks by malicious remote capture servers!])
  	#
  	# rpcapd requires pthreads on UN*X.
  	#
  	if test "$ac_lbl_have_pthreads" != "found"; then
  		AC_MSG_ERROR([rpcapd requires pthreads, but we didn't find them])
  	fi
  	#
  	# It also requires crypt().
  	# Do we have it in the system libraries?
  	#
  	AC_CHECK_FUNC(crypt,,
  	    [
  		#
  		# No.  Do we have it in -lcrypt?
  		#
  		AC_CHECK_LIB(crypt, crypt,
  		    [
  			#
  			# Yes; add -lcrypt to the libraries for rpcapd.
  			#
  			RPCAPD_LIBS="$RPCAPD_LIBS -lcrypt"
  		    ],
  		    [
  			AC_MSG_ERROR([rpcapd requires crypt(), but we didn't find it])
  		    ])
  	    ])
  
  	#
  	# OK, we have crypt().  Do we have getspnam()?
  	#
  	AC_CHECK_FUNCS(getspnam)
  
  	#
  	# Check for various members of struct msghdr.
  	#
  	AC_CHECK_MEMBERS([struct msghdr.msg_control],,,
  	    [
  		#include "ftmacros.h"
  		#include <sys/socket.h>
  	    ])
  	AC_CHECK_MEMBERS([struct msghdr.msg_flags],,,
  	    [
  		#include "ftmacros.h"
  		#include <sys/socket.h>
  	    ])
  
  	AC_DEFINE(ENABLE_REMOTE,,
  	    [Define to 1 if remote packet capture is to be supported])
  	SSRC="$SSRC pcap-new.c pcap-rpcap.c rpcap-protocol.c sockutils.c"
  	BUILD_RPCAPD=build-rpcapd
  	INSTALL_RPCAPD=install-rpcapd
  	;;
  *)	AC_MSG_RESULT(no)
  	;;
  esac
  
  AC_MSG_CHECKING(whether to build optimizer debugging code)
  AC_ARG_ENABLE(optimizer-dbg,
  AC_HELP_STRING([--enable-optimizer-dbg],[build optimizer debugging code]))
  if test "$enable_optimizer_dbg" = "yes"; then
  	AC_DEFINE(BDEBUG,1,[Enable optimizer debugging])
  fi
  AC_MSG_RESULT(${enable_optimizer_dbg-no})
  
  AC_MSG_CHECKING(whether to build parser debugging code)
  AC_ARG_ENABLE(yydebug,
  AC_HELP_STRING([--enable-yydebug],[build parser debugging code]))
  if test "$enable_yydebug" = "yes"; then
  	AC_DEFINE(YYDEBUG,1,[Enable parser debugging])
  fi
  AC_MSG_RESULT(${enable_yydebug-no})
  
  #
  # Look for {f}lex.
  #
  AC_PROG_LEX
  if test "$LEX" = ":"; then
  	AC_MSG_ERROR([Neither flex nor lex was found.])
  fi
  
  #
  # Make sure {f}lex supports the -P, --header-file, and --nounput flags
  # and supports processing our scanner.l.
  #
  AC_CACHE_CHECK([for capable lex], tcpdump_cv_capable_lex,
  	if $LEX -P pcap_ --header-file=/dev/null --nounput -t $srcdir/scanner.l > /dev/null 2>&1; then
  	    tcpdump_cv_capable_lex=yes
  	else
  	    tcpdump_cv_capable_lex=insufficient
  	fi)
  if test $tcpdump_cv_capable_lex = insufficient ; then
  	AC_MSG_ERROR([$LEX is insufficient to compile libpcap.
   libpcap requires Flex 2.5.31 or later, or a compatible version of lex.])
  fi
  
  #
  # Look for yacc/bison/byacc.
  #
  AC_PROG_YACC
  
  #
  # Make sure it supports the -p flag and supports processing our
  # grammar.y.
  #
  AC_CACHE_CHECK([for capable yacc/bison], tcpdump_cv_capable_yacc,
  	if $YACC -p pcap_ -o /dev/null $srcdir/grammar.y >/dev/null 2>&1; then
  	    tcpdump_cv_capable_yacc=yes
  	else
  	    tcpdump_cv_capable_yacc=insufficient
  	fi)
  if test $tcpdump_cv_capable_yacc = insufficient ; then
  	AC_MSG_ERROR([$YACC is insufficient to compile libpcap.
   libpcap requires Bison, a newer version of Berkeley YACC with support
   for reentrant parsers, or another YACC compatible with them.])
  fi
  
  #
  # Do various checks for various OSes and versions of those OSes.
  #
  # Assume, by default, no support for shared libraries and V7/BSD
  # convention for man pages (file formats in section 5, miscellaneous
  # info in section 7, administrative commands and daemons in section 8).
  # Individual cases can override this.
  #
  DYEXT="none"
  MAN_FILE_FORMATS=5
  MAN_MISC_INFO=7
  MAN_ADMIN_COMMANDS=8
  case "$host_os" in
  
  aix*)
  	dnl Workaround to enable certain features
  	AC_DEFINE(_SUN,1,[define on AIX to get certain functions])
  
  	#
  	# AIX makes it fun to build shared and static libraries,
  	# because they're *both* ".a" archive libraries.  We
  	# build the static library for the benefit of the traditional
  	# scheme of building libpcap and tcpdump in subdirectories of
  	# the same directory, with tcpdump statically linked with the
  	# libpcap in question, but we also build a shared library as
  	# "libpcap.shareda" and install *it*, rather than the static
  	# library, as "libpcap.a".
  	#
  	DYEXT="shareda"
  
  	case "$V_PCAP" in
  
  	dlpi)
  		#
  		# If we're using DLPI, applications will need to
  		# use /lib/pse.exp if present, as we use the
  		# STREAMS routines.
  		#
  		pseexe="/lib/pse.exp"
  		AC_MSG_CHECKING(for $pseexe)
  		if test -f $pseexe ; then
  			AC_MSG_RESULT(yes)
  			LIBS="-I:$pseexe"
  		fi
  		;;
  
  	bpf)
  		#
  		# If we're using BPF, we need "-lodm" and "-lcfg", as
  		# we use them to load the BPF module.
  		#
  		LIBS="-lodm -lcfg"
  		;;
  	esac
  	;;
  
  darwin*)
  	DYEXT="dylib"
  	V_CCOPT="$V_CCOPT -fno-common"
  	AC_ARG_ENABLE(universal,
  	AC_HELP_STRING([--disable-universal],[don't build universal on macOS]))
  	if test "$enable_universal" != "no"; then
  		case "$host_os" in
  
  		darwin[0-7].*)
  			#
  			# Pre-Tiger.  Build only for 32-bit PowerPC; no
  			# need for any special compiler or linker flags.
  			#
  			;;
  
  		darwin8.[0123]*)
  			#
  			# Tiger, prior to Intel support.  Build for 32-bit
  			# PowerPC and 64-bit PowerPC, with 32-bit PowerPC
  			# first.  (I'm guessing that's what Apple does.)
  			#
  			V_CCOPT="$V_CCOPT -arch ppc -arch ppc64"
  			LDFLAGS="$LDFLAGS -arch ppc -arch ppc64"
  			;;
  
  		darwin8.[456]*)
  			#
  			# Tiger, subsequent to Intel support but prior to
  			# x86-64 support.  Build for 32-bit PowerPC, 64-bit
  			# PowerPC, and x86, with 32-bit PowerPC first.
  			# (I'm guessing that's what Apple does.)
  			#
  			V_CCOPT="$V_CCOPT -arch ppc -arch ppc64 -arch i386"
  			LDFLAGS="$LDFLAGS -arch ppc -arch ppc64 -arch i386"
  			;;
  
  		darwin8.*)
  			#
  			# All other Tiger, so subsequent to x86-64
  			# support. Build for 32-bit PowerPC, 64-bit
  			# PowerPC, x86, and x86-64, and with 32-bit PowerPC
  			# first.  (I'm guessing that's what Apple does.)
  			#
  			V_CCOPT="$V_CCOPT -arch ppc -arch ppc64 -arch i386 -arch x86_64"
  			LDFLAGS="$LDFLAGS -arch ppc -arch ppc64 -arch i386 -arch x86_64"
  			;;
  
  		darwin9.*)
  			#
  			# Leopard.  Build for 32-bit PowerPC, 64-bit
  			# PowerPC, x86, and x86-64, with 32-bit PowerPC
  			# first.  (That's what Apple does.)
  			#
  			V_CCOPT="$V_CCOPT -arch ppc -arch ppc64 -arch i386 -arch x86_64"
  			LDFLAGS="$LDFLAGS -arch ppc -arch ppc64 -arch i386 -arch x86_64"
  			;;
  
  		darwin10.*)
  			#
  			# Snow Leopard.  Build for x86-64, x86, and
  			# 32-bit PowerPC, with x86-64 first.  (That's
  			# what Apple does, even though Snow Leopard
  			# doesn't run on PPC, so PPC libpcap runs under
  			# Rosetta, and Rosetta doesn't support BPF
  			# ioctls, so PPC programs can't do live
  			# captures.)
  			#
  			V_CCOPT="$V_CCOPT -arch x86_64 -arch i386 -arch ppc"
  			LDFLAGS="$LDFLAGS -arch x86_64 -arch i386 -arch ppc"
  			;;
  
  		darwin*)
  			#
  			# Post-Snow Leopard.  Build for x86-64 and
  			# x86, with x86-64 first.  (That's probably what
  			# Apple does, given that Rosetta is gone.)
  			# XXX - update if and when Apple drops support
  			# for 32-bit x86 code.
  			#
  			V_CCOPT="$V_CCOPT -arch x86_64 -arch i386"
  			LDFLAGS="$LDFLAGS -arch x86_64 -arch i386"
  			;;
  		esac
  	fi
  	;;
  
  hpux9*)
  	AC_DEFINE(HAVE_HPUX9,1,[on HP-UX 9.x])
  
  	#
  	# Use System V conventions for man pages.
  	#
  	MAN_ADMIN_COMMANDS=1m
  	MAN_FILE_FORMATS=4
  	MAN_MISC_INFO=5
  	;;
  
  hpux10.0*)
  
  	#
  	# Use System V conventions for man pages.
  	#
  	MAN_ADMIN_COMMANDS=1m
  	MAN_FILE_FORMATS=4
  	MAN_MISC_INFO=5
  	;;
  
  hpux10.1*)
  
  	#
  	# Use System V conventions for man pages.
  	#
  	MAN_ADMIN_COMMANDS=1m
  	MAN_FILE_FORMATS=4
  	MAN_MISC_INFO=5
  	;;
  
  hpux*)
  	dnl HPUX 10.20 and above is similar to HPUX 9, but
  	dnl not the same....
  	dnl
  	dnl XXX - DYEXT should be set to "sl" if this is building
  	dnl for 32-bit PA-RISC, but should be left as "so" for
  	dnl 64-bit PA-RISC or, I suspect, IA-64.
  	AC_DEFINE(HAVE_HPUX10_20_OR_LATER,1,[on HP-UX 10.20 or later])
  	if test "`uname -m`" = "ia64"; then
  		DYEXT="so"
  	else
  		DYEXT="sl"
  	fi
  
  	#
  	# "-b" builds a shared library; "+h" sets the soname.
  	#
  	SHLIB_OPT="-b"
  	SONAME_OPT="+h"
  
  	#
  	# Use System V conventions for man pages.
  	#
  	MAN_FILE_FORMATS=4
  	MAN_MISC_INFO=5
  	;;
  
  irix*)
  	#
  	# Use IRIX conventions for man pages; they're the same as the
  	# System V conventions, except that they use section 8 for
  	# administrative commands and daemons.
  	#
  	MAN_FILE_FORMATS=4
  	MAN_MISC_INFO=5
  	;;
  
  linux*|freebsd*|netbsd*|openbsd*|dragonfly*|kfreebsd*|gnu*)
  	DYEXT="so"
  
  	#
  	# Compiler assumed to be GCC; run-time linker may require a -R
  	# flag.
  	#
  	if test "$libdir" != "/usr/lib"; then
  		V_RFLAGS=-Wl,-R$libdir
  	fi
  	;;
  
  osf*)
  	DYEXT="so"
  
  	#
  	# DEC OSF/1, a/k/a Digial UNIX, a/k/a Tru64 UNIX.
  	# Use Tru64 UNIX conventions for man pages; they're the same as
  	# the System V conventions except that they use section 8 for
  	# administrative commands and daemons.
  	#
  	MAN_FILE_FORMATS=4
  	MAN_MISC_INFO=5
  	;;
  
  sinix*)
  	AC_MSG_CHECKING(if SINIX compiler defines sinix)
  	AC_CACHE_VAL(ac_cv_cc_sinix_defined,
  		AC_TRY_COMPILE(
  		    [],
  		    [int i = sinix;],
  		    ac_cv_cc_sinix_defined=yes,
  		    ac_cv_cc_sinix_defined=no))
  	    AC_MSG_RESULT($ac_cv_cc_sinix_defined)
  	    if test $ac_cv_cc_sinix_defined = no ; then
  		    AC_DEFINE(sinix,1,[on sinix])
  	    fi
  	;;
  
  solaris*)
  	AC_DEFINE(HAVE_SOLARIS,1,[On solaris])
  
  	DYEXT="so"
  
  	#
  	# Make sure errno is thread-safe, in case we're called in
  	# a multithreaded program.  We don't guarantee that two
  	# threads can use the *same* pcap_t safely, but the
  	# current version does guarantee that you can use different
  	# pcap_t's in different threads, and even that pcap_compile()
  	# is thread-safe (it wasn't thread-safe in some older versions).
  	#
  	V_CCOPT="$V_CCOPT -D_TS_ERRNO"
  
  	case "`uname -r`" in
  
  	5.12)
  		;;
  
  	*)
  		#
  		# Use System V conventions for man pages.
  		#
  		MAN_ADMIN_COMMANDS=1m
  		MAN_FILE_FORMATS=4
  		MAN_MISC_INFO=5
  	esac
  	;;
  esac
  
  AC_ARG_ENABLE(shared,
  AC_HELP_STRING([--enable-shared],[build shared libraries @<:@default=yes, if support available@:>@]))
  test "x$enable_shared" = "xno" && DYEXT="none"
  
  AC_PROG_RANLIB
  AC_CHECK_TOOL([AR], [ar])
  
  AC_PROG_LN_S
  AC_SUBST(LN_S)
  
  AC_LBL_DEVEL(V_CCOPT)
  
  #
  # Check to see if the sockaddr struct has the 4.4 BSD sa_len member.
  #
  AC_CHECK_MEMBERS([struct sockaddr.sa_len],,,
      [
  	#include <sys/types.h>
  	#include <sys/socket.h>
      ])
  
  #
  # Check to see if there's a sockaddr_storage structure.
  #
  AC_CHECK_TYPES(struct sockaddr_storage,,,
      [
  	#include <sys/types.h>
  	#include <sys/socket.h>
      ])
  
  #
  # Check to see if the dl_hp_ppa_info_t struct has the HP-UX 11.00
  # dl_module_id_1 member.
  #
  # NOTE: any failure means we conclude that it doesn't have that member,
  # so if we don't have DLPI, don't have a <sys/dlpi_ext.h> header, or
  # have one that doesn't declare a dl_hp_ppa_info_t type, we conclude
  # it doesn't have that member (which is OK, as either we won't be
  # using code that would use that member, or we wouldn't compile in
  # any case).
  #
  AC_CHECK_MEMBERS([dl_hp_ppa_info_t.dl_module_id_1],,,
      [
  	#include <sys/types.h>
  	#include <sys/dlpi.h>
  	#include <sys/dlpi_ext.h>
      ])
  
  AC_LBL_UNALIGNED_ACCESS
  
  AC_SUBST(V_CCOPT)
  AC_SUBST(V_DEFS)
  AC_SUBST(V_FINDALLDEVS)
  AC_SUBST(V_INCLS)
  AC_SUBST(V_LEX)
  AC_SUBST(V_PCAP)
  AC_SUBST(V_SHLIB_CCOPT)
  AC_SUBST(V_SHLIB_CMD)
  AC_SUBST(V_SHLIB_OPT)
  AC_SUBST(V_SONAME_OPT)
  AC_SUBST(V_RPATH_OPT)
  AC_SUBST(V_YACC)
  AC_SUBST(ADDLOBJS)
  AC_SUBST(ADDLARCHIVEOBJS)
  AC_SUBST(SSRC)
  AC_SUBST(DYEXT)
  AC_SUBST(MAN_FILE_FORMATS)
  AC_SUBST(MAN_MISC_INFO)
  AC_SUBST(MAN_ADMIN_COMMANDS)
  AC_SUBST(PTHREAD_LIBS)
  AC_SUBST(BUILD_RPCAPD)
  AC_SUBST(INSTALL_RPCAPD)
  AC_SUBST(RPCAPD_LIBS)
  AC_SUBST(EXTRA_NETWORK_LIBS)
  
  AC_ARG_ENABLE([usb],
  [AC_HELP_STRING([--enable-usb],[enable USB capture support @<:@default=yes, if support available@:>@])],
      [],
      [enable_usb=yes])
  
  if test "xxx_only" = yes; then
  	# User requested something-else-only pcap, so they don't
  	# want USB support.
  	enable_usb=no
  fi
  
  if test "x$enable_usb" != "xno" ; then
     dnl check for USB sniffing support
     AC_MSG_CHECKING(for USB sniffing support)
     case "$host_os" in
     linux*)
  	AC_DEFINE(PCAP_SUPPORT_USB, 1, [target host supports USB sniffing])
  	USB_SRC=pcap-usb-linux.c
  	AC_MSG_RESULT(yes)
  	ac_usb_dev_name=`udevinfo -q name -p /sys/class/usb_device/usbmon 2>/dev/null`
  	if test $? -ne 0 ; then
  	  ac_usb_dev_name="usbmon"
  	fi
  	AC_DEFINE_UNQUOTED(LINUX_USB_MON_DEV, "/dev/$ac_usb_dev_name", [path for device for USB sniffing])
  	AC_MSG_NOTICE(Device for USB sniffing is /dev/$ac_usb_dev_name)
  	#
  	# Do we have a version of <linux/compiler.h> available?
  	# If so, we might need it for <linux/usbdevice_fs.h>.
  	#
  	AC_CHECK_HEADERS(linux/compiler.h)
  	if test "$ac_cv_header_linux_compiler_h" = yes; then
  	  #
  	  # Yes - include it when testing for <linux/usbdevice_fs.h>.
  	  #
  	  AC_CHECK_HEADERS(linux/usbdevice_fs.h,,,[#include <linux/compiler.h>])
  	else
  	  AC_CHECK_HEADERS(linux/usbdevice_fs.h)
  	fi
  	if test "$ac_cv_header_linux_usbdevice_fs_h" = yes; then
  	  #
  	  # OK, does it define bRequestType?  Older versions of the kernel
  	  # define fields with names like "requesttype, "request", and
  	  # "value", rather than "bRequestType", "bRequest", and
  	  # "wValue".
  	  #
  	  AC_CHECK_MEMBERS([struct usbdevfs_ctrltransfer.bRequestType],,,
  	      [
  		  AC_INCLUDES_DEFAULT
  		  #ifdef HAVE_LINUX_COMPILER_H
  		  #include <linux/compiler.h>
  		  #endif
  		  #include <linux/usbdevice_fs.h>
  	      ])
  	fi
  	;;
      freebsd*)
  	#
  	# This just uses BPF in FreeBSD 8.4 and later; we don't need
  	# to check for anything special for capturing.
  	#
  	AC_MSG_RESULT([yes, in FreeBSD 8.4 and later])
  	;;
  
      *)
  	AC_MSG_RESULT(no)
  	;;
  esac
  fi
  AC_SUBST(PCAP_SUPPORT_USB)
  AC_SUBST(USB_SRC)
  
  dnl check for netfilter sniffing support
  if test "xxx_only" != yes; then
  	AC_MSG_CHECKING(whether the platform could support netfilter sniffing)
  	case "$host_os" in
  	linux*)
  		AC_MSG_RESULT(yes)
  		#
  		# Life's too short to deal with trying to get this to compile
  		# if you don't get the right types defined with
  		# __KERNEL_STRICT_NAMES getting defined by some other include.
  		#
  		# Check whether the includes Just Work.  If not, don't turn on
  		# netfilter support.
  		#
  		AC_MSG_CHECKING(whether we can compile the netfilter support)
  		AC_CACHE_VAL(ac_cv_netfilter_can_compile,
  		  AC_TRY_COMPILE([
  AC_INCLUDES_DEFAULT
  #include <sys/socket.h>
  #include <netinet/in.h>
  #include <linux/types.h>
  
  #include <linux/netlink.h>
  #include <linux/netfilter.h>
  #include <linux/netfilter/nfnetlink.h>
  #include <linux/netfilter/nfnetlink_log.h>
  #include <linux/netfilter/nfnetlink_queue.h>],
  		    [],
  		    ac_cv_netfilter_can_compile=yes,
  		    ac_cv_netfilter_can_compile=no))
  		AC_MSG_RESULT($ac_cv_netfilter_can_compile)
  		if test $ac_cv_netfilter_can_compile = yes ; then
  		  AC_DEFINE(PCAP_SUPPORT_NETFILTER, 1,
  		    [target host supports netfilter sniffing])
  		  NETFILTER_SRC=pcap-netfilter-linux.c
  		fi
  		;;
  	*)
  		AC_MSG_RESULT(no)
  		;;
  	esac
  fi
  AC_SUBST(PCAP_SUPPORT_NETFILTER)
  AC_SUBST(NETFILTER_SRC)
  
  AC_ARG_ENABLE([netmap],
  [AC_HELP_STRING([--enable-netmap],[enable netmap support @<:@default=yes, if support available@:>@])],
      [],
      [enable_netmap=yes])
  
  if test "x$enable_netmap" != "xno" ; then
  	#
  	# Check whether net/netmap_user.h is usable if NETMAP_WITH_LIBS is
  	# defined; it's not usable on DragonFly BSD 4.6 if NETMAP_WITH_LIBS
  	# is defined, for example, as it includes a non-existent malloc.h
  	# header.
  	#
  	AC_MSG_CHECKING(whether we can compile the netmap support)
  	AC_CACHE_VAL(ac_cv_net_netmap_user_can_compile,
  	  AC_TRY_COMPILE([
  AC_INCLUDES_DEFAULT
  #define NETMAP_WITH_LIBS
  #include <net/netmap_user.h>],
  	    [],
  	    ac_cv_net_netmap_user_can_compile=yes,
  	    ac_cv_net_netmap_user_can_compile=no))
  	AC_MSG_RESULT($ac_cv_net_netmap_user_can_compile)
  	if test $ac_cv_net_netmap_user_can_compile = yes ; then
  	  AC_DEFINE(PCAP_SUPPORT_NETMAP, 1,
  	    [target host supports netmap])
  	    NETMAP_SRC=pcap-netmap.c
  	fi
  	AC_SUBST(PCAP_SUPPORT_NETMAP)
  	AC_SUBST(NETMAP_SRC)
  fi
  
  
  AC_ARG_ENABLE([bluetooth],
  [AC_HELP_STRING([--enable-bluetooth],[enable Bluetooth support @<:@default=yes, if support available@:>@])],
      [],
      [enable_bluetooth=ifsupportavailable])
  
  if test "xxx_only" = yes; then
  	# User requested something-else-only pcap, so they don't
  	# want Bluetooth support.
  	enable_bluetooth=no
  fi
  
  if test "x$enable_bluetooth" != "xno" ; then
  	dnl check for Bluetooth sniffing support
  	case "$host_os" in
  	linux*)
  		AC_CHECK_HEADER(bluetooth/bluetooth.h,
  		    [
  			#
  			# We have bluetooth.h, so we support Bluetooth
  			# sniffing.
  			#
  			AC_DEFINE(PCAP_SUPPORT_BT, 1, [target host supports Bluetooth sniffing])
  			BT_SRC=pcap-bt-linux.c
  			AC_MSG_NOTICE(Bluetooth sniffing is supported)
  			ac_lbl_bluetooth_available=yes
  
  			#
  			# OK, does struct sockaddr_hci have an hci_channel
  			# member?
  			#
  			AC_CHECK_MEMBERS([struct sockaddr_hci.hci_channel],
  			    [
  				#
  				# Yes; is HCI_CHANNEL_MONITOR defined?
  				#
  				AC_MSG_CHECKING(if HCI_CHANNEL_MONITOR is defined)
  				AC_CACHE_VAL(ac_cv_lbl_hci_channel_monitor_is_defined,
  				    AC_TRY_COMPILE(
  					[
  					    #include <bluetooth/bluetooth.h>
  					    #include <bluetooth/hci.h>
  					],
  					[
  					    u_int i = HCI_CHANNEL_MONITOR;
  					],
  					[
  					    AC_MSG_RESULT(yes)
  					    AC_DEFINE(PCAP_SUPPORT_BT_MONITOR,,
  					      [target host supports Bluetooth Monitor])
  					    BT_MONITOR_SRC=pcap-bt-monitor-linux.c
  					],
  					[
  					    AC_MSG_RESULT(no)
  					]))
  			    ],,
  			    [
  				#include <bluetooth/bluetooth.h>
  				#include <bluetooth/hci.h>
  			    ])
  		    ],
  		    [
  			#
  			# We don't have bluetooth.h, so we don't support
  			# Bluetooth sniffing.
  			#
  			if test "x$enable_bluetooth" = "xyes" ; then
  				AC_MSG_ERROR(Bluetooth sniffing is not supported; install bluez-lib devel to enable it)
  			else
  				AC_MSG_NOTICE(Bluetooth sniffing is not supported; install bluez-lib devel to enable it)
  			fi
  		    ])
  		;;
  	*)
  		if test "x$enable_bluetooth" = "xyes" ; then
  			AC_MSG_ERROR(no Bluetooth sniffing support implemented for $host_os)
  		else
  			AC_MSG_NOTICE(no Bluetooth sniffing support implemented for $host_os)
  		fi
  		;;
  	esac
  	AC_SUBST(PCAP_SUPPORT_BT)
  	AC_SUBST(BT_SRC)
  	AC_SUBST(BT_MONITOR_SRC)
  fi
  
  AC_ARG_ENABLE([dbus],
  [AC_HELP_STRING([--enable-dbus],[enable D-Bus capture support @<:@default=yes, if support available@:>@])],
      [],
      [enable_dbus=ifavailable])
  
  if test "xxx_only" = yes; then
  	# User requested something-else-only pcap, so they don't
  	# want D-Bus support.
  	enable_dbus=no
  fi
  
  if test "x$enable_dbus" != "xno"; then
  	if test "x$enable_dbus" = "xyes"; then
  		case "$host_os" in
  
  		darwin*)
  			#
  			# We don't support D-Bus sniffing on macOS; see
  			#
  			# https://bugs.freedesktop.org/show_bug.cgi?id=74029
  			#
  			# The user requested it, so fail.
  			#
  			AC_MSG_ERROR([Due to freedesktop.org bug 74029, D-Bus capture support is not available on macOS])
  		esac
  	else
  		case "$host_os" in
  
  		darwin*)
  			#
  			# We don't support D-Bus sniffing on macOS; see
  			#
  			# https://bugs.freedesktop.org/show_bug.cgi?id=74029
  			#
  			# The user dind't explicitly request it, so just
  			# silently refuse to enable it.
  			#
  			enable_dbus="no"
  			;;
  		esac
  	fi
  fi
  
  if test "x$enable_dbus" != "xno"; then
  	AC_CHECK_PROG([PKGCONFIG], [pkg-config], [pkg-config], [no])
  	if test "x$PKGCONFIG" != "xno"; then
  		AC_MSG_CHECKING([for D-Bus])
  		if "$PKGCONFIG" dbus-1; then
  			AC_MSG_RESULT([yes])
  			DBUS_CFLAGS=`"$PKGCONFIG" --cflags dbus-1`
  			DBUS_LIBS=`"$PKGCONFIG" --libs dbus-1`
  			save_CFLAGS="$CFLAGS"
  			save_LIBS="$LIBS"
  			CFLAGS="$CFLAGS $DBUS_CFLAGS"
  			LIBS="$LIBS $DBUS_LIBS"
  			AC_MSG_CHECKING(whether the D-Bus library defines dbus_connection_read_write)
  			AC_TRY_LINK(
  			    [#include <string.h>
  
  			     #include <time.h>
  			     #include <sys/time.h>
  
  			     #include <dbus/dbus.h>],
  			    [return dbus_connection_read_write(NULL, 0);],
  			    [
  				AC_MSG_RESULT([yes])
  				AC_DEFINE(PCAP_SUPPORT_DBUS, 1, [support D-Bus sniffing])
  				DBUS_SRC=pcap-dbus.c
  				V_INCLS="$V_INCLS $DBUS_CFLAGS"
  			    ],
  			    [
  				AC_MSG_RESULT([no])
  				if test "x$enable_dbus" = "xyes"; then
  				    AC_MSG_ERROR([--enable-dbus was given, but the D-Bus library doesn't define dbus_connection_read_write()])
  				fi
  				LIBS="$save_LIBS"
  			     ])
  			CFLAGS="$save_CFLAGS"
  		else
  			AC_MSG_RESULT([no])
  			if test "x$enable_dbus" = "xyes"; then
  				AC_MSG_ERROR([--enable-dbus was given, but the dbus-1 package is not installed])
  			fi
  		fi
  	fi
  	AC_SUBST(PCAP_SUPPORT_DBUS)
  	AC_SUBST(DBUS_SRC)
  fi
  
  AC_ARG_ENABLE([rdma],
  [AC_HELP_STRING([--enable-rdma],[enable RDMA capture support @<:@default=yes, if support available@:>@])],
      [],
      [enable_rdmasniff=ifavailable])
  
  if test "xxx_only" = yes; then
  	# User requested something-else-only pcap, so they don't
  	# want RDMA support.
  	enable_rdmasniff=no
  fi
  
  if test "x$enable_rdmasniff" != "xno"; then
  	AC_CHECK_LIB(ibverbs, ibv_get_device_list, [
  		AC_CHECK_HEADER(infiniband/verbs.h, [
  			#
  			# ibv_create_flow may be defined as a static inline
  			# function in infiniband/verbs.h, so we can't
  			# use AC_CHECK_LIB.
  			#
  			# Too bad autoconf has no AC_SYMBOL_EXISTS()
  			# macro that works like CMake's check_symbol_exists()
  			# function, to check do a compile check like
  			# this (they do a clever trick to avoid having
  			# to know the function's signature).
  			#
  			AC_MSG_CHECKING(whether libibverbs defines ibv_create_flow)
  			AC_TRY_LINK(
  				[
  					#include <infiniband/verbs.h>
  				],
  				[
  					(void) ibv_create_flow((struct ibv_qp *) NULL,
  							       (struct ibv_flow_attr *) NULL);
  				],
  				[
  					AC_MSG_RESULT([yes])
  					AC_DEFINE(PCAP_SUPPORT_RDMASNIFF, , [target host supports RDMA sniffing])
  					RDMA_SRC=pcap-rdmasniff.c
  					LIBS="-libverbs $LIBS"
  				],
  				[
  					AC_MSG_RESULT([no])
  				]
  			)
  		])
  	])
  	AC_SUBST(PCAP_SUPPORT_RDMASNIFF)
  	AC_SUBST(RDMA_SRC)
  fi
  
  AC_PROG_INSTALL
  
  AC_CONFIG_HEADER(config.h)
  
  AC_OUTPUT_COMMANDS([if test -f .devel; then
  	echo timestamp > stamp-h
  	cat $srcdir/Makefile-devel-adds >> Makefile
  	make depend
  fi])
  AC_OUTPUT(Makefile pcap-filter.manmisc pcap-linktype.manmisc
  	pcap-tstamp.manmisc pcap-savefile.manfile pcap.3pcap
  	pcap_compile.3pcap pcap_datalink.3pcap pcap_dump_open.3pcap
  	pcap_get_tstamp_precision.3pcap pcap_list_datalinks.3pcap
  	pcap_list_tstamp_types.3pcap pcap_open_dead.3pcap
  	pcap_open_offline.3pcap pcap_set_tstamp_precision.3pcap
  	pcap_set_tstamp_type.3pcap rpcapd/Makefile rpcapd/rpcapd.manadmin
  	testprogs/Makefile)
  exit 0