4 [https://github.com/harfbuzz/harfbuzz/issues/new],
6 [http://harfbuzz.org/])
8 AC_CONFIG_MACRO_DIR([m4])
9 AC_CONFIG_SRCDIR([src/harfbuzz.pc.in])
10 AC_CONFIG_HEADERS([config.h])
12 AM_INIT_AUTOMAKE([1.13.0 gnits tar-ustar dist-bzip2 no-dist-gzip -Wall no-define color-tests -Wno-portability])
13 AM_SILENT_RULES([yes])
17 m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
19 LT_INIT([disable-static])
26 dnl AX_CXX_COMPILE_STDCXX(11, noext, optional)
28 PKG_PROG_PKG_CONFIG([0.20])
29 AM_MISSING_PROG([RAGEL], [ragel])
30 AM_MISSING_PROG([GIT], [git])
33 m4_define(hb_version_triplet,m4_split(AC_PACKAGE_VERSION,[[.]]))
34 m4_define(hb_version_major,m4_argn(1,hb_version_triplet))
35 m4_define(hb_version_minor,m4_argn(2,hb_version_triplet))
36 m4_define(hb_version_micro,m4_argn(3,hb_version_triplet))
37 HB_VERSION_MAJOR=hb_version_major
38 HB_VERSION_MINOR=hb_version_minor
39 HB_VERSION_MICRO=hb_version_micro
40 HB_VERSION=AC_PACKAGE_VERSION
41 AC_SUBST(HB_VERSION_MAJOR)
42 AC_SUBST(HB_VERSION_MINOR)
43 AC_SUBST(HB_VERSION_MICRO)
47 m4_define([hb_version_int],
48 m4_eval(hb_version_major*10000 + hb_version_minor*100 + hb_version_micro))
49 m4_if(m4_eval(hb_version_minor % 2), [1],
50 dnl for unstable releases
51 [m4_define([hb_libtool_revision], 0)],
52 dnl for stable releases
53 [m4_define([hb_libtool_revision], hb_version_micro)])
54 m4_define([hb_libtool_age],
55 m4_eval(hb_version_int - hb_libtool_revision))
56 m4_define([hb_libtool_current],
57 m4_eval(hb_libtool_age))
58 HB_LIBTOOL_VERSION_INFO=hb_libtool_current:hb_libtool_revision:hb_libtool_age
59 AC_SUBST(HB_LIBTOOL_VERSION_INFO)
61 AC_ARG_WITH([libstdc++],
62 [AS_HELP_STRING([--with-libstdc++=@<:@yes/no@:>@],
63 [Allow linking with libstdc++ @<:@default=no@:>@])],
64 [with_libstdcxx=$withval],
66 AM_CONDITIONAL(WITH_LIBSTDCXX, [test "x$with_libstdcxx" = "xyes"])
70 m4_ifdef([GTK_DOC_CHECK], [
71 GTK_DOC_CHECK([1.15],[--flavour no-tmpl])
72 if test "x$enable_gtk_doc" = xyes; then
76 AM_CONDITIONAL([ENABLE_GTK_DOC], false)
79 # Functions and headers
80 AC_CHECK_FUNCS(atexit mprotect sysconf getpagesize mmap isatty newlocale strtod_l posix_memalign)
84 AC_CHECK_FUNCS([round], ,[AC_CHECK_DECLS([round], , ,[#include <math.h>])])
87 AC_CHECK_HEADERS(unistd.h sys/mman.h xlocale.h stdbool.h)
91 AC_CHECK_ALIGNOF([struct{char;}])
92 if test "x$GCC" = "xyes"; then
94 # Make symbols link locally
95 AX_CHECK_LINK_FLAG([[-Bsymbolic-functions]], [LDFLAGS="$LDFLAGS -Bsymbolic-functions"])
97 # Make it possible to not link to libstdc++
98 # No threadsafe statics in C++ as we do it ourselves.
99 # We don't use these features, so it's safe to disable them
100 # even in the cases where we DO link to libstdc++.
101 # Put -fno-rtti before $CXXFLAGS such that users can re-enable it
102 # by overriding CXXFLAGS.
103 CXXFLAGS="-fno-rtti $CXXFLAGS -fno-exceptions -fno-threadsafe-statics"
109 # Hide inline methods
110 CXXFLAGS="$CXXFLAGS -fvisibility-inlines-hidden"
116 if test "x$ac_cv_alignof_struct_char__" != x1; then
117 # Request byte alignment
118 CXXFLAGS="$CXXFLAGS -mstructure-size-boundary=8"
124 AM_CONDITIONAL(HAVE_GCC, test "x$GCC" = "xyes")
127 AC_MSG_CHECKING([for native Win32])
133 AC_MSG_RESULT([$hb_os_win32])
134 AM_CONDITIONAL(OS_WIN32, test "$hb_os_win32" = "yes")
137 if test "$hb_os_win32" = no; then
138 AX_PTHREAD([have_pthread=true])
140 if $have_pthread; then
141 AC_DEFINE(HAVE_PTHREAD, 1, [Have POSIX threads])
143 AM_CONDITIONAL(HAVE_PTHREAD, $have_pthread)
145 dnl ==========================================================================
148 if $have_fallback; then
149 AC_DEFINE(HAVE_FALLBACK, 1, [Have simple TrueType Layout backend])
151 AM_CONDITIONAL(HAVE_FALLBACK, $have_fallback)
153 dnl ===========================================================================
156 [AS_HELP_STRING([--with-glib=@<:@yes/no/auto@:>@],
157 [Use glib @<:@default=auto@:>@])],,
160 GLIB_DEPS="glib-2.0 >= 2.19.1"
162 if test "x$with_glib" = "xyes" -o "x$with_glib" = "xauto"; then
163 PKG_CHECK_MODULES(GLIB, $GLIB_DEPS, have_glib=true, :)
165 if test "x$with_glib" = "xyes" -a "x$have_glib" != "xtrue"; then
166 AC_MSG_ERROR([glib support requested but glib-2.0 not found])
169 AC_DEFINE(HAVE_GLIB, 1, [Have glib2 library])
171 AM_CONDITIONAL(HAVE_GLIB, $have_glib)
173 dnl ===========================================================================
176 [AS_HELP_STRING([--with-gobject=@<:@yes/no/auto@:>@],
177 [Use gobject @<:@default=no@:>@])],,
180 if test "x$with_gobject" = "xyes" -o "x$with_gobject" = "xauto"; then
181 PKG_CHECK_MODULES(GOBJECT, gobject-2.0 glib-2.0, have_gobject=true, :)
183 if test "x$with_gobject" = "xyes" -a "x$have_gobject" != "xtrue"; then
184 AC_MSG_ERROR([gobject support requested but gobject-2.0 / glib-2.0 not found])
186 if $have_gobject; then
187 AC_DEFINE(HAVE_GOBJECT, 1, [Have gobject2 library])
188 GLIB_MKENUMS=`$PKG_CONFIG --variable=glib_mkenums glib-2.0`
189 AC_SUBST(GLIB_MKENUMS)
191 AM_CONDITIONAL(HAVE_GOBJECT, $have_gobject)
192 AC_SUBST(have_gobject)
194 dnl ===========================================================================
197 dnl ===========================================================================
198 # Gobject-Introspection
199 have_introspection=false
200 m4_ifdef([GOBJECT_INTROSPECTION_CHECK], [
201 if $have_gobject; then
202 GOBJECT_INTROSPECTION_CHECK([1.34.0])
203 if test "x$found_introspection" = xyes; then
204 have_introspection=true
207 AM_CONDITIONAL([HAVE_INTROSPECTION], false)
210 AM_CONDITIONAL([HAVE_INTROSPECTION], false)
213 dnl ==========================================================================
216 [AS_HELP_STRING([--with-cairo=@<:@yes/no/auto@:>@],
217 [Use cairo @<:@default=auto@:>@])],,
220 if test "x$with_cairo" = "xyes" -o "x$with_cairo" = "xauto"; then
221 PKG_CHECK_MODULES(CAIRO, cairo >= 1.8.0, have_cairo=true, :)
223 if test "x$with_cairo" = "xyes" -a "x$have_cairo" != "xtrue"; then
224 AC_MSG_ERROR([cairo support requested but not found])
227 AC_DEFINE(HAVE_CAIRO, 1, [Have cairo graphics library])
229 AM_CONDITIONAL(HAVE_CAIRO, $have_cairo)
233 PKG_CHECK_MODULES(CAIRO_FT, cairo-ft, have_cairo_ft=true, :)
235 if $have_cairo_ft; then
236 AC_DEFINE(HAVE_CAIRO_FT, 1, [Have cairo-ft support in cairo graphics library])
238 AM_CONDITIONAL(HAVE_CAIRO_FT, $have_cairo_ft)
240 dnl ==========================================================================
242 AC_ARG_WITH(fontconfig,
243 [AS_HELP_STRING([--with-fontconfig=@<:@yes/no/auto@:>@],
244 [Use fontconfig @<:@default=auto@:>@])],,
245 [with_fontconfig=auto])
246 have_fontconfig=false
247 if test "x$with_fontconfig" = "xyes" -o "x$with_fontconfig" = "xauto"; then
248 PKG_CHECK_MODULES(FONTCONFIG, fontconfig, have_fontconfig=true, :)
250 if test "x$with_fontconfig" = "xyes" -a "x$have_fontconfig" != "xtrue"; then
251 AC_MSG_ERROR([fontconfig support requested but not found])
253 if $have_fontconfig; then
254 AC_DEFINE(HAVE_FONTCONFIG, 1, [Have fontconfig library])
256 AM_CONDITIONAL(HAVE_FONTCONFIG, $have_fontconfig)
258 dnl ==========================================================================
261 [AS_HELP_STRING([--with-icu=@<:@yes/no/builtin/auto@:>@],
262 [Use ICU @<:@default=auto@:>@])],,
265 if test "x$with_icu" = "xyes" -o "x$with_icu" = "xbuiltin" -o "x$with_icu" = "xauto"; then
266 PKG_CHECK_MODULES(ICU, icu-uc, have_icu=true, :)
268 dnl Fallback to icu-config if ICU pkg-config files could not be found
269 if test "$have_icu" != "true"; then
270 AC_CHECK_TOOL(ICU_CONFIG, icu-config, no)
271 AC_MSG_CHECKING([for ICU by using icu-config fallback])
272 if test "$ICU_CONFIG" != "no" && "$ICU_CONFIG" --version >/dev/null; then
274 # We don't use --cflags as this gives us a lot of things that we don't
275 # necessarily want, like debugging and optimization flags
276 # See man (1) icu-config for more info.
277 ICU_CFLAGS=`$ICU_CONFIG --cppflags`
278 ICU_LIBS=`$ICU_CONFIG --ldflags-searchpath --ldflags-libsonly`
287 if test \( "x$with_icu" = "xyes" -o "x$with_icu" = "xbuiltin" \) -a "x$have_icu" != "xtrue"; then
288 AC_MSG_ERROR([icu support requested but icu-uc not found])
292 CXXFLAGS="$CXXFLAGS `$PKG_CONFIG --variable=CXXFLAGS icu-uc`"
293 AC_DEFINE(HAVE_ICU, 1, [Have ICU library])
294 if test "x$with_icu" = "xbuiltin"; then
295 AC_DEFINE(HAVE_ICU_BUILTIN, 1, [Use hb-icu Unicode callbacks])
298 AM_CONDITIONAL(HAVE_ICU, $have_icu)
299 AM_CONDITIONAL(HAVE_ICU_BUILTIN, $have_icu && test "x$with_icu" = "xbuiltin")
301 dnl ===========================================================================
304 [AS_HELP_STRING([--with-ucdn=@<:@yes/no@:>@],
305 [Use builtin UCDN library @<:@default=yes@:>@])],,
308 if test "x$with_ucdn" = "xyes"; then
312 AC_DEFINE(HAVE_UCDN, 1, [Have UCDN Unicode functions])
314 AM_CONDITIONAL(HAVE_UCDN, $have_ucdn)
316 dnl ==========================================================================
318 AC_ARG_WITH(graphite2,
319 [AS_HELP_STRING([--with-graphite2=@<:@yes/no/auto@:>@],
320 [Use the graphite2 library @<:@default=no@:>@])],,
323 GRAPHITE2_DEPS="graphite2 >= 1.2.0"
324 AC_SUBST(GRAPHITE2_DEPS)
325 if test "x$with_graphite2" = "xyes" -o "x$with_graphite2" = "xauto"; then
326 PKG_CHECK_MODULES(GRAPHITE2, $GRAPHITE2_DEPS, have_graphite2=true, :)
327 if test "x$have_graphite2" != "xtrue"; then
328 # If pkg-config is not available, graphite2 can still be there
329 ac_save_CFLAGS="$CFLAGS"
330 ac_save_CPPFLAGS="$CPPFLAGS"
331 CFLAGS="$CFLAGS $GRAPHITE2_CFLAGS"
332 CPPFLAGS="$CPPFLAGS $GRAPHITE2_CFLAGS"
333 AC_CHECK_HEADER(graphite2/Segment.h, have_graphite2=true, :)
334 CPPFLAGS="$ac_save_CPPFLAGS"
335 CFLAGS="$ac_save_CFLAGS"
338 if test "x$with_graphite2" = "xyes" -a "x$have_graphite2" != "xtrue"; then
339 AC_MSG_ERROR([graphite2 support requested but libgraphite2 not found])
341 if $have_graphite2; then
342 AC_DEFINE(HAVE_GRAPHITE2, 1, [Have Graphite2 library])
344 AM_CONDITIONAL(HAVE_GRAPHITE2, $have_graphite2)
346 dnl ==========================================================================
348 AC_ARG_WITH(freetype,
349 [AS_HELP_STRING([--with-freetype=@<:@yes/no/auto@:>@],
350 [Use the FreeType library @<:@default=auto@:>@])],,
351 [with_freetype=auto])
353 FREETYPE_DEPS="freetype2 >= 12.0.6"
354 AC_SUBST(FREETYPE_DEPS)
355 if test "x$with_freetype" = "xyes" -o "x$with_freetype" = "xauto"; then
356 # See freetype/docs/VERSION.DLL; 12.0.6 means freetype-2.4.2
357 PKG_CHECK_MODULES(FREETYPE, $FREETYPE_DEPS, have_freetype=true, :)
359 if test "x$with_freetype" = "xyes" -a "x$have_freetype" != "xtrue"; then
360 AC_MSG_ERROR([FreeType support requested but libfreetype2 not found])
362 if $have_freetype; then
363 AC_DEFINE(HAVE_FREETYPE, 1, [Have FreeType 2 library])
365 LIBS="$LIBS $FREETYPE_LIBS"
366 AC_CHECK_FUNCS(FT_Get_Var_Blend_Coordinates FT_Set_Var_Blend_Coordinates FT_Done_MM_Var)
369 AM_CONDITIONAL(HAVE_FREETYPE, $have_freetype)
371 dnl ===========================================================================
373 AC_ARG_WITH(uniscribe,
374 [AS_HELP_STRING([--with-uniscribe=@<:@yes/no/auto@:>@],
375 [Use the Uniscribe library @<:@default=no@:>@])],,
378 if test "x$with_uniscribe" = "xyes" -o "x$with_uniscribe" = "xauto"; then
379 AC_CHECK_HEADERS(usp10.h windows.h, have_uniscribe=true)
381 if test "x$with_uniscribe" = "xyes" -a "x$have_uniscribe" != "xtrue"; then
382 AC_MSG_ERROR([uniscribe support requested but not found])
384 if $have_uniscribe; then
386 UNISCRIBE_LIBS="-lusp10 -lgdi32 -lrpcrt4"
387 AC_SUBST(UNISCRIBE_CFLAGS)
388 AC_SUBST(UNISCRIBE_LIBS)
389 AC_DEFINE(HAVE_UNISCRIBE, 1, [Have Uniscribe library])
391 AM_CONDITIONAL(HAVE_UNISCRIBE, $have_uniscribe)
393 dnl ===========================================================================
395 AC_ARG_WITH(directwrite,
396 [AS_HELP_STRING([--with-directwrite=@<:@yes/no/auto@:>@],
397 [Use the DirectWrite library (experimental) @<:@default=no@:>@])],,
398 [with_directwrite=no])
399 have_directwrite=false
401 if test "x$with_directwrite" = "xyes" -o "x$with_directwrite" = "xauto"; then
402 AC_CHECK_HEADERS(dwrite.h, have_directwrite=true)
405 if test "x$with_directwrite" = "xyes" -a "x$have_directwrite" != "xtrue"; then
406 AC_MSG_ERROR([directwrite support requested but not found])
408 if $have_directwrite; then
409 DIRECTWRITE_CXXFLAGS=
410 DIRECTWRITE_LIBS="-ldwrite"
411 AC_SUBST(DIRECTWRITE_CXXFLAGS)
412 AC_SUBST(DIRECTWRITE_LIBS)
413 AC_DEFINE(HAVE_DIRECTWRITE, 1, [Have DirectWrite library])
415 AM_CONDITIONAL(HAVE_DIRECTWRITE, $have_directwrite)
417 dnl ===========================================================================
419 AC_ARG_WITH(coretext,
420 [AS_HELP_STRING([--with-coretext=@<:@yes/no/auto@:>@],
421 [Use CoreText @<:@default=no@:>@])],,
424 if test "x$with_coretext" = "xyes" -o "x$with_coretext" = "xauto"; then
425 AC_CHECK_TYPE(CTFontRef, have_coretext=true,, [#include <ApplicationServices/ApplicationServices.h>])
427 if $have_coretext; then
429 CORETEXT_LIBS="-framework ApplicationServices"
430 AC_SUBST(CORETEXT_CFLAGS)
431 AC_SUBST(CORETEXT_LIBS)
433 # On iOS CoreText and CoreGraphics are stand-alone frameworks
434 if test "x$have_coretext" != "xtrue"; then
435 # Check for a different symbol to avoid getting cached result.
436 AC_CHECK_TYPE(CTRunRef, have_coretext=true,, [#include <CoreText/CoreText.h>])
439 if $have_coretext; then
441 CORETEXT_LIBS="-framework CoreText -framework CoreGraphics -framework CoreFoundation"
442 AC_SUBST(CORETEXT_CFLAGS)
443 AC_SUBST(CORETEXT_LIBS)
447 if test "x$with_coretext" = "xyes" -a "x$have_coretext" != "xtrue"; then
448 AC_MSG_ERROR([CoreText support requested but libcoretext not found])
450 if $have_coretext; then
451 AC_DEFINE(HAVE_CORETEXT, 1, [Have Core Text backend])
453 AM_CONDITIONAL(HAVE_CORETEXT, $have_coretext)
455 dnl ===========================================================================
457 AC_CACHE_CHECK([for Intel atomic primitives], hb_cv_have_intel_atomic_primitives, [
458 hb_cv_have_intel_atomic_primitives=false
460 void memory_barrier (void) { __sync_synchronize (); }
461 int atomic_add (int *i) { return __sync_fetch_and_add (i, 1); }
462 int mutex_trylock (int *m) { return __sync_lock_test_and_set (m, 1); }
463 void mutex_unlock (int *m) { __sync_lock_release (m); }
464 ], [], hb_cv_have_intel_atomic_primitives=true
467 if $hb_cv_have_intel_atomic_primitives; then
468 AC_DEFINE(HAVE_INTEL_ATOMIC_PRIMITIVES, 1, [Have Intel __sync_* atomic primitives])
471 dnl ===========================================================================
473 AC_CACHE_CHECK([for Solaris atomic operations], hb_cv_have_solaris_atomic_ops, [
474 hb_cv_have_solaris_atomic_ops=false
477 /* This requires Solaris Studio 12.2 or newer: */
478 #include <mbarrier.h>
479 void memory_barrier (void) { __machine_rw_barrier (); }
480 int atomic_add (volatile unsigned *i) { return atomic_add_int_nv (i, 1); }
481 void *atomic_ptr_cmpxchg (volatile void **target, void *cmp, void *newval) { return atomic_cas_ptr (target, cmp, newval); }
482 ], [], hb_cv_have_solaris_atomic_ops=true
485 if $hb_cv_have_solaris_atomic_ops; then
486 AC_DEFINE(HAVE_SOLARIS_ATOMIC_OPS, 1, [Have Solaris __machine_*_barrier and atomic_* operations])
489 if test "$os_win32" = no && ! $have_pthread; then
490 AC_CHECK_HEADERS(sched.h)
491 AC_SEARCH_LIBS(sched_yield,rt,AC_DEFINE(HAVE_SCHED_YIELD, 1, [Have sched_yield]))
494 dnl ===========================================================================
499 src/harfbuzz-config.cmake
504 test/fuzzing/Makefile
505 test/shaping/Makefile
506 test/shaping/data/Makefile
507 test/shaping/data/aots/Makefile
508 test/shaping/data/in-house/Makefile
509 test/shaping/data/text-rendering-tests/Makefile
511 test/subset/data/Makefile
519 echo "C++ compiler version:"
527 Unicode callbacks (you want at least one):
528 Builtin (UCDN): ${have_ucdn}
532 Font callbacks (the more the merrier):
533 FreeType: ${have_freetype}
535 Tools used for command-line utilities:
537 Fontconfig: ${have_fontconfig}
539 Additional shapers (the more the merrier):
540 Graphite2: ${have_graphite2}
542 Platform shapers (not normally needed):
543 CoreText: ${have_coretext}
544 DirectWrite: ${have_directwrite}
545 Uniscribe: ${have_uniscribe}
548 Documentation: ${enable_gtk_doc}
549 GObject bindings: ${have_gobject}
550 Introspection: ${have_introspection}