blob: 98e9c32d8185a4e566b46307211ffbcf0030a83d [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 Esfahbodd6fc1d42019-03-28 21:21:26 -07003 [2.4.0],
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
Javier Jardón2abe1262011-01-09 22:18:53 -050015
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 Esfahbod94d32d12018-02-16 15:36:20 -080023AC_PROG_CC_C99
Behdad Esfahbod01098162010-10-05 18:36:45 -040024AM_PROG_CC_C_O
Behdad Esfahbod29aa4002009-11-02 16:28:39 -050025AC_PROG_CXX
Behdad Esfahbodfa1ae3d2018-12-30 12:01:13 -050026AX_CXX_COMPILE_STDCXX(11,, optional)
Behdad Esfahbod7201fdd2016-10-04 14:53:17 -070027AC_SYS_LARGEFILE
Behdad Esfahbodc7afac02012-10-02 14:44:47 -040028PKG_PROG_PKG_CONFIG([0.20])
Behdad Esfahbodbb8ffb52014-03-04 13:03:51 -080029AM_MISSING_PROG([RAGEL], [ragel])
30AM_MISSING_PROG([GIT], [git])
Behdad Esfahbod29aa4002009-11-02 16:28:39 -050031
Behdad Esfahbodc78f4482011-05-05 21:31:04 -040032# Version
Behdad Esfahbod329c1572011-05-25 16:07:07 -040033m4_define(hb_version_triplet,m4_split(AC_PACKAGE_VERSION,[[.]]))
34m4_define(hb_version_major,m4_argn(1,hb_version_triplet))
35m4_define(hb_version_minor,m4_argn(2,hb_version_triplet))
36m4_define(hb_version_micro,m4_argn(3,hb_version_triplet))
37HB_VERSION_MAJOR=hb_version_major
38HB_VERSION_MINOR=hb_version_minor
39HB_VERSION_MICRO=hb_version_micro
Behdad Esfahbodc78f4482011-05-05 21:31:04 -040040HB_VERSION=AC_PACKAGE_VERSION
Behdad Esfahbodc78f4482011-05-05 21:31:04 -040041AC_SUBST(HB_VERSION_MAJOR)
42AC_SUBST(HB_VERSION_MINOR)
43AC_SUBST(HB_VERSION_MICRO)
44AC_SUBST(HB_VERSION)
45
Behdad Esfahbod329c1572011-05-25 16:07:07 -040046# Libtool version
47m4_define([hb_version_int],
48 m4_eval(hb_version_major*10000 + hb_version_minor*100 + hb_version_micro))
49m4_if(m4_eval(hb_version_minor % 2), [1],
50 dnl for unstable releases
51 [m4_define([hb_libtool_revision], 0)],
52 dnl for stable releases
53 [m4_define([hb_libtool_revision], hb_version_micro)])
54m4_define([hb_libtool_age],
55 m4_eval(hb_version_int - hb_libtool_revision))
56m4_define([hb_libtool_current],
Behdad Esfahbod26044232015-07-26 23:39:10 +020057 m4_eval(hb_libtool_age))
Behdad Esfahbod329c1572011-05-25 16:07:07 -040058HB_LIBTOOL_VERSION_INFO=hb_libtool_current:hb_libtool_revision:hb_libtool_age
59AC_SUBST(HB_LIBTOOL_VERSION_INFO)
Behdad Esfahbodc78f4482011-05-05 21:31:04 -040060
Khaled Hosny0b94d592018-02-12 16:45:36 +020061AC_ARG_WITH([libstdc++],
62 [AS_HELP_STRING([--with-libstdc++=@<:@yes/no@:>@],
63 [Allow linking with libstdc++ @<:@default=no@:>@])],
64 [with_libstdcxx=$withval],
65 [with_libstdcxx=no])
66AM_CONDITIONAL(WITH_LIBSTDCXX, [test "x$with_libstdcxx" = "xyes"])
Ebrahim Byagowi2efc8962018-02-12 12:00:07 +033067
Behdad Esfahbod71ef22b2013-08-28 12:52:55 -040068# Documentation
69have_gtk_doc=false
70m4_ifdef([GTK_DOC_CHECK], [
Behdad Esfahbod79d754e2013-08-28 13:43:35 -040071GTK_DOC_CHECK([1.15],[--flavour no-tmpl])
Behdad Esfahbod71ef22b2013-08-28 12:52:55 -040072 if test "x$enable_gtk_doc" = xyes; then
73 have_gtk_doc=true
74 fi
75], [
76 AM_CONDITIONAL([ENABLE_GTK_DOC], false)
77])
Behdad Esfahbodb9b10ad2011-09-13 13:30:39 -040078
Behdad Esfahbod08b8eb62018-03-31 12:15:50 +020079# Functions and headers
Behdad Esfahbod83ea2772018-07-10 13:17:27 +020080AC_CHECK_FUNCS(atexit mprotect sysconf getpagesize mmap isatty newlocale strtod_l posix_memalign)
Chun-wei Fan89dbabf2018-03-12 13:27:38 +080081
82save_libs="$LIBS"
83LIBS="$LIBS -lm"
84AC_CHECK_FUNCS([round], ,[AC_CHECK_DECLS([round], , ,[#include <math.h>])])
85LIBS="$save_libs"
86
87AC_CHECK_HEADERS(unistd.h sys/mman.h xlocale.h stdbool.h)
Behdad Esfahbod29aa4002009-11-02 16:28:39 -050088
Behdad Esfahbod174e3fe2011-05-05 19:37:53 -040089# Compiler flags
Behdad Esfahbodc78f4482011-05-05 21:31:04 -040090AC_CANONICAL_HOST
Behdad Esfahbod824d00d2014-06-09 14:17:33 -040091AC_CHECK_ALIGNOF([struct{char;}])
Behdad Esfahbod29aa4002009-11-02 16:28:39 -050092if test "x$GCC" = "xyes"; then
Behdad Esfahbod5b7f3892011-04-27 15:10:12 -040093
Behdad Esfahbod71cef142011-05-06 19:30:59 -040094 # Make symbols link locally
Ebrahim Byagowi7b4333b2018-03-16 22:45:09 +033095 AX_CHECK_LINK_FLAG([[-Bsymbolic-functions]], [LDFLAGS="$LDFLAGS -Bsymbolic-functions"])
Behdad Esfahbod71cef142011-05-06 19:30:59 -040096
Behdad Esfahbod08b8eb62018-03-31 12:15:50 +020097 # Make it possible to not link to libstdc++
98 # No threadsafe statics in C++ as we do it ourselves.
99 # We don't use these features, so it's safe to disable them
100 # even in the cases where we DO link to libstdc++.
101 # Put -fno-rtti before $CXXFLAGS such that users can re-enable it
102 # by overriding CXXFLAGS.
103 CXXFLAGS="-fno-rtti $CXXFLAGS -fno-exceptions -fno-threadsafe-statics"
104
Behdad Esfahbod5b7f3892011-04-27 15:10:12 -0400105 case "$host" in
Behdad Esfahbod560d68a2012-08-08 17:16:01 -0400106 *-*-mingw*)
Behdad Esfahbode3320ec2012-08-06 11:44:10 -0700107 ;;
108 *)
109 # Hide inline methods
110 CXXFLAGS="$CXXFLAGS -fvisibility-inlines-hidden"
111 ;;
112 esac
113
114 case "$host" in
Behdad Esfahbod5b7f3892011-04-27 15:10:12 -0400115 arm-*-*)
Behdad Esfahbod824d00d2014-06-09 14:17:33 -0400116 if test "x$ac_cv_alignof_struct_char__" != x1; then
Behdad Esfahbod3f38c112014-06-06 16:03:40 -0400117 # Request byte alignment
118 CXXFLAGS="$CXXFLAGS -mstructure-size-boundary=8"
119 fi
Behdad Esfahbod5b7f3892011-04-27 15:10:12 -0400120 ;;
121 esac
Behdad Esfahbod29aa4002009-11-02 16:28:39 -0500122fi
123
Behdad Esfahbode7846322013-01-14 00:27:21 -0600124AM_CONDITIONAL(HAVE_GCC, test "x$GCC" = "xyes")
125
Behdad Esfahbod0e292eb2012-10-02 14:59:00 -0400126hb_os_win32=no
Behdad Esfahbod560d68a2012-08-08 17:16:01 -0400127AC_MSG_CHECKING([for native Win32])
128case "$host" in
129 *-*-mingw*)
130 hb_os_win32=yes
131 ;;
Behdad Esfahbod560d68a2012-08-08 17:16:01 -0400132esac
133AC_MSG_RESULT([$hb_os_win32])
134AM_CONDITIONAL(OS_WIN32, test "$hb_os_win32" = "yes")
135
Behdad Esfahbod66efe892012-10-02 14:55:32 -0400136have_pthread=false
Behdad Esfahbod0e292eb2012-10-02 14:59:00 -0400137if test "$hb_os_win32" = no; then
138 AX_PTHREAD([have_pthread=true])
139fi
Behdad Esfahbod66efe892012-10-02 14:55:32 -0400140if $have_pthread; then
141 AC_DEFINE(HAVE_PTHREAD, 1, [Have POSIX threads])
142fi
143AM_CONDITIONAL(HAVE_PTHREAD, $have_pthread)
144
Behdad Esfahbod29aa4002009-11-02 16:28:39 -0500145dnl ==========================================================================
146
Konstantin Rittc9522de2014-01-22 21:07:13 +0200147have_fallback=true
148if $have_fallback; then
149 AC_DEFINE(HAVE_FALLBACK, 1, [Have simple TrueType Layout backend])
150fi
151AM_CONDITIONAL(HAVE_FALLBACK, $have_fallback)
152
Behdad Esfahbod68c75b42012-06-05 19:55:46 -0400153dnl ===========================================================================
154
Behdad Esfahbodab2af172013-05-27 19:27:43 -0400155AC_ARG_WITH(glib,
156 [AS_HELP_STRING([--with-glib=@<:@yes/no/auto@:>@],
Behdad Esfahbod5e25eb72013-05-27 19:30:48 -0400157 [Use glib @<:@default=auto@:>@])],,
158 [with_glib=auto])
Behdad Esfahbodab2af172013-05-27 19:27:43 -0400159have_glib=false
Mike Hommey1c98ff82016-09-30 18:15:37 +0900160GLIB_DEPS="glib-2.0 >= 2.19.1"
Behdad Esfahbod539a6102015-08-11 12:58:49 +0200161AC_SUBST(GLIB_DEPS)
Behdad Esfahbodab2af172013-05-27 19:27:43 -0400162if test "x$with_glib" = "xyes" -o "x$with_glib" = "xauto"; then
Behdad Esfahbod539a6102015-08-11 12:58:49 +0200163 PKG_CHECK_MODULES(GLIB, $GLIB_DEPS, have_glib=true, :)
Behdad Esfahbodab2af172013-05-27 19:27:43 -0400164fi
165if test "x$with_glib" = "xyes" -a "x$have_glib" != "xtrue"; then
166 AC_MSG_ERROR([glib support requested but glib-2.0 not found])
167fi
Behdad Esfahbodf94cf6b2009-11-02 18:55:19 -0500168if $have_glib; then
Behdad Esfahbodd94647e2009-11-03 16:35:10 -0500169 AC_DEFINE(HAVE_GLIB, 1, [Have glib2 library])
Behdad Esfahbodf94cf6b2009-11-02 18:55:19 -0500170fi
Behdad Esfahbod29aa4002009-11-02 16:28:39 -0500171AM_CONDITIONAL(HAVE_GLIB, $have_glib)
172
Behdad Esfahbod71ef22b2013-08-28 12:52:55 -0400173dnl ===========================================================================
174
Behdad Esfahbod71439a82013-08-26 20:56:58 -0400175AC_ARG_WITH(gobject,
176 [AS_HELP_STRING([--with-gobject=@<:@yes/no/auto@:>@],
Behdad Esfahbod601126a2017-11-03 20:34:11 -0400177 [Use gobject @<:@default=no@:>@])],,
Behdad Esfahbod71ef22b2013-08-28 12:52:55 -0400178 [with_gobject=no])
Behdad Esfahbodab2af172013-05-27 19:27:43 -0400179have_gobject=false
Behdad Esfahbod71439a82013-08-26 20:56:58 -0400180if test "x$with_gobject" = "xyes" -o "x$with_gobject" = "xauto"; then
181 PKG_CHECK_MODULES(GOBJECT, gobject-2.0 glib-2.0, have_gobject=true, :)
182fi
183if test "x$with_gobject" = "xyes" -a "x$have_gobject" != "xtrue"; then
184 AC_MSG_ERROR([gobject support requested but gobject-2.0 / glib-2.0 not found])
Behdad Esfahbodab2af172013-05-27 19:27:43 -0400185fi
Behdad Esfahbodc214cff2011-08-14 15:17:16 +0200186if $have_gobject; then
187 AC_DEFINE(HAVE_GOBJECT, 1, [Have gobject2 library])
Behdad Esfahbodd75333f2011-08-19 19:59:24 +0200188 GLIB_MKENUMS=`$PKG_CONFIG --variable=glib_mkenums glib-2.0`
189 AC_SUBST(GLIB_MKENUMS)
Behdad Esfahbodc214cff2011-08-14 15:17:16 +0200190fi
191AM_CONDITIONAL(HAVE_GOBJECT, $have_gobject)
Ben Boeckeld38f37b2018-02-23 16:55:53 -0500192AC_SUBST(have_gobject)
Behdad Esfahbodc214cff2011-08-14 15:17:16 +0200193
Behdad Esfahbodca653262013-05-27 19:09:50 -0400194dnl ===========================================================================
195
Behdad Esfahbod71ef22b2013-08-28 12:52:55 -0400196
197dnl ===========================================================================
198# Gobject-Introspection
199have_introspection=false
200m4_ifdef([GOBJECT_INTROSPECTION_CHECK], [
201 if $have_gobject; then
Behdad Esfahbod50a00532014-04-10 16:03:29 -0700202 GOBJECT_INTROSPECTION_CHECK([1.34.0])
Behdad Esfahbod71ef22b2013-08-28 12:52:55 -0400203 if test "x$found_introspection" = xyes; then
204 have_introspection=true
205 fi
206 else
207 AM_CONDITIONAL([HAVE_INTROSPECTION], false)
208 fi
209], [
210 AM_CONDITIONAL([HAVE_INTROSPECTION], false)
211])
212
Behdad Esfahbod174e3fe2011-05-05 19:37:53 -0400213dnl ==========================================================================
214
Behdad Esfahbodf8087ff2013-05-27 19:43:48 -0400215AC_ARG_WITH(cairo,
216 [AS_HELP_STRING([--with-cairo=@<:@yes/no/auto@:>@],
217 [Use cairo @<:@default=auto@:>@])],,
218 [with_cairo=auto])
219have_cairo=false
220if test "x$with_cairo" = "xyes" -o "x$with_cairo" = "xauto"; then
Behdad Esfahbod270cfd72013-06-06 18:57:15 -0400221 PKG_CHECK_MODULES(CAIRO, cairo >= 1.8.0, have_cairo=true, :)
Behdad Esfahbodf8087ff2013-05-27 19:43:48 -0400222fi
223if test "x$with_cairo" = "xyes" -a "x$have_cairo" != "xtrue"; then
224 AC_MSG_ERROR([cairo support requested but not found])
225fi
Behdad Esfahbod5353bf42011-02-22 18:06:19 -0500226if $have_cairo; then
227 AC_DEFINE(HAVE_CAIRO, 1, [Have cairo graphics library])
228fi
229AM_CONDITIONAL(HAVE_CAIRO, $have_cairo)
230
Behdad Esfahbodf8087ff2013-05-27 19:43:48 -0400231have_cairo_ft=false
232if $have_cairo; then
Behdad Esfahbod270cfd72013-06-06 18:57:15 -0400233 PKG_CHECK_MODULES(CAIRO_FT, cairo-ft, have_cairo_ft=true, :)
Behdad Esfahbodf8087ff2013-05-27 19:43:48 -0400234fi
Behdad Esfahbod5353bf42011-02-22 18:06:19 -0500235if $have_cairo_ft; then
236 AC_DEFINE(HAVE_CAIRO_FT, 1, [Have cairo-ft support in cairo graphics library])
237fi
238AM_CONDITIONAL(HAVE_CAIRO_FT, $have_cairo_ft)
239
Behdad Esfahbod174e3fe2011-05-05 19:37:53 -0400240dnl ==========================================================================
241
Behdad Esfahbodfe97b652014-08-06 16:49:51 -0400242AC_ARG_WITH(fontconfig,
243 [AS_HELP_STRING([--with-fontconfig=@<:@yes/no/auto@:>@],
244 [Use fontconfig @<:@default=auto@:>@])],,
245 [with_fontconfig=auto])
246have_fontconfig=false
247if test "x$with_fontconfig" = "xyes" -o "x$with_fontconfig" = "xauto"; then
248 PKG_CHECK_MODULES(FONTCONFIG, fontconfig, have_fontconfig=true, :)
249fi
250if test "x$with_fontconfig" = "xyes" -a "x$have_fontconfig" != "xtrue"; then
251 AC_MSG_ERROR([fontconfig support requested but not found])
252fi
253if $have_fontconfig; then
254 AC_DEFINE(HAVE_FONTCONFIG, 1, [Have fontconfig library])
255fi
256AM_CONDITIONAL(HAVE_FONTCONFIG, $have_fontconfig)
257
258dnl ==========================================================================
259
Behdad Esfahbod932b7472013-05-27 19:04:40 -0400260AC_ARG_WITH(icu,
Kal Conleyb424b6c2016-02-26 00:35:15 +0100261 [AS_HELP_STRING([--with-icu=@<:@yes/no/builtin/auto@:>@],
Behdad Esfahbod932b7472013-05-27 19:04:40 -0400262 [Use ICU @<:@default=auto@:>@])],,
263 [with_icu=auto])
264have_icu=false
Kal Conleyb424b6c2016-02-26 00:35:15 +0100265if test "x$with_icu" = "xyes" -o "x$with_icu" = "xbuiltin" -o "x$with_icu" = "xauto"; then
Behdad Esfahbod570bccc2013-06-10 13:56:51 -0400266 PKG_CHECK_MODULES(ICU, icu-uc, have_icu=true, :)
Behdad Esfahbod932b7472013-05-27 19:04:40 -0400267
268 dnl Fallback to icu-config if ICU pkg-config files could not be found
269 if test "$have_icu" != "true"; then
270 AC_CHECK_TOOL(ICU_CONFIG, icu-config, no)
271 AC_MSG_CHECKING([for ICU by using icu-config fallback])
272 if test "$ICU_CONFIG" != "no" && "$ICU_CONFIG" --version >/dev/null; then
273 have_icu=true
274 # We don't use --cflags as this gives us a lot of things that we don't
275 # necessarily want, like debugging and optimization flags
276 # See man (1) icu-config for more info.
277 ICU_CFLAGS=`$ICU_CONFIG --cppflags`
278 ICU_LIBS=`$ICU_CONFIG --ldflags-searchpath --ldflags-libsonly`
279 AC_SUBST(ICU_CFLAGS)
280 AC_SUBST(ICU_LIBS)
281 AC_MSG_RESULT([yes])
282 else
283 AC_MSG_RESULT([no])
284 fi
Behdad Esfahbod14cfab52013-03-11 19:53:44 -0400285 fi
286fi
Kal Conleyb424b6c2016-02-26 00:35:15 +0100287if test \( "x$with_icu" = "xyes" -o "x$with_icu" = "xbuiltin" \) -a "x$have_icu" != "xtrue"; then
Behdad Esfahbod932b7472013-05-27 19:04:40 -0400288 AC_MSG_ERROR([icu support requested but icu-uc not found])
289fi
Kal Conleyb424b6c2016-02-26 00:35:15 +0100290
Behdad Esfahbodd94647e2009-11-03 16:35:10 -0500291if $have_icu; then
Behdad Esfahbode5dbf392013-01-07 17:34:24 -0600292 CXXFLAGS="$CXXFLAGS `$PKG_CONFIG --variable=CXXFLAGS icu-uc`"
Behdad Esfahbodd94647e2009-11-03 16:35:10 -0500293 AC_DEFINE(HAVE_ICU, 1, [Have ICU library])
Kal Conleyb424b6c2016-02-26 00:35:15 +0100294 if test "x$with_icu" = "xbuiltin"; then
295 AC_DEFINE(HAVE_ICU_BUILTIN, 1, [Use hb-icu Unicode callbacks])
296 fi
Behdad Esfahbodd94647e2009-11-03 16:35:10 -0500297fi
298AM_CONDITIONAL(HAVE_ICU, $have_icu)
Kal Conleyb424b6c2016-02-26 00:35:15 +0100299AM_CONDITIONAL(HAVE_ICU_BUILTIN, $have_icu && test "x$with_icu" = "xbuiltin")
300
301dnl ===========================================================================
302
Behdad Esfahbod53543f82017-01-05 20:12:32 -0800303AC_ARG_WITH(ucdn,
304 [AS_HELP_STRING([--with-ucdn=@<:@yes/no@:>@],
305 [Use builtin UCDN library @<:@default=yes@:>@])],,
306 [with_ucdn=yes])
307have_ucdn=false
308if test "x$with_ucdn" = "xyes"; then
309 have_ucdn=true
Kal Conleyb424b6c2016-02-26 00:35:15 +0100310fi
311if $have_ucdn; then
312 AC_DEFINE(HAVE_UCDN, 1, [Have UCDN Unicode functions])
313fi
314AM_CONDITIONAL(HAVE_UCDN, $have_ucdn)
Behdad Esfahbodd94647e2009-11-03 16:35:10 -0500315
Behdad Esfahbod46377392011-08-24 02:12:05 +0200316dnl ==========================================================================
Behdad Esfahbod1f49cf32011-08-24 01:29:25 +0200317
Behdad Esfahbod5a78d232013-05-27 18:47:58 -0400318AC_ARG_WITH(graphite2,
319 [AS_HELP_STRING([--with-graphite2=@<:@yes/no/auto@:>@],
320 [Use the graphite2 library @<:@default=no@:>@])],,
321 [with_graphite2=no])
322have_graphite2=false
Ebrahim Byagowic2c7e642018-10-04 00:29:40 +0330323GRAPHITE2_DEPS="graphite2 >= 1.2.0"
Behdad Esfahbod539a6102015-08-11 12:58:49 +0200324AC_SUBST(GRAPHITE2_DEPS)
Behdad Esfahbod5a78d232013-05-27 18:47:58 -0400325if test "x$with_graphite2" = "xyes" -o "x$with_graphite2" = "xauto"; then
Behdad Esfahbod539a6102015-08-11 12:58:49 +0200326 PKG_CHECK_MODULES(GRAPHITE2, $GRAPHITE2_DEPS, have_graphite2=true, :)
Phil Krylovf16bf6c2016-09-27 12:38:49 +0200327 if test "x$have_graphite2" != "xtrue"; then
328 # If pkg-config is not available, graphite2 can still be there
329 ac_save_CFLAGS="$CFLAGS"
330 ac_save_CPPFLAGS="$CPPFLAGS"
331 CFLAGS="$CFLAGS $GRAPHITE2_CFLAGS"
332 CPPFLAGS="$CPPFLAGS $GRAPHITE2_CFLAGS"
333 AC_CHECK_HEADER(graphite2/Segment.h, have_graphite2=true, :)
334 CPPFLAGS="$ac_save_CPPFLAGS"
335 CFLAGS="$ac_save_CFLAGS"
336 fi
Behdad Esfahbod1f49cf32011-08-24 01:29:25 +0200337fi
Behdad Esfahbod5a78d232013-05-27 18:47:58 -0400338if test "x$with_graphite2" = "xyes" -a "x$have_graphite2" != "xtrue"; then
339 AC_MSG_ERROR([graphite2 support requested but libgraphite2 not found])
340fi
341if $have_graphite2; then
Behdad Esfahbod9a3b7482014-12-28 17:27:39 -0800342 AC_DEFINE(HAVE_GRAPHITE2, 1, [Have Graphite2 library])
Behdad Esfahbod5a78d232013-05-27 18:47:58 -0400343fi
344AM_CONDITIONAL(HAVE_GRAPHITE2, $have_graphite2)
Behdad Esfahbod46377392011-08-24 02:12:05 +0200345
346dnl ==========================================================================
Behdad Esfahbod174e3fe2011-05-05 19:37:53 -0400347
Behdad Esfahbod82eddfe2013-05-27 19:33:36 -0400348AC_ARG_WITH(freetype,
349 [AS_HELP_STRING([--with-freetype=@<:@yes/no/auto@:>@],
350 [Use the FreeType library @<:@default=auto@:>@])],,
351 [with_freetype=auto])
352have_freetype=false
Behdad Esfahbod539a6102015-08-11 12:58:49 +0200353FREETYPE_DEPS="freetype2 >= 12.0.6"
354AC_SUBST(FREETYPE_DEPS)
Behdad Esfahbod82eddfe2013-05-27 19:33:36 -0400355if test "x$with_freetype" = "xyes" -o "x$with_freetype" = "xauto"; then
Behdad Esfahbod350f3a02014-12-28 17:44:26 -0800356 # See freetype/docs/VERSION.DLL; 12.0.6 means freetype-2.4.2
Behdad Esfahbod539a6102015-08-11 12:58:49 +0200357 PKG_CHECK_MODULES(FREETYPE, $FREETYPE_DEPS, have_freetype=true, :)
Behdad Esfahbod82eddfe2013-05-27 19:33:36 -0400358fi
359if test "x$with_freetype" = "xyes" -a "x$have_freetype" != "xtrue"; then
360 AC_MSG_ERROR([FreeType support requested but libfreetype2 not found])
361fi
Behdad Esfahbodf94cf6b2009-11-02 18:55:19 -0500362if $have_freetype; then
363 AC_DEFINE(HAVE_FREETYPE, 1, [Have FreeType 2 library])
Behdad Esfahbod42c81422016-09-13 23:49:46 +0200364 save_libs=$LIBS
365 LIBS="$LIBS $FREETYPE_LIBS"
Behdad Esfahbodd0f3e7f2018-02-10 12:45:28 -0600366 AC_CHECK_FUNCS(FT_Get_Var_Blend_Coordinates FT_Set_Var_Blend_Coordinates FT_Done_MM_Var)
Behdad Esfahbod42c81422016-09-13 23:49:46 +0200367 LIBS=$save_libs
Behdad Esfahbodf94cf6b2009-11-02 18:55:19 -0500368fi
Behdad Esfahbod29aa4002009-11-02 16:28:39 -0500369AM_CONDITIONAL(HAVE_FREETYPE, $have_freetype)
370
Behdad Esfahbodc78f4482011-05-05 21:31:04 -0400371dnl ===========================================================================
Behdad Esfahbod29aa4002009-11-02 16:28:39 -0500372
Behdad Esfahbodab2af172013-05-27 19:27:43 -0400373AC_ARG_WITH(uniscribe,
374 [AS_HELP_STRING([--with-uniscribe=@<:@yes/no/auto@:>@],
375 [Use the Uniscribe library @<:@default=no@:>@])],,
376 [with_uniscribe=no])
377have_uniscribe=false
378if test "x$with_uniscribe" = "xyes" -o "x$with_uniscribe" = "xauto"; then
Behdad Esfahbod2a17f952013-05-28 13:10:51 -0400379 AC_CHECK_HEADERS(usp10.h windows.h, have_uniscribe=true)
Behdad Esfahbodab2af172013-05-27 19:27:43 -0400380fi
381if test "x$with_uniscribe" = "xyes" -a "x$have_uniscribe" != "xtrue"; then
382 AC_MSG_ERROR([uniscribe support requested but not found])
383fi
Behdad Esfahbod0fbb2dc2011-08-03 19:55:04 -0400384if $have_uniscribe; then
385 UNISCRIBE_CFLAGS=
Behdad Esfahbod8ac2e882013-07-21 16:06:49 -0400386 UNISCRIBE_LIBS="-lusp10 -lgdi32 -lrpcrt4"
Behdad Esfahbod0fbb2dc2011-08-03 19:55:04 -0400387 AC_SUBST(UNISCRIBE_CFLAGS)
388 AC_SUBST(UNISCRIBE_LIBS)
Behdad Esfahbodab2af172013-05-27 19:27:43 -0400389 AC_DEFINE(HAVE_UNISCRIBE, 1, [Have Uniscribe library])
Behdad Esfahbod0fbb2dc2011-08-03 19:55:04 -0400390fi
391AM_CONDITIONAL(HAVE_UNISCRIBE, $have_uniscribe)
392
Behdad Esfahbod04bc1ee2012-06-05 20:16:56 -0400393dnl ===========================================================================
394
Chun-wei Fanc6792852016-02-03 18:31:23 +0800395AC_ARG_WITH(directwrite,
396 [AS_HELP_STRING([--with-directwrite=@<:@yes/no/auto@:>@],
397 [Use the DirectWrite library (experimental) @<:@default=no@:>@])],,
398 [with_directwrite=no])
399have_directwrite=false
400AC_LANG_PUSH([C++])
401if test "x$with_directwrite" = "xyes" -o "x$with_directwrite" = "xauto"; then
402 AC_CHECK_HEADERS(dwrite.h, have_directwrite=true)
403fi
404AC_LANG_POP([C++])
405if test "x$with_directwrite" = "xyes" -a "x$have_directwrite" != "xtrue"; then
406 AC_MSG_ERROR([directwrite support requested but not found])
407fi
408if $have_directwrite; then
409 DIRECTWRITE_CXXFLAGS=
410 DIRECTWRITE_LIBS="-ldwrite"
411 AC_SUBST(DIRECTWRITE_CXXFLAGS)
412 AC_SUBST(DIRECTWRITE_LIBS)
413 AC_DEFINE(HAVE_DIRECTWRITE, 1, [Have DirectWrite library])
414fi
415AM_CONDITIONAL(HAVE_DIRECTWRITE, $have_directwrite)
416
417dnl ===========================================================================
418
Behdad Esfahbodeb63e782013-05-27 19:29:09 -0400419AC_ARG_WITH(coretext,
420 [AS_HELP_STRING([--with-coretext=@<:@yes/no/auto@:>@],
421 [Use CoreText @<:@default=no@:>@])],,
422 [with_coretext=no])
423have_coretext=false
424if test "x$with_coretext" = "xyes" -o "x$with_coretext" = "xauto"; then
425 AC_CHECK_TYPE(CTFontRef, have_coretext=true,, [#include <ApplicationServices/ApplicationServices.h>])
Konstantin Rittb96af032014-03-20 16:01:30 +0200426
427 if $have_coretext; then
428 CORETEXT_CFLAGS=
429 CORETEXT_LIBS="-framework ApplicationServices"
430 AC_SUBST(CORETEXT_CFLAGS)
431 AC_SUBST(CORETEXT_LIBS)
432 else
433 # On iOS CoreText and CoreGraphics are stand-alone frameworks
434 if test "x$have_coretext" != "xtrue"; then
Behdad Esfahbod331c46c2016-10-11 13:45:22 -0700435 # Check for a different symbol to avoid getting cached result.
436 AC_CHECK_TYPE(CTRunRef, have_coretext=true,, [#include <CoreText/CoreText.h>])
Konstantin Rittb96af032014-03-20 16:01:30 +0200437 fi
438
439 if $have_coretext; then
440 CORETEXT_CFLAGS=
Romain Ouabdelkader3db1d342017-12-21 14:39:34 +0100441 CORETEXT_LIBS="-framework CoreText -framework CoreGraphics -framework CoreFoundation"
Konstantin Rittb96af032014-03-20 16:01:30 +0200442 AC_SUBST(CORETEXT_CFLAGS)
443 AC_SUBST(CORETEXT_LIBS)
444 fi
445 fi
Behdad Esfahbodeb63e782013-05-27 19:29:09 -0400446fi
447if test "x$with_coretext" = "xyes" -a "x$have_coretext" != "xtrue"; then
448 AC_MSG_ERROR([CoreText support requested but libcoretext not found])
449fi
Jonathan Kewaa6d8492012-07-24 15:52:32 -0400450if $have_coretext; then
Jonathan Kewaa6d8492012-07-24 15:52:32 -0400451 AC_DEFINE(HAVE_CORETEXT, 1, [Have Core Text backend])
452fi
453AM_CONDITIONAL(HAVE_CORETEXT, $have_coretext)
454
455dnl ===========================================================================
456
Behdad Esfahbod04bc1ee2012-06-05 20:16:56 -0400457AC_CACHE_CHECK([for Intel atomic primitives], hb_cv_have_intel_atomic_primitives, [
458 hb_cv_have_intel_atomic_primitives=false
Behdad Esfahbod12f5c0a2012-06-26 11:16:13 -0400459 AC_TRY_LINK([
Behdad Esfahbod04bc1ee2012-06-05 20:16:56 -0400460 void memory_barrier (void) { __sync_synchronize (); }
Behdad Esfahbod12f5c0a2012-06-26 11:16:13 -0400461 int atomic_add (int *i) { return __sync_fetch_and_add (i, 1); }
462 int mutex_trylock (int *m) { return __sync_lock_test_and_set (m, 1); }
463 void mutex_unlock (int *m) { __sync_lock_release (m); }
464 ], [], hb_cv_have_intel_atomic_primitives=true
Behdad Esfahbod04bc1ee2012-06-05 20:16:56 -0400465 )
466])
467if $hb_cv_have_intel_atomic_primitives; then
468 AC_DEFINE(HAVE_INTEL_ATOMIC_PRIMITIVES, 1, [Have Intel __sync_* atomic primitives])
469fi
470
471dnl ===========================================================================
472
Behdad Esfahbod2dcb3332013-01-10 01:17:59 -0600473AC_CACHE_CHECK([for Solaris atomic operations], hb_cv_have_solaris_atomic_ops, [
474 hb_cv_have_solaris_atomic_ops=false
475 AC_TRY_LINK([
476 #include <atomic.h>
477 /* This requires Solaris Studio 12.2 or newer: */
478 #include <mbarrier.h>
479 void memory_barrier (void) { __machine_rw_barrier (); }
480 int atomic_add (volatile unsigned *i) { return atomic_add_int_nv (i, 1); }
481 void *atomic_ptr_cmpxchg (volatile void **target, void *cmp, void *newval) { return atomic_cas_ptr (target, cmp, newval); }
482 ], [], hb_cv_have_solaris_atomic_ops=true
483 )
484])
485if $hb_cv_have_solaris_atomic_ops; then
486 AC_DEFINE(HAVE_SOLARIS_ATOMIC_OPS, 1, [Have Solaris __machine_*_barrier and atomic_* operations])
487fi
488
489if test "$os_win32" = no && ! $have_pthread; then
490 AC_CHECK_HEADERS(sched.h)
491 AC_SEARCH_LIBS(sched_yield,rt,AC_DEFINE(HAVE_SCHED_YIELD, 1, [Have sched_yield]))
492fi
493
494dnl ===========================================================================
495
Behdad Esfahbod29aa4002009-11-02 16:28:39 -0500496AC_CONFIG_FILES([
Behdad Esfahbod29aa4002009-11-02 16:28:39 -0500497Makefile
498src/Makefile
Ben Boeckeld38f37b2018-02-23 16:55:53 -0500499src/harfbuzz-config.cmake
Behdad Esfahbod3f33f0d2012-10-02 16:03:18 -0400500src/hb-ucdn/Makefile
Behdad Esfahbod511a1362011-08-09 15:03:00 +0200501util/Makefile
Behdad Esfahbodbbdeff52011-04-07 16:05:07 -0400502test/Makefile
Behdad Esfahbod4d6dafd2012-01-19 14:52:02 -0500503test/api/Makefile
Behdad Esfahbod19300182015-11-05 23:08:50 -0800504test/fuzzing/Makefile
Behdad Esfahbodd4de5622012-01-19 15:21:04 -0500505test/shaping/Makefile
Behdad Esfahbod6db0b172018-01-10 05:40:43 +0100506test/shaping/data/Makefile
Ebrahim Byagowi24887d12018-11-24 20:07:24 +0330507test/shaping/data/aots/Makefile
Behdad Esfahbod6db0b172018-01-10 05:40:43 +0100508test/shaping/data/in-house/Makefile
509test/shaping/data/text-rendering-tests/Makefile
Garret Rieger08532602018-01-29 13:30:02 -0800510test/subset/Makefile
511test/subset/data/Makefile
Anthony Carricof7c72b42013-02-24 13:00:33 -0500512docs/Makefile
Behdad Esfahbod5783e052015-08-31 19:18:10 +0100513docs/version.xml
Behdad Esfahbod29aa4002009-11-02 16:28:39 -0500514])
515
516AC_OUTPUT
Behdad Esfahbodd16ddbc2012-12-20 01:02:36 -0500517
Behdad Esfahbodede117d2019-01-30 15:10:23 -0800518echo
519echo "C++ compiler version:"
520$CXX --version
521echo
522
Behdad Esfahbodd16ddbc2012-12-20 01:02:36 -0500523AC_MSG_NOTICE([
524
525Build configuration:
526
527Unicode callbacks (you want at least one):
Behdad Esfahbod53543f82017-01-05 20:12:32 -0800528 Builtin (UCDN): ${have_ucdn}
Behdad Esfahbodd16ddbc2012-12-20 01:02:36 -0500529 Glib: ${have_glib}
530 ICU: ${have_icu}
Behdad Esfahbodd16ddbc2012-12-20 01:02:36 -0500531
Behdad Esfahbodfcb8be12018-02-04 12:38:18 -0500532Font callbacks (the more the merrier):
Behdad Esfahbodd16ddbc2012-12-20 01:02:36 -0500533 FreeType: ${have_freetype}
534
535Tools used for command-line utilities:
536 Cairo: ${have_cairo}
Behdad Esfahbodfe97b652014-08-06 16:49:51 -0400537 Fontconfig: ${have_fontconfig}
Behdad Esfahbodd16ddbc2012-12-20 01:02:36 -0500538
Behdad Esfahbodfcb8be12018-02-04 12:38:18 -0500539Additional shapers (the more the merrier):
Behdad Esfahbod5a78d232013-05-27 18:47:58 -0400540 Graphite2: ${have_graphite2}
Behdad Esfahbodd16ddbc2012-12-20 01:02:36 -0500541
Behdad Esfahbodac1b7232013-08-30 19:32:10 -0400542Platform shapers (not normally needed):
Behdad Esfahbodd16ddbc2012-12-20 01:02:36 -0500543 CoreText: ${have_coretext}
Chun-wei Fanc6792852016-02-03 18:31:23 +0800544 DirectWrite: ${have_directwrite}
Ebrahim Byagowieff36cd2018-03-30 22:25:35 +0430545 Uniscribe: ${have_uniscribe}
Anthony Carricof7c72b42013-02-24 13:00:33 -0500546
Behdad Esfahbod23027f72013-08-22 19:03:21 -0400547Other features:
Khaled Hosnycf943f62018-02-04 12:05:12 +0200548 Documentation: ${enable_gtk_doc}
Behdad Esfahbod71439a82013-08-26 20:56:58 -0400549 GObject bindings: ${have_gobject}
Behdad Esfahbod71ef22b2013-08-28 12:52:55 -0400550 Introspection: ${have_introspection}
Behdad Esfahbodd16ddbc2012-12-20 01:02:36 -0500551])