File: plugin-configure.m4

package info (click to toggle)
abiword 3.0.2-9
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 60,284 kB
  • sloc: cpp: 476,293; ansic: 15,499; makefile: 5,794; sh: 4,359; xml: 3,332; yacc: 1,818; lex: 1,104; perl: 40; python: 6
file content (1955 lines) | stat: -rw-r--r-- 44,729 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

openwriter_pkgs="$gsf_req"
openwriter_deps="no"

if test "$enable_openwriter" != ""; then

PKG_CHECK_EXISTS([ $openwriter_pkgs ], 
[
	openwriter_deps="yes"
], [
	test "$enable_openwriter" = "auto" && AC_MSG_WARN([openwriter plugin: dependencies not satisfied - $openwriter_pkgs])
])

fi

if test "$enable_openwriter" = "yes" || \
   test "$openwriter_deps" = "yes"; then

PKG_CHECK_MODULES(OPENWRITER,[ $openwriter_pkgs ])

test "$enable_openwriter" = "auto" && PLUGINS="$PLUGINS openwriter"

OPENWRITER_CFLAGS="$OPENWRITER_CFLAGS "'${PLUGIN_CFLAGS}'
OPENWRITER_LIBS="$OPENWRITER_LIBS "'${PLUGIN_LIBS}'

if test "$enable_openwriter_builtin" = "yes"; then
	OPENWRITER_CFLAGS="$OPENWRITER_CFLAGS -DABI_PLUGIN_BUILTIN"
fi

fi

AC_SUBST([OPENWRITER_CFLAGS])
AC_SUBST([OPENWRITER_LIBS])


grammar_pkgs='link-grammar >= 4.2.1'
grammar_deps="no"

dnl make sure we enable grammar only if spell is enabled. At least in auto mode.
if test "$enable_grammar" != "" && test  "$abi_cv_spell" = "yes"; then

PKG_CHECK_EXISTS([ $grammar_pkgs ], 
[
	grammar_deps="yes"
], [
	test "$enable_grammar" = "auto" && AC_MSG_WARN([grammar plugin: dependencies not satisfied - $grammar_pkgs])
])

fi

if test "$enable_grammar" = "yes" || \
   test "$grammar_deps" = "yes"; then

if test "$enable_grammar_builtin" = "yes"; then
AC_MSG_ERROR([grammar plugin: static linking not supported])
fi

PKG_CHECK_MODULES(GRAMMAR,[ $grammar_pkgs ])
PKG_CHECK_EXISTS([ link-grammar >= 5.1.0 ], 
[
	AC_DEFINE([HAVE_LINK_GRAMMAR_51],[1],["have link-grammar 5.1.0 or later"])
])

test "$enable_grammar" = "auto" && PLUGINS="$PLUGINS grammar"

GRAMMAR_CFLAGS="$GRAMMAR_CFLAGS "'${PLUGIN_CFLAGS}'
GRAMMAR_LIBS="$GRAMMAR_LIBS "'${PLUGIN_LIBS}'

fi

AC_SUBST([GRAMMAR_CFLAGS])
AC_SUBST([GRAMMAR_LIBS])


wpg_pkgs="libwpg-0.3 $gsf_req"
wpg_deps="no"

if test "$enable_wpg" != ""; then

PKG_CHECK_EXISTS([ $wpg_pkgs ], 
[
	wpg_deps="yes"
], [
	test "$enable_wpg" = "auto" && AC_MSG_WARN([wpg plugin: dependencies not satisfied - $wpg_pkgs])
])

fi

if test "$enable_wpg" = "yes" || \
   test "$wpg_deps" = "yes"; then

if test "$enable_wpg_builtin" = "yes"; then
AC_MSG_ERROR([wpg plugin: static linking not supported])
fi

PKG_CHECK_MODULES(WPG, [ $wpg_pkgs ])

test "$enable_wpg" = "auto" && PLUGINS="$PLUGINS wpg"

WPG_CFLAGS="$WPG_CFLAGS "'${PLUGIN_CFLAGS}'
WPG_LIBS="$WPG_LIBS "'${PLUGIN_LIBS}'

fi

AC_SUBST([WPG_CFLAGS])
AC_SUBST([WPG_LIBS])


GIMP_CFLAGS=
GIMP_LIBS=

if test "$enable_gimp" != ""; then

test "$enable_gimp" = "auto" && PLUGINS="$PLUGINS gimp"

GIMP_CFLAGS="$GIMP_CFLAGS "'${PLUGIN_CFLAGS}'
GIMP_LIBS="$GIMP_LIBS "'${PLUGIN_LIBS}'

if test "$enable_gimp_builtin" = "yes"; then
	GIMP_CFLAGS="$GIMP_CFLAGS -DABI_PLUGIN_BUILTIN"
fi

fi

AC_SUBST([GIMP_CFLAGS])
AC_SUBST([GIMP_LIBS])


aiksaurus_pkgs="aiksaurus-1.2"
aiksaurus_gtk_pkgs="aiksaurusgtk3-1.2"
aiksaurus_deps="no"

if test "$enable_aiksaurus" != ""; then

PKG_CHECK_EXISTS([ $aiksaurus_pkgs ], 
[
  aiksaurus_deps="yes"
], [
	test "$enable_aiksaurus" = "auto" && AC_MSG_WARN([aiksaurus plugin: dependencies not satisfied - $aiksaurus_pkgs])
])

fi

if test "$enable_aiksaurus" = "yes" || \
   test "$aiksaurus_deps" = "yes"; then

use_builtin_aiksaurus_gtk="no"
if test "$TOOLKIT" = "gtk"; then
PKG_CHECK_EXISTS([ $aiksaurus_gtk_pkgs ], 
[
  aiksaurus_pkgs="$aiksaurus_pkgs $aiksaurus_gtk_pkgs"
], [use_builtin_aiksaurus_gtk="yes"])
fi

if test "$enable_aiksaurus_builtin" = "yes"; then
AC_MSG_ERROR([aiksaurus plugin: static linking not supported])
fi

PKG_CHECK_MODULES(AIKSAURUS,[ $aiksaurus_pkgs ])

  
test "$enable_aiksaurus" = "auto" && PLUGINS="$PLUGINS aiksaurus"

AIKSAURUS_CFLAGS="$AIKSAURUS_CFLAGS "'${PLUGIN_CFLAGS}'
AIKSAURUS_LIBS="$AIKSAURUS_LIBS "'${PLUGIN_LIBS}'

fi

AM_CONDITIONAL([WITH_BUILTIN_AIKSAURUS_GTK],[ test "x$use_builtin_aiksaurus_gtk" = "xyes" ])

AC_SUBST([AIKSAURUS_CFLAGS])
AC_SUBST([AIKSAURUS_LIBS])

command_deps="no"

if test "$enable_command" != ""; then
    if test "$TOOLKIT" != "gtk"; then
		command_deps="no"
		AC_MSG_WARN([command plugin: only supported on UNIX/gtk platforms])
	else 
		# stolen from the original plugin.m4 in abiword-plugins
		AC_CHECK_HEADER(readline/readline.h,[
				AC_CHECK_HEADER(readline/history.h,[
						AC_CHECK_LIB(readline,readline,[
								command_deps="yes"
						],[     AC_CHECK_LIB(readline,rl_initialize,[
										command_deps="yes"

								],,)
						],)
				])
		])
	fi
fi

if test "$enable_command" = "yes" || \
   test "$command_deps" = "yes"; then

if test "$enable_command_builtin" = "yes"; then
AC_MSG_ERROR([command plugin: static linking not supported])
fi

AC_MSG_CHECKING([command plugin: for readline and friends])
if test "$command_deps" != "yes"; then
	AC_MSG_ERROR([no])
else
	AC_MSG_RESULT([yes])
        COMMAND_LIBS="-lreadline -lhistory $COMMAND_LIBS"
fi

test "$enable_command" = "auto" && PLUGINS="$PLUGINS command"

COMMAND_CFLAGS="$COMMAND_CFLAGS "'${PLUGIN_CFLAGS}'
COMMAND_LIBS="$COMMAND_LIBS "'${PLUGIN_LIBS}'

fi

AC_SUBST([COMMAND_CFLAGS])
AC_SUBST([COMMAND_LIBS])


goffice_req=
for ver in 0.10 ; do
  if test "x$goffice_req" = x; then
    if pkg-config --exists libgoffice-$ver; then
      goffice_req=libgoffice-$ver
    fi
  fi
done
if test "x$goffice_req" = x; then
  goffice_req=libgoffice-0.10
fi

goffice_pkgs="$goffice_req >= 0.10.2"
goffice_deps="no"

if test "$enable_goffice" != ""; then

