summaryrefslogtreecommitdiff
path: root/build/configure.ac.enable
blob: aa5d71deeac1cc1f46fd6b013ec29246c727e3dc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390

dnl
dnl Define macros to enable various features.
dnl  - Macro: CAIRO_ENABLE_* (ID, NAME, DEFAULT, COMMANDS)
dnl
dnl where:
dnl
dnl	ID is the feature id, eg. "ft" for cairo_ft_...
dnl	NAME is the human-readable name of the feature, eg. "FreeType"
dnl	DEFAULT is the default state of the feature:
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 feature can be enabled.  Their
dnl		result may be cached, so user should not count on them being run.
dnl		They should set use_$(ID) to something other than yes if the
dnl		feature cannot be built, eg. "no (requires SomeThing)".  It then
dnl		should also set $(ID)_REQUIRES/CFLAGS/LIBS/...
dnl		appropriately.  Look at the macro definition for more details,
dnl		or ask if in doubt.
dnl

AC_DEFUN([CAIRO_ENABLE],
	[_CAIRO_ENABLE([$1],	[$2],			,		[$3],[$4])])dnl

AC_DEFUN([CAIRO_ENABLE_SURFACE_BACKEND],
	[_CAIRO_ENABLE([$1],	[$2 surface backend],	surface,	[$3],[$4])])dnl

AC_DEFUN([CAIRO_ENABLE_FONT_BACKEND],
	[_CAIRO_ENABLE([$1],	[$2 font backend],	font,	  	[$3],[$4])])dnl

AC_DEFUN([CAIRO_ENABLE_FUNCTIONS],
	[_CAIRO_ENABLE([$1],	[$2 functions],		functions,	[$3],[$4])])dnl


dnl
dnl Define cr_feature_tag ala other cr_feature_* macros
dnl Expands to CAIRO_HAS_FEATURE_ID
dnl
m4_define([_CAIRO_BUILD_FEATURE_TAG_NORMALIZED],
	[CAIRO_HAS_[$1]m4_bmatch([$1],[$2$],,[$2])])dnl
m4_define([_CAIRO_BUILD_FEATURE_TAG],
	[_CAIRO_BUILD_FEATURE_TAG_NORMALIZED(AS_TR_CPP([$1]),AS_TR_CPP(m4_ifval([$2],[ $2])))])dnl
m4_define([cr_feature_tag],
	[_CAIRO_BUILD_FEATURE_TAG(cr_feature,cr_feature_what)])dnl

dnl Allow feature tags in the output
m4_pattern_allow(^CAIRO_HAS_)dnl


dnl
dnl Define cr_feature_pc and friends ala other cr_feature_* macros
dnl
m4_define([cr_feature_pc_modname],
	[[cairo-]m4_translit(cr_feature,_,-)])dnl
m4_define([cr_feature_pc],
	[cr_feature_pc_modname[.pc]])dnl
m4_define([cr_feature_uninstalled_pc],
	[cr_feature_pc_modname[-uninstalled.pc]])dnl


dnl ===========================================================================
dnl
dnl Hooks
dnl
dnl ===========================================================================


dnl ===========================================================================
dnl
dnl Automake conditionals for all features
dnl
CAIRO_FEATURE_HOOK_REGISTER(*,*,*,
[dnl
	AM_CONDITIONAL(cr_feature_tag, test "x$use_$1" = xyes)dnl
])dnl


dnl ===========================================================================
dnl
dnl Generate {src,boilerplate}/Makefile.{am,win32}.config
dnl

dnl Accumulators
dnl	CAIRO_ACCUMULATE(FEATURES, cr_feature_tag)
CAIRO_ACCUMULATORS_REGISTER(CONFIG_AMAKE,m4_newline,[# Generated by configure.  Do not edit.
include $(top_srcdir)/src/Makefile.sources

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 =])dnl

CAIRO_ACCUMULATORS_REGISTER_UNQUOTED(CONFIG_WIN32,m4_newline,[$CAIRO_CONFIG_AMAKE])dnl

dnl Generate
CAIRO_CONFIG_COMMANDS([$srcdir/src/Makefile.am.config],
		      [echo "$CAIRO_CONFIG_AMAKE"],
		      [CAIRO_CONFIG_AMAKE='$CAIRO_CONFIG_AMAKE'])dnl
CAIRO_CONFIG_COMMANDS([$srcdir/src/Makefile.win32.config],
		      [echo "$CAIRO_CONFIG_WIN32"],
		      [CAIRO_CONFIG_WIN32='$CAIRO_CONFIG_WIN32'])dnl

dnl Collect list of all supported public cairo headers
CAIRO_FEATURE_HOOK_REGISTER(*,!no,!,
[dnl
	CAIRO_ACCUMULATE(CONFIG_AMAKE, [supported_cairo_headers += $(cairo_$1_headers)])dnl
	CAIRO_ACCUMULATE(CONFIG_WIN32, [supported_cairo_headers += $(cairo_$1_headers)])dnl
])dnl

