configure.ac 9.5 KB
Newer Older
1
AC_PREREQ([2.64])
B
Minor  
Behdad Esfahbod 已提交
2
AC_INIT([HarfBuzz],
B
0.9.12  
Behdad Esfahbod 已提交
3
        [0.9.12],
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

12
AM_INIT_AUTOMAKE([1.11.1 gnits dist-bzip2 no-dist-gzip -Wall no-define color-tests])
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
AC_CHECK_FUNCS(atexit mprotect sysconf getpagesize mmap setmode isatty)
B
Behdad Esfahbod 已提交
59
AC_CHECK_HEADERS(unistd.h sys/mman.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 92
AM_CONDITIONAL(HAVE_GCC, test "x$GCC" = "xyes")

93
hb_os_win32=no
94 95 96 97 98 99 100 101 102
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 已提交
103
have_pthread=false
104 105 106
if test "$hb_os_win32" = no; then
	AX_PTHREAD([have_pthread=true])
fi
B
Behdad Esfahbod 已提交
107 108 109 110 111
if $have_pthread; then
	AC_DEFINE(HAVE_PTHREAD, 1, [Have POSIX threads])
fi
AM_CONDITIONAL(HAVE_PTHREAD, $have_pthread)

B
Behdad Esfahbod 已提交
112 113
dnl ==========================================================================

B
Shuffle  
Behdad Esfahbod 已提交
114 115 116 117 118 119 120 121
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 ===========================================================================

122 123 124 125 126 127 128 129
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 已提交
130 131 132 133 134 135 136 137
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 已提交
138
PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.16, have_glib=true, have_glib=false)
139
if $have_glib; then
B
Behdad Esfahbod 已提交
140
	AC_DEFINE(HAVE_GLIB, 1, [Have glib2 library])
141
fi
B
Behdad Esfahbod 已提交
142 143
AM_CONDITIONAL(HAVE_GLIB, $have_glib)

144 145 146 147 148 149
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)

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

B
Behdad Esfahbod 已提交
158 159
dnl ==========================================================================

B
Behdad Esfahbod 已提交
160 161 162 163 164 165 166 167 168 169 170 171
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 已提交
172 173
dnl ==========================================================================

174
PKG_CHECK_MODULES(ICU, icu-uc, have_icu=true, have_icu=false)
B
Behdad Esfahbod 已提交
175
if $have_icu; then
176
	CXXFLAGS="$CXXFLAGS `$PKG_CONFIG --variable=CXXFLAGS icu-uc`"
B
Behdad Esfahbod 已提交
177 178 179 180
	AC_DEFINE(HAVE_ICU, 1, [Have ICU library])
fi
AM_CONDITIONAL(HAVE_ICU, $have_icu)

B
Behdad Esfahbod 已提交
181
dnl ==========================================================================
182

183
PKG_CHECK_MODULES(ICU_LE, icu-le icu-uc, have_icu_le=true, have_icu_le=false)
184 185 186 187 188 189 190
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 ==========================================================================

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

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

199
PKG_CHECK_MODULES(FREETYPE, freetype2 >= 2.3.8, have_freetype=true, have_freetype=false)
200 201
if $have_freetype; then
	AC_DEFINE(HAVE_FREETYPE, 1, [Have FreeType 2 library])
B
Behdad Esfahbod 已提交
202 203 204 205 206 207 208
	_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"
209
fi
B
Behdad Esfahbod 已提交
210 211
AM_CONDITIONAL(HAVE_FREETYPE, $have_freetype)

212
dnl ===========================================================================
B
Behdad Esfahbod 已提交
213

214 215 216 217 218 219 220 221 222 223 224 225 226
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
227 228 229 230 231
if $have_uniscribe; then
	UNISCRIBE_CFLAGS=
	UNISCRIBE_LIBS="-lusp10 -lgdi32"
	AC_SUBST(UNISCRIBE_CFLAGS)
	AC_SUBST(UNISCRIBE_LIBS)
232
	AC_DEFINE(HAVE_UNISCRIBE, 1, [Have Uniscribe backend])
233 234 235
fi
AM_CONDITIONAL(HAVE_UNISCRIBE, $have_uniscribe)

236 237
dnl ===========================================================================

J
John Ralls 已提交
238
AC_CHECK_TYPE(CTFontRef, have_coretext=true, have_coretext=false, [#include <ApplicationServices/ApplicationServices.h>])
239 240
if $have_coretext; then
	CORETEXT_CFLAGS=
241
	CORETEXT_LIBS="-framework ApplicationServices"
242 243 244 245 246 247 248 249
	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 ===========================================================================

250 251
AC_CACHE_CHECK([for Intel atomic primitives], hb_cv_have_intel_atomic_primitives, [
	hb_cv_have_intel_atomic_primitives=false
B
Behdad Esfahbod 已提交
252
	AC_TRY_LINK([
253
		void memory_barrier (void) { __sync_synchronize (); }
B
Behdad Esfahbod 已提交
254 255 256 257
		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
258 259 260 261 262 263 264 265
	)
])
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 已提交
266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288
AC_CACHE_CHECK([for Solaris atomic operations], hb_cv_have_solaris_atomic_ops, [
	hb_cv_have_solaris_atomic_ops=false
	AC_TRY_LINK([
		#include <atomic.h>
		/* This requires Solaris Studio 12.2 or newer: */
		#include <mbarrier.h>
		void memory_barrier (void) { __machine_rw_barrier (); }
		int atomic_add (volatile unsigned *i) { return atomic_add_int_nv (i, 1); }
		void *atomic_ptr_cmpxchg (volatile void **target, void *cmp, void *newval) { return atomic_cas_ptr (target, cmp, newval); }
		], [], hb_cv_have_solaris_atomic_ops=true
	)
])
if $hb_cv_have_solaris_atomic_ops; then
	AC_DEFINE(HAVE_SOLARIS_ATOMIC_OPS, 1, [Have Solaris __machine_*_barrier and atomic_* operations])
fi

if test "$os_win32" = no && ! $have_pthread; then
	AC_CHECK_HEADERS(sched.h)
	AC_SEARCH_LIBS(sched_yield,rt,AC_DEFINE(HAVE_SCHED_YIELD, 1, [Have sched_yield]))
fi

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

B
Behdad Esfahbod 已提交
289 290
AC_CONFIG_FILES([
Makefile
291
harfbuzz.pc
B
Behdad Esfahbod 已提交
292
src/Makefile
293
src/hb-version.h
294
src/hb-icu-le/Makefile
B
Behdad Esfahbod 已提交
295 296
src/hb-old/Makefile
src/hb-ucdn/Makefile
B
Behdad Esfahbod 已提交
297
util/Makefile
B
Behdad Esfahbod 已提交
298
test/Makefile
B
Behdad Esfahbod 已提交
299
test/api/Makefile
300
test/shaping/Makefile
B
Behdad Esfahbod 已提交
301 302 303
])

AC_OUTPUT
304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328

AC_MSG_NOTICE([

Build configuration:

Unicode callbacks (you want at least one):
	Glib:			${have_glib}
	ICU:			${have_icu}
	UCDN:			${have_ucdn}

Font callbacks (the more the better):
	FreeType:		${have_freetype}

Tools used for command-line utilities:
	Cairo:			${have_cairo}

Additional shapers (the more the better):
	Graphite2:		${have_graphite}

Test / platform shapers (not normally needed):
	CoreText:		${have_coretext}
	ICU Layout Engine:	${have_icu_le}
	Old HarfBuzz:		${have_hb_old}
	Uniscribe:		${have_uniscribe}
])