configure.ac revision e5dbf39900fa63051f64cc447a6742665cbee339
1AC_PREREQ([2.64])
2AC_INIT([HarfBuzz],
3        [0.9.10],
4        [http://bugs.freedesktop.org/enter_bug.cgi?product=harfbuzz],
5        [harfbuzz],
6        [http://harfbuzz.org/])
7
8AC_CONFIG_MACRO_DIR([m4])
9AC_CONFIG_SRCDIR([harfbuzz.pc.in])
10AC_CONFIG_HEADERS([config.h])
11
12AM_INIT_AUTOMAKE([1.11.1 gnits dist-bzip2 no-dist-gzip -Wall no-define])
13AM_SILENT_RULES([yes])
14
15# Initialize libtool
16LT_PREREQ([2.2])
17LT_INIT([disable-static])
18
19# Check for programs
20AC_PROG_CC
21AM_PROG_CC_C_O
22AC_PROG_CXX
23PKG_PROG_PKG_CONFIG([0.20])
24
25# Version
26m4_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
33HB_VERSION=AC_PACKAGE_VERSION
34AC_SUBST(HB_VERSION_MAJOR)
35AC_SUBST(HB_VERSION_MINOR)
36AC_SUBST(HB_VERSION_MICRO)
37AC_SUBST(HB_VERSION)
38
39# 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)
53
54dnl GOBJECT_INTROSPECTION_CHECK([0.9.0])
55dnl GTK_DOC_CHECK([1.15],[--flavour no-tmpl])
56
57# Functions and headers
58AC_CHECK_FUNCS(atexit mprotect sysconf getpagesize sched_yield mmap _setmode isatty)
59AC_CHECK_HEADERS(unistd.h sys/mman.h sched.h io.h)
60
61# Compiler flags
62AC_CANONICAL_HOST
63if test "x$GCC" = "xyes"; then
64
65	# Make symbols link locally
66	LDFLAGS="$LDFLAGS -Bsymbolic-functions"
67
68	# Make sure we don't link to libstdc++
69	CXXFLAGS="$CXXFLAGS -fno-rtti -fno-exceptions"
70
71	# Assorted warnings
72	CXXFLAGS="$CXXFLAGS -Wcast-align"
73
74	case "$host" in
75		*-*-mingw*)
76		;;
77		*)
78			# Hide inline methods
79			CXXFLAGS="$CXXFLAGS -fvisibility-inlines-hidden"
80		;;
81	esac
82
83	case "$host" in
84		arm-*-*)
85			# Request byte alignment on arm
86			CXXFLAGS="$CXXFLAGS -mstructure-size-boundary=8"
87		;;
88	esac
89fi
90
91hb_os_win32=no
92AC_MSG_CHECKING([for native Win32])
93case "$host" in
94  *-*-mingw*)
95    hb_os_win32=yes
96    ;;
97esac
98AC_MSG_RESULT([$hb_os_win32])
99AM_CONDITIONAL(OS_WIN32, test "$hb_os_win32" = "yes")
100
101have_pthread=false
102if test "$hb_os_win32" = no; then
103	AX_PTHREAD([have_pthread=true])
104fi
105if $have_pthread; then
106	AC_DEFINE(HAVE_PTHREAD, 1, [Have POSIX threads])
107fi
108AM_CONDITIONAL(HAVE_PTHREAD, $have_pthread)
109
110dnl ==========================================================================
111
112have_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
120have_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
128have_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
136PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.16, have_glib=true, have_glib=false)
137if $have_glib; then
138	AC_DEFINE(HAVE_GLIB, 1, [Have glib2 library])
139fi
140AM_CONDITIONAL(HAVE_GLIB, $have_glib)
141
142PKG_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
148PKG_CHECK_MODULES(GOBJECT, gobject-2.0 glib-2.0 >= 2.16, have_gobject=true, have_gobject=false)
149if $have_gobject; then
150	AC_DEFINE(HAVE_GOBJECT, 1, [Have gobject2 library])
151	GLIB_MKENUMS=`$PKG_CONFIG --variable=glib_mkenums glib-2.0`
152	AC_SUBST(GLIB_MKENUMS)
153fi
154AM_CONDITIONAL(HAVE_GOBJECT, $have_gobject)
155
156dnl ==========================================================================
157
158PKG_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
164PKG_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
170dnl ==========================================================================
171
172PKG_CHECK_MODULES(ICU, icu-uc, have_icu=true, have_icu=false)
173if $have_icu; then
174	CXXFLAGS="$CXXFLAGS `$PKG_CONFIG --variable=CXXFLAGS icu-uc`"
175	AC_DEFINE(HAVE_ICU, 1, [Have ICU library])
176fi
177AM_CONDITIONAL(HAVE_ICU, $have_icu)
178
179dnl ==========================================================================
180
181PKG_CHECK_MODULES(ICU_LE, icu-le icu-uc, have_icu_le=true, have_icu_le=false)
182if $have_icu_le; then
183	AC_DEFINE(HAVE_ICU_LE, 1, [Have ICU Layout Engine library])
184fi
185AM_CONDITIONAL(HAVE_ICU_LE, $have_icu_le)
186
187dnl ==========================================================================
188
189PKG_CHECK_MODULES(GRAPHITE2, graphite2, have_graphite=true, have_graphite=false)
190if $have_graphite; then
191    AC_DEFINE(HAVE_GRAPHITE2, 1, [Have Graphite library])
192fi
193AM_CONDITIONAL(HAVE_GRAPHITE2, $have_graphite)
194
195dnl ==========================================================================
196
197PKG_CHECK_MODULES(FREETYPE, freetype2 >= 2.3.8, have_freetype=true, have_freetype=false)
198if $have_freetype; then
199	AC_DEFINE(HAVE_FREETYPE, 1, [Have FreeType 2 library])
200	_save_libs="$LIBS"
201	_save_cflags="$CFLAGS"
202	LIBS="$LIBS $FREETYPE_LIBS"
203	CFLAGS="$CFLAGS $FREETYPE_CFLAGS"
204	AC_CHECK_FUNCS(FT_Face_GetCharVariantIndex)
205	LIBS="$_save_libs"
206	CFLAGS="$_save_cflags"
207fi
208AM_CONDITIONAL(HAVE_FREETYPE, $have_freetype)
209
210dnl ===========================================================================
211
212AC_MSG_CHECKING([for ScriptShapeOpenType in usp10])
213saved_LIBS=$LIBS
214LIBS="$LIBS -lusp10 -lgdi32"
215AC_LINK_IFELSE([AC_LANG_PROGRAM(
216	[[
217	 #define _WIN32_WINNT 0x0600
218	 #include <windows.h>
219	 #include <usp10.h>
220	 ]],
221	ScriptShapeOpenType)],
222	[have_uniscribe=true; AC_MSG_RESULT(yes)],
223	[have_uniscribe=false;AC_MSG_RESULT(no)])
224LIBS=$saved_LIBS
225if $have_uniscribe; then
226	UNISCRIBE_CFLAGS=
227	UNISCRIBE_LIBS="-lusp10 -lgdi32"
228	AC_SUBST(UNISCRIBE_CFLAGS)
229	AC_SUBST(UNISCRIBE_LIBS)
230	AC_DEFINE(HAVE_UNISCRIBE, 1, [Have Uniscribe backend])
231fi
232AM_CONDITIONAL(HAVE_UNISCRIBE, $have_uniscribe)
233
234dnl ===========================================================================
235
236AC_CHECK_TYPE(CTFontRef, have_coretext=true, have_coretext=false, [#include <ApplicationServices/ApplicationServices.h>])
237if $have_coretext; then
238	CORETEXT_CFLAGS=
239	CORETEXT_LIBS="-framework ApplicationServices"
240	AC_SUBST(CORETEXT_CFLAGS)
241	AC_SUBST(CORETEXT_LIBS)
242	AC_DEFINE(HAVE_CORETEXT, 1, [Have Core Text backend])
243fi
244AM_CONDITIONAL(HAVE_CORETEXT, $have_coretext)
245
246dnl ===========================================================================
247
248AC_CACHE_CHECK([for Intel atomic primitives], hb_cv_have_intel_atomic_primitives, [
249	hb_cv_have_intel_atomic_primitives=false
250	AC_TRY_LINK([
251		void memory_barrier (void) { __sync_synchronize (); }
252		int atomic_add (int *i) { return __sync_fetch_and_add (i, 1); }
253		int mutex_trylock (int *m) { return __sync_lock_test_and_set (m, 1); }
254		void mutex_unlock (int *m) { __sync_lock_release (m); }
255		], [], hb_cv_have_intel_atomic_primitives=true
256	)
257])
258if $hb_cv_have_intel_atomic_primitives; then
259	AC_DEFINE(HAVE_INTEL_ATOMIC_PRIMITIVES, 1, [Have Intel __sync_* atomic primitives])
260fi
261
262dnl ===========================================================================
263
264AC_CONFIG_FILES([
265Makefile
266harfbuzz.pc
267src/Makefile
268src/hb-version.h
269src/hb-icu-le/Makefile
270src/hb-old/Makefile
271src/hb-ucdn/Makefile
272util/Makefile
273test/Makefile
274test/api/Makefile
275test/shaping/Makefile
276])
277
278AC_OUTPUT
279
280AC_MSG_NOTICE([
281
282Build configuration:
283
284Unicode callbacks (you want at least one):
285	Glib:			${have_glib}
286	ICU:			${have_icu}
287	UCDN:			${have_ucdn}
288
289Font callbacks (the more the better):
290	FreeType:		${have_freetype}
291
292Tools used for command-line utilities:
293	Cairo:			${have_cairo}
294
295Additional shapers (the more the better):
296	Graphite2:		${have_graphite}
297
298Test / platform shapers (not normally needed):
299	CoreText:		${have_coretext}
300	ICU Layout Engine:	${have_icu_le}
301	Old HarfBuzz:		${have_hb_old}
302	Uniscribe:		${have_uniscribe}
303])
304