PKG_CHECK_EXISTS([ $goffice_pkgs ], 
[
	AC_MSG_CHECKING([for gtk toolkit])
	if test "$TOOLKIT" = "gtk"; then
	  AC_MSG_RESULT([yes])
	  goffice_deps="yes"
	else
	  AC_MSG_RESULT([no])
	  if test "$enable_goffice" = "auto"; then
	    AC_MSG_WARN([goffice plugin: only supported with gtk])
	  else
	    AC_MSG_ERROR([goffice plugin: only supported with gtk])
	  fi
	fi
], [
	test "$enable_goffice" = "auto" && AC_MSG_WARN([goffice plugin: dependencies not satisfied - $goffice_pkgs])
])

fi

if test "$enable_goffice" = "yes" || \
   test "$goffice_deps" = "yes"; then

if test "$enable_goffice_builtin" = "yes"; then
AC_MSG_ERROR([goffice plugin: static linking not supported])
fi

PKG_CHECK_MODULES(GOFFICE,[ $goffice_pkgs ])

test "$enable_goffice" = "auto" && PLUGINS="$PLUGINS goffice"

GOFFICE_CFLAGS="$GOFFICE_CFLAGS "'${PLUGIN_CFLAGS}'
GOFFICE_LIBS="$GOFFICE_LIBS "'${PLUGIN_LIBS}'

fi

AC_SUBST([GOFFICE_CFLAGS])
AC_SUBST([GOFFICE_LIBS])


sdw_pkgs="$gsf_req"
sdw_deps="no"

if test "$enable_sdw" != ""; then

PKG_CHECK_EXISTS([ $sdw_pkgs ], 
[
	sdw_deps="yes"
], [
	test "$enable_sdw" = "auto" && AC_MSG_WARN([sdw plugin: dependencies not satisfied - $sdw_pkgs])
])

fi

if test "$enable_sdw" = "yes" || \
   test "$sdw_deps" = "yes"; then

PKG_CHECK_MODULES(SDW,[ $sdw_pkgs ])

test "$enable_sdw" = "auto" && PLUGINS="$PLUGINS sdw"

SDW_CFLAGS="$SDW_CFLAGS "'${PLUGIN_CFLAGS}'
SDW_LIBS="$SDW_LIBS "'${PLUGIN_LIBS}'

if test "$enable_sdw_builtin" = "yes"; then
	SDW_CFLAGS="$SDW_CFLAGS -DABI_PLUGIN_BUILTIN"
fi

fi

AC_SUBST([SDW_CFLAGS])
AC_SUBST([SDW_LIBS])


PAINT_CFLAGS=
PAINT_LIBS=

if test "$enable_paint" != ""; then

test "$enable_paint" = "auto" && PLUGINS="$PLUGINS paint"

# TODO check for libpng
if test "$TOOLKIT" = "win"; then
	PAINT_LIBS="-lgdi32 $PNG_LIBS"
	PAINT_CFLAGS="$PAINT_CFLAGS $PNG_CFLAGS"
fi

PAINT_CFLAGS="$PAINT_CFLAGS "'${PLUGIN_CFLAGS}'
PAINT_LIBS="$PAINT_LIBS "'${PLUGIN_LIBS}'

if test "$enable_paint_builtin" = "yes"; then
	PAINT_CFLAGS="$PAINT_CFLAGS -DABI_PLUGIN_BUILTIN"
fi

fi

AC_SUBST([PAINT_CFLAGS])
AC_SUBST([PAINT_LIBS])


PASSEPARTOUT_CFLAGS=
PASSEPARTOUT_LIBS=

if test "$enable_passepartout" != ""; then

test "$enable_passepartout" = "auto" && PLUGINS="$PLUGINS passepartout"

PASSEPARTOUT_CFLAGS="$PASSEPARTOUT_CFLAGS "'${PLUGIN_CFLAGS}'
PASSEPARTOUT_LIBS="$PASSEPARTOUT_LIBS "'${PLUGIN_LIBS}'

if test "$enable_passepartout_builtin" = "yes"; then
	PASSEPARTOUT_CFLAGS="$PASSEPARTOUT_CFLAGS -DABI_PLUGIN_BUILTIN"
fi

fi

AC_SUBST([PASSEPARTOUT_CFLAGS])
AC_SUBST([PASSEPARTOUT_LIBS])


#opendocument_pkgs="$gsf_req redland >= 1.0.10 rasqal >= 0.9.17"

opendocument_pkgs="$gsf_req"
opendocument_optional_pkgs="redland >= 1.0.10 rasqal >= 0.9.17"
opendocument_deps="no"

if test "$enable_opendocument" != ""; then

PKG_CHECK_EXISTS([ $opendocument_pkgs ], 
[
	opendocument_deps="yes"
], [
	test "$enable_opendocument" = "auto" && AC_MSG_WARN([opendocument plugin: dependencies not satisfied - $opendocument_pkgs])
])

PKG_CHECK_EXISTS([ $opendocument_optional_pkgs ], 
[ opendocument_pkgs="$opendocument_pkgs $opendocument_optional_pkgs" ])

fi

if test "$enable_opendocument" = "yes" || \
   test "$opendocument_deps" = "yes"; then

PKG_CHECK_MODULES(OPENDOCUMENT,[ $opendocument_pkgs ])

test "$enable_opendocument" = "auto" && PLUGINS="$PLUGINS opendocument"

OPENDOCUMENT_CFLAGS="$OPENDOCUMENT_CFLAGS "'${PLUGIN_CFLAGS}'
OPENDOCUMENT_LIBS="$OPENDOCUMENT_LIBS "'${PLUGIN_LIBS} -lz'

if test "$enable_opendocument_builtin" = "yes"; then
	OPENDOCUMENT_CFLAGS="$OPENDOCUMENT_CFLAGS -DABI_PLUGIN_BUILTIN"
fi

fi

AC_SUBST([OPENDOCUMENT_CFLAGS])
AC_SUBST([OPENDOCUMENT_LIBS])


wml_pkgs="$gsf_req"
wml_deps="no"

if test "$enable_wml" != ""; then

PKG_CHECK_EXISTS([ $wml_pkgs ], 
[
	wml_deps="yes"
], [
	test "$enable_wml" = "auto" && AC_MSG_WARN([wml plugin: dependencies not satisfied - $wml_pkgs])
])

fi

if test "$enable_wml" = "yes" || \
   test "$wml_deps" = "yes"; then

PKG_CHECK_MODULES(WML,[ $wml_pkgs ])

test "$enable_wml" = "auto" && PLUGINS="$PLUGINS wml"

WML_CFLAGS="$WML_CFLAGS "'${PLUGIN_CFLAGS}'
WML_LIBS="$WML_LIBS "'${PLUGIN_LIBS}'

if test "$enable_wml_builtin" = "yes"; then
	WML_CFLAGS="$WML_CFLAGS -DABI_PLUGIN_BUILTIN"
fi

fi

AC_SUBST([WML_CFLAGS])
AC_SUBST([WML_LIBS])


EML_CFLAGS=
EML_LIBS=

if test "$enable_eml" != ""; then

test "$enable_eml" = "auto" && PLUGINS="$PLUGINS eml"

EML_CFLAGS="$EML_CFLAGS "'${PLUGIN_CFLAGS}'
EML_LIBS="$EML_LIBS "'${PLUGIN_LIBS}'

if test "$enable_eml_builtin" = "yes"; then
	EML_CFLAGS="$EML_CFLAGS -DABI_PLUGIN_BUILTIN"
fi

fi

AC_SUBST([EML_CFLAGS])
AC_SUBST([EML_LIBS])


#
# Optional packages
#

AC_ARG_WITH([inter7eps], 
	[AS_HELP_STRING([--with-inter7eps], [MHT plugin: support multipart html using the inter7 EPS library])], 
[
	mht_cv_inter7eps="$withval"
],[
	mht_cv_inter7eps="auto"
])

AC_ARG_WITH([libtidy], 
	[AS_HELP_STRING([--with-libtidy], [MHT plugin: clean up HTML before importing using libtidy])], 
[
	mht_cv_libtidy="$withval"
],[
	mht_cv_libtidy="auto"
])

# gsf pulls in libxml, so we are ok
mht_pkgs="$gsf_req"
mht_deps="no"

if test "$enable_mht" != ""; then

PKG_CHECK_EXISTS([ $mht_pkgs ], 
[
	mht_deps="yes"
], [
	test "$enable_mht" = "auto" && AC_MSG_WARN([mht plugin: dependencies not satisfied - $mht_pkgs])
])

fi

if test "$enable_mht" = "yes" || \
   test "$mht_deps" = "yes"; then

test "$enable_mht" = "auto" && PLUGINS="$PLUGINS mht"

if test "$enable_mht_builtin" = "yes"; then
AC_MSG_ERROR([mht plugin: static linking not supported])
fi

#
# Tests
#

AC_CHECK_HEADERS([eps/eps.h],
[
	inter7eps_found="yes"
], [
	inter7eps_found="no"
])

AC_CHECK_HEADERS([tidy/tidy.h],
[
	libtidy_found="yes"
], [
	libtidy_found="no"
])

#
# Settings
#

if test "$mht_cv_inter7eps" = "yes" &&
   test "$inter7eps_found" = "no"; then
	AC_MSG_ERROR([MHT plugin: error - inter7 EPS headers not found])
