blob: 3e42d95b4b982a5d5be7777ddbcd6baa647b9269 [file] [log] [blame]
Javier Jardón2abe1262011-01-09 22:18:53 -05001AC_PREREQ([2.64])
Behdad Esfahbod8c5f5e62012-06-17 14:58:59 -04002AC_INIT([HarfBuzz],
Behdad Esfahbod28f5e0b2015-01-23 12:45:35 -08003 [0.9.38],
Javier Jardón2abe1262011-01-09 22:18:53 -05004 [http://bugs.freedesktop.org/enter_bug.cgi?product=harfbuzz],
5 [harfbuzz],
Behdad Esfahbod5b21eff2011-05-25 14:49:35 -04006 [http://harfbuzz.org/])
Javier Jardón2abe1262011-01-09 22:18:53 -05007
Behdad Esfahbodc7afac02012-10-02 14:44:47 -04008AC_CONFIG_MACRO_DIR([m4])
Behdad Esfahbod22ce0962013-05-28 17:18:30 -04009AC_CONFIG_SRCDIR([src/harfbuzz.pc.in])
Behdad Esfahbod29aa4002009-11-02 16:28:39 -050010AC_CONFIG_HEADERS([config.h])
Behdad Esfahbod29aa4002009-11-02 16:28:39 -050011
Behdad Esfahbod2646aec2013-12-05 18:19:35 -050012AM_INIT_AUTOMAKE([1.11.1 gnits tar-pax dist-bzip2 no-dist-gzip -Wall no-define color-tests -Wno-portability])
13AM_CONDITIONAL(AUTOMAKE_OLDER_THAN_1_13, test $am__api_version = 1.11 -o $am__api_version = 1.12)
Javier Jardón2abe1262011-01-09 22:18:53 -050014AM_SILENT_RULES([yes])
15
Behdad Esfahbodc62e41b2012-01-27 02:20:58 -050016# Initialize libtool
Behdad Esfahbod03adf382013-04-29 13:40:52 -040017m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
Behdad Esfahbodc62e41b2012-01-27 02:20:58 -050018LT_PREREQ([2.2])
19LT_INIT([disable-static])
20
Javier Jardón2abe1262011-01-09 22:18:53 -050021# Check for programs
Behdad Esfahbod29aa4002009-11-02 16:28:39 -050022AC_PROG_CC
Behdad Esfahbod01098162010-10-05 18:36:45 -040023AM_PROG_CC_C_O
Behdad Esfahbod29aa4002009-11-02 16:28:39 -050024AC_PROG_CXX
Behdad Esfahbodc7afac02012-10-02 14:44:47 -040025PKG_PROG_PKG_CONFIG([0.20])
Behdad Esfahbodbb8ffb52014-03-04 13:03:51 -080026AM_MISSING_PROG([RAGEL], [ragel])
27AM_MISSING_PROG([GIT], [git])
Behdad Esfahbod29aa4002009-11-02 16:28:39 -050028
Behdad Esfahbodc78f4482011-05-05 21:31:04 -040029# Version
Behdad Esfahbod329c1572011-05-25 16:07:07 -040030m4_define(hb_version_triplet,m4_split(AC_PACKAGE_VERSION,[[.]]))
31m4_define(hb_version_major,m4_argn(1,hb_version_triplet))
32m4_define(hb_version_minor,m4_argn(2,hb_version_triplet))
33m4_define(hb_version_micro,m4_argn(3,hb_version_triplet))
34HB_VERSION_MAJOR=hb_version_major
35HB_VERSION_MINOR=hb_version_minor
36HB_VERSION_MICRO=hb_version_micro
Behdad Esfahbodc78f4482011-05-05 21:31:04 -040037HB_VERSION=AC_PACKAGE_VERSION
Behdad Esfahbodc78f4482011-05-05 21:31:04 -040038AC_SUBST(HB_VERSION_MAJOR)
39AC_SUBST(HB_VERSION_MINOR)
40AC_SUBST(HB_VERSION_MICRO)
41AC_SUBST(HB_VERSION)
42
Behdad Esfahbod329c1572011-05-25 16:07:07 -040043# Libtool version
44m4_define([hb_version_int],
45 m4_eval(hb_version_major*10000 + hb_version_minor*100 + hb_version_micro))
46m4_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)])
51m4_define([hb_libtool_age],
52 m4_eval(hb_version_int - hb_libtool_revision))
53m4_define([hb_libtool_current],
54 m4_eval(hb_version_major + hb_libtool_age))
55HB_LIBTOOL_VERSION_INFO=hb_libtool_current:hb_libtool_revision:hb_libtool_age
56AC_SUBST(HB_LIBTOOL_VERSION_INFO)
Behdad Esfahbodc78f4482011-05-05 21:31:04 -040057
Behdad Esfahbod71ef22b2013-08-28 12:52:55 -040058# Documentation
59have_gtk_doc=false
60m4_ifdef([GTK_DOC_CHECK], [
Behdad Esfahbod79d754e2013-08-28 13:43:35 -040061GTK_DOC_CHECK([1.15],[--flavour no-tmpl])
Behdad Esfahbod71ef22b2013-08-28 12:52:55 -040062 if test "x$enable_gtk_doc" = xyes; then
63 have_gtk_doc=true
64 fi
65], [
66 AM_CONDITIONAL([ENABLE_GTK_DOC], false)
67])
Behdad Esfahbodb9b10ad2011-09-13 13:30:39 -040068
Behdad Esfahbod174e3fe2011-05-05 19:37:53 -040069# Functions and headers
Behdad Esfahbode2aab4b2013-02-12 15:35:32 -050070AC_CHECK_FUNCS(atexit mprotect sysconf getpagesize mmap isatty)
71AC_CHECK_HEADERS(unistd.h sys/mman.h)
Behdad Esfahbod29aa4002009-11-02 16:28:39 -050072
Behdad Esfahbod174e3fe2011-05-05 19:37:53 -040073# Compiler flags
Behdad Esfahbodc78f4482011-05-05 21:31:04 -040074AC_CANONICAL_HOST
Behdad Esfahbod824d00d2014-06-09 14:17:33 -040075AC_CHECK_ALIGNOF([struct{char;}])
Behdad Esfahbod29aa4002009-11-02 16:28:39 -050076if test "x$GCC" = "xyes"; then
Behdad Esfahbod5b7f3892011-04-27 15:10:12 -040077
Behdad Esfahbod71cef142011-05-06 19:30:59 -040078 # Make symbols link locally
79 LDFLAGS="$LDFLAGS -Bsymbolic-functions"
80
Behdad Esfahbod5b7f3892011-04-27 15:10:12 -040081 # Make sure we don't link to libstdc++
Behdad Esfahbod29aa4002009-11-02 16:28:39 -050082 CXXFLAGS="$CXXFLAGS -fno-rtti -fno-exceptions"
Behdad Esfahbod5b7f3892011-04-27 15:10:12 -040083
Behdad Esfahbod11c4ad42012-07-13 11:29:31 -040084 # Assorted warnings
85 CXXFLAGS="$CXXFLAGS -Wcast-align"
86
Behdad Esfahbod5b7f3892011-04-27 15:10:12 -040087 case "$host" in
Behdad Esfahbod560d68a2012-08-08 17:16:01 -040088 *-*-mingw*)
Behdad Esfahbode3320ec2012-08-06 11:44:10 -070089 ;;
90 *)
91 # Hide inline methods
92 CXXFLAGS="$CXXFLAGS -fvisibility-inlines-hidden"
93 ;;
94 esac
95
96 case "$host" in
Behdad Esfahbod5b7f3892011-04-27 15:10:12 -040097 arm-*-*)
Behdad Esfahbod824d00d2014-06-09 14:17:33 -040098 if test "x$ac_cv_alignof_struct_char__" != x1; then
Behdad Esfahbod3f38c112014-06-06 16:03:40 -040099 # Request byte alignment
100 CXXFLAGS="$CXXFLAGS -mstructure-size-boundary=8"
101 fi
Behdad Esfahbod5b7f3892011-04-27 15:10:12 -0400102 ;;
103 esac
Behdad Esfahbod29aa4002009-11-02 16:28:39 -0500104fi
105
Behdad Esfahbode7846322013-01-14 00:27:21 -0600106AM_CONDITIONAL(HAVE_GCC, test "x$GCC" = "xyes")
107
Behdad Esfahbod0e292eb2012-10-02 14:59:00 -0400108hb_os_win32=no
Behdad Esfahbod560d68a2012-08-08 17:16:01 -0400109AC_MSG_CHECKING([for native Win32])
110case "$host" in
111 *-*-mingw*)
112 hb_os_win32=yes
113 ;;
Behdad Esfahbod560d68a2012-08-08 17:16:01 -0400114esac
115AC_MSG_RESULT([$hb_os_win32])
116AM_CONDITIONAL(OS_WIN32, test "$hb_os_win32" = "yes")
117
Behdad Esfahbod66efe892012-10-02 14:55:32 -0400118have_pthread=false
Behdad Esfahbod0e292eb2012-10-02 14:59:00 -0400119if test "$hb_os_win32" = no; then
120 AX_PTHREAD([have_pthread=true])
121fi
Behdad Esfahbod66efe892012-10-02 14:55:32 -0400122if $have_pthread; then
123 AC_DEFINE(HAVE_PTHREAD, 1, [Have POSIX threads])
124fi
125AM_CONDITIONAL(HAVE_PTHREAD, $have_pthread)
126
Behdad Esfahbod29aa4002009-11-02 16:28:39 -0500127dnl ==========================================================================
128
Behdad Esfahbod68c75b42012-06-05 19:55:46 -0400129have_ot=true
130if $have_ot; then
131 AC_DEFINE(HAVE_OT, 1, [Have native OpenType Layout backend])
132fi
133AM_CONDITIONAL(HAVE_OT, $have_ot)
134
Konstantin Rittc9522de2014-01-22 21:07:13 +0200135have_fallback=true
136if $have_fallback; then
137 AC_DEFINE(HAVE_FALLBACK, 1, [Have simple TrueType Layout backend])
138fi
139AM_CONDITIONAL(HAVE_FALLBACK, $have_fallback)
140
Behdad Esfahbod68c75b42012-06-05 19:55:46 -0400141dnl ===========================================================================
142
Behdad Esfahbodab2af172013-05-27 19:27:43 -0400143AC_ARG_WITH(glib,
144 [AS_HELP_STRING([--with-glib=@<:@yes/no/auto@:>@],
Behdad Esfahbod5e25eb72013-05-27 19:30:48 -0400145 [Use glib @<:@default=auto@:>@])],,
146 [with_glib=auto])
Behdad Esfahbodab2af172013-05-27 19:27:43 -0400147have_glib=false
148if test "x$with_glib" = "xyes" -o "x$with_glib" = "xauto"; then
Behdad Esfahbod270cfd72013-06-06 18:57:15 -0400149 PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.16, have_glib=true, :)
Behdad Esfahbodab2af172013-05-27 19:27:43 -0400150fi
151if test "x$with_glib" = "xyes" -a "x$have_glib" != "xtrue"; then
152 AC_MSG_ERROR([glib support requested but glib-2.0 not found])
153fi
Behdad Esfahbodf94cf6b2009-11-02 18:55:19 -0500154if $have_glib; then
Behdad Esfahbodd94647e2009-11-03 16:35:10 -0500155 AC_DEFINE(HAVE_GLIB, 1, [Have glib2 library])
Behdad Esfahbodf94cf6b2009-11-02 18:55:19 -0500156fi
Behdad Esfahbod29aa4002009-11-02 16:28:39 -0500157AM_CONDITIONAL(HAVE_GLIB, $have_glib)
158
Behdad Esfahbod71ef22b2013-08-28 12:52:55 -0400159dnl ===========================================================================
160
Behdad Esfahbod71439a82013-08-26 20:56:58 -0400161AC_ARG_WITH(gobject,
162 [AS_HELP_STRING([--with-gobject=@<:@yes/no/auto@:>@],
163 [Use gobject @<:@default=auto@:>@])],,
Behdad Esfahbod71ef22b2013-08-28 12:52:55 -0400164 [with_gobject=no])
Behdad Esfahbodab2af172013-05-27 19:27:43 -0400165have_gobject=false
Behdad Esfahbod71439a82013-08-26 20:56:58 -0400166if 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, :)
168fi
169if 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])
Behdad Esfahbodab2af172013-05-27 19:27:43 -0400171fi
Behdad Esfahbodc214cff2011-08-14 15:17:16 +0200172if $have_gobject; then
173 AC_DEFINE(HAVE_GOBJECT, 1, [Have gobject2 library])
Behdad Esfahbodd75333f2011-08-19 19:59:24 +0200174 GLIB_MKENUMS=`$PKG_CONFIG --variable=glib_mkenums glib-2.0`
175 AC_SUBST(GLIB_MKENUMS)
Behdad Esfahbodc214cff2011-08-14 15:17:16 +0200176fi
177AM_CONDITIONAL(HAVE_GOBJECT, $have_gobject)
178
Behdad Esfahbodca653262013-05-27 19:09:50 -0400179dnl ===========================================================================
180
Behdad Esfahbod71ef22b2013-08-28 12:52:55 -0400181
182dnl ===========================================================================
183# Gobject-Introspection
184have_introspection=false
185m4_ifdef([GOBJECT_INTROSPECTION_CHECK], [
186 if $have_gobject; then
Behdad Esfahbod50a00532014-04-10 16:03:29 -0700187 GOBJECT_INTROSPECTION_CHECK([1.34.0])
Behdad Esfahbod71ef22b2013-08-28 12:52:55 -0400188 if test "x$found_introspection" = xyes; then
189 have_introspection=true
190 fi
191 else
192 AM_CONDITIONAL([HAVE_INTROSPECTION], false)
193 fi
194], [
195 AM_CONDITIONAL([HAVE_INTROSPECTION], false)
196])
197
198dnl ===========================================================================
199
Behdad Esfahbodca653262013-05-27 19:09:50 -0400200have_ucdn=true
Behdad Esfahbod58db2c22013-05-27 19:10:33 -0400201if $have_glib; then
202 have_ucdn=false
203fi
Behdad Esfahbodca653262013-05-27 19:09:50 -0400204if $have_ucdn; then
205 AC_DEFINE(HAVE_UCDN, 1, [Have UCDN Unicode functions])
206fi
207AM_CONDITIONAL(HAVE_UCDN, $have_ucdn)
208
Behdad Esfahbod174e3fe2011-05-05 19:37:53 -0400209dnl ==========================================================================
210
Behdad Esfahbodf8087ff2013-05-27 19:43:48 -0400211AC_ARG_WITH(cairo,
212 [AS_HELP_STRING([--with-cairo=@<:@yes/no/auto@:>@],
213 [Use cairo @<:@default=auto@:>@])],,
214 [with_cairo=auto])
215have_cairo=false
216if test "x$with_cairo" = "xyes" -o "x$with_cairo" = "xauto"; then
Behdad Esfahbod270cfd72013-06-06 18:57:15 -0400217 PKG_CHECK_MODULES(CAIRO, cairo >= 1.8.0, have_cairo=true, :)
Behdad Esfahbodf8087ff2013-05-27 19:43:48 -0400218fi
219if test "x$with_cairo" = "xyes" -a "x$have_cairo" != "xtrue"; then
220 AC_MSG_ERROR([cairo support requested but not found])
221fi
Behdad Esfahbod5353bf42011-02-22 18:06:19 -0500222if $have_cairo; then
223 AC_DEFINE(HAVE_CAIRO, 1, [Have cairo graphics library])
224fi
225AM_CONDITIONAL(HAVE_CAIRO, $have_cairo)
226
Behdad Esfahbodf8087ff2013-05-27 19:43:48 -0400227have_cairo_ft=false
228if $have_cairo; then
Behdad Esfahbod270cfd72013-06-06 18:57:15 -0400229 PKG_CHECK_MODULES(CAIRO_FT, cairo-ft, have_cairo_ft=true, :)
Behdad Esfahbodf8087ff2013-05-27 19:43:48 -0400230fi
Behdad Esfahbod5353bf42011-02-22 18:06:19 -0500231if $have_cairo_ft; then
232 AC_DEFINE(HAVE_CAIRO_FT, 1, [Have cairo-ft support in cairo graphics library])
233fi
234AM_CONDITIONAL(HAVE_CAIRO_FT, $have_cairo_ft)
235
Behdad Esfahbod174e3fe2011-05-05 19:37:53 -0400236dnl ==========================================================================
237
Behdad Esfahbod932b7472013-05-27 19:04:40 -0400238AC_ARG_WITH(icu,
239 [AS_HELP_STRING([--with-icu=@<:@yes/no/auto@:>@],
240 [Use ICU @<:@default=auto@:>@])],,
241 [with_icu=auto])
242have_icu=false
243if test "x$with_icu" = "xyes" -o "x$with_icu" = "xauto"; then
Behdad Esfahbod570bccc2013-06-10 13:56:51 -0400244 PKG_CHECK_MODULES(ICU, icu-uc, have_icu=true, :)
Behdad Esfahbod932b7472013-05-27 19:04:40 -0400245
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
251 have_icu=true
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`
257 AC_SUBST(ICU_CFLAGS)
258 AC_SUBST(ICU_LIBS)
259 AC_MSG_RESULT([yes])
260 else
261 AC_MSG_RESULT([no])
262 fi
Behdad Esfahbod14cfab52013-03-11 19:53:44 -0400263 fi
264fi
Behdad Esfahbod932b7472013-05-27 19:04:40 -0400265if test "x$with_icu" = "xyes" -a "x$have_icu" != "xtrue"; then
266 AC_MSG_ERROR([icu support requested but icu-uc not found])
267fi
Behdad Esfahbodd94647e2009-11-03 16:35:10 -0500268if $have_icu; then
Behdad Esfahbode5dbf392013-01-07 17:34:24 -0600269 CXXFLAGS="$CXXFLAGS `$PKG_CONFIG --variable=CXXFLAGS icu-uc`"
Behdad Esfahbodd94647e2009-11-03 16:35:10 -0500270 AC_DEFINE(HAVE_ICU, 1, [Have ICU library])
271fi
272AM_CONDITIONAL(HAVE_ICU, $have_icu)
273
Behdad Esfahbod46377392011-08-24 02:12:05 +0200274dnl ==========================================================================
Behdad Esfahbod1f49cf32011-08-24 01:29:25 +0200275
Behdad Esfahbod5a78d232013-05-27 18:47:58 -0400276AC_ARG_WITH(graphite2,
277 [AS_HELP_STRING([--with-graphite2=@<:@yes/no/auto@:>@],
278 [Use the graphite2 library @<:@default=no@:>@])],,
279 [with_graphite2=no])
280have_graphite2=false
281if test "x$with_graphite2" = "xyes" -o "x$with_graphite2" = "xauto"; then
Behdad Esfahbod270cfd72013-06-06 18:57:15 -0400282 PKG_CHECK_MODULES(GRAPHITE2, graphite2, have_graphite2=true, :)
Behdad Esfahbod1f49cf32011-08-24 01:29:25 +0200283fi
Behdad Esfahbod5a78d232013-05-27 18:47:58 -0400284if test "x$with_graphite2" = "xyes" -a "x$have_graphite2" != "xtrue"; then
285 AC_MSG_ERROR([graphite2 support requested but libgraphite2 not found])
286fi
287if $have_graphite2; then
Behdad Esfahbod9a3b7482014-12-28 17:27:39 -0800288 AC_DEFINE(HAVE_GRAPHITE2, 1, [Have Graphite2 library])
Behdad Esfahbod5a78d232013-05-27 18:47:58 -0400289fi
290AM_CONDITIONAL(HAVE_GRAPHITE2, $have_graphite2)
Behdad Esfahbod46377392011-08-24 02:12:05 +0200291
292dnl ==========================================================================
Behdad Esfahbod174e3fe2011-05-05 19:37:53 -0400293
Behdad Esfahbod82eddfe2013-05-27 19:33:36 -0400294AC_ARG_WITH(freetype,
295 [AS_HELP_STRING([--with-freetype=@<:@yes/no/auto@:>@],
296 [Use the FreeType library @<:@default=auto@:>@])],,
297 [with_freetype=auto])
298have_freetype=false
299if test "x$with_freetype" = "xyes" -o "x$with_freetype" = "xauto"; then
Behdad Esfahbod350f3a02014-12-28 17:44:26 -0800300 # 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, :)
Behdad Esfahbod82eddfe2013-05-27 19:33:36 -0400302fi
303if test "x$with_freetype" = "xyes" -a "x$have_freetype" != "xtrue"; then
304 AC_MSG_ERROR([FreeType support requested but libfreetype2 not found])
305fi
Behdad Esfahbodf94cf6b2009-11-02 18:55:19 -0500306if $have_freetype; then
307 AC_DEFINE(HAVE_FREETYPE, 1, [Have FreeType 2 library])
308fi
Behdad Esfahbod29aa4002009-11-02 16:28:39 -0500309AM_CONDITIONAL(HAVE_FREETYPE, $have_freetype)
310
Behdad Esfahbodc78f4482011-05-05 21:31:04 -0400311dnl ===========================================================================
Behdad Esfahbod29aa4002009-11-02 16:28:39 -0500312
Behdad Esfahbodab2af172013-05-27 19:27:43 -0400313AC_ARG_WITH(uniscribe,
314 [AS_HELP_STRING([--with-uniscribe=@<:@yes/no/auto@:>@],
315 [Use the Uniscribe library @<:@default=no@:>@])],,
316 [with_uniscribe=no])
317have_uniscribe=false
318if test "x$with_uniscribe" = "xyes" -o "x$with_uniscribe" = "xauto"; then
Behdad Esfahbod2a17f952013-05-28 13:10:51 -0400319 AC_CHECK_HEADERS(usp10.h windows.h, have_uniscribe=true)
Behdad Esfahbodab2af172013-05-27 19:27:43 -0400320fi
321if test "x$with_uniscribe" = "xyes" -a "x$have_uniscribe" != "xtrue"; then
322 AC_MSG_ERROR([uniscribe support requested but not found])
323fi
Behdad Esfahbod0fbb2dc2011-08-03 19:55:04 -0400324if $have_uniscribe; then
325 UNISCRIBE_CFLAGS=
Behdad Esfahbod8ac2e882013-07-21 16:06:49 -0400326 UNISCRIBE_LIBS="-lusp10 -lgdi32 -lrpcrt4"
Behdad Esfahbod0fbb2dc2011-08-03 19:55:04 -0400327 AC_SUBST(UNISCRIBE_CFLAGS)
328 AC_SUBST(UNISCRIBE_LIBS)
Behdad Esfahbodab2af172013-05-27 19:27:43 -0400329 AC_DEFINE(HAVE_UNISCRIBE, 1, [Have Uniscribe library])
Behdad Esfahbod0fbb2dc2011-08-03 19:55:04 -0400330fi
331AM_CONDITIONAL(HAVE_UNISCRIBE, $have_uniscribe)
332
Behdad Esfahbod04bc1ee2012-06-05 20:16:56 -0400333dnl ===========================================================================
334
Behdad Esfahbodeb63e782013-05-27 19:29:09 -0400335AC_ARG_WITH(coretext,
336 [AS_HELP_STRING([--with-coretext=@<:@yes/no/auto@:>@],
337 [Use CoreText @<:@default=no@:>@])],,
338 [with_coretext=no])
339have_coretext=false
340if test "x$with_coretext" = "xyes" -o "x$with_coretext" = "xauto"; then
341 AC_CHECK_TYPE(CTFontRef, have_coretext=true,, [#include <ApplicationServices/ApplicationServices.h>])
Konstantin Rittb96af032014-03-20 16:01:30 +0200342
343 if $have_coretext; then
344 CORETEXT_CFLAGS=
345 CORETEXT_LIBS="-framework ApplicationServices"
346 AC_SUBST(CORETEXT_CFLAGS)
347 AC_SUBST(CORETEXT_LIBS)
348 else
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>])
352 fi
353
354 if $have_coretext; then
355 CORETEXT_CFLAGS=
356 CORETEXT_LIBS="-framework CoreText -framework CoreGraphics"
357 AC_SUBST(CORETEXT_CFLAGS)
358 AC_SUBST(CORETEXT_LIBS)
359 fi
360 fi
Behdad Esfahbodeb63e782013-05-27 19:29:09 -0400361fi
362if test "x$with_coretext" = "xyes" -a "x$have_coretext" != "xtrue"; then
363 AC_MSG_ERROR([CoreText support requested but libcoretext not found])
364fi
Jonathan Kewaa6d8492012-07-24 15:52:32 -0400365if $have_coretext; then
Jonathan Kewaa6d8492012-07-24 15:52:32 -0400366 AC_DEFINE(HAVE_CORETEXT, 1, [Have Core Text backend])
367fi
368AM_CONDITIONAL(HAVE_CORETEXT, $have_coretext)
369
370dnl ===========================================================================
371
Behdad Esfahbod04bc1ee2012-06-05 20:16:56 -0400372AC_CACHE_CHECK([for Intel atomic primitives], hb_cv_have_intel_atomic_primitives, [
373 hb_cv_have_intel_atomic_primitives=false
Behdad Esfahbod12f5c0a2012-06-26 11:16:13 -0400374 AC_TRY_LINK([
Behdad Esfahbod04bc1ee2012-06-05 20:16:56 -0400375 void memory_barrier (void) { __sync_synchronize (); }
Behdad Esfahbod12f5c0a2012-06-26 11:16:13 -0400376 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
Behdad Esfahbod04bc1ee2012-06-05 20:16:56 -0400380 )
381])
382if $hb_cv_have_intel_atomic_primitives; then
383 AC_DEFINE(HAVE_INTEL_ATOMIC_PRIMITIVES, 1, [Have Intel __sync_* atomic primitives])
384fi
385
386dnl ===========================================================================
387
Behdad Esfahbod2dcb3332013-01-10 01:17:59 -0600388AC_CACHE_CHECK([for Solaris atomic operations], hb_cv_have_solaris_atomic_ops, [
389 hb_cv_have_solaris_atomic_ops=false
390 AC_TRY_LINK([
391 #include <atomic.h>
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
398 )
399])
400if $hb_cv_have_solaris_atomic_ops; then
401 AC_DEFINE(HAVE_SOLARIS_ATOMIC_OPS, 1, [Have Solaris __machine_*_barrier and atomic_* operations])
402fi
403
404if 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]))
407fi
408
409dnl ===========================================================================
410
Behdad Esfahbod29aa4002009-11-02 16:28:39 -0500411AC_CONFIG_FILES([
Behdad Esfahbod29aa4002009-11-02 16:28:39 -0500412Makefile
413src/Makefile
Behdad Esfahbodc78f4482011-05-05 21:31:04 -0400414src/hb-version.h
Behdad Esfahbod3f33f0d2012-10-02 16:03:18 -0400415src/hb-ucdn/Makefile
Behdad Esfahbod511a1362011-08-09 15:03:00 +0200416util/Makefile
Behdad Esfahbodbbdeff52011-04-07 16:05:07 -0400417test/Makefile
Behdad Esfahbod4d6dafd2012-01-19 14:52:02 -0500418test/api/Makefile
Behdad Esfahbodd4de5622012-01-19 15:21:04 -0500419test/shaping/Makefile
Anthony Carricof7c72b42013-02-24 13:00:33 -0500420docs/Makefile
421docs/reference/Makefile
Behdad Esfahboda2a28232013-08-30 19:38:47 -0400422docs/reference/version.xml
Behdad Esfahbod29aa4002009-11-02 16:28:39 -0500423])
424
425AC_OUTPUT
Behdad Esfahbodd16ddbc2012-12-20 01:02:36 -0500426
427AC_MSG_NOTICE([
428
429Build configuration:
430
431Unicode callbacks (you want at least one):
432 Glib: ${have_glib}
433 ICU: ${have_icu}
434 UCDN: ${have_ucdn}
435
436Font callbacks (the more the better):
437 FreeType: ${have_freetype}
438
439Tools used for command-line utilities:
440 Cairo: ${have_cairo}
441
442Additional shapers (the more the better):
Behdad Esfahbod5a78d232013-05-27 18:47:58 -0400443 Graphite2: ${have_graphite2}
Behdad Esfahbodd16ddbc2012-12-20 01:02:36 -0500444
Behdad Esfahbodac1b7232013-08-30 19:32:10 -0400445Platform shapers (not normally needed):
Behdad Esfahbodd16ddbc2012-12-20 01:02:36 -0500446 CoreText: ${have_coretext}
Behdad Esfahbodd16ddbc2012-12-20 01:02:36 -0500447 Uniscribe: ${have_uniscribe}
Anthony Carricof7c72b42013-02-24 13:00:33 -0500448
Behdad Esfahbod23027f72013-08-22 19:03:21 -0400449Other features:
Behdad Esfahbod71ef22b2013-08-28 12:52:55 -0400450 Documentation: ${have_gtk_doc}
Behdad Esfahbod71439a82013-08-26 20:56:58 -0400451 GObject bindings: ${have_gobject}
Behdad Esfahbod71ef22b2013-08-28 12:52:55 -0400452 Introspection: ${have_introspection}
Behdad Esfahbodd16ddbc2012-12-20 01:02:36 -0500453])