dnl Collect list of all unsupported public cairo headers
CAIRO_FEATURE_HOOK_REGISTER(*,no,!,
[dnl
	CAIRO_ACCUMULATE(CONFIG_AMAKE, [unsupported_cairo_headers += $(cairo_$1_headers)])dnl
	CAIRO_ACCUMULATE(CONFIG_WIN32, [unsupported_cairo_headers += $(cairo_$1_headers)])dnl
])dnl

dnl Collect list of source files for all/enabled public features
CAIRO_FEATURE_HOOK_REGISTER(*,*,!,
[dnl
	CAIRO_ACCUMULATE(CONFIG_AMAKE, [dnl
all_cairo_headers += $(cairo_$1_headers)
all_cairo_private += $(cairo_$1_private)
all_cairo_sources += $(cairo_$1_sources)
if cr_feature_tag
enabled_cairo_headers += $(cairo_$1_headers)
enabled_cairo_private += $(cairo_$1_private)
enabled_cairo_sources += $(cairo_$1_sources)
endif
])dnl
	CAIRO_ACCUMULATE(CONFIG_WIN32, [dnl
all_cairo_headers += $(cairo_$1_headers)
all_cairo_private += $(cairo_$1_private)
all_cairo_sources += $(cairo_$1_sources)
ifeq ($(cr_feature_tag),1)
enabled_cairo_headers += $(cairo_$1_headers)
enabled_cairo_private += $(cairo_$1_private)
enabled_cairo_sources += $(cairo_$1_sources)
endif
])dnl
])dnl

dnl Collect list of source files for all/enabled private features
CAIRO_FEATURE_HOOK_REGISTER(*,*,,
[dnl
	dnl No public headers for private features
	CAIRO_ACCUMULATE(CONFIG_AMAKE, [dnl
all_cairo_private += $(cairo_$1_private) $(cairo_$1_headers)
all_cairo_sources += $(cairo_$1_sources)
if cr_feature_tag
enabled_cairo_private += $(cairo_$1_private) $(cairo_$1_headers)
enabled_cairo_sources += $(cairo_$1_sources)
endif
])dnl
	CAIRO_ACCUMULATE(CONFIG_WIN32, [dnl
all_cairo_private += $(cairo_$1_private) $(cairo_$1_headers)
all_cairo_sources += $(cairo_$1_sources)
ifeq ($(cr_feature_tag),1)
enabled_cairo_private += $(cairo_$1_private) $(cairo_$1_headers)
enabled_cairo_sources += $(cairo_$1_sources)
endif
])dnl
])dnl


dnl ===========================================================================
dnl
dnl Generate .pc files
dnl

dnl All .pc files are generated automatically except for this one
AC_CONFIG_FILES([src/cairo.pc])dnl
AC_CONFIG_FILES([cairo-uninstalled.pc:src/cairo-uninstalled.pc.in])dnl

dnl pkg-config requires, non-pkgconfig cflags and libs, and total cflags and libs
CAIRO_FEATURE_VARS_REGISTER([BASE],[cairo])dnl
CAIRO_ACCUMULATED_FEATURE_VARS_REGISTER([REQUIRES],,[ ])dnl
CAIRO_ACCUMULATED_FEATURE_VARS_REGISTER([CFLAGS NONPKGCONFIG_CFLAGS],,[ ])dnl
CAIRO_ACCUMULATED_FEATURE_VARS_REGISTER([LIBS NONPKGCONFIG_LIBS],,[ ],[$LIBS])dnl
AC_SUBST(CAIRO_REQUIRES)dnl
AC_SUBST(CAIRO_BASE)dnl
AC_SUBST(CAIRO_CFLAGS)dnl
AC_SUBST(CAIRO_NONPKGCONFIG_CFLAGS)dnl
AC_SUBST(CAIRO_LIBS)dnl
AC_SUBST(CAIRO_NONPKGCONFIG_LIBS)dnl


dnl Generate .pc files for enabled non-builtin public features
CAIRO_FEATURE_HOOK_REGISTER(yes,!always,!,
[dnl
	AC_CONFIG_FILES(src/cr_feature_pc:src/cairo-features.pc.in,
	[dnl
		$SED -i -e "dnl
		s%@FEATURE_PC@%]cr_feature_pc_modname[%g;dnl
		s%@FEATURE_NAME@%]cr_feature_name[%g;dnl
		s%@FEATURE_BASE@%$$1_BASE%g;dnl
		s%@FEATURE_REQUIRES@%$$1_REQUIRES%g;dnl
		s%@FEATURE_NONPKGCONFIG_LIBS@%$$1_NONPKGCONFIG_LIBS%g;dnl
		s%@FEATURE_NONPKGCONFIG_CFLAGS@%$$1_NONPKGCONFIG_CFLAGS%g;dnl
		" "]src/cr_feature_pc[" ||
		AC_MSG_ERROR(failed to update ]src/cr_feature_pc[)
	],[dnl
		SED='$SED'
		$1_BASE='$$1_BASE'
		$1_REQUIRES='$$1_REQUIRES'
		$1_NONPKGCONFIG_LIBS='$$1_NONPKGCONFIG_LIBS'
		$1_NONPKGCONFIG_CFLAGS='$$1_NONPKGCONFIG_CFLAGS'
	])dnl
])dnl

