summaryrefslogtreecommitdiff
path: root/legacy/evas/configure.in
blob: bb9212e5f177a530eb4bb81f8f6f97b91cc82ad3 (plain)
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
# get rid of that stupid cache mechanism
rm -f config.cache

AC_INIT(configure.in)
AC_CANONICAL_BUILD
AC_CANONICAL_HOST
AC_ISC_POSIX
AM_INIT_AUTOMAKE(evas, 0.9.9.037)
AM_CONFIG_HEADER(config.h)

AC_C_BIGENDIAN
AC_PROG_CC
AM_PROG_CC_STDC
AC_HEADER_STDC
AC_C_CONST
AM_ENABLE_SHARED
AM_PROG_LIBTOOL
AC_FUNC_ALLOCA

MODULE_ARCH="$host_os-$host_cpu"
AC_SUBST(MODULE_ARCH)
AC_DEFINE_UNQUOTED(MODULE_ARCH, "$MODULE_ARCH", "Module architecture")

create_shared_lib=""
case "$host_os" in
	mingw|mingw32)
		create_shared_lib="-no-undefined "
		;;
esac
AC_SUBST(create_shared_lib)

if test "x${bindir}" = 'xNONE'; then
  if test "x${prefix}" = "xNONE"; then
    PACKAGE_BIN_DIR="${ac_default_prefix}/bin"
  else
    PACKAGE_BIN_DIR="${prefix}/bin"
  fi
else
  PACKAGE_BIN_DIR="${bindir}"
fi
AC_SUBST(PACKAGE_BIN_DIR)

if test "x${libdir}" = 'xNONE'; then
  if test "x${prefix}" = "xNONE"; then
    PACKAGE_LIB_DIR="${ac_default_prefix}/lib"
  else
    PACKAGE_LIB_DIR="${prefix}/lib"
  fi
else
  PACKAGE_LIB_DIR="${libdir}"
fi
AC_SUBST(PACKAGE_LIB_DIR)
		
if test "x${prefix}" = "xNONE"; then
  PACKAGE_DATA_DIR="${ac_default_prefix}/share/${PACKAGE}"
else
  PACKAGE_DATA_DIR="${prefix}/share/${PACKAGE}"
fi
AC_SUBST(PACKAGE_DATA_DIR)

x_dir=""
x_cflags=""
x_libs=""
xcb_dir=""
xcb_cflags=""
xcb_libs=""
gl_dir=""
gl_cflags=""
gl_libs=""
qt_dir=""
qt_cflags=""
qt_libs=""				 
qt_moc="moc"

#####################################################################

# blah-config style checks
# qtdir setting
AC_ARG_WITH(qtdir,
AC_HELP_STRING([--with-qtdir=QT_DIR],[use qt directory specified]),
[ 
  qt_dir=$withval;
  echo "using "$qt_dir" for qt directory.";
],[
  qt_dir="/opt/Qtopia";
])
# check for freetype
PKG_CHECK_MODULES(FREETYPE, freetype2 >= 9.3.0)

#######################################
## FontConfig

AC_ARG_ENABLE(fontconfig,
  AC_HELP_STRING(
    [--enable-fontconfig],
    [enable fontconfig for finding fonts. [[default=enabled]]]
  ), [
    have_fontconfig=$enableval
  ], [
    have_fontconfig=yes
  ]
)

if test "x$have_fontconfig" = "xyes"; then
  # Check if really available
  PKG_CHECK_MODULES(FONTCONFIG, fontconfig, [ 
    have_fontconfig="yes"
    AC_DEFINE(HAVE_FONTCONFIG, 1, [have fontconfig searching capabilities])
  ], [
    have_fontconfig="no"
  ])
fi

###############   
## dlopen

dlopen_libs=""
case "$host_os" in
  mingw|mingw32)
    AC_CHECK_HEADER(windows.h, [], [AC_MSG_ERROR(Cannot find windows.h)])
  ;;
  *)
    AC_CHECK_FUNCS(dlopen, res=yes, res=no)
    if test "x$res" = "xyes"; then
      AC_CHECK_FUNCS(dladdr, AC_DEFINE(HAVE_DLADDR))
    else
      AC_CHECK_LIB(dl, dlopen, res=yes, res=no)
      if test "x$res" = "xyes"; then
        AC_CHECK_LIB(dl, dladdr, AC_DEFINE(HAVE_DLADDR))
        dlopen_libs=-ldl
      else
        AC_MSG_ERROR(Cannot find dlopen)
      fi
    fi
esac
AC_SUBST(dlopen_libs)

#####################################################################
## Engines

#######################################
## Check if we should build the software_x11 engine
have_evas_software_x11="no";
## Automatic check...
AC_CHECK_HEADER(X11/X.h,
  [ have_evas_software_x11="yes" ],
  [ have_evas_software_x11="no" ]
)
## Manual override
AC_MSG_CHECKING(whether software x11 backend is to be built)
AC_ARG_ENABLE(software-x11, AC_HELP_STRING([--enable-software-x11],[enable the Software X11 rendering backend]), [
	   if test x"$enableval" = x"yes" ; then
	     AC_MSG_RESULT(yes)
	     have_evas_software_x11="yes"
	   else
	     AC_MSG_RESULT(no)
	     have_evas_software_x11="no"
	   fi
        ], [
	   AC_MSG_RESULT($have_evas_software_x11)
	]
)
if test "x$have_evas_software_x11" = "xyes"; then
  AC_PATH_XTRA
  AC_CHECK_HEADER(X11/X.h,
    [
      AC_DEFINE(BUILD_ENGINE_SOFTWARE_X11, 1, [Software X11 Rendering Backend])
      x_dir=${x_dir:-/usr/X11R6}
      x_cflags=${x_cflags:--I${x_includes:-$x_dir/include}}
      x_libs="${x_libs:--L${x_libraries:-$x_dir/lib}} -lX11 -lXext"
    ],
    [
      AC_MSG_RESULT(disabling software X11 engine)
      have_evas_software_x11="no"
    ]
  )
fi
AM_CONDITIONAL(BUILD_ENGINE_SOFTWARE_X11, test "x$have_evas_software_x11" = "xyes")

#######################################
## Check if we should build the software_xcb engine
have_evas_software_xcb="no";
## Automatic check...
PKG_CHECK_MODULES(
  XCB,
  xcb xcb-shm xcb-image,
  [have_evas_software_xcb="yes"],
  [have_evas_software_xcb="no"],
  [ have_evas_software_xcb="no" ])

## manually disable xcb engine by default - not auto detected.
have_evas_software_xcb="no"
## Manual override
AC_MSG_CHECKING(whether software xcb backend is to be built)
AC_ARG_ENABLE(software-xcb, AC_HELP_STRING([--enable-software-xcb],[enable the Software XCB rendering backend]), [
	   if test x"$enableval" = x"yes" ; then
	     AC_MSG_RESULT(yes)
	     have_evas_software_xcb="yes"
	   else
	     AC_MSG_RESULT(no)
	     have_evas_software_xcb="no"
	   fi
        ], [
	   AC_MSG_RESULT($have_evas_software_xcb)
	]
)
if test "x$have_evas_software_xcb" = "xyes"; then
  PKG_CHECK_MODULES(
    XCB,
    xcb xcb-shm xcb-image,
    [AC_DEFINE(BUILD_ENGINE_SOFTWARE_XCB, 1, [Software XCB Rendering Backend])
     xcb_cflags=$XCB_CFLAGS
     xcb_libs=$XCB_LIBS],
    [AC_MSG_RESULT(disabling software XCB engine)
     have_evas_software_xcb="no"])
fi
AM_CONDITIONAL(BUILD_ENGINE_SOFTWARE_XCB, test "x$have_evas_software_xcb" = "xyes")

#######################################
## Check if we should build the directfb engine
have_evas_directfb="no";
## Automatic check...
PKG_CHECK_MODULES(DIRECTFB, directfb >= 0.9.16,
  [ have_evas_directfb="yes" ],
  [ have_evas_directfb="no" ]
)
## manually disable directfb engine by default - not auto detected.
have_evas_directfb="no"
## Manual override
AC_MSG_CHECKING(whether directfb backend is to be built)
AC_ARG_ENABLE(directfb, AC_HELP_STRING([--enable-directfb],[enable the DirectFB rendering backend]), [
	   if test x"$enableval" = x"yes" ; then
	     AC_MSG_RESULT(yes)
	     have_evas_directfb="yes"
	   else
	     AC_MSG_RESULT(no)
	     have_evas_directfb="no"
	   fi
	], [
	   AC_MSG_RESULT($have_evas_directfb)
	]
)
if test "x$have_evas_directfb" = "xyes"; then
  PKG_CHECK_MODULES(DIRECTFB, directfb >= 0.9.16,
    [
      AC_DEFINE(BUILD_ENGINE_DIRECTFB, 1, [DirectFB Rendering Backend])
    ], [
      AC_MSG_RESULT(disabling directfb engine)
      have_evas_directfb="no"
    ]
  )
fi
AM_CONDITIONAL(BUILD_ENGINE_DIRECTFB, test "x$have_evas_directfb" = "xyes")

#######################################
## Check if we should build the fb engine
have_evas_fb="no";
## Automatic check...
AC_CHECK_HEADER(linux/fb.h,
  [ have_evas_fb="yes" ],
  [ have_evas_fb="no" ]
)
## Manual override
AC_MSG_CHECKING(whether fb backend is to be built)
AC_ARG_ENABLE(fb, AC_HELP_STRING([--enable-fb],[enable the FB rendering backend]), [
	   if test x"$enableval" = x"yes" ; then
	     AC_MSG_RESULT(yes)
	     have_evas_fb="yes"
	   else
	     AC_MSG_RESULT(no)
	     have_evas_fb="no"
	   fi
	], [
	   AC_MSG_RESULT($have_evas_fb)
	]
)
if test "x$have_evas_fb" = "xyes"; then
  AC_CHECK_HEADER(linux/fb.h,
    [
      AM_CONDITIONAL(BUILD_ENGINE_FB, true)
      AC_DEFINE(BUILD_ENGINE_FB, 1, [Linux FB Rendering Backend])
    ], [
      AM_CONDITIONAL(BUILD_ENGINE_FB, false)
      AC_MSG_RESULT(disabling fb engine)
      have_evas_fb="no"
    ]
  )
else
  AM_CONDITIONAL(BUILD_ENGINE_FB, false)
  have_evas_fb="no"
