4 [http://bugs.freedesktop.org/enter_bug.cgi?product=harfbuzz],
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.11.1 gnits tar-pax dist-bzip2 no-dist-gzip -Wall no-define color-tests -Wno-portability])
13 AM_CONDITIONAL(AUTOMAKE_OLDER_THAN_1_13, test $am__api_version = 1.11 -o $am__api_version = 1.12)
14 AM_SILENT_RULES([yes])
17 m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
19 LT_INIT([disable-static])
25 PKG_PROG_PKG_CONFIG([0.20])
26 AM_MISSING_PROG([RAGEL], [ragel])
27 AM_MISSING_PROG([GIT], [git])
30 m4_define(hb_version_triplet,m4_split(AC_PACKAGE_VERSION,[[.]]))
31 m4_define(hb_version_major,m4_argn(1,hb_version_triplet))
32 m4_define(hb_version_minor,m4_argn(2,hb_version_triplet))
33 m4_define(hb_version_micro,m4_argn(3,hb_version_triplet))
34 HB_VERSION_MAJOR=hb_version_major
35 HB_VERSION_MINOR=hb_version_minor
36 HB_VERSION_MICRO=hb_version_micro
37 HB_VERSION=AC_PACKAGE_VERSION
38 AC_SUBST(HB_VERSION_MAJOR)
39 AC_SUBST(HB_VERSION_MINOR)
40 AC_SUBST(HB_VERSION_MICRO)
44 m4_define([hb_version_int],
45 m4_eval(hb_version_major*10000 + hb_version_minor*100 + hb_version_micro))
46 m4_if(m4_eval(hb_version_minor % 2), [1],
47 dnl for unstable releases
48 [m4_define([hb_libtool_revision], 0)],
49 dnl for stable releases
50 [m4_define([hb_libtool_revision], hb_version_micro)])
51 m4_define([hb_libtool_age],
52 m4_eval(hb_version_int - hb_libtool_revision))
53 m4_define([hb_libtool_current],
54 m4_eval(hb_version_major + hb_libtool_age))
55 HB_LIBTOOL_VERSION_INFO=hb_libtool_current:hb_libtool_revision:hb_libtool_age
56 AC_SUBST(HB_LIBTOOL_VERSION_INFO)
60 m4_ifdef([GTK_DOC_CHECK], [
61 GTK_DOC_CHECK([1.15],[--flavour no-tmpl])
62 if test "x$enable_gtk_doc" = xyes; then
66 AM_CONDITIONAL([ENABLE_GTK_DOC], false)
69 # Functions and headers
70 AC_CHECK_FUNCS(atexit mprotect sysconf getpagesize mmap isatty)
71 AC_CHECK_HEADERS(unistd.h sys/mman.h)
75 AC_CHECK_ALIGNOF([struct{char;}])
76 if test "x$GCC" = "xyes"; then
78 # Make symbols link locally
79 LDFLAGS="$LDFLAGS -Bsymbolic-functions"
81 # Make sure we don't link to libstdc++
82 CXXFLAGS="$CXXFLAGS -fno-rtti -fno-exceptions"
85 CXXFLAGS="$CXXFLAGS -Wcast-align"
92 CXXFLAGS="$CXXFLAGS -fvisibility-inlines-hidden"
98 if test "x$ac_cv_alignof_struct_char__" != x1; then
99 # Request byte alignment
100 CXXFLAGS="$CXXFLAGS -mstructure-size-boundary=8"
106 AM_CONDITIONAL(HAVE_GCC, test "x$GCC" = "xyes")
109 AC_MSG_CHECKING([for native Win32])
115 AC_MSG_RESULT([$hb_os_win32])
116 AM_CONDITIONAL(OS_WIN32, test "$hb_os_win32" = "yes")
119 if test "$hb_os_win32" = no; then
120 AX_PTHREAD([have_pthread=true])
122 if $have_pthread; then
123 AC_DEFINE(HAVE_PTHREAD, 1, [Have POSIX threads])
125 AM_CONDITIONAL(HAVE_PTHREAD, $have_pthread)
127 dnl ==========================================================================
131 AC_DEFINE(HAVE_OT, 1, [Have native OpenType Layout backend])
133 AM_CONDITIONAL(HAVE_OT, $have_ot)
136 if $have_fallback; then
137 AC_DEFINE(HAVE_FALLBACK, 1, [Have simple TrueType Layout backend])
139 AM_CONDITIONAL(HAVE_FALLBACK, $have_fallback)
141 dnl ===========================================================================
144 [AS_HELP_STRING([--with-glib=@<:@yes/no/auto@:>@],
145 [Use glib @<:@default=auto@:>@])],,
148 if test "x$with_glib" = "xyes" -o "x$with_glib" = "xauto"; then
149 PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.16, have_glib=true, :)
151 if test "x$with_glib" = "xyes" -a "x$have_glib" != "xtrue"; then
152 AC_MSG_ERROR([glib support requested but glib-2.0 not found])
155 AC_DEFINE(HAVE_GLIB, 1, [Have glib2 library])
157 AM_CONDITIONAL(HAVE_GLIB, $have_glib)
159 dnl ===========================================================================
162 [AS_HELP_STRING([--with-gobject=@<:@yes/no/auto@:>@],
163 [Use gobject @<:@default=auto@:>@])],,
166 if test "x$with_gobject" = "xyes" -o "x$with_gobject" = "xauto"; then
167 PKG_CHECK_MODULES(GOBJECT, gobject-2.0 glib-2.0, have_gobject=true, :)
169 if test "x$with_gobject" = "xyes" -a "x$have_gobject" != "xtrue"; then
170 AC_MSG_ERROR([gobject support requested but gobject-2.0 / glib-2.0 not found])
172 if $have_gobject; then
173 AC_DEFINE(HAVE_GOBJECT, 1, [Have gobject2 library])
174 GLIB_MKENUMS=`$PKG_CONFIG --variable=glib_mkenums glib-2.0`
175 AC_SUBST(GLIB_MKENUMS)
177 AM_CONDITIONAL(HAVE_GOBJECT, $have_gobject)
179 dnl ===========================================================================
182 dnl ===========================================================================
183 # Gobject-Introspection
184 have_introspection=false
185 m4_ifdef([GOBJECT_INTROSPECTION_CHECK], [
186 if $have_gobject; then
187 GOBJECT_INTROSPECTION_CHECK([1.34.0])
188 if test "x$found_introspection" = xyes; then
189 have_introspection=true
192 AM_CONDITIONAL([HAVE_INTROSPECTION], false)
195 AM_CONDITIONAL([HAVE_INTROSPECTION], false)
198 dnl ===========================================================================
205 AC_DEFINE(HAVE_UCDN, 1, [Have UCDN Unicode functions])
207 AM_CONDITIONAL(HAVE_UCDN, $have_ucdn)
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 ==========================================================================
239 [AS_HELP_STRING([--with-icu=@<:@yes/no/auto@:>@],
240 [Use ICU @<:@default=auto@:>@])],,
243 if test "x$with_icu" = "xyes" -o "x$with_icu" = "xauto"; then
244 PKG_CHECK_MODULES(ICU, icu-uc, have_icu=true, :)
246 dnl Fallback to icu-config if ICU pkg-config files could not be found
247 if test "$have_icu" != "true"; then
248 AC_CHECK_TOOL(ICU_CONFIG, icu-config, no)
249 AC_MSG_CHECKING([for ICU by using icu-config fallback])
250 if test "$ICU_CONFIG" != "no" && "$ICU_CONFIG" --version >/dev/null; then
252 # We don't use --cflags as this gives us a lot of things that we don't
253 # necessarily want, like debugging and optimization flags
254 # See man (1) icu-config for more info.
255 ICU_CFLAGS=`$ICU_CONFIG --cppflags`
256 ICU_LIBS=`$ICU_CONFIG --ldflags-searchpath --ldflags-libsonly`
265 if test "x$with_icu" = "xyes" -a "x$have_icu" != "xtrue"; then
266 AC_MSG_ERROR([icu support requested but icu-uc not found])
269 CXXFLAGS="$CXXFLAGS `$PKG_CONFIG --variable=CXXFLAGS icu-uc`"
270 AC_DEFINE(HAVE_ICU, 1, [Have ICU library])
272 AM_CONDITIONAL(HAVE_ICU, $have_icu)
274 dnl ==========================================================================
276 AC_ARG_WITH(graphite2,
277 [AS_HELP_STRING([--with-graphite2=@<:@yes/no/auto@:>@],
278 [Use the graphite2 library @<:@default=no@:>@])],,
281 if test "x$with_graphite2" = "xyes" -o "x$with_graphite2" = "xauto"; then
282 PKG_CHECK_MODULES(GRAPHITE2, graphite2, have_graphite2=true, :)
284 if test "x$with_graphite2" = "xyes" -a "x$have_graphite2" != "xtrue"; then
285 AC_MSG_ERROR([graphite2 support requested but libgraphite2 not found])
287 if $have_graphite2; then
288 AC_DEFINE(HAVE_GRAPHITE2, 1, [Have Graphite2 library])
290 AM_CONDITIONAL(HAVE_GRAPHITE2, $have_graphite2)
292 dnl ==========================================================================
294 AC_ARG_WITH(freetype,
295 [AS_HELP_STRING([--with-freetype=@<:@yes/no/auto@:>@],
296 [Use the FreeType library @<:@default=auto@:>@])],,
297 [with_freetype=auto])
299 if test "x$with_freetype" = "xyes" -o "x$with_freetype" = "xauto"; then
300 # See freetype/docs/VERSION.DLL; 12.0.6 means freetype-2.4.2
301 PKG_CHECK_MODULES(FREETYPE, freetype2 >= 12.0.6, have_freetype=true, :)
303 if test "x$with_freetype" = "xyes" -a "x$have_freetype" != "xtrue"; then
304 AC_MSG_ERROR([FreeType support requested but libfreetype2 not found])
306 if $have_freetype; then
307 AC_DEFINE(HAVE_FREETYPE, 1, [Have FreeType 2 library])
309 AM_CONDITIONAL(HAVE_FREETYPE, $have_freetype)
311 dnl ===========================================================================
313 AC_ARG_WITH(uniscribe,
314 [AS_HELP_STRING([--with-uniscribe=@<:@yes/no/auto@:>@],
315 [Use the Uniscribe library @<:@default=no@:>@])],,
318 if test "x$with_uniscribe" = "xyes" -o "x$with_uniscribe" = "xauto"; then
319 AC_CHECK_HEADERS(usp10.h windows.h, have_uniscribe=true)
321 if test "x$with_uniscribe" = "xyes" -a "x$have_uniscribe" != "xtrue"; then
322 AC_MSG_ERROR([uniscribe support requested but not found])
324 if $have_uniscribe; then
326 UNISCRIBE_LIBS="-lusp10 -lgdi32 -lrpcrt4"
327 AC_SUBST(UNISCRIBE_CFLAGS)
328 AC_SUBST(UNISCRIBE_LIBS)
329 AC_DEFINE(HAVE_UNISCRIBE, 1, [Have Uniscribe library])
331 AM_CONDITIONAL(HAVE_UNISCRIBE, $have_uniscribe)
333 dnl ===========================================================================
335 AC_ARG_WITH(coretext,
336 [AS_HELP_STRING([--with-coretext=@<:@yes/no/auto@:>@],
337 [Use CoreText @<:@default=no@:>@])],,
340 if test "x$with_coretext" = "xyes" -o "x$with_coretext" = "xauto"; then
341 AC_CHECK_TYPE(CTFontRef, have_coretext=true,, [#include <ApplicationServices/ApplicationServices.h>])
343 if $have_coretext; then
345 CORETEXT_LIBS="-framework ApplicationServices"
346 AC_SUBST(CORETEXT_CFLAGS)
347 AC_SUBST(CORETEXT_LIBS)
349 # On iOS CoreText and CoreGraphics are stand-alone frameworks
350 if test "x$have_coretext" != "xtrue"; then
351 AC_CHECK_TYPE(CTFontRef, have_coretext=true,, [#include <CoreText/CoreText.h>])
354 if $have_coretext; then
356 CORETEXT_LIBS="-framework CoreText -framework CoreGraphics"
357 AC_SUBST(CORETEXT_CFLAGS)
358 AC_SUBST(CORETEXT_LIBS)
362 if test "x$with_coretext" = "xyes" -a "x$have_coretext" != "xtrue"; then
363 AC_MSG_ERROR([CoreText support requested but libcoretext not found])
365 if $have_coretext; then
366 AC_DEFINE(HAVE_CORETEXT, 1, [Have Core Text backend])
368 AM_CONDITIONAL(HAVE_CORETEXT, $have_coretext)
370 dnl ===========================================================================
372 AC_CACHE_CHECK([for Intel atomic primitives], hb_cv_have_intel_atomic_primitives, [
373 hb_cv_have_intel_atomic_primitives=false
375 void memory_barrier (void) { __sync_synchronize (); }
376 int atomic_add (int *i) { return __sync_fetch_and_add (i, 1); }
377 int mutex_trylock (int *m) { return __sync_lock_test_and_set (m, 1); }
378 void mutex_unlock (int *m) { __sync_lock_release (m); }
379 ], [], hb_cv_have_intel_atomic_primitives=true
382 if $hb_cv_have_intel_atomic_primitives; then
383 AC_DEFINE(HAVE_INTEL_ATOMIC_PRIMITIVES, 1, [Have Intel __sync_* atomic primitives])
386 dnl ===========================================================================
388 AC_CACHE_CHECK([for Solaris atomic operations], hb_cv_have_solaris_atomic_ops, [
389 hb_cv_have_solaris_atomic_ops=false
392 /* This requires Solaris Studio 12.2 or newer: */
393 #include <mbarrier.h>
394 void memory_barrier (void) { __machine_rw_barrier (); }
395 int atomic_add (volatile unsigned *i) { return atomic_add_int_nv (i, 1); }
396 void *atomic_ptr_cmpxchg (volatile void **target, void *cmp, void *newval) { return atomic_cas_ptr (target, cmp, newval); }
397 ], [], hb_cv_have_solaris_atomic_ops=true
400 if $hb_cv_have_solaris_atomic_ops; then
401 AC_DEFINE(HAVE_SOLARIS_ATOMIC_OPS, 1, [Have Solaris __machine_*_barrier and atomic_* operations])
404 if test "$os_win32" = no && ! $have_pthread; then
405 AC_CHECK_HEADERS(sched.h)
406 AC_SEARCH_LIBS(sched_yield,rt,AC_DEFINE(HAVE_SCHED_YIELD, 1, [Have sched_yield]))
409 dnl ===========================================================================
419 test/shaping/Makefile
421 docs/reference/Makefile
422 docs/reference/version.xml
431 Unicode callbacks (you want at least one):
436 Font callbacks (the more the better):
437 FreeType: ${have_freetype}
439 Tools used for command-line utilities:
442 Additional shapers (the more the better):
443 Graphite2: ${have_graphite2}
445 Platform shapers (not normally needed):
446 CoreText: ${have_coretext}
447 Uniscribe: ${have_uniscribe}
450 Documentation: ${have_gtk_doc}
451 GObject bindings: ${have_gobject}
452 Introspection: ${have_introspection}