blob: a2d0992a724fb6fc7b6ac718f08b2219b8b868e9 [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 Esfahbod0a3b7a02018-10-20 13:14:07 -07003 [2.0.2],
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])
Ebrahim Byagowif7399792018-03-03 22:55:09 +033014AX_CODE_COVERAGE
Sascha Brawer1f141072018-10-04 09:17:08 +020015AC_USE_SYSTEM_EXTENSIONS
Javier Jardón2abe1262011-01-09 22:18:53 -050016
Behdad Esfahbodc62e41b2012-01-27 02:20:58 -050017# Initialize libtool
Behdad Esfahbod03adf382013-04-29 13:40:52 -040018m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
Behdad Esfahbodc62e41b2012-01-27 02:20:58 -050019LT_PREREQ([2.2])
20LT_INIT([disable-static])
21
Javier Jardón2abe1262011-01-09 22:18:53 -050022# Check for programs
Behdad Esfahbod29aa4002009-11-02 16:28:39 -050023AC_PROG_CC
Behdad Esfahbod94d32d12018-02-16 15:36:20 -080024AC_PROG_CC_C99
Behdad Esfahbod01098162010-10-05 18:36:45 -040025AM_PROG_CC_C_O
Behdad Esfahbod29aa4002009-11-02 16:28:39 -050026AC_PROG_CXX
Behdad Esfahbod22d8c762018-01-12 09:46:38 +010027dnl AX_CXX_COMPILE_STDCXX(11, noext, optional)
Behdad Esfahbod7201fdd2016-10-04 14:53:17 -070028AC_SYS_LARGEFILE
Behdad Esfahbodc7afac02012-10-02 14:44:47 -040029PKG_PROG_PKG_CONFIG([0.20])
Behdad Esfahbodbb8ffb52014-03-04 13:03:51 -080030AM_MISSING_PROG([RAGEL], [ragel])
31AM_MISSING_PROG([GIT], [git])
Behdad Esfahbod29aa4002009-11-02 16:28:39 -050032
Behdad Esfahbodc78f4482011-05-05 21:31:04 -040033# Version
Behdad Esfahbod329c1572011-05-25 16:07:07 -040034m4_define(hb_version_triplet,m4_split(AC_PACKAGE_VERSION,[[.]]))
35m4_define(hb_version_major,m4_argn(1,hb_version_triplet))
36m4_define(hb_version_minor,m4_argn(2,hb_version_triplet))
37m4_define(hb_version_micro,m4_argn(3,hb_version_triplet))
38HB_VERSION_MAJOR=hb_version_major
39HB_VERSION_MINOR=hb_version_minor
40HB_VERSION_MICRO=hb_version_micro
Behdad Esfahbodc78f4482011-05-05 21:31:04 -040041HB_VERSION=AC_PACKAGE_VERSION
Behdad Esfahbodc78f4482011-05-05 21:31:04 -040042AC_SUBST(HB_VERSION_MAJOR)
43AC_SUBST(HB_VERSION_MINOR)
44AC_SUBST(HB_VERSION_MICRO)
45AC_SUBST(HB_VERSION)
46
Behdad Esfahbod329c1572011-05-25 16:07:07 -040047# Libtool version
48m4_define([hb_version_int],
49 m4_eval(hb_version_major*10000 + hb_version_minor*100 + hb_version_micro))
50m4_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)])
55m4_define([hb_libtool_age],
56 m4_eval(hb_version_int - hb_libtool_revision))
57m4_define([hb_libtool_current],
Behdad Esfahbod26044232015-07-26 23:39:10 +020058 m4_eval(hb_libtool_age))
Behdad Esfahbod329c1572011-05-25 16:07:07 -040059HB_LIBTOOL_VERSION_INFO=hb_libtool_current:hb_libtool_revision:hb_libtool_age
60AC_SUBST(HB_LIBTOOL_VERSION_INFO)
Behdad Esfahbodc78f4482011-05-05 21:31:04 -040061
Khaled Hosny0b94d592018-02-12 16:45:36 +020062AC_ARG_WITH([libstdc++],
63 [AS_HELP_STRING([--with-libstdc++=@<:@yes/no@:>@],
64 [Allow linking with libstdc++ @<:@default=no@:>@])],
65 [with_libstdcxx=$withval],
66 [with_libstdcxx=no])
67AM_CONDITIONAL(WITH_LIBSTDCXX, [test "x$with_libstdcxx" = "xyes"])
Ebrahim Byagowi2efc8962018-02-12 12:00:07 +033068
Behdad Esfahbod71ef22b2013-08-28 12:52:55 -040069# Documentation
70have_gtk_doc=false
71m4_ifdef([GTK_DOC_CHECK], [
Behdad Esfahbod79d754e2013-08-28 13:43:35 -040072GTK_DOC_CHECK([1.15],[--flavour no-tmpl])
Behdad Esfahbod71ef22b2013-08-28 12:52:55 -040073 if test "x$enable_gtk_doc" = xyes; then
74 have_gtk_doc=true
75 fi
76], [
77 AM_CONDITIONAL([ENABLE_GTK_DOC], false)
78])
Behdad Esfahbodb9b10ad2011-09-13 13:30:39 -040079
Behdad Esfahbod08b8eb62018-03-31 12:15:50 +020080# Functions and headers
Behdad Esfahbod83ea2772018-07-10 13:17:27 +020081AC_CHECK_FUNCS(atexit mprotect sysconf getpagesize mmap isatty newlocale strtod_l posix_memalign)
Chun-wei Fan89dbabf2018-03-12 13:27:38 +080082
83save_libs="$LIBS"
84LIBS="$LIBS -lm"
85AC_CHECK_FUNCS([round], ,[AC_CHECK_DECLS([round], , ,[#include <math.h>])])
86LIBS="$save_libs"
87
88AC_CHECK_HEADERS(unistd.h sys/mman.h xlocale.h stdbool.h)
Behdad Esfahbod29aa4002009-11-02 16:28:39 -050089
Behdad Esfahbod174e3fe2011-05-05 19:37:53 -040090# Compiler flags
Behdad Esfahbodc78f4482011-05-05 21:31:04 -040091AC_CANONICAL_HOST
Behdad Esfahbod824d00d2014-06-09 14:17:33 -040092AC_CHECK_ALIGNOF([struct{char;}])
Behdad Esfahbod29aa4002009-11-02 16:28:39 -050093if test "x$GCC" = "xyes"; then
Behdad Esfahbod5b7f3892011-04-27 15:10:12 -040094
Behdad Esfahbod71cef142011-05-06 19:30:59 -040095 # Make symbols link locally
Ebrahim Byagowi7b4333b2018-03-16 22:45:09 +033096 AX_CHECK_LINK_FLAG([[-Bsymbolic-functions]], [LDFLAGS="$LDFLAGS -Bsymbolic-functions"])
Behdad Esfahbod71cef142011-05-06 19:30:59 -040097
Behdad Esfahbod08b8eb62018-03-31 12:15:50 +020098 # 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"
105
Behdad Esfahbod11c4ad42012-07-13 11:29:31 -0400106 # Assorted warnings
107 CXXFLAGS="$CXXFLAGS -Wcast-align"
108
Behdad Esfahbod5b7f3892011-04-27 15:10:12 -0400109 case "$host" in
Behdad Esfahbod560d68a2012-08-08 17:16:01 -0400110 *-*-mingw*)
Behdad Esfahbode3320ec2012-08-06 11:44:10 -0700111 ;;
112 *)
113 # Hide inline methods
114 CXXFLAGS="$CXXFLAGS -fvisibility-inlines-hidden"
115 ;;
116 esac
117
118 case "$host" in
Behdad Esfahbod5b7f3892011-04-27 15:10:12 -0400119 arm-*-*)
Behdad Esfahbod824d00d2014-06-09 14:17:33 -0400120 if test "x$ac_cv_alignof_struct_char__" != x1; then
Behdad Esfahbod3f38c112014-06-06 16:03:40 -0400121 # Request byte alignment
122 CXXFLAGS="$CXXFLAGS -mstructure-size-boundary=8"
123 fi
Behdad Esfahbod5b7f3892011-04-27 15:10:12 -0400124 ;;
125 esac
Behdad Esfahbod29aa4002009-11-02 16:28:39 -0500126fi
127
Behdad Esfahbode7846322013-01-14 00:27:21 -0600128AM_CONDITIONAL(HAVE_GCC, test "x$GCC" = "xyes")
129
Behdad Esfahbod0e292eb2012-10-02 14:59:00 -0400130hb_os_win32=no
Behdad Esfahbod560d68a2012-08-08 17:16:01 -0400131AC_MSG_CHECKING([for native Win32])
132case "$host" in
133 *-*-mingw*)
134 hb_os_win32=yes
135 ;;
Behdad Esfahbod560d68a2012-08-08 17:16:01 -0400136esac
137AC_MSG_RESULT([$hb_os_win32])
138AM_CONDITIONAL(OS_WIN32, test "$hb_os_win32" = "yes")
139
Behdad Esfahbod66efe892012-10-02 14:55:32 -0400140have_pthread=false
Behdad Esfahbod0e292eb2012-10-02 14:59:00 -0400141if test "$hb_os_win32" = no; then
142 AX_PTHREAD([have_pthread=true])
143fi
Behdad Esfahbod66efe892012-10-02 14:55:32 -0400144if $have_pthread; then
145 AC_DEFINE(HAVE_PTHREAD, 1, [Have POSIX threads])
146fi
147AM_CONDITIONAL(HAVE_PTHREAD, $have_pthread)
148
Behdad Esfahbod29aa4002009-11-02 16:28:39 -0500149dnl ==========================================================================
150
Konstantin Rittc9522de2014-01-22 21:07:13 +0200151have_fallback=true
152if $have_fallback; then
153 AC_DEFINE(HAVE_FALLBACK, 1, [Have simple TrueType Layout backend])
154fi
155AM_CONDITIONAL(HAVE_FALLBACK, $have_fallback)
156
Behdad Esfahbod68c75b42012-06-05 19:55:46 -0400157dnl ===========================================================================
158
Behdad Esfahbodab2af172013-05-27 19:27:43 -0400159AC_ARG_WITH(glib,
160 [AS_HELP_STRING([--with-glib=@<:@yes/no/auto@:>@],
Behdad Esfahbod5e25eb72013-05-27 19:30:48 -0400161 [Use glib @<:@default=auto@:>@])],,
162 [with_glib=auto])
Behdad Esfahbodab2af172013-05-27 19:27:43 -0400163have_glib=false
Mike Hommey1c98ff82016-09-30 18:15:37 +0900164GLIB_DEPS="glib-2.0 >= 2.19.1"
Behdad Esfahbod539a6102015-08-11 12:58:49 +0200165AC_SUBST(GLIB_DEPS)
Behdad Esfahbodab2af172013-05-27 19:27:43 -0400166if test "x$with_glib" = "xyes" -o "x$with_glib" = "xauto"; then
Behdad Esfahbod539a6102015-08-11 12:58:49 +0200167 PKG_CHECK_MODULES(GLIB, $GLIB_DEPS, have_glib=true, :)
Behdad Esfahbodab2af172013-05-27 19:27:43 -0400168fi
169if test "x$with_glib" = "xyes" -a "x$have_glib" != "xtrue"; then
170 AC_MSG_ERROR([glib support requested but glib-2.0 not found])
171fi
Behdad Esfahbodf94cf6b2009-11-02 18:55:19 -0500172if $have_glib; then
Behdad Esfahbodd94647e2009-11-03 16:35:10 -0500173 AC_DEFINE(HAVE_GLIB, 1, [Have glib2 library])
Behdad Esfahbodf94cf6b2009-11-02 18:55:19 -0500174fi
Behdad Esfahbod29aa4002009-11-02 16:28:39 -0500175AM_CONDITIONAL(HAVE_GLIB, $have_glib)
176
Behdad Esfahbod71ef22b2013-08-28 12:52:55 -0400177dnl ===========================================================================
178
Behdad Esfahbod71439a82013-08-26 20:56:58 -0400179AC_ARG_WITH(gobject,
180 [AS_HELP_STRING([--with-gobject=@<:@yes/no/auto@:>@],
Behdad Esfahbod601126a2017-11-03 20:34:11 -0400181 [Use gobject @<:@default=no@:>@])],,
Behdad Esfahbod71ef22b2013-08-28 12:52:55 -0400182 [with_gobject=no])
Behdad Esfahbodab2af172013-05-27 19:27:43 -0400183have_gobject=false
Behdad Esfahbod71439a82013-08-26 20:56:58 -0400184if test "x$with_gobject" = "xyes" -o "x$with_gobject" = "xauto"; then
185 PKG_CHECK_MODULES(GOBJECT, gobject-2.0 glib-2.0, have_gobject=true, :)
186fi
187if test "x$with_gobject" = "xyes" -a "x$have_gobject" != "xtrue"; then
188 AC_MSG_ERROR([gobject support requested but gobject-2.0 / glib-2.0 not found])
Behdad Esfahbodab2af172013-05-27 19:27:43 -0400189fi
Behdad Esfahbodc214cff2011-08-14 15:17:16 +0200190if $have_gobject; then
191 AC_DEFINE(HAVE_GOBJECT, 1, [Have gobject2 library])
Behdad Esfahbodd75333f2011-08-19 19:59:24 +0200192 GLIB_MKENUMS=`$PKG_CONFIG --variable=glib_mkenums glib-2.0`
193 AC_SUBST(GLIB_MKENUMS)
Behdad Esfahbodc214cff2011-08-14 15:17:16 +0200194fi
195AM_CONDITIONAL(HAVE_GOBJECT, $have_gobject)
Ben Boeckeld38f37b2018-02-23 16:55:53 -0500196AC_SUBST(have_gobject)
Behdad Esfahbodc214cff2011-08-14 15:17:16 +0200197
Behdad Esfahbodca653262013-05-27 19:09:50 -0400198dnl ===========================================================================
199
Behdad Esfahbod71ef22b2013-08-28 12:52:55 -0400200
201dnl ===========================================================================
202# Gobject-Introspection
203have_introspection=false
204m4_ifdef([GOBJECT_INTROSPECTION_CHECK], [
205 if $have_gobject; then
Behdad Esfahbod50a00532014-04-10 16:03:29 -0700206 GOBJECT_INTROSPECTION_CHECK([1.34.0])
Behdad Esfahbod71ef22b2013-08-28 12:52:55 -0400207 if test "x$found_introspection" = xyes; then
208 have_introspection=true
209 fi
210 else
211 AM_CONDITIONAL([HAVE_INTROSPECTION], false)
212 fi
213], [
214 AM_CONDITIONAL([HAVE_INTROSPECTION], false)
215])
216
Behdad Esfahbod174e3fe2011-05-05 19:37:53 -0400217dnl ==========================================================================
218
Behdad Esfahbodf8087ff2013-05-27 19:43:48 -0400219AC_ARG_WITH(cairo,
220 [AS_HELP_STRING([--with-cairo=@<:@yes/no/auto@:>@],
221 [Use cairo @<:@default=auto@:>@])],,
222 [with_cairo=auto])
223have_cairo=false
224if test "x$with_cairo" = "xyes" -o "x$with_cairo" = "xauto"; then
Behdad Esfahbod270cfd72013-06-06 18:57:15 -0400225 PKG_CHECK_MODULES(CAIRO, cairo >= 1.8.0, have_cairo=true, :)
Behdad Esfahbodf8087ff2013-05-27 19:43:48 -0400226fi
227if test "x$with_cairo" = "xyes" -a "x$have_cairo" != "xtrue"; then
228 AC_MSG_ERROR([cairo support requested but not found])
229fi
Behdad Esfahbod5353bf42011-02-22 18:06:19 -0500230if $have_cairo; then
231 AC_DEFINE(HAVE_CAIRO, 1, [Have cairo graphics library])
232fi
233AM_CONDITIONAL(HAVE_CAIRO, $have_cairo)
234
Behdad Esfahbodf8087ff2013-05-27 19:43:48 -0400235have_cairo_ft=false
236if $have_cairo; then
Behdad Esfahbod270cfd72013-06-06 18:57:15 -0400237 PKG_CHECK_MODULES(CAIRO_FT, cairo-ft, have_cairo_ft=true, :)
Behdad Esfahbodf8087ff2013-05-27 19:43:48 -0400238fi
Behdad Esfahbod5353bf42011-02-22 18:06:19 -0500239if $have_cairo_ft; then
240 AC_DEFINE(HAVE_CAIRO_FT, 1, [Have cairo-ft support in cairo graphics library])
241fi
242AM_CONDITIONAL(HAVE_CAIRO_FT, $have_cairo_ft)
243
Behdad Esfahbod174e3fe2011-05-05 19:37:53 -0400244dnl ==========================================================================
245
Behdad Esfahbodfe97b652014-08-06 16:49:51 -0400246AC_ARG_WITH(fontconfig,
247 [AS_HELP_STRING([--with-fontconfig=@<:@yes/no/auto@:>@],
248 [Use fontconfig @<:@default=auto@:>@])],,
249 [with_fontconfig=auto])
250have_fontconfig=false
251if test "x$with_fontconfig" = "xyes" -o "x$with_fontconfig" = "xauto"; then
252 PKG_CHECK_MODULES(FONTCONFIG, fontconfig, have_fontconfig=true, :)
253fi
254if test "x$with_fontconfig" = "xyes" -a "x$have_fontconfig" != "xtrue"; then
255 AC_MSG_ERROR([fontconfig support requested but not found])
256fi
257if $have_fontconfig; then
258 AC_DEFINE(HAVE_FONTCONFIG, 1, [Have fontconfig library])
259fi
260AM_CONDITIONAL(HAVE_FONTCONFIG, $have_fontconfig)
261
262dnl ==========================================================================
263
Behdad Esfahbod932b7472013-05-27 19:04:40 -0400264AC_ARG_WITH(icu,
Kal Conleyb424b6c2016-02-26 00:35:15 +0100265 [AS_HELP_STRING([--with-icu=@<:@yes/no/builtin/auto@:>@],
Behdad Esfahbod932b7472013-05-27 19:04:40 -0400266 [Use ICU @<:@default=auto@:>@])],,
267 [with_icu=auto])
268have_icu=false
Kal Conleyb424b6c2016-02-26 00:35:15 +0100269if test "x$with_icu" = "xyes" -o "x$with_icu" = "xbuiltin" -o "x$with_icu" = "xauto"; then
Behdad Esfahbod570bccc2013-06-10 13:56:51 -0400270 PKG_CHECK_MODULES(ICU, icu-uc, have_icu=true, :)
Behdad Esfahbod932b7472013-05-27 19:04:40 -0400271
272 dnl Fallback to icu-config if ICU pkg-config files could not be found
273 if test "$have_icu" != "true"; then
274 AC_CHECK_TOOL(ICU_CONFIG, icu-config, no)
275 AC_MSG_CHECKING([for ICU by using icu-config fallback])
276 if test "$ICU_CONFIG" != "no" && "$ICU_CONFIG" --version >/dev/null; then
277 have_icu=true
278 # We don't use --cflags as this gives us a lot of things that we don't
279 # necessarily want, like debugging and optimization flags
280 # See man (1) icu-config for more info.
281 ICU_CFLAGS=`$ICU_CONFIG --cppflags`
282 ICU_LIBS=`$ICU_CONFIG --ldflags-searchpath --ldflags-libsonly`
283 AC_SUBST(ICU_CFLAGS)
284 AC_SUBST(ICU_LIBS)
285 AC_MSG_RESULT([yes])
286 else
287 AC_MSG_RESULT([no])
288 fi
Behdad Esfahbod14cfab52013-03-11 19:53:44 -0400289 fi
290fi
Kal Conleyb424b6c2016-02-26 00:35:15 +0100291if test \( "x$with_icu" = "xyes" -o "x$with_icu" = "xbuiltin" \) -a "x$have_icu" != "xtrue"; then
Behdad Esfahbod932b7472013-05-27 19:04:40 -0400292 AC_MSG_ERROR([icu support requested but icu-uc not found])
293fi
Kal Conleyb424b6c2016-02-26 00:35:15 +0100294
Behdad Esfahbodd94647e2009-11-03 16:35:10 -0500295if $have_icu; then
Behdad Esfahbode5dbf392013-01-07 17:34:24 -0600296 CXXFLAGS="$CXXFLAGS `$PKG_CONFIG --variable=CXXFLAGS icu-uc`"
Behdad Esfahbodd94647e2009-11-03 16:35:10 -0500297 AC_DEFINE(HAVE_ICU, 1, [Have ICU library])
Kal Conleyb424b6c2016-02-26 00:35:15 +0100298 if test "x$with_icu" = "xbuiltin"; then
299 AC_DEFINE(HAVE_ICU_BUILTIN, 1, [Use hb-icu Unicode callbacks])
300 fi
Behdad Esfahbodd94647e2009-11-03 16:35:10 -0500301fi
302AM_CONDITIONAL(HAVE_ICU, $have_icu)
Kal Conleyb424b6c2016-02-26 00:35:15 +0100303AM_CONDITIONAL(HAVE_ICU_BUILTIN, $have_icu && test "x$with_icu" = "xbuiltin")
304
305dnl ===========================================================================
306
Behdad Esfahbod53543f82017-01-05 20:12:32 -0800307AC_ARG_WITH(ucdn,
308 [AS_HELP_STRING([--with-ucdn=@<:@yes/no@:>@],
309 [Use builtin UCDN library @<:@default=yes@:>@])],,
310 [with_ucdn=yes])
311have_ucdn=false
312if test "x$with_ucdn" = "xyes"; then
313 have_ucdn=true
Kal Conleyb424b6c2016-02-26 00:35:15 +0100314fi
315if $have_ucdn; then
316 AC_DEFINE(HAVE_UCDN, 1, [Have UCDN Unicode functions])
317fi
318AM_CONDITIONAL(HAVE_UCDN, $have_ucdn)
Behdad Esfahbodd94647e2009-11-03 16:35:10 -0500319
Behdad Esfahbod46377392011-08-24 02:12:05 +0200320dnl ==========================================================================
Behdad Esfahbod1f49cf32011-08-24 01:29:25 +0200321
Behdad Esfahbod5a78d232013-05-27 18:47:58 -0400322AC_ARG_WITH(graphite2,
323 [AS_HELP_STRING([--with-graphite2=@<:@yes/no/auto@:>@],
324 [Use the graphite2 library @<:@default=no@:>@])],,
325 [with_graphite2=no])
326have_graphite2=false
Ebrahim Byagowic2c7e642018-10-04 00:29:40 +0330327GRAPHITE2_DEPS="graphite2 >= 1.2.0"
Behdad Esfahbod539a6102015-08-11 12:58:49 +0200328AC_SUBST(GRAPHITE2_DEPS)
Behdad Esfahbod5a78d232013-05-27 18:47:58 -0400329if test "x$with_graphite2" = "xyes" -o "x$with_graphite2" = "xauto"; then
Behdad Esfahbod539a6102015-08-11 12:58:49 +0200330 PKG_CHECK_MODULES(GRAPHITE2, $GRAPHITE2_DEPS, have_graphite2=true, :)
Phil Krylovf16bf6c2016-09-27 12:38:49 +0200331 if test "x$have_graphite2" != "xtrue"; then
332 # If pkg-config is not available, graphite2 can still be there
333 ac_save_CFLAGS="$CFLAGS"
334 ac_save_CPPFLAGS="$CPPFLAGS"
335 CFLAGS="$CFLAGS $GRAPHITE2_CFLAGS"
336 CPPFLAGS="$CPPFLAGS $GRAPHITE2_CFLAGS"
337 AC_CHECK_HEADER(graphite2/Segment.h, have_graphite2=true, :)
338 CPPFLAGS="$ac_save_CPPFLAGS"
339 CFLAGS="$ac_save_CFLAGS"
340 fi
Behdad Esfahbod1f49cf32011-08-24 01:29:25 +0200341fi
Behdad Esfahbod5a78d232013-05-27 18:47:58 -0400342if test "x$with_graphite2" = "xyes" -a "x$have_graphite2" != "xtrue"; then
343 AC_MSG_ERROR([graphite2 support requested but libgraphite2 not found])
344fi
345if $have_graphite2; then
Behdad Esfahbod9a3b7482014-12-28 17:27:39 -0800346 AC_DEFINE(HAVE_GRAPHITE2, 1, [Have Graphite2 library])
Behdad Esfahbod5a78d232013-05-27 18:47:58 -0400347fi
348AM_CONDITIONAL(HAVE_GRAPHITE2, $have_graphite2)
Behdad Esfahbod46377392011-08-24 02:12:05 +0200349
350dnl ==========================================================================
Behdad Esfahbod174e3fe2011-05-05 19:37:53 -0400351
Behdad Esfahbod82eddfe2013-05-27 19:33:36 -0400352AC_ARG_WITH(freetype,
353 [AS_HELP_STRING([--with-freetype=@<:@yes/no/auto@:>@],
354 [Use the FreeType library @<:@default=auto@:>@])],,
355 [with_freetype=auto])
356have_freetype=false
Behdad Esfahbod539a6102015-08-11 12:58:49 +0200357FREETYPE_DEPS="freetype2 >= 12.0.6"
358AC_SUBST(FREETYPE_DEPS)
Behdad Esfahbod82eddfe2013-05-27 19:33:36 -0400359if test "x$with_freetype" = "xyes" -o "x$with_freetype" = "xauto"; then
Behdad Esfahbod350f3a02014-12-28 17:44:26 -0800360 # See freetype/docs/VERSION.DLL; 12.0.6 means freetype-2.4.2
Behdad Esfahbod539a6102015-08-11 12:58:49 +0200361 PKG_CHECK_MODULES(FREETYPE, $FREETYPE_DEPS, have_freetype=true, :)
Behdad Esfahbod82eddfe2013-05-27 19:33:36 -0400362fi
363if test "x$with_freetype" = "xyes" -a "x$have_freetype" != "xtrue"; then
364 AC_MSG_ERROR([FreeType support requested but libfreetype2 not found])
365fi
Behdad Esfahbodf94cf6b2009-11-02 18:55:19 -0500366if $have_freetype; then
367 AC_DEFINE(HAVE_FREETYPE, 1, [Have FreeType 2 library])
Behdad Esfahbod42c81422016-09-13 23:49:46 +0200368 save_libs=$LIBS
369 LIBS="$LIBS $FREETYPE_LIBS"
Behdad Esfahbodd0f3e7f2018-02-10 12:45:28 -0600370 AC_CHECK_FUNCS(FT_Get_Var_Blend_Coordinates FT_Set_Var_Blend_Coordinates FT_Done_MM_Var)
Behdad Esfahbod42c81422016-09-13 23:49:46 +0200371 LIBS=$save_libs
Behdad Esfahbodf94cf6b2009-11-02 18:55:19 -0500372fi
Behdad Esfahbod29aa4002009-11-02 16:28:39 -0500373AM_CONDITIONAL(HAVE_FREETYPE, $have_freetype)
374
Behdad Esfahbodc78f4482011-05-05 21:31:04 -0400375dnl ===========================================================================
Behdad Esfahbod29aa4002009-11-02 16:28:39 -0500376
Behdad Esfahbodab2af172013-05-27 19:27:43 -0400377AC_ARG_WITH(uniscribe,
378 [AS_HELP_STRING([--with-uniscribe=@<:@yes/no/auto@:>@],
379 [Use the Uniscribe library @<:@default=no@:>@])],,
380 [with_uniscribe=no])
381have_uniscribe=false
382if test "x$with_uniscribe" = "xyes" -o "x$with_uniscribe" = "xauto"; then
Behdad Esfahbod2a17f952013-05-28 13:10:51 -0400383 AC_CHECK_HEADERS(usp10.h windows.h, have_uniscribe=true)
Behdad Esfahbodab2af172013-05-27 19:27:43 -0400384fi
385if test "x$with_uniscribe" = "xyes" -a "x$have_uniscribe" != "xtrue"; then
386 AC_MSG_ERROR([uniscribe support requested but not found])
387fi
Behdad Esfahbod0fbb2dc2011-08-03 19:55:04 -0400388if $have_uniscribe; then
389 UNISCRIBE_CFLAGS=
Behdad Esfahbod8ac2e882013-07-21 16:06:49 -0400390 UNISCRIBE_LIBS="-lusp10 -lgdi32 -lrpcrt4"
Behdad Esfahbod0fbb2dc2011-08-03 19:55:04 -0400391 AC_SUBST(UNISCRIBE_CFLAGS)
392 AC_SUBST(UNISCRIBE_LIBS)
Behdad Esfahbodab2af172013-05-27 19:27:43 -0400393 AC_DEFINE(HAVE_UNISCRIBE, 1, [Have Uniscribe library])
Behdad Esfahbod0fbb2dc2011-08-03 19:55:04 -0400394fi
395AM_CONDITIONAL(HAVE_UNISCRIBE, $have_uniscribe)
396
Behdad Esfahbod04bc1ee2012-06-05 20:16:56 -0400397dnl ===========================================================================
398
Chun-wei Fanc6792852016-02-03 18:31:23 +0800399AC_ARG_WITH(directwrite,
400 [AS_HELP_STRING([--with-directwrite=@<:@yes/no/auto@:>@],
401 [Use the DirectWrite library (experimental) @<:@default=no@:>@])],,
402 [with_directwrite=no])
403have_directwrite=false
404AC_LANG_PUSH([C++])
405if test "x$with_directwrite" = "xyes" -o "x$with_directwrite" = "xauto"; then
406 AC_CHECK_HEADERS(dwrite.h, have_directwrite=true)
407fi
408AC_LANG_POP([C++])
409if test "x$with_directwrite" = "xyes" -a "x$have_directwrite" != "xtrue"; then
410 AC_MSG_ERROR([directwrite support requested but not found])
411fi
412if $have_directwrite; then
413 DIRECTWRITE_CXXFLAGS=
414 DIRECTWRITE_LIBS="-ldwrite"
415 AC_SUBST(DIRECTWRITE_CXXFLAGS)
416 AC_SUBST(DIRECTWRITE_LIBS)
417 AC_DEFINE(HAVE_DIRECTWRITE, 1, [Have DirectWrite library])
418fi
419AM_CONDITIONAL(HAVE_DIRECTWRITE, $have_directwrite)
420
421dnl ===========================================================================
422
Behdad Esfahbodeb63e782013-05-27 19:29:09 -0400423AC_ARG_WITH(coretext,
424 [AS_HELP_STRING([--with-coretext=@<:@yes/no/auto@:>@],
425 [Use CoreText @<:@default=no@:>@])],,
426 [with_coretext=no])
427have_coretext=false
428if test "x$with_coretext" = "xyes" -o "x$with_coretext" = "xauto"; then
429 AC_CHECK_TYPE(CTFontRef, have_coretext=true,, [#include <ApplicationServices/ApplicationServices.h>])
Konstantin Rittb96af032014-03-20 16:01:30 +0200430
431 if $have_coretext; then
432 CORETEXT_CFLAGS=
433 CORETEXT_LIBS="-framework ApplicationServices"
434 AC_SUBST(CORETEXT_CFLAGS)
435 AC_SUBST(CORETEXT_LIBS)
436 else
437 # On iOS CoreText and CoreGraphics are stand-alone frameworks
438 if test "x$have_coretext" != "xtrue"; then
Behdad Esfahbod331c46c2016-10-11 13:45:22 -0700439 # Check for a different symbol to avoid getting cached result.
440 AC_CHECK_TYPE(CTRunRef, have_coretext=true,, [#include <CoreText/CoreText.h>])
Konstantin Rittb96af032014-03-20 16:01:30 +0200441 fi
442
443 if $have_coretext; then
444 CORETEXT_CFLAGS=
Romain Ouabdelkader3db1d342017-12-21 14:39:34 +0100445 CORETEXT_LIBS="-framework CoreText -framework CoreGraphics -framework CoreFoundation"
Konstantin Rittb96af032014-03-20 16:01:30 +0200446 AC_SUBST(CORETEXT_CFLAGS)
447 AC_SUBST(CORETEXT_LIBS)
448 fi
449 fi
Behdad Esfahbodeb63e782013-05-27 19:29:09 -0400450fi
451if test "x$with_coretext" = "xyes" -a "x$have_coretext" != "xtrue"; then
452 AC_MSG_ERROR([CoreText support requested but libcoretext not found])
453fi
Jonathan Kewaa6d8492012-07-24 15:52:32 -0400454if $have_coretext; then
Jonathan Kewaa6d8492012-07-24 15:52:32 -0400455 AC_DEFINE(HAVE_CORETEXT, 1, [Have Core Text backend])
456fi
457AM_CONDITIONAL(HAVE_CORETEXT, $have_coretext)
458
459dnl ===========================================================================
460
Behdad Esfahbod04bc1ee2012-06-05 20:16:56 -0400461AC_CACHE_CHECK([for Intel atomic primitives], hb_cv_have_intel_atomic_primitives, [
462 hb_cv_have_intel_atomic_primitives=false
Behdad Esfahbod12f5c0a2012-06-26 11:16:13 -0400463 AC_TRY_LINK([
Behdad Esfahbod04bc1ee2012-06-05 20:16:56 -0400464 void memory_barrier (void) { __sync_synchronize (); }
Behdad Esfahbod12f5c0a2012-06-26 11:16:13 -0400465 int atomic_add (int *i) { return __sync_fetch_and_add (i, 1); }
466 int mutex_trylock (int *m) { return __sync_lock_test_and_set (m, 1); }
467 void mutex_unlock (int *m) { __sync_lock_release (m); }
468 ], [], hb_cv_have_intel_atomic_primitives=true
Behdad Esfahbod04bc1ee2012-06-05 20:16:56 -0400469 )
470])
471if $hb_cv_have_intel_atomic_primitives; then
472 AC_DEFINE(HAVE_INTEL_ATOMIC_PRIMITIVES, 1, [Have Intel __sync_* atomic primitives])
473fi
474
475dnl ===========================================================================
476
Behdad Esfahbod2dcb3332013-01-10 01:17:59 -0600477AC_CACHE_CHECK([for Solaris atomic operations], hb_cv_have_solaris_atomic_ops, [
478 hb_cv_have_solaris_atomic_ops=false
479 AC_TRY_LINK([
480 #include <atomic.h>
481 /* This requires Solaris Studio 12.2 or newer: */
482 #include <mbarrier.h>
483 void memory_barrier (void) { __machine_rw_barrier (); }
484 int atomic_add (volatile unsigned *i) { return atomic_add_int_nv (i, 1); }
485 void *atomic_ptr_cmpxchg (volatile void **target, void *cmp, void *newval) { return atomic_cas_ptr (target, cmp, newval); }
486 ], [], hb_cv_have_solaris_atomic_ops=true
487 )
488])
489if $hb_cv_have_solaris_atomic_ops; then
490 AC_DEFINE(HAVE_SOLARIS_ATOMIC_OPS, 1, [Have Solaris __machine_*_barrier and atomic_* operations])
491fi
492
493if test "$os_win32" = no && ! $have_pthread; then
494 AC_CHECK_HEADERS(sched.h)
495 AC_SEARCH_LIBS(sched_yield,rt,AC_DEFINE(HAVE_SCHED_YIELD, 1, [Have sched_yield]))
496fi
497
498dnl ===========================================================================
499
Behdad Esfahbod29aa4002009-11-02 16:28:39 -0500500AC_CONFIG_FILES([
Behdad Esfahbod29aa4002009-11-02 16:28:39 -0500501Makefile
502src/Makefile
Ben Boeckeld38f37b2018-02-23 16:55:53 -0500503src/harfbuzz-config.cmake
Behdad Esfahbod3f33f0d2012-10-02 16:03:18 -0400504src/hb-ucdn/Makefile
Behdad Esfahbod511a1362011-08-09 15:03:00 +0200505util/Makefile
Behdad Esfahbodbbdeff52011-04-07 16:05:07 -0400506test/Makefile
Behdad Esfahbod4d6dafd2012-01-19 14:52:02 -0500507test/api/Makefile
Behdad Esfahbod19300182015-11-05 23:08:50 -0800508test/fuzzing/Makefile
Behdad Esfahbodd4de5622012-01-19 15:21:04 -0500509test/shaping/Makefile
Behdad Esfahbod6db0b172018-01-10 05:40:43 +0100510test/shaping/data/Makefile
511test/shaping/data/in-house/Makefile
512test/shaping/data/text-rendering-tests/Makefile
Garret Rieger08532602018-01-29 13:30:02 -0800513test/subset/Makefile
514test/subset/data/Makefile
Anthony Carricof7c72b42013-02-24 13:00:33 -0500515docs/Makefile
Behdad Esfahbod5783e052015-08-31 19:18:10 +0100516docs/version.xml
Behdad Esfahbod29aa4002009-11-02 16:28:39 -0500517])
518
519AC_OUTPUT
Behdad Esfahbodd16ddbc2012-12-20 01:02:36 -0500520
521AC_MSG_NOTICE([
522
523Build configuration:
524
525Unicode callbacks (you want at least one):
Behdad Esfahbod53543f82017-01-05 20:12:32 -0800526 Builtin (UCDN): ${have_ucdn}
Behdad Esfahbodd16ddbc2012-12-20 01:02:36 -0500527 Glib: ${have_glib}
528 ICU: ${have_icu}
Behdad Esfahbodd16ddbc2012-12-20 01:02:36 -0500529
Behdad Esfahbodfcb8be12018-02-04 12:38:18 -0500530Font callbacks (the more the merrier):
Behdad Esfahbodd16ddbc2012-12-20 01:02:36 -0500531 FreeType: ${have_freetype}
532
533Tools used for command-line utilities:
534 Cairo: ${have_cairo}
Behdad Esfahbodfe97b652014-08-06 16:49:51 -0400535 Fontconfig: ${have_fontconfig}
Behdad Esfahbodd16ddbc2012-12-20 01:02:36 -0500536
Behdad Esfahbodfcb8be12018-02-04 12:38:18 -0500537Additional shapers (the more the merrier):
Behdad Esfahbod5a78d232013-05-27 18:47:58 -0400538 Graphite2: ${have_graphite2}
Behdad Esfahbodd16ddbc2012-12-20 01:02:36 -0500539
Behdad Esfahbodac1b7232013-08-30 19:32:10 -0400540Platform shapers (not normally needed):
Behdad Esfahbodd16ddbc2012-12-20 01:02:36 -0500541 CoreText: ${have_coretext}
Chun-wei Fanc6792852016-02-03 18:31:23 +0800542 DirectWrite: ${have_directwrite}
Ebrahim Byagowieff36cd2018-03-30 22:25:35 +0430543 Uniscribe: ${have_uniscribe}
Anthony Carricof7c72b42013-02-24 13:00:33 -0500544
Behdad Esfahbod23027f72013-08-22 19:03:21 -0400545Other features:
Khaled Hosnycf943f62018-02-04 12:05:12 +0200546 Documentation: ${enable_gtk_doc}
Behdad Esfahbod71439a82013-08-26 20:56:58 -0400547 GObject bindings: ${have_gobject}
Behdad Esfahbod71ef22b2013-08-28 12:52:55 -0400548 Introspection: ${have_introspection}
Behdad Esfahbodd16ddbc2012-12-20 01:02:36 -0500549])