configure.ac 7.9 KB
Newer Older
1
AC_PREREQ([2.64])
B
Minor  
Behdad Esfahbod 已提交
2
AC_INIT([HarfBuzz],
B
0.9.9  
Behdad Esfahbod 已提交
3
        [0.9.9],
4 5
        [http://bugs.freedesktop.org/enter_bug.cgi?product=harfbuzz],
        [harfbuzz],
B
Behdad Esfahbod 已提交
6
        [http://harfbuzz.org/])
7

B
Behdad Esfahbod 已提交
8
AC_CONFIG_MACRO_DIR([m4])
B
Behdad Esfahbod 已提交
9 10
AC_CONFIG_SRCDIR([harfbuzz.pc.in])
AC_CONFIG_HEADERS([config.h])
11

B
Behdad Esfahbod 已提交
12
AM_INIT_AUTOMAKE([1.11.1 gnits dist-bzip2 no-dist-gzip -Wall no-define])
13
AM_SILENT_RULES([yes])
B
Behdad Esfahbod 已提交
14

B
Minor  
Behdad Esfahbod 已提交
15 16 17 18
# Initialize libtool
LT_PREREQ([2.2])
LT_INIT([disable-static])

19
# Check for programs
B
Behdad Esfahbod 已提交
20
AC_PROG_CC
B
Behdad Esfahbod 已提交
21
AM_PROG_CC_C_O
B
Behdad Esfahbod 已提交
22
AC_PROG_CXX
B
Behdad Esfahbod 已提交
23
PKG_PROG_PKG_CONFIG([0.20])
B
Behdad Esfahbod 已提交
24

25
# Version
B
Behdad Esfahbod 已提交
26 27 28 29 30 31 32
m4_define(hb_version_triplet,m4_split(AC_PACKAGE_VERSION,[[.]]))
m4_define(hb_version_major,m4_argn(1,hb_version_triplet))
m4_define(hb_version_minor,m4_argn(2,hb_version_triplet))
m4_define(hb_version_micro,m4_argn(3,hb_version_triplet))
HB_VERSION_MAJOR=hb_version_major
HB_VERSION_MINOR=hb_version_minor
HB_VERSION_MICRO=hb_version_micro
33 34 35 36 37 38
HB_VERSION=AC_PACKAGE_VERSION
AC_SUBST(HB_VERSION_MAJOR)
AC_SUBST(HB_VERSION_MINOR)
AC_SUBST(HB_VERSION_MICRO)
AC_SUBST(HB_VERSION)

B
Behdad Esfahbod 已提交
39 40 41 42 43 44 45 46 47 48 49 50 51 52
# Libtool version
m4_define([hb_version_int],
	  m4_eval(hb_version_major*10000 + hb_version_minor*100 + hb_version_micro))
m4_if(m4_eval(hb_version_minor % 2), [1],
      dnl for unstable releases
      [m4_define([hb_libtool_revision], 0)],
      dnl for stable releases
      [m4_define([hb_libtool_revision], hb_version_micro)])
m4_define([hb_libtool_age],
	  m4_eval(hb_version_int - hb_libtool_revision))
m4_define([hb_libtool_current],
	  m4_eval(hb_version_major + hb_libtool_age))
HB_LIBTOOL_VERSION_INFO=hb_libtool_current:hb_libtool_revision:hb_libtool_age
AC_SUBST(HB_LIBTOOL_VERSION_INFO)
53

B
Behdad Esfahbod 已提交
54
dnl GOBJECT_INTROSPECTION_CHECK([0.9.0])
B
Behdad Esfahbod 已提交
55
dnl GTK_DOC_CHECK([1.15],[--flavour no-tmpl])
56

B
Behdad Esfahbod 已提交
57
# Functions and headers
58 59
AC_CHECK_FUNCS(atexit mprotect sysconf getpagesize sched_yield mmap _setmode isatty)
AC_CHECK_HEADERS(unistd.h sys/mman.h sched.h io.h)
B
Behdad Esfahbod 已提交
60

B
Behdad Esfahbod 已提交
61
# Compiler flags
62
AC_CANONICAL_HOST
B
Behdad Esfahbod 已提交
63
if test "x$GCC" = "xyes"; then
64

65 66 67
	# Make symbols link locally
	LDFLAGS="$LDFLAGS -Bsymbolic-functions"

68
	# Make sure we don't link to libstdc++
B
Behdad Esfahbod 已提交
69
	CXXFLAGS="$CXXFLAGS -fno-rtti -fno-exceptions"
70

B
Behdad Esfahbod 已提交
71 72 73
	# Assorted warnings
	CXXFLAGS="$CXXFLAGS -Wcast-align"

B
Behdad Esfahbod 已提交
74
	case "$host" in
75
		*-*-mingw*)
B
Behdad Esfahbod 已提交
76 77 78 79 80 81 82
		;;
		*)
			# Hide inline methods
			CXXFLAGS="$CXXFLAGS -fvisibility-inlines-hidden"
		;;
	esac

83 84 85 86 87 88
	case "$host" in
		arm-*-*)
			# Request byte alignment on arm
			CXXFLAGS="$CXXFLAGS -mstructure-size-boundary=8"
		;;
	esac
