blob: 8ae0d01412b6b8c2be077fa3879a98f71d6ceb9c [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 Esfahbod09b53932013-01-18 17:10:47 -06003 [0.9.12],
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 Esfahbod29aa4002009-11-02 16:28:39 -05009AC_CONFIG_SRCDIR([harfbuzz.pc.in])
10AC_CONFIG_HEADERS([config.h])
Behdad Esfahbod29aa4002009-11-02 16:28:39 -050011
Behdad Esfahbod52d66c22013-02-04 23:31:24 -050012AM_INIT_AUTOMAKE([1.11.1 gnits dist-bzip2 no-dist-gzip -Wall no-define color-tests])
Javier Jardón2abe1262011-01-09 22:18:53 -050013AM_SILENT_RULES([yes])
14
Behdad Esfahbodc62e41b2012-01-27 02:20:58 -050015# Initialize libtool
16LT_PREREQ([2.2])
17LT_INIT([disable-static])
18
Javier Jardón2abe1262011-01-09 22:18:53 -050019# Check for programs
Behdad Esfahbod29aa4002009-11-02 16:28:39 -050020AC_PROG_CC
Behdad Esfahbod01098162010-10-05 18:36:45 -040021AM_PROG_CC_C_O
Behdad Esfahbod29aa4002009-11-02 16:28:39 -050022AC_PROG_CXX
Behdad Esfahbodc7afac02012-10-02 14:44:47 -040023PKG_PROG_PKG_CONFIG([0.20])
Behdad Esfahbod29aa4002009-11-02 16:28:39 -050024
Behdad Esfahbodc78f4482011-05-05 21:31:04 -040025# Version
Behdad Esfahbod329c1572011-05-25 16:07:07 -040026m4_define(hb_version_triplet,m4_split(AC_PACKAGE_VERSION,[[.]]))
27m4_define(hb_version_major,m4_argn(1,hb_version_triplet))
28m4_define(hb_version_minor,m4_argn(2,hb_version_triplet))
29m4_define(hb_version_micro,m4_argn(3,hb_version_triplet))
30HB_VERSION_MAJOR=hb_version_major
31HB_VERSION_MINOR=hb_version_minor
32HB_VERSION_MICRO=hb_version_micro
Behdad Esfahbodc78f4482011-05-05 21:31:04 -040033HB_VERSION=AC_PACKAGE_VERSION
Behdad Esfahbodc78f4482011-05-05 21:31:04 -040034AC_SUBST(HB_VERSION_MAJOR)
35AC_SUBST(HB_VERSION_MINOR)
36AC_SUBST(HB_VERSION_MICRO)
37AC_SUBST(HB_VERSION)
38
Behdad Esfahbod329c1572011-05-25 16:07:07 -040039# Libtool version
40m4_define([hb_version_int],
41 m4_eval(hb_version_major*10000 + hb_version_minor*100 + hb_version_micro))
42m4_if(m4_eval(hb_version_minor % 2), [1],
43 dnl for unstable releases
44 [m4_define([hb_libtool_revision], 0)],
45 dnl for stable releases
46 [m4_define([hb_libtool_revision], hb_version_micro)])
47m4_define([hb_libtool_age],
48 m4_eval(hb_version_int - hb_libtool_revision))
49m4_define([hb_libtool_current],
50 m4_eval(hb_version_major + hb_libtool_age))
51HB_LIBTOOL_VERSION_INFO=hb_libtool_current:hb_libtool_revision:hb_libtool_age
52AC_SUBST(HB_LIBTOOL_VERSION_INFO)
Behdad Esfahbodc78f4482011-05-05 21:31:04 -040053
Behdad Esfahbod8c0ea7b2012-06-24 13:20:56 -040054dnl GOBJECT_INTROSPECTION_CHECK([0.9.0])
Behdad Esfahbod95ab82a2012-01-15 14:56:56 -050055dnl GTK_DOC_CHECK([1.15],[--flavour no-tmpl])
Behdad Esfahbodb9b10ad2011-09-13 13:30:39 -040056
Behdad Esfahbod174e3fe2011-05-05 19:37:53 -040057# Functions and headers
Behdad Esfahbodbc764492013-01-31 18:18:05 -050058AC_CHECK_FUNCS(atexit mprotect sysconf getpagesize mmap setmode isatty)
Behdad Esfahbod2dcb3332013-01-10 01:17:59 -060059AC_CHECK_HEADERS(unistd.h sys/mman.h io.h)
Behdad Esfahbod29aa4002009-11-02 16:28:39 -050060
Behdad Esfahbod174e3fe2011-05-05 19:37:53 -040061# Compiler flags
Behdad Esfahbodc78f4482011-05-05 21:31:04 -040062AC_CANONICAL_HOST
Behdad Esfahbod29aa4002009-11-02 16:28:39 -050063if test "x$GCC" = "xyes"; then
Behdad Esfahbod5b7f3892011-04-27 15:10:12 -040064
Behdad Esfahbod71cef142011-05-06 19:30:59 -040065 # Make symbols link locally
66 LDFLAGS="$LDFLAGS -Bsymbolic-functions"
67
Behdad Esfahbod5b7f3892011-04-27 15:10:12 -040068 # Make sure we don't link to libstdc++
Behdad Esfahbod29aa4002009-11-02 16:28:39 -050069 CXXFLAGS="$CXXFLAGS -fno-rtti -fno-exceptions"
Behdad Esfahbod5b7f3892011-04-27 15:10:12 -040070
Behdad Esfahbod11c4ad42012-07-13 11:29:31 -040071 # Assorted warnings
72 CXXFLAGS="$CXXFLAGS -Wcast-align"
73
Behdad Esfahbod5b7f3892011-04-27 15:10:12 -040074 case "$host" in
Behdad Esfahbod560d68a2012-08-08 17:16:01 -040075 *-*-mingw*)
Behdad Esfahbode3320ec2012-08-06 11:44:10 -070076 ;;
77 *)
78 # Hide inline methods
79 CXXFLAGS="$CXXFLAGS -fvisibility-inlines-hidden"
80 ;;
81 esac
82
83 case "$host" in
Behdad Esfahbod5b7f3892011-04-27 15:10:12 -040084 arm-*-*)
85 # Request byte alignment on arm
86 CXXFLAGS="$CXXFLAGS -mstructure-size-boundary=8"
87 ;;
88 esac
Behdad Esfahbod29aa4002009-11-02 16:28:39 -050089fi
90
Behdad Esfahbode7846322013-01-14 00:27:21 -060091AM_CONDITIONAL(HAVE_GCC, test "x$GCC" = "xyes")
92
Behdad Esfahbod0e292eb2012-10-02 14:59:00 -040093hb_os_win32=no
Behdad Esfahbod560d68a2012-08-08 17:16:01 -040094AC_MSG_CHECKING([for native Win32])
95case "$host" in
96 *-*-mingw*)
97 hb_os_win32=yes
98 ;;
Behdad Esfahbod560d68a2012-08-08 17:16:01 -040099esac
100AC_MSG_RESULT([$hb_os_win32])
101AM_CONDITIONAL(OS_WIN32, test "$hb_os_win32" = "yes")
102
Behdad Esfahbod66efe892012-10-02 14:55:32 -0400103have_pthread=false
Behdad Esfahbod0e292eb2012-10-02 14:59:00 -0400104if test "$hb_os_win32" = no; then
105 AX_PTHREAD([have_pthread=true])
106fi
Behdad Esfahbod66efe892012-10-02 14:55:32 -0400107if $have_pthread; then
108 AC_DEFINE(HAVE_PTHREAD, 1, [Have POSIX threads])
109fi
110AM_CONDITIONAL(HAVE_PTHREAD, $have_pthread)
111
Behdad Esfahbod29aa4002009-11-02 16:28:39 -0500112dnl ==========================================================================
113
Behdad Esfahbod68c75b42012-06-05 19:55:46 -0400114have_ot=true
115if $have_ot; then
116 AC_DEFINE(HAVE_OT, 1, [Have native OpenType Layout backend])
117fi
118AM_CONDITIONAL(HAVE_OT, $have_ot)
119
120dnl ===========================================================================
121
Behdad Esfahbod8fe4c742012-07-24 21:05:12 -0400122have_hb_old=true
123if $have_hb_old; then
124 AC_DEFINE(HAVE_HB_OLD, 1, [Have Old HarfBuzz backend])
125fi
126AM_CONDITIONAL(HAVE_HB_OLD, $have_hb_old)
127
128dnl ===========================================================================
129
Behdad Esfahbod3f33f0d2012-10-02 16:03:18 -0400130have_ucdn=true
131if $have_ucdn; then
132 AC_DEFINE(HAVE_UCDN, 1, [Have UCDN Unicode functions])
133fi
134AM_CONDITIONAL(HAVE_UCDN, $have_ucdn)
135
136dnl ===========================================================================
137
Behdad Esfahbode6a5b882011-05-05 16:24:42 -0400138PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.16, have_glib=true, have_glib=false)
Behdad Esfahbodf94cf6b2009-11-02 18:55:19 -0500139if $have_glib; then
Behdad Esfahbodd94647e2009-11-03 16:35:10 -0500140 AC_DEFINE(HAVE_GLIB, 1, [Have glib2 library])
Behdad Esfahbodf94cf6b2009-11-02 18:55:19 -0500141fi
Behdad Esfahbod29aa4002009-11-02 16:28:39 -0500142AM_CONDITIONAL(HAVE_GLIB, $have_glib)
143
Behdad Esfahbodc214cff2011-08-14 15:17:16 +0200144PKG_CHECK_MODULES(GTHREAD, gthread-2.0, have_gthread=true, have_gthread=false)
145if $have_gthread; then
146 AC_DEFINE(HAVE_GTHREAD, 1, [Have gthread2 library])
147fi
148AM_CONDITIONAL(HAVE_GTHREAD, $have_gthread)
149
Behdad Esfahbod3d0ddd12012-01-15 15:55:52 -0500150PKG_CHECK_MODULES(GOBJECT, gobject-2.0 glib-2.0 >= 2.16, have_gobject=true, have_gobject=false)
Behdad Esfahbodc214cff2011-08-14 15:17:16 +0200151if $have_gobject; then
152 AC_DEFINE(HAVE_GOBJECT, 1, [Have gobject2 library])
Behdad Esfahbodd75333f2011-08-19 19:59:24 +0200153 GLIB_MKENUMS=`$PKG_CONFIG --variable=glib_mkenums glib-2.0`
154 AC_SUBST(GLIB_MKENUMS)
Behdad Esfahbodc214cff2011-08-14 15:17:16 +0200155fi
156AM_CONDITIONAL(HAVE_GOBJECT, $have_gobject)
157
Behdad Esfahbod174e3fe2011-05-05 19:37:53 -0400158dnl ==========================================================================
159
Behdad Esfahbod5353bf42011-02-22 18:06:19 -0500160PKG_CHECK_MODULES(CAIRO, cairo >= 1.8.0, have_cairo=true, have_cairo=false)
161if $have_cairo; then
162 AC_DEFINE(HAVE_CAIRO, 1, [Have cairo graphics library])
163fi
164AM_CONDITIONAL(HAVE_CAIRO, $have_cairo)
165
Behdad Esfahbod5353bf42011-02-22 18:06:19 -0500166PKG_CHECK_MODULES(CAIRO_FT, cairo-ft, have_cairo_ft=true, have_cairo_ft=false)
167if $have_cairo_ft; then
168 AC_DEFINE(HAVE_CAIRO_FT, 1, [Have cairo-ft support in cairo graphics library])
169fi
170AM_CONDITIONAL(HAVE_CAIRO_FT, $have_cairo_ft)
171
Behdad Esfahbod174e3fe2011-05-05 19:37:53 -0400172dnl ==========================================================================
173
Behdad Esfahbodb161bfc2012-08-16 08:09:44 -0400174PKG_CHECK_MODULES(ICU, icu-uc, have_icu=true, have_icu=false)
Behdad Esfahbodd94647e2009-11-03 16:35:10 -0500175if $have_icu; then
Behdad Esfahbode5dbf392013-01-07 17:34:24 -0600176 CXXFLAGS="$CXXFLAGS `$PKG_CONFIG --variable=CXXFLAGS icu-uc`"
Behdad Esfahbodd94647e2009-11-03 16:35:10 -0500177 AC_DEFINE(HAVE_ICU, 1, [Have ICU library])
178fi
179AM_CONDITIONAL(HAVE_ICU, $have_icu)
180
Behdad Esfahbod46377392011-08-24 02:12:05 +0200181dnl ==========================================================================
Behdad Esfahbod1f49cf32011-08-24 01:29:25 +0200182
Behdad Esfahbod2f7586c2012-08-23 23:59:55 -0400183PKG_CHECK_MODULES(ICU_LE, icu-le icu-uc, have_icu_le=true, have_icu_le=false)
Behdad Esfahbod7d242362012-08-23 21:23:41 -0400184if $have_icu_le; then
185 AC_DEFINE(HAVE_ICU_LE, 1, [Have ICU Layout Engine library])
186fi
187AM_CONDITIONAL(HAVE_ICU_LE, $have_icu_le)
188
189dnl ==========================================================================
190
Behdad Esfahbod6bd9b472012-04-12 14:53:53 -0400191PKG_CHECK_MODULES(GRAPHITE2, graphite2, have_graphite=true, have_graphite=false)
Behdad Esfahbod46377392011-08-24 02:12:05 +0200192if $have_graphite; then
Behdad Esfahbod6bd9b472012-04-12 14:53:53 -0400193 AC_DEFINE(HAVE_GRAPHITE2, 1, [Have Graphite library])
Behdad Esfahbod1f49cf32011-08-24 01:29:25 +0200194fi
Behdad Esfahbod6bd9b472012-04-12 14:53:53 -0400195AM_CONDITIONAL(HAVE_GRAPHITE2, $have_graphite)
Behdad Esfahbod46377392011-08-24 02:12:05 +0200196
197dnl ==========================================================================
Behdad Esfahbod174e3fe2011-05-05 19:37:53 -0400198
Behdad Esfahbod0b7e4d92011-08-15 20:41:59 +0200199PKG_CHECK_MODULES(FREETYPE, freetype2 >= 2.3.8, have_freetype=true, have_freetype=false)
Behdad Esfahbodf94cf6b2009-11-02 18:55:19 -0500200if $have_freetype; then
201 AC_DEFINE(HAVE_FREETYPE, 1, [Have FreeType 2 library])
Behdad Esfahbodcd11a982009-12-20 23:05:02 +0100202 _save_libs="$LIBS"
203 _save_cflags="$CFLAGS"
204 LIBS="$LIBS $FREETYPE_LIBS"
205 CFLAGS="$CFLAGS $FREETYPE_CFLAGS"
206 AC_CHECK_FUNCS(FT_Face_GetCharVariantIndex)
207 LIBS="$_save_libs"
208 CFLAGS="$_save_cflags"
Behdad Esfahbodf94cf6b2009-11-02 18:55:19 -0500209fi
Behdad Esfahbod29aa4002009-11-02 16:28:39 -0500210AM_CONDITIONAL(HAVE_FREETYPE, $have_freetype)
211
Behdad Esfahbodc78f4482011-05-05 21:31:04 -0400212dnl ===========================================================================
Behdad Esfahbod29aa4002009-11-02 16:28:39 -0500213
Behdad Esfahbod5e7e52d2012-12-10 17:44:22 -0500214AC_MSG_CHECKING([for ScriptShapeOpenType in usp10])
215saved_LIBS=$LIBS
216LIBS="$LIBS -lusp10 -lgdi32"
217AC_LINK_IFELSE([AC_LANG_PROGRAM(
218 [[
219 #define _WIN32_WINNT 0x0600
220 #include <windows.h>
221 #include <usp10.h>
222 ]],
223 ScriptShapeOpenType)],
224 [have_uniscribe=true; AC_MSG_RESULT(yes)],
225 [have_uniscribe=false;AC_MSG_RESULT(no)])
226LIBS=$saved_LIBS
Behdad Esfahbod0fbb2dc2011-08-03 19:55:04 -0400227if $have_uniscribe; then
228 UNISCRIBE_CFLAGS=
229 UNISCRIBE_LIBS="-lusp10 -lgdi32"
230 AC_SUBST(UNISCRIBE_CFLAGS)
231 AC_SUBST(UNISCRIBE_LIBS)
Behdad Esfahbod02aeca92011-08-04 22:31:05 -0400232 AC_DEFINE(HAVE_UNISCRIBE, 1, [Have Uniscribe backend])
Behdad Esfahbod0fbb2dc2011-08-03 19:55:04 -0400233fi
234AM_CONDITIONAL(HAVE_UNISCRIBE, $have_uniscribe)
235
Behdad Esfahbod04bc1ee2012-06-05 20:16:56 -0400236dnl ===========================================================================
237
John Rallsc48a04e2012-12-10 16:24:24 -0500238AC_CHECK_TYPE(CTFontRef, have_coretext=true, have_coretext=false, [#include <ApplicationServices/ApplicationServices.h>])
Jonathan Kewaa6d8492012-07-24 15:52:32 -0400239if $have_coretext; then
240 CORETEXT_CFLAGS=
Behdad Esfahbodae4d4e12012-08-26 14:27:44 -0400241 CORETEXT_LIBS="-framework ApplicationServices"
Jonathan Kewaa6d8492012-07-24 15:52:32 -0400242 AC_SUBST(CORETEXT_CFLAGS)
243 AC_SUBST(CORETEXT_LIBS)
244 AC_DEFINE(HAVE_CORETEXT, 1, [Have Core Text backend])
245fi
246AM_CONDITIONAL(HAVE_CORETEXT, $have_coretext)
247
248dnl ===========================================================================
249
Behdad Esfahbod04bc1ee2012-06-05 20:16:56 -0400250AC_CACHE_CHECK([for Intel atomic primitives], hb_cv_have_intel_atomic_primitives, [
251 hb_cv_have_intel_atomic_primitives=false
Behdad Esfahbod12f5c0a2012-06-26 11:16:13 -0400252 AC_TRY_LINK([
Behdad Esfahbod04bc1ee2012-06-05 20:16:56 -0400253 void memory_barrier (void) { __sync_synchronize (); }
Behdad Esfahbod12f5c0a2012-06-26 11:16:13 -0400254 int atomic_add (int *i) { return __sync_fetch_and_add (i, 1); }
255 int mutex_trylock (int *m) { return __sync_lock_test_and_set (m, 1); }
256 void mutex_unlock (int *m) { __sync_lock_release (m); }
257 ], [], hb_cv_have_intel_atomic_primitives=true
Behdad Esfahbod04bc1ee2012-06-05 20:16:56 -0400258 )
259])
260if $hb_cv_have_intel_atomic_primitives; then
261 AC_DEFINE(HAVE_INTEL_ATOMIC_PRIMITIVES, 1, [Have Intel __sync_* atomic primitives])
262fi
263
264dnl ===========================================================================
265
Behdad Esfahbod2dcb3332013-01-10 01:17:59 -0600266AC_CACHE_CHECK([for Solaris atomic operations], hb_cv_have_solaris_atomic_ops, [
267 hb_cv_have_solaris_atomic_ops=false
268 AC_TRY_LINK([
269 #include <atomic.h>
270 /* This requires Solaris Studio 12.2 or newer: */
271 #include <mbarrier.h>
272 void memory_barrier (void) { __machine_rw_barrier (); }
273 int atomic_add (volatile unsigned *i) { return atomic_add_int_nv (i, 1); }
274 void *atomic_ptr_cmpxchg (volatile void **target, void *cmp, void *newval) { return atomic_cas_ptr (target, cmp, newval); }
275 ], [], hb_cv_have_solaris_atomic_ops=true
276 )
277])
278if $hb_cv_have_solaris_atomic_ops; then
279 AC_DEFINE(HAVE_SOLARIS_ATOMIC_OPS, 1, [Have Solaris __machine_*_barrier and atomic_* operations])
280fi
281
282if test "$os_win32" = no && ! $have_pthread; then
283 AC_CHECK_HEADERS(sched.h)
284 AC_SEARCH_LIBS(sched_yield,rt,AC_DEFINE(HAVE_SCHED_YIELD, 1, [Have sched_yield]))
285fi
286
287dnl ===========================================================================
288
Behdad Esfahbod29aa4002009-11-02 16:28:39 -0500289AC_CONFIG_FILES([
Behdad Esfahbod29aa4002009-11-02 16:28:39 -0500290Makefile
Behdad Esfahbodc78f4482011-05-05 21:31:04 -0400291harfbuzz.pc
Behdad Esfahbod29aa4002009-11-02 16:28:39 -0500292src/Makefile
Behdad Esfahbodc78f4482011-05-05 21:31:04 -0400293src/hb-version.h
Behdad Esfahbod7d242362012-08-23 21:23:41 -0400294src/hb-icu-le/Makefile
Behdad Esfahbod3f33f0d2012-10-02 16:03:18 -0400295src/hb-old/Makefile
296src/hb-ucdn/Makefile
Behdad Esfahbod511a1362011-08-09 15:03:00 +0200297util/Makefile
Behdad Esfahbodbbdeff52011-04-07 16:05:07 -0400298test/Makefile
Behdad Esfahbod4d6dafd2012-01-19 14:52:02 -0500299test/api/Makefile
Behdad Esfahbodd4de5622012-01-19 15:21:04 -0500300test/shaping/Makefile
Behdad Esfahbod29aa4002009-11-02 16:28:39 -0500301])
302
303AC_OUTPUT
Behdad Esfahbodd16ddbc2012-12-20 01:02:36 -0500304
305AC_MSG_NOTICE([
306
307Build configuration:
308
309Unicode callbacks (you want at least one):
310 Glib: ${have_glib}
311 ICU: ${have_icu}
312 UCDN: ${have_ucdn}
313
314Font callbacks (the more the better):
315 FreeType: ${have_freetype}
316
317Tools used for command-line utilities:
318 Cairo: ${have_cairo}
319
320Additional shapers (the more the better):
321 Graphite2: ${have_graphite}
322
323Test / platform shapers (not normally needed):
324 CoreText: ${have_coretext}
325 ICU Layout Engine: ${have_icu_le}
326 Old HarfBuzz: ${have_hb_old}
327 Uniscribe: ${have_uniscribe}
328])