blob: ade962afbb154f665d1a90a6af8eb418990772cd [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 Esfahbod007a2a42017-12-20 12:09:00 -05003 [1.7.4],
ebraminio7c6937e2017-11-20 14:49:22 -05004 [https://github.com/harfbuzz/harfbuzz/issues/new],
Javier Jardón2abe1262011-01-09 22:18:53 -05005 [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 Esfahbod504f9132018-01-09 23:15:54 +010012AM_INIT_AUTOMAKE([1.13.0 gnits tar-ustar dist-bzip2 no-dist-gzip -Wall no-define color-tests -Wno-portability])
Javier Jardón2abe1262011-01-09 22:18:53 -050013AM_SILENT_RULES([yes])
14
Behdad Esfahbodc62e41b2012-01-27 02:20:58 -050015# Initialize libtool
Behdad Esfahbod03adf382013-04-29 13:40:52 -040016m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
Behdad Esfahbodc62e41b2012-01-27 02:20:58 -050017LT_PREREQ([2.2])
18LT_INIT([disable-static])
19
Javier Jardón2abe1262011-01-09 22:18:53 -050020# Check for programs
Behdad Esfahbod11816422016-10-26 16:04:30 +020021AC_USE_SYSTEM_EXTENSIONS
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 Esfahbod22d8c762018-01-12 09:46:38 +010025dnl AX_CXX_COMPILE_STDCXX(11, noext, optional)
Behdad Esfahbod7201fdd2016-10-04 14:53:17 -070026AC_SYS_LARGEFILE
Behdad Esfahbodc7afac02012-10-02 14:44:47 -040027PKG_PROG_PKG_CONFIG([0.20])
Behdad Esfahbodbb8ffb52014-03-04 13:03:51 -080028AM_MISSING_PROG([RAGEL], [ragel])
29AM_MISSING_PROG([GIT], [git])
Behdad Esfahbod29aa4002009-11-02 16:28:39 -050030
Behdad Esfahbodc78f4482011-05-05 21:31:04 -040031# Version
Behdad Esfahbod329c1572011-05-25 16:07:07 -040032m4_define(hb_version_triplet,m4_split(AC_PACKAGE_VERSION,[[.]]))
33m4_define(hb_version_major,m4_argn(1,hb_version_triplet))
34m4_define(hb_version_minor,m4_argn(2,hb_version_triplet))
35m4_define(hb_version_micro,m4_argn(3,hb_version_triplet))
36HB_VERSION_MAJOR=hb_version_major
37HB_VERSION_MINOR=hb_version_minor
38HB_VERSION_MICRO=hb_version_micro
Behdad Esfahbodc78f4482011-05-05 21:31:04 -040039HB_VERSION=AC_PACKAGE_VERSION
Behdad Esfahbodc78f4482011-05-05 21:31:04 -040040AC_SUBST(HB_VERSION_MAJOR)
41AC_SUBST(HB_VERSION_MINOR)
42AC_SUBST(HB_VERSION_MICRO)
43AC_SUBST(HB_VERSION)
44
Behdad Esfahbod329c1572011-05-25 16:07:07 -040045# Libtool version
46m4_define([hb_version_int],
47 m4_eval(hb_version_major*10000 + hb_version_minor*100 + hb_version_micro))
48m4_if(m4_eval(hb_version_minor % 2), [1],
49 dnl for unstable releases
50 [m4_define([hb_libtool_revision], 0)],
51 dnl for stable releases
52 [m4_define([hb_libtool_revision], hb_version_micro)])
53m4_define([hb_libtool_age],
54 m4_eval(hb_version_int - hb_libtool_revision))
55m4_define([hb_libtool_current],
Behdad Esfahbod26044232015-07-26 23:39:10 +020056 m4_eval(hb_libtool_age))
Behdad Esfahbod329c1572011-05-25 16:07:07 -040057HB_LIBTOOL_VERSION_INFO=hb_libtool_current:hb_libtool_revision:hb_libtool_age
58AC_SUBST(HB_LIBTOOL_VERSION_INFO)
Behdad Esfahbodc78f4482011-05-05 21:31:04 -040059
Behdad Esfahbod71ef22b2013-08-28 12:52:55 -040060# Documentation
61have_gtk_doc=false
62m4_ifdef([GTK_DOC_CHECK], [
Behdad Esfahbod79d754e2013-08-28 13:43:35 -040063GTK_DOC_CHECK([1.15],[--flavour no-tmpl])
Behdad Esfahbod71ef22b2013-08-28 12:52:55 -040064 if test "x$enable_gtk_doc" = xyes; then
65 have_gtk_doc=true
66 fi
67], [
68 AM_CONDITIONAL([ENABLE_GTK_DOC], false)
69])
Behdad Esfahbodb9b10ad2011-09-13 13:30:39 -040070
Behdad Esfahbod174e3fe2011-05-05 19:37:53 -040071# Functions and headers
Behdad Esfahbod3ca69c82017-09-14 20:50:35 -040072AC_CHECK_FUNCS(atexit mprotect sysconf getpagesize mmap isatty newlocale strtod_l)
73AC_CHECK_HEADERS(unistd.h sys/mman.h xlocale.h)
Behdad Esfahbod29aa4002009-11-02 16:28:39 -050074
Behdad Esfahbod174e3fe2011-05-05 19:37:53 -040075# Compiler flags
Behdad Esfahbodc78f4482011-05-05 21:31:04 -040076AC_CANONICAL_HOST
Behdad Esfahbod824d00d2014-06-09 14:17:33 -040077AC_CHECK_ALIGNOF([struct{char;}])
Behdad Esfahbod29aa4002009-11-02 16:28:39 -050078if test "x$GCC" = "xyes"; then
Behdad Esfahbod5b7f3892011-04-27 15:10:12 -040079
Behdad Esfahbod71cef142011-05-06 19:30:59 -040080 # Make symbols link locally
81 LDFLAGS="$LDFLAGS -Bsymbolic-functions"
82
Behdad Esfahbod5b7f3892011-04-27 15:10:12 -040083 # Make sure we don't link to libstdc++
Behdad Esfahbod29aa4002009-11-02 16:28:39 -050084 CXXFLAGS="$CXXFLAGS -fno-rtti -fno-exceptions"
Behdad Esfahbod5b7f3892011-04-27 15:10:12 -040085
Behdad Esfahbod11c4ad42012-07-13 11:29:31 -040086 # Assorted warnings
87 CXXFLAGS="$CXXFLAGS -Wcast-align"
88
Behdad Esfahbod5b7f3892011-04-27 15:10:12 -040089 case "$host" in
Behdad Esfahbod560d68a2012-08-08 17:16:01 -040090 *-*-mingw*)
Behdad Esfahbode3320ec2012-08-06 11:44:10 -070091 ;;
92 *)
93 # Hide inline methods
94 CXXFLAGS="$CXXFLAGS -fvisibility-inlines-hidden"
95 ;;
96 esac
97
98 case "$host" in
Behdad Esfahbod5b7f3892011-04-27 15:10:12 -040099 arm-*-*)
Behdad Esfahbod824d00d2014-06-09 14:17:33 -0400100 if test "x$ac_cv_alignof_struct_char__" != x1; then
Behdad Esfahbod3f38c112014-06-06 16:03:40 -0400101 # Request byte alignment
102 CXXFLAGS="$CXXFLAGS -mstructure-size-boundary=8"
103 fi
Behdad Esfahbod5b7f3892011-04-27 15:10:12 -0400104 ;;
105 esac
Behdad Esfahbod29aa4002009-11-02 16:28:39 -0500106fi
107
Behdad Esfahbode7846322013-01-14 00:27:21 -0600108AM_CONDITIONAL(HAVE_GCC, test "x$GCC" = "xyes")
109
Behdad Esfahbod0e292eb2012-10-02 14:59:00 -0400110hb_os_win32=no
Behdad Esfahbod560d68a2012-08-08 17:16:01 -0400111AC_MSG_CHECKING([for native Win32])
112case "$host" in
113 *-*-mingw*)
114 hb_os_win32=yes
115 ;;
Behdad Esfahbod560d68a2012-08-08 17:16:01 -0400116esac
117AC_MSG_RESULT([$hb_os_win32])
118AM_CONDITIONAL(OS_WIN32, test "$hb_os_win32" = "yes")
119
Behdad Esfahbod66efe892012-10-02 14:55:32 -0400120have_pthread=false
Behdad Esfahbod0e292eb2012-10-02 14:59:00 -0400121if test "$hb_os_win32" = no; then
122 AX_PTHREAD([have_pthread=true])
123fi
Behdad Esfahbod66efe892012-10-02 14:55:32 -0400124if $have_pthread; then
125 AC_DEFINE(HAVE_PTHREAD, 1, [Have POSIX threads])
126fi
127AM_CONDITIONAL(HAVE_PTHREAD, $have_pthread)
128
Behdad Esfahbod29aa4002009-11-02 16:28:39 -0500129dnl ==========================================================================
130
Behdad Esfahbod68c75b42012-06-05 19:55:46 -0400131have_ot=true
132if $have_ot; then
133 AC_DEFINE(HAVE_OT, 1, [Have native OpenType Layout backend])
134fi
135AM_CONDITIONAL(HAVE_OT, $have_ot)
136
Konstantin Rittc9522de2014-01-22 21:07:13 +0200137have_fallback=true
138if $have_fallback; then
139 AC_DEFINE(HAVE_FALLBACK, 1, [Have simple TrueType Layout backend])
140fi
141AM_CONDITIONAL(HAVE_FALLBACK, $have_fallback)
142
Behdad Esfahbod68c75b42012-06-05 19:55:46 -0400143dnl ===========================================================================
144
Behdad Esfahbodab2af172013-05-27 19:27:43 -0400145AC_ARG_WITH(glib,
146 [AS_HELP_STRING([--with-glib=@<:@yes/no/auto@:>@],
Behdad Esfahbod5e25eb72013-05-27 19:30:48 -0400147 [Use glib @<:@default=auto@:>@])],,
148 [with_glib=auto])
Behdad Esfahbodab2af172013-05-27 19:27:43 -0400149have_glib=false
Mike Hommey1c98ff82016-09-30 18:15:37 +0900150GLIB_DEPS="glib-2.0 >= 2.19.1"
Behdad Esfahbod539a6102015-08-11 12:58:49 +0200151AC_SUBST(GLIB_DEPS)
Behdad Esfahbodab2af172013-05-27 19:27:43 -0400152if test "x$with_glib" = "xyes" -o "x$with_glib" = "xauto"; then
Behdad Esfahbod539a6102015-08-11 12:58:49 +0200153 PKG_CHECK_MODULES(GLIB, $GLIB_DEPS, have_glib=true, :)
Behdad Esfahbodab2af172013-05-27 19:27:43 -0400154fi
155if test "x$with_glib" = "xyes" -a "x$have_glib" != "xtrue"; then
156 AC_MSG_ERROR([glib support requested but glib-2.0 not found])
157fi
Behdad Esfahbodf94cf6b2009-11-02 18:55:19 -0500158if $have_glib; then
Behdad Esfahbodd94647e2009-11-03 16:35:10 -0500159 AC_DEFINE(HAVE_GLIB, 1, [Have glib2 library])
Behdad Esfahbodf94cf6b2009-11-02 18:55:19 -0500160fi
Behdad Esfahbod29aa4002009-11-02 16:28:39 -0500161AM_CONDITIONAL(HAVE_GLIB, $have_glib)
162
Behdad Esfahbod71ef22b2013-08-28 12:52:55 -0400163dnl ===========================================================================
164
Behdad Esfahbod71439a82013-08-26 20:56:58 -0400165AC_ARG_WITH(gobject,
166 [AS_HELP_STRING([--with-gobject=@<:@yes/no/auto@:>@],
Behdad Esfahbod601126a2017-11-03 20:34:11 -0400167 [Use gobject @<:@default=no@:>@])],,
Behdad Esfahbod71ef22b2013-08-28 12:52:55 -0400168 [with_gobject=no])
Behdad Esfahbodab2af172013-05-27 19:27:43 -0400169have_gobject=false
Behdad Esfahbod71439a82013-08-26 20:56:58 -0400170if test "x$with_gobject" = "xyes" -o "x$with_gobject" = "xauto"; then
171 PKG_CHECK_MODULES(GOBJECT, gobject-2.0 glib-2.0, have_gobject=true, :)
172fi
173if test "x$with_gobject" = "xyes" -a "x$have_gobject" != "xtrue"; then
174 AC_MSG_ERROR([gobject support requested but gobject-2.0 / glib-2.0 not found])
Behdad Esfahbodab2af172013-05-27 19:27:43 -0400175fi
Behdad Esfahbodc214cff2011-08-14 15:17:16 +0200176if $have_gobject; then
177 AC_DEFINE(HAVE_GOBJECT, 1, [Have gobject2 library])
Behdad Esfahbodd75333f2011-08-19 19:59:24 +0200178 GLIB_MKENUMS=`$PKG_CONFIG --variable=glib_mkenums glib-2.0`
179 AC_SUBST(GLIB_MKENUMS)
Behdad Esfahbodc214cff2011-08-14 15:17:16 +0200180fi
181AM_CONDITIONAL(HAVE_GOBJECT, $have_gobject)
182
Behdad Esfahbodca653262013-05-27 19:09:50 -0400183dnl ===========================================================================
184
Behdad Esfahbod71ef22b2013-08-28 12:52:55 -0400185
186dnl ===========================================================================
187# Gobject-Introspection
188have_introspection=false
189m4_ifdef([GOBJECT_INTROSPECTION_CHECK], [
190 if $have_gobject; then
Behdad Esfahbod50a00532014-04-10 16:03:29 -0700191 GOBJECT_INTROSPECTION_CHECK([1.34.0])
Behdad Esfahbod71ef22b2013-08-28 12:52:55 -0400192 if test "x$found_introspection" = xyes; then
193 have_introspection=true
194 fi
195 else
196 AM_CONDITIONAL([HAVE_INTROSPECTION], false)
197 fi
198], [
199 AM_CONDITIONAL([HAVE_INTROSPECTION], false)
200])
201
Behdad Esfahbod174e3fe2011-05-05 19:37:53 -0400202dnl ==========================================================================
203
Behdad Esfahbodf8087ff2013-05-27 19:43:48 -0400204AC_ARG_WITH(cairo,
205 [AS_HELP_STRING([--with-cairo=@<:@yes/no/auto@:>@],
206 [Use cairo @<:@default=auto@:>@])],,
207 [with_cairo=auto])
208have_cairo=false
209if test "x$with_cairo" = "xyes" -o "x$with_cairo" = "xauto"; then
Behdad Esfahbod270cfd72013-06-06 18:57:15 -0400210 PKG_CHECK_MODULES(CAIRO, cairo >= 1.8.0, have_cairo=true, :)
Behdad Esfahbodf8087ff2013-05-27 19:43:48 -0400211fi
212if test "x$with_cairo" = "xyes" -a "x$have_cairo" != "xtrue"; then
213 AC_MSG_ERROR([cairo support requested but not found])
214fi
Behdad Esfahbod5353bf42011-02-22 18:06:19 -0500215if $have_cairo; then
216 AC_DEFINE(HAVE_CAIRO, 1, [Have cairo graphics library])
217fi
218AM_CONDITIONAL(HAVE_CAIRO, $have_cairo)
219
Behdad Esfahbodf8087ff2013-05-27 19:43:48 -0400220have_cairo_ft=false
221if $have_cairo; then
Behdad Esfahbod270cfd72013-06-06 18:57:15 -0400222 PKG_CHECK_MODULES(CAIRO_FT, cairo-ft, have_cairo_ft=true, :)
Behdad Esfahbodf8087ff2013-05-27 19:43:48 -0400223fi
Behdad Esfahbod5353bf42011-02-22 18:06:19 -0500224if $have_cairo_ft; then
225 AC_DEFINE(HAVE_CAIRO_FT, 1, [Have cairo-ft support in cairo graphics library])
226fi
227AM_CONDITIONAL(HAVE_CAIRO_FT, $have_cairo_ft)
228
Behdad Esfahbod174e3fe2011-05-05 19:37:53 -0400229dnl ==========================================================================
230
Behdad Esfahbodfe97b652014-08-06 16:49:51 -0400231AC_ARG_WITH(fontconfig,
232 [AS_HELP_STRING([--with-fontconfig=@<:@yes/no/auto@:>@],
233 [Use fontconfig @<:@default=auto@:>@])],,
234 [with_fontconfig=auto])
235have_fontconfig=false
236if test "x$with_fontconfig" = "xyes" -o "x$with_fontconfig" = "xauto"; then
237 PKG_CHECK_MODULES(FONTCONFIG, fontconfig, have_fontconfig=true, :)
238fi
239if test "x$with_fontconfig" = "xyes" -a "x$have_fontconfig" != "xtrue"; then
240 AC_MSG_ERROR([fontconfig support requested but not found])
241fi
242if $have_fontconfig; then
243 AC_DEFINE(HAVE_FONTCONFIG, 1, [Have fontconfig library])
244fi
245AM_CONDITIONAL(HAVE_FONTCONFIG, $have_fontconfig)
246
247dnl ==========================================================================
248
Behdad Esfahbod932b7472013-05-27 19:04:40 -0400249AC_ARG_WITH(icu,
Kal Conleyb424b6c2016-02-26 00:35:15 +0100250 [AS_HELP_STRING([--with-icu=@<:@yes/no/builtin/auto@:>@],
Behdad Esfahbod932b7472013-05-27 19:04:40 -0400251 [Use ICU @<:@default=auto@:>@])],,
252 [with_icu=auto])
253have_icu=false
Kal Conleyb424b6c2016-02-26 00:35:15 +0100254if test "x$with_icu" = "xyes" -o "x$with_icu" = "xbuiltin" -o "x$with_icu" = "xauto"; then
Behdad Esfahbod570bccc2013-06-10 13:56:51 -0400255 PKG_CHECK_MODULES(ICU, icu-uc, have_icu=true, :)
Behdad Esfahbod932b7472013-05-27 19:04:40 -0400256
257 dnl Fallback to icu-config if ICU pkg-config files could not be found
258 if test "$have_icu" != "true"; then
259 AC_CHECK_TOOL(ICU_CONFIG, icu-config, no)
260 AC_MSG_CHECKING([for ICU by using icu-config fallback])
261 if test "$ICU_CONFIG" != "no" && "$ICU_CONFIG" --version >/dev/null; then
262 have_icu=true
263 # We don't use --cflags as this gives us a lot of things that we don't
264 # necessarily want, like debugging and optimization flags
265 # See man (1) icu-config for more info.
266 ICU_CFLAGS=`$ICU_CONFIG --cppflags`
267 ICU_LIBS=`$ICU_CONFIG --ldflags-searchpath --ldflags-libsonly`
268 AC_SUBST(ICU_CFLAGS)
269 AC_SUBST(ICU_LIBS)
270 AC_MSG_RESULT([yes])
271 else
272 AC_MSG_RESULT([no])
273 fi
Behdad Esfahbod14cfab52013-03-11 19:53:44 -0400274 fi
275fi
Kal Conleyb424b6c2016-02-26 00:35:15 +0100276if test \( "x$with_icu" = "xyes" -o "x$with_icu" = "xbuiltin" \) -a "x$have_icu" != "xtrue"; then
Behdad Esfahbod932b7472013-05-27 19:04:40 -0400277 AC_MSG_ERROR([icu support requested but icu-uc not found])
278fi
Kal Conleyb424b6c2016-02-26 00:35:15 +0100279
Behdad Esfahbodd94647e2009-11-03 16:35:10 -0500280if $have_icu; then
Behdad Esfahbode5dbf392013-01-07 17:34:24 -0600281 CXXFLAGS="$CXXFLAGS `$PKG_CONFIG --variable=CXXFLAGS icu-uc`"
Behdad Esfahbodd94647e2009-11-03 16:35:10 -0500282 AC_DEFINE(HAVE_ICU, 1, [Have ICU library])
Kal Conleyb424b6c2016-02-26 00:35:15 +0100283 if test "x$with_icu" = "xbuiltin"; then
284 AC_DEFINE(HAVE_ICU_BUILTIN, 1, [Use hb-icu Unicode callbacks])
285 fi
Behdad Esfahbodd94647e2009-11-03 16:35:10 -0500286fi
287AM_CONDITIONAL(HAVE_ICU, $have_icu)
Kal Conleyb424b6c2016-02-26 00:35:15 +0100288AM_CONDITIONAL(HAVE_ICU_BUILTIN, $have_icu && test "x$with_icu" = "xbuiltin")
289
290dnl ===========================================================================
291
Behdad Esfahbod53543f82017-01-05 20:12:32 -0800292AC_ARG_WITH(ucdn,
293 [AS_HELP_STRING([--with-ucdn=@<:@yes/no@:>@],
294 [Use builtin UCDN library @<:@default=yes@:>@])],,
295 [with_ucdn=yes])
296have_ucdn=false
297if test "x$with_ucdn" = "xyes"; then
298 have_ucdn=true
Kal Conleyb424b6c2016-02-26 00:35:15 +0100299fi
300if $have_ucdn; then
301 AC_DEFINE(HAVE_UCDN, 1, [Have UCDN Unicode functions])
302fi
303AM_CONDITIONAL(HAVE_UCDN, $have_ucdn)
Behdad Esfahbodd94647e2009-11-03 16:35:10 -0500304
Behdad Esfahbod46377392011-08-24 02:12:05 +0200305dnl ==========================================================================
Behdad Esfahbod1f49cf32011-08-24 01:29:25 +0200306
Behdad Esfahbod5a78d232013-05-27 18:47:58 -0400307AC_ARG_WITH(graphite2,
308 [AS_HELP_STRING([--with-graphite2=@<:@yes/no/auto@:>@],
309 [Use the graphite2 library @<:@default=no@:>@])],,
310 [with_graphite2=no])
311have_graphite2=false
Behdad Esfahbod539a6102015-08-11 12:58:49 +0200312GRAPHITE2_DEPS="graphite2"
313AC_SUBST(GRAPHITE2_DEPS)
Behdad Esfahbod5a78d232013-05-27 18:47:58 -0400314if test "x$with_graphite2" = "xyes" -o "x$with_graphite2" = "xauto"; then
Behdad Esfahbod539a6102015-08-11 12:58:49 +0200315 PKG_CHECK_MODULES(GRAPHITE2, $GRAPHITE2_DEPS, have_graphite2=true, :)
Phil Krylovf16bf6c2016-09-27 12:38:49 +0200316 if test "x$have_graphite2" != "xtrue"; then
317 # If pkg-config is not available, graphite2 can still be there
318 ac_save_CFLAGS="$CFLAGS"
319 ac_save_CPPFLAGS="$CPPFLAGS"
320 CFLAGS="$CFLAGS $GRAPHITE2_CFLAGS"
321 CPPFLAGS="$CPPFLAGS $GRAPHITE2_CFLAGS"
322 AC_CHECK_HEADER(graphite2/Segment.h, have_graphite2=true, :)
323 CPPFLAGS="$ac_save_CPPFLAGS"
324 CFLAGS="$ac_save_CFLAGS"
325 fi
Behdad Esfahbod1f49cf32011-08-24 01:29:25 +0200326fi
Behdad Esfahbod5a78d232013-05-27 18:47:58 -0400327if test "x$with_graphite2" = "xyes" -a "x$have_graphite2" != "xtrue"; then
328 AC_MSG_ERROR([graphite2 support requested but libgraphite2 not found])
329fi
330if $have_graphite2; then
Behdad Esfahbod9a3b7482014-12-28 17:27:39 -0800331 AC_DEFINE(HAVE_GRAPHITE2, 1, [Have Graphite2 library])
Behdad Esfahbod5a78d232013-05-27 18:47:58 -0400332fi
333AM_CONDITIONAL(HAVE_GRAPHITE2, $have_graphite2)
Behdad Esfahbod46377392011-08-24 02:12:05 +0200334
335dnl ==========================================================================
Behdad Esfahbod174e3fe2011-05-05 19:37:53 -0400336
Behdad Esfahbod82eddfe2013-05-27 19:33:36 -0400337AC_ARG_WITH(freetype,
338 [AS_HELP_STRING([--with-freetype=@<:@yes/no/auto@:>@],
339 [Use the FreeType library @<:@default=auto@:>@])],,
340 [with_freetype=auto])
341have_freetype=false
Behdad Esfahbod539a6102015-08-11 12:58:49 +0200342FREETYPE_DEPS="freetype2 >= 12.0.6"
343AC_SUBST(FREETYPE_DEPS)
Behdad Esfahbod82eddfe2013-05-27 19:33:36 -0400344if test "x$with_freetype" = "xyes" -o "x$with_freetype" = "xauto"; then
Behdad Esfahbod350f3a02014-12-28 17:44:26 -0800345 # See freetype/docs/VERSION.DLL; 12.0.6 means freetype-2.4.2
Behdad Esfahbod539a6102015-08-11 12:58:49 +0200346 PKG_CHECK_MODULES(FREETYPE, $FREETYPE_DEPS, have_freetype=true, :)
Behdad Esfahbod82eddfe2013-05-27 19:33:36 -0400347fi
348if test "x$with_freetype" = "xyes" -a "x$have_freetype" != "xtrue"; then
349 AC_MSG_ERROR([FreeType support requested but libfreetype2 not found])
350fi
Behdad Esfahbodf94cf6b2009-11-02 18:55:19 -0500351if $have_freetype; then
352 AC_DEFINE(HAVE_FREETYPE, 1, [Have FreeType 2 library])
Behdad Esfahbod42c81422016-09-13 23:49:46 +0200353 save_libs=$LIBS
354 LIBS="$LIBS $FREETYPE_LIBS"
355 AC_CHECK_FUNCS(FT_Get_Var_Blend_Coordinates)
Olivier Blin0fd89dc2017-12-04 18:58:41 +0100356 AC_CHECK_FUNCS(FT_Set_Var_Blend_Coordinates)
Behdad Esfahbod0473d952018-01-08 10:07:46 +0000357 AC_CHECK_FUNCS(FT_Done_MM_Var)
Behdad Esfahbod42c81422016-09-13 23:49:46 +0200358 LIBS=$save_libs
Behdad Esfahbodf94cf6b2009-11-02 18:55:19 -0500359fi
Behdad Esfahbod29aa4002009-11-02 16:28:39 -0500360AM_CONDITIONAL(HAVE_FREETYPE, $have_freetype)
361
Behdad Esfahbodc78f4482011-05-05 21:31:04 -0400362dnl ===========================================================================
Behdad Esfahbod29aa4002009-11-02 16:28:39 -0500363
Behdad Esfahbodab2af172013-05-27 19:27:43 -0400364AC_ARG_WITH(uniscribe,
365 [AS_HELP_STRING([--with-uniscribe=@<:@yes/no/auto@:>@],
366 [Use the Uniscribe library @<:@default=no@:>@])],,
367 [with_uniscribe=no])
368have_uniscribe=false
369if test "x$with_uniscribe" = "xyes" -o "x$with_uniscribe" = "xauto"; then
Behdad Esfahbod2a17f952013-05-28 13:10:51 -0400370 AC_CHECK_HEADERS(usp10.h windows.h, have_uniscribe=true)
Behdad Esfahbodab2af172013-05-27 19:27:43 -0400371fi
372if test "x$with_uniscribe" = "xyes" -a "x$have_uniscribe" != "xtrue"; then
373 AC_MSG_ERROR([uniscribe support requested but not found])
374fi
Behdad Esfahbod0fbb2dc2011-08-03 19:55:04 -0400375if $have_uniscribe; then
376 UNISCRIBE_CFLAGS=
Behdad Esfahbod8ac2e882013-07-21 16:06:49 -0400377 UNISCRIBE_LIBS="-lusp10 -lgdi32 -lrpcrt4"
Behdad Esfahbod0fbb2dc2011-08-03 19:55:04 -0400378 AC_SUBST(UNISCRIBE_CFLAGS)
379 AC_SUBST(UNISCRIBE_LIBS)
Behdad Esfahbodab2af172013-05-27 19:27:43 -0400380 AC_DEFINE(HAVE_UNISCRIBE, 1, [Have Uniscribe library])
Behdad Esfahbod0fbb2dc2011-08-03 19:55:04 -0400381fi
382AM_CONDITIONAL(HAVE_UNISCRIBE, $have_uniscribe)
383
Behdad Esfahbod04bc1ee2012-06-05 20:16:56 -0400384dnl ===========================================================================
385
Chun-wei Fanc6792852016-02-03 18:31:23 +0800386AC_ARG_WITH(directwrite,
387 [AS_HELP_STRING([--with-directwrite=@<:@yes/no/auto@:>@],
388 [Use the DirectWrite library (experimental) @<:@default=no@:>@])],,
389 [with_directwrite=no])
390have_directwrite=false
391AC_LANG_PUSH([C++])
392if test "x$with_directwrite" = "xyes" -o "x$with_directwrite" = "xauto"; then
393 AC_CHECK_HEADERS(dwrite.h, have_directwrite=true)
394fi
395AC_LANG_POP([C++])
396if test "x$with_directwrite" = "xyes" -a "x$have_directwrite" != "xtrue"; then
397 AC_MSG_ERROR([directwrite support requested but not found])
398fi
399if $have_directwrite; then
400 DIRECTWRITE_CXXFLAGS=
401 DIRECTWRITE_LIBS="-ldwrite"
402 AC_SUBST(DIRECTWRITE_CXXFLAGS)
403 AC_SUBST(DIRECTWRITE_LIBS)
404 AC_DEFINE(HAVE_DIRECTWRITE, 1, [Have DirectWrite library])
405fi
406AM_CONDITIONAL(HAVE_DIRECTWRITE, $have_directwrite)
407
408dnl ===========================================================================
409
Behdad Esfahbodeb63e782013-05-27 19:29:09 -0400410AC_ARG_WITH(coretext,
411 [AS_HELP_STRING([--with-coretext=@<:@yes/no/auto@:>@],
412 [Use CoreText @<:@default=no@:>@])],,
413 [with_coretext=no])
414have_coretext=false
415if test "x$with_coretext" = "xyes" -o "x$with_coretext" = "xauto"; then
416 AC_CHECK_TYPE(CTFontRef, have_coretext=true,, [#include <ApplicationServices/ApplicationServices.h>])
Konstantin Rittb96af032014-03-20 16:01:30 +0200417
418 if $have_coretext; then
419 CORETEXT_CFLAGS=
420 CORETEXT_LIBS="-framework ApplicationServices"
421 AC_SUBST(CORETEXT_CFLAGS)
422 AC_SUBST(CORETEXT_LIBS)
423 else
424 # On iOS CoreText and CoreGraphics are stand-alone frameworks
425 if test "x$have_coretext" != "xtrue"; then
Behdad Esfahbod331c46c2016-10-11 13:45:22 -0700426 # Check for a different symbol to avoid getting cached result.
427 AC_CHECK_TYPE(CTRunRef, have_coretext=true,, [#include <CoreText/CoreText.h>])
Konstantin Rittb96af032014-03-20 16:01:30 +0200428 fi
429
430 if $have_coretext; then
431 CORETEXT_CFLAGS=
Romain Ouabdelkader3db1d342017-12-21 14:39:34 +0100432 CORETEXT_LIBS="-framework CoreText -framework CoreGraphics -framework CoreFoundation"
Konstantin Rittb96af032014-03-20 16:01:30 +0200433 AC_SUBST(CORETEXT_CFLAGS)
434 AC_SUBST(CORETEXT_LIBS)
435 fi
436 fi
Behdad Esfahbodeb63e782013-05-27 19:29:09 -0400437fi
438if test "x$with_coretext" = "xyes" -a "x$have_coretext" != "xtrue"; then
439 AC_MSG_ERROR([CoreText support requested but libcoretext not found])
440fi
Jonathan Kewaa6d8492012-07-24 15:52:32 -0400441if $have_coretext; then
Jonathan Kewaa6d8492012-07-24 15:52:32 -0400442 AC_DEFINE(HAVE_CORETEXT, 1, [Have Core Text backend])
443fi
444AM_CONDITIONAL(HAVE_CORETEXT, $have_coretext)
445
446dnl ===========================================================================
447
Behdad Esfahbod04bc1ee2012-06-05 20:16:56 -0400448AC_CACHE_CHECK([for Intel atomic primitives], hb_cv_have_intel_atomic_primitives, [
449 hb_cv_have_intel_atomic_primitives=false
Behdad Esfahbod12f5c0a2012-06-26 11:16:13 -0400450 AC_TRY_LINK([
Behdad Esfahbod04bc1ee2012-06-05 20:16:56 -0400451 void memory_barrier (void) { __sync_synchronize (); }
Behdad Esfahbod12f5c0a2012-06-26 11:16:13 -0400452 int atomic_add (int *i) { return __sync_fetch_and_add (i, 1); }
453 int mutex_trylock (int *m) { return __sync_lock_test_and_set (m, 1); }
454 void mutex_unlock (int *m) { __sync_lock_release (m); }
455 ], [], hb_cv_have_intel_atomic_primitives=true
Behdad Esfahbod04bc1ee2012-06-05 20:16:56 -0400456 )
457])
458if $hb_cv_have_intel_atomic_primitives; then
459 AC_DEFINE(HAVE_INTEL_ATOMIC_PRIMITIVES, 1, [Have Intel __sync_* atomic primitives])
460fi
461
462dnl ===========================================================================
463
Behdad Esfahbod2dcb3332013-01-10 01:17:59 -0600464AC_CACHE_CHECK([for Solaris atomic operations], hb_cv_have_solaris_atomic_ops, [
465 hb_cv_have_solaris_atomic_ops=false
466 AC_TRY_LINK([
467 #include <atomic.h>
468 /* This requires Solaris Studio 12.2 or newer: */
469 #include <mbarrier.h>
470 void memory_barrier (void) { __machine_rw_barrier (); }
471 int atomic_add (volatile unsigned *i) { return atomic_add_int_nv (i, 1); }
472 void *atomic_ptr_cmpxchg (volatile void **target, void *cmp, void *newval) { return atomic_cas_ptr (target, cmp, newval); }
473 ], [], hb_cv_have_solaris_atomic_ops=true
474 )
475])
476if $hb_cv_have_solaris_atomic_ops; then
477 AC_DEFINE(HAVE_SOLARIS_ATOMIC_OPS, 1, [Have Solaris __machine_*_barrier and atomic_* operations])
478fi
479
480if test "$os_win32" = no && ! $have_pthread; then
481 AC_CHECK_HEADERS(sched.h)
482 AC_SEARCH_LIBS(sched_yield,rt,AC_DEFINE(HAVE_SCHED_YIELD, 1, [Have sched_yield]))
483fi
484
485dnl ===========================================================================
486
Behdad Esfahbod29aa4002009-11-02 16:28:39 -0500487AC_CONFIG_FILES([
Behdad Esfahbod29aa4002009-11-02 16:28:39 -0500488Makefile
489src/Makefile
Behdad Esfahbodc78f4482011-05-05 21:31:04 -0400490src/hb-version.h
Behdad Esfahbod3f33f0d2012-10-02 16:03:18 -0400491src/hb-ucdn/Makefile
Behdad Esfahbod511a1362011-08-09 15:03:00 +0200492util/Makefile
Behdad Esfahbodbbdeff52011-04-07 16:05:07 -0400493test/Makefile
Behdad Esfahbod4d6dafd2012-01-19 14:52:02 -0500494test/api/Makefile
Behdad Esfahbod19300182015-11-05 23:08:50 -0800495test/fuzzing/Makefile
Behdad Esfahbodd4de5622012-01-19 15:21:04 -0500496test/shaping/Makefile
Behdad Esfahbod6db0b172018-01-10 05:40:43 +0100497test/shaping/data/Makefile
498test/shaping/data/in-house/Makefile
499test/shaping/data/text-rendering-tests/Makefile
Anthony Carricof7c72b42013-02-24 13:00:33 -0500500docs/Makefile
Behdad Esfahbod5783e052015-08-31 19:18:10 +0100501docs/version.xml
Behdad Esfahbod29aa4002009-11-02 16:28:39 -0500502])
503
504AC_OUTPUT
Behdad Esfahbodd16ddbc2012-12-20 01:02:36 -0500505
506AC_MSG_NOTICE([
507
508Build configuration:
509
510Unicode callbacks (you want at least one):
Behdad Esfahbod53543f82017-01-05 20:12:32 -0800511 Builtin (UCDN): ${have_ucdn}
Behdad Esfahbodd16ddbc2012-12-20 01:02:36 -0500512 Glib: ${have_glib}
513 ICU: ${have_icu}
Behdad Esfahbodd16ddbc2012-12-20 01:02:36 -0500514
515Font callbacks (the more the better):
516 FreeType: ${have_freetype}
517
518Tools used for command-line utilities:
519 Cairo: ${have_cairo}
Behdad Esfahbodfe97b652014-08-06 16:49:51 -0400520 Fontconfig: ${have_fontconfig}
Behdad Esfahbodd16ddbc2012-12-20 01:02:36 -0500521
522Additional shapers (the more the better):
Behdad Esfahbod5a78d232013-05-27 18:47:58 -0400523 Graphite2: ${have_graphite2}
Behdad Esfahbodd16ddbc2012-12-20 01:02:36 -0500524
Behdad Esfahbodac1b7232013-08-30 19:32:10 -0400525Platform shapers (not normally needed):
Behdad Esfahbodd16ddbc2012-12-20 01:02:36 -0500526 CoreText: ${have_coretext}
Behdad Esfahbodd16ddbc2012-12-20 01:02:36 -0500527 Uniscribe: ${have_uniscribe}
Chun-wei Fanc6792852016-02-03 18:31:23 +0800528 DirectWrite: ${have_directwrite}
Anthony Carricof7c72b42013-02-24 13:00:33 -0500529
Behdad Esfahbod23027f72013-08-22 19:03:21 -0400530Other features:
Behdad Esfahbod71ef22b2013-08-28 12:52:55 -0400531 Documentation: ${have_gtk_doc}
Behdad Esfahbod71439a82013-08-26 20:56:58 -0400532 GObject bindings: ${have_gobject}
Behdad Esfahbod71ef22b2013-08-28 12:52:55 -0400533 Introspection: ${have_introspection}
Behdad Esfahbodd16ddbc2012-12-20 01:02:36 -0500534])