B
Behdad Esfahbod 已提交
89 90
fi

91
hb_os_win32=no
92 93 94 95 96 97 98 99 100
AC_MSG_CHECKING([for native Win32])
case "$host" in
  *-*-mingw*)
    hb_os_win32=yes
    ;;
esac
AC_MSG_RESULT([$hb_os_win32])
AM_CONDITIONAL(OS_WIN32, test "$hb_os_win32" = "yes")

B
Behdad Esfahbod 已提交
101
have_pthread=false
102 103 104
if test "$hb_os_win32" = no; then
	AX_PTHREAD([have_pthread=true])
fi
B
Behdad Esfahbod 已提交
105 106 107 108 109
if $have_pthread; then
	AC_DEFINE(HAVE_PTHREAD, 1, [Have POSIX threads])
fi
AM_CONDITIONAL(HAVE_PTHREAD, $have_pthread)

B
Behdad Esfahbod 已提交
110 111
dnl ==========================================================================

B
Shuffle  
Behdad Esfahbod 已提交
112 113 114 115 116 117 118 119
have_ot=true
if $have_ot; then
	AC_DEFINE(HAVE_OT, 1, [Have native OpenType Layout backend])
fi
AM_CONDITIONAL(HAVE_OT, $have_ot)

dnl ===========================================================================

120 121 122 123 124 125 126 127
have_hb_old=true
if $have_hb_old; then
	AC_DEFINE(HAVE_HB_OLD, 1, [Have Old HarfBuzz backend])
fi
AM_CONDITIONAL(HAVE_HB_OLD, $have_hb_old)

dnl ===========================================================================

B
Behdad Esfahbod 已提交
128 129 130 131 132 133 134 135
have_ucdn=true
if $have_ucdn; then
	AC_DEFINE(HAVE_UCDN, 1, [Have UCDN Unicode functions])
fi
AM_CONDITIONAL(HAVE_UCDN, $have_ucdn)

dnl ===========================================================================

B
Behdad Esfahbod 已提交
136
PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.16, have_glib=true, have_glib=false)
137
if $have_glib; then
B
Behdad Esfahbod 已提交
138
	AC_DEFINE(HAVE_GLIB, 1, [Have glib2 library])
139
fi
B
Behdad Esfahbod 已提交
140 141
AM_CONDITIONAL(HAVE_GLIB, $have_glib)

142 143 144 145 146 147
PKG_CHECK_MODULES(GTHREAD, gthread-2.0, have_gthread=true, have_gthread=false)
if $have_gthread; then
	AC_DEFINE(HAVE_GTHREAD, 1, [Have gthread2 library])
fi
AM_CONDITIONAL(HAVE_GTHREAD, $have_gthread)

148
PKG_CHECK_MODULES(GOBJECT, gobject-2.0 glib-2.0 >= 2.16, have_gobject=true, have_gobject=false)
149 150
if $have_gobject; then
	AC_DEFINE(HAVE_GOBJECT, 1, [Have gobject2 library])
151 152
	GLIB_MKENUMS=`$PKG_CONFIG --variable=glib_mkenums glib-2.0`
	AC_SUBST(GLIB_MKENUMS)
153 154 155
fi
AM_CONDITIONAL(HAVE_GOBJECT, $have_gobject)

B
Behdad Esfahbod 已提交
156 157
dnl ==========================================================================

B
Behdad Esfahbod 已提交
158 159 160 161 162 163 164 165 166 167 168 169
PKG_CHECK_MODULES(CAIRO, cairo >= 1.8.0, have_cairo=true, have_cairo=false)
if $have_cairo; then
	AC_DEFINE(HAVE_CAIRO, 1, [Have cairo graphics library])
fi
AM_CONDITIONAL(HAVE_CAIRO, $have_cairo)

PKG_CHECK_MODULES(CAIRO_FT, cairo-ft, have_cairo_ft=true, have_cairo_ft=false)
if $have_cairo_ft; then
	AC_DEFINE(HAVE_CAIRO_FT, 1, [Have cairo-ft support in cairo graphics library])
fi
AM_CONDITIONAL(HAVE_CAIRO_FT, $have_cairo_ft)

B
Behdad Esfahbod 已提交
170 171
dnl ==========================================================================

172
PKG_CHECK_MODULES(ICU, icu-uc, have_icu=true, have_icu=false)
B
Behdad Esfahbod 已提交
173 174 175 176 177
if $have_icu; then
	AC_DEFINE(HAVE_ICU, 1, [Have ICU library])
fi
AM_CONDITIONAL(HAVE_ICU, $have_icu)

B
Behdad Esfahbod 已提交
178
dnl ==========================================================================
179

180
PKG_CHECK_MODULES(ICU_LE, icu-le icu-uc, have_icu_le=true, have_icu_le=false)
181 182 183 184 185 186 187
if $have_icu_le; then
	AC_DEFINE(HAVE_ICU_LE, 1, [Have ICU Layout Engine library])
fi
AM_CONDITIONAL(HAVE_ICU_LE, $have_icu_le)