dnl Generate -uninstalled.pc files for enabled non-builtin public features
CAIRO_FEATURE_HOOK_REGISTER(yes,!always,!,
[dnl
	AC_CONFIG_FILES(cr_feature_uninstalled_pc:src/cairo-features-uninstalled.pc.in,
	[dnl
		$SED -i -e "dnl
		s%@FEATURE_PC@%]cr_feature_pc_modname[%g;dnl
		s%@FEATURE_NAME@%]cr_feature_name[%g;dnl
		s%@FEATURE_BASE@%$$1_BASE%g;dnl
		s%@FEATURE_REQUIRES@%$$1_REQUIRES%g;dnl
		s%@FEATURE_NONPKGCONFIG_LIBS@%$$1_NONPKGCONFIG_LIBS%g;dnl
		s%@FEATURE_NONPKGCONFIG_CFLAGS@%$$1_NONPKGCONFIG_CFLAGS%g;dnl
		" "]src/cr_feature_pc[" ||
		AC_MSG_ERROR(failed to update ]src/cr_feature_pc[)
	],[dnl
		SED='$SED'
		$1_BASE='$$1_BASE'
		$1_REQUIRES='$$1_REQUIRES'
		$1_NONPKGCONFIG_LIBS='$$1_NONPKGCONFIG_LIBS'
		$1_NONPKGCONFIG_CFLAGS='$$1_NONPKGCONFIG_CFLAGS'
	])dnl
])dnl

dnl Collect list of .pc files for all/enabled non-builtin public features
CAIRO_FEATURE_HOOK_REGISTER(*,!always,!,
[dnl
	CAIRO_CONFIG_AMAKE=$CAIRO_CONFIG_AMAKE'
all_cairo_pkgconf += cr_feature_pc
if cr_feature_tag
enabled_cairo_pkgconf += cr_feature_pc
endif
'
])dnl


dnl ===========================================================================
dnl
dnl Generate src/cairo-features.h src/cairo-supported-features.h
dnl

dnl Collect list of enabled public features
CAIRO_ACCUMULATORS_REGISTER(FEATURES,[ ])dnl
CAIRO_FEATURE_HOOK_REGISTER(yes,*,!,dnl
[dnl
	CAIRO_ACCUMULATE(FEATURES, cr_feature_tag)dnl
])dnl
dnl Collect list of all supported public features
CAIRO_ACCUMULATORS_REGISTER(SUPPORTED_FEATURES,[ ])dnl
CAIRO_FEATURE_HOOK_REGISTER(*,!no,!,dnl
[dnl
	CAIRO_ACCUMULATE(SUPPORTED_FEATURES, cr_feature_tag)
])dnl
dnl Collect list of all supported disabled public features
CAIRO_ACCUMULATORS_REGISTER(NO_FEATURES,[ ])dnl
CAIRO_FEATURE_HOOK_REGISTER(no,!no,!,
[dnl
	CAIRO_ACCUMULATE(NO_FEATURES, cr_feature_tag)
])dnl

dnl Generate src/cairo-features.h and src/cairo-supported-features.h
CAIRO_CONFIG_COMMANDS([src/cairo-features.h],
[dnl
	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 $FEATURE 1"
	done | LANG=C sort
	echo ''
	for FEATURE in $CAIRO_NO_FEATURES; do
		echo "/*#undef $FEATURE */"
	done | LANG=C sort
	echo ''
	echo '#endif'
],[dnl
	CAIRO_FEATURES='$CAIRO_FEATURES'
	CAIRO_NO_FEATURES='$CAIRO_NO_FEATURES'
])dnl
CAIRO_CONFIG_COMMANDS([$srcdir/src/cairo-supported-features.h],
[dnl
	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 $FEATURE 1"
	done
	echo ''
	echo '#endif'
],[dnl
	CAIRO_SUPPORTED_FEATURES='$CAIRO_SUPPORTED_FEATURES'
])dnl

dnl For enabled private features just define them in config.h.  No fanfare!
CAIRO_FEATURE_HOOK_REGISTER(yes,*,,
[dnl
	AC_DEFINE(cr_feature_tag, 1, [Define to 1 to enable cairo's ]cr_feature_name[ feature])
])dnl

dnl ===========================================================================
dnl
dnl Report
dnl

CAIRO_ACCUMULATORS_REGISTER([WARNING_MESSAGE],m4_newline()m4_newline)dnl

dnl Collect warning message for enabled unsupported public features
CAIRO_FEATURE_HOOK_REGISTER(yes,no,!,
[dnl
	CAIRO_ACCUMULATE([WARNING_MESSAGE], m4_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.], [--- ],, 78))
])dnl

dnl Collect warning message for disabled recommended features
CAIRO_FEATURE_HOOK_REGISTER(no,yes,*,
[dnl
	CAIRO_ACCUMULATE([WARNING_MESSAGE], m4_text_wrap([It is strictly recommended that you do NOT disable the ]cr_feature_name[ feature.], [+++ ],, 78))
])dnl


AC_DEFUN([CAIRO_REPORT],
[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 ""

	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"
])dnl