• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1AC_PREREQ([2.64])
2AC_INIT([HarfBuzz],
3        [0.9.14],
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 color-tests])
13AM_SILENT_RULES([yes])
14
15# Initialize libtool
16AM_PROG_AR
17LT_PREREQ([2.2])
18LT_INIT([disable-static])
19
20# Check for programs
21AC_PROG_CC
22AM_PROG_CC_C_O
23AC_PROG_CXX
24PKG_PROG_PKG_CONFIG([0.20])
25
26# Version
27m4_define(hb_version_triplet,m4_split(AC_PACKAGE_VERSION,[[.]]))
28m4_define(hb_version_major,m4_argn(1,hb_version_triplet))
29m4_define(hb_version_minor,m4_argn(2,hb_version_triplet))
30m4_define(hb_version_micro,m4_argn(3,hb_version_triplet))
31HB_VERSION_MAJOR=hb_version_major
32HB_VERSION_MINOR=hb_version_minor
33HB_VERSION_MICRO=hb_version_micro
34HB_VERSION=AC_PACKAGE_VERSION
35AC_SUBST(HB_VERSION_MAJOR)
36AC_SUBST(HB_VERSION_MINOR)
37AC_SUBST(HB_VERSION_MICRO)
38AC_SUBST(HB_VERSION)
39
40# Libtool version
41m4_define([hb_version_int],
42	  m4_eval(hb_version_major*10000 + hb_version_minor*100 + hb_version_micro))
43m4_if(m4_eval(hb_version_minor % 2), [1],
44      dnl for unstable releases
45      [m4_define([hb_libtool_revision], 0)],
46      dnl for stable releases
47      [m4_define([hb_libtool_revision], hb_version_micro)])
48m4_define([hb_libtool_age],
49	  m4_eval(hb_version_int - hb_libtool_revision))
50m4_define([hb_libtool_current],
51	  m4_eval(hb_version_major + hb_libtool_age))
52HB_LIBTOOL_VERSION_INFO=hb_libtool_current:hb_libtool_revision:hb_libtool_age
53AC_SUBST(HB_LIBTOOL_VERSION_INFO)
54
55dnl GOBJECT_INTROSPECTION_CHECK([0.9.0])
56dnl GTK_DOC_CHECK([1.15],[--flavour no-tmpl])
57
58# Functions and headers
59AC_CHECK_FUNCS(atexit mprotect sysconf getpagesize mmap isatty)
60AC_CHECK_HEADERS(unistd.h sys/mman.h)
61
62# Compiler flags
63AC_CANONICAL_HOST
64if test "x$GCC" = "xyes"; then
65
66	# Make symbols link locally
67	LDFLAGS="$LDFLAGS -Bsymbolic-functions"
68
69	# Make sure we don't link to libstdc++
70	CXXFLAGS="$CXXFLAGS -fno-rtti -fno-exceptions"
71
72	# Assorted warnings
73	CXXFLAGS="$CXXFLAGS -Wcast-align"
74
75	case "$host" in
76		*-*-mingw*)
77		;;
78		*)
79			# Hide inline methods
80			CXXFLAGS="$CXXFLAGS -fvisibility-inlines-hidden"
81		;;
82	esac
83
84	case "$host" in
85		arm-*-*)
86			# Request byte alignment on arm
87			CXXFLAGS="$CXXFLAGS -mstructure-size-boundary=8"
88		;;
89	esac
90fi
91
92AM_CONDITIONAL(HAVE_GCC, test "x$GCC" = "xyes")
93
94hb_os_win32=no
95AC_MSG_CHECKING([for native Win32])
96case "$host" in
97  *-*-mingw*)
98    hb_os_win32=yes
99    ;;
100esac
101AC_MSG_RESULT([$hb_os_win32])
102AM_CONDITIONAL(OS_WIN32, test "$hb_os_win32" = "yes")
103
104have_pthread=false
105if test "$hb_os_win32" = no; then
106	AX_PTHREAD([have_pthread=true])
107fi
108if $have_pthread; then
109	AC_DEFINE(HAVE_PTHREAD, 1, [Have POSIX threads])
110fi
111AM_CONDITIONAL(HAVE_PTHREAD, $have_pthread)
112
113dnl ==========================================================================
114
115have_ot=true
116if $have_ot; then
117	AC_DEFINE(HAVE_OT, 1, [Have native OpenType Layout backend])
118fi
119AM_CONDITIONAL(HAVE_OT, $have_ot)
120
121dnl ===========================================================================
122
123have_hb_old=true
124if $have_hb_old; then
125	AC_DEFINE(HAVE_HB_OLD, 1, [Have Old HarfBuzz backend])
126fi
127AM_CONDITIONAL(HAVE_HB_OLD, $have_hb_old)
128
129dnl ===========================================================================
130
131have_ucdn=true
132if $have_ucdn; then
133	AC_DEFINE(HAVE_UCDN, 1, [Have UCDN Unicode functions])
134fi
135AM_CONDITIONAL(HAVE_UCDN, $have_ucdn)
136
137dnl ===========================================================================
138
139PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.16, have_glib=true, have_glib=false)
140if $have_glib; then
141	AC_DEFINE(HAVE_GLIB, 1, [Have glib2 library])
142fi
143AM_CONDITIONAL(HAVE_GLIB, $have_glib)
144
145PKG_CHECK_MODULES(GTHREAD, gthread-2.0, have_gthread=true, have_gthread=false)
146if $have_gthread; then
147	AC_DEFINE(HAVE_GTHREAD, 1, [Have gthread2 library])
148fi
149AM_CONDITIONAL(HAVE_GTHREAD, $have_gthread)
150
151PKG_CHECK_MODULES(GOBJECT, gobject-2.0 glib-2.0 >= 2.16, have_gobject=true, have_gobject=false)
152if $have_gobject; then
153	AC_DEFINE(HAVE_GOBJECT, 1, [Have gobject2 library])
154	GLIB_MKENUMS=`$PKG_CONFIG --variable=glib_mkenums glib-2.0`
155	AC_SUBST(GLIB_MKENUMS)
156fi
157AM_CONDITIONAL(HAVE_GOBJECT, $have_gobject)
158
159dnl ==========================================================================
160
161PKG_CHECK_MODULES(CAIRO, cairo >= 1.8.0, have_cairo=true, have_cairo=false)
162if $have_cairo; then
163	AC_DEFINE(HAVE_CAIRO, 1, [Have cairo graphics library])
164fi
165AM_CONDITIONAL(HAVE_CAIRO, $have_cairo)
166
167PKG_CHECK_MODULES(CAIRO_FT, cairo-ft, have_cairo_ft=true, have_cairo_ft=false)
168if $have_cairo_ft; then
169	AC_DEFINE(HAVE_CAIRO_FT, 1, [Have cairo-ft support in cairo graphics library])
170fi
171AM_CONDITIONAL(HAVE_CAIRO_FT, $have_cairo_ft)
172
173dnl ==========================================================================
174
175PKG_CHECK_MODULES(ICU, icu-uc, have_icu=true, have_icu=false)
176dnl Fallback to icu-config if ICU pkg-config files could not be found
177if test "$have_icu" != "true"; then
178	AC_PATH_PROG(icu_config, icu-config, no)
179	AC_MSG_CHECKING([for ICU by using icu-config fallback])
180	if test "$icu_config" != "no" && "$icu_config" --version >/dev/null; then
181		have_icu=true
182		# We don't use --cflags as this gives us a lot of things that we don't
183		# necessarily want, like debugging and optimization flags
184		# See man (1) icu-config for more info.
185		ICU_CFLAGS=`$icu_config --cppflags`
186		ICU_LIBS=`$icu_config --ldflags-libsonly`
187		AC_SUBST(ICU_CFLAGS)
188		AC_SUBST(ICU_LIBS)
189		AC_MSG_RESULT([yes])
190	else
191		AC_MSG_RESULT([no])
192	fi
193fi
194
195if $have_icu; then
196	CXXFLAGS="$CXXFLAGS `$PKG_CONFIG --variable=CXXFLAGS icu-uc`"
197	AC_DEFINE(HAVE_ICU, 1, [Have ICU library])
198fi
199AM_CONDITIONAL(HAVE_ICU, $have_icu)
200
201dnl ==========================================================================
202
203PKG_CHECK_MODULES(ICU_LE, icu-le icu-uc, have_icu_le=true, have_icu_le=false)
204dnl Fallback to icu-config if ICU pkg-config files could not be found
205if test "$have_icu_le" != "true"; then
206	AC_PATH_PROG(icu_config, icu-config, no)
207	AC_MSG_CHECKING([for ICU_LE by using icu-config fallback])
208	if test "$icu_config" != "no" && "$icu_config" --version >/dev/null; then
209		have_icu_le=true
210		# We don't use --cflags as this gives us a lot of things that we don't
211		# necessarily want, like debugging and optimization flags
212		# See man (1) icu-config for more info.
213		ICU_LE_CFLAGS=`$icu_config --cppflags`
214		ICU_LE_LIBS=`$icu_config --ldflags-libsonly --ldflags-layout`
215		AC_SUBST(ICU_LE_CFLAGS)
216		AC_SUBST(ICU_LE_LIBS)
217		AC_MSG_RESULT([yes])
218	else
219		AC_MSG_RESULT([no])
220	fi
221fi
222if $have_icu_le; then
223	AC_DEFINE(HAVE_ICU_LE, 1, [Have ICU Layout Engine library])
224fi
225AM_CONDITIONAL(HAVE_ICU_LE, $have_icu_le)
226
227dnl ==========================================================================
228
229PKG_CHECK_MODULES(GRAPHITE2, graphite2, have_graphite=true, have_graphite=false)
230if $have_graphite; then
231    AC_DEFINE(HAVE_GRAPHITE2, 1, [Have Graphite library])
232fi
233AM_CONDITIONAL(HAVE_GRAPHITE2, $have_graphite)
234
235dnl ==========================================================================
236
237PKG_CHECK_MODULES(FREETYPE, freetype2 >= 2.3.8, have_freetype=true, have_freetype=false)
238if $have_freetype; then
239	AC_DEFINE(HAVE_FREETYPE, 1, [Have FreeType 2 library])
240	_save_libs="$LIBS"
241	_save_cflags="$CFLAGS"
242	LIBS="$LIBS $FREETYPE_LIBS"
243	CFLAGS="$CFLAGS $FREETYPE_CFLAGS"
244	AC_CHECK_FUNCS(FT_Face_GetCharVariantIndex)
245	LIBS="$_save_libs"
246	CFLAGS="$_save_cflags"
247fi
248AM_CONDITIONAL(HAVE_FREETYPE, $have_freetype)
249
250dnl ===========================================================================
251
252AC_MSG_CHECKING([for ScriptShapeOpenType in usp10])
253saved_LIBS=$LIBS
254LIBS="$LIBS -lusp10 -lgdi32"
255AC_LINK_IFELSE([AC_LANG_PROGRAM(
256	[[
257	 #define _WIN32_WINNT 0x0600
258	 #include <windows.h>
259	 #include <usp10.h>
260	 ]],
261	ScriptShapeOpenType)],
262	[have_uniscribe=true; AC_MSG_RESULT(yes)],
263	[have_uniscribe=false;AC_MSG_RESULT(no)])
264LIBS=$saved_LIBS
265if $have_uniscribe; then
266	UNISCRIBE_CFLAGS=
267	UNISCRIBE_LIBS="-lusp10 -lgdi32"
268	AC_SUBST(UNISCRIBE_CFLAGS)
269	AC_SUBST(UNISCRIBE_LIBS)
270	AC_DEFINE(HAVE_UNISCRIBE, 1, [Have Uniscribe backend])
271fi
272AM_CONDITIONAL(HAVE_UNISCRIBE, $have_uniscribe)
273
274dnl ===========================================================================
275
276AC_CHECK_TYPE(CTFontRef, have_coretext=true, have_coretext=false, [#include <ApplicationServices/ApplicationServices.h>])
277if $have_coretext; then
278	CORETEXT_CFLAGS=
279	CORETEXT_LIBS="-framework ApplicationServices"
280	AC_SUBST(CORETEXT_CFLAGS)
281	AC_SUBST(CORETEXT_LIBS)
282	AC_DEFINE(HAVE_CORETEXT, 1, [Have Core Text backend])
283fi
284AM_CONDITIONAL(HAVE_CORETEXT, $have_coretext)
285
286dnl ===========================================================================
287
288AC_CACHE_CHECK([for Intel atomic primitives], hb_cv_have_intel_atomic_primitives, [
289	hb_cv_have_intel_atomic_primitives=false
290	AC_TRY_LINK([
291		void memory_barrier (void) { __sync_synchronize (); }
292		int atomic_add (int *i) { return __sync_fetch_and_add (i, 1); }
293		int mutex_trylock (int *m) { return __sync_lock_test_and_set (m, 1); }
294		void mutex_unlock (int *m) { __sync_lock_release (m); }
295		], [], hb_cv_have_intel_atomic_primitives=true
296	)
297])
298if $hb_cv_have_intel_atomic_primitives; then
299	AC_DEFINE(HAVE_INTEL_ATOMIC_PRIMITIVES, 1, [Have Intel __sync_* atomic primitives])
300fi
301
302dnl ===========================================================================
303
304AC_CACHE_CHECK([for Solaris atomic operations], hb_cv_have_solaris_atomic_ops, [
305	hb_cv_have_solaris_atomic_ops=false
306	AC_TRY_LINK([
307		#include <atomic.h>
308		/* This requires Solaris Studio 12.2 or newer: */
309		#include <mbarrier.h>
310		void memory_barrier (void) { __machine_rw_barrier (); }
311		int atomic_add (volatile unsigned *i) { return atomic_add_int_nv (i, 1); }
312		void *atomic_ptr_cmpxchg (volatile void **target, void *cmp, void *newval) { return atomic_cas_ptr (target, cmp, newval); }
313		], [], hb_cv_have_solaris_atomic_ops=true
314	)
315])
316if $hb_cv_have_solaris_atomic_ops; then
317	AC_DEFINE(HAVE_SOLARIS_ATOMIC_OPS, 1, [Have Solaris __machine_*_barrier and atomic_* operations])
318fi
319
320if test "$os_win32" = no && ! $have_pthread; then
321	AC_CHECK_HEADERS(sched.h)
322	AC_SEARCH_LIBS(sched_yield,rt,AC_DEFINE(HAVE_SCHED_YIELD, 1, [Have sched_yield]))
323fi
324
325dnl ===========================================================================
326
327AC_CONFIG_FILES([
328Makefile
329harfbuzz.pc
330src/Makefile
331src/hb-version.h
332src/hb-icu-le/Makefile
333src/hb-old/Makefile
334src/hb-ucdn/Makefile
335util/Makefile
336test/Makefile
337test/api/Makefile
338test/shaping/Makefile
339])
340
341AC_OUTPUT
342
343AC_MSG_NOTICE([
344
345Build configuration:
346
347Unicode callbacks (you want at least one):
348	Glib:			${have_glib}
349	ICU:			${have_icu}
350	UCDN:			${have_ucdn}
351
352Font callbacks (the more the better):
353	FreeType:		${have_freetype}
354
355Tools used for command-line utilities:
356	Cairo:			${have_cairo}
357
358Additional shapers (the more the better):
359	Graphite2:		${have_graphite}
360
361Test / platform shapers (not normally needed):
362	CoreText:		${have_coretext}
363	ICU Layout Engine:	${have_icu_le}
364	Old HarfBuzz:		${have_hb_old}
365	Uniscribe:		${have_uniscribe}
366])
367