blob: 93b659b68a6381a5341738e3d661ad412309e23a [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 Esfahbod13c05842012-10-14 18:37:09 -05003 [0.9.5],
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 Esfahbode297ee42012-08-10 14:49:37 -040012AM_INIT_AUTOMAKE([1.11.1 gnits dist-bzip2 no-dist-gzip -Wall no-define])
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 Esfahbodcdafe3a2012-06-05 16:34:49 -040058AC_CHECK_FUNCS(atexit mprotect sysconf getpagesize sched_yield mmap _setmode isatty)
59AC_CHECK_HEADERS(unistd.h sys/mman.h sched.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 Esfahbod0e292eb2012-10-02 14:59:00 -040091hb_os_win32=no
Behdad Esfahbod560d68a2012-08-08 17:16:01 -040092AC_MSG_CHECKING([for native Win32])
93case "$host" in
94 *-*-mingw*)
95 hb_os_win32=yes
96 ;;
Behdad Esfahbod560d68a2012-08-08 17:16:01 -040097esac
98AC_MSG_RESULT([$hb_os_win32])
99AM_CONDITIONAL(OS_WIN32, test "$hb_os_win32" = "yes")
100
Behdad Esfahbod66efe892012-10-02 14:55:32 -0400101have_pthread=false
Behdad Esfahbod0e292eb2012-10-02 14:59:00 -0400102if test "$hb_os_win32" = no; then
103 AX_PTHREAD([have_pthread=true])
104fi
Behdad Esfahbod66efe892012-10-02 14:55:32 -0400105if $have_pthread; then
106 AC_DEFINE(HAVE_PTHREAD, 1, [Have POSIX threads])
107fi
108AM_CONDITIONAL(HAVE_PTHREAD, $have_pthread)
109
Behdad Esfahbod29aa4002009-11-02 16:28:39 -0500110dnl ==========================================================================
111
Behdad Esfahbod68c75b42012-06-05 19:55:46 -0400112have_ot=true
113if $have_ot; then
114 AC_DEFINE(HAVE_OT, 1, [Have native OpenType Layout backend])
115fi
116AM_CONDITIONAL(HAVE_OT, $have_ot)
117
118dnl ===========================================================================
119
Behdad Esfahbod8fe4c742012-07-24 21:05:12 -0400120have_hb_old=true
121if $have_hb_old; then
122 AC_DEFINE(HAVE_HB_OLD, 1, [Have Old HarfBuzz backend])
123fi
124AM_CONDITIONAL(HAVE_HB_OLD, $have_hb_old)
125
126dnl ===========================================================================
127
Behdad Esfahbod3f33f0d2012-10-02 16:03:18 -0400128have_ucdn=true
129if $have_ucdn; then
130 AC_DEFINE(HAVE_UCDN, 1, [Have UCDN Unicode functions])
131fi
132AM_CONDITIONAL(HAVE_UCDN, $have_ucdn)
133
134dnl ===========================================================================
135
Behdad Esfahbode6a5b882011-05-05 16:24:42 -0400136PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.16, have_glib=true, have_glib=false)
Behdad Esfahbodf94cf6b2009-11-02 18:55:19 -0500137if $have_glib; then
Behdad Esfahbodd94647e2009-11-03 16:35:10 -0500138 AC_DEFINE(HAVE_GLIB, 1, [Have glib2 library])
Behdad Esfahbodf94cf6b2009-11-02 18:55:19 -0500139fi
Behdad Esfahbod29aa4002009-11-02 16:28:39 -0500140AM_CONDITIONAL(HAVE_GLIB, $have_glib)
141
Behdad Esfahbodc214cff2011-08-14 15:17:16 +0200142PKG_CHECK_MODULES(GTHREAD, gthread-2.0, have_gthread=true, have_gthread=false)
143if $have_gthread; then
144 AC_DEFINE(HAVE_GTHREAD, 1, [Have gthread2 library])
145fi
146AM_CONDITIONAL(HAVE_GTHREAD, $have_gthread)
147
Behdad Esfahbod3d0ddd12012-01-15 15:55:52 -0500148PKG_CHECK_MODULES(GOBJECT, gobject-2.0 glib-2.0 >= 2.16, have_gobject=true, have_gobject=false)
Behdad Esfahbodc214cff2011-08-14 15:17:16 +0200149if $have_gobject; then
150 AC_DEFINE(HAVE_GOBJECT, 1, [Have gobject2 library])
Behdad Esfahbodd75333f2011-08-19 19:59:24 +0200151 GLIB_MKENUMS=`$PKG_CONFIG --variable=glib_mkenums glib-2.0`
152 AC_SUBST(GLIB_MKENUMS)
Behdad Esfahbodc214cff2011-08-14 15:17:16 +0200153fi
154AM_CONDITIONAL(HAVE_GOBJECT, $have_gobject)
155
Behdad Esfahbod174e3fe2011-05-05 19:37:53 -0400156dnl ==========================================================================
157
Behdad Esfahbod5353bf42011-02-22 18:06:19 -0500158PKG_CHECK_MODULES(CAIRO, cairo >= 1.8.0, have_cairo=true, have_cairo=false)
159if $have_cairo; then
160 AC_DEFINE(HAVE_CAIRO, 1, [Have cairo graphics library])
161fi
162AM_CONDITIONAL(HAVE_CAIRO, $have_cairo)
163
Behdad Esfahbod5353bf42011-02-22 18:06:19 -0500164PKG_CHECK_MODULES(CAIRO_FT, cairo-ft, have_cairo_ft=true, have_cairo_ft=false)
165if $have_cairo_ft; then
166 AC_DEFINE(HAVE_CAIRO_FT, 1, [Have cairo-ft support in cairo graphics library])
167fi
168AM_CONDITIONAL(HAVE_CAIRO_FT, $have_cairo_ft)
169
Behdad Esfahbod174e3fe2011-05-05 19:37:53 -0400170dnl ==========================================================================
171
Behdad Esfahbodb161bfc2012-08-16 08:09:44 -0400172PKG_CHECK_MODULES(ICU, icu-uc, have_icu=true, have_icu=false)
Behdad Esfahbodd94647e2009-11-03 16:35:10 -0500173if $have_icu; then
174 AC_DEFINE(HAVE_ICU, 1, [Have ICU library])
175fi
176AM_CONDITIONAL(HAVE_ICU, $have_icu)
177
Behdad Esfahbod46377392011-08-24 02:12:05 +0200178dnl ==========================================================================
Behdad Esfahbod1f49cf32011-08-24 01:29:25 +0200179
Behdad Esfahbod2f7586c2012-08-23 23:59:55 -0400180PKG_CHECK_MODULES(ICU_LE, icu-le icu-uc, have_icu_le=true, have_icu_le=false)
Behdad Esfahbod7d242362012-08-23 21:23:41 -0400181if $have_icu_le; then
182 AC_DEFINE(HAVE_ICU_LE, 1, [Have ICU Layout Engine library])
183fi
184AM_CONDITIONAL(HAVE_ICU_LE, $have_icu_le)
185
186dnl ==========================================================================
187
Behdad Esfahbod6bd9b472012-04-12 14:53:53 -0400188PKG_CHECK_MODULES(GRAPHITE2, graphite2, have_graphite=true, have_graphite=false)
Behdad Esfahbod46377392011-08-24 02:12:05 +0200189if $have_graphite; then
Behdad Esfahbod6bd9b472012-04-12 14:53:53 -0400190 AC_DEFINE(HAVE_GRAPHITE2, 1, [Have Graphite library])
Behdad Esfahbod1f49cf32011-08-24 01:29:25 +0200191fi
Behdad Esfahbod6bd9b472012-04-12 14:53:53 -0400192AM_CONDITIONAL(HAVE_GRAPHITE2, $have_graphite)
Behdad Esfahbod46377392011-08-24 02:12:05 +0200193
194dnl ==========================================================================
Behdad Esfahbod174e3fe2011-05-05 19:37:53 -0400195
Behdad Esfahbod0b7e4d92011-08-15 20:41:59 +0200196PKG_CHECK_MODULES(FREETYPE, freetype2 >= 2.3.8, have_freetype=true, have_freetype=false)
Behdad Esfahbodf94cf6b2009-11-02 18:55:19 -0500197if $have_freetype; then
198 AC_DEFINE(HAVE_FREETYPE, 1, [Have FreeType 2 library])
Behdad Esfahbodcd11a982009-12-20 23:05:02 +0100199 _save_libs="$LIBS"
200 _save_cflags="$CFLAGS"
201 LIBS="$LIBS $FREETYPE_LIBS"
202 CFLAGS="$CFLAGS $FREETYPE_CFLAGS"
203 AC_CHECK_FUNCS(FT_Face_GetCharVariantIndex)
204 LIBS="$_save_libs"
205 CFLAGS="$_save_cflags"
Behdad Esfahbodf94cf6b2009-11-02 18:55:19 -0500206fi
Behdad Esfahbod29aa4002009-11-02 16:28:39 -0500207AM_CONDITIONAL(HAVE_FREETYPE, $have_freetype)
208
Behdad Esfahbodc78f4482011-05-05 21:31:04 -0400209dnl ===========================================================================
Behdad Esfahbod29aa4002009-11-02 16:28:39 -0500210
Behdad Esfahbod0fbb2dc2011-08-03 19:55:04 -0400211AC_CHECK_HEADERS(usp10.h windows.h, have_uniscribe=true, have_uniscribe=false)
212if $have_uniscribe; then
213 UNISCRIBE_CFLAGS=
214 UNISCRIBE_LIBS="-lusp10 -lgdi32"
215 AC_SUBST(UNISCRIBE_CFLAGS)
216 AC_SUBST(UNISCRIBE_LIBS)
Behdad Esfahbod02aeca92011-08-04 22:31:05 -0400217 AC_DEFINE(HAVE_UNISCRIBE, 1, [Have Uniscribe backend])
Behdad Esfahbod0fbb2dc2011-08-03 19:55:04 -0400218fi
219AM_CONDITIONAL(HAVE_UNISCRIBE, $have_uniscribe)
220
Behdad Esfahbod04bc1ee2012-06-05 20:16:56 -0400221dnl ===========================================================================
222
Jonathan Kewaa6d8492012-07-24 15:52:32 -0400223AC_CHECK_HEADERS(ApplicationServices/ApplicationServices.h, have_coretext=true, have_coretext=false)
224if $have_coretext; then
225 CORETEXT_CFLAGS=
Behdad Esfahbodae4d4e12012-08-26 14:27:44 -0400226 CORETEXT_LIBS="-framework ApplicationServices"
Jonathan Kewaa6d8492012-07-24 15:52:32 -0400227 AC_SUBST(CORETEXT_CFLAGS)
228 AC_SUBST(CORETEXT_LIBS)
229 AC_DEFINE(HAVE_CORETEXT, 1, [Have Core Text backend])
230fi
231AM_CONDITIONAL(HAVE_CORETEXT, $have_coretext)
232
233dnl ===========================================================================
234
Behdad Esfahbod04bc1ee2012-06-05 20:16:56 -0400235AC_CACHE_CHECK([for Intel atomic primitives], hb_cv_have_intel_atomic_primitives, [
236 hb_cv_have_intel_atomic_primitives=false
Behdad Esfahbod12f5c0a2012-06-26 11:16:13 -0400237 AC_TRY_LINK([
Behdad Esfahbod04bc1ee2012-06-05 20:16:56 -0400238 void memory_barrier (void) { __sync_synchronize (); }
Behdad Esfahbod12f5c0a2012-06-26 11:16:13 -0400239 int atomic_add (int *i) { return __sync_fetch_and_add (i, 1); }
240 int mutex_trylock (int *m) { return __sync_lock_test_and_set (m, 1); }
241 void mutex_unlock (int *m) { __sync_lock_release (m); }
242 ], [], hb_cv_have_intel_atomic_primitives=true
Behdad Esfahbod04bc1ee2012-06-05 20:16:56 -0400243 )
244])
245if $hb_cv_have_intel_atomic_primitives; then
246 AC_DEFINE(HAVE_INTEL_ATOMIC_PRIMITIVES, 1, [Have Intel __sync_* atomic primitives])
247fi
248
249dnl ===========================================================================
250
Behdad Esfahbod29aa4002009-11-02 16:28:39 -0500251AC_CONFIG_FILES([
Behdad Esfahbod29aa4002009-11-02 16:28:39 -0500252Makefile
Behdad Esfahbodc78f4482011-05-05 21:31:04 -0400253harfbuzz.pc
Behdad Esfahbod29aa4002009-11-02 16:28:39 -0500254src/Makefile
Behdad Esfahbodc78f4482011-05-05 21:31:04 -0400255src/hb-version.h
Behdad Esfahbod7d242362012-08-23 21:23:41 -0400256src/hb-icu-le/Makefile
Behdad Esfahbod3f33f0d2012-10-02 16:03:18 -0400257src/hb-old/Makefile
258src/hb-ucdn/Makefile
Behdad Esfahbod511a1362011-08-09 15:03:00 +0200259util/Makefile
Behdad Esfahbodbbdeff52011-04-07 16:05:07 -0400260test/Makefile
Behdad Esfahbod4d6dafd2012-01-19 14:52:02 -0500261test/api/Makefile
Behdad Esfahbodd4de5622012-01-19 15:21:04 -0500262test/shaping/Makefile
Behdad Esfahbod29aa4002009-11-02 16:28:39 -0500263])
264
265AC_OUTPUT