dnl ==========================================================================

188
PKG_CHECK_MODULES(GRAPHITE2, graphite2, have_graphite=true, have_graphite=false)
B
Behdad Esfahbod 已提交
189
if $have_graphite; then
190
    AC_DEFINE(HAVE_GRAPHITE2, 1, [Have Graphite library])
191
fi
192
AM_CONDITIONAL(HAVE_GRAPHITE2, $have_graphite)
B
Behdad Esfahbod 已提交
193 194

dnl ==========================================================================
B
Behdad Esfahbod 已提交
195

196
PKG_CHECK_MODULES(FREETYPE, freetype2 >= 2.3.8, have_freetype=true, have_freetype=false)
197 198
if $have_freetype; then
	AC_DEFINE(HAVE_FREETYPE, 1, [Have FreeType 2 library])
B
Behdad Esfahbod 已提交
199 200 201 202 203 204 205
	_save_libs="$LIBS"
	_save_cflags="$CFLAGS"
	LIBS="$LIBS $FREETYPE_LIBS"
	CFLAGS="$CFLAGS $FREETYPE_CFLAGS"
	AC_CHECK_FUNCS(FT_Face_GetCharVariantIndex)
	LIBS="$_save_libs"
	CFLAGS="$_save_cflags"
206
fi
B
Behdad Esfahbod 已提交
207 208
AM_CONDITIONAL(HAVE_FREETYPE, $have_freetype)

209
dnl ===========================================================================
B
Behdad Esfahbod 已提交
210

211 212 213 214 215 216 217 218 219 220 221 222 223
AC_MSG_CHECKING([for ScriptShapeOpenType in usp10])
saved_LIBS=$LIBS
LIBS="$LIBS -lusp10 -lgdi32"
AC_LINK_IFELSE([AC_LANG_PROGRAM(
	[[
	 #define _WIN32_WINNT 0x0600
	 #include <windows.h>
	 #include <usp10.h>
	 ]],
	ScriptShapeOpenType)],
	[have_uniscribe=true; AC_MSG_RESULT(yes)],
	[have_uniscribe=false;AC_MSG_RESULT(no)])
LIBS=$saved_LIBS
224 225 226 227 228
if $have_uniscribe; then
	UNISCRIBE_CFLAGS=
	UNISCRIBE_LIBS="-lusp10 -lgdi32"
	AC_SUBST(UNISCRIBE_CFLAGS)
	AC_SUBST(UNISCRIBE_LIBS)
229
	AC_DEFINE(HAVE_UNISCRIBE, 1, [Have Uniscribe backend])
230 231 232
fi
AM_CONDITIONAL(HAVE_UNISCRIBE, $have_uniscribe)

233 234
dnl ===========================================================================

J
John Ralls 已提交
235
AC_CHECK_TYPE(CTFontRef, have_coretext=true, have_coretext=false, [#include <ApplicationServices/ApplicationServices.h>])
236 237
if $have_coretext; then
	CORETEXT_CFLAGS=
238
	CORETEXT_LIBS="-framework ApplicationServices"
239 240 241 242 243 244 245 246
	AC_SUBST(CORETEXT_CFLAGS)
	AC_SUBST(CORETEXT_LIBS)
	AC_DEFINE(HAVE_CORETEXT, 1, [Have Core Text backend])
fi
AM_CONDITIONAL(HAVE_CORETEXT, $have_coretext)

dnl ===========================================================================

247 248
AC_CACHE_CHECK([for Intel atomic primitives], hb_cv_have_intel_atomic_primitives, [
	hb_cv_have_intel_atomic_primitives=false
B
Behdad Esfahbod 已提交
249
	AC_TRY_LINK([
250
		void memory_barrier (void) { __sync_synchronize (); }
B
Behdad Esfahbod 已提交
251 252 253 254
		int atomic_add (int *i) { return __sync_fetch_and_add (i, 1); }
		int mutex_trylock (int *m) { return __sync_lock_test_and_set (m, 1); }
		void mutex_unlock (int *m) { __sync_lock_release (m); }
		], [], hb_cv_have_intel_atomic_primitives=true
255 256 257 258 259 260 261 262
	)
])
if $hb_cv_have_intel_atomic_primitives; then
	AC_DEFINE(HAVE_INTEL_ATOMIC_PRIMITIVES, 1, [Have Intel __sync_* atomic primitives])
fi

dnl ===========================================================================

B
Behdad Esfahbod 已提交
263 264
AC_CONFIG_FILES([
Makefile
265
harfbuzz.pc
B
Behdad Esfahbod 已提交
266
src/Makefile
267
src/hb-version.h
268
src/hb-icu-le/Makefile
B
Behdad Esfahbod 已提交
269 270
src/hb-old/Makefile
src/hb-ucdn/Makefile
B
Behdad Esfahbod 已提交
271
util/Makefile
B
Behdad Esfahbod 已提交
272
test/Makefile
B
Behdad Esfahbod 已提交
273
test/api/Makefile
274
test/shaping/Makefile
B
Behdad Esfahbod 已提交
275 276 277
])

AC_OUTPUT