elif test "$mht_cv_inter7eps" = "auto"; then
	mht_cv_inter7eps="$inter7eps_found"
fi
if test "$mht_cv_inter7eps" = "yes"; then
	MHT_OPT_LIBS="$MHT_OPT_LIBS -leps"
fi

if test "$mht_cv_libtidy" = "yes" &&
   test "$libtidy_found" = "no"; then
	AC_MSG_ERROR([MHT plugin: error - libtidy headers not found])
elif test "$mht_cv_libtidy" = "auto"; then
	mht_cv_libtidy="$libtidy_found"
fi
if test "$mht_cv_libtidy" = "yes"; then
	MHT_OPT_LIBS="$MHT_OPT_LIBS -ltidy"
fi

PKG_CHECK_MODULES(MHT,[ $mht_pkgs ])

MHT_CFLAGS="$MHT_CFLAGS "'${PLUGIN_CFLAGS}'
MHT_LIBS="$MHT_LIBS $MHT_OPT_LIBS "'${PLUGIN_LIBS}'

fi

AC_SUBST([MHT_CFLAGS])
AC_SUBST([MHT_LIBS])

# TODO we depend on libxml2 anyways, so get rid of alternatives
AM_CONDITIONAL([ABI_XHTML_XML2], test /bin/true)
AM_CONDITIONAL([ABI_XHTML_MHT], test "$mht_cv_inter7eps" = "yes")
AM_CONDITIONAL([ABI_XHTML_TIDY], test "$mht_cv_libtidy" = "yes")


GDICT_CFLAGS=
GDICT_LIBS=
gdict_deps="no"

if test "$enable_gdict" != ""; then

AC_MSG_CHECKING([for unix/gtk platform])
if test "$TOOLKIT" = "gtk"; then
  AC_MSG_RESULT([yes])
  gdict_deps="yes"
else
  AC_MSG_RESULT([no])
  if test "$enable_gdict" = "auto"; then
    AC_MSG_WARN([gdict plugin: only supported on UNIX/gtk platforms])
  else
    AC_MSG_ERROR([gdict plugin: only supported on UNIX/gtk platforms])
  fi
fi

fi

if test "$enable_gdict" = "yes" || \
   test "$gdict_deps" = "yes"; then

AC_TYPE_PID_T

test "$enable_gdict" = "auto" && PLUGINS="$PLUGINS gdict"

GDICT_CFLAGS="$GDICT_CFLAGS "'${PLUGIN_CFLAGS} -DUSE_FORK_AND_EXEC_METHOD=1'
GDICT_LIBS='${PLUGIN_LIBS}'

if test "$enable_gdict_builtin" != ""; then
	GDICT_CFLAGS="$GDICT_CFLAGS -DABI_PLUGIN_BUILTIN"
fi

fi

AC_SUBST([GDICT_CFLAGS])
AC_SUBST([GDICT_LIBS])


S5_CFLAGS=
S5_LIBS=

if test "$enable_s5" != ""; then

test "$enable_s5" = "auto" && PLUGINS="$PLUGINS s5"

S5_CFLAGS="$S5_CFLAGS "'${PLUGIN_CFLAGS}'
S5_LIBS="$S5_LIBS "'${PLUGIN_LIBS}'

if test "$enable_s5_builtin" = "yes"; then
	S5_CFLAGS="$S5_CFLAGS -DABI_PLUGIN_BUILTIN"
fi

fi

AC_SUBST([S5_CFLAGS])
AC_SUBST([S5_LIBS])


BABELFISH_CFLAGS=
BABELFISH_LIBS=

if test "$enable_babelfish" != ""; then

test "$enable_babelfish" = "auto" && PLUGINS="$PLUGINS babelfish"

BABELFISH_CFLAGS="$BABELFISH_CFLAGS "'${PLUGIN_CFLAGS}'
BABELFISH_LIBS="$BABELFISH_LIBS "'${PLUGIN_LIBS}'

if test "$enable_babelfish_builtin" = "yes"; then
	BABELFISH_CFLAGS="$BABELFISH_CFLAGS -DABI_PLUGIN_BUILTIN"
fi

fi

AC_SUBST([BABELFISH_CFLAGS])
AC_SUBST([BABELFISH_LIBS])


ots_pkgs="libots-1 >= 0.5.0"
ots_deps="no"

if test "$enable_ots" != ""; then

PKG_CHECK_EXISTS([ $ots_pkgs ], 
[
	ots_deps="yes"
], [
	test "$enable_ots" = "auto" && AC_MSG_WARN([ots plugin: dependencies not satisfied - $ots_pkgs])
])

fi

if test "$enable_ots" = "yes" || \
   test "$ots_deps" = "yes"; then

test "$enable_ots" = "auto" && PLUGINS="$PLUGINS ots"

if test "$enable_ots_builtin" = "yes"; then
AC_MSG_ERROR([ots plugin: static linking not supported])
fi

PKG_CHECK_MODULES(OTS,[ $ots_pkgs ])

OTS_CFLAGS="$OTS_CFLAGS "'${PLUGIN_CFLAGS}'
OTS_LIBS="$OTS_LIBS "'${PLUGIN_LIBS}'

fi

AC_SUBST([OTS_CFLAGS])
AC_SUBST([OTS_LIBS])


BMP_CFLAGS=
BMP_LIBS=
bmp_deps="no"

if test "$enable_bmp" != ""; then

   bmp_deps="yes"

fi

if test "$enable_bmp" = "yes" || \
   test "$bmp_deps" = "yes"; then

# TODO check for libpng, well abiword links to it anyways

BMP_CFLAGS="$BMP_CFLAGS $PNG_CFLAGS "'${PLUGIN_CFLAGS}'
BMP_LIBS="$BMP_LIBS $PNG_LIBS "'${PLUGIN_LIBS}'

if test "$enable_bmp_builtin" = "yes"; then
	BMP_CFLAGS="$BMP_CFLAGS -DABI_PLUGIN_BUILTIN"
fi

test "$enable_bmp" = "auto" && PLUGINS="$PLUGINS bmp"

fi

AC_SUBST([BMP_CFLAGS])
AC_SUBST([BMP_LIBS])


AC_ARG_WITH([psiconv-config],
	[AS_HELP_STRING([--with-psiconv-config=DIR], [use psiconv-config in DIR])],
[
	AC_PATH_PROG(psiconvconfig, psiconv-config, , "$withval")
], [
	AC_PATH_PROG(psiconvconfig, psiconv-config)
])

# The required psiconv version, as reported by psiconv-config
psiconv_major_req=0
psiconv_minor_req=9
psiconv_micro_req=4
psion_deps="no"

if test "$enable_psion" != ""; then

	if test "$psiconvconfig" = ""; then
		if test "$enable_psion" = "yes"; then
		  AC_MSG_ERROR([psiconv plugin: program psiconv-config not found in path])
		else
		  AC_MSG_WARN([psiconv plugin: program psiconv-config not found in path])
		fi
	else
		IFS_old="$IFS"
		IFS='.'
		set -- `$psiconvconfig --version`
		psiconv_major_found="${1}"
		psiconv_minor_found="${2}"
		psiconv_micro_found="${3}"
		IFS="$IFS_old"
		if test "$psiconv_major_found" -gt "$psiconv_major_req"; then
			psion_deps="yes"
		elif test "$psiconv_major_found" -eq "$psiconv_major_req" &&
		     test "$psiconv_minor_found" -gt "$psiconv_minor_req"; then
			psion_deps="yes"
		elif test "$psiconv_major_found" -eq "$psiconv_major_req" &&
		     test "$psiconv_minor_found" -eq "$psiconv_minor_req" &&
		     test "$psiconv_micro_found" -ge "$psiconv_micro_req"; then
			psion_deps="yes"
		fi
	fi
fi

if test "$enable_psion" = "yes" || \
   test "$psion_deps" = "yes"; then

if test "$enable_psion_builtin" = "yes"; then
AC_MSG_ERROR([psion plugin: static linking not supported])
fi

AC_MSG_CHECKING([for psiconv >= ${psiconv_major_req}.${psiconv_minor_req}.${psiconv_micro_req}])
if test "$psion_deps" = "yes"; then
	AC_MSG_RESULT([version ${psiconv_major_found}.${psiconv_minor_found}.${psiconv_micro_found} (ok)])
	PSION_CFLAGS=`$psiconvconfig --cflags`
	PSION_LIBS=`$psiconvconfig --libs`
else
	AC_MSG_ERROR([version ${psiconv_major_found}.${psiconv_minor_found}.${psiconv_micro_found} (too old!)])
fi

test "$enable_psion" = "auto" && PLUGINS="$PLUGINS psion"

PSION_CFLAGS="$PSION_CFLAGS $PNG_CFLAGS "'${PLUGIN_CFLAGS}'
PSION_LIBS="$PSION_LIBS $PNG_LIBS -lgsf-1 "'${PLUGIN_LIBS}'

