Upload Tizen2.0 source
[framework/graphics/cairo.git] / build / configure.ac.features
1
2 dnl
3 dnl Define macros to enable various features.
4 dnl  - Macro: CAIRO_ENABLE_* (ID, NAME, DEFAULT, COMMANDS)
5 dnl
6 dnl where:
7 dnl
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.
21 dnl
22
23 AC_DEFUN([CAIRO_ENABLE],
24         [_CAIRO_ENABLE([$1],    [$2],                   ,               [$3],[$4])])dnl
25
26 AC_DEFUN([CAIRO_ENABLE_SURFACE_BACKEND],
27         [_CAIRO_ENABLE([$1],    [$2 surface backend],   surface,        [$3],[$4])])dnl
28
29 AC_DEFUN([CAIRO_ENABLE_FONT_BACKEND],
30         [_CAIRO_ENABLE([$1],    [$2 font backend],      font,           [$3],[$4])])dnl
31
32 AC_DEFUN([CAIRO_ENABLE_FUNCTIONS],
33         [_CAIRO_ENABLE([$1],    [$2 functions],         functions,      [$3],[$4])])dnl
34
35
36 dnl
37 dnl Define cr_feature_pc and friends ala other cr_feature_* macros
38 dnl
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
45
46
47 dnl ===========================================================================
48 dnl
49 dnl Hooks
50 dnl
51 dnl ===========================================================================
52
53
54 dnl ===========================================================================
55 dnl
56 dnl Generate {src,boilerplate}/Makefile.{am,win32}.config
57 dnl
58
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
65
66
67 dnl Collect list of all supported public headers
68 CAIRO_MAKEFILE_ACCUMULATE(*,
69 [supported_$1_headers = $($1_headers)]dnl
70 )dnl
71 CAIRO_MAKEFILE_ACCUMULATE_FEATURE(*,*,!no,!,
72 [supported_$1_headers += $($1_$2_headers)]dnl
73 )dnl
74
75 dnl Collect list of all unsupported public headers
76 CAIRO_MAKEFILE_ACCUMULATE(*,
77 [unsupported_$1_headers =]dnl
78 )dnl
79 CAIRO_MAKEFILE_ACCUMULATE_FEATURE(*,*,no,!,
80 [unsupported_$1_headers += $($1_$2_headers)]dnl
81 )dnl
82
83 dnl Collect list of source files for all public features
84 CAIRO_MAKEFILE_ACCUMULATE(*,
85 [dnl
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)
90 ])dnl
91 CAIRO_MAKEFILE_ACCUMULATE_FEATURE(*,*,*,!,
92 [dnl
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
97 )dnl
98
99 dnl Collect list of source files for enabled public features
100 CAIRO_MAKEFILE_ACCUMULATE(*,
101 [dnl
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)
106 ])dnl
107 CAIRO_MAKEFILE_ACCUMULATE_FEATURE(*,yes,*,!,
108 [dnl
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
113 )dnl
114
115 dnl No public headers for private features
116
117 dnl Collect list of source files for all private features
118 CAIRO_MAKEFILE_ACCUMULATE_FEATURE(*,*,*,,
119 [dnl
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
123 )dnl
124
125 dnl Collect list of source files for enabled private features
126 CAIRO_MAKEFILE_ACCUMULATE_FEATURE(*,yes,*,,
127 [dnl
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
131 )dnl
132
133
134 dnl ===========================================================================
135 dnl
136 dnl Generate .pc files
137 dnl
138
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
142
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
155
156 dnl add non-pkgconfig values
157 AC_CONFIG_COMMANDS_PRE(
158 [dnl
159 CAIRO_CFLAGS="$CAIRO_CFLAGS $CAIRO_NONPKGCONFIG_CFLAGS"
160 CAIRO_LIBS="$CAIRO_LIBS $CAIRO_NONPKGCONFIG_LIBS"
161 ])dnl
162
163 m4_define([_CAIRO_FEATURE_CONFIG_PKGCONFIG_FILE],
164 [dnl
165         AC_CONFIG_FILES([$3:$4],
166         [dnl
167                 mv "$3" "$3.tmp" &&
168                 $SED "dnl
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)
178         ],[dnl
179                 SED='$SED'
180                 $1_BASE='$$1_BASE'
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'
185         ])dnl
186 ])dnl
187
188 dnl Generate .pc files for enabled non-builtin public features
189 CAIRO_FEATURE_HOOK_REGISTER(yes,!always,!,
190 [dnl
191         _CAIRO_FEATURE_CONFIG_PKGCONFIG_FILE(
192                 [$1],
193                 cr_feature_name,
194                 [src/]cr_feature_pc,
195                 [src/cairo-features.pc.in]
196         )dnl
197 ])dnl
198
199 dnl Generate -uninstalled.pc files for enabled non-builtin public features
200 CAIRO_FEATURE_HOOK_REGISTER(yes,!always,!,
201 [dnl
202         _CAIRO_FEATURE_CONFIG_PKGCONFIG_FILE(
203                 [$1],
204                 cr_feature_name,
205                 cr_feature_uninstalled_pc,
206                 [src/cairo-features-uninstalled.pc.in]
207         )dnl
208 ])dnl
209
210
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
216
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
222
223
224 dnl ===========================================================================
225 dnl
226 dnl Generate src/cairo-features.h, src/cairo-supported-features.h, and
227 dnl src/cairo-features-win32.h
228 dnl
229
230 dnl Collect list of enabled public features
231 CAIRO_ACCUMULATORS_REGISTER(FEATURES,[ ])dnl
232 CAIRO_FEATURE_HOOK_REGISTER(yes,*,!,dnl
233 [dnl
234         CAIRO_ACCUMULATE(FEATURES, cr_feature_tag)dnl
235 ])dnl
236 dnl Collect list of all supported public features
237 CAIRO_ACCUMULATORS_REGISTER(SUPPORTED_FEATURES,[ ])dnl
238 CAIRO_FEATURE_HOOK_REGISTER(*,!no,!,dnl
239 [dnl
240         CAIRO_ACCUMULATE(SUPPORTED_FEATURES, cr_feature_tag)
241 ])dnl
242 dnl Collect list of all supported disabled public features
243 CAIRO_ACCUMULATORS_REGISTER(NO_FEATURES,[ ])dnl
244 CAIRO_FEATURE_HOOK_REGISTER(no,!no,!,
245 [dnl
246         CAIRO_ACCUMULATE(NO_FEATURES, cr_feature_tag)
247 ])dnl
248
249 dnl Generate src/cairo-features.h
250 CAIRO_CONFIG_COMMANDS([src/cairo-features.h],
251 [dnl
252         echo '/* Generated by configure.  Do not edit. */'
253         echo '#ifndef CAIRO_FEATURES_H'
254         echo '#define CAIRO_FEATURES_H'
255         echo ''
256         for FEATURE in $CAIRO_FEATURES; do
257                 echo "#define $FEATURE 1"
258         done | LANG=C sort
259         echo ''
260         for FEATURE in $CAIRO_NO_FEATURES; do
261                 echo "/*#undef $FEATURE */"
262         done | LANG=C sort
263         echo ''
264         echo '#endif'
265 ],[dnl
266         CAIRO_FEATURES='$CAIRO_FEATURES'
267         CAIRO_NO_FEATURES='$CAIRO_NO_FEATURES'
268 ])dnl
269 dnl Generate src/cairo-supported-features.h
270 CAIRO_CONFIG_COMMANDS([src/cairo-supported-features.h],
271 [dnl
272         echo '/* Generated by configure.  Do not edit. */'
273         echo '#ifndef CAIRO_SUPPORTED_FEATURES_H'
274         echo '#define CAIRO_SUPPORTED_FEATURES_H'
275         echo ''
276         echo '/* This is a dummy header, to trick gtk-doc only */'
277         echo ''
278         for FEATURE in $CAIRO_SUPPORTED_FEATURES; do
279                 echo "#define $FEATURE 1"
280         done
281         echo ''
282         echo '#endif'
283 ],[dnl
284         CAIRO_SUPPORTED_FEATURES='$CAIRO_SUPPORTED_FEATURES'
285 ])dnl
286
287 dnl For enabled private features just define them in config.h.  No fanfare!
288 CAIRO_FEATURE_HOOK_REGISTER(yes,*,,
289 [dnl
290         AC_DEFINE(cr_feature_tag, 1, [Define to 1 to enable cairo's ]cr_feature_name[ feature])
291 ])dnl
292
293
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])
296 dnl
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
303 )
304 AC_CONFIG_COMMANDS_PRE(
305 [dnl
306         CAIRO_MAKEFILE_ACCUMULATE([win32_features_h], [ @echo "[#]endif" >>  $(top_srcdir)/src/cairo-features.h])
307 ])dnl
308 CAIRO_MAKEFILE_ACCUMULATE_FEATURE([win32_features_h],yes,*,*,dnl
309 [       @echo "[#]define cr_feature_tag 1" >> $(top_srcdir)/src/cairo-features.h]dnl
310 )dnl
311
312
313 dnl ===========================================================================
314 dnl
315 dnl Report
316 dnl
317
318 CAIRO_ACCUMULATORS_REGISTER([WARNING_MESSAGE],m4_newline()m4_newline)dnl
319
320 dnl Collect warning message for enabled unsupported public features
321 CAIRO_FEATURE_HOOK_REGISTER(yes,no,!,
322 [dnl
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.], [--- ]))
324 ])dnl
325
326 dnl Collect warning message for disabled recommended features
327 CAIRO_FEATURE_HOOK_REGISTER(no,yes,*,
328 [dnl
329         CAIRO_ACCUMULATE([WARNING_MESSAGE], CAIRO_TEXT_WRAP([It is strongly recommended that you do NOT disable the ]cr_feature_name[ feature.], [+++ ]))
330 ])dnl
331
332
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,
337 [dnl
338         CAIRO_ACCUMULATE([NATIVE_SURFACE_BACKENDS], [$1])
339 ])dnl
340 CAIRO_FEATURE_HOOK_REGISTER(yes,auto,font,
341 [dnl
342         CAIRO_ACCUMULATE([NATIVE_FONT_BACKENDS], [$1])
343 ])dnl
344
345 dnl Collect warning message if no native surface/font backend feature enabled
346 AC_CONFIG_COMMANDS_PRE(dnl
347 [dnl
348         AS_IF([test -z "$CAIRO_NATIVE_SURFACE_BACKENDS"],dnl
349         [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.], [*** ]))
351         ])
352         AS_IF([test -z "$CAIRO_NATIVE_FONT_BACKENDS"],dnl
353         [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.], [*** ]))
355         ])
356 ])dnl
357
358
359 AC_DEFUN([CAIRO_REPORT],
360 [dnl
361         V="$CAIRO_VERSION_MAJOR.$CAIRO_VERSION_MINOR.$CAIRO_VERSION_MICRO"
362         echo ""
363         echo "cairo (version $V [[$CAIRO_RELEASE_STATUS]]) will be compiled with:"
364         echo ""
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"
375         echo "  Qt:            $use_qt"
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"
392         echo ""
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"
399         echo ""
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"
407         echo ""
408         echo "The following features and utilities:"
409         echo "  cairo-trace:                $use_trace"
410         echo "  cairo-script-interpreter:   $use_interpreter"
411         echo ""
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"
423         fi
424         echo "$CAIRO_WARNING_MESSAGE"
425         echo ""
426 ])dnl
427