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])
22 AC_USE_SYSTEM_EXTENSIONS
27 dnl AX_CXX_COMPILE_STDCXX(11, noext, optional)
29 PKG_PROG_PKG_CONFIG([0.20])
30 AM_MISSING_PROG([RAGEL], [ragel])
31 AM_MISSING_PROG([GIT], [git])
34 m4_define(hb_version_triplet,m4_split(AC_PACKAGE_VERSION,[[.]]))
35 m4_define(hb_version_major,m4_argn(1,hb_version_triplet))
36 m4_define(hb_version_minor,m4_argn(2,hb_version_triplet))
37 m4_define(hb_version_micro,m4_argn(3,hb_version_triplet))
38 HB_VERSION_MAJOR=hb_version_major
39 HB_VERSION_MINOR=hb_version_minor
40 HB_VERSION_MICRO=hb_version_micro
41 HB_VERSION=AC_PACKAGE_VERSION
42 AC_SUBST(HB_VERSION_MAJOR)
43 AC_SUBST(HB_VERSION_MINOR)
44 AC_SUBST(HB_VERSION_MICRO)
48 m4_define([hb_version_int],
49 m4_eval(hb_version_major*10000 + hb_version_minor*100 + hb_version_micro))
50 m4_if(m4_eval(hb_version_minor % 2), [1],
51 dnl for unstable releases
52 [m4_define([hb_libtool_revision], 0)],
53 dnl for stable releases
54 [m4_define([hb_libtool_revision], hb_version_micro)])
55 m4_define([hb_libtool_age],
56 m4_eval(hb_version_int - hb_libtool_revision))
57 m4_define([hb_libtool_current],
58 m4_eval(hb_libtool_age))
59 HB_LIBTOOL_VERSION_INFO=hb_libtool_current:hb_libtool_revision:hb_libtool_age
60 AC_SUBST(HB_LIBTOOL_VERSION_INFO)
62 AC_ARG_WITH([libstdc++],
63 [AS_HELP_STRING([--with-libstdc++=@<:@yes/no@:>@],
64 [Allow linking with libstdc++ @<:@default=no@:>@])],
65 [with_libstdcxx=$withval],
67 AM_CONDITIONAL(WITH_LIBSTDCXX, [test "x$with_libstdcxx" = "xyes"])
71 m4_ifdef([GTK_DOC_CHECK], [
72 GTK_DOC_CHECK([1.15],[--flavour no-tmpl])
73 if test "x$enable_gtk_doc" = xyes; then
77 AM_CONDITIONAL([ENABLE_GTK_DOC], false)
80 # Functions and headers
81 AC_CHECK_FUNCS(atexit mprotect sysconf getpagesize mmap isatty newlocale strtod_l)
85 AC_CHECK_FUNCS([round], ,[AC_CHECK_DECLS([round], , ,[#include <math.h>])])
88 AC_CHECK_HEADERS(unistd.h sys/mman.h xlocale.h stdbool.h)
92 AC_CHECK_ALIGNOF([struct{char;}])
93 if test "x$GCC" = "xyes"; then
95 # Make symbols link locally
96 AX_CHECK_LINK_FLAG([[-Bsymbolic-functions]], [LDFLAGS="$LDFLAGS -Bsymbolic-functions"])
98 # Make it possible to not link to libstdc++
99 # No threadsafe statics in C++ as we do it ourselves.
100 # We don't use these features, so it's safe to disable them
101 # even in the cases where we DO link to libstdc++.
102 # Put -fno-rtti before $CXXFLAGS such that users can re-enable it
103 # by overriding CXXFLAGS.
104 CXXFLAGS="-fno-rtti $CXXFLAGS -fno-exceptions -fno-threadsafe-statics"
107 CXXFLAGS="$CXXFLAGS -Wcast-align"
113 # Hide inline methods
114 CXXFLAGS="$CXXFLAGS -fvisibility-inlines-hidden"
120 if test "x$ac_cv_alignof_struct_char__" != x1; then
121 # Request byte alignment
122 CXXFLAGS="$CXXFLAGS -mstructure-size-boundary=8"
128 AM_CONDITIONAL(HAVE_GCC, test "x$GCC" = "xyes")
131 AC_MSG_CHECKING([for native Win32])
137 AC_MSG_RESULT([$hb_os_win32])
138 AM_CONDITIONAL(OS_WIN32, test "$hb_os_win32" = "yes")
141 if test "$hb_os_win32" = no; then
142 AX_PTHREAD([have_pthread=true])
144 if $have_pthread; then
145 AC_DEFINE(HAVE_PTHREAD, 1, [Have POSIX threads])
147 AM_CONDITIONAL(HAVE_PTHREAD, $have_pthread)
149 dnl ==========================================================================
153 AC_DEFINE(HAVE_OT, 1, [Have native OpenType Layout backend])
155 AM_CONDITIONAL(HAVE_OT, $have_ot)
158 if $have_fallback; then
159 AC_DEFINE(HAVE_FALLBACK, 1, [Have simple TrueType Layout backend])
161 AM_CONDITIONAL(HAVE_FALLBACK, $have_fallback)
163 dnl ===========================================================================
166 [AS_HELP_STRING([--with-glib=@<:@yes/no/auto@:>@],
167 [Use glib @<:@default=auto@:>@])],,
170 GLIB_DEPS="glib-2.0 >= 2.19.1"
172 if test "x$with_glib" = "xyes" -o "x$with_glib" = "xauto"; then
173 PKG_CHECK_MODULES(GLIB, $GLIB_DEPS, have_glib=true, :)
175 if test "x$with_glib" = "xyes" -a "x$have_glib" != "xtrue"; then
176 AC_MSG_ERROR([glib support requested but glib-2.0 not found])
179 AC_DEFINE(HAVE_GLIB, 1, [Have glib2 library])
181 AM_CONDITIONAL(HAVE_GLIB, $have_glib)
183 dnl ===========================================================================
186 [AS_HELP_STRING([--with-gobject=@<:@yes/no/auto@:>@],
187 [Use gobject @<:@default=no@:>@])],,
190 if test "x$with_gobject" = "xyes" -o "x$with_gobject" = "xauto"; then
191 PKG_CHECK_MODULES(GOBJECT, gobject-2.0 glib-2.0, have_gobject=true, :)
193 if test "x$with_gobject" = "xyes" -a "x$have_gobject" != "xtrue"; then
194 AC_MSG_ERROR([gobject support requested but gobject-2.0 / glib-2.0 not found])
196 if $have_gobject; then
197 AC_DEFINE(HAVE_GOBJECT, 1, [Have gobject2 library])
198 GLIB_MKENUMS=`$PKG_CONFIG --variable=glib_mkenums glib-2.0`
199 AC_SUBST(GLIB_MKENUMS)
201 AM_CONDITIONAL(HAVE_GOBJECT, $have_gobject)
202 AC_SUBST(have_gobject)
204 dnl ===========================================================================
207 dnl ===========================================================================
208 # Gobject-Introspection
209 have_introspection=false
210 m4_ifdef([GOBJECT_INTROSPECTION_CHECK], [
211 if $have_gobject; then
212 GOBJECT_INTROSPECTION_CHECK([1.34.0])
213 if test "x$found_introspection" = xyes; then
214 have_introspection=true
217 AM_CONDITIONAL([HAVE_INTROSPECTION], false)
220 AM_CONDITIONAL([HAVE_INTROSPECTION], false)
223 dnl ==========================================================================
226 [AS_HELP_STRING([--with-cairo=@<:@yes/no/auto@:>@],
227 [Use cairo @<:@default=auto@:>@])],,
230 if test "x$with_cairo" = "xyes" -o "x$with_cairo" = "xauto"; then
231 PKG_CHECK_MODULES(CAIRO, cairo >= 1.8.0, have_cairo=true, :)
233 if test "x$with_cairo" = "xyes" -a "x$have_cairo" != "xtrue"; then
234 AC_MSG_ERROR([cairo support requested but not found])
237 AC_DEFINE(HAVE_CAIRO, 1, [Have cairo graphics library])
239 AM_CONDITIONAL(HAVE_CAIRO, $have_cairo)
243 PKG_CHECK_MODULES(CAIRO_FT, cairo-ft, have_cairo_ft=true, :)
245 if $have_cairo_ft; then
246 AC_DEFINE(HAVE_CAIRO_FT, 1, [Have cairo-ft support in cairo graphics library])
248 AM_CONDITIONAL(HAVE_CAIRO_FT, $have_cairo_ft)
250 dnl ==========================================================================
252 AC_ARG_WITH(fontconfig,
253 [AS_HELP_STRING([--with-fontconfig=@<:@yes/no/auto@:>@],
254 [Use fontconfig @<:@default=auto@:>@])],,
255 [with_fontconfig=auto])
256 have_fontconfig=false
257 if test "x$with_fontconfig" = "xyes" -o "x$with_fontconfig" = "xauto"; then
258 PKG_CHECK_MODULES(FONTCONFIG, fontconfig, have_fontconfig=true, :)
260 if test "x$with_fontconfig" = "xyes" -a "x$have_fontconfig" != "xtrue"; then
261 AC_MSG_ERROR([fontconfig support requested but not found])
263 if $have_fontconfig; then
264 AC_DEFINE(HAVE_FONTCONFIG, 1, [Have fontconfig library])
266 AM_CONDITIONAL(HAVE_FONTCONFIG, $have_fontconfig)
268 dnl ==========================================================================
271 [AS_HELP_STRING([--with-icu=@<:@yes/no/builtin/auto@:>@],
272 [Use ICU @<:@default=auto@:>@])],,
275 if test "x$with_icu" = "xyes" -o "x$with_icu" = "xbuiltin" -o "x$with_icu" = "xauto"; then
276 PKG_CHECK_MODULES(ICU, icu-uc, have_icu=true, :)
278 dnl Fallback to icu-config if ICU pkg-config files could not be found
279 if test "$have_icu" != "true"; then
280 AC_CHECK_TOOL(ICU_CONFIG, icu-config, no)
281 AC_MSG_CHECKING([for ICU by using icu-config fallback])
282 if test "$ICU_CONFIG" != "no" && "$ICU_CONFIG" --version >/dev/null; then
284 # We don't use --cflags as this gives us a lot of things that we don't
285 # necessarily want, like debugging and optimization flags
286 # See man (1) icu-config for more info.
287 ICU_CFLAGS=`$ICU_CONFIG --cppflags`
288 ICU_LIBS=`$ICU_CONFIG --ldflags-searchpath --ldflags-libsonly`
297 if test \( "x$with_icu" = "xyes" -o "x$with_icu" = "xbuiltin" \) -a "x$have_icu" != "xtrue"; then
298 AC_MSG_ERROR([icu support requested but icu-uc not found])
302 CXXFLAGS="$CXXFLAGS `$PKG_CONFIG --variable=CXXFLAGS icu-uc`"
303 AC_DEFINE(HAVE_ICU, 1, [Have ICU library])
304 if test "x$with_icu" = "xbuiltin"; then
305 AC_DEFINE(HAVE_ICU_BUILTIN, 1, [Use hb-icu Unicode callbacks])
308 AM_CONDITIONAL(HAVE_ICU, $have_icu)
309 AM_CONDITIONAL(HAVE_ICU_BUILTIN, $have_icu && test "x$with_icu" = "xbuiltin")
311 dnl ===========================================================================
314 [AS_HELP_STRING([--with-ucdn=@<:@yes/no@:>@],
315 [Use builtin UCDN library @<:@default=yes@:>@])],,
318 if test "x$with_ucdn" = "xyes"; then
322 AC_DEFINE(HAVE_UCDN, 1, [Have UCDN Unicode functions])
324 AM_CONDITIONAL(HAVE_UCDN, $have_ucdn)
326 dnl ==========================================================================
328 AC_ARG_WITH(graphite2,
329 [AS_HELP_STRING([--with-graphite2=@<:@yes/no/auto@:>@],
330 [Use the graphite2 library @<:@default=no@:>@])],,
333 GRAPHITE2_DEPS="graphite2"
334 AC_SUBST(GRAPHITE2_DEPS)
335 if test "x$with_graphite2" = "xyes" -o "x$with_graphite2" = "xauto"; then
336 PKG_CHECK_MODULES(GRAPHITE2, $GRAPHITE2_DEPS, have_graphite2=true, :)
337 if test "x$have_graphite2" != "xtrue"; then
338 # If pkg-config is not available, graphite2 can still be there
339 ac_save_CFLAGS="$CFLAGS"
340 ac_save_CPPFLAGS="$CPPFLAGS"
341 CFLAGS="$CFLAGS $GRAPHITE2_CFLAGS"
342 CPPFLAGS="$CPPFLAGS $GRAPHITE2_CFLAGS"
343 AC_CHECK_HEADER(graphite2/Segment.h, have_graphite2=true, :)
344 CPPFLAGS="$ac_save_CPPFLAGS"
345 CFLAGS="$ac_save_CFLAGS"
348 if test "x$with_graphite2" = "xyes" -a "x$have_graphite2" != "xtrue"; then
349 AC_MSG_ERROR([graphite2 support requested but libgraphite2 not found])
351 if $have_graphite2; then
352 AC_DEFINE(HAVE_GRAPHITE2, 1, [Have Graphite2 library])
354 AM_CONDITIONAL(HAVE_GRAPHITE2, $have_graphite2)
356 dnl ==========================================================================
358 AC_ARG_WITH(freetype,
359 [AS_HELP_STRING([--with-freetype=@<:@yes/no/auto@:>@],
360 [Use the FreeType library @<:@default=auto@:>@])],,
361 [with_freetype=auto])
363 FREETYPE_DEPS="freetype2 >= 12.0.6"
364 AC_SUBST(FREETYPE_DEPS)
365 if test "x$with_freetype" = "xyes" -o "x$with_freetype" = "xauto"; then
366 # See freetype/docs/VERSION.DLL; 12.0.6 means freetype-2.4.2
367 PKG_CHECK_MODULES(FREETYPE, $FREETYPE_DEPS, have_freetype=true, :)
369 if test "x$with_freetype" = "xyes" -a "x$have_freetype" != "xtrue"; then
370 AC_MSG_ERROR([FreeType support requested but libfreetype2 not found])
372 if $have_freetype; then
373 AC_DEFINE(HAVE_FREETYPE, 1, [Have FreeType 2 library])
375 LIBS="$LIBS $FREETYPE_LIBS"
376 AC_CHECK_FUNCS(FT_Get_Var_Blend_Coordinates FT_Set_Var_Blend_Coordinates FT_Done_MM_Var)
379 AM_CONDITIONAL(HAVE_FREETYPE, $have_freetype)
381 dnl ===========================================================================
383 AC_ARG_WITH(uniscribe,
384 [AS_HELP_STRING([--with-uniscribe=@<:@yes/no/auto@:>@],
385 [Use the Uniscribe library @<:@default=no@:>@])],,
388 if test "x$with_uniscribe" = "xyes" -o "x$with_uniscribe" = "xauto"; then
389 AC_CHECK_HEADERS(usp10.h windows.h, have_uniscribe=true)
391 if test "x$with_uniscribe" = "xyes" -a "x$have_uniscribe" != "xtrue"; then
392 AC_MSG_ERROR([uniscribe support requested but not found])
394 if $have_uniscribe; then
396 UNISCRIBE_LIBS="-lusp10 -lgdi32 -lrpcrt4"
397 AC_SUBST(UNISCRIBE_CFLAGS)
398 AC_SUBST(UNISCRIBE_LIBS)
399 AC_DEFINE(HAVE_UNISCRIBE, 1, [Have Uniscribe library])
401 AM_CONDITIONAL(HAVE_UNISCRIBE, $have_uniscribe)
403 dnl ===========================================================================
405 AC_ARG_WITH(directwrite,
406 [AS_HELP_STRING([--with-directwrite=@<:@yes/no/auto@:>@],
407 [Use the DirectWrite library (experimental) @<:@default=no@:>@])],,
408 [with_directwrite=no])
409 have_directwrite=false
411 if test "x$with_directwrite" = "xyes" -o "x$with_directwrite" = "xauto"; then
412 AC_CHECK_HEADERS(dwrite.h, have_directwrite=true)
415 if test "x$with_directwrite" = "xyes" -a "x$have_directwrite" != "xtrue"; then
416 AC_MSG_ERROR([directwrite support requested but not found])
418 if $have_directwrite; then
419 DIRECTWRITE_CXXFLAGS=
420 DIRECTWRITE_LIBS="-ldwrite"
421 AC_SUBST(DIRECTWRITE_CXXFLAGS)
422 AC_SUBST(DIRECTWRITE_LIBS)
423 AC_DEFINE(HAVE_DIRECTWRITE, 1, [Have DirectWrite library])
425 AM_CONDITIONAL(HAVE_DIRECTWRITE, $have_directwrite)
427 dnl ===========================================================================
429 AC_ARG_WITH(coretext,
430 [AS_HELP_STRING([--with-coretext=@<:@yes/no/auto@:>@],
431 [Use CoreText @<:@default=no@:>@])],,
434 if test "x$with_coretext" = "xyes" -o "x$with_coretext" = "xauto"; then
435 AC_CHECK_TYPE(CTFontRef, have_coretext=true,, [#include <ApplicationServices/ApplicationServices.h>])
437 if $have_coretext; then
439 CORETEXT_LIBS="-framework ApplicationServices"
440 AC_SUBST(CORETEXT_CFLAGS)
441 AC_SUBST(CORETEXT_LIBS)
443 # On iOS CoreText and CoreGraphics are stand-alone frameworks
444 if test "x$have_coretext" != "xtrue"; then
445 # Check for a different symbol to avoid getting cached result.
446 AC_CHECK_TYPE(CTRunRef, have_coretext=true,, [#include <CoreText/CoreText.h>])
449 if $have_coretext; then
451 CORETEXT_LIBS="-framework CoreText -framework CoreGraphics -framework CoreFoundation"
452 AC_SUBST(CORETEXT_CFLAGS)
453 AC_SUBST(CORETEXT_LIBS)
457 if test "x$with_coretext" = "xyes" -a "x$have_coretext" != "xtrue"; then
458 AC_MSG_ERROR([CoreText support requested but libcoretext not found])
460 if $have_coretext; then
461 AC_DEFINE(HAVE_CORETEXT, 1, [Have Core Text backend])
463 AM_CONDITIONAL(HAVE_CORETEXT, $have_coretext)
465 dnl ===========================================================================
467 AC_CACHE_CHECK([for Intel atomic primitives], hb_cv_have_intel_atomic_primitives, [
468 hb_cv_have_intel_atomic_primitives=false
470 void memory_barrier (void) { __sync_synchronize (); }
471 int atomic_add (int *i) { return __sync_fetch_and_add (i, 1); }
472 int mutex_trylock (int *m) { return __sync_lock_test_and_set (m, 1); }
473 void mutex_unlock (int *m) { __sync_lock_release (m); }
474 ], [], hb_cv_have_intel_atomic_primitives=true
477 if $hb_cv_have_intel_atomic_primitives; then
478 AC_DEFINE(HAVE_INTEL_ATOMIC_PRIMITIVES, 1, [Have Intel __sync_* atomic primitives])
481 dnl ===========================================================================
483 AC_CACHE_CHECK([for Solaris atomic operations], hb_cv_have_solaris_atomic_ops, [
484 hb_cv_have_solaris_atomic_ops=false
487 /* This requires Solaris Studio 12.2 or newer: */
488 #include <mbarrier.h>
489 void memory_barrier (void) { __machine_rw_barrier (); }
490 int atomic_add (volatile unsigned *i) { return atomic_add_int_nv (i, 1); }
491 void *atomic_ptr_cmpxchg (volatile void **target, void *cmp, void *newval) { return atomic_cas_ptr (target, cmp, newval); }
492 ], [], hb_cv_have_solaris_atomic_ops=true
495 if $hb_cv_have_solaris_atomic_ops; then
496 AC_DEFINE(HAVE_SOLARIS_ATOMIC_OPS, 1, [Have Solaris __machine_*_barrier and atomic_* operations])
499 if test "$os_win32" = no && ! $have_pthread; then
500 AC_CHECK_HEADERS(sched.h)
501 AC_SEARCH_LIBS(sched_yield,rt,AC_DEFINE(HAVE_SCHED_YIELD, 1, [Have sched_yield]))
504 dnl ===========================================================================
509 src/harfbuzz-config.cmake
514 test/fuzzing/Makefile
515 test/shaping/Makefile
516 test/shaping/data/Makefile
517 test/shaping/data/in-house/Makefile
518 test/shaping/data/text-rendering-tests/Makefile
520 test/subset/data/Makefile
531 Unicode callbacks (you want at least one):
532 Builtin (UCDN): ${have_ucdn}
536 Font callbacks (the more the merrier):
537 FreeType: ${have_freetype}
539 Tools used for command-line utilities:
541 Fontconfig: ${have_fontconfig}
543 Additional shapers (the more the merrier):
544 Graphite2: ${have_graphite2}
546 Platform shapers (not normally needed):
547 CoreText: ${have_coretext}
548 DirectWrite: ${have_directwrite}
549 Uniscribe: ${have_uniscribe}
552 Documentation: ${enable_gtk_doc}
553 GObject bindings: ${have_gobject}
554 Introspection: ${have_introspection}