fi

#######################################
## Check if we should build the buffer engine
have_evas_buffer="no";
## Automatic check...
have_evas_buffer="yes"
## Manual override
AC_MSG_CHECKING(whether buffer backend is to be built)
AC_ARG_ENABLE(buffer, AC_HELP_STRING([--enable-buffer],[enable the Buffer rendering backend]), [
	   if test x"$enableval" = x"yes" ; then
	     AC_MSG_RESULT(yes)
	     have_evas_buffer="yes"
	   else
	     AC_MSG_RESULT(no)
	     have_evas_buffer="no"
	   fi
	], [
	   AC_MSG_RESULT($have_evas_buffer)
	]
)
if test "x$have_evas_buffer" = "xyes"; then
  AM_CONDITIONAL(BUILD_ENGINE_BUFFER, true)
  AC_DEFINE(BUILD_ENGINE_BUFFER, 1, [Buffer Rendering Backend])
else
  AM_CONDITIONAL(BUILD_ENGINE_BUFFER, false)
fi

#######################################
## Check if we should build the software_qtopia engine
have_evas_qtopia="no";
## Automatic check...
AC_CHECK_HEADER(qdirectpainter_qws.h,
  [ have_evas_qtopia="yes" ],
  [ have_evas_qtopia="no" ],
  [
    #include <qwidget.h>
    #include <qnamespace.h>
    #include <qbrush.h>
    #include <qpainter.h>
  ]
)
## manually disable qtopia engine by default - not auto detected.
have_evas_qtopia="no"
## Manual override
AC_MSG_CHECKING(whether software qtopia backend is to be built)
AC_ARG_ENABLE(software-qtopia, [  --enable-software-qtopia        enable the Software Qtopia rendering backend], [
	   if test x"$enableval" = x"yes" ; then
	     AC_MSG_RESULT(yes)
	     have_evas_qtopia="yes"
	   else
	     AC_MSG_RESULT(no)
	     have_evas_qtopia="no"
	   fi
        ], [
	   AC_MSG_RESULT($have_evas_qtopia)
	]
)
if test "x$have_evas_qtopia" = "xyes"; then
  AC_PROG_CXX
  AC_CHECK_HEADER(qdirectpainter_qws.h,
    [
      AM_CONDITIONAL(BUILD_ENGINE_SOFTWARE_QTOPIA, test "$enableval" = "yes")
      AC_DEFINE(BUILD_ENGINE_SOFTWARE_QTOPIA, 1, [Qtopia Rendering Backend])
      qt_cflags="-fno-exceptions -fno-rtti -I"$qt_dir"/include"
      qt_libs="-L"$qt_dir"/lib -lqte -lqpe"
      qt_moc=$qt_dir"/bin/moc"
    ], [
      AM_CONDITIONAL(BUILD_ENGINE_SOFTWARE_QTOPIA, false)
      AC_MSG_RESULT(disabling qtopia engine)
      have_evas_qtopia="no"
    ],
    [
      #include <qwidget.h>
      #include <qnamespace.h>
      #include <qbrush.h>
      #include <qpainter.h>
    ]
  )
else
  AM_CONDITIONAL(BUILD_ENGINE_SOFTWARE_QTOPIA, false)
fi

#######################################
## Check if we should build the gl_x11 engine
have_evas_gl_x11="no";
## Automatic check...
  AC_CHECK_HEADER(GL/gl.h,
    [
      AC_CHECK_HEADER(X11/X.h,
        [ have_evas_gl_x11="yes" ],
	[ have_evas_gl_x11="no" ]
      )
    ],
    [ have_evas_gl_x11="no" ]
)
## manually disable gl engine by default - not auto detected.
have_evas_gl_x11="no"
## Manual override
AC_MSG_CHECKING(whether gl x11 backend is to be built)
AC_ARG_ENABLE(gl-x11, [  --enable-gl-x11                 enable the OpenGL X11 display engine], [
	   if test x"$enableval" = x"yes" ; then
	     AC_MSG_RESULT(yes)
	     have_evas_gl_x11="yes"
	   else
	     AC_MSG_RESULT(no)
	     have_evas_gl_x11="no"
	   fi
        ], [
	   AC_MSG_RESULT($have_evas_gl_x11)
	]
)
if test "x$have_evas_gl_x11" = "xyes"; then
  AC_CHECK_HEADER(GL/gl.h,
    [
      AC_CHECK_HEADER(GL/glu.h,
        [
          AC_CHECK_HEADER(X11/X.h,
            [
              AM_CONDITIONAL(BUILD_ENGINE_GL_X11, true)
	      AC_DEFINE(BUILD_ENGINE_GL_X11, 1, [OpenGL X11 Rendering Backend])
	      AM_CONDITIONAL(BUILD_ENGINE_GL_COMMON, true)
	      AC_DEFINE(BUILD_ENGINE_GL_COMMON, 1, [Generic OpenGL Rendering Support])
	      x_dir=${x_dir:-/usr/X11R6};
	      x_cflags=${x_cflags:--I$x_dir/include}
	      x_libs="${x_libs:--L$x_dir/lib -lX11 -lXext}"
	      gl_cflags="-I/usr/include"
	      gl_libs="-lGL -lGLU -lpthread"
	      gl_dir=""
            ], [
              AM_CONDITIONAL(BUILD_ENGINE_GL_X11, false)
              AM_CONDITIONAL(BUILD_ENGINE_GL_COMMON, false)
              AC_MSG_RESULT(disabling GL X11 engine)
              have_evas_gl_x11="no"
            ]
	  )
        ], [
          AM_CONDITIONAL(BUILD_ENGINE_GL_X11, false)
          AM_CONDITIONAL(BUILD_ENGINE_GL_COMMON, false)
          AC_MSG_RESULT(disabling GL X11 engine)
          have_evas_gl_x11="no"
        ]
      )
    ], [
      AM_CONDITIONAL(BUILD_ENGINE_GL_X11, false)
      AM_CONDITIONAL(BUILD_ENGINE_GL_COMMON, false)
      AC_MSG_RESULT(disabling GL X11 engine)
      have_evas_gl_x11="no"
    ]
  )
else
  AM_CONDITIONAL(BUILD_ENGINE_GL_X11, false)
  AM_CONDITIONAL(BUILD_ENGINE_GL_COMMON, false)
  have_evas_gl_x11="no"
fi



#######################################
## Check if we should build the gl_x11 engine
have_evas_cairo_x11="no";
# Automatic check...
#PKG_CHECK_MODULES(CAIRO, cairo >= 1.0.0,
#  [ have_evas_cairo_x11="yes" ],
#  [ have_evas_cairo_x11="no" ]
#)
# Manual override
#AC_MSG_CHECKING(whether cairo x11 backend is to be built)
#AC_ARG_ENABLE(cairo-x11, [  --enable-cairo-x11              enable the Cairo X11 display engine], [
#	   if test x"$enableval" = x"yes" ; then
#	     AC_MSG_RESULT(yes)
#	     have_evas_cairo_x11="yes"
#	   else
#	     AC_MSG_RESULT(no)
#	     have_evas_cairo_x11="no"
#	   fi
#        ], [
#	   AC_MSG_RESULT($have_evas_cairo_x11)
#	]
#)
if test "x$have_evas_cairo_x11" = "xyes"; then
  AC_CHECK_HEADER(X11/X.h,
    [
      AM_CONDITIONAL(BUILD_ENGINE_CAIRO_X11, true)
      AC_DEFINE(BUILD_ENGINE_CAIRO_X11, 1, [Cairo X11 Rendering Backend])
      AM_CONDITIONAL(BUILD_ENGINE_CAIRO_COMMON, true)
      AC_DEFINE(BUILD_ENGINE_CAIRO_COMMON, 1, [Generic Cairo Rendering Support])
      x_dir="/usr/X11R6";
      x_cflags="-I"$x_dir"/include"
      x_libs="-L"$x_dir"/lib -lX11 -lXext"
    ], [
      AM_CONDITIONAL(BUILD_ENGINE_CAIRO_X11, false)
      AM_CONDITIONAL(BUILD_ENGINE_CAIRO_COMMON, false)
      AC_MSG_RESULT(disabling Cairo X11 engine)
    ]
  )
else
  AM_CONDITIONAL(BUILD_ENGINE_CAIRO_X11, false)
  AM_CONDITIONAL(BUILD_ENGINE_CAIRO_COMMON, false)
fi

#######################################
## Check if we should build the xrender_x11 engine
have_evas_xrender_x11="no";
## Automatic check...
AC_CHECK_HEADER(X11/X.h,
  [ have_evas_xrender_x11="yes" ],
  [ have_evas_xrender_x11="no" ]
)
## Manual override
AC_MSG_CHECKING(whether xrender x11 backend is to be built)
AC_ARG_ENABLE(xrender-x11, [  --enable-xrender-x11            enable the XRender X11 rendering backend], [
	   if test x"$enableval" = x"yes" ; then
	     AC_MSG_RESULT(yes)
	     have_evas_xrender_x11="yes"
	   else
	     AC_MSG_RESULT(no)
	     have_evas_xrender_x11="no"
	   fi
        ], [
	   AC_MSG_RESULT($have_evas_xrender_x11)
	]
)
if test "x$have_evas_xrender_x11" = "xyes"; then
  AC_PATH_XTRA
  AC_CHECK_HEADER(X11/X.h,
    [
      AC_CHECK_HEADER(X11/extensions/Xrender.h,
        [
          AC_DEFINE(BUILD_ENGINE_XRENDER_X11, 1, [XRender X11 Rendering Backend])
          x_dir=${x_dir:-/usr/X11R6}
          x_cflags=${x_cflags:--I${x_includes:-$x_dir/include}}
          x_libs="${x_libs:--L${x_libraries:-$x_dir/lib}} -lX11 -lXext -lXrender"
	],
	[
          AC_MSG_RESULT(disabling xrender X11 engine)
          have_evas_xrender_x11="no"
	]
      )
    ],
    [
      AC_MSG_RESULT(disabling xrender X11 engine)
      have_evas_xrender_x11="no"
    ]
  )
fi
AM_CONDITIONAL(BUILD_ENGINE_XRENDER_X11, test "x$have_evas_xrender_x11" = "xyes")

