• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1AC_PREREQ([2.64])
2AC_INIT([HarfBuzz],
3        [6.0.0],
4        [https://github.com/harfbuzz/harfbuzz/issues/new],
5        [harfbuzz],
6        [http://harfbuzz.org/])
7
8AC_CONFIG_MACRO_DIR([m4])
9AC_CONFIG_SRCDIR([src/harfbuzz.pc.in])
10AC_CONFIG_HEADERS([config.h])
11
12AM_INIT_AUTOMAKE([1.13.0 gnits tar-ustar dist-xz no-dist-gzip -Wall no-define color-tests -Wno-portability])
13AM_SILENT_RULES([yes])
14AX_CODE_COVERAGE
15
16# Initialize libtool
17m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
18LT_PREREQ([2.2])
19LT_INIT([disable-static])
20
21# Check for programs
22AC_PROG_CC
23AC_PROG_CC_C99
24AM_PROG_CC_C_O
25AC_PROG_CXX
26AX_CXX_COMPILE_STDCXX(11)
27AC_SYS_LARGEFILE
28PKG_PROG_PKG_CONFIG([0.28])
29AM_MISSING_PROG([RAGEL], [ragel])
30AM_MISSING_PROG([GIT], [git])
31
32# Version
33m4_define(hb_version_triplet,m4_split(AC_PACKAGE_VERSION,[[.]]))
34m4_define(hb_version_major,m4_argn(1,hb_version_triplet))
35m4_define(hb_version_minor,m4_argn(2,hb_version_triplet))
36m4_define(hb_version_micro,m4_argn(3,hb_version_triplet))
37HB_VERSION_MAJOR=hb_version_major
38HB_VERSION_MINOR=hb_version_minor
39HB_VERSION_MICRO=hb_version_micro
40HB_VERSION=AC_PACKAGE_VERSION
41AC_SUBST(HB_VERSION_MAJOR)
42AC_SUBST(HB_VERSION_MINOR)
43AC_SUBST(HB_VERSION_MICRO)
44AC_SUBST(HB_VERSION)
45
46# Libtool version
47m4_define([hb_version_int],
48	  m4_eval(hb_version_major*10000 + hb_version_minor*100 + hb_version_micro))
49HB_LIBTOOL_VERSION_INFO=hb_version_int:0:hb_version_int
50AC_SUBST(HB_LIBTOOL_VERSION_INFO)
51
52AC_ARG_WITH([libstdc++],
53	[AS_HELP_STRING([--with-libstdc++=@<:@yes/no@:>@],
54			[Allow linking with libstdc++ @<:@default=no@:>@])],
55	[with_libstdcxx=$withval],
56	[with_libstdcxx=no])
57AM_CONDITIONAL(WITH_LIBSTDCXX, [test "x$with_libstdcxx" = "xyes"])
58
59# Documentation
60have_gtk_doc=false
61m4_ifdef([GTK_DOC_CHECK], [
62GTK_DOC_CHECK([1.15],[--flavour no-tmpl])
63	if test "x$enable_gtk_doc" = xyes; then
64		have_gtk_doc=true
65	fi
66], [
67	AM_CONDITIONAL([ENABLE_GTK_DOC], false)
68])
69
70# Functions and headers
71AC_CHECK_FUNCS(atexit mprotect sysconf getpagesize mmap isatty newlocale uselocale)
72AC_CHECK_HEADERS(unistd.h sys/mman.h stdbool.h xlocale.h)
73
74# Compiler flags
75AC_CANONICAL_HOST
76AC_CHECK_ALIGNOF([struct{char;}])
77if test "x$GCC" = "xyes"; then
78
79	# Make symbols link locally
80	AX_CHECK_LINK_FLAG([[-Bsymbolic-functions]], [LDFLAGS="$LDFLAGS -Bsymbolic-functions"])
81
82	# Make it possible to not link to libstdc++
83	# No threadsafe statics in C++ as we do it ourselves.
84	# We don't use these features, so it's safe to disable them
85	# even in the cases where we DO link to libstdc++.
86	# Put -fno-rtti before $CXXFLAGS such that users can re-enable it
87	# by overriding CXXFLAGS.
88	CXXFLAGS="-fno-rtti $CXXFLAGS -fno-exceptions -fno-threadsafe-statics"
89
90	case "$host" in
91		*-*-mingw*)
92		;;
93		*)
94			# Hide inline methods
95			CXXFLAGS="$CXXFLAGS -fvisibility-inlines-hidden"
96		;;
97	esac
98
99	case "$host" in
100		arm-*-*)
101			if test "x$ac_cv_alignof_struct_char__" != x1; then
102				# Request byte alignment
103				CXXFLAGS="$CXXFLAGS -mstructure-size-boundary=8"
104			fi
105		;;
106	esac
107fi
108
109AM_CONDITIONAL(HAVE_GCC, test "x$GCC" = "xyes")
110
111hb_os_win32=no
112AC_MSG_CHECKING([for native Win32])
113case "$host" in
114  *-*-mingw*)
115    hb_os_win32=yes
116    ;;
117esac
118AC_MSG_RESULT([$hb_os_win32])
119AM_CONDITIONAL(OS_WIN32, test "$hb_os_win32" = "yes")
120
121have_pthread=false
122AX_PTHREAD([have_pthread=true])
123if $have_pthread; then
124	AC_DEFINE(HAVE_PTHREAD, 1, [Have POSIX threads])
125fi
126AM_CONDITIONAL(HAVE_PTHREAD, $have_pthread)
127
128dnl ==========================================================================
129
130AC_ARG_WITH(glib,
131	[AS_HELP_STRING([--with-glib=@<:@yes/no/auto@:>@],
132			[Use glib @<:@default=auto@:>@])],,
133	[with_glib=auto])
134have_glib=false
135GLIB_DEPS="glib-2.0 >= 2.19.1"
136AC_SUBST(GLIB_DEPS)
137if test "x$with_glib" = "xyes" -o "x$with_glib" = "xauto"; then
138	PKG_CHECK_MODULES(GLIB, $GLIB_DEPS, have_glib=true, :)
139fi
140if test "x$with_glib" = "xyes" -a "x$have_glib" != "xtrue"; then
141	AC_MSG_ERROR([glib support requested but glib-2.0 not found])
142fi
143if $have_glib; then
144	AC_DEFINE(HAVE_GLIB, 1, [Have glib2 library])
145fi
146AM_CONDITIONAL(HAVE_GLIB, $have_glib)
147
148dnl ===========================================================================
149
150AC_ARG_WITH(gobject,
151	[AS_HELP_STRING([--with-gobject=@<:@yes/no/auto@:>@],
152			[Use gobject @<:@default=no@:>@])],,
153	[with_gobject=no])
154have_gobject=false
155if test "x$with_gobject" = "xyes" -o "x$with_gobject" = "xauto"; then
156	PKG_CHECK_MODULES(GOBJECT, gobject-2.0 glib-2.0, have_gobject=true, :)
157fi
158if test "x$with_gobject" = "xyes" -a "x$have_gobject" != "xtrue"; then
159	AC_MSG_ERROR([gobject support requested but gobject-2.0 / glib-2.0 not found])
160fi
161if $have_gobject; then
162	AC_DEFINE(HAVE_GOBJECT, 1, [Have gobject2 library])
163	GLIB_MKENUMS=`$PKG_CONFIG --variable=glib_mkenums glib-2.0`
164	AC_SUBST(GLIB_MKENUMS)
165fi
166AM_CONDITIONAL(HAVE_GOBJECT, $have_gobject)
167AC_SUBST(have_gobject)
168
169dnl ===========================================================================
170
171
172dnl ===========================================================================
173# Gobject-Introspection
174have_introspection=false
175m4_ifdef([GOBJECT_INTROSPECTION_CHECK], [
176	if $have_gobject; then
177		GOBJECT_INTROSPECTION_CHECK([1.34.0])
178		if test "x$found_introspection" = xyes; then
179			have_introspection=true
180		fi
181	else
182		AM_CONDITIONAL([HAVE_INTROSPECTION], false)
183	fi
184], [
185	AM_CONDITIONAL([HAVE_INTROSPECTION], false)
186])
187
188dnl ==========================================================================
189
190AC_ARG_WITH(cairo,
191	[AS_HELP_STRING([--with-cairo=@<:@yes/no/auto@:>@],
192			[Use cairo @<:@default=auto@:>@])],,
193	[with_cairo=auto])
194have_cairo=false
195if test "x$with_cairo" = "xyes" -o "x$with_cairo" = "xauto"; then
196	PKG_CHECK_MODULES(CAIRO, cairo >= 1.8.0, have_cairo=true, :)
197	save_libs=$LIBS
198	LIBS="$LIBS $CAIRO_LIBS"
199	AC_CHECK_FUNCS(cairo_user_font_face_set_render_color_glyph_func)
200	LIBS=$save_libs
201fi
202if test "x$with_cairo" = "xyes" -a "x$have_cairo" != "xtrue"; then
203	AC_MSG_ERROR([cairo support requested but not found])
204fi
205if $have_cairo; then
206	AC_DEFINE(HAVE_CAIRO, 1, [Have cairo graphics library])
207fi
208AM_CONDITIONAL(HAVE_CAIRO, $have_cairo)
209
210have_cairo_ft=false
211if $have_cairo; then
212	PKG_CHECK_MODULES(CAIRO_FT, cairo-ft, have_cairo_ft=true, :)
213fi
214if $have_cairo_ft; then
215	AC_DEFINE(HAVE_CAIRO_FT, 1, [Have cairo-ft support in cairo graphics library])
216fi
217AM_CONDITIONAL(HAVE_CAIRO_FT, $have_cairo_ft)
218
219dnl ==========================================================================
220
221AC_ARG_WITH(chafa,
222	[AS_HELP_STRING([--with-chafa=@<:@yes/no/auto@:>@],
223			[Use chafa @<:@default=auto@:>@])],,
224	[with_chafa=auto])
225have_chafa=false
226if test "x$with_chafa" = "xyes" -o "x$with_chafa" = "xauto"; then
227	PKG_CHECK_MODULES(CHAFA, chafa >= 1.6.0, have_chafa=true, :)
228fi
229if test "x$with_chafa" = "xyes" -a "x$have_chafa" != "xtrue"; then
230	AC_MSG_ERROR([chafa support requested but not found])
231fi
232if $have_chafa; then
233	AC_DEFINE(HAVE_CHAFA, 1, [Have chafa terminal graphics library])
234fi
235AM_CONDITIONAL(HAVE_CHAFA, $have_chafa)
236
237dnl ==========================================================================
238
239AC_ARG_WITH(icu,
240	[AS_HELP_STRING([--with-icu=@<:@yes/no/builtin/auto@:>@],
241			[Use ICU @<:@default=auto@:>@])],,
242	[with_icu=auto])
243have_icu=false
244if test "x$with_icu" = "xyes" -o "x$with_icu" = "xbuiltin" -o "x$with_icu" = "xauto"; then
245	PKG_CHECK_MODULES(ICU, icu-uc, have_icu=true, :)
246fi
247if test \( "x$with_icu" = "xyes" -o "x$with_icu" = "xbuiltin" \) -a "x$have_icu" != "xtrue"; then
248	AC_MSG_ERROR([icu support requested but icu-uc not found])
249fi
250
251if $have_icu; then
252	CXXFLAGS="$CXXFLAGS `$PKG_CONFIG --variable=CXXFLAGS icu-uc`"
253	AC_DEFINE(HAVE_ICU, 1, [Have ICU library])
254	if test "x$with_icu" = "xbuiltin"; then
255		AC_DEFINE(HAVE_ICU_BUILTIN, 1, [Use hb-icu Unicode callbacks])
256	fi
257fi
258AM_CONDITIONAL(HAVE_ICU, $have_icu)
259AM_CONDITIONAL(HAVE_ICU_BUILTIN, $have_icu && test "x$with_icu" = "xbuiltin")
260
261dnl ===========================================================================
262
263AC_ARG_WITH(graphite2,
264	[AS_HELP_STRING([--with-graphite2=@<:@yes/no/auto@:>@],
265			[Use the graphite2 library @<:@default=no@:>@])],,
266	[with_graphite2=no])
267have_graphite2=false
268GRAPHITE2_DEPS="graphite2 >= 1.2.0"
269AC_SUBST(GRAPHITE2_DEPS)
270if test "x$with_graphite2" = "xyes" -o "x$with_graphite2" = "xauto"; then
271	PKG_CHECK_MODULES(GRAPHITE2, $GRAPHITE2_DEPS, have_graphite2=true, :)
272	if test "x$have_graphite2" != "xtrue"; then
273                # If pkg-config is not available, graphite2 can still be there
274		ac_save_CFLAGS="$CFLAGS"
275		ac_save_CPPFLAGS="$CPPFLAGS"
276		CFLAGS="$CFLAGS $GRAPHITE2_CFLAGS"
277		CPPFLAGS="$CPPFLAGS $GRAPHITE2_CFLAGS"
278		AC_CHECK_HEADER(graphite2/Segment.h, have_graphite2=true, :)
279		CPPFLAGS="$ac_save_CPPFLAGS"
280		CFLAGS="$ac_save_CFLAGS"
281	fi
282fi
283if test "x$with_graphite2" = "xyes" -a "x$have_graphite2" != "xtrue"; then
284	AC_MSG_ERROR([graphite2 support requested but libgraphite2 not found])
285fi
286if $have_graphite2; then
287	AC_DEFINE(HAVE_GRAPHITE2, 1, [Have Graphite2 library])
288fi
289AM_CONDITIONAL(HAVE_GRAPHITE2, $have_graphite2)
290
291dnl ==========================================================================
292
293AC_ARG_WITH(freetype,
294	[AS_HELP_STRING([--with-freetype=@<:@yes/no/auto@:>@],
295			[Use the FreeType library @<:@default=auto@:>@])],,
296	[with_freetype=auto])
297have_freetype=false
298FREETYPE_DEPS="freetype2 >= 12.0.6"
299AC_SUBST(FREETYPE_DEPS)
300if test "x$with_freetype" = "xyes" -o "x$with_freetype" = "xauto"; then
301	# See freetype/docs/VERSION.DLL; 12.0.6 means freetype-2.4.2
302	PKG_CHECK_MODULES(FREETYPE, $FREETYPE_DEPS, have_freetype=true, :)
303fi
304if test "x$with_freetype" = "xyes" -a "x$have_freetype" != "xtrue"; then
305	AC_MSG_ERROR([FreeType support requested but libfreetype2 not found])
306fi
307if $have_freetype; then
308	AC_DEFINE(HAVE_FREETYPE, 1, [Have FreeType 2 library])
309	save_libs=$LIBS
310	LIBS="$LIBS $FREETYPE_LIBS"
311	AC_CHECK_FUNCS(FT_Get_Var_Blend_Coordinates FT_Set_Var_Blend_Coordinates FT_Done_MM_Var FT_Get_Transform)
312	LIBS=$save_libs
313fi
314AM_CONDITIONAL(HAVE_FREETYPE, $have_freetype)
315
316dnl ===========================================================================
317
318AC_ARG_WITH(uniscribe,
319	[AS_HELP_STRING([--with-uniscribe=@<:@yes/no/auto@:>@],
320			[Use the Uniscribe library @<:@default=no@:>@])],,
321	[with_uniscribe=no])
322have_uniscribe=false
323if test "x$with_uniscribe" = "xyes" -o "x$with_uniscribe" = "xauto"; then
324	AC_CHECK_HEADERS(usp10.h windows.h, have_uniscribe=true)
325fi
326if test "x$with_uniscribe" = "xyes" -a "x$have_uniscribe" != "xtrue"; then
327	AC_MSG_ERROR([uniscribe support requested but not found])
328fi
329if $have_uniscribe; then
330	UNISCRIBE_CFLAGS=
331	UNISCRIBE_LIBS="-lusp10 -lgdi32 -lrpcrt4"
332	AC_SUBST(UNISCRIBE_CFLAGS)
333	AC_SUBST(UNISCRIBE_LIBS)
334	AC_DEFINE(HAVE_UNISCRIBE, 1, [Have Uniscribe library])
335fi
336AM_CONDITIONAL(HAVE_UNISCRIBE, $have_uniscribe)
337
338dnl ===========================================================================
339
340AC_ARG_WITH(gdi,
341	[AS_HELP_STRING([--with-gdi=@<:@yes/no/auto@:>@],
342			[Provide GDI integration helpers @<:@default=no@:>@])],,
343	[with_gdi=no])
344have_gdi=false
345if test "x$with_gdi" = "xyes" -o "x$with_gdi" = "xauto"; then
346	AC_CHECK_HEADERS(windows.h, have_gdi=true)
347fi
348if test "x$with_gdi" = "xyes" -a "x$have_gdi" != "xtrue"; then
349	AC_MSG_ERROR([gdi support requested but not found])
350fi
351if $have_gdi; then
352	GDI_CFLAGS=
353	GDI_LIBS="-lgdi32"
354	AC_SUBST(GDI_CFLAGS)
355	AC_SUBST(GDI_LIBS)
356	AC_DEFINE(HAVE_GDI, 1, [Have GDI library])
357fi
358AM_CONDITIONAL(HAVE_GDI, $have_gdi)
359
360dnl ===========================================================================
361
362AC_ARG_WITH(directwrite,
363	[AS_HELP_STRING([--with-directwrite=@<:@yes/no/auto@:>@],
364			[Use the DirectWrite library (experimental) @<:@default=no@:>@])],,
365	[with_directwrite=no])
366have_directwrite=false
367AC_LANG_PUSH([C++])
368if test "x$with_directwrite" = "xyes" -o "x$with_directwrite" = "xauto"; then
369	AC_CHECK_HEADERS(dwrite_1.h, have_directwrite=true)
370fi
371AC_LANG_POP([C++])
372if test "x$with_directwrite" = "xyes" -a "x$have_directwrite" != "xtrue"; then
373	AC_MSG_ERROR([directwrite support requested but not found])
374fi
375if $have_directwrite; then
376	AC_DEFINE(HAVE_DIRECTWRITE, 1, [Have DirectWrite library])
377fi
378AM_CONDITIONAL(HAVE_DIRECTWRITE, $have_directwrite)
379
380dnl ===========================================================================
381
382AC_ARG_WITH(coretext,
383	[AS_HELP_STRING([--with-coretext=@<:@yes/no/auto@:>@],
384			[Use CoreText @<:@default=no@:>@])],,
385	[with_coretext=no])
386have_coretext=false
387if test "x$with_coretext" = "xyes" -o "x$with_coretext" = "xauto"; then
388	AC_CHECK_TYPE(CTFontRef, have_coretext=true,, [#include <ApplicationServices/ApplicationServices.h>])
389
390	if $have_coretext; then
391		CORETEXT_CFLAGS=
392		CORETEXT_LIBS="-framework ApplicationServices"
393		AC_SUBST(CORETEXT_CFLAGS)
394		AC_SUBST(CORETEXT_LIBS)
395	else
396		# On iOS CoreText and CoreGraphics are stand-alone frameworks
397		if test "x$have_coretext" != "xtrue"; then
398			# Check for a different symbol to avoid getting cached result.
399			AC_CHECK_TYPE(CTRunRef, have_coretext=true,, [#include <CoreText/CoreText.h>])
400		fi
401
402		if $have_coretext; then
403			CORETEXT_CFLAGS=
404			CORETEXT_LIBS="-framework CoreText -framework CoreGraphics -framework CoreFoundation"
405			AC_SUBST(CORETEXT_CFLAGS)
406			AC_SUBST(CORETEXT_LIBS)
407		fi
408	fi
409fi
410if test "x$with_coretext" = "xyes" -a "x$have_coretext" != "xtrue"; then
411	AC_MSG_ERROR([CoreText support requested but libcoretext not found])
412fi
413if $have_coretext; then
414	AC_DEFINE(HAVE_CORETEXT, 1, [Have Core Text backend])
415fi
416AM_CONDITIONAL(HAVE_CORETEXT, $have_coretext)
417
418dnl ===========================================================================
419
420AC_CONFIG_FILES([
421Makefile
422src/Makefile
423src/harfbuzz-config.cmake
424util/Makefile
425test/Makefile
426test/api/Makefile
427test/fuzzing/Makefile
428test/shape/Makefile
429test/shape/data/Makefile
430test/shape/data/aots/Makefile
431test/shape/data/in-house/Makefile
432test/shape/data/text-rendering-tests/Makefile
433test/subset/Makefile
434test/subset/data/Makefile
435test/subset/data/repack_tests/Makefile
436test/threads/Makefile
437perf/Makefile
438docs/Makefile
439docs/version.xml
440])
441
442AC_OUTPUT
443
444echo
445echo "C++ compiler version:"
446$CXX --version
447echo
448
449AC_MSG_NOTICE([
450
451Autotools is no longer our supported build system for building the library
452for *nix distributions, please migrate to meson.
453
454])
455
456
457AC_MSG_NOTICE([
458
459Build configuration:
460
461Unicode callbacks (you want at least one):
462	Builtin			true
463	Glib:			${have_glib}
464	ICU:			${have_icu}
465
466Font callbacks (the more the merrier):
467	FreeType:		${have_freetype}
468
469Tools used for command-line utilities:
470	Cairo:			${have_cairo}
471	Chafa:			${have_chafa}
472
473Additional shapers:
474	Graphite2:		${have_graphite2}
475
476Platform shapers (not normally needed):
477	CoreText:		${have_coretext}
478	DirectWrite:		${have_directwrite}
479	GDI:			${have_gdi}
480	Uniscribe:		${have_uniscribe}
481
482Other features:
483	Documentation:		${enable_gtk_doc}
484	GObject bindings:	${have_gobject}
485	Introspection:		${have_introspection}
486])
487