3 dnl Define macros to enable various features.
4 dnl - Macro: CAIRO_ENABLE_* (ID, NAME, DEFAULT, COMMANDS)
8 dnl ID is the feature id, eg. "ft" for cairo_ft_...
9 dnl NAME is the human-readable name of the feature, eg. "FreeType"
10 dnl DEFAULT is the default state of the feature:
11 dnl "no" for experimental backends, eg. your favorite new backend
12 dnl "yes" for mandatory backends, eg. png
13 dnl "auto" for other supported backends, eg. xlib
14 dnl COMMANDS are run to check whether the feature can be enabled. Their
15 dnl result may be cached, so user should not count on them being run.
16 dnl They should set use_$(ID) to something other than yes if the
17 dnl feature cannot be built, eg. "no (requires SomeThing)". It then
18 dnl should also set $(ID)_REQUIRES/CFLAGS/LIBS/...
19 dnl appropriately. Look at the macro definition for more details,
20 dnl or ask if in doubt.
23 AC_DEFUN([CAIRO_ENABLE],
24 [_CAIRO_ENABLE([$1], [$2], , [$3],[$4])])dnl
26 AC_DEFUN([CAIRO_ENABLE_SURFACE_BACKEND],
27 [_CAIRO_ENABLE([$1], [$2 surface backend], surface, [$3],[$4])])dnl
29 AC_DEFUN([CAIRO_ENABLE_FONT_BACKEND],
30 [_CAIRO_ENABLE([$1], [$2 font backend], font, [$3],[$4])])dnl
32 AC_DEFUN([CAIRO_ENABLE_FUNCTIONS],
33 [_CAIRO_ENABLE([$1], [$2 functions], functions, [$3],[$4])])dnl
37 dnl Define cr_feature_pc and friends ala other cr_feature_* macros
39 m4_define([cr_pc_modname],
40 [[cairo-]m4_translit([$1],_,-)])dnl
41 m4_define([cr_feature_pc],
42 [cr_pc_modname(cr_feature)[.pc]])dnl
43 m4_define([cr_feature_uninstalled_pc],
44 [cr_pc_modname(cr_feature)[-uninstalled.pc]])dnl
47 dnl ===========================================================================
51 dnl ===========================================================================
54 dnl ===========================================================================
56 dnl Generate {src,boilerplate}/Makefile.{am,win32}.config
59 CAIRO_INIT_MAKEFILES([build])
60 CAIRO_CONFIG_MAKEFILE([cairo], [src])dnl
61 CAIRO_CONFIG_MAKEFILE([cairo_boilerplate], [boilerplate])dnl
62 CAIRO_MAKEFILE_INCLUDE(*,[Makefile.sources])dnl
63 dnl An empty line per feature for readability
64 CAIRO_MAKEFILE_ACCUMULATE_FEATURE(*,*,*,*,[])dnl
67 dnl Collect list of all supported public headers
68 CAIRO_MAKEFILE_ACCUMULATE(*,
69 [supported_$1_headers = $($1_headers)]dnl
71 CAIRO_MAKEFILE_ACCUMULATE_FEATURE(*,*,!no,!,
72 [supported_$1_headers += $($1_$2_headers)]dnl
75 dnl Collect list of all unsupported public headers
76 CAIRO_MAKEFILE_ACCUMULATE(*,
77 [unsupported_$1_headers =]dnl
79 CAIRO_MAKEFILE_ACCUMULATE_FEATURE(*,*,no,!,
80 [unsupported_$1_headers += $($1_$2_headers)]dnl
83 dnl Collect list of source files for all public features
84 CAIRO_MAKEFILE_ACCUMULATE(*,
86 all_$1_headers = $($1_headers)
87 all_$1_private = $($1_private)
88 all_$1_cxx_sources = $($1_cxx_sources)
89 all_$1_sources = $($1_sources)
91 CAIRO_MAKEFILE_ACCUMULATE_FEATURE(*,*,*,!,
93 all_$1_headers += $($1_$2_headers)
94 all_$1_private += $($1_$2_private)
95 all_$1_cxx_sources += $($1_$2_cxx_sources)
96 all_$1_sources += $($1_$2_sources)]dnl
99 dnl Collect list of source files for enabled public features
100 CAIRO_MAKEFILE_ACCUMULATE(*,
102 enabled_$1_headers = $($1_headers)
103 enabled_$1_private = $($1_private)
104 enabled_$1_cxx_sources = $($1_cxx_sources)
105 enabled_$1_sources = $($1_sources)
107 CAIRO_MAKEFILE_ACCUMULATE_FEATURE(*,yes,*,!,
109 enabled_$1_headers += $($1_$2_headers)
110 enabled_$1_private += $($1_$2_private)
111 enabled_$1_cxx_sources += $($1_$2_cxx_sources)
112 enabled_$1_sources += $($1_$2_sources)]dnl
115 dnl No public headers for private features
117 dnl Collect list of source files for all private features
118 CAIRO_MAKEFILE_ACCUMULATE_FEATURE(*,*,*,,
120 all_$1_private += $($1_$2_private) $($1_$2_headers)
121 all_$1_cxx_sources += $($1_$2_cxx_sources)
122 all_$1_sources += $($1_$2_sources)]dnl
125 dnl Collect list of source files for enabled private features
126 CAIRO_MAKEFILE_ACCUMULATE_FEATURE(*,yes,*,,
128 enabled_$1_private += $($1_$2_private) $($1_$2_headers)
129 enabled_$1_cxx_sources += $($1_$2_cxx_sources)
130 enabled_$1_sources += $($1_$2_sources)]dnl
134 dnl ===========================================================================
136 dnl Generate .pc files
139 dnl All .pc files are generated automatically except for this one
140 AC_CONFIG_FILES([src/cairo.pc])dnl
141 AC_CONFIG_FILES([cairo-uninstalled.pc:src/cairo-uninstalled.pc.in])dnl
143 dnl pkg-config requires, non-pkgconfig cflags and libs, and total cflags and libs
144 CAIRO_FEATURE_VARS_REGISTER([BASE],[cairo])dnl
145 CAIRO_ACCUMULATED_FEATURE_VARS_REGISTER([REQUIRES],,[ ])dnl
146 CAIRO_ACCUMULATED_FEATURE_VARS_REGISTER([CFLAGS NONPKGCONFIG_CFLAGS],,[ ])dnl
147 CAIRO_ACCUMULATED_FEATURE_VARS_REGISTER([LIBS NONPKGCONFIG_LIBS],,[ ],[$LIBS])dnl
148 CAIRO_FEATURE_VARS_REGISTER([NONPKGCONFIG_EXTRA_LIBS])dnl
149 AC_SUBST(CAIRO_REQUIRES)dnl
150 AC_SUBST(CAIRO_CFLAGS)dnl
151 AC_SUBST(CAIRO_LDFLAGS)dnl
152 AC_SUBST(CAIRO_NONPKGCONFIG_CFLAGS)dnl
153 AC_SUBST(CAIRO_LIBS)dnl
154 AC_SUBST(CAIRO_NONPKGCONFIG_LIBS)dnl
156 dnl add non-pkgconfig values
157 AC_CONFIG_COMMANDS_PRE(
159 CAIRO_CFLAGS="$CAIRO_CFLAGS $CAIRO_NONPKGCONFIG_CFLAGS"
160 CAIRO_LIBS="$CAIRO_LIBS $CAIRO_NONPKGCONFIG_LIBS"
163 m4_define([_CAIRO_FEATURE_CONFIG_PKGCONFIG_FILE],
165 AC_CONFIG_FILES([$3:$4],
169 s%@FEATURE_PC@%]cr_pc_modname([$1])[%g;dnl
170 s%@FEATURE_NAME@%$2%g;dnl
171 s%@FEATURE_BASE@%$$1_BASE%g;dnl
172 s%@FEATURE_REQUIRES@%$$1_REQUIRES%g;dnl
173 s%@FEATURE_NONPKGCONFIG_LIBS@%$$1_NONPKGCONFIG_LIBS%g;dnl
174 s%@FEATURE_NONPKGCONFIG_EXTRA_LIBS@%$$1_NONPKGCONFIG_EXTRA_LIBS%g;dnl
175 s%@FEATURE_NONPKGCONFIG_CFLAGS@%$$1_NONPKGCONFIG_CFLAGS%g;dnl
176 " < "$3.tmp" > "$3" && rm -f "$3.tmp" ||
177 AC_MSG_ERROR(failed to update $3)
181 $1_REQUIRES='$$1_REQUIRES'
182 $1_NONPKGCONFIG_LIBS='$$1_NONPKGCONFIG_LIBS'
183 $1_NONPKGCONFIG_EXTRA_LIBS='$$1_NONPKGCONFIG_EXTRA_LIBS'
184 $1_NONPKGCONFIG_CFLAGS='$$1_NONPKGCONFIG_CFLAGS'
188 dnl Generate .pc files for enabled non-builtin public features
189 CAIRO_FEATURE_HOOK_REGISTER(yes,!always,!,
191 _CAIRO_FEATURE_CONFIG_PKGCONFIG_FILE(
195 [src/cairo-features.pc.in]
199 dnl Generate -uninstalled.pc files for enabled non-builtin public features
200 CAIRO_FEATURE_HOOK_REGISTER(yes,!always,!,
202 _CAIRO_FEATURE_CONFIG_PKGCONFIG_FILE(
205 cr_feature_uninstalled_pc,
206 [src/cairo-features-uninstalled.pc.in]
211 dnl Collect list of .pc files for all non-builtin public features
212 CAIRO_MAKEFILE_ACCUMULATE(cairo,
213 [all_$1_pkgconf = cairo.pc])dnl
214 CAIRO_MAKEFILE_ACCUMULATE_FEATURE(cairo,*,!always,!,
215 [all_$1_pkgconf += cr_feature_pc])dnl
217 dnl Collect list of .pc files for enabled non-builtin public features
218 CAIRO_MAKEFILE_ACCUMULATE(cairo,
219 [enabled_$1_pkgconf = cairo.pc])dnl
220 CAIRO_MAKEFILE_ACCUMULATE_FEATURE(cairo,yes,!always,!,
221 [enabled_$1_pkgconf += cr_feature_pc])dnl
224 dnl ===========================================================================
226 dnl Generate src/cairo-features.h, src/cairo-supported-features.h, and
227 dnl src/cairo-features-win32.h
230 dnl Collect list of enabled public features
231 CAIRO_ACCUMULATORS_REGISTER(FEATURES,[ ])dnl
232 CAIRO_FEATURE_HOOK_REGISTER(yes,*,!,dnl
234 CAIRO_ACCUMULATE(FEATURES, cr_feature_tag)dnl
236 dnl Collect list of all supported public features
237 CAIRO_ACCUMULATORS_REGISTER(SUPPORTED_FEATURES,[ ])dnl
238 CAIRO_FEATURE_HOOK_REGISTER(*,!no,!,dnl
240 CAIRO_ACCUMULATE(SUPPORTED_FEATURES, cr_feature_tag)
242 dnl Collect list of all supported disabled public features
243 CAIRO_ACCUMULATORS_REGISTER(NO_FEATURES,[ ])dnl
244 CAIRO_FEATURE_HOOK_REGISTER(no,!no,!,
246 CAIRO_ACCUMULATE(NO_FEATURES, cr_feature_tag)
249 dnl Generate src/cairo-features.h
250 CAIRO_CONFIG_COMMANDS([src/cairo-features.h],
252 echo '/* Generated by configure. Do not edit. */'
253 echo '#ifndef CAIRO_FEATURES_H'
254 echo '#define CAIRO_FEATURES_H'
256 for FEATURE in $CAIRO_FEATURES; do
257 echo "#define $FEATURE 1"
260 for FEATURE in $CAIRO_NO_FEATURES; do
261 echo "/*#undef $FEATURE */"
266 CAIRO_FEATURES='$CAIRO_FEATURES'
267 CAIRO_NO_FEATURES='$CAIRO_NO_FEATURES'
269 dnl Generate src/cairo-supported-features.h
270 CAIRO_CONFIG_COMMANDS([src/cairo-supported-features.h],
272 echo '/* Generated by configure. Do not edit. */'
273 echo '#ifndef CAIRO_SUPPORTED_FEATURES_H'
274 echo '#define CAIRO_SUPPORTED_FEATURES_H'
276 echo '/* This is a dummy header, to trick gtk-doc only */'
278 for FEATURE in $CAIRO_SUPPORTED_FEATURES; do
279 echo "#define $FEATURE 1"
284 CAIRO_SUPPORTED_FEATURES='$CAIRO_SUPPORTED_FEATURES'
287 dnl For enabled private features just define them in config.h. No fanfare!
288 CAIRO_FEATURE_HOOK_REGISTER(yes,*,,
290 AC_DEFINE(cr_feature_tag, 1, [Define to 1 to enable cairo's ]cr_feature_name[ feature])
294 dnl Generate build/Makefile.win32.features-h that generates src/cairo-features.h
295 CAIRO_CONFIG_MAKEFILE_PRIVATE_WIN32([win32_features_h],[build],[features-h])
297 CAIRO_MAKEFILE_ACCUMULATE([win32_features_h],
298 [$(top_srcdir)/src/cairo-features.h: $(top_srcdir)/build/Makefile.win32.features
299 @echo "Generating src/cairo-features.h"
300 @echo "/* Generated by Makefile.win32.features-h. Do not edit. */" > $(top_srcdir)/src/cairo-features.h
301 @echo "[#]ifndef CAIRO_FEATURES_H" >> $(top_srcdir)/src/cairo-features.h
302 @echo "[#]define CAIRO_FEATURES_H 1" >> $(top_srcdir)/src/cairo-features.h]dnl
304 AC_CONFIG_COMMANDS_PRE(
306 CAIRO_MAKEFILE_ACCUMULATE([win32_features_h], [ @echo "[#]endif" >> $(top_srcdir)/src/cairo-features.h])
308 CAIRO_MAKEFILE_ACCUMULATE_FEATURE([win32_features_h],yes,*,*,dnl
309 [ @echo "[#]define cr_feature_tag 1" >> $(top_srcdir)/src/cairo-features.h]dnl
313 dnl ===========================================================================
318 CAIRO_ACCUMULATORS_REGISTER([WARNING_MESSAGE],m4_newline()m4_newline)dnl
320 dnl Collect warning message for enabled unsupported public features
321 CAIRO_FEATURE_HOOK_REGISTER(yes,no,!,
323 CAIRO_ACCUMULATE([WARNING_MESSAGE], CAIRO_TEXT_WRAP([The ]cr_feature_name[ feature 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 ]cr_feature_name[ specific API.], [--- ]))
326 dnl Collect warning message for disabled recommended features
327 CAIRO_FEATURE_HOOK_REGISTER(no,yes,*,
329 CAIRO_ACCUMULATE([WARNING_MESSAGE], CAIRO_TEXT_WRAP([It is strongly recommended that you do NOT disable the ]cr_feature_name[ feature.], [+++ ]))
333 dnl Collect enabled native surface/font backend features
334 CAIRO_ACCUMULATORS_REGISTER([NATIVE_SURFACE_BACKENDS])dnl
335 CAIRO_ACCUMULATORS_REGISTER([NATIVE_FONT_BACKENDS])dnl
336 CAIRO_FEATURE_HOOK_REGISTER(yes,auto,surface,
338 CAIRO_ACCUMULATE([NATIVE_SURFACE_BACKENDS], [$1])
340 CAIRO_FEATURE_HOOK_REGISTER(yes,auto,font,
342 CAIRO_ACCUMULATE([NATIVE_FONT_BACKENDS], [$1])
345 dnl Collect warning message if no native surface/font backend feature enabled
346 AC_CONFIG_COMMANDS_PRE(dnl
348 AS_IF([test -z "$CAIRO_NATIVE_SURFACE_BACKENDS"],dnl
350 CAIRO_ACCUMULATE([WARNING_MESSAGE], CAIRO_TEXT_WRAP([No native surface backends enabled for your platform. It is strongly recommended that you enable the native surface backend feature for your platform.], [*** ]))
352 AS_IF([test -z "$CAIRO_NATIVE_FONT_BACKENDS"],dnl
354 CAIRO_ACCUMULATE([WARNING_MESSAGE], CAIRO_TEXT_WRAP([No native font backends enabled for your platform. It is strongly recommended that you enable the native font backend feature for your platform.], [*** ]))
359 AC_DEFUN([CAIRO_REPORT],
361 V="$CAIRO_VERSION_MAJOR.$CAIRO_VERSION_MINOR.$CAIRO_VERSION_MICRO"
363 echo "cairo (version $V [[$CAIRO_RELEASE_STATUS]]) will be compiled with:"
365 echo "The following surface backends:"
366 echo " Image: yes (always builtin)"
367 echo " Recording: yes (always builtin)"
368 echo " Observer: yes (always builtin)"
369 echo " Mime: yes (always builtin)"
370 echo " Tee: $use_tee"
371 echo " XML: $use_xml"
372 echo " Skia: $use_skia"
373 echo " Xlib: $use_xlib"
374 echo " Xlib Xrender: $use_xlib_xrender"
376 echo " Quartz: $use_quartz"
377 echo " Quartz-image: $use_quartz_image"
378 echo " XCB: $use_xcb"
379 echo " Win32: $use_win32"
380 echo " OS2: $use_os2"
381 echo " CairoScript: $use_script"
382 echo " PostScript: $use_ps"
383 echo " PDF: $use_pdf"
384 echo " SVG: $use_svg"
385 echo " OpenGL: $use_gl"
386 echo " OpenGL ES 2.0: $use_glesv2"
387 echo " BeOS: $use_beos"
388 echo " DirectFB: $use_directfb"
389 echo " OpenVG: $use_vg"
390 echo " DRM: $use_drm"
391 echo " Cogl: $use_cogl"
393 echo "The following font backends:"
394 echo " User: yes (always builtin)"
395 echo " FreeType: $use_ft"
396 echo " Fontconfig: $use_fc"
397 echo " Win32: $use_win32_font"
398 echo " Quartz: $use_quartz_font"
400 echo "The following functions:"
401 echo " PNG functions: $use_png"
402 echo " GLX functions: $use_glx"
403 echo " WGL functions: $use_wgl"
404 echo " EGL functions: $use_egl"
405 echo " X11-xcb functions: $use_xlib_xcb"
406 echo " XCB-shm functions: $use_xcb_shm"
408 echo "The following features and utilities:"
409 echo " cairo-trace: $use_trace"
410 echo " cairo-script-interpreter: $use_interpreter"
412 echo "And the following internal features:"
413 echo " pthread: $use_pthread"
414 echo " gtk-doc: $enable_gtk_doc"
415 echo " gcov support: $use_gcov"
416 echo " symbol-lookup: $use_symbol_lookup"
417 echo " test surfaces: $use_test_surfaces"
418 echo " ps testing: $test_ps"
419 echo " pdf testing: $test_pdf"
420 echo " svg testing: $test_svg"
421 if test x"$use_win32" = "xyes"; then
422 echo " win32 printing testing: $test_win32_printing"
424 echo "$CAIRO_WARNING_MESSAGE"