#######################################
## Check if we should build the xrender_xcb engine
have_evas_xrender_xcb="no";
## Automatic check...
PKG_CHECK_MODULES(
  XCBRENDER,
  xcb xcb-shm xcb-render xcb-image,
  [have_evas_xrender_xcb="yes"],
  [have_evas_xrender_xcb="no"],
  [ have_evas_xrender_xcb="no" ])

## manually disable xcb engine by default - not auto detected.
have_evas_xrender_xcb="no"
## Manual override
AC_MSG_CHECKING(whether xrender xcb backend is to be built)
AC_ARG_ENABLE(xrender-xcb, [  --enable-xrender-xcb            enable the Xrender XCB rendering backend], [
	   if test x"$enableval" = x"yes" ; then
	     AC_MSG_RESULT(yes)
	     have_evas_xrender_xcb="yes"
	   else
	     AC_MSG_RESULT(no)
	     have_evas_xrender_xcb="no"
	   fi
        ], [
	   AC_MSG_RESULT($have_evas_xrender_xcb)
	]
)
if test "x$have_evas_xrender_xcb" = "xyes"; then
  PKG_CHECK_MODULES(
    XCBRENDER,
    xcb xcb-shm xcb-render xcb-image,
    [AC_DEFINE(BUILD_ENGINE_XRENDER_XCB, 1, [Xrender XCB Rendering Backend])
     xcbrender_cflags=$XCBRENDER_CFLAGS
     xcbrender_libs=$XCBRENDER_LIBS],
    [AC_MSG_RESULT(disabling xrender XCB engine)
     have_evas_xrender_xcb="no"])
fi
AM_CONDITIONAL(BUILD_ENGINE_XRENDER_XCB, test "x$have_evas_xrender_xcb" = "xyes")

#######################################
## Check if we should build the glitz_x11 engine
have_evas_glitz_x11="no";
## Automatic check...
AC_CHECK_HEADER(glitz-glx.h,
  [ have_evas_glitz_x11="yes" ],
  [ have_evas_glitz_x11="no" ]
)
# maually disable glitz engine for now - as it does nothing.
have_evas_glitz_x11="no";
## Manual override
AC_MSG_CHECKING(whether glitz x11 backend is to be built)
AC_ARG_ENABLE(glitz-x11, [  --enable-glitz-x11                enable the Glitz X11 rendering backend], [
	   if test x"$enableval" = x"yes" ; then
	     AC_MSG_RESULT(yes)
	     have_evas_glitz_x11="yes"
	   else
	     AC_MSG_RESULT(no)
	     have_evas_glitz_x11="no"
	   fi
        ], [
	   AC_MSG_RESULT($have_evas_glitz_x11)
	]
)
if test "x$have_evas_glitz_x11" = "xyes"; then
  AC_PATH_XTRA
  AC_CHECK_HEADER(X11/X.h,
    [
      PKG_CHECK_MODULES(GLITZ, glitz glitz-glx,
	[
          x_dir=${x_dir:-/usr/X11R6}
          x_cflags=${x_cflags:--I${x_includes:-$x_dir/include}}
          x_libs="${x_libs:--L${x_libraries:-$x_dir/lib}} -lX11 -lXext"
          AC_DEFINE(BUILD_ENGINE_GLITZ_X11, 1, [Glitz X11 Rendering Backend])
        ],
        [
          AC_MSG_RESULT(disabling glitz X11 engine)
          have_evas_glitz_x11="no"
        ]
      )
    ],
    [
      AC_MSG_RESULT(disabling glitz X11 engine)
      have_evas_glitz_x11="no"
    ]
  )
fi
AM_CONDITIONAL(BUILD_ENGINE_GLITZ_X11, test "x$have_evas_glitz_x11" = "xyes")

#####################################################################
## Image loaders

#######################################
## GIF
have_gif="no";
AC_CHECK_HEADER(gif_lib.h,
  [ have_gif="yes" ],
  [ have_gif="no" ]
)
AC_MSG_CHECKING(whether to enable gif image loader)
AC_ARG_ENABLE(image-loader-gif, 
  [  --enable-image-loader-gif       enable GIF image loader], [
      if test x"$enableval" = x"yes" ; then
        AC_MSG_RESULT(yes)
	have_gif="yes"
      else
        AC_MSG_RESULT(no)
	have_gif="no"
      fi
  ], [
      AC_MSG_RESULT($have_gif)
  ]
)
if test "x$have_gif" = "xyes"; then
  AC_CHECK_HEADER(gif_lib.h,
    [ AC_CHECK_LIB(gif, DGifOpenFileName,
       [ gif_libs="-lgif"
         have_gif="yes" ],
       [ AC_CHECK_LIB(ungif, DGifOpenFileName,
          [ gif_libs="-lungif"
            have_gif="yes" ],
          [ have_gif="no" ]) ]) ],
    [ have_gif="no" ]
  )
fi
if test "x$have_gif" = "xyes"; then
  AC_DEFINE(BUILD_LOADER_GIF, 1, [GIF Image Loader Support])
  gif_cflags=""
fi

AM_CONDITIONAL(BUILD_LOADER_GIF, test x$have_gif = xyes)

#######################################
## PNG
have_png="no";
AC_MSG_CHECKING(whether to enable png image loader)
if   pkg-config --exists libpng12; then
  have_png="yes";
elif pkg-config --exists libpng10; then
  have_png="yes";
elif pkg-config --exists libpng; then
  have_png="yes";
fi

AC_ARG_ENABLE(image-loader-png, 
  [  --enable-image-loader-png       enable PNG image loader], [
      if test x"$enableval" = x"yes" ; then
        AC_MSG_RESULT(yes)
	have_png="yes"
      else
        AC_MSG_RESULT(no)
	have_png="no"
      fi
  ], [
      AC_MSG_RESULT($have_png)
  ]
)
if test "x$have_png" = "xyes"; then
  if   pkg-config --exists libpng12; then
    png_cflags=`pkg-config --cflags libpng12`
    png_libs=`pkg-config --libs libpng12`
    AC_MSG_CHECKING(libpng 1.2.x)
  elif pkg-config --exists libpng10; then
    png_cflags=`pkg-config --cflags libpng10`
    png_libs=`pkg-config --libs libpng10`
    AC_MSG_CHECKING(libpng 1.0.x)
  elif pkg-config --exists libpng; then
    png_cflags=`pkg-config --cflags libpng`
    png_libs=`pkg-config --libs libpng`
    AC_MSG_CHECKING(generic system libpng)
  fi
  AC_MSG_RESULT($have_png)
fi

AM_CONDITIONAL(BUILD_LOADER_PNG, test x$have_png = xyes)

#######################################
## JPEG
have_jpeg="no";
AC_CHECK_HEADER(jpeglib.h,
  [ have_jpeg="yes" ],
  [ have_jpeg="no" ]
)
AC_MSG_CHECKING(whether to enable jpeg image loader)
dnl Windows has no sigsetjmp function, nor equivalent.
dnl So we disable the jpeg saver.
have_jpeg_saver="yes"
case "$host_os" in
   mingw|mingw32)
   have_jpeg_saver="no"
   ;;
esac
AC_ARG_ENABLE(image-loader-jpeg, 
  [  --enable-image-loader-jpeg      enable JPEG image loader], [
      if test x"$enableval" = x"yes" ; then
        AC_MSG_RESULT(yes)
	have_jpeg="yes"
      else
        AC_MSG_RESULT(no)
	have_jpeg="no"
      fi
  ], [
      AC_MSG_RESULT($have_jpeg)
  ]
)
if test "x$have_jpeg" = "xyes"; then
  AC_CHECK_HEADER(jpeglib.h,
    [ have_jpeg="yes" ],
    [ have_jpeg="no" ]
  )
fi
if test "x$have_jpeg" = "xyes"; then
  AC_DEFINE(BUILD_LOADER_JPEG, 1, [JPEG Image Loader Support])
  jpeg_cflags=""
  jpeg_libs="-ljpeg"
fi

AM_CONDITIONAL(BUILD_LOADER_JPEG, test x$have_jpeg = xyes)
AM_CONDITIONAL(BUILD_SAVER_JPEG, test x$have_jpeg_saver = xyes)

#######################################
## EET
#
# first, check whether the user WANTS to use EET
AC_ARG_ENABLE(image-loader-eet,
  AC_HELP_STRING(
    [--enable-image-loader-eet],
    [enable EET image loader. [[default=enabled]]]
  ),
  [want_eet_image_loader=$enableval],
  [want_eet_image_loader=yes]
)

AC_ARG_ENABLE(font-loader-eet,
  AC_HELP_STRING(
    [--enable-font-loader-eet],
    [enable EET font loader. [[default=enabled]]]
  ),
  [want_eet_font_loader=$enableval],
  [want_eet_font_loader=yes]
)

# next, if she does, check whether EET is available
if test "$want_eet_image_loader" = yes -o "$want_eet_font_loader" = yes; then
  PKG_CHECK_MODULES(EET, eet, have_eet=yes, have_eet=no)
else
  have_eet=no
fi

# finally, spew out the result
AC_MSG_CHECKING(whether to enable eet font loader)
if test "$want_eet_font_loader" = yes -a "$have_eet" = yes; then
  AC_DEFINE(BUILD_FONT_LOADER_EET, 1, [EET Font Loader Support])
  have_eet_font_loader=yes
else
  have_eet_font_loader=no
fi
AC_MSG_RESULT($have_eet_font_loader)

AC_MSG_CHECKING(whether to enable eet image loader)
if test "$want_eet_image_loader" = yes -a "$have_eet" = yes; then
  AC_DEFINE(BUILD_LOADER_EET, 1, [EET Image Loader Support])
  have_eet_image_loader=yes
else
  have_eet_image_loader=no
fi
AC_MSG_RESULT($have_eet_image_loader)

AM_CONDITIONAL(BUILD_LOADER_EET, test $have_eet_image_loader = yes)

#######################################
## EDB
#
# first, check whether the user WANTS to use EDB
AC_ARG_ENABLE(image-loader-edb,
  AC_HELP_STRING(
    [--enable-image-loader-edb],
    [enable EDB image loader. [[default=enabled]]]
  ),
  [want_edb_image_loader=$enableval],
  [want_edb_image_loader=yes]
)

# next, if she does, check whether EDB is available
if test "$want_edb_image_loader" = yes; then
  PKG_CHECK_MODULES(EDB, edb, have_edb=yes, have_edb=no)
else
  have_edb=no
fi

