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
|
AC_PREREQ(2.54)
# cairo package version number, (as distinct from shared library version)
# An odd micro number indicates in-progress development, (eg. from CVS)
# An even micro number indicates a released version.
m4_define(cairo_version_major, 1)
m4_define(cairo_version_minor, 1)
m4_define(cairo_version_micro, 1)
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)
AM_INIT_AUTOMAKE([1.7])
dnl ===========================================================================
# libtool shared library version
# Increment if the interface has additions, changes, removals.
LT_CURRENT=5
# Increment any time the source changes; set to
# 0 if you increment CURRENT
LT_REVISION=0
# Increment if any interfaces have been added; set to 0
# if any interfaces have been removed. removal has
# precedence over adding, so set to 0 if both happened.
LT_AGE=3
dnl ===========================================================================
VERSION_INFO="$LT_CURRENT:$LT_REVISION:$LT_AGE"
AC_SUBST(VERSION_INFO)
LT_CURRENT_MINUS_AGE=`expr $LT_CURRENT - $LT_AGE`
AC_SUBST(LT_CURRENT_MINUS_AGE)
CAIRO_VERSION_MAJOR=cairo_version_major()
CAIRO_VERSION_MINOR=cairo_version_minor()
CAIRO_VERSION_MICRO=cairo_version_micro()
AC_SUBST(CAIRO_VERSION_MAJOR)
AC_SUBST(CAIRO_VERSION_MINOR)
AC_SUBST(CAIRO_VERSION_MICRO)
AC_SUBST(CAIRO_VERSION_OTHER)
AM_MAINTAINER_MODE
AC_PROG_CC
AC_PROG_CPP
AM_PROG_LIBTOOL
AC_STDC_HEADERS
AC_C_BIGENDIAN
dnl ===========================================================================
dnl === Local macros
dnl ===========================================================================
# _CHECK_FUNCS_WITH_FLAGS(FUNCTION..., CFLAGS, LIBS
# [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
# Like AC_CHECK_FUNCS but with additional CFLAGS and LIBS
# --------------------------------------------------------------------
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_FUNCS(vasnprintf)
AC_CHECK_LIBM
LIBS="$LIBS $LIBM"
dnl ===========================================================================
PKG_PROG_PKG_CONFIG
dnl ===========================================================================
AC_ARG_ENABLE(xlib,
[ --disable-xlib Disable cairo's Xlib backend],
[use_xlib=$enableval], [use_xlib=yes])
if test "x$use_xlib" = "xyes"; then
dnl Check for Xrender header files if the Xrender package is not installed:
PKG_CHECK_MODULES(XRENDER, xrender >= 0.6, [
XRENDER_REQUIRES=xrender
use_xlib=yes], [
AC_CHECK_HEADER(X11/extensions/Xrender.h, [
AC_PATH_XTRA
XRENDER_LIBS="$X_LIBS -lXrender -lXext -lX11 $X_EXTRA_LIBS"
use_xlib=yes], [
use_xlib="no (requires Xrender http://freedesktop.org/Software/xlibs)"])])
_CHECK_FUNCS_WITH_FLAGS(XrmFinalize, $XRENDER_CFLAGS, $XRENDER_LIBS)
fi
AM_CONDITIONAL(CAIRO_HAS_XLIB_SURFACE, test "x$use_xlib" = "xyes")
if test "x$use_xlib" = "xyes"; then
XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
fi
AC_SUBST(XLIB_SURFACE_FEATURE)
AC_SUBST(XRENDER_REQUIRES)
CAIRO_CFLAGS="$CAIRO_CFLAGS $XRENDER_CFLAGS"
CAIRO_LIBS="$CAIRO_LIBS $XRENDER_LIBS"
AC_ARG_ENABLE(quartz,
[ --enable-quartz Enable cairo's Quartz backend],
[use_quartz=$enableval], [use_quartz=no])
if test "x$use_quartz" = "xyes"; then
dnl There is no pkgconfig for quartz; lets do a header check
AC_CHECK_HEADER(Carbon/Carbon.h, [use_quartz=yes], [use_quartz=no])
fi
AM_CONDITIONAL(CAIRO_HAS_QUARTZ_SURFACE, test "x$use_quartz" = "xyes")
if test "x$use_quartz" = "xyes"; then
QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
QUARTZ_LIBS="-Xlinker -framework -Xlinker Carbon"
fi
AC_SUBST(QUARTZ_SURFACE_FEATURE)
CAIRO_LIBS="$CAIRO_LIBS $QUARTZ_LIBS"
dnl ===========================================================================
AC_ARG_ENABLE(xcb,
[ --enable-xcb Enable cairo's XCB backend],
[use_xcb=$enableval], [use_xcb=no])
if test "x$use_xcb" = "xyes"; then
PKG_CHECK_MODULES(XCB, xcb, [use_xcb=yes], [
use_xcb="no (requires XCB http://xcb.freedesktop.org)"])
fi
AM_CONDITIONAL(CAIRO_HAS_XCB_SURFACE, test "x$use_xcb" = "xyes")
if test "x$use_xcb" = "xyes"; then
XCB_SURFACE_FEATURE="#define CAIRO_HAS_XCB_SURFACE 1"
fi
AC_SUBST(XCB_SURFACE_FEATURE)
CAIRO_CFLAGS="$CAIRO_CFLAGS $XCB_CFLAGS"
CAIRO_LIBS="$CAIRO_LIBS $XCB_LIBS"
dnl ===========================================================================
AC_MSG_CHECKING([for some Win32 platform])
case "$host" in
*-*-mingw*|*-*-cygwin*)
cairo_platform_win32=yes
;;
*)
cairo_platform_win32=no
;;
esac
AC_MSG_RESULT([$cairo_platform_win32])
AC_ARG_ENABLE(win32,
[ --disable-win32 Disable cairo's Microsoft Windows backend],
[use_win32=$enableval], [use_win32="yes"])
if test "x$cairo_platform_win32" != "xyes" ; then
use_win32=no
fi
if test "x$use_win32" = "xyes"; then
CAIRO_LIBS="$CAIRO_LIBS -lgdi32 -lmsimg32"
fi
AM_CONDITIONAL(CAIRO_HAS_WIN32_SURFACE, test "x$use_win32" = "xyes")
if test "x$use_win32" = "xyes"; then
WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
fi
AC_SUBST(WIN32_SURFACE_FEATURE)
AM_CONDITIONAL(CAIRO_HAS_WIN32_FONT, test "x$use_win32" = "xyes")
if test "x$use_win32" = "xyes"; then
WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
fi
AC_SUBST(WIN32_FONT_FEATURE)
dnl ===========================================================================
AC_MSG_CHECKING([for BeOS/Zeta])
case "$host" in
*-*-beos)
cairo_platform_beos=yes
;;
*)
cairo_platform_beos=no
;;
esac
AC_MSG_RESULT([$cairo_platform_beos])
AC_ARG_ENABLE(beos,
[ --enable-beos Disable cairo's BeOS/Zeta backend],
[use_beos=$enableval], [use_beos=no])
if test "x$cairo_platform_beos" != "xyes" ; then
if test "x$use_beos" = "xyes"; then
AC_MSG_WARN([The BeOS backend requires a BeOS platform; disabling])
use_beos=no
fi
fi
if test "x$use_beos" = "xyes"; then
AC_PROG_CXX
dnl Add libbe and libzeta if available
AC_CHECK_LIB(be,main,CAIRO_LIBS="$CAIRO_LIBS -lbe")
AC_CHECK_LIB(zeta,main,CAIRO_LIBS="$CAIRO_LIBS -lzeta")
fi
AM_CONDITIONAL(CAIRO_HAS_BEOS_SURFACE, test "x$use_beos" = "xyes")
if test "x$use_beos" = "xyes"; then
BEOS_SURFACE_FEATURE="#define CAIRO_HAS_BEOS_SURFACE 1"
fi
AC_SUBST(BEOS_SURFACE_FEATURE)
dnl ===========================================================================
AC_ARG_ENABLE(png,
[ --disable-png Disable cairo's PNG functions],
[use_png=$enableval], [use_png=yes])
if test "x$use_png" = "xyes"; then
use_png=no
# 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
if test "x$use_png" = "xyes" ; then
# Sets PNG_CFLAGS, PNG_LIBS
PKG_CHECK_MODULES(PNG, $PNG_REQUIRES)
else
AC_MSG_WARN([Could not find libpng in the pkg-config search path])
fi
fi
AM_CONDITIONAL(CAIRO_HAS_PNG_FUNCTIONS, test "x$use_png" = "xyes")
if test "x$use_png" = "xyes"; then
PNG_FUNCTIONS_FEATURE="#define CAIRO_HAS_PNG_FUNCTIONS 1"
else
AC_MSG_WARN([*** To run the tests, cairo must be built with png support ***])
fi
AC_SUBST(PNG_FUNCTIONS_FEATURE)
CAIRO_CFLAGS="$CAIRO_CFLAGS $PNG_CFLAGS"
CAIRO_LIBS="$CAIRO_LIBS $PNG_LIBS"
AC_SUBST(PNG_REQUIRES)
dnl ===========================================================================
AC_ARG_ENABLE(glitz,
[ --enable-glitz Enable cairo's glitz backend],
[use_glitz=$enableval], [use_glitz=no])
if test "x$use_glitz" = "xyes"; then
PKG_CHECK_MODULES(GLITZ, glitz >= 0.5.1, [
GLITZ_REQUIRES=glitz
use_glitz=yes], [use_glitz="no (requires glitz http://freedesktop.org/Software/glitz)"])
fi
if test "x$use_glitz" = "xyes";then
PKG_CHECK_MODULES(GLITZ_AGL, glitz-agl >= 0.5.1,
[have_glitz_agl=yes], [have_glitz_agl=no])
PKG_CHECK_MODULES(GLITZ_EGL, glitz-egl >= 0.5.1,
[have_glitz_egl=yes], [have_glitz_egl=no])
PKG_CHECK_MODULES(GLITZ_GLX, glitz-glx >= 0.5.1,
[have_glitz_glx=yes], [have_glitz_glx=no])
PKG_CHECK_MODULES(GLITZ_WGL, glitz-wgl >= 0.5.1,
[have_glitz_wgl=yes], [have_glitz_wgl=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")
AM_CONDITIONAL(CAIRO_HAS_GLITZ_SURFACE, test "x$use_glitz" = "xyes")
if test "x$use_glitz" = "xyes"; then
GLITZ_SURFACE_FEATURE="#define CAIRO_HAS_GLITZ_SURFACE 1"
fi
AC_SUBST(GLITZ_SURFACE_FEATURE)
CAIRO_CFLAGS="$CAIRO_CFLAGS $GLITZ_CFLAGS"
CAIRO_LIBS="$CAIRO_LIBS $GLITZ_LIBS"
AC_SUBST(GLITZ_REQUIRES)
dnl ===========================================================================
AC_ARG_ENABLE(directfb,
[ --enable-directfb Enable cairo's directfb backend],
[use_directfb=$enableval], [use_directfb=no])
if test "x$use_directfb" = "xyes"; then
PKG_CHECK_MODULES(DIRECTFB, directfb, [use_directfb=yes], [
use_directfb="no (requires directfb http://www.directfb.org)"])
fi
AM_CONDITIONAL(CAIRO_HAS_DIRECTFB_SURFACE, test "x$use_directfb" = "xyes")
if test "x$use_directfb" = "xyes"; then
DIRECTFB_SURFACE_FEATURE="#define CAIRO_HAS_DIRECTFB_SURFACE 1"
fi
AC_SUBST(DIRECTFB_SURFACE_FEATURE)
CAIRO_CFLAGS="$CAIRO_CFLAGS $DIRECTFB_CFLAGS"
CAIRO_LIBS="$CAIRO_LIBS $DIRECTFB_LIBS"
dnl ===========================================================================
AC_ARG_ENABLE(freetype,
[ --disable-freetype Disable cairo's freetype font backend],
[use_freetype=$enableval], [use_freetype=yes])
if test "x$use_freetype" = "xyes"; then
PKG_CHECK_MODULES(FONTCONFIG, fontconfig,
[use_freetype=yes], [use_freetype=no])
_CHECK_FUNCS_WITH_FLAGS(FcFini, $FONTCONFIG_CFLAGS, $FONTCONFIG_LIBS)
fi
CAIRO_CFLAGS="$CAIRO_CFLAGS $FONTCONFIG_CFLAGS"
CAIRO_LIBS="$CAIRO_LIBS $FONTCONFIG_LIBS"
# 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.5)
# libtool (such as 9.4.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.0
# libtool-specific version - this is what is checked
FREETYPE_MIN_VERSION=8.0.2
if test "x$use_freetype" = "xyes"; then
PKG_CHECK_MODULES(FREETYPE, freetype2 >= $FREETYPE_MIN_VERSION,
[freetype_pkgconfig=yes], [freetype_pkgconfig=no])
if test "x$freetype_pkgconfig" = "xyes"; then
FREETYPE_REQUIRES="freetype2 >= $FREETYPE_MIN_VERSION fontconfig"
else
if test -z "$FREETYPE_CONFIG"; then
AC_PATH_PROG(FREETYPE_CONFIG, freetype-config, no)
fi
if test "$FREETYPE_CONFIG" = "no" ; then
AC_MSG_WARN([No freetype-config script found in path or FREETYPE_CONFIG])
use_freetype=no
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)
AC_MSG_WARN([$FREETYPE_VERSION - version $FREETYPE_MIN_VERSION from release $FREETYPE_MIN_RELEASE required])
use_freetype=no
else
AC_MSG_RESULT($FREETYPE_VERSION - OK)
FREETYPE_CONFIG_CFLAGS=`$FREETYPE_CONFIG --cflags`
FREETYPE_CONFIG_LIBS=`$FREETYPE_CONFIG --libs`
FREETYPE_CFLAGS=$FREETYPE_CONFIG_CFLAGS
FREETYPE_LIBS=$FREETYPE_CONFIG_LIBS
FREETYPE_REQUIRES=fontconfig
fi
fi
fi
fi
have_ft_load_sfnt_table=no
if test "x$use_freetype" = "xyes"; then
AC_SUBST(FREETYPE_CFLAGS)
AC_SUBST(FREETYPE_LIBS)
AC_SUBST(FREETYPE_CONFIG_CFLAGS)
AC_SUBST(FREETYPE_CONFIG_LIBS)
AC_SUBST(FREETYPE_REQUIRES)
temp_save_libs="$LIBS"
temp_save_cflags="$CFLAGS"
LIBS="$LIBS $FREETYPE_LIBS"
CFLAGS="$CFLAGS $FREETYPE_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_FUNC(FT_Load_Sfnt_Table, have_ft_load_sfnt_table=yes)
AC_CHECK_FUNCS(FT_GlyphSlot_Embolden)
LIBS="$temp_save_libs"
CFLAGS="$temp_save_cflags"
fi
CAIRO_CFLAGS="$CAIRO_CFLAGS $FREETYPE_CFLAGS"
CAIRO_LIBS="$CAIRO_LIBS $FREETYPE_LIBS"
AM_CONDITIONAL(CAIRO_HAS_FT_FONT, test "x$use_freetype" = "xyes")
if test "x$use_freetype" = "xyes"; then
FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
fi
AC_SUBST(FT_FONT_FEATURE)
dnl ===========================================================================
AC_CHECK_HEADERS([pthread.h], have_pthread=yes, have_pthread=no)
AM_CONDITIONAL(HAVE_PTHREAD, test "x$have_pthread" = "xyes")
dnl ===========================================================================
AC_ARG_ENABLE(ps,
[ --disable-ps Disable cairo's PostScript backend],
[use_ps=$enableval], [use_ps=yes])
if test x"$have_ft_load_sfnt_table" != "xyes" ; then
AC_MSG_WARN([PS backend requires FreeType 2.1.4 or newer, disabling])
use_ps=no
fi
# The postscript module requires zlib.
AC_CHECK_LIB(z, compress,
[AC_CHECK_HEADER(zlib.h, [],
[use_ps="no (requires zlib http://www.gzip.org/zlib/)"])],
[use_ps="no (requires zlib http://www.gzip.org/zlib/)"])
AM_CONDITIONAL(CAIRO_HAS_PS_SURFACE, test "x$use_ps" = "xyes")
if test "x$use_ps" = "xyes"; then
PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
PS_LIBS=-lz
fi
AC_SUBST(PS_SURFACE_FEATURE)
CAIRO_LIBS="$CAIRO_LIBS $PS_LIBS"
AC_SUBST(PS_LIBS)
dnl ===========================================================================
AC_ARG_ENABLE(pdf,
[ --disable-pdf Disable cairo's PDF backend],
[use_pdf=$enableval], [use_pdf=yes])
if test x"$have_ft_load_sfnt_table" != "xyes" ; then
AC_MSG_WARN([PDF backend requires FreeType 2.1.4 or newer, disabling])
use_pdf=no
fi
test_pdf=no
AM_CONDITIONAL(CAIRO_HAS_PDF_SURFACE, test "x$use_pdf" = "xyes")
if test "x$use_pdf" = "xyes"; then
PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
PDF_LIBS=-lz
PKG_CHECK_MODULES(POPPLER, poppler-glib >= 0.4.1 pango gtk+-2.0, [test_pdf=yes], [test_pdf=no])
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 is not available])
fi
fi
AC_SUBST(PDF_SURFACE_FEATURE)
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")
CAIRO_LIBS="$CAIRO_LIBS $PDF_LIBS"
AC_SUBST(PDF_LIBS)
dnl ===========================================================================
AC_ARG_ENABLE(svg,
[ --enable-svg Enable cairo's SVG backend],
[use_svg=$enableval], [use_svg=no])
if test x"$have_ft_load_sfnt_table" != "xyes" ; then
AC_MSG_WARN([SVG backend requires FreeType 2.1.4 or newer, disabling])
use_svg=no
fi
if test "x$use_svg" = "xyes" ; then
use_svg=no
if $PKG_CONFIG --exists libxml-2.0 ; then
# Sets XML_CFLAGS, XML_LIBS
PKG_CHECK_MODULES(XML, libxml-2.0)
use_svg=yes
else
AC_MSG_WARN([SVG requires libxml2, which is not found in pkg-config search path, disabling])
fi
fi
AM_CONDITIONAL(CAIRO_HAS_SVG_SURFACE, test "x$use_svg" = "xyes")
if test "x$use_svg" = "xyes"; then
SVG_SURFACE_FEATURE="#define CAIRO_HAS_SVG_SURFACE 1"
PKG_CHECK_MODULES(LIBRSVG, librsvg-2.0 gdk-2.0, [test_svg=yes], [test_svg=no])
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 (need librsvg)])
else
AC_MSG_WARN([SVG backend will not be tested since a librsvg is not available])
fi
fi
AC_SUBST(SVG_SURFACE_FEATURE)
AM_CONDITIONAL(CAIRO_CAN_TEST_SVG_SURFACE, test "x$test_svg" = "xyes")
AC_SUBST(LIBRSVG_CFLAGS)
AC_SUBST(LIBRSVG_LIBS)
CAIRO_CFLAGS="$CAIRO_CFLAGS $XML_CFLAGS"
CAIRO_LIBS="$CAIRO_LIBS $XML_LIBS"
dnl ===========================================================================
dnl This check should default to 'yes' once we have code to actually
dnl check for the atsui font backend.
AC_ARG_ENABLE(atsui,
[ --enable-atsui Enable cairo's atsui font backend],
[use_atsui=$enableval], [use_atsui=no])
if test "x$use_atsui" = "xyes"; then
dnl There is no pkgconfig for atsui; lets do a header check
AC_CHECK_HEADER(Carbon/Carbon.h, [use_atsui=yes], [use_atsui=no])
fi
AM_CONDITIONAL(CAIRO_HAS_ATSUI_FONT, test "x$use_atsui" = "xyes")
if test "x$use_atsui" = "xyes"; then
ATSUI_FONT_FEATURE="#define CAIRO_HAS_ATSUI_FONT 1"
fi
AC_SUBST(ATSUI_FONT_FEATURE)
dnl ===========================================================================
dnl Checks for precise integer types
AC_CHECK_HEADERS([stdint.h inttypes.h sys/int_types.h])
AC_CHECK_TYPES([uint64_t, uint128_t])
dnl Use lots of warning flags with GCC
WARN_CFLAGS=""
if test "x$GCC" = "xyes"; then
WARN_CFLAGS="-Wall -Wpointer-arith -Wstrict-prototypes \
-Wmissing-prototypes -Wmissing-declarations \
-Wnested-externs -fno-strict-aliasing"
fi
CAIRO_CFLAGS="$CAIRO_CFLAGS $WARN_CFLAGS"
CAIRO_LIBS="$CAIRO_LIBS"
AC_SUBST(CAIRO_CFLAGS)
AC_SUBST(CAIRO_LIBS)
dnl ===========================================================================
dnl Check for gtk-doc and docbook
GTK_DOC_CHECK([1.3])
dnl ===========================================================================
dnl Check for recent pkg-config which supports Requires.private
case `$PKG_CONFIG --version` in
0.?|0.1[0-7]) PKGCONFIG_REQUIRES="Requires"; ;;
*) PKGCONFIG_REQUIRES="Requires.private"; ;;
esac
AC_SUBST(PKGCONFIG_REQUIRES)
dnl ===========================================================================
dnl Check for MMX
MMX_CFLAGS="-mmmx -Winline --param inline-unit-growth=10000 --param large-function-growth=10000"
have_mmx_intrinsics=no
AC_MSG_CHECKING(For MMX/SSE intrinsics in the compiler)
xserver_save_CFLAGS=$CFLAGS
CFLAGS="$CFLAGS $MMX_CFLAGS"
AC_COMPILE_IFELSE([
#if defined(__GNUC__) && (__GNUC__ < 3 || (__GNUC__ == 3 && __GNUC_MINOR__ < 4))
#error "Need GCC >= 3.4 for MMX intrinsics"
#endif
#include <mmintrin.h>
int main () {
__m64 v = _mm_cvtsi32_si64 (1);
__m64 w = _mm_slli_si64 (v, 1);
v = _mm_or_si64 (v, w);
return _mm_cvtsi64_si32 (v);
}], have_mmx_intrinsics=yes)
CFLAGS=$xserver_save_CFLAGS
AC_MSG_RESULT($have_mmx_intrinsics)
if test $have_mmx_intrinsics = yes ; then
AC_DEFINE(USE_MMX, 1, [use MMX compiler intrinsics])
else
MMX_CFLAGS=
fi
AC_SUBST(MMX_CFLAGS)
AM_CONDITIONAL(USE_MMX, test $have_mmx_intrinsics = yes)
dnl ===========================================================================
AC_ARG_ENABLE(gcov,
[ --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
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.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
])
else
ltp_msg="To enable code coverage reporting you must have one of the following LTP versions installed: $ltp_version_list"
AC_MSG_ERROR([$ltp_msg])
fi
case $cairo_cv_ltp_version in
""|invalid[)]
ltp_msg="You must have one of the following versions of LTP: $ltp_version_list (found: $ltp_version)."
AC_MSG_ERROR([$ltp_msg])
LTP="exit 0;"
;;
esac
if test -z "$LTP_GENHTML"; then
AC_MSG_ERROR([Could not find genhtml from the LTP package])
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({,})
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"
fi
dnl ===========================================================================
AC_ARG_ENABLE(test-surfaces,
[ --enable-test-surfaces Add backends for more test suite coverage (no additional public functionality)],
[use_test_surfaces=$enableval], [use_test_surfaces=no])
AM_CONDITIONAL(CAIRO_HAS_TEST_SURFACES, test "x$use_test_surfaces" = "xyes")
if test "x$use_test_surfaces" = "xyes"; then
AC_DEFINE(CAIRO_HAS_TEST_SURFACES, 1, [define in the extra test surface have been built into cairo for the test suite])
fi
dnl ===========================================================================
AC_OUTPUT([
cairo.pc
Makefile
pixman/Makefile
pixman/src/Makefile
src/Makefile
src/cairo-features.h
test/Makefile
doc/Makefile
doc/public/Makefile
doc/public/version.xml
])
dnl ===========================================================================
echo ""
echo "cairo will be compiled with the following surface backends:"
echo " image: yes (always builtin)"
echo " Xlib: $use_xlib"
echo " Quartz: $use_quartz"
echo " XCB: $use_xcb"
echo " Win32: $use_win32"
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 " FreeType: $use_freetype"
echo " Win32: $use_win32"
echo " ATSUI: $use_atsui"
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 ""
echo "using CFLAGS:"
echo $CAIRO_CFLAGS
echo ""
if test x"$use_freetype" != "xyes" && \
test x"$use_win32" != "xyes" && \
test x"$use_atsui" != "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
WARNING_MESSAGE='
*** The @BACKEND@ 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 @BACKEND@-backend specific API.
'
if test x"$use_glitz" = "xyes" ; then
echo "$WARNING_MESSAGE" | sed 's/@BACKEND@/Glitz/'
fi
if test x"$use_xcb" = "xyes" ; then
echo "$WARNING_MESSAGE" | sed 's/@BACKEND@/XCB/'
fi
if test x"$use_quartz" = "xyes" ; then
echo "$WARNING_MESSAGE" | sed 's/@BACKEND@/Quartz/'
fi
if test x"$use_quartz" = "xyes" ; then
echo "$WARNING_MESSAGE" | sed 's/@BACKEND@/ATSUI/'
fi
if test x"$use_beos" = "xyes" ; then
echo "$WARNING_MESSAGE" | sed 's/@BACKEND@/BeOS/'
fi
if test x"$use_directfb" == "xyes" ; then
echo "$WARNING_MESSAGE" | sed 's/@BACKEND@/DirectFB/'
fi
|