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 setlinebuf)
82 AC_CHECK_HEADERS(unistd.h sys/mman.h xlocale.h)
86 AC_CHECK_ALIGNOF([struct{char;}])
87 if test "x$GCC" = "xyes"; then
89 # Make symbols link locally
90 LDFLAGS="$LDFLAGS -Bsymbolic-functions"
93 CXXFLAGS="$CXXFLAGS -Wcast-align"
100 CXXFLAGS="$CXXFLAGS -fvisibility-inlines-hidden"
106 if test "x$ac_cv_alignof_struct_char__" != x1; then
107 # Request byte alignment
108 CXXFLAGS="$CXXFLAGS -mstructure-size-boundary=8"
114 AM_CONDITIONAL(HAVE_GCC, test "x$GCC" = "xyes")
117 AC_MSG_CHECKING([for native Win32])
123 AC_MSG_RESULT([$hb_os_win32])
124 AM_CONDITIONAL(OS_WIN32, test "$hb_os_win32" = "yes")
127 if test "$hb_os_win32" = no; then
128 AX_PTHREAD([have_pthread=true])
130 if $have_pthread; then
131 AC_DEFINE(HAVE_PTHREAD, 1, [Have POSIX threads])
133 AM_CONDITIONAL(HAVE_PTHREAD, $have_pthread)
135 dnl ==========================================================================
139 AC_DEFINE(HAVE_OT, 1, [Have native OpenType Layout backend])
141 AM_CONDITIONAL(HAVE_OT, $have_ot)
144 if $have_fallback; then
145 AC_DEFINE(HAVE_FALLBACK, 1, [Have simple TrueType Layout backend])
147 AM_CONDITIONAL(HAVE_FALLBACK, $have_fallback)
149 dnl ===========================================================================
152 [AS_HELP_STRING([--with-glib=@<:@yes/no/auto@:>@],
153 [Use glib @<:@default=auto@:>@])],,
156 GLIB_DEPS="glib-2.0 >= 2.19.1"
158 if test "x$with_glib" = "xyes" -o "x$with_glib" = "xauto"; then
159 PKG_CHECK_MODULES(GLIB, $GLIB_DEPS, have_glib=true, :)
161 if test "x$with_glib" = "xyes" -a "x$have_glib" != "xtrue"; then
162 AC_MSG_ERROR([glib support requested but glib-2.0 not found])
165 AC_DEFINE(HAVE_GLIB, 1, [Have glib2 library])
167 AM_CONDITIONAL(HAVE_GLIB, $have_glib)
169 dnl ===========================================================================
172 [AS_HELP_STRING([--with-gobject=@<:@yes/no/auto@:>@],
173 [Use gobject @<:@default=no@:>@])],,
176 if test "x$with_gobject" = "xyes" -o "x$with_gobject" = "xauto"; then
177 PKG_CHECK_MODULES(GOBJECT, gobject-2.0 glib-2.0, have_gobject=true, :)
179 if test "x$with_gobject" = "xyes" -a "x$have_gobject" != "xtrue"; then
180 AC_MSG_ERROR([gobject support requested but gobject-2.0 / glib-2.0 not found])
182 if $have_gobject; then
183 AC_DEFINE(HAVE_GOBJECT, 1, [Have gobject2 library])
184 GLIB_MKENUMS=`$PKG_CONFIG --variable=glib_mkenums glib-2.0`
185 AC_SUBST(GLIB_MKENUMS)
187 AM_CONDITIONAL(HAVE_GOBJECT, $have_gobject)
188 AC_SUBST(have_gobject)
190 dnl ===========================================================================
193 dnl ===========================================================================
194 # Gobject-Introspection
195 have_introspection=false
196 m4_ifdef([GOBJECT_INTROSPECTION_CHECK], [
197 if $have_gobject; then
198 GOBJECT_INTROSPECTION_CHECK([1.34.0])
199 if test "x$found_introspection" = xyes; then
200 have_introspection=true
203 AM_CONDITIONAL([HAVE_INTROSPECTION], false)
206 AM_CONDITIONAL([HAVE_INTROSPECTION], false)
209 dnl ==========================================================================
212 [AS_HELP_STRING([--with-cairo=@<:@yes/no/auto@:>@],
213 [Use cairo @<:@default=auto@:>@])],,
216 if test "x$with_cairo" = "xyes" -o "x$with_cairo" = "xauto"; then
217 PKG_CHECK_MODULES(CAIRO, cairo >= 1.8.0, have_cairo=true, :)
219 if test "x$with_cairo" = "xyes" -a "x$have_cairo" != "xtrue"; then
220 AC_MSG_ERROR([cairo support requested but not found])
223 AC_DEFINE(HAVE_CAIRO, 1, [Have cairo graphics library])
225 AM_CONDITIONAL(HAVE_CAIRO, $have_cairo)
229 PKG_CHECK_MODULES(CAIRO_FT, cairo-ft, have_cairo_ft=true, :)
231 if $have_cairo_ft; then
232 AC_DEFINE(HAVE_CAIRO_FT, 1, [Have cairo-ft support in cairo graphics library])
234 AM_CONDITIONAL(HAVE_CAIRO_FT, $have_cairo_ft)
236 dnl ==========================================================================
238 AC_ARG_WITH(fontconfig,
239 [AS_HELP_STRING([--with-fontconfig=@<:@yes/no/auto@:>@],
240 [Use fontconfig @<:@default=auto@:>@])],,
241 [with_fontconfig=auto])
242 have_fontconfig=false
243 if test "x$with_fontconfig" = "xyes" -o "x$with_fontconfig" = "xauto"; then
244 PKG_CHECK_MODULES(FONTCONFIG, fontconfig, have_fontconfig=true, :)
246 if test "x$with_fontconfig" = "xyes" -a "x$have_fontconfig" != "xtrue"; then
247 AC_MSG_ERROR([fontconfig support requested but not found])
249 if $have_fontconfig; then
250 AC_DEFINE(HAVE_FONTCONFIG, 1, [Have fontconfig library])
252 AM_CONDITIONAL(HAVE_FONTCONFIG, $have_fontconfig)
254 dnl ==========================================================================
257 [AS_HELP_STRING([--with-icu=@<:@yes/no/builtin/auto@:>@],
258 [Use ICU @<:@default=auto@:>@])],,
261 if test "x$with_icu" = "xyes" -o "x$with_icu" = "xbuiltin" -o "x$with_icu" = "xauto"; then
262 PKG_CHECK_MODULES(ICU, icu-uc, have_icu=true, :)
264 dnl Fallback to icu-config if ICU pkg-config files could not be found
265 if test "$have_icu" != "true"; then
266 AC_CHECK_TOOL(ICU_CONFIG, icu-config, no)
267 AC_MSG_CHECKING([for ICU by using icu-config fallback])
268 if test "$ICU_CONFIG" != "no" && "$ICU_CONFIG" --version >/dev/null; then
270 # We don't use --cflags as this gives us a lot of things that we don't
271 # necessarily want, like debugging and optimization flags
272 # See man (1) icu-config for more info.
273 ICU_CFLAGS=`$ICU_CONFIG --cppflags`
274 ICU_LIBS=`$ICU_CONFIG --ldflags-searchpath --ldflags-libsonly`
283 if test \( "x$with_icu" = "xyes" -o "x$with_icu" = "xbuiltin" \) -a "x$have_icu" != "xtrue"; then
284 AC_MSG_ERROR([icu support requested but icu-uc not found])
288 CXXFLAGS="$CXXFLAGS `$PKG_CONFIG --variable=CXXFLAGS icu-uc`"
289 AC_DEFINE(HAVE_ICU, 1, [Have ICU library])
290 if test "x$with_icu" = "xbuiltin"; then
291 AC_DEFINE(HAVE_ICU_BUILTIN, 1, [Use hb-icu Unicode callbacks])
294 AM_CONDITIONAL(HAVE_ICU, $have_icu)
295 AM_CONDITIONAL(HAVE_ICU_BUILTIN, $have_icu && test "x$with_icu" = "xbuiltin")
297 dnl ===========================================================================
300 [AS_HELP_STRING([--with-ucdn=@<:@yes/no@:>@],
301 [Use builtin UCDN library @<:@default=yes@:>@])],,
304 if test "x$with_ucdn" = "xyes"; then
308 AC_DEFINE(HAVE_UCDN, 1, [Have UCDN Unicode functions])
310 AM_CONDITIONAL(HAVE_UCDN, $have_ucdn)
312 dnl ==========================================================================
314 AC_ARG_WITH(graphite2,
315 [AS_HELP_STRING([--with-graphite2=@<:@yes/no/auto@:>@],
316 [Use the graphite2 library @<:@default=no@:>@])],,
319 GRAPHITE2_DEPS="graphite2"
320 AC_SUBST(GRAPHITE2_DEPS)
321 if test "x$with_graphite2" = "xyes" -o "x$with_graphite2" = "xauto"; then
322 PKG_CHECK_MODULES(GRAPHITE2, $GRAPHITE2_DEPS, have_graphite2=true, :)
323 if test "x$have_graphite2" != "xtrue"; then
324 # If pkg-config is not available, graphite2 can still be there
325 ac_save_CFLAGS="$CFLAGS"
326 ac_save_CPPFLAGS="$CPPFLAGS"
327 CFLAGS="$CFLAGS $GRAPHITE2_CFLAGS"
328 CPPFLAGS="$CPPFLAGS $GRAPHITE2_CFLAGS"
329 AC_CHECK_HEADER(graphite2/Segment.h, have_graphite2=true, :)
330 CPPFLAGS="$ac_save_CPPFLAGS"
331 CFLAGS="$ac_save_CFLAGS"
334 if test "x$with_graphite2" = "xyes" -a "x$have_graphite2" != "xtrue"; then
335 AC_MSG_ERROR([graphite2 support requested but libgraphite2 not found])
337 if $have_graphite2; then
338 AC_DEFINE(HAVE_GRAPHITE2, 1, [Have Graphite2 library])
340 AM_CONDITIONAL(HAVE_GRAPHITE2, $have_graphite2)
342 dnl ==========================================================================
344 AC_ARG_WITH(freetype,
345 [AS_HELP_STRING([--with-freetype=@<:@yes/no/auto@:>@],
346 [Use the FreeType library @<:@default=auto@:>@])],,
347 [with_freetype=auto])
349 FREETYPE_DEPS="freetype2 >= 12.0.6"
350 AC_SUBST(FREETYPE_DEPS)
351 if test "x$with_freetype" = "xyes" -o "x$with_freetype" = "xauto"; then
352 # See freetype/docs/VERSION.DLL; 12.0.6 means freetype-2.4.2
353 PKG_CHECK_MODULES(FREETYPE, $FREETYPE_DEPS, have_freetype=true, :)
355 if test "x$with_freetype" = "xyes" -a "x$have_freetype" != "xtrue"; then
356 AC_MSG_ERROR([FreeType support requested but libfreetype2 not found])
358 if $have_freetype; then
359 AC_DEFINE(HAVE_FREETYPE, 1, [Have FreeType 2 library])
361 LIBS="$LIBS $FREETYPE_LIBS"
362 AC_CHECK_FUNCS(FT_Get_Var_Blend_Coordinates FT_Set_Var_Blend_Coordinates FT_Done_MM_Var)
365 AM_CONDITIONAL(HAVE_FREETYPE, $have_freetype)
367 dnl ===========================================================================
369 AC_ARG_WITH(uniscribe,
370 [AS_HELP_STRING([--with-uniscribe=@<:@yes/no/auto@:>@],
371 [Use the Uniscribe library @<:@default=no@:>@])],,
374 if test "x$with_uniscribe" = "xyes" -o "x$with_uniscribe" = "xauto"; then
375 AC_CHECK_HEADERS(usp10.h windows.h, have_uniscribe=true)
377 if test "x$with_uniscribe" = "xyes" -a "x$have_uniscribe" != "xtrue"; then
378 AC_MSG_ERROR([uniscribe support requested but not found])
380 if $have_uniscribe; then
382 UNISCRIBE_LIBS="-lusp10 -lgdi32 -lrpcrt4"
383 AC_SUBST(UNISCRIBE_CFLAGS)
384 AC_SUBST(UNISCRIBE_LIBS)
385 AC_DEFINE(HAVE_UNISCRIBE, 1, [Have Uniscribe library])
387 AM_CONDITIONAL(HAVE_UNISCRIBE, $have_uniscribe)
389 dnl ===========================================================================
391 AC_ARG_WITH(directwrite,
392 [AS_HELP_STRING([--with-directwrite=@<:@yes/no/auto@:>@],
393 [Use the DirectWrite library (experimental) @<:@default=no@:>@])],,
394 [with_directwrite=no])
395 have_directwrite=false
397 if test "x$with_directwrite" = "xyes" -o "x$with_directwrite" = "xauto"; then
398 AC_CHECK_HEADERS(dwrite.h, have_directwrite=true)
401 if test "x$with_directwrite" = "xyes" -a "x$have_directwrite" != "xtrue"; then
402 AC_MSG_ERROR([directwrite support requested but not found])
404 if $have_directwrite; then
405 DIRECTWRITE_CXXFLAGS=
406 DIRECTWRITE_LIBS="-ldwrite"
407 AC_SUBST(DIRECTWRITE_CXXFLAGS)
408 AC_SUBST(DIRECTWRITE_LIBS)
409 AC_DEFINE(HAVE_DIRECTWRITE, 1, [Have DirectWrite library])
411 AM_CONDITIONAL(HAVE_DIRECTWRITE, $have_directwrite)
413 dnl ===========================================================================
415 AC_ARG_WITH(coretext,
416 [AS_HELP_STRING([--with-coretext=@<:@yes/no/auto@:>@],
417 [Use CoreText @<:@default=no@:>@])],,
420 if test "x$with_coretext" = "xyes" -o "x$with_coretext" = "xauto"; then
421 AC_CHECK_TYPE(CTFontRef, have_coretext=true,, [#include <ApplicationServices/ApplicationServices.h>])
423 if $have_coretext; then
425 CORETEXT_LIBS="-framework ApplicationServices"
426 AC_SUBST(CORETEXT_CFLAGS)
427 AC_SUBST(CORETEXT_LIBS)
429 # On iOS CoreText and CoreGraphics are stand-alone frameworks
430 if test "x$have_coretext" != "xtrue"; then
431 # Check for a different symbol to avoid getting cached result.
432 AC_CHECK_TYPE(CTRunRef, have_coretext=true,, [#include <CoreText/CoreText.h>])
435 if $have_coretext; then
437 CORETEXT_LIBS="-framework CoreText -framework CoreGraphics -framework CoreFoundation"
438 AC_SUBST(CORETEXT_CFLAGS)
439 AC_SUBST(CORETEXT_LIBS)
443 if test "x$with_coretext" = "xyes" -a "x$have_coretext" != "xtrue"; then
444 AC_MSG_ERROR([CoreText support requested but libcoretext not found])
446 if $have_coretext; then
447 AC_DEFINE(HAVE_CORETEXT, 1, [Have Core Text backend])
449 AM_CONDITIONAL(HAVE_CORETEXT, $have_coretext)
451 dnl ===========================================================================
453 AC_CACHE_CHECK([for Intel atomic primitives], hb_cv_have_intel_atomic_primitives, [
454 hb_cv_have_intel_atomic_primitives=false
456 void memory_barrier (void) { __sync_synchronize (); }
457 int atomic_add (int *i) { return __sync_fetch_and_add (i, 1); }
458 int mutex_trylock (int *m) { return __sync_lock_test_and_set (m, 1); }
459 void mutex_unlock (int *m) { __sync_lock_release (m); }
460 ], [], hb_cv_have_intel_atomic_primitives=true
463 if $hb_cv_have_intel_atomic_primitives; then
464 AC_DEFINE(HAVE_INTEL_ATOMIC_PRIMITIVES, 1, [Have Intel __sync_* atomic primitives])
467 dnl ===========================================================================
469 AC_CACHE_CHECK([for Solaris atomic operations], hb_cv_have_solaris_atomic_ops, [
470 hb_cv_have_solaris_atomic_ops=false
473 /* This requires Solaris Studio 12.2 or newer: */
474 #include <mbarrier.h>
475 void memory_barrier (void) { __machine_rw_barrier (); }
476 int atomic_add (volatile unsigned *i) { return atomic_add_int_nv (i, 1); }
477 void *atomic_ptr_cmpxchg (volatile void **target, void *cmp, void *newval) { return atomic_cas_ptr (target, cmp, newval); }
478 ], [], hb_cv_have_solaris_atomic_ops=true
481 if $hb_cv_have_solaris_atomic_ops; then
482 AC_DEFINE(HAVE_SOLARIS_ATOMIC_OPS, 1, [Have Solaris __machine_*_barrier and atomic_* operations])
485 if test "$os_win32" = no && ! $have_pthread; then
486 AC_CHECK_HEADERS(sched.h)
487 AC_SEARCH_LIBS(sched_yield,rt,AC_DEFINE(HAVE_SCHED_YIELD, 1, [Have sched_yield]))
490 dnl ===========================================================================
496 src/harfbuzz-config.cmake
501 test/fuzzing/Makefile
502 test/shaping/Makefile
503 test/shaping/data/Makefile
504 test/shaping/data/in-house/Makefile
505 test/shaping/data/text-rendering-tests/Makefile
507 test/subset/data/Makefile
518 Unicode callbacks (you want at least one):
519 Builtin (UCDN): ${have_ucdn}
523 Font callbacks (the more the merrier):
524 FreeType: ${have_freetype}
526 Tools used for command-line utilities:
528 Fontconfig: ${have_fontconfig}
530 Additional shapers (the more the merrier):
531 Graphite2: ${have_graphite2}
533 Platform shapers (not normally needed):
534 CoreText: ${have_coretext}
535 Uniscribe: ${have_uniscribe}
536 DirectWrite: ${have_directwrite}
539 Documentation: ${enable_gtk_doc}
540 GObject bindings: ${have_gobject}
541 Introspection: ${have_introspection}