# finally, spew out the result
AC_MSG_CHECKING(whether to enable edb image loader)
if test "$want_edb_image_loader" = yes -a "$have_edb" = yes; then
  AC_DEFINE(BUILD_LOADER_EDB, 1, [EDB Image Loader Support])
  have_edb_image_loader=yes
else
  have_edb_image_loader=no
fi
AC_MSG_RESULT($have_edb_image_loader)

AM_CONDITIONAL(BUILD_LOADER_EDB, test $have_edb_image_loader = yes)

#######################################
## TIFF
have_tiff="no";
AC_CHECK_HEADER(tiffio.h,
  [ have_tiff="yes" ],
  [ have_tiff="no" ]
)
AC_MSG_CHECKING(whether to enable tiff image loader)
AC_ARG_ENABLE(image-loader-tiff, 
  [  --enable-image-loader-tiff      enable TIFF image loader], [
      if test x"$enableval" = x"yes" ; then
        AC_MSG_RESULT(yes)
	have_tiff="yes"
      else
        AC_MSG_RESULT(no)
	have_tiff="no"
      fi
  ], [
      AC_MSG_RESULT($have_tiff)
  ]
)
if test "x$have_tiff" = "xyes"; then
  AC_CHECK_HEADER(tiffio.h,
    [ AC_CHECK_LIB(tiff, TIFFReadScanline,
       [ tiff_libs="-ltiff"
         have_tiff="yes" ],
       [ AC_CHECK_LIB(tiff, TIFFReadScanline,
          [ tiff_libs="-ltiff -ljpeg -lz -lm"
            have_tiff="yes" ],
          [ AC_CHECK_LIB(tiff34, TIFFReadScanline,
             [ tiff_libs="-ltiff34 -ljpeg -lz -lm"
               have_tiff="yes" ],
             [ have_tiff="no" ]) ]) ]) ],
    [ have_tiff="no" ]
  )
fi
if test "x$have_tiff" = "xyes"; then
  AC_DEFINE(BUILD_LOADER_TIFF, 1, [TIFF Image Loader Support])
  tiff_cflags=""
fi

AM_CONDITIONAL(BUILD_LOADER_TIFF, test x$have_tiff = xyes)

#######################################
## XPM
have_xpm="yes";
AC_MSG_CHECKING(whether to enable xpm image loader)

AC_ARG_ENABLE(image-loader-xpm, 
  [  --enable-image-loader-xpm       enable XPM image loader], [
      if test x"$enableval" = x"yes" ; then
          have_xpm="yes"
      else
          have_xpm="no"
      fi
  ]
)
AC_MSG_RESULT($have_xpm)

xpm_cflags=""
xpm_libs=""

AM_CONDITIONAL(BUILD_LOADER_XPM, test x$have_xpm = xyes)

#######################################
## SVG
have_svg="yes";
AC_MSG_CHECKING(whether to enable svg image loader)

AC_ARG_ENABLE(image-loader-svg, 
  [  --enable-image-loader-svg       enable SVG image loader], [
      if test x"$enableval" = x"yes" ; then
        AC_MSG_RESULT(yes)
	have_svg="yes"
      else
        AC_MSG_RESULT(no)
	have_svg="no"
      fi
  ], [
      AC_MSG_RESULT($have_svg)
  ]
)
svg_cflags=""
svg_libs=""
if test "x$have_svg" = "xyes"; then
   # Check if really available
   PKG_CHECK_MODULES(SVG, librsvg-2.0 >= 2.14.0,
	 [ 
	     have_svg="yes"
	 ],
	 [ 
	     have_svg="no"
	 ]
    )
   if test "x$have_svg" = "xyes"; then
      PKG_CHECK_MODULES(CAIRO_SVG, cairo-svg,
	 [ 
	    have_svg="yes"
	    svg_cflags="$SVG_CFLAGS $CAIRO_SVG_CFLAGS"
	    svg_libs="$SVG_LIBS $CAIRO_SVG_LIBS"
	 ],
	 [ 
            PKG_CHECK_MODULES(LIBSVG_CAIRO, libsvg-cairo,
	       [ 
	          have_svg="yes"
	          svg_cflags="$SVG_CFLAGS $LIBSVG_CAIRO_CFLAGS"
	          svg_libs="$SVG_LIBS $LIBSVG_CAIRO_LIBS"
	       ],
	       [ 
	          have_svg="no"
	       ]
            )
	 ]
      )
   fi
else 
   AC_MSG_RESULT(no)
fi

AM_CONDITIONAL(BUILD_LOADER_SVG, test x$have_svg = xyes)

#####################################################################
## Cpu based optimizations

#######################################
## PTHREADS
pthread_cflags=""
pthread_libs=""
build_pthreads="no"
# sched_getaffinity pthread_attr_setaffinity_np
AC_CHECK_HEADER(pthread.h,
  [ 
    AC_CHECK_HEADER(sched.h,
      [ 
        AC_CHECK_LIB(pthread, pthread_attr_setaffinity_np, 
	  [
            AC_CHECK_LIB(pthread, pthread_barrier_wait, 
  	      [ build_pthreads="yes" ],
              [ build_pthreads="no" ]
            )
	  ],
          [ build_pthreads="no" ]
        )
      ],
      [ build_pthreads="no" ]
    )
  ],
  [ build_pthreads="no" ]
)
### disable pthreads by default for now - some wierd deadlock issue with
# barriers (makes no sense)
#build_pthreads="no"
AC_MSG_CHECKING(whether to build pthread code)
AC_ARG_ENABLE(pthreads, 
  [  --enable-pthreads               enable threaded rendering], [
      if test x"$enableval" = x"yes" ; then
        AC_MSG_RESULT(yes)
        AC_DEFINE(BUILD_PTHREAD, 1, [Build Threaded Rendering])
        build_pthreads="yes"
        pthread_cflags=""
        pthread_libs="-lpthread"
      else
        AC_MSG_RESULT(no)
        build_pthreads="no"
      fi
  ],
  [ 
    AC_MSG_RESULT($build_pthreads)
    if test x"$build_pthreads" = x"yes" ; then
      AC_DEFINE(BUILD_PTHREAD, 1, [Build Threaded Rendering])
      pthread_cflags=""
      pthread_libs="-lpthread"
    fi
  ]
)

#######################################
## MMX
build_cpu_mmx="no"
case $host_cpu in
  i*86)
    build_cpu_mmx="yes"
    ;;
  x86_64)
    build_cpu_mmx="yes"
    ;;
esac
AC_MSG_CHECKING(whether to build mmx code)
AC_ARG_ENABLE(cpu-mmx, 
  [  --enable-cpu-mmx                enable mmx code], [
      if test x"$enableval" = x"yes" ; then
        AC_MSG_RESULT(yes)
        AC_DEFINE(BUILD_MMX, 1, [Build MMX Code])
        build_cpu_mmx="yes"
      else
        AC_MSG_RESULT(no)
        build_cpu_mmx="no"
      fi
  ],
  [
    AC_MSG_RESULT($build_cpu_mmx)
    if test x"$build_cpu_mmx" = x"yes" ; then
      AC_DEFINE(BUILD_MMX, 1, [Build MMX Code])
    fi
  ]
)

#######################################
## SSE
build_cpu_sse="no"
case $host_cpu in
  i*86)
    build_cpu_sse="yes"
    ;;
  x86_64)
    build_cpu_sse="yes"
    ;;
esac
AC_MSG_CHECKING(whether to build sse code)
AC_ARG_ENABLE(cpu-sse, 
  [  --enable-cpu-sse                enable sse code], [
      if test x"$enableval" = x"yes" ; then
        AC_MSG_RESULT(yes)
        AC_DEFINE(BUILD_SSE, 1, [Build SSE Code])
        build_cpu_sse="yes"
      else
        AC_MSG_RESULT(no)
        build_cpu_sse="no"
      fi
  ],
  [ 
    AC_MSG_RESULT($build_cpu_sse)
    if test x"$build_cpu_sse" = x"yes" ; then
      AC_DEFINE(BUILD_SSE, 1, [Build SSE Code])
    fi
  ]
)

#######################################
## ALTIVEC
build_cpu_altivec="no"
case $host_cpu in
  *power* | *ppc*)
    build_cpu_altivec="yes"
    ;;
esac
altivec_cflags=""
AC_MSG_CHECKING(whether to build altivec code)
AC_ARG_ENABLE(cpu-altivec, 
  [  --enable-cpu-altivec            enable altivec code], [
     build_cpu_altivec=$enableval
  ]
)
AC_MSG_RESULT($build_cpu_altivec)
if test "x$build_cpu_altivec" = "xyes"; then
   AC_CHECK_HEADER(altivec.h,
     [
        AC_DEFINE(BUILD_ALTIVEC, 1, [Build Altivec Code])
        AC_DEFINE(HAVE_ALTIVEC_H, 1, [Have altivec.h header file])
        build_cpu_altivec="yes"
     ],
     [
       save_CFLAGS=$CFLAGS
       save_CPPFLAGS=$CPPFLAGS
       CFLAGS=$CFLAGS" -maltivec"
       CPPFLAGS=$CPPFLAGS" -maltivec"
       unset ac_cv_header_altivec_h
       AC_CHECK_HEADER(altivec.h,
         [
            AC_DEFINE(BUILD_ALTIVEC, 1, [Build Altivec Code])
            AC_DEFINE(HAVE_ALTIVEC_H, 1, [Have altivec.h header file])
            build_cpu_altivec="yes"
         ],
         [
            build_cpu_altivec="no"
         ]
       )
       CFLAGS=$save_CFLAGS
       CPPFLAGS=$save_CPPFLAGS
     ]
   )
fi
if test "x$build_cpu_altivec" = "xyes"; then
   AC_MSG_CHECKING(whether to use altivec compiler flag)
   if test x"$GCC" = x"yes"; then
      if echo "int main(){return 0;}" | ${CPP} -faltivec - > /dev/null 2>&1; then
         altivec_cflags="-faltivec"
         AC_DEFINE(BUILD_ALTIVEC, 1, [Build Altivec Code])
      elif echo "int main(){return 0;}" | ${CPP} -maltivec - > /dev/null 2>&1; then
         altivec_cflags="-maltivec"
         AC_DEFINE(BUILD_ALTIVEC, 1, [Build Altivec Code])
      fi
   fi
   AC_MSG_RESULT($altivec_cflags)
   CFLAGS="$CFLAGS $altivec_cflags"