fi

AC_SUBST([PSION_CFLAGS])
AC_SUBST([PSION_LIBS])


gda_pkgs='libgda >= 1.2.0 libgnomedb >= 1.2.0'
gda_deps="no"

if test "$enable_gda" != ""; then

PKG_CHECK_EXISTS([ $gda_pkgs ], 
[
	AC_MSG_CHECKING([for gtk toolkit])
	if test "$TOOLKIT" = "gtk"; then
	  AC_MSG_RESULT([yes])
	  gda_deps="yes"
	else
	  AC_MSG_RESULT([no])
	  if test "$enable_gda" = "auto"; then
	    AC_MSG_WARN([gda plugin: only supported with gtk])
	  else
	    AC_MSG_ERROR([gda plugin: only supported with gtk])
	  fi
	fi
], [
	test "$enable_gda" = "auto" && AC_MSG_WARN([gda plugin: dependencies not satisfied - $gda_pkgs])
])

fi

if test "$enable_gda" = "yes" || \
   test "$gda_deps" = "yes"; then

if test "$enable_gda_builtin" = "yes"; then
AC_MSG_ERROR([gda plugin: static linking not supported])
fi

PKG_CHECK_MODULES(GDA,[ $gda_pkgs ])

test "$enable_gda" = "auto" && PLUGINS="$PLUGINS gda"

GDA_CFLAGS="$GDA_CFLAGS "'${PLUGIN_CFLAGS}'
GDA_LIBS="$GDA_LIBS "'${PLUGIN_LIBS}'

fi

AC_SUBST([GDA_CFLAGS])
AC_SUBST([GDA_LIBS])


OPML_CFLAGS=
OPML_LIBS=

if test "$enable_opml" != ""; then

test "$enable_opml" = "auto" && PLUGINS="$PLUGINS opml"

OPML_CFLAGS="$OPML_CFLAGS "'${PLUGIN_CFLAGS}'
OPML_LIBS="$OPML_LIBS "'${PLUGIN_LIBS}'

if test "$enable_opml_builtin" = "yes"; then
	OPML_CFLAGS="$OPML_CFLAGS -DABI_PLUGIN_BUILTIN"
fi

fi

AC_SUBST([OPML_CFLAGS])
AC_SUBST([OPML_LIBS])


garble_pkgs="libgsf-1 >= 1.12 libxml-2.0 >= 2.4.0"
garble_deps="no"

if test "$enable_garble" != ""; then

PKG_CHECK_EXISTS([ $garble_pkgs ], 
[
	garble_deps="yes"
], [
	test "$enable_garble" = "auto" && AC_MSG_WARN([garble plugin: dependencies not satisfied - $garble_pkgs])
])

fi

if test "$enable_garble" = "yes" || \
   test "$garble_deps" = "yes"; then

AC_HEADER_TIME

PKG_CHECK_MODULES(GARBLE,[ $garble_pkgs ])

test "$enable_garble" = "auto" && PLUGINS="$PLUGINS garble"

GARBLE_CFLAGS="$GARBLE_CFLAGS $PNG_CFLAGS "'${PLUGIN_CFLAGS}'
GARBLE_LIBS="$GARBLE_LIBS $PNG_LIBS "'${PLUGIN_LIBS}'

if test "$enable_garble_builtin" = "yes"; then
	GARBLE_CFLAGS="$GARBLE_CFLAGS -DABI_PLUGIN_BUILTIN"
fi

fi

AC_SUBST([GARBLE_CFLAGS])
AC_SUBST([GARBLE_LIBS])


HRTEXT_CFLAGS=
HRTEXT_LIBS=

if test "$enable_hrtext" != ""; then

test "$enable_hrtext" = "auto" && PLUGINS="$PLUGINS hrtext"

HRTEXT_CFLAGS="$HRTEXT_CFLAGS "'${PLUGIN_CFLAGS}'
HRTEXT_LIBS="$HRTEXT_LIBS "'${PLUGIN_LIBS}'

if test "$enable_hrtext_builtin" = "yes"; then
	HRTEXT_CFLAGS="$HRTEXT_CFLAGS -DABI_PLUGIN_BUILTIN"
fi

fi

AC_SUBST([HRTEXT_CFLAGS])
AC_SUBST([HRTEXT_LIBS])


PRESENTATION_CFLAGS=
PRESENTATION_LIBS=

if test "$enable_presentation" != ""; then

test "$enable_presentation" = "auto" && PLUGINS="$PLUGINS presentation"

PRESENTATION_CFLAGS="$PRESENTATION_CFLAGS "'${PLUGIN_CFLAGS}'
PRESENTATION_LIBS="$PRESENTATION_LIBS "'${PLUGIN_LIBS}'

if test "$enable_presentation_builtin" = "yes"; then
	PRESENTATION_CFLAGS="$PRESENTATION_CFLAGS -DABI_PLUGIN_BUILTIN"
fi

fi

AC_SUBST([PRESENTATION_CFLAGS])
AC_SUBST([PRESENTATION_LIBS])


FREETRANSLATION_CFLAGS=
FREETRANSLATION_LIBS=

if test "$enable_freetranslation" != ""; then

test "$enable_freetranslation" = "auto" && PLUGINS="$PLUGINS freetranslation"

FREETRANSLATION_CFLAGS="$FREETRANSLATION_CFLAGS "'${PLUGIN_CFLAGS}'
FREETRANSLATION_LIBS="$FREETRANSLATION_LIBS "'${PLUGIN_LIBS}'

if test "$enable_freetranslation_builtin" = "yes"; then
	FREETRANSLATION_CFLAGS="$FREETRANSLATION_CFLAGS -DABI_PLUGIN_BUILTIN"
fi

fi

AC_SUBST([FREETRANSLATION_CFLAGS])
AC_SUBST([FREETRANSLATION_LIBS])


xslfo_pkgs="$gsf_req"
xslfo_deps="no"

if test "$enable_xslfo" != ""; then

PKG_CHECK_EXISTS([ $xslfo_pkgs ], 
[
	xslfo_deps="yes"
], [
	test "$enable_xslfo" = "auto" && AC_MSG_WARN([xslfo plugin: dependencies not satisfied - $xslfo_pkgs])
])

fi

if test "$enable_xslfo" = "yes" || \
   test "$xslfo_deps" = "yes"; then

PKG_CHECK_MODULES(XSLFO,[ $xslfo_pkgs ])

test "$enable_xslfo" = "auto" && PLUGINS="$PLUGINS xslfo"

XSLFO_CFLAGS="$XSLFO_CFLAGS "'${PLUGIN_CFLAGS}'
XSLFO_LIBS="$XSLFO_LIBS "'${PLUGIN_LIBS}'

if test "$enable_xslfo_builtin" = "yes"; then
	XSLFO_CFLAGS="$XSLFO_CFLAGS -DABI_PLUGIN_BUILTIN"
fi

fi

AC_SUBST([XSLFO_CFLAGS])
AC_SUBST([XSLFO_LIBS])


wordperfect_pkgs="libwpd-0.10 $gsf_req"
wordperfect_wps_pkgs='libwps-0.3'
wordperfect_deps="no"

WORDPERFECT_CFLAGS=
WORDPERFECT_LIBS=
WPS_DEFINE=

if test "$enable_wordperfect" != ""; then

PKG_CHECK_EXISTS([ $wordperfect_pkgs ], 
[
	wordperfect_deps="yes"
], [
	test "$enable_wordperfect" = "auto" && AC_MSG_WARN([wordperfect plugin: dependencies not satisfied - $wordperfect_pkgs])
])

fi

if test "$enable_wordperfect" = "yes" || \
   test "$wordperfect_deps" = "yes"; then

if test "$enable_wordperfect_builtin" = "yes"; then
AC_MSG_ERROR([wordperfect plugin: static linking not supported])
fi

wp_deps_pkgs="$wordperfect_pkgs"

PKG_CHECK_EXISTS([ $wordperfect_wps_pkgs ],
[
	wp_deps_pkgs="$wordperfect_wps_pkgs $wp_deps_pkgs"
	WPS_DEFINE=" -DHAVE_LIBWPS"
])

PKG_CHECK_MODULES(WORDPERFECT,[ $wp_deps_pkgs ])

test "$enable_wordperfect" = "auto" && PLUGINS="$PLUGINS wordperfect"

WORDPERFECT_CFLAGS="$WORDPERFECT_CFLAGS "'${PLUGIN_CFLAGS}'"$WPS_DEFINE"
WORDPERFECT_LIBS="$WORDPERFECT_LIBS "'${PLUGIN_LIBS}'

fi

AC_SUBST([WORDPERFECT_CFLAGS])
AC_SUBST([WORDPERFECT_LIBS])


applix_pkgs="$gsf_req"
applix_deps="no"

if test "$enable_applix" != ""; then

PKG_CHECK_EXISTS([ $applix_pkgs ], 
[
	applix_deps="yes"
], [
	test "$enable_applix" = "auto" && AC_MSG_WARN([applix plugin: dependencies not satisfied - $applix_pkgs])
])

