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
|
AC_PREREQ(2.58)
dnl Parse Version.mk and declare m4 variables out of it
m4_define([cairo_version_macro],
m4_translit(
m4_bpatsubst(m4_include(cairo-version.h),
[^.define \([a-zA-Z0-9_]*\) *\([0-9][0-9]*\)],
[[m4_define(\1, \[\2\])]]),
[A-Z], [a-z]))
cairo_version_macro
AC_INIT([cairo],
cairo_version_major.cairo_version_minor.cairo_version_micro,
[http://bugs.freedesktop.org/enter_bug.cgi?product=cairo])
AC_CONFIG_SRCDIR(src/cairo.h)
AC_CONFIG_HEADERS(config.h)
dnl AC_CONFIG_MACRO_DIR([m4])
dnl automake 1.8 requires autoconf 2.58
dnl automake 1.7 requires autoconf 2.54
dnl automake < 1.8 does not handle TESTS=some-test$(EXEXT) as used
dnl in test/Makefile.am and perf/Makefile.am
AM_INIT_AUTOMAKE([1.8])
dnl ===========================================================================
dnl
dnl Version stuff
dnl
dnl This macro expands to one of 'git', 'snapshot', or 'release'
m4_define([cairo_release_status],
[m4_if(m4_eval(cairo_version_micro % 2), [1], [git],
[m4_if(m4_eval(cairo_version_minor % 2), [1], [snapshot],
[release])])])
dnl This is the .so/dll number. 2 for cairo-1.x.x
m4_define(cairo_version_sonum, m4_eval(cairo_version_major + 1))
dnl The libtool shared library version stuff
m4_define(cairo_version,
m4_eval(cairo_version_major*10000 + cairo_version_minor*100 + cairo_version_micro))
m4_if(m4_eval(cairo_version_minor % 2), [1],
[
dnl for unstable releases
m4_define(cairo_libtool_revision, 0)
],
[
dnl for stable releases
m4_define(cairo_libtool_revision, cairo_version_micro)
])
m4_define(cairo_libtool_current,
m4_eval(cairo_version_sonum + cairo_version - cairo_libtool_revision))
m4_define(cairo_libtool_age,
m4_eval(cairo_libtool_current - cairo_version_sonum))
CAIRO_VERSION_MAJOR=cairo_version_major
CAIRO_VERSION_MINOR=cairo_version_minor
CAIRO_VERSION_MICRO=cairo_version_micro
CAIRO_VERSION_SONUM=cairo_version_sonum
CAIRO_RELEASE_STATUS=cairo_release_status
CAIRO_LIBTOOL_VERSION_INFO=cairo_libtool_current:cairo_libtool_revision:cairo_libtool_age
AC_SUBST(CAIRO_VERSION_MAJOR)
AC_SUBST(CAIRO_VERSION_MINOR)
AC_SUBST(CAIRO_VERSION_MICRO)
AC_SUBST(CAIRO_VERSION_SONUM)
AC_SUBST(CAIRO_RELEASE_STATUS)
AC_SUBST(CAIRO_LIBTOOL_VERSION_INFO)
dnl ===========================================================================
AC_PATH_PROG(FIND, find)
AC_PATH_PROG(XARGS, xargs)
dnl ===========================================================================
AC_PROG_CC
AC_PROG_CPP
AC_PROG_CXX dnl required for BeOS (and cannot be a conditional dependency)
AC_LIBTOOL_WIN32_DLL
AC_PROG_LIBTOOL dnl required version (1.4) DON'T REMOVE!
AC_STDC_HEADERS
AC_C_INLINE
case $host_os in
darwin*)
AH_VERBATIM([X_BYTE_ORDER],[
/* Deal with multiple architecture compiles on Mac OS X */
#ifdef __APPLE_CC__
#ifdef __BIG_ENDIAN__
#define WORDS_BIGENDIAN 1
#define FLOAT_WORDS_BIGENDIAN 1
#else
#undef WORDS_BIGENDIAN
#undef FLOAT_WORDS_BIGENDIAN
#endif
#endif
])
;;
*)
AC_C_BIGENDIAN
AX_C_FLOAT_WORDS_BIGENDIAN
;;
esac
AH_BOTTOM([
#ifdef __cplusplus
# define CAIRO_BEGIN_DECLS extern "C" {
# define CAIRO_END_DECLS }
#else
# define CAIRO_BEGIN_DECLS
# define CAIRO_END_DECLS
#endif
])
dnl ===========================================================================
dnl === Local macros
dnl ===========================================================================
dnl _CHECK_FUNCS_WITH_FLAGS(FUNCTION..., CFLAGS, LIBS
dnl [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
dnl Like AC_CHECK_FUNCS but with additional CFLAGS and LIBS
dnl --------------------------------------------------------------------
AC_DEFUN([_CHECK_FUNCS_WITH_FLAGS],
[
_save_cflags="$CFLAGS"
_save_libs="$LIBS"
CFLAGS="$CFLAGS $2"
LIBS="$LIBS $3"
AC_CHECK_FUNCS($1, $4, $5)
CFLAGS="$_save_cflags"
LIBS="$_save_libs"
])
dnl ===========================================================================
AC_CHECK_LIBM
LIBS="$LIBS $LIBM"
AC_CHECK_FUNCS(vasnprintf link ctime_r drand48 flockfile)
AC_MSG_CHECKING([for Sun Solaris (non-POSIX ctime_r)])
case "$host" in
*-*-solaris*)
CFLAGS="$CFLAGS -D_POSIX_PTHREAD_SEMANTICS"
solaris_posix_pthread=yes
;;
*)
solaris_posix_pthread=no
;;
esac
AC_MSG_RESULT([$solaris_posix_pthread])
# check for GNU-extensions to fenv
AC_CHECK_HEADER(fenv.h, [AC_CHECK_FUNCS(feenableexcept fedisableexcept)])
dnl ===========================================================================
dnl
dnl Test for native atomic operations.
dnl
AC_CACHE_CHECK([for native atomic primitives], cairo_cv_atomic_primitives, [
cairo_cv_atomic_primitives="none"
AC_TRY_LINK([int atomic_add(int i) { return __sync_fetch_and_add (&i, 1); }], [],
cairo_cv_atomic_primitives="Intel"
)
])
if test "x$cairo_cv_atomic_primitives" = xIntel; then
AC_DEFINE(CAIRO_HAS_INTEL_ATOMIC_PRIMITIVES, 1, [Enable if your compiler supports the Intel __sync_* atomic primitives])
fi
AC_CACHE_CHECK([whether atomic ops require a memory barrier], cairo_cv_atomic_op_needs_memory_barrier, [
case $host_cpu in
i?86)
cairo_cv_atomic_op_needs_memory_barrier="no"
;;
x86_64)
cairo_cv_atomic_op_needs_memory_barrier="no"
;;
arm*)
cairo_cv_atomic_op_needs_memory_barrier="no"
;;
*)
cairo_cv_atomic_op_needs_memory_barrier="yes"
;;
esac
])
if test "x$cairo_cv_atomic_op_needs_memory_barrier" = "xyes"; then
AC_DEFINE_UNQUOTED(CAIRO_ATOMIC_OP_NEEDS_MEMORY_BARRIER, 1,
[whether Cairo needs memory barriers around atomic ops])
fi
dnl ===========================================================================
AC_CHECK_LIB(z, compress,
[AC_CHECK_HEADER(zlib.h, [have_libz=yes],
[have_libz="no (requires zlib http://www.gzip.org/zlib/)"])],
[have_libz="no (requires zlib http://www.gzip.org/zlib/)"])
dnl ===========================================================================
PKG_PROG_PKG_CONFIG()
if test "x$PKG_CONFIG" = x; then
AC_MSG_ERROR([pkg-config >= $PKGCONFIG_REQUIRED required but not found (http://pkgconfig.freedesktop.org/)])
fi
dnl ===========================================================================
dnl
dnl CAIRO_CONFIG_COMMANDS is like AC_CONFIG_COMMANDS, except that:
dnl
dnl 1) It redirects the stdout of the command to the file.
dnl 2) It does not recreate the file if contents didn't change.
dnl
AC_DEFUN([CAIRO_CONFIG_COMMANDS], [
AC_CONFIG_COMMANDS($1,
[
_config_file=$1
_tmp_file=cairoconf.tmp
AC_MSG_NOTICE([creating $_config_file])
{
$2
} >> "$_tmp_file"
if cmp -s "$_tmp_file" "$_config_file"; then
AC_MSG_NOTICE([$_config_file is unchanged])
rm -f "$_tmp_file"
else
mv "$_tmp_file" "$_config_file" ||
AC_MSG_ERROR([failed to update $_config_file])
fi
], $3)
])
dnl ===========================================================================
dnl
dnl cairo_cache_version should be increased every time that the backend
dnl detection stuff changes in a way that removing the config.cache file may be
dnl needed for correct operation. (this is only for the backend detection
dnl changes; it doesn't have any effect on any other cached thing.)
dnl
m4_define(cairo_cache_version, 4)
dnl ===========================================================================
dnl
dnl Define a macro to enable backends.
dnl - Macro: CAIRO_BACKEND_ENABLE (NAMESPACE, NAME, ARG, FEATURE_NAME, DEFAULT, COMMANDS)
dnl
dnl where:
dnl
dnl NAMESPACE is the sub-namespace in function names, eg. "ft" for cairo_ft_...
dnl NAME is the human-readable name of the backend, eg. "FreeType font"
dnl ARG is what enables the backend, eg. "freetype" for --enable-freetype
dnl FEATURE_NAME is what's used in cairo-features.h, eg. FT_FONT for CAIRO_HAS_FT_FONT
dnl DEFAULT is the default state of the backend:
dnl "no" for experimental backends, eg. your favorite new backend
dnl "yes" for mandatory backends, eg. png
dnl "auto" for other supported backends, eg. xlib
dnl COMMANDS are run to check whether the backend can be enabled. Their
dnl result may be cached, so user should not count on them being run.
dnl They should set use_$(NAMESPACE) to something other than yes if the
dnl backend cannot be built, eg. "no (requires SomeThing)". It then
dnl should also set $(NAMESPACE)_REQUIRES/CFLAGS/LIBS/...
dnl appropriately. Look at the macro definition for more details,
dnl or ask if in doubt.
dnl
AC_DEFUN([CAIRO_BACKEND_ENABLE],
[AC_ARG_ENABLE([$3],
AS_HELP_STRING([--enable-$3=@<:@no/auto/yes@:>@],
[Enable cairo's $2 backend @<:@default=$5@:>@]),
enable_$1=$enableval, enable_$1=$5)
if test "x$enable_$1" = xno; then
use_$1="no (disabled, use --enable-$3 to enable)"
else
if test "x$cairo_cv_backend_[]$1[]_cache_version" != "x[]cairo_cache_version"; then
# cached results for this backend (if any) are stale. force rechecking.
unset cairo_cv_backend_[]$1[]_use
fi
AC_CACHE_CHECK([for cairo's $2 backend], cairo_cv_backend_[]$1[]_use,
[echo
use_[]$1=yes
$1[]_REQUIRES=$ac_env_[]$1[]_REQUIRES_value
$1[]_CFLAGS=$ac_env_[]$1[]_CFLAGS_value
$1[]_LIBS=$ac_env_[]$1[]_LIBS_value
$1[]_NONPKGCONFIG_CFLAGS=$ac_env_[]$1[]_NONPKGCONFIG_CFLAGS_value
$1[]_NONPKGCONFIG_LIBS=$ac_env_[]$1[]_NONPKGCONFIG_LIBS_value
$1[]_BASE=cairo
$6
cairo_cv_backend_[]$1[]_use=$use_[]$1
cairo_cv_backend_[]$1[]_cache_version=cairo_cache_version
cairo_cv_backend_[]$1[]_requires=$[]$1[]_REQUIRES
cairo_cv_backend_[]$1[]_cflags=$[]$1[]_CFLAGS
cairo_cv_backend_[]$1[]_libs=$[]$1[]_LIBS
cairo_cv_backend_[]$1[]_nonpkgconfig_cflags=$[]$1[]_NONPKGCONFIG_CFLAGS
cairo_cv_backend_[]$1[]_nonpkgconfig_libs=$[]$1[]_NONPKGCONFIG_LIBS
cairo_cv_backend_[]$1[]_base=$[]$1[]_BASE
AC_MSG_CHECKING([whether cairo's $2 backend could be enabled])])
use_[]$1=$cairo_cv_backend_[]$1[]_use
$1[]_BASE=$cairo_cv_backend_[]$1[]_base
$1[]_REQUIRES="$cairo_cv_backend_[]$1[]_requires "
$1[]_CFLAGS="$cairo_cv_backend_[]$1[]_cflags "
$1[]_LIBS="$cairo_cv_backend_[]$1[]_libs "
$1[]_NONPKGCONFIG_CFLAGS="$cairo_cv_backend_[]$1[]_nonpkgconfig_cflags "
$1[]_NONPKGCONFIG_LIBS="$cairo_cv_backend_[]$1[]_nonpkgconfig_libs "
# null the ones that only have space
test "x$$1[]_REQUIRES" = "x " && $1[]_REQUIRES=""
test "x$$1[]_CFLAGS" = "x " && $1[]_CFLAGS=""
test "x$$1[]_LIBS" = "x " && $1[]_LIBS=""
test "x$$1[]_NONPKGCONFIG_CFLAGS" = "x " && $1[]_NONPKGCONFIG_CFLAGS=""
test "x$$1[]_NONPKGCONFIG_LIBS" = "x " && $1[]_NONPKGCONFIG_LIBS=""
case $enable_[]$1 in
yes)
AS_IF([test "x$use_[]$1" = xyes],,[
AC_MSG_ERROR([requested $2 backend could not be enabled])
])
;;
auto)
;;
*)
AC_MSG_ERROR([invalid argument passed to --enable-$3: $use_$1, should be one of @<:@no/auto/yes@:>@])
;;
esac
if test "x$use_[]$1" = xyes; then
CAIRO_FEATURES="$4 $CAIRO_FEATURES"
CAIRO_REQUIRES="$$1_REQUIRES$CAIRO_REQUIRES"
CAIRO_CFLAGS="$$1_NONPKGCONFIG_CFLAGS$$1_CFLAGS$CAIRO_CFLAGS"
CAIRO_LIBS="$$1_NONPKGCONFIG_LIBS$$1_LIBS$CAIRO_LIBS"
CAIRO_NONPKGCONFIG_CFLAGS="$$1_NONPKGCONFIG_CFLAGS$CAIRO_NONPKGCONFIG_CFLAGS"
CAIRO_NONPKGCONFIG_LIBS="$$1_NONPKGCONFIG_LIBS$CAIRO_NONPKGCONFIG_LIBS"
m4_define([cairo_backend_pc], m4_bpatsubst(src/cairo-$1.pc,_,-))
AC_CONFIG_FILES(cairo_backend_pc():src/cairo-backend.pc.in,
[sed \
-e "s,@backend_name@,$1,g" \
-e "s,@Backend_Name@,$2,g" \
-e "s,@BACKEND_BASE@,$$1_BASE,g" \
-e "s,@BACKEND_REQUIRES@,$$1_REQUIRES,g" \
-e "s%@BACKEND_NONPKGCONFIG_LIBS@%$$1_NONPKGCONFIG_LIBS%g" \
-e "s,@BACKEND_NONPKGCONFIG_CFLAGS@,$$1_NONPKGCONFIG_CFLAGS,g" \
-i ]cairo_backend_pc()[ ||
AC_MSG_ERROR(failed to update cairo_backend_pc())
],
[
$1_BASE='$$1_BASE'
$1_REQUIRES='$$1_REQUIRES'
$1_NONPKGCONFIG_LIBS='$$1_NONPKGCONFIG_LIBS'
$1_NONPKGCONFIG_CFLAGS='$$1_NONPKGCONFIG_CFLAGS'
])
else
# Collect list of all supported but disabled features
AS_IF([test "x$5" = xno],,[
CAIRO_NO_FEATURES="$4 $CAIRO_NO_FEATURES"
])
fi
fi
AM_CONDITIONAL(CAIRO_HAS_$4, test "x$use_$1" = xyes)
# Collect list of all supported features and cairo headers
AS_IF([test "x$5" = xno],[
CAIRO_CONFIG_AMAKE=$CAIRO_CONFIG_AMAKE'
unsupported_cairo_headers += $(cairo_$1_headers)'
CAIRO_CONFIG_WIN32=$CAIRO_CONFIG_WIN32'
unsupported_cairo_headers += $(cairo_$1_headers)'
],[
CAIRO_SUPPORTED_FEATURES="$4 $CAIRO_SUPPORTED_FEATURES"
CAIRO_CONFIG_AMAKE=$CAIRO_CONFIG_AMAKE'
supported_cairo_headers += $(cairo_$1_headers)'
CAIRO_CONFIG_WIN32=$CAIRO_CONFIG_WIN32'
supported_cairo_headers += $(cairo_$1_headers)'
])
# Collect list of all/enabled cairo source files
CAIRO_CONFIG_AMAKE=$CAIRO_CONFIG_AMAKE'
all_cairo_pkgconf += $(cairo_$1_pkgconf)
all_cairo_headers += $(cairo_$1_headers)
all_cairo_private += $(cairo_$1_private)
all_cairo_sources += $(cairo_$1_sources)
if CAIRO_HAS_$4
enabled_cairo_pkgconf += $(cairo_$1_pkgconf)
enabled_cairo_headers += $(cairo_$1_headers)
enabled_cairo_private += $(cairo_$1_private)
enabled_cairo_sources += $(cairo_$1_sources)
endif
'
CAIRO_CONFIG_WIN32=$CAIRO_CONFIG_WIN32'
all_cairo_pkgconf += $(cairo_$1_pkgconf)
all_cairo_headers += $(cairo_$1_headers)
all_cairo_private += $(cairo_$1_private)
all_cairo_sources += $(cairo_$1_sources)
ifeq ($(CAIRO_HAS_$4),1)
enabled_cairo_pkgconf += $(cairo_$1_pkgconf)
enabled_cairo_headers += $(cairo_$1_headers)
enabled_cairo_private += $(cairo_$1_private)
enabled_cairo_sources += $(cairo_$1_sources)
endif
'
# Collect warning message for enabled unsupported backends
AS_IF([test "x$use_[]$1" = xyes && test "x$5" = xno],[
CAIRO_WARNING_MESSAGE="$CAIRO_WARNING_MESSAGE
*** The $2 backend is still under active development and
*** is included in this release only as a preview. It does not
*** fully work yet and incompatible changes may yet be made
*** to $2-backend specific API.
"
],)
])
CAIRO_WARNING_MESSAGE=""
CAIRO_FEATURES=""
CAIRO_NO_FEATURES=""
CAIRO_SUPPORTED_FEATURES=""
CAIRO_REQUIRES=""
CAIRO_NONPKGCONFIG_CFLAGS=""
CAIRO_NONPKGCONFIG_LIBS="$LIBM"
CAIRO_LDADD=""
CAIRO_CFLAGS=$CAIRO_NONPKGCONFIG_CFLAGS
CAIRO_LIBS=$CAIRO_NONPKGCONFIG_LIBS
CAIRO_CONFIG_AMAKE='# Generated by configure. Do not edit.
include $(top_srcdir)/src/Sources.mk
enabled_cairo_pkgconf = cairo.pc
enabled_cairo_headers = $(cairo_headers)
enabled_cairo_private = $(cairo_private)
enabled_cairo_sources = $(cairo_sources)
all_cairo_pkgconf =
all_cairo_headers = $(cairo_headers)
all_cairo_private = $(cairo_private)
all_cairo_sources = $(cairo_sources)
supported_cairo_headers = $(cairo_headers)
unsupported_cairo_headers =
'
CAIRO_CONFIG_WIN32=$CAIRO_CONFIG_AMAKE'
enabled_cairo_headers += $(_cairo_nodist_headers) $(_cairo_extra_headers)
'
dnl ===========================================================================
CAIRO_BACKEND_ENABLE(xlib, Xlib, xlib, XLIB_SURFACE, auto, [
xlib_REQUIRES="x11"
PKG_CHECK_MODULES(xlib, $xlib_REQUIRES, ,
[AC_MSG_RESULT(no)
xlib_REQUIRES=""
AC_PATH_XTRA
if test "x$no_x" = xyes; then
use_xlib="no (requires X development libraries)"
else
xlib_NONPKGCONFIG_LIBS="$X_PRE_LIBS $X_LIBS -lX11 $X_EXTRA_LIBS"
xlib_NONPKGCONFIG_CFLAGS=$X_CFLAGS
fi])
])
CAIRO_BACKEND_ENABLE(xlib_xrender, Xlib Xrender, xlib-xrender, XLIB_XRENDER_SURFACE, auto, [
if test "x$use_xlib" != "xyes"; then
use_xlib_xrender="no (requires --enable-xlib)"
else
dnl Check for Xrender header files if the Xrender package is not installed:
xlib_xrender_BASE=cairo-xlib
xlib_xrender_REQUIRES="xrender >= 0.6"
PKG_CHECK_MODULES(xlib_xrender, $xlib_xrender_REQUIRES, ,
[AC_MSG_RESULT(no)
xlib_xrender_REQUIRES=""
old_CPPFLAGS=$CPPFLAGS
CPPFLAGS="$CPPFLAGS $xlib_CFLAGS $xlib_NONPKGCONFIG_CFLAGS"
AC_CHECK_HEADER(X11/extensions/Xrender.h,
[xlib_xrender_NONPKGCONFIG_LIBS="-lXrender"],
[use_xlib_xrender="no (requires Xrender http://freedesktop.org/Software/xlibs)"])
CPPFLAGS=$old_CPPFLAGS
])
fi
])
dnl ===========================================================================
CAIRO_BACKEND_ENABLE(xcb, XCB, xcb, XCB_SURFACE, no, [
xcb_REQUIRES="xcb >= 0.9.92 xcb-render >= 0.9.92 xcb-renderutil"
PKG_CHECK_MODULES(xcb, $xcb_REQUIRES, , [AC_MSG_RESULT(no)
use_xcb="no (requires XCB http://xcb.freedesktop.org)"])
])
dnl ===========================================================================
CAIRO_BACKEND_ENABLE(quartz, Quartz, quartz, QUARTZ_SURFACE, auto, [
dnl There is no pkgconfig for quartz; lets do a header check
AC_CHECK_HEADER(ApplicationServices/ApplicationServices.h, , [use_quartz="no (ApplicationServices framework not found)"])
if test "x$use_quartz" != "xyes" ; then
dnl check for CoreGraphics as a separate framework
AC_CHECK_HEADER(CoreGraphics/CoreGraphics.h, , [use_quartz="no (CoreGraphics framework not found)"])
quartz_LIBS="-Xlinker -framework -Xlinker CoreGraphics"
else
quartz_LIBS="-Xlinker -framework -Xlinker ApplicationServices"
fi
])
CAIRO_BACKEND_ENABLE(quartz_font, Quartz font, quartz-font, QUARTZ_FONT, auto, [
use_quartz_font=$use_quartz
])
CAIRO_BACKEND_ENABLE(quartz_image, Quartz Image, quartz-image, QUARTZ_IMAGE_SURFACE, no, [
use_quartz_image=$use_quartz
])
dnl ===========================================================================
AC_MSG_CHECKING([for native Win32])
case "$host" in
*-*-mingw*)
cairo_os_win32=yes
;;
*)
cairo_os_win32=no
;;
esac
AC_MSG_RESULT([$cairo_os_win32])
AM_CONDITIONAL(OS_WIN32, test "$cairo_os_win32" = "yes")
AC_CHECK_HEADERS([windows.h], have_windows=yes, have_windows=no)
CAIRO_BACKEND_ENABLE(win32, Microsoft Windows, win32, WIN32_SURFACE, auto, [
if test "x$have_windows" != xyes; then
use_win32="no (requires a Win32 platform)"
fi
win32_LIBS="-lgdi32 -lmsimg32"
])
CAIRO_BACKEND_ENABLE(win32_font, Microsoft Windows font, win32-font, WIN32_FONT, auto, [
use_win32_font=$use_win32
])
test_win32_printing=no
if test "x$use_win32" = "xyes"; then
AC_CHECK_PROG(GS, gs, gs)
if test "$GS"; then
AC_DEFINE([CAIRO_CAN_TEST_WIN32_PRINTING_SURFACE], 1, [Define to 1 if the Win32 Printing backend can be tested (needs ghostscript)])
test_win32_printing="yes"
else
AC_MSG_WARN([Win32 Printing backend will not be tested since ghostscript is not available])
test_win32_printing="no (requires ghostscript)"
fi
fi
AM_CONDITIONAL(CAIRO_CAN_TEST_WIN32_PRINTING_SURFACE, test "x$test_win32_printing" = "xyes")
dnl ===========================================================================
CAIRO_BACKEND_ENABLE(os2, OS/2, os2, OS2_SURFACE, no, [
case "$host" in
*-*-os2*)
:
;;
*)
use_os2="no (requires an OS/2 platform)"
;;
esac
])
dnl ===========================================================================
CAIRO_BACKEND_ENABLE(beos, BeOS/Zeta, beos, BEOS_SURFACE, no, [
case "$host" in
*-*-beos)
dnl Add libbe and libzeta if available
AC_CHECK_LIB(be,main,beos_LIBS="$beos_LIBS -lbe")
AC_CHECK_LIB(zeta,main,beos_LIBS="$beos_LIBS -lzeta")
;;
*)
use_beos="no (requires a BeOS platform)"
;;
esac
])
dnl ===========================================================================
CAIRO_BACKEND_ENABLE(png, PNG, png, PNG_FUNCTIONS, yes, [
use_png=no
AC_ARG_VAR([png_REQUIRES], [module name for libpng to search for using pkg-config])
if test "x$png_REQUIRES" = x; then
# libpng13 is GnuWin32's libpng-1.2.8 :-(
for l in libpng12 libpng13 libpng10 ; do
if $PKG_CONFIG --exists $l ; then
png_REQUIRES=$l
use_png=yes
break
fi
done
else
use_png=yes
fi
if test "x$use_png" = "xyes" ; then
PKG_CHECK_MODULES(png, $png_REQUIRES, , AC_MSG_RESULT(no))
else
AC_MSG_WARN([Could not find libpng in the pkg-config search path])
fi
])
if test "x$use_png" = "xyes"; then
:
else
AC_MSG_WARN([*** To run the tests, cairo must be built with png support ***])
fi
dnl ===========================================================================
GLITZ_MIN_VERSION=0.5.1
CAIRO_BACKEND_ENABLE(glitz, glitz, glitz, GLITZ_SURFACE, no, [
glitz_REQUIRES="glitz >= $GLITZ_MIN_VERSION"
PKG_CHECK_MODULES(glitz, $glitz_REQUIRES, , [AC_MSG_RESULT(no)
use_glitz="no (requires glitz http://freedesktop.org/Software/glitz)"])
])
if test "x$use_glitz" = "xyes";then
PKG_CHECK_MODULES(GLITZ_AGL, glitz-agl >= $GLITZ_MIN_VERSION,
[have_glitz_agl=yes], [have_glitz_agl=no; AC_MSG_RESULT(no)])
PKG_CHECK_MODULES(GLITZ_EGL, glitz-egl >= $GLITZ_MIN_VERSION,
[have_glitz_egl=yes], [have_glitz_egl=no; AC_MSG_RESULT(no)])
PKG_CHECK_MODULES(GLITZ_GLX, glitz-glx >= $GLITZ_MIN_VERSION,
[have_glitz_glx=yes], [have_glitz_glx=no; AC_MSG_RESULT(no)])
PKG_CHECK_MODULES(GLITZ_WGL, glitz-wgl >= $GLITZ_MIN_VERSION,
[have_glitz_wgl=yes], [have_glitz_wgl=no; AC_MSG_RESULT(no)])
if test "x$have_glitz_agl" = "xyes";then
AC_DEFINE(CAIRO_CAN_TEST_GLITZ_AGL_SURFACE, 1, [define if glitz backend can be tested against agl])
fi
if test "x$have_glitz_egl" = "xyes";then
AC_DEFINE(CAIRO_CAN_TEST_GLITZ_EGL_SURFACE, 1, [define if glitz backend can be tested against egl])
fi
if test "x$have_glitz_glx" = "xyes";then
AC_DEFINE(CAIRO_CAN_TEST_GLITZ_GLX_SURFACE, 1, [define if glitz backend can be tested against glx])
fi
if test "x$have_glitz_wgl" = "xyes";then
AC_DEFINE(CAIRO_CAN_TEST_GLITZ_WGL_SURFACE, 1, [define if glitz backend can be tested against wgl])
fi
fi
AM_CONDITIONAL(CAIRO_CAN_TEST_GLITZ_AGL_SURFACE, test "x$have_glitz_agl" = "xyes")
AM_CONDITIONAL(CAIRO_CAN_TEST_GLITZ_EGL_SURFACE, test "x$have_glitz_egl" = "xyes")
AM_CONDITIONAL(CAIRO_CAN_TEST_GLITZ_GLX_SURFACE, test "x$have_glitz_glx" = "xyes")
AM_CONDITIONAL(CAIRO_CAN_TEST_GLITZ_WGL_SURFACE, test "x$have_glitz_wgl" = "xyes")
dnl ===========================================================================
CAIRO_BACKEND_ENABLE(directfb, directfb, directfb, DIRECTFB_SURFACE, no, [
directfb_REQUIRES=directfb
PKG_CHECK_MODULES(directfb, $directfb_REQUIRES, , AC_MSG_RESULT(no)
[use_directfb="no (requires directfb http://www.directfb.org)"])
])
dnl ===========================================================================
# We use pkg-config to look for freetype2, but fall back to
# freetype-config if it fails. We prefer pkg-config, since we can
# then just put freetype2 >= $FREETYPE_MIN_VERSION in
# Requires.private, but at least up to 2003-06-07, there was no
# freetype2.pc in the release.
#
# FreeType versions come in three forms:
# release (such as 2.1.9)
# libtool (such as 9.7.3) (returned by freetype-config and pkg-config)
# platform-specific/soname (such as 6.3.4)
# and they recommend you never use the platform-specific version
# (see docs/VERSION.DLL in freetype2 sources)
#
# Set these as appropriate:
# release number - for information only
FREETYPE_MIN_RELEASE=2.1.9
# libtool-specific version - this is what is checked
FREETYPE_MIN_VERSION=9.7.3
CAIRO_BACKEND_ENABLE(ft, FreeType font, freetype, FT_FONT, auto, [
ft_REQUIRES="fontconfig"
PKG_CHECK_MODULES(FONTCONFIG, $ft_REQUIRES,,
[AC_MSG_RESULT(no); use_ft="no (requires fontconfig)"])
if test "x$use_ft" = "xyes"; then
_CHECK_FUNCS_WITH_FLAGS(FcFini, [$FONTCONFIG_CFLAGS], [$FONTCONFIG_LIBS])
PKG_CHECK_MODULES(FREETYPE, freetype2 >= $FREETYPE_MIN_VERSION,
[freetype_pkgconfig=yes],
[AC_MSG_RESULT(no)
freetype_pkgconfig=no])
if test "x$freetype_pkgconfig" = "xyes"; then
ft_REQUIRES="freetype2 >= $FREETYPE_MIN_VERSION $ft_REQUIRES"
else
if test -z "$FREETYPE_CONFIG"; then
AC_PATH_PROG(FREETYPE_CONFIG, freetype-config, no)
fi
if test "x$FREETYPE_CONFIG" = "xno" ; then
use_ft='no (freetype-config not found in path or $FREETYPE_CONFIG)'
else
AC_MSG_CHECKING(freetype2 libtool version)
FREETYPE_VERSION=`$FREETYPE_CONFIG --version`
VERSION_DEC=`echo $FREETYPE_VERSION | awk -F. '{printf("%d\n", 10000*$1 + 100*$2 + $3)};'`
MIN_VERSION_DEC=`echo $FREETYPE_MIN_VERSION | awk -F. '{printf("%d\n", 10000*$1 + 100*$2 + $3)};'`
if test $VERSION_DEC -lt $MIN_VERSION_DEC; then
AC_MSG_RESULT($FREETYPE_VERSION - Too old)
use_ft="no ($FREETYPE_VERSION found; version $FREETYPE_MIN_VERSION from release $FREETYPE_MIN_RELEASE required)"
else
AC_MSG_RESULT($FREETYPE_VERSION - OK)
ft_NONPKGCONFIG_CFLAGS=`$FREETYPE_CONFIG --cflags`
ft_NONPKGCONFIG_LIBS=`$FREETYPE_CONFIG --libs`
fi
fi
fi
fi
ft_CFLAGS="$FREETYPE_CFLAGS $FONTCONFIG_CFLAGS"
ft_LIBS="$FREETYPE_LIBS $FONTCONFIG_LIBS"
])
if test "x$use_ft" = "xyes"; then
_save_libs="$LIBS"
_save_cflags="$CFLAGS"
LIBS="$LIBS $ft_LIBS"
CFLAGS="$CFLAGS $ft_CFLAGS"
AC_CHECK_MEMBER(FT_Bitmap_Size.y_ppem,
HAVE_FT_BITMAP_SIZE_Y_PPEM=1,
HAVE_FT_BITMAP_SIZE_Y_PPEM=0,
[#include <ft2build.h>
#include FT_FREETYPE_H])
AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,$HAVE_FT_BITMAP_SIZE_Y_PPEM,
[FT_Bitmap_Size structure includes y_ppem field])
AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table FT_Library_SetLcdFilter)
LIBS="$_save_libs"
CFLAGS="$_save_cflags"
fi
dnl ===========================================================================
AC_ARG_ENABLE(pthread,
AS_HELP_STRING([--disable-pthread],
[Do not use pthread]),
[use_pthread=$enableval], [use_pthread=auto])
have_pthread=no
if test "x$use_pthread" != "xno"; then
AC_CHECK_HEADERS([pthread.h], have_pthread=yes, have_pthread=no)
fi
AM_CONDITIONAL(HAVE_PTHREAD, test "x$have_pthread" = "xyes")
if test "x$have_pthread" = xno -a "x$use_pthread" = xyes; then
AC_MSG_ERROR([pthread requested but not found])
fi
dnl ===========================================================================
CAIRO_BACKEND_ENABLE(ps, PostScript, ps, PS_SURFACE, yes, [
# The ps backend requires zlib.
use_ps=$have_libz
ps_NONPKGCONFIG_LIBS=-lz
])
dnl ===========================================================================
test_ps=no
if test "x$use_ps" = "xyes"; then
AC_CHECK_PROG(GS, gs, gs)
if test "$GS"; then
AC_DEFINE([CAIRO_CAN_TEST_PS_SURFACE], 1, [Define to 1 if the PS backend can be tested (needs ghostscript)])
test_ps="yes"
else
AC_MSG_WARN([PS backend will not be tested since ghostscript is not available])
test_ps="no (requires ghostscript)"
fi
fi
AM_CONDITIONAL(CAIRO_CAN_TEST_PS_SURFACE, test "x$test_ps" = "xyes")
dnl ===========================================================================
CAIRO_BACKEND_ENABLE(pdf, PDF, pdf, PDF_SURFACE, yes, [
# The pdf backend requires zlib.
use_pdf=$have_libz
pdf_NONPKGCONFIG_LIBS=-lz
])
dnl ===========================================================================
POPPLER_VERSION_REQUIRED=0.8.0
test_pdf=no
if test "x$use_pdf" = "xyes"; then
poppler_DEPENDENCY="poppler-glib >= $POPPLER_VERSION_REQUIRED"
PKG_CHECK_MODULES(POPPLER, $poppler_DEPENDENCY pango gtk+-2.0,
[_CHECK_FUNCS_WITH_FLAGS(poppler_page_render_to_pixbuf, [$POPPLER_CFLAGS], [$POPPLER_LIBS],
[test_pdf=yes],
[AC_MSG_RESULT(no); test_pdf="no (requires $poppler_DEPENDENCY)"])],
[AC_MSG_RESULT(no); test_pdf="no (requires $poppler_DEPENDENCY)"])
if test "x$test_pdf" = "xyes"; then
AC_DEFINE([CAIRO_CAN_TEST_PDF_SURFACE], 1, [Define to 1 if the PDF backend can be tested (need poppler and other dependencies for pdf2png)])
else
AC_MSG_WARN([PDF backend will not be tested since poppler >= $POPPLER_VERSION_REQUIRED is not available])
fi
fi
AM_CONDITIONAL(CAIRO_CAN_TEST_PDF_SURFACE, test "x$test_pdf" = "xyes")
AC_SUBST(POPPLER_CFLAGS)
AC_SUBST(POPPLER_LIBS)
AM_CONDITIONAL(CAIRO_HAS_MULTI_PAGE_SURFACES, test "x$use_ps" = "xyes" -o "x$use_pdf" = "xyes")
dnl ===========================================================================
CAIRO_BACKEND_ENABLE(svg, SVG, svg, SVG_SURFACE, yes, [
if test "x$use_png" != "xyes"; then
use_svg="no (requires --enable-png)"
fi
])
LIBRSVG_VERSION_REQUIRED=2.15.0
test_svg=no
if test "x$use_svg" = "xyes"; then
librsvg_DEPENDENCY="librsvg-2.0 >= $LIBRSVG_VERSION_REQUIRED"
PKG_CHECK_MODULES(LIBRSVG, $librsvg_DEPENDENCY gdk-2.0,
[_CHECK_FUNCS_WITH_FLAGS(rsvg_pixbuf_from_file, [$LIBRSVG_CFLAGS], [$LIBRSVG_LIBS],
[test_svg=yes],
[AC_MSG_RESULT(no); test_svg="no (requires $librsvg_DEPENDENCY)"])],
[AC_MSG_RESULT(no); test_svg="no (requires $librsvg_DEPENDENCY)"])
if test "x$test_svg" = "xyes"; then
AC_DEFINE([CAIRO_CAN_TEST_SVG_SURFACE], 1, [Define to 1 if the SVG backend can be tested])
else
AC_MSG_WARN([SVG backend will not be tested since librsvg >= $LIBRSVG_VERSION_REQUIRED is not available])
fi
fi
AM_CONDITIONAL(CAIRO_CAN_TEST_SVG_SURFACE, test "x$test_svg" = "xyes")
AC_SUBST(LIBRSVG_CFLAGS)
AC_SUBST(LIBRSVG_LIBS)
dnl ===========================================================================
dnl XXX make this a private feature?
CAIRO_BACKEND_ENABLE(test_surfaces, test surfaces, test-surfaces, TEST_SURFACES, no)
dnl ===========================================================================
PIXMAN_VERSION="0.11.2"
PIXMAN_REQUIRES="pixman-1 >= $PIXMAN_VERSION"
PKG_CHECK_MODULES(pixman, $PIXMAN_REQUIRES, ,
[AC_MSG_ERROR([pixman >= $PIXMAN_VERSION is required
(http://cairographics.org/releases/)])])
CAIRO_REQUIRES="$PIXMAN_REQUIRES $CAIRO_REQUIRES"
CAIRO_CFLAGS="$pixman_CFLAGS $CAIRO_CFLAGS"
CAIRO_LIBS="$pixman_LIBS $CAIRO_LIBS"
dnl ===========================================================================
dnl Build the external converter if we have any of the test backends
AM_CONDITIONAL(BUILD_ANY2PPM,
test "x$test_svg" = "xyes" \
-o "x$test_pdf" = "xyes" ) # -o "x$test_ps" = "xyes")
dnl ===========================================================================
dnl dump backend checking results
AC_CACHE_SAVE
dnl ===========================================================================
dnl Checks for precise integer types
AC_CHECK_HEADERS([stdint.h signal.h setjmp.h inttypes.h sys/int_types.h])
AC_CHECK_TYPES([uint64_t, uint128_t])
dnl Check for socket support for any2ppm daemon
AC_CHECK_HEADERS([fcntl.h unistd.h signal.h sys/stat.h sys/socket.h sys/poll.h sys/un.h])
dnl ===========================================================================
dnl check for CPU affinity support
AC_CHECK_HEADERS([sched.h], [
AC_CHECK_FUNCS([sched_getaffinity], [
AC_DEFINE([HAVE_SCHED_GETAFFINITY], [1],
[Define to 1 if you have Linux compatible sched_getaffinity])
])
])
AC_CHECK_LIB(rt, sched_yield, [RT_LIBS=-lrt], [RT_LIBS=])
CAIROPERF_LIBS=$RT_LIBS
dnl ===========================================================================
dnl Checks for misc headers
AC_CHECK_HEADERS([libgen.h byteswap.h])
dnl ===========================================================================
dnl check compiler flags
AC_DEFUN([CAIRO_CC_TRY_FLAG], [
AC_MSG_CHECKING([whether $CC supports $1])
_save_cflags="$CFLAGS"
CFLAGS="$CFLAGS -Werror $1"
AC_COMPILE_IFELSE([ ], [cairo_cc_flag=yes], [cairo_cc_flag=no])
CFLAGS="$_save_cflags"
if test "x$cairo_cc_flag" = "xyes"; then
ifelse([$2], , :, [$2])
else
ifelse([$3], , :, [$3])
fi
AC_MSG_RESULT([$cairo_cc_flag])
])
dnl Use lots of warning flags with with gcc and compatible compilers
dnl Note: if you change the following variable, the cache is automatically
dnl skipped and all flags rechecked. So there's no need to do anything
dnl else. If for any reason you need to force a recheck, just change
dnl MAYBE_WARN in an ignorable way (like adding whitespace)
MAYBE_WARN="-Wall -Wextra \
-Wsign-compare -Werror-implicit-function-declaration \
-Wpointer-arith -Wwrite-strings -Wstrict-prototypes \
-Wmissing-prototypes -Wmissing-declarations -Wnested-externs \
-Wpacked -Wswitch-enum -Wmissing-format-attribute \
-Wstrict-aliasing=2 -Winit-self -Wunsafe-loop-optimizations \
-Wdeclaration-after-statement -Wold-style-definition \
-Wno-missing-field-initializers -Wno-unused-parameter \
-Wno-attributes -Wno-long-long -Winline"
dnl We also abuse the warning-flag facility to enable other compiler
dnl options. Namely, the following:
MAYBE_WARN="$MAYBE_WARN -fno-strict-aliasing"
# invalidate cached value if MAYBE_WARN has changed
if test "x$cairo_cv_warn_maybe" != "x$MAYBE_WARN"; then
unset cairo_cv_warn_cflags
fi
AC_CACHE_CHECK([for supported warning flags], cairo_cv_warn_cflags, [
echo
WARN_CFLAGS=""
# Some warning options are not supported by all versions of
# gcc, so test all desired options against the current
# compiler.
#
# Note that there are some order dependencies
# here. Specifically, an option that disables a warning will
# have no net effect if a later option then enables that
# warnings, (perhaps implicitly). So we put some grouped
# options (-Wall and -Wextra) up front and the -Wno options
# last.
for W in $MAYBE_WARN; do
CAIRO_CC_TRY_FLAG([$W], [WARN_CFLAGS="$WARN_CFLAGS $W"])
done
cairo_cv_warn_cflags=$WARN_CFLAGS
cairo_cv_warn_maybe=$MAYBE_WARN
AC_MSG_CHECKING([which warning flags were supported])
])
WARN_CFLAGS="$cairo_cv_warn_cflags"
CAIRO_CFLAGS="$CAIRO_CFLAGS $WARN_CFLAGS"
# We only wish to enable attribute(warn_unused_result) if we can prevent
# gcc from generating thousands of warnings about the misapplication of the
# attribute to void functions and variables.
AC_CACHE_CHECK([how to enable unused result warnings], cairo_cv_warn_unused_result, [
cairo_cv_warn_unused_result=""
if echo $WARN_CFLAGS | grep -e '-Wno-attributes' >/dev/null; then
AC_TRY_COMPILE([__attribute__((__warn_unused_result__))
int f (int i) { return i; }], [],
[cairo_cv_warn_unused_result="__attribute__((__warn_unused_result__))"])
fi
])
AC_DEFINE_UNQUOTED([WARN_UNUSED_RESULT], [$cairo_cv_warn_unused_result],
[Define to the value your compiler uses to support the warn-unused-result attribute])
dnl ===========================================================================
AC_SUBST(CAIRO_REQUIRES)
AC_SUBST(CAIRO_NONPKGCONFIG_CFLAGS)
AC_SUBST(CAIRO_NONPKGCONFIG_LIBS)
AC_SUBST(CAIRO_CFLAGS)
AC_SUBST(CAIRO_LDADD)
AC_SUBST(CAIRO_LIBS)
AC_SUBST(CAIROPERF_LIBS)
dnl ===========================================================================
dnl Check for gtk-doc and docbook
GTK_DOC_CHECK([1.6])
dnl ===========================================================================
dnl Check for recent pkg-config which supports Requires.private
case `$PKG_CONFIG --version` in
[0.?|0.?.?|0.1[0-7]|0.1[0-7].?]) PKGCONFIG_REQUIRES="Requires"; ;;
*) PKGCONFIG_REQUIRES="Requires.private"; ;;
esac
AC_SUBST(PKGCONFIG_REQUIRES)
dnl ===========================================================================
cairo_has_lcov=no
AC_ARG_ENABLE(gcov,
AS_HELP_STRING([--enable-gcov],
[Enable gcov]),
[use_gcov=$enableval], [use_gcov=no])
if test "x$use_gcov" = "xyes"; then
dnl we need gcc:
if test "$GCC" != "yes"; then
AC_MSG_ERROR([GCC is required for --enable-gcov])
fi
dnl Check if ccache is being used
AC_CHECK_PROG(SHTOOL, shtool, shtool)
case `$SHTOOL path $CC` in
*ccache*[)] gcc_ccache=yes;;
*[)] gcc_ccache=no;;
esac
if test "$gcc_ccache" = "yes" && (test -z "$CCACHE_DISABLE" || test "$CCACHE_DISABLE" != "1"); then
AC_MSG_ERROR([ccache must be disabled when --enable-gcov option is used. You can disable ccache by setting environment variable CCACHE_DISABLE=1.])
fi
ltp_version_list="1.6 1.5 1.4"
AC_CHECK_PROG(LTP, lcov, lcov)
AC_CHECK_PROG(LTP_GENHTML, genhtml, genhtml)
if test "$LTP"; then
AC_CACHE_CHECK([for ltp version], cairo_cv_ltp_version, [
cairo_cv_ltp_version=invalid
ltp_version=`$LTP -v 2>/dev/null | $SED -e 's/^.* //'`
for ltp_check_version in $ltp_version_list; do
if test "$ltp_version" = "$ltp_check_version"; then
cairo_cv_ltp_version="$ltp_check_version (ok)"
fi
done
])
fi
case $cairo_cv_ltp_version in
""|invalid[)]
;;
*)
cairo_has_lcov=yes
;;
esac
if test "x$cairo_has_lcov" != "xyes"; then
AC_MSG_ERROR([[To enable code coverage reporting you must have one of the following LTP versions installed: $ltp_version_list.
Please install the Linux Test Project [http://ltp.sourceforge.net/], and try again.]])
fi
if test -z "$LTP_GENHTML"; then
AC_MSG_ERROR([[Could not find genhtml from the LTP package.
Please install the Linux Test Project [http://ltp.sourceforge.net/], and try again.]])
fi
AC_DEFINE(HAVE_GCOV, 1, [Whether you have gcov])
dnl PHP_ADD_MAKEFILE_FRAGMENT($abs_srcdir/Makefile.gcov, $abs_srcdir)
dnl Remove all optimization flags from CFLAGS
changequote({,})
CFLAGS=`echo "$CFLAGS" | $SED -e 's/-O[0-9]*//g'`
CAIRO_CFLAGS=`echo "$CAIRO_CFLAGS" | $SED -e 's/-O[0-9]*//g'`
changequote([,])
dnl Add the special gcc flags
CAIRO_CFLAGS="$CAIRO_CFLAGS -O0 -fprofile-arcs -ftest-coverage"
CAIRO_LDADD="$CAIRO_LDADD -lgcov"
fi
AM_CONDITIONAL(CAIRO_HAS_LCOV, test "x$cairo_has_lcov" = "xyes")
dnl ===========================================================================
AC_ARG_ENABLE(some-floating-point,
AS_HELP_STRING([--disable-some-floating-point],
[Disable certain code paths that rely heavily on double precision
floating-point calculation. This option can improve
performance on systems without a double precision floating-point
unit, but might degrade performance on those that do.]), [
if test "x$enableval" = "xno"; then
# A value of 'no' for $enableval means that they want to disable, which
# means 'yes' for $disable_some_floating_point.
disable_some_floating_point=yes
fi
], [disable_some_floating_point=no])
AM_CONDITIONAL(DISABLE_SOME_FLOATING_POINT,
test "x$disable_some_floating_point" = "xyes")
if test "x$disable_some_floating_point" = "xyes"; then
AC_DEFINE(DISABLE_SOME_FLOATING_POINT, 1,
[Define to 1 to disable certain code paths that rely heavily on
double precision floating-point calculation])
fi
dnl ===========================================================================
CAIRO_CONFIG_COMMANDS([$srcdir/src/Config.mk],
[echo "$CAIRO_CONFIG_AMAKE"],
[CAIRO_CONFIG_AMAKE='$CAIRO_CONFIG_AMAKE'])
CAIRO_CONFIG_COMMANDS([$srcdir/src/Config.mk.win32],
[echo "$CAIRO_CONFIG_WIN32"],
[CAIRO_CONFIG_WIN32='$CAIRO_CONFIG_WIN32'])
CAIRO_CONFIG_COMMANDS([src/cairo-features.h],
[
echo '/* Generated by configure. Do not edit. */'
echo '#ifndef CAIRO_FEATURES_H'
echo '#define CAIRO_FEATURES_H'
echo ''
for FEATURE in $CAIRO_FEATURES; do
echo "#define CAIRO_HAS_$FEATURE 1"
done | LANG=C sort
echo ''
for FEATURE in $CAIRO_NO_FEATURES; do
echo "/*#undef CAIRO_HAS_$FEATURE */"
done | LANG=C sort
echo ''
echo '#endif'
],[
CAIRO_FEATURES='$CAIRO_FEATURES'
CAIRO_NO_FEATURES='$CAIRO_NO_FEATURES'
])
CAIRO_CONFIG_COMMANDS([src/cairo-supported-features.h],
[
echo '/* Generated by configure. Do not edit. */'
echo '#ifndef CAIRO_SUPPORTED_FEATURES_H'
echo '#define CAIRO_SUPPORTED_FEATURES_H'
echo ''
echo '/* This is a dummy header, to trick gtk-doc only */'
echo ''
for FEATURE in $CAIRO_SUPPORTED_FEATURES; do
echo "#define CAIRO_HAS_$FEATURE 1"
done
echo ''
echo '#endif'
],[
CAIRO_SUPPORTED_FEATURES='$CAIRO_SUPPORTED_FEATURES'
])
AC_CONFIG_FILES([
Makefile
boilerplate/Makefile
src/Makefile
test/Makefile
test/pdiff/Makefile
perf/Makefile
util/Makefile
doc/Makefile
doc/public/Makefile
doc/public/version.xml
src/cairo.pc
])
AC_OUTPUT
dnl ===========================================================================
V="$CAIRO_VERSION_MAJOR.$CAIRO_VERSION_MINOR.$CAIRO_VERSION_MICRO"
echo ""
echo "cairo (version $V [[$CAIRO_RELEASE_STATUS]]) will be compiled with the following surface backends:"
echo " Image: yes (always builtin)"
echo " Xlib: $use_xlib"
echo " Xlib Xrender: $use_xlib_xrender"
echo " Quartz: $use_quartz"
echo " Quartz-image: $use_quartz_image"
echo " XCB: $use_xcb"
echo " Win32: $use_win32"
echo " OS2: $use_os2"
echo " PostScript: $use_ps"
echo " PDF: $use_pdf"
echo " SVG: $use_svg"
echo " glitz: $use_glitz"
echo " BeOS: $use_beos"
echo " DirectFB: $use_directfb"
echo ""
echo "the following font backends:"
echo " User: yes (always builtin)"
echo " FreeType: $use_ft"
echo " Win32: $use_win32_font"
echo " Quartz: $use_quartz_font"
echo ""
echo "the following features:"
echo " PNG functions: $use_png"
echo ""
echo "and the following debug options:"
echo " gcov support: $use_gcov"
echo " test surfaces: $use_test_surfaces"
echo " ps testing: $test_ps"
echo " pdf testing: $test_pdf"
echo " svg testing: $test_svg"
if test x"$use_win32" = "xyes"; then
echo " win32 printing testing: $test_win32_printing"
fi
echo ""
echo "using CFLAGS:"
echo $CAIRO_CFLAGS
echo ""
if test x"$use_ft" != "xyes" && \
test x"$use_win32_font" != "xyes" && \
test x"$use_quartz_font" != "xyes" ; then
AC_MSG_ERROR([Cairo requires at least one font backend.
Please install freetype and fontconfig, then try again:
http://freetype.org/ http://fontconfig.org/
])
fi
echo "$CAIRO_WARNING_MESSAGE"
|