fi


#######################################
## C
build_cpu_c="no"
build_cpu_c="yes"
AC_MSG_CHECKING(whether to build c code)
AC_ARG_ENABLE(cpu-c, 
  [  --enable-cpu-c                  enable C code], [
      if test x"$enableval" = x"yes" ; then
        AC_MSG_RESULT(yes)
        AC_DEFINE(BUILD_C, 1, [Build plain C code])
	build_cpu_c="yes"
      else
        AC_MSG_RESULT(no)
	build_cpu_c="no"
      fi
  ], [
      AC_MSG_RESULT($build_cpu_c)
      if test x"$build_cpu_c" = x"yes" ; then
        AC_DEFINE(BUILD_C, 1, [Build plain C code])
      fi
  ]
)

#####################################################################
## ARGB engine options

#######################################
## Nearest sampling scaler
scaler_sample="no"
scaler_sample="yes"
AC_MSG_CHECKING(whether to build sampling scaler)
AC_ARG_ENABLE(scale-sample, 
  [  --enable-scale-sample           enable sampling scaler code], [
      if test x"$enableval" = x"yes" ; then
        AC_MSG_RESULT(yes)
        AC_DEFINE(BUILD_SCALE_SAMPLE, 1, [Sampling Scaler Support])
        scaler_sample="yes"
      else
        AC_MSG_RESULT(no)
        scaler_sample="no"
      fi
  ], [
      AC_MSG_RESULT($scaler_sample)
      if test x"$scaler_sample" = x"yes" ; then
        AC_DEFINE(BUILD_SCALE_SAMPLE, 1, [Sampling Scaler Support])
      fi
  ]
)

#######################################
## Smooth super and sub sampling scaler
scaler_smooth="no"
scaler_smooth="yes"
AC_MSG_CHECKING(whether to build smooth scaler)
AC_ARG_ENABLE(scale-smooth, 
  [  --enable-scale-smooth           enable smooth scaler code], [
      if test x"$enableval" = x"yes" ; then
        AC_MSG_RESULT(yes)
        AC_DEFINE(BUILD_SCALE_SMOOTH, 1, [Smooth Scaler Support])
        scaler_smooth="yes"
      else
        AC_MSG_RESULT(no)
        scaler_smooth="no"
      fi
  ], [
      AC_MSG_RESULT($scaler_smooth)
      if test x"$scaler_smooth" = x"yes" ; then
        AC_DEFINE(BUILD_SCALE_SMOOTH, 1, [Smooth Scaler Support])
      fi
  ]
)

#######################################
## YUV -> ARGB converter
conv_yuv="no"
conv_yuv="yes"
AC_MSG_CHECKING(whether to build yuv converter code)
AC_ARG_ENABLE(convert-yuv, 
  [  --enable-convert-yuv            enable yuv converter code], [
      if test x"$enableval" = x"yes" ; then
        AC_MSG_RESULT(yes)
        AC_DEFINE(BUILD_CONVERT_YUV, 1, [YUV Converter Support])
	conv_yuv="yes"
      else
        AC_MSG_RESULT(no)
	conv_yuv="no"
      fi
  ], [
      AC_MSG_RESULT($conv_yuv)
      if test x"$conv_yuv" = x"yes" ; then
        AC_DEFINE(BUILD_CONVERT_YUV, 1, [YUV Converter Support])
      fi
  ]
)

#####################################################################
## Output rendering features

#######################################
## Small dither mask instead of big one (lower quality)
conv_small_dither="no"
conv_small_dither="no"
AC_MSG_CHECKING(whether to build small dither mask code)
AC_ARG_ENABLE(small-dither-mask, 
  [  --enable-small-dither-mask      enable small dither mask code], [
      if test x"$enableval" = x"yes" ; then
        AC_MSG_RESULT(yes)
      	AC_DEFINE(BUILD_SMALL_DITHER_MASK, 1, [Small Dither Mask Support])
        conv_small_dither="yes"
      else
        AC_MSG_RESULT(no)
        conv_small_dither="no"
      fi
  ], [
      AC_MSG_RESULT($conv_small_dither)
      if test x"$conv_small_dither" = x"yes" ; then
        AC_DEFINE(BUILD_SMALL_DITHER_MASK, 1, [Small Dither Mask Support])
      fi
  ]
)

#######################################
## No dither mask at all for 16bpp
conv_no_dither="no"
conv_no_dither="no"
AC_MSG_CHECKING(whether to build without dither mask for 16bpp)
AC_ARG_ENABLE(no-dither-mask,
  [  --enable-no-dither-mask         enable conversion to 16bpp without dither mask], [
      if test x"$enableval" = x"yes" ; then
        AC_MSG_RESULT(yes)
      	AC_DEFINE(BUILD_NO_DITHER_MASK, 1, [No Dither Mask Support])
        conv_no_dither="yes"
      else
        AC_MSG_RESULT(no)
        conv_no_dither="no"
      fi
  ], [
      AC_MSG_RESULT($conv_no_dither)
      if test x"$conv_no_dither" = x"yes" ; then
        AC_DEFINE(BUILD_NO_DITHER_MASK, 1, [No Dither Mask Support])
      fi
  ]
)

#######################################
## Convert to 8bpp RGB 332
conv_8_rgb_332="no"
conv_8_rgb_332="yes"
AC_MSG_CHECKING(whether to build 8bpp 332 converter code)
AC_ARG_ENABLE(convert-8-rgb-332, 
  [  --enable-convert-8-rgb-332      enable 8bpp 332 converter code], [
      if test x"$enableval" = x"yes" ; then
        AC_MSG_RESULT(yes)
        AC_DEFINE(BUILD_CONVERT_8_RGB_332, 1, [8bpp 332 Converter Support])
        conv_8_rgb_332="yes"
      else
        AC_MSG_RESULT(no)
	conv_8_rgb_332="no"
      fi
  ], [
      AC_MSG_RESULT($conv_8_rgb_332)
      if test x"$conv_8_rgb_332" = x"yes" ; then
        AC_DEFINE(BUILD_CONVERT_8_RGB_332, 1, [8bpp 332 Converter Support])
      fi
  ]
)

#######################################
## Convert to 8bpp RGB 666
conv_8_rgb_666="no"
conv_8_rgb_666="yes"
AC_MSG_CHECKING(whether to build 8bpp 666 converter code)
AC_ARG_ENABLE(convert-8-rgb-666, 
  [  --enable-convert-8-rgb-666      enable 8bpp 666 converter code], [
      if test x"$enableval" = x"yes" ; then
        AC_MSG_RESULT(yes)
        AC_DEFINE(BUILD_CONVERT_8_RGB_666, 1, [8bpp 666 Converter Support])
        conv_8_rgb_666="yes"
      else
        AC_MSG_RESULT(no)
	conv_8_rgb_666="no"
      fi
  ], [
      AC_MSG_RESULT($conv_8_rgb_666)
      if test x"$conv_8_rgb_666" = x"yes" ; then
        AC_DEFINE(BUILD_CONVERT_8_RGB_666, 1, [8bpp 666 Converter Support])
      fi
  ]
)

#######################################
## Convert to 8bpp RGB 232
conv_8_rgb_232="no"
conv_8_rgb_232="yes"
AC_MSG_CHECKING(whether to build 8bpp 232 converter code)
AC_ARG_ENABLE(convert-8-rgb-232, 
  [  --enable-convert-8-rgb-232      enable 8bpp 232 converter code], [
      if test x"$enableval" = x"yes" ; then
        AC_MSG_RESULT(yes)
        AC_DEFINE(BUILD_CONVERT_8_RGB_232, 1, [8bpp 232 Converter Support])
        conv_8_rgb_232="yes"
      else
        AC_MSG_RESULT(no)
	conv_8_rgb_232="no"
      fi
  ], [
      AC_MSG_RESULT($conv_8_rgb_232)
      if test x"$conv_8_rgb_232" = x"yes" ; then
        AC_DEFINE(BUILD_CONVERT_8_RGB_232, 1, [8bpp 232 Converter Support])
      fi
  ]
)

#######################################
## Convert to 8bpp RGB 222
conv_8_rgb_222="no"
conv_8_rgb_222="yes"
AC_MSG_CHECKING(whether to build 8bpp 222 converter code)
AC_ARG_ENABLE(convert-8-rgb-222, 
  [  --enable-convert-8-rgb-222      enable 8bpp 222 converter code], [
      if test x"$enableval" = x"yes" ; then
        AC_MSG_RESULT(yes)
        AC_DEFINE(BUILD_CONVERT_8_RGB_222, 1, [8bpp 222 Converter Support])
        conv_8_rgb_222="yes"
      else
        AC_MSG_RESULT(no)
	conv_8_rgb_222="no"
      fi
  ], [
      AC_MSG_RESULT($conv_8_rgb_222)
      if test x"$conv_8_rgb_222" = x"yes" ; then
        AC_DEFINE(BUILD_CONVERT_8_RGB_222, 1, [8bpp 222 Converter Support])
      fi
  ]
)

#######################################
## Convert to 8bpp RGB 221
conv_8_rgb_221="no"
conv_8_rgb_221="yes"
AC_MSG_CHECKING(whether to build 8bpp 221 converter code)
AC_ARG_ENABLE(convert-8-rgb-221, 
  [  --enable-convert-8-rgb-221      enable 8bpp 221 converter code], [
      if test x"$enableval" = x"yes" ; then
        AC_MSG_RESULT(yes)
        AC_DEFINE(BUILD_CONVERT_8_RGB_221, 1, [8bpp 221 Converter Support])
        conv_8_rgb_221="yes"
      else
        AC_MSG_RESULT(no)
	conv_8_rgb_221="no"
      fi
  ], [
      AC_MSG_RESULT($conv_8_rgb_221)
      if test x"$conv_8_rgb_221" = x"yes" ; then
        AC_DEFINE(BUILD_CONVERT_8_RGB_221, 1, [8bpp 221 Converter Support])
      fi
  ]
)