fi

if test "$enable_applix" = "yes" || \
   test "$applix_deps" = "yes"; then

PKG_CHECK_MODULES(APPLIX,[ $applix_pkgs ])

test "$enable_applix" = "auto" && PLUGINS="$PLUGINS applix"

APPLIX_CFLAGS="$APPLIX_CFLAGS "'${PLUGIN_CFLAGS}'
APPLIX_LIBS="$APPLIX_LIBS "'${PLUGIN_LIBS}'

if test "$enable_applix_builtin" = "yes"; then
	APPLIX_CFLAGS="$APPLIX_CFLAGS -DABI_PLUGIN_BUILTIN"
fi

fi

AC_SUBST([APPLIX_CFLAGS])
AC_SUBST([APPLIX_LIBS])


loadbindings_pkgs="$gsf_req"
loadbindings_deps="no"

if test "$enable_loadbindings" != ""; then

PKG_CHECK_EXISTS([ $loadbindings_pkgs ], 
[
	loadbindings_deps="yes"
], [
	test "$enable_loadbindings" = "auto" && AC_MSG_WARN([loadbindings plugin: dependencies not satisfied - $loadbindings_pkgs])
])

fi

if test "$enable_loadbindings" = "yes" || \
   test "$loadbindings_deps" = "yes"; then

PKG_CHECK_MODULES(LOADBINDINGS,[ $loadbindings_pkgs ])

test "$enable_loadbindings" = "auto" && PLUGINS="$PLUGINS loadbindings"

LOADBINDINGS_CFLAGS="$LOADBINDINGS_CFLAGS "'${PLUGIN_CFLAGS}'
LOADBINDINGS_LIBS="$LOADBINDINGS_LIBS "'${PLUGIN_LIBS}'

if test "$enable_loadbindings_builtin" = "yes"; then
	LOADBINDINGS_CFLAGS="$LOADBINDINGS_CFLAGS -DABI_PLUGIN_BUILTIN"
fi

fi

AC_SUBST([LOADBINDINGS_CFLAGS])
AC_SUBST([LOADBINDINGS_LIBS])


docbook_pkgs="$gsf_req"
docbook_deps="no"

if test "$enable_docbook" != ""; then

PKG_CHECK_EXISTS([ $docbook_pkgs ], 
[
	docbook_deps="yes"
], [
	test "$enable_docbook" = "auto" && AC_MSG_WARN([docbook plugin: dependencies not satisfied - $docbook_pkgs])
])

fi

if test "$enable_docbook" = "yes" || \
   test "$docbook_deps" = "yes"; then

AC_HEADER_TIME

PKG_CHECK_MODULES(DOCBOOK,[ $docbook_pkgs ])

test "$enable_docbook" = "auto" && PLUGINS="$PLUGINS docbook"

DOCBOOK_CFLAGS="$DOCBOOK_CFLAGS "'${PLUGIN_CFLAGS}'
DOCBOOK_LIBS="$DOCBOOK_LIBS "'${PLUGIN_LIBS}'

if test "$enable_docbook_builtin" = "yes"; then
	DOCBOOK_CFLAGS="$DOCBOOK_CFLAGS -DABI_PLUGIN_BUILTIN"
fi

fi

AC_SUBST([DOCBOOK_CFLAGS])
AC_SUBST([DOCBOOK_LIBS])


MIF_CFLAGS=
MIF_LIBS=

if test "$enable_mif" != ""; then

test "$enable_mif" = "auto" && PLUGINS="$PLUGINS mif"

MIF_CFLAGS="$MIF_CFLAGS "'${PLUGIN_CFLAGS}'
MIF_LIBS="$MIF_LIBS "'${PLUGIN_LIBS}'

if test "$enable_mif_builtin" = "yes"; then
	MIF_CFLAGS="$MIF_CFLAGS -DABI_PLUGIN_BUILTIN"
fi

fi

AC_SUBST([MIF_CFLAGS])
AC_SUBST([MIF_LIBS])


pdf_pkgs="$gsf_req"
pdf_deps="no"

PDF_CFLAGS=
PDF_LIBS=

if test "$enable_pdf" != ""; then

PKG_CHECK_EXISTS([ $pdf_pkgs ], 
[
	pdf_deps="yes"
], [
	test "$enable_pdf" = "auto" && AC_MSG_WARN([pdf plugin: dependencies not satisfied - $pdf_pkgs])
])

fi

if test "$enable_pdf" = "yes" || \
   test "$pdf_deps" = "yes"; then

PKG_CHECK_MODULES(PDF,[ $pdf_pkgs ])

test "$enable_pdf" = "auto" && PLUGINS="$PLUGINS pdf"

PDF_CFLAGS="$PDF_CFLAGS "'${PLUGIN_CFLAGS}'
PDF_LIBS="$PDF_LIBS "'${PLUGIN_LIBS}'

if test "$enable_pdf_builtin" = "yes"; then
	PDF_CFLAGS="$PDF_CFLAGS -DABI_PLUGIN_BUILTIN"
fi

fi

AC_SUBST([PDF_CFLAGS])
AC_SUBST([PDF_LIBS])


GOOGLE_CFLAGS=
GOOGLE_LIBS=

if test "$enable_google" != ""; then

test "$enable_google" = "auto" && PLUGINS="$PLUGINS google"

GOOGLE_CFLAGS="$GOOGLE_CFLAGS "'${PLUGIN_CFLAGS}'
GOOGLE_LIBS="$GOOGLE_LIBS "'${PLUGIN_LIBS}'

if test "$enable_google_builtin" = "yes"; then
	GOOGLE_CFLAGS="$GOOGLE_CFLAGS -DABI_PLUGIN_BUILTIN"
fi

fi

AC_SUBST([GOOGLE_CFLAGS])
AC_SUBST([GOOGLE_LIBS])


clarisworks_pkgs="$gsf_req"
clarisworks_deps="no"

if test "$enable_clarisworks" != ""; then

PKG_CHECK_EXISTS([ $clarisworks_pkgs ], 
[
	clarisworks_deps="yes"
], [
	test "$enable_clarisworks" = "auto" && AC_MSG_WARN([clarisworks plugin: dependencies not satisfied - $clarisworks_pkgs])
])

fi

if test "$enable_clarisworks" = "yes" || \
   test "$clarisworks_deps" = "yes"; then

PKG_CHECK_MODULES(CLARISWORKS,[ $clarisworks_pkgs ])

test "$enable_clarisworks" = "auto" && PLUGINS="$PLUGINS clarisworks"

CLARISWORKS_CFLAGS="$CLARISWORKS_CFLAGS "'${PLUGIN_CFLAGS}'
CLARISWORKS_LIBS="$CLARISWORKS_LIBS "'${PLUGIN_LIBS}'

if test "$enable_clarisworks_builtin" = "yes"; then
	CLARISWORKS_CFLAGS="$CLARISWORKS_CFLAGS -DABI_PLUGIN_BUILTIN"
fi

fi

AC_SUBST([CLARISWORKS_CFLAGS])
AC_SUBST([CLARISWORKS_LIBS])


LATEX_CFLAGS=
LATEX_LIBS=

# use libxslt if detected
libxslt_req='libxslt'
PKG_CHECK_EXISTS([ $libxslt_req ],
[
	abi_cv_libxslt="yes"
], [
	abi_cv_libxslt="no"
])
AM_CONDITIONAL([HAVE_LIBXSLT], test "$abi_cv_libxslt" = "yes")

if test "$enable_latex" != ""; then

test "$enable_latex" = "auto" && PLUGINS="$PLUGINS latex"

if test "$abi_cv_libxslt" = "yes"; then
	PKG_CHECK_MODULES(LIBXSLT,[$libxslt_req])
	LATEX_CFLAGS="$LATEX_CFLAGS "'${LIBXSLT_CFLAGS}'" -DHAVE_LIBXSLT"
	LATEX_LIBS="$LATEX_LIBS "'${LIBXSLT_LIBS}'
	AC_SUBST(ABIWORD_XSLTMLDIR, "${ABIWORD_DATADIR}/xsltml")
	PKG_CHECK_MODULES(LIBGSF, libgsf-1)
	LATEX_CFLAGS="$LATEX_CFLAGS "'${LIBGSF_CFLAGS}'
	LATEX_LIBS="$LATEX_LIBS "'${LIBGSF_LIBS}'
fi

LATEX_CFLAGS="$LATEX_CFLAGS "'${PLUGIN_CFLAGS}'
LATEX_LIBS="$LATEX_LIBS "'${PLUGIN_LIBS}'

if test "$enable_latex_builtin" = "yes"; then
	LATEX_CFLAGS="$LATEX_CFLAGS -DABI_PLUGIN_BUILTIN"
fi

fi

AC_SUBST([LATEX_CFLAGS])
AC_SUBST([LATEX_LIBS])


t602_pkgs="$gsf_req"
t602_deps="no"

if test "$enable_t602" != ""; then

PKG_CHECK_EXISTS([ $t602_pkgs ], 
[
	t602_deps="yes"
], [
	test "$enable_t602" = "auto" && AC_MSG_WARN([t602 plugin: dependencies not satisfied - $t602_pkgs])
])

fi

if test "$enable_t602" = "yes" || \
   test "$t602_deps" = "yes"; then

PKG_CHECK_MODULES(T602,[ $t602_pkgs ])

test "$enable_t602" = "auto" && PLUGINS="$PLUGINS t602"

T602_CFLAGS="$T602_CFLAGS "'${PLUGIN_CFLAGS}'
T602_LIBS="$T602_LIBS "'${PLUGIN_LIBS}'

if test "$enable_t602_builtin" = "yes"; then
	T602_CFLAGS="$T602_CFLAGS -DABI_PLUGIN_BUILTIN"
fi

fi

AC_SUBST([T602_CFLAGS])
AC_SUBST([T602_LIBS])


collab_req="libgsf-1 >= 1.12 libxml-2.0 >= 2.4.0"
collab_telepathy_req="dbus-glib-1 >= 0.70 telepathy-glib >= 0.14.5"
if test "$TOOLKIT_IS_GTK2" = "yes"; then
collab_xmpp_req="loudmouth-1.0 >= 1.3.2 gtk+-2.0"
else
collab_xmpp_req="loudmouth-1.0 >= 1.3.2 gtk+-3.0"
fi
collab_sugar_req="dbus-glib-1 >= 0.70"
collab_service_req="libsoup-2.4 gnutls"
collab_pkgs="$collab_req" 	# accumulate required packages

AC_ARG_ENABLE([collab-backend-fake], 
    [AS_HELP_STRING([--enable-collab-backend-fake], [Fake backend for debugging purposes only (default: off)])], 
[
	enable_collab_backend_fake=$enableval
], [
	enable_collab_backend_fake="no"
])
AC_MSG_CHECKING([for collab fake backend])
AC_MSG_RESULT([$enable_collab_backend_fake])


AC_ARG_ENABLE([collab-backend-telepathy], 
    [AS_HELP_STRING([--enable-collab-backend-telepathy], [Telepathy backend (default: auto)])], 
[
	enable_collab_backend_telepathy=$enableval
], [
	PKG_CHECK_EXISTS([ $collab_telepathy_req ],
	[
	    enable_collab_backend_telepathy="yes"
	], [
	    enable_collab_backend_telepathy="no"
	])
])
test "$enable_collab_backend_telepathy" = "yes" && collab_pkgs="$collab_pkgs $collab_telepathy_req"
AC_MSG_CHECKING([for collab telepathy backend])
AC_MSG_RESULT([$enable_collab_backend_telepathy])

AC_ARG_ENABLE([collab-backend-xmpp], 
    [AS_HELP_STRING([--enable-collab-backend-xmpp], [Jabber backend (default: auto)])], 
[
	enable_collab_backend_xmpp=$enableval
], [
	PKG_CHECK_EXISTS([ $collab_xmpp_req ],
	[
		enable_collab_backend_xmpp="yes"
	], [
		enable_collab_backend_xmpp="no"
	])
])
test "$enable_collab_backend_xmpp" = "yes" && collab_pkgs="$collab_pkgs $collab_xmpp_req"
AC_MSG_CHECKING([for collab xmpp backend])
AC_MSG_RESULT([$enable_collab_backend_xmpp])

AC_ARG_ENABLE([collab-backend-tcp], 
    [AS_HELP_STRING([--enable-collab-backend-tcp], [TCP backend (default: auto)])], 
[
	enable_collab_backend_tcp=$enableval
	if test "$enable_collab_backend_tcp" != "no"; then
		AC_LANG_PUSH(C++)
		AC_CHECK_HEADERS([asio.hpp], [], 
		[
			AC_MSG_ERROR([collab plugin: asio is required for the collab plugin TCP backend, see http://think-async.com/])
		])
		AC_LANG_POP
	fi
], [
	AC_LANG_PUSH(C++)
	AC_CHECK_HEADERS([asio.hpp], 
	[
		enable_collab_backend_tcp="yes"
	])
	AC_LANG_POP
])
AC_MSG_CHECKING([for collab tcp backend])
AC_MSG_RESULT([$enable_collab_backend_tcp])

AC_ARG_ENABLE([collab-backend-sugar], 
    [AS_HELP_STRING([--enable-collab-backend-sugar], [Sugar/OLPC backend (default: auto)])], 
[
	enable_collab_backend_sugar=$enableval
], [
	PKG_CHECK_EXISTS([ $collab_sugar_req ],
	[
		enable_collab_backend_sugar="yes"
	], [
		enable_collab_backend_sugar="no"
	])
])
test "$enable_collab_backend_sugar" = "yes" && collab_pkgs="$collab_pkgs $collab_sugar_req"
AC_MSG_CHECKING([for collab sugar backend])
AC_MSG_RESULT([$enable_collab_backend_sugar])

AC_ARG_ENABLE([collab-backend-service], 
    [AS_HELP_STRING([--enable-collab-backend-service], [abicollab.net backend (default: auto)])], 
[
	enable_collab_backend_service=$enableval
	if test "$enable_collab_backend_service" != "no"; then
		AC_LANG_PUSH(C++)
		AC_CHECK_HEADERS([asio.hpp], [], 
		[
			AC_MSG_ERROR([collab plugin: asio is required for the the abicollab.net backend, see http://think-async.com/])
		])
		AC_LANG_POP
	fi
], [
	AC_LANG_PUSH(C++)
	AC_CHECK_HEADERS([asio.hpp],
	[
		enable_collab_backend_service="yes"
	])
	AC_LANG_POP
])
test "$enable_collab_backend_service" = "yes" && collab_pkgs="$collab_pkgs $collab_service_req"
AC_MSG_CHECKING([for collab service backend])
AC_MSG_RESULT([$enable_collab_backend_service])

AC_ARG_ENABLE([collab-backend-sip], 
    [AS_HELP_STRING([--enable-collab-backend-sip], [Experimental SIP backend (default: off)])], 
[
	enable_collab_backend_sipsimple=$enableval
], [
	enable_collab_backend_sipsimple="no"
])
AC_MSG_CHECKING([for collab sip backend])
AC_MSG_RESULT([$enable_collab_backend_sipsimple])

AC_ARG_ENABLE([collab-record-always], 
    [AS_HELP_STRING([--enable-collab-record-always], [Always record AbiCollab sessions (default: off)])], 
[
	enable_collab_record_always=$enableval
], [
	enable_collab_record_always="no"
])
AC_MSG_CHECKING([for collab always recording backend])
AC_MSG_RESULT([$enable_collab_record_always])

collab_deps="no"

if test "$enable_collab" != ""; then

PKG_CHECK_EXISTS([ $collab_pkgs ], 
[
	collab_deps="yes"
])

fi

if test "$enable_collab" = "yes" || \
   test "$collab_deps" = "yes"; then

if test "$enable_collab_builtin" = "yes"; then
AC_MSG_ERROR([collab plugin: static linking not supported])
fi

PKG_CHECK_MODULES(COLLAB,[ $collab_pkgs ])

if test "$enable_collab_backend_fake" = "yes"; then
	COLLAB_CFLAGS="$COLLAB_CFLAGS -DABICOLLAB_HANDLER_FAKE"
	COLLAB_RCFLAGS="$COLLAB_RCFLAGS -DABICOLLAB_HANDLER_FAKE"
fi
if test "$enable_collab_backend_telepathy" = "yes"; then
	COLLAB_CFLAGS="$COLLAB_CFLAGS -DABICOLLAB_HANDLER_TELEPATHY"
	COLLAB_RCFLAGS="$COLLAB_RCFLAGS -DABICOLLAB_HANDLER_TELEPATHY"
fi
if test "$enable_collab_backend_xmpp" = "yes"; then
	COLLAB_CFLAGS="$COLLAB_CFLAGS -DABICOLLAB_HANDLER_XMPP"
	COLLAB_RCFLAGS="$COLLAB_RCFLAGS -DABICOLLAB_HANDLER_XMPP"
fi
if test "$enable_collab_backend_tcp" = "yes"; then
	COLLAB_CFLAGS="$COLLAB_CFLAGS -DABICOLLAB_HANDLER_TCP"
	COLLAB_RCFLAGS="$COLLAB_RCFLAGS -DABICOLLAB_HANDLER_TCP"
fi
if test "$enable_collab_backend_sugar" = "yes"; then
	COLLAB_CFLAGS="$COLLAB_CFLAGS -DABICOLLAB_HANDLER_SUGAR"
	COLLAB_RCFLAGS="$COLLAB_RCFLAGS -DABICOLLAB_HANDLER_SUGAR"
fi
if test "$enable_collab_backend_service" = "yes"; then
	COLLAB_CFLAGS="$COLLAB_CFLAGS -DABICOLLAB_HANDLER_SERVICE -DSOUP24"
	COLLAB_RCFLAGS="$COLLAB_RCFLAGS -DABICOLLAB_HANDLER_SERVICE"
fi
if test "$enable_collab_backend_sipsimple" = "yes"; then
	COLLAB_CFLAGS="$COLLAB_CFLAGS -DABICOLLAB_HANDLER_SIPSIMPLE"
	COLLAB_RCFLAGS="$COLLAB_RCFLAGS -DABICOLLAB_HANDLER_SIPSIMPLE"
fi
if test "$enable_collab_record_always" = "yes"; then
	COLLAB_CFLAGS="$COLLAB_CFLAGS -DABICOLLAB_RECORD_ALWAYS"
	COLLAB_RCFLAGS="$COLLAB_RCFLAGS -DABICOLLAB_RECORD_ALWAYS"
fi

if test "$enable_collab_backend_tcp" = "yes" || \
   test "$enable_collab_backend_service" = "yes"; then
	COLLAB_LIBS="$COLLAB_LIBS -lgcrypt"
	if test "$TOOLKIT" != "win"; then
		COLLAB_LIBS="$COLLAB_LIBS -lpthread"
	fi
fi


test "$enable_collab" = "auto" && PLUGINS="$PLUGINS collab"

COLLAB_CFLAGS="$COLLAB_CFLAGS "'${PLUGIN_CFLAGS}'
COLLAB_LIBS="$COLLAB_LIBS "'${PLUGIN_LIBS}'

fi # plugin conditional

AM_CONDITIONAL([COLLAB_BACKEND_FAKE], [test "$enable_collab_backend_fake" = "yes"])
AM_CONDITIONAL([COLLAB_BACKEND_TELEPATHY], [test "$enable_collab_backend_telepathy" = "yes"])
AM_CONDITIONAL([COLLAB_BACKEND_XMPP], [test "$enable_collab_backend_xmpp" = "yes"])
AM_CONDITIONAL([COLLAB_BACKEND_TCP], [test "$enable_collab_backend_tcp" = "yes"])
AM_CONDITIONAL([COLLAB_BACKEND_SUGAR], [test "$enable_collab_backend_sugar" = "yes"])
AM_CONDITIONAL([COLLAB_BACKEND_SERVICE], [test "$enable_collab_backend_service" = "yes"])
AM_CONDITIONAL([COLLAB_BACKEND_SIPSIMPLE], [test "$enable_collab_backend_sipsimple" = "yes"])
AM_CONDITIONAL([COLLAB_RECORD_ALWAYS], [test "$enable_collab_record_always" = "yes"])

AC_SUBST([COLLAB_CFLAGS])
AC_SUBST([COLLAB_RCFLAGS])
AC_SUBST([COLLAB_LIBS])


mswrite_pkgs="$gsf_req"
mswrite_deps="no"

if test "$enable_mswrite" != ""; then

PKG_CHECK_EXISTS([ $mswrite_pkgs ], 
[
	mswrite_deps="yes"
], [
	test "$enable_mswrite" = "auto" && AC_MSG_WARN([mswrite plugin: dependencies not satisfied - $mswrite_pkgs])
])

fi

if test "$enable_mswrite" = "yes" || \
   test "$mswrite_deps" = "yes"; then

PKG_CHECK_MODULES(MSWRITE,[ $mswrite_pkgs ])

test "$enable_mswrite" = "auto" && PLUGINS="$PLUGINS mswrite"

MSWRITE_CFLAGS="$MSWRITE_CFLAGS "'${PLUGIN_CFLAGS}'
MSWRITE_LIBS="$MSWRITE_LIBS "'${PLUGIN_LIBS}'

if test "$enable_mswrite_builtin" = "yes"; then
	MSWRITE_CFLAGS="$MSWRITE_CFLAGS -DABI_PLUGIN_BUILTIN"
fi

fi

AC_SUBST([MSWRITE_CFLAGS])
AC_SUBST([MSWRITE_LIBS])


ISCII_CFLAGS=
ISCII_LIBS=

if test "$enable_iscii" != ""; then

test "$enable_iscii" = "auto" && PLUGINS="$PLUGINS iscii"

ISCII_CFLAGS="$ISCII_CFLAGS "'${PLUGIN_CFLAGS}'
ISCII_LIBS="$ISCII_LIBS "'${PLUGIN_LIBS}'

if test "$enable_iscii_builtin" = "yes"; then
	ISCII_CFLAGS="$ISCII_CFLAGS -DABI_PLUGIN_BUILTIN"
fi

fi

AC_SUBST([ISCII_CFLAGS])
AC_SUBST([ISCII_LIBS])


openxml_pkgs="libgsf-1 >= 1.14.4"
openxml_deps="no"

if test "$enable_openxml" != ""; then

PKG_CHECK_EXISTS([ $openxml_pkgs ], 
[
	openxml_deps="yes"
	], [
	test "$enable_openxml" = "auto" && AC_MSG_WARN([openxml plugin: dependencies not satisfied - $openxml_pkgs])
])

AC_SUBST(ABIWORD_OMMLXSLTDIR, "${ABIWORD_DATADIR}/omml_xslt")

fi

if test "$enable_openxml" = "yes" || \
   test "$openxml_deps" = "yes"; then

PKG_CHECK_MODULES(OPENXML,[ $openxml_pkgs ])

test "$enable_openxml" = "auto" && PLUGINS="$PLUGINS openxml"

OPENXML_CFLAGS="$OPENXML_CFLAGS "'${PLUGIN_CFLAGS}'
OPENXML_LIBS="$OPENXML_LIBS "'${PLUGIN_LIBS}'

if test "$enable_openxml_builtin" = "yes"; then
	OPENXML_CFLAGS="$OPENXML_CFLAGS -DABI_PLUGIN_BUILTIN"
fi

fi

AC_SUBST([OPENXML_CFLAGS])
AC_SUBST([OPENXML_LIBS])


WIKIPEDIA_CFLAGS=
WIKIPEDIA_LIBS=

if test "$enable_wikipedia" != ""; then

test "$enable_wikipedia" = "auto" && PLUGINS="$PLUGINS wikipedia"

WIKIPEDIA_CFLAGS="$WIKIPEDIA_CFLAGS "'${PLUGIN_CFLAGS}'
WIKIPEDIA_LIBS="$WIKIPEDIA_LIBS "'${PLUGIN_LIBS}'

if test "$enable_wikipedia_builtin" = "yes"; then
	WIKIPEDIA_CFLAGS="$WIKIPEDIA_CFLAGS -DABI_PLUGIN_BUILTIN"
fi

fi

AC_SUBST([WIKIPEDIA_CFLAGS])
AC_SUBST([WIKIPEDIA_LIBS])


pdb_pkgs="$gsf_req"
pdb_deps="no"

if test "$enable_pdb" != ""; then

PKG_CHECK_EXISTS([ $pdb_pkgs ], 
[
	pdb_deps="yes"
], [
	test "$enable_pdb" = "auto" && AC_MSG_WARN([pdb plugin: dependencies not satisfied - $pdb_pkgs])
])

fi

if test "$enable_pdb" = "yes" || \
   test "$pdb_deps" = "yes"; then

PKG_CHECK_MODULES(PDB,[ $pdb_pkgs ])

test "$enable_pdb" = "auto" && PLUGINS="$PLUGINS pdb"

PDB_CFLAGS="$PDB_CFLAGS "'${PLUGIN_CFLAGS}'
PDB_LIBS="$PDB_LIBS "'${PLUGIN_LIBS}'

if test "$enable_pdb_builtin" = "yes"; then
	PDB_CFLAGS="$PDB_CFLAGS -DABI_PLUGIN_BUILTIN"
fi

fi

AC_SUBST([PDB_CFLAGS])
AC_SUBST([PDB_LIBS])


mathview_pkgs='mathview-frontend-libxml2 >= 0.7.5'
mathview_deps="no"

# test hashmap availablity
HASHMAP_CFLAGS=""
AC_LANG(C++)
AC_CHECK_HEADER(hash_map,
[
	HASHMAP_CFLAGS="-DHAVE_HASH_MAP"
], [
	AC_CHECK_HEADER(ext/hash_map,
	[
		HASHMAP_CFLAGS="-DHAVE_EXT_HASH_MAP"
	], [
		AC_MSG_WARN([mathview plugin: dependencies not satisfied - missing 'hash_map' or 'ext/hash_map' header])
	])
])
AC_LANG(C)

if test "$HASHMAP_CFLAGS" != ""; then

if test "$enable_mathview" != ""; then

PKG_CHECK_EXISTS([ $mathview_pkgs ], 
[
	mathview_deps="yes"
], [
	test "$enable_mathview" = "auto" && AC_MSG_WARN([mathview plugin: dependencies not satisfied - $mathview_pkgs])
])

fi

if test "$enable_mathview" = "yes" || \
   test "$mathview_deps" = "yes"; then

if test "$enable_mathview_builtin" = "yes"; then
AC_MSG_ERROR([mathview plugin: static linking not supported])
fi

PKG_CHECK_MODULES(MATHVIEW,[ $mathview_pkgs ])

test "$enable_mathview" = "auto" && PLUGINS="$PLUGINS mathview"

MATHVIEW_CFLAGS="$MATHVIEW_CFLAGS $HASHMAP_CFLAGS "'${PLUGIN_CFLAGS}'
MATHVIEW_LIBS="$MATHVIEW_LIBS "'${PLUGIN_LIBS}'

fi

fi

# need to unconditionally test, for `make distcheck'
AM_PROG_LEX
AC_PROG_YACC

AC_SUBST([MATHVIEW_CFLAGS])
AC_SUBST([MATHVIEW_LIBS])


URLDICT_CFLAGS=
URLDICT_LIBS=

if test "$enable_urldict" != ""; then

test "$enable_urldict" = "auto" && PLUGINS="$PLUGINS urldict"

URLDICT_CFLAGS="$URLDICT_CFLAGS "'${PLUGIN_CFLAGS}'
URLDICT_LIBS="$URLDICT_LIBS "'${PLUGIN_LIBS}'

if test "$enable_urldict_builtin" = "yes"; then
	URLDICT_CFLAGS="$URLDICT_CFLAGS -DABI_PLUGIN_BUILTIN"
fi

fi

AC_SUBST([URLDICT_CFLAGS])
AC_SUBST([URLDICT_LIBS])


AC_ARG_WITH([libwmf-config],
	[AS_HELP_STRING([--with-libwmf-config=DIR], [use libwmf-config in DIR])],
[
	AC_PATH_PROG(libwmfconfig, libwmf-config, , "$withval")
], [
	AC_PATH_PROG(libwmfconfig, libwmf-config)
])

# The required libwmf version, as reported by libwmf-config
libwmf_major_req=0
libwmf_minor_req=2
libwmf_micro_req=8
wmf_deps="no"

if test "$enable_wmf" != ""; then

	if test "$libwmfconfig" = ""; then
		if test "$enable_wmf" = "yes"; then
		  AC_MSG_ERROR([wmf plugin: program libwmf-config not found in path])
		else
		  AC_MSG_WARN([wmf plugin: program libwmf-config not found in path])
		fi
	else
		IFS_old="$IFS"
		IFS='.'
		set -- `$libwmfconfig --version`
		libwmf_major_found="${1}"
		libwmf_minor_found="${2}"
		libwmf_micro_found="${3}"
		IFS="$IFS_old"
		if test "$libwmf_major_found" -gt "$libwmf_major_req"; then
			wmf_deps="yes"
		elif test "$libwmf_major_found" -eq "$libwmf_major_req" &&
		     test "$libwmf_minor_found" -gt "$libwmf_minor_req"; then
			wmf_deps="yes"
		elif test "$libwmf_major_found" -eq "$libwmf_major_req" &&
		     test "$libwmf_minor_found" -eq "$libwmf_minor_req" &&
		     test "$libwmf_micro_found" -ge "$libwmf_micro_req"; then
			wmf_deps="yes"
		fi
	fi
fi

if test "$enable_wmf" = "yes" || \
   test "$wmf_deps" = "yes"; then

if test "$enable_wmf_builtin" = "yes"; then
AC_MSG_ERROR([wmf plugin: static linking not supported])
fi

AC_MSG_CHECKING([for libwmf >= ${libwmf_major_req}.${libwmf_minor_req}.${libwmf_micro_req}])
if test "$wmf_deps" = "yes"; then
	AC_MSG_RESULT([version ${libwmf_major_found}.${libwmf_minor_found}.${libwmf_micro_found} (ok)])
	WMF_CFLAGS=`$libwmfconfig --cflags`
	WMF_LIBS=`$libwmfconfig --libs`
else
	AC_MSG_ERROR([version ${libwmf_major_found}.${libwmf_minor_found}.${libwmf_micro_found} (too old!)])
fi

test "$enable_wmf" = "auto" && PLUGINS="$PLUGINS wmf"

WMF_CFLAGS="$WMF_CFLAGS "'${PLUGIN_CFLAGS}'
WMF_LIBS="$WMF_LIBS "'${PLUGIN_LIBS}'

fi

AC_SUBST([WMF_CFLAGS])
AC_SUBST([WMF_LIBS])


hancom_pkgs="$gsf_req"
hancom_deps="no"

if test "$enable_hancom" != ""; then

PKG_CHECK_EXISTS([ $hancom_pkgs ], 
[
	hancom_deps="yes"
], [
	test "$enable_hancom" = "auto" && AC_MSG_WARN([hancom plugin: dependencies not satisfied - $hancom_pkgs])
])

fi

if test "$enable_hancom" = "yes" || \
   test "$hancom_deps" = "yes"; then

PKG_CHECK_MODULES(HANCOM,[ $hancom_pkgs ])

test "$enable_hancom" = "auto" && PLUGINS="$PLUGINS hancom"

HANCOM_CFLAGS="$HANCOM_CFLAGS "'${PLUGIN_CFLAGS}'
HANCOM_LIBS="$HANCOM_LIBS "'${PLUGIN_LIBS}'

if test "$enable_hancom_builtin" = "yes"; then
	HANCOM_CFLAGS="$HANCOM_CFLAGS -DABI_PLUGIN_BUILTIN"
fi

fi

AC_SUBST([HANCOM_CFLAGS])
AC_SUBST([HANCOM_LIBS])


epub_pkgs="libgsf-1 >= 1.14.4"
epub_deps="no"

if test "$enable_epub" != ""; then

PKG_CHECK_EXISTS([ $epub_pkgs ], 
[
	epub_deps="yes"
	], [
	test "$enable_epub" = "auto" && AC_MSG_WARN([epub plugin: dependencies not satisfied - $epub_pkgs])
])

fi

if test "$enable_epub" = "yes" || \
   test "$epub_deps" = "yes"; then

PKG_CHECK_MODULES(EPUB,[ $epub_pkgs ])

test "$enable_epub" = "auto" && PLUGINS="$PLUGINS epub"

EPUB_CFLAGS="$EPUB_CFLAGS "'${PLUGIN_CFLAGS}'
EPUB_LIBS="$EPUB_LIBS "'${PLUGIN_LIBS}'

if test "$enable_epub_builtin" = "yes"; then
	EPUB_CFLAGS="$EPUB_CFLAGS -DABI_PLUGIN_BUILTIN"
fi

fi

AC_SUBST([EPUB_CFLAGS])
AC_SUBST([EPUB_LIBS])


kword_pkgs="$gsf_req"
kword_deps="no"

if test "$enable_kword" != ""; then

PKG_CHECK_EXISTS([ $kword_pkgs ], 
[
	kword_deps="yes"
], [
	test "$enable_kword" = "auto" && AC_MSG_WARN([kword plugin: dependencies not satisfied - $kword_pkgs])
])

fi

if test "$enable_kword" = "yes" || \
   test "$kword_deps" = "yes"; then

PKG_CHECK_MODULES(KWORD,[ $kword_pkgs ])

test "$enable_kword" = "auto" && PLUGINS="$PLUGINS kword"

KWORD_CFLAGS="$KWORD_CFLAGS "'${PLUGIN_CFLAGS}'
KWORD_LIBS="$KWORD_LIBS "'${PLUGIN_LIBS}'

if test "$enable_kword_builtin" != ""; then
	KWORD_CFLAGS="$KWORD_CFLAGS -DABI_PLUGIN_BUILTIN"
fi

fi

AC_SUBST([KWORD_CFLAGS])
AC_SUBST([KWORD_LIBS])


rsvg_pkgs="librsvg-2.0 >= 2.0 glib-2.0"
rsvg_deps="no"

if test "$TOOLKIT" = "gtk"; then
 
 if test "$enable_rsvg" = "auto"; then
   AC_MSG_WARN([rsvg plugin: not needed with gtk])
 fi
 enable_rsvg=""
fi

if test "$enable_rsvg" != ""; then

PKG_CHECK_EXISTS([ $rsvg_pkgs ], 
[
	rsvg_deps="yes"
], [
	test "$enable_rsvg" = "auto" && AC_MSG_WARN([rsvg plugin: dependencies not satisfied - $rsvg_pkgs])
])

fi

if test "$enable_rsvg" = "yes" || \
   test "$rsvg_deps" = "yes"; then

if test "$enable_rsvg_builtin" = "yes"; then
AC_MSG_ERROR([rsvg plugin: static linking not supported])
fi

PKG_CHECK_MODULES(RSVG,[ $rsvg_pkgs ])

test "$enable_rsvg" = "auto" && PLUGINS="$PLUGINS rsvg"

RSVG_CFLAGS="$RSVG_CFLAGS "'${PLUGIN_CFLAGS}'
RSVG_LIBS="$RSVG_LIBS "'${PLUGIN_LIBS}'

fi

AC_SUBST([RSVG_CFLAGS])
AC_SUBST([RSVG_LIBS])