#######################################
## Convert to 8bpp RGB 121
conv_8_rgb_121="no"
conv_8_rgb_121="yes"
AC_MSG_CHECKING(whether to build 8bpp 121 converter code)
AC_ARG_ENABLE(convert-8-rgb-121, 
  [  --enable-convert-8-rgb-121      enable 8bpp 121 converter code], [
      if test x"$enableval" = x"yes" ; then
        AC_MSG_RESULT(yes)
        AC_DEFINE(BUILD_CONVERT_8_RGB_121, 1, [8bpp 121 Converter Support])
        conv_8_rgb_121="yes"
      else
        AC_MSG_RESULT(no)
	conv_8_rgb_121="no"
      fi
  ], [
      AC_MSG_RESULT($conv_8_rgb_121)
      if test x"$conv_8_rgb_121" = x"yes" ; then
        AC_DEFINE(BUILD_CONVERT_8_RGB_121, 1, [8bpp 121 Converter Support])
      fi
  ]
)

#######################################
## Convert to 8bpp RGB 111
conv_8_rgb_111="no"
conv_8_rgb_111="yes"
AC_MSG_CHECKING(whether to build 8bpp 111 converter code)
AC_ARG_ENABLE(convert-8-rgb-111, 
  [  --enable-convert-8-rgb-111      enable 8bpp 111 converter code], [
      if test x"$enableval" = x"yes" ; then
        AC_MSG_RESULT(yes)
        AC_DEFINE(BUILD_CONVERT_8_RGB_111, 1, [8bpp 111 Converter Support])
        conv_8_rgb_111="yes"
      else
        AC_MSG_RESULT(no)
	conv_8_rgb_111="no"
      fi
  ], [
      AC_MSG_RESULT($conv_8_rgb_111)
      if test x"$conv_8_rgb_111" = x"yes" ; then
        AC_DEFINE(BUILD_CONVERT_8_RGB_111, 1, [8bpp 111 Converter Support])
      fi
  ]
)

#######################################
## Convert to 16bpp RGB 565
conv_16_rgb_565="no"
conv_16_rgb_565="yes"
AC_MSG_CHECKING(whether to build 16bpp 565 rgb converter code)
AC_ARG_ENABLE(convert-16-rgb-565, 
  [  --enable-convert-16-rgb-565     enable 16bpp rgb 565 converter code], [
      if test x"$enableval" = x"yes" ; then
        AC_MSG_RESULT(yes)
        AC_DEFINE(BUILD_CONVERT_16_RGB_565, 1, [16bpp RGB 565 Converter Support])
        conv_16_rgb_565="yes"
      else
        AC_MSG_RESULT(no)
	conv_16_rgb_565="no"
      fi
  ], [
      AC_MSG_RESULT($conv_16_rgb_565)
      if test x"$conv_16_rgb_565" = x"yes" ; then
        AC_DEFINE(BUILD_CONVERT_16_RGB_565, 1, [16bpp RGB 565 Converter Support])
      fi
  ]
)

#######################################
## Convert to 16bpp BGR 565
conv_16_bgr_565="no"
conv_16_bgr_565="yes"
AC_MSG_CHECKING(whether to build 16bpp 565 bgr converter code)
AC_ARG_ENABLE(convert-16-bgr-565, 
  [  --enable-convert-16-bgr-565     enable 16bpp bgr 565 converter code], [
      if test x"$enableval" = x"yes" ; then
        AC_MSG_RESULT(yes)
        AC_DEFINE(BUILD_CONVERT_16_BGR_565, 1, [16bpp BGR 565 Converter Support])
        conv_16_bgr_565="yes"
      else
        AC_MSG_RESULT(no)
	conv_16_bgr_565="no"
      fi
  ], [
      AC_MSG_RESULT($conv_16_bgr_565)
      if test x"$conv_16_bgr_565" = x"yes" ; then
        AC_DEFINE(BUILD_CONVERT_16_BGR_565, 1, [16bpp BGR 565 Converter Support])
      fi
  ]
)

#######################################
## Convert to 16bpp RGB 555
conv_16_rgb_555="no"
conv_16_rgb_555="yes"
AC_MSG_CHECKING(whether to build 16bpp 555 converter code)
AC_ARG_ENABLE(convert-16-rgb-555, 
  [  --enable-convert-16-rgb-555     enable 16bpp 555 converter code], [
      if test x"$enableval" = x"yes" ; then
        AC_MSG_RESULT(yes)
        AC_DEFINE(BUILD_CONVERT_16_RGB_555, 1, [16bpp 555 Converter Support])
        conv_16_rgb_555="yes"
      else
        AC_MSG_RESULT(no)
	conv_16_rgb_555="no"
      fi
  ], [
      AC_MSG_RESULT($conv_16_rgb_555)
      if test x"$conv_16_rgb_555" = x"yes" ; then
        AC_DEFINE(BUILD_CONVERT_16_RGB_555, 1, [16bpp 555 Converter Support])
      fi
  ]
)

#######################################
## Convert to 16bpp RGB 444
conv_16_rgb_444="no"
conv_16_rgb_444="yes"
AC_MSG_CHECKING(whether to build 16bpp 444 converter code)
AC_ARG_ENABLE(convert-16-rgb-444, 
  [  --enable-convert-16-rgb-444     enable 16bpp 444 converter code], [
      if test x"$enableval" = x"yes" ; then
        AC_MSG_RESULT(yes)
        AC_DEFINE(BUILD_CONVERT_16_RGB_444, 1, [16bpp 444 Converter Support])
        conv_16_rgb_444="yes"
      else
        AC_MSG_RESULT(no)
	conv_16_rgb_444="no"
      fi
  ], [
      AC_MSG_RESULT($conv_16_rgb_444)
      if test x"$conv_16_rgb_444" = x"yes" ; then
        AC_DEFINE(BUILD_CONVERT_16_RGB_444, 1, [16bpp 444 Converter Support])
      fi
  ]
)

#######################################
## Convert to 16bpp RGB 565 (444 ipaq)
conv_16_rgb_ipq="no"
conv_16_rgb_ipq="yes"
AC_MSG_CHECKING(whether to build 16bpp 565 (444 ipaq) converter code)
AC_ARG_ENABLE(convert-16-rgb-ipq, 
  [  --enable-convert-16-rgb-ipq     enable 16bpp 565 (444 ipaq) converter code], [
      if test x"$enableval" = x"yes" ; then
        AC_MSG_RESULT(yes)
        AC_DEFINE(BUILD_CONVERT_16_RGB_454645, 1, [16bpp 565 (444 ipaq) Converter Support])
        conv_16_rgb_ipq="yes"
      else
        AC_MSG_RESULT(no)
	conv_16_rgb_ipq="no"
      fi
  ], [
      AC_MSG_RESULT($conv_16_rgb_ipq)
      if test x"$conv_16_rgb_ipq" = x"yes" ; then
        AC_DEFINE(BUILD_CONVERT_16_RGB_454645, 1, [16bpp 565 (444 ipaq) Converter Support])
      fi
  ]
)

#######################################
## Convert to 16bpp RGB with rotation of 0
conv_16_rgb_rot_0="no"
conv_16_rgb_rot_0="yes"
AC_MSG_CHECKING(whether to build 16bpp rotation 0 converter code)
AC_ARG_ENABLE(convert-16-rgb-rot-0, 
  [  --enable-convert-16-rgb-rot-0   enable 16bpp rotation 0 converter code], [
      if test x"$enableval" = x"yes" ; then
        AC_MSG_RESULT(yes)
        AC_DEFINE(BUILD_CONVERT_16_RGB_ROT0, 1, [16bpp Rotation 0 Converter Code])
	conv_16_rgb_rot_0="yes"
      else
        AC_MSG_RESULT(no)
	conv_16_rgb_rot_0="no"
      fi
  ], [
      AC_MSG_RESULT($conv_16_rgb_rot_0)
      if test x"$conv_16_rgb_rot_0" = x"yes" ; then
        AC_DEFINE(BUILD_CONVERT_16_RGB_ROT0, 1, [16bpp Rotation 0 Converter Code])
      fi
  ]
)

#######################################
## Convert to 16bpp RGB with rotation of 180
conv_16_rgb_rot_180="no"
conv_16_rgb_rot_180="yes"
AC_MSG_CHECKING(whether to build 16bpp rotation 180 converter code)
AC_ARG_ENABLE(convert-16-rgb-rot-180,
  [  --enable-convert-16-rgb-rot-180 enable 16bpp rotation 180 converter code], [
      if test x"$enableval" = x"yes" ; then
        AC_MSG_RESULT(yes)
        AC_DEFINE(BUILD_CONVERT_16_RGB_ROT180, 1, [16bpp Rotation 180 Converter Code])
        conv_16_rgb_rot_180="yes"
      else
        AC_MSG_RESULT(no)
        conv_16_rgb_rot_180="no"
      fi
  ], [
      AC_MSG_RESULT($conv_16_rgb_rot_180)
      if test x"$conv_16_rgb_rot_180" = x"yes" ; then
        AC_DEFINE(BUILD_CONVERT_16_RGB_ROT180, 1, [16bpp Rotation 180 Converter Code])
      fi
  ]
)

#######################################
## Convert to 16bpp RGB with rotation of 270
conv_16_rgb_rot_270="no"
conv_16_rgb_rot_270="yes"
AC_MSG_CHECKING(whether to build 16bpp rotation 270 converter code)
AC_ARG_ENABLE(convert-16-rgb-rot-270, 
  [  --enable-convert-16-rgb-rot-270 enable 16bpp rotation 270 converter code], [
      if test x"$enableval" = x"yes" ; then
        AC_MSG_RESULT(yes)
        AC_DEFINE(BUILD_CONVERT_16_RGB_ROT270, 1, [16bpp Rotation 270 Converter Code])
	conv_16_rgb_rot_270="yes"
      else
        AC_MSG_RESULT(no)
	conv_16_rgb_rot_270="no"
      fi
  ], [
      AC_MSG_RESULT($conv_16_rgb_rot_270)
      if test x"$conv_16_rgb_rot_270" = x"yes" ; then
        AC_DEFINE(BUILD_CONVERT_16_RGB_ROT270, 1, [16bpp Rotation 270 Converter Code])
      fi
  ]
)

#######################################
## Convert to 16bpp RGB with rotation of 90
conv_16_rgb_rot_90="no"
conv_16_rgb_rot_90="yes"
AC_MSG_CHECKING(whether to build 16bpp rotation 90 converter code)
AC_ARG_ENABLE(convert-16-rgb-rot-90, 
  [  --enable-convert-16-rgb-rot-90  enable 16bpp rotation 90 converter code], [
      if test x"$enableval" = x"yes" ; then
        AC_MSG_RESULT(yes)
        AC_DEFINE(BUILD_CONVERT_16_RGB_ROT90, 1, [16bpp Rotation 90 Converter Code])
	conv_16_rgb_rot_90="yes"
      else
        AC_MSG_RESULT(no)
	conv_16_rgb_rot_90="no"
      fi
  ], [
      AC_MSG_RESULT($conv_16_rgb_rot_90)
      if test x"$conv_16_rgb_rot_90" = x"yes" ; then
        AC_DEFINE(BUILD_CONVERT_16_RGB_ROT90, 1, [16bpp Rotation 90 Converter Code])
      fi
  ]
)

#######################################
## Convert to 24bpp RGB 888
conv_24_rgb_888="no"
conv_24_rgb_888="yes"
AC_MSG_CHECKING(whether to build 24bpp 888 rgb converter code)
AC_ARG_ENABLE(convert-24-rgb-888, 
  [  --enable-convert-24-rgb-888     enable 24bpp rgb 888 converter code], [
      if test x"$enableval" = x"yes" ; then
        AC_MSG_RESULT(yes)
        AC_DEFINE(BUILD_CONVERT_24_RGB_888, 1, [24bpp RGB 888 Converter Support])
	conv_24_rgb_888="yes"
      else
        AC_MSG_RESULT(no)
	conv_24_rgb_888="no"
      fi
  ], [
      AC_MSG_RESULT($conv_24_rgb_888)
      if test x"$conv_24_rgb_888" = x"yes" ; then
        AC_DEFINE(BUILD_CONVERT_24_RGB_888, 1, [24bpp RGB 888 Converter Support])
      fi
  ]
)

#######################################
## Convert to 24bpp BGR 888
conv_24_bgr_888="no"
conv_24_bgr_888="yes"
AC_MSG_CHECKING(whether to build 24bpp 888 bgr converter code)
AC_ARG_ENABLE(convert-24-bgr-888, 
  [  --enable-convert-24-bgr-888     enable 24bpp bgr 888 converter code], [
      if test x"$enableval" = x"yes" ; then
        AC_MSG_RESULT(yes)
        AC_DEFINE(BUILD_CONVERT_24_BGR_888, 1, [24bpp BGR 888 Converter Support])
	conv_24_bgr_888="yes"
      else
        AC_MSG_RESULT(no)
	conv_24_bgr_888="no"
      fi
  ], [
      AC_MSG_RESULT(yes)
      if test x"$conv_24_bgr_888" = x"yes" ; then
        AC_DEFINE(BUILD_CONVERT_24_BGR_888, 1, [24bpp BGR 888 Converter Support])
      fi
  ]
)

#######################################
## Convert to 32bpp RGB 8888
conv_32_rgb_8888="no"
conv_32_rgb_8888="yes"
AC_MSG_CHECKING(whether to build 32bpp 8888 rgb converter code)
AC_ARG_ENABLE(convert-32-rgb-8888, 
  [  --enable-convert-32-rgb-8888    enable 32bpp rgb 8888 converter code], [
      if test x"$enableval" = x"yes" ; then
        AC_MSG_RESULT(yes)
        AC_DEFINE(BUILD_CONVERT_32_RGB_8888, 1, [32bpp RGB 8888 Converter Support])
	conv_32_rgb_8888="yes"
      else
        AC_MSG_RESULT(no)
	conv_32_rgb_8888="no"
      fi
  ], [
      AC_MSG_RESULT($conv_32_rgb_8888)
      if test x"$conv_32_rgb_8888" = x"yes" ; then
        AC_DEFINE(BUILD_CONVERT_32_RGB_8888, 1, [32bpp RGB 8888 Converter Support])
      fi
  ]
)

#######################################
## Convert to 32bpp RGBX 8888
conv_32_rgbx_8888="no"
conv_32_rgbx_8888="yes"
AC_MSG_CHECKING(whether to build 32bpp 8888 rgbx converter code)
AC_ARG_ENABLE(convert-32-rgbx-8888, 
  [  --enable-convert-32-rgbx-8888   enable 32bpp rgbx 8888 converter code], [
      if test x"$enableval" = x"yes" ; then
        AC_MSG_RESULT(yes)
        AC_DEFINE(BUILD_CONVERT_32_RGBX_8888, 1, [32bpp RGBX 8888 Converter Support])
	conv_32_rgbx_8888="yes"
      else
        AC_MSG_RESULT(no)
	conv_32_rgbx_8888="no"
      fi
  ], [
      AC_MSG_RESULT($conv_32_rgbx_8888)
      if test x"$conv_32_rgbx_8888" = x"yes" ; then
        AC_DEFINE(BUILD_CONVERT_32_RGBX_8888, 1, [32bpp RBGX 8888 Converter Support])
      fi
  ]
)

#######################################
## Convert to 32bpp BGR 8888
conv_32_bgr_8888="no"
conv_32_bgr_8888="yes"
AC_MSG_CHECKING(whether to build 32bpp 8888 bgr converter code)
AC_ARG_ENABLE(convert-32-bgr-8888, 
  [  --enable-convert-32-bgr-8888    enable 32bpp bgr 8888 converter code], [
      if test x"$enableval" = x"yes" ; then
        AC_MSG_RESULT(yes)
        AC_DEFINE(BUILD_CONVERT_32_BGR_8888, 1, [32bpp BGR 8888 Converter Support])
	conv_32_bgr_8888="yes"
      else
        AC_MSG_RESULT(no)
	conv_32_bgr_8888="no"
      fi
  ], [
      AC_MSG_RESULT($conv_32_bgr_8888)
      if test x"$conv_32_bgr_8888" = x"yes" ; then
        AC_DEFINE(BUILD_CONVERT_32_BGR_8888, 1, [32bpp BGR 8888 Converter Support])
      fi
  ]
)

#######################################
## Convert to 32bpp BGRX 8888
conv_32_bgrx_8888="no"
conv_32_bgrx_8888="yes"
AC_MSG_CHECKING(whether to build 32bpp 8888 bgrx converter code)
AC_ARG_ENABLE(convert-32-bgrx-8888, 
  [  --enable-convert-32-bgrx-8888   enable 32bpp bgrx 8888 converter code], [
      if test x"$enableval" = x"yes" ; then
        AC_MSG_RESULT(yes)
        AC_DEFINE(BUILD_CONVERT_32_BGRX_8888, 1, [32bpp BGRX 8888 Converter Support])
	conv_32_bgrx_8888="yes"
      else
        AC_MSG_RESULT(no)
	conv_32_bgrx_8888="no"
      fi
  ], [
      AC_MSG_RESULT($conv_32_bgrx_8888)
      if test x"$conv_32_bgrx_8888" = x"yes" ; then
        AC_DEFINE(BUILD_CONVERT_32_BGRX_8888, 1, [32bpp RBGX 8888 Converter Support])
      fi
  ]
)

#######################################
## Convert to 32bpp RGB with rotation of 0
conv_32_rgb_rot_0="no"
conv_32_rgb_rot_0="yes"
AC_MSG_CHECKING(whether to build 32bpp rotation 0 converter code)
AC_ARG_ENABLE(convert-32-rgb-rot-0, 
  [  --enable-convert-32-rgb-rot-0   enable 32bpp rotation 0 converter code], [
      if test x"$enableval" = x"yes" ; then
        AC_MSG_RESULT(yes)
        AC_DEFINE(BUILD_CONVERT_32_RGB_ROT0, 1, [32bpp Rotation 0 Converter Support])
	conv_32_rgb_rot_0="yes"
      else
        AC_MSG_RESULT(no)
	conv_32_rgb_rot_0="no"
      fi
  ], [
      AC_MSG_RESULT($conv_32_rgb_rot_0)
      if test x"$conv_32_rgb_rot_0" = x"yes" ; then
        AC_DEFINE(BUILD_CONVERT_32_RGB_ROT0, 1, [32bpp Rotation 0 Converter Support])
      fi
  ]
)

#######################################
## Convert to 32bpp RGB with rotation of 180
conv_32_rgb_rot_180="no"
conv_32_rgb_rot_180="yes"
AC_MSG_CHECKING(whether to build 32bpp rotation 180 converter code)
AC_ARG_ENABLE(convert-32-rgb-rot-180,
  [  --enable-convert-32-rgb-rot-180 enable 32bpp rotation 180 converter code], [
      if test x"$enableval" = x"yes" ; then
        AC_MSG_RESULT(yes)
        AC_DEFINE(BUILD_CONVERT_32_RGB_ROT180, 1, [32bpp Rotation 180 Converter Support])
        conv_32_rgb_rot_180="yes"
      else
        AC_MSG_RESULT(no)
        conv_32_rgb_rot_180="no"
      fi
  ], [
      AC_MSG_RESULT($conv_32_rgb_rot_180)
      if test x"$conv_32_rgb_rot_180" = x"yes" ; then
        AC_DEFINE(BUILD_CONVERT_32_RGB_ROT180, 1, [32bpp Rotation 180 Converter Support])
      fi
  ]
)

#######################################
## Convert to 32bpp RGB with rotation of 270
conv_32_rgb_rot_270="no"
conv_32_rgb_rot_270="yes"
AC_MSG_CHECKING(whether to build 32bpp rotation 270 converter code)
AC_ARG_ENABLE(convert-32-rgb-rot-270, 
  [  --enable-convert-32-rgb-rot-270 enable 32bpp rotation 270 converter code], [
      if test x"$enableval" = x"yes" ; then
        AC_MSG_RESULT(yes)
        AC_DEFINE(BUILD_CONVERT_32_RGB_ROT270, 1, [32bpp Rotation 270 Converter Support])
	conv_32_rgb_rot_270="yes"
      else
        AC_MSG_RESULT(no)
	conv_32_rgb_rot_270="no"
      fi
  ], [
      AC_MSG_RESULT($conv_32_rgb_rot_270)
      if test x"$conv_32_rgb_rot_270" = x"yes" ; then
        AC_DEFINE(BUILD_CONVERT_32_RGB_ROT270, 1, [32bpp Rotation 270 Converter Support])
      fi
  ]
)

#######################################
## Convert to 32bpp RGB with rotation of 90
conv_32_rgb_rot_90="no"
conv_32_rgb_rot_90="yes"
AC_MSG_CHECKING(whether to build 32bpp rotation 90 converter code)
AC_ARG_ENABLE(convert-32-rgb-rot-90, 
  [  --enable-convert-32-rgb-rot-90  enable 32bpp rotation 90 converter code], [
      if test x"$enableval" = x"yes" ; then
        AC_MSG_RESULT(yes)
        AC_DEFINE(BUILD_CONVERT_32_RGB_ROT90, 1, [32bpp Rotation 90 Converter Support])
	conv_32_rgb_rot_90="yes"
      else
        AC_MSG_RESULT(no)
	conv_32_rgb_rot_90="no"
      fi
  ], [
      AC_MSG_RESULT($conv_32_rgb_rot_90)
      if test x"$conv_32_rgb_rot_90" = x"yes" ; then
        AC_DEFINE(BUILD_CONVERT_32_RGB_ROT90, 1, [32bpp Rotation 90 Converter Support])
      fi
  ]
)

# Setting have_valgrind to "no" seems pointless, but we just need to
# put something in as the 4th parameter, so configure doesn't abort
# when valgrind.pc isn't found.
have_valgrind="no"
PKG_CHECK_MODULES(VALGRIND, valgrind >= 2.4.0, have_valgrind=yes, have_valgrind=no)
VALGRIND_LIBS="" # dont use LIBS

AC_ARG_ENABLE(valgrind,
  [  --enable-valgrind               enable valgrind fixes to stop false reports], [
      if test x"$enableval" = x"yes" ; then
        have_valgrind="yes"
      else
        have_valgrind="no"
        VALGRIND_CFLAGS=""
      fi
  ], [
    have_valgrind=$have_valgrind
  ]
)

if test x$have_valgrind = "xyes"; then
  AC_DEFINE(HAVE_VALGRIND, 1, [Valgrind support])
fi

#####################################################################
## Fill in flags

AC_SUBST(VALGRIND_CFLAGS)

AC_SUBST(x_cflags)
AC_SUBST(x_libs)

AC_SUBST(xcb_cflags)
AC_SUBST(xcb_libs)
AC_SUBST(xcbrender_cflags)
AC_SUBST(xcbrender_libs)

AC_SUBST(gl_cflags)
AC_SUBST(gl_libs)

AC_SUBST(qt_cflags)
AC_SUBST(qt_libs)
AC_SUBST(qt_moc)

AC_SUBST(gif_cflags)
AC_SUBST(gif_libs)
AC_SUBST(png_cflags)
AC_SUBST(png_libs)
AC_SUBST(jpeg_cflags)
AC_SUBST(jpeg_libs)
AC_SUBST(tiff_cflags)
AC_SUBST(tiff_libs)
AC_SUBST(xpm_cflags)
AC_SUBST(xpm_libs)
AC_SUBST(svg_cflags)
AC_SUBST(svg_libs)
AC_SUBST(altivec_cflags)
AC_SUBST(pthread_cflags)
AC_SUBST(pthread_libs)

#####################################################################
## Output

AC_OUTPUT([
Makefile
evas-cairo-x11.pc
evas-directfb.pc
evas-framebuffer.pc
evas-glitz-x11.pc
evas-opengl-x11.pc
evas-software-buffer.pc
evas-software-qtopia.pc
evas-software-x11.pc
evas-software-xcb.pc
evas-xrender-x11.pc
evas-xrender-xcb.pc
evas.pc
src/Makefile
src/lib/Makefile
src/lib/canvas/Makefile
src/lib/data/Makefile
src/lib/file/Makefile
src/lib/imaging/Makefile
src/lib/engines/Makefile
src/lib/engines/common/Makefile
src/lib/engines/common/evas_op_add/Makefile
src/lib/engines/common/evas_op_blend/Makefile
src/lib/engines/common/evas_op_copy/Makefile
src/lib/engines/common/evas_op_mask/Makefile
src/lib/engines/common/evas_op_mul/Makefile
src/lib/engines/common/evas_op_sub/Makefile
src/modules/Makefile
src/modules/engines/Makefile
src/modules/engines/software_generic/Makefile
src/modules/engines/software_x11/Makefile
src/modules/engines/software_xcb/Makefile
src/modules/engines/fb/Makefile
src/modules/engines/buffer/Makefile
src/modules/engines/software_win32_gdi/Makefile
src/modules/engines/software_qtopia/Makefile
src/modules/engines/directfb/Makefile
src/modules/engines/gl_common/Makefile
src/modules/engines/gl_x11/Makefile
src/modules/engines/cairo_common/Makefile
src/modules/engines/cairo_x11/Makefile
src/modules/engines/xrender_x11/Makefile
src/modules/engines/xrender_xcb/Makefile
src/modules/engines/glitz_x11/Makefile
src/modules/loaders/Makefile
src/modules/loaders/edb/Makefile
src/modules/loaders/eet/Makefile
src/modules/loaders/gif/Makefile
src/modules/loaders/jpeg/Makefile
src/modules/loaders/png/Makefile
src/modules/loaders/tiff/Makefile
src/modules/loaders/xpm/Makefile
src/modules/loaders/svg/Makefile
src/modules/savers/Makefile
src/modules/savers/edb/Makefile
src/modules/savers/eet/Makefile
src/modules/savers/jpeg/Makefile
src/modules/savers/png/Makefile
src/modules/savers/tiff/Makefile
src/lib/include/Makefile
evas-config
README
evas.spec
debian/changelog
],[
chmod +x evas-config
])

#####################################################################
## Info

echo
echo
echo
echo "------------------------------------------------------------------------"
echo "$PACKAGE $VERSION"
echo "------------------------------------------------------------------------"
echo
echo "Configuration Options Summary:"
echo
echo "Engines:"
echo "  Software X11............: $have_evas_software_x11"
echo "  Software XCB............: $have_evas_software_xcb"
echo "  Software Framebuffer....: $have_evas_fb"
echo "  Software Qtopia.........: $have_evas_qtopia"
echo "  Software Memory Buffer..: $have_evas_buffer"
echo "  DirectFB................: $have_evas_directfb"
echo "  OpenGL X11..............: $have_evas_gl_x11"
echo "  Cairo X11...............: $have_evas_cairo_x11"
echo "  XRender X11.............: $have_evas_xrender_x11"
echo "  XRender Xcb.............: $have_evas_xrender_xcb"
echo "  Glitz X11...............: $have_evas_glitz_x11"
# FIXME: opengl engine needs to be fixed and tested lots for all drivers
# FIXME: xrender engine to be written
echo
echo "Image Loaders:"
echo "  GIF.....................: $have_gif"
echo "  PNG.....................: $have_png"
echo "  JPEG....................: $have_jpeg"
echo "  EET.....................: $have_eet_image_loader"
echo "  EDB.....................: $have_edb_image_loader"
echo "  TIFF....................: $have_tiff"
echo "  XPM.....................: $have_xpm"
echo "  SVG.....................: $have_svg"
# FIXME: need to add modular image loader system
# FIXME: add more image loader modules
echo
echo "Font Sourcing Systems:"
echo "  EET.....................: $have_eet_font_loader"
echo
echo "Font Searching Systems:"
echo "  Fontconfig..............: $have_fontconfig"
# FIXME: add non freetype2 font engine support
# FIXME: make freetype2 optional
echo
echo "CPU Specific Extensions:"
echo "  Fallback C Code.........: $build_cpu_c"
echo "  MMX.....................: $build_cpu_mmx"
echo "  SSE.....................: $build_cpu_sse"
echo "  ALTIVEC.................: $build_cpu_altivec"
echo "  Thread Support..........: $build_pthreads"
echo
echo "ARGB Software Engine Options:"
echo "  Sampling Scaler.........: $scaler_sample"
echo "  Smooth Scaler...........: $scaler_smooth"
# FIXME: add an mxx scaler routine
echo "  YUV Converter...........: $conv_yuv"
# FIXME: add more YUV format and colorvariant support
echo
echo "ARGB Conversion Options:"
echo "  Smaller Dither Mask.....: $conv_small_dither"
echo "  No Dither Mask for 16bpp: $conv_no_dither"
echo "  8bpp RGB 332............: $conv_8_rgb_332"
echo "  8bpp RGB 666............: $conv_8_rgb_666"
echo "  8bpp RGB 232............: $conv_8_rgb_232"
echo "  8bpp RGB 222............: $conv_8_rgb_222"
echo "  8bpp RGB 221............: $conv_8_rgb_221"
echo "  8bpp RGB 121............: $conv_8_rgb_121"
echo "  8bpp RGB 111............: $conv_8_rgb_111"
# FIXME: add grayscale and B&W support
echo "  16bpp RGB 565...........: $conv_16_rgb_565"
echo "  16bpp BGR 565...........: $conv_16_bgr_565"
echo "  16bpp RGB 555...........: $conv_16_rgb_555"
echo "  16bpp RGB 444...........: $conv_16_rgb_444"
echo "  16bpp RGB 565 (444 ipaq): $conv_16_rgb_ipq"
# FIXME: add 555 (444 ipaq) support
# FIXME: add 24bpp 666 support
# FIXME: add 32bpp 666 support
# FIXME: add 30bpp support
# FIXME: add palletted support
# FIXME: add 8bpp and below rotation
echo "  16bpp Rotation 0........: $conv_16_rgb_rot_0"
echo "  16bpp Rotation 90.......: $conv_16_rgb_rot_90"
echo "  16bpp Rotation 180......: $conv_16_rgb_rot_180"
echo "  16bpp Rotation 270......: $conv_16_rgb_rot_270"
echo "  24bpp RGB 888...........: $conv_24_rgb_888"
echo "  24bpp BGR 888...........: $conv_24_bgr_888"
# FIXME: add 24bpp rotation
echo "  32bpp RGB 8888..........: $conv_32_rgb_8888"
echo "  32bpp RGBX 8888.........: $conv_32_rgbx_8888"
echo "  32bpp BGR 8888..........: $conv_32_bgr_8888"
echo "  32bpp BGRX 8888.........: $conv_32_bgrx_8888"
echo "  32bpp Rotation 0........: $conv_32_rgb_rot_0"
echo "  32bpp Rotation 90.......: $conv_32_rgb_rot_90"
echo "  32bpp Rotation 180......: $conv_32_rgb_rot_180"
echo "  32bpp Rotation 270......: $conv_32_rgb_rot_270"
echo
echo "------------------------------------------------------------------------"
echo
echo "Now type 'make' ('gmake' on some systems) to compile $PACKAGE,"
echo "and then afterwards as root (or the user who will install this), type"
echo "'make install'. Change users with 'su' or 'sudo' appropriately."
echo