configure.ac revision 79ecdc3f9525212053d2bc88a5541c41697159da
1AC_PREREQ([2.64]) 2AC_INIT([HarfBuzz], 3 [0.9.28], 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([src/harfbuzz.pc.in]) 10AC_CONFIG_HEADERS([config.h]) 11 12AM_INIT_AUTOMAKE([1.11.1 gnits tar-pax dist-bzip2 no-dist-gzip -Wall no-define color-tests -Wno-portability]) 13AM_CONDITIONAL(AUTOMAKE_OLDER_THAN_1_13, test $am__api_version = 1.11 -o $am__api_version = 1.12) 14AM_SILENT_RULES([yes]) 15 16# Initialize libtool 17m4_ifdef([AM_PROG_AR], [AM_PROG_AR]) 18LT_PREREQ([2.2]) 19LT_INIT([disable-static]) 20 21# Check for programs 22AC_PROG_CC 23AM_PROG_CC_C_O 24AC_PROG_CXX 25PKG_PROG_PKG_CONFIG([0.20]) 26AM_MISSING_PROG([RAGEL], [ragel]) 27AM_MISSING_PROG([GIT], [git]) 28 29# Version 30m4_define(hb_version_triplet,m4_split(AC_PACKAGE_VERSION,[[.]])) 31m4_define(hb_version_major,m4_argn(1,hb_version_triplet)) 32m4_define(hb_version_minor,m4_argn(2,hb_version_triplet)) 33m4_define(hb_version_micro,m4_argn(3,hb_version_triplet)) 34HB_VERSION_MAJOR=hb_version_major 35HB_VERSION_MINOR=hb_version_minor 36HB_VERSION_MICRO=hb_version_micro 37HB_VERSION=AC_PACKAGE_VERSION 38AC_SUBST(HB_VERSION_MAJOR) 39AC_SUBST(HB_VERSION_MINOR) 40AC_SUBST(HB_VERSION_MICRO) 41AC_SUBST(HB_VERSION) 42 43# Libtool version 44m4_define([hb_version_int], 45 m4_eval(hb_version_major*10000 + hb_version_minor*100 + hb_version_micro)) 46m4_if(m4_eval(hb_version_minor % 2), [1], 47 dnl for unstable releases 48 [m4_define([hb_libtool_revision], 0)], 49 dnl for stable releases 50 [m4_define([hb_libtool_revision], hb_version_micro)]) 51m4_define([hb_libtool_age], 52 m4_eval(hb_version_int - hb_libtool_revision)) 53m4_define([hb_libtool_current], 54 m4_eval(hb_version_major + hb_libtool_age)) 55HB_LIBTOOL_VERSION_INFO=hb_libtool_current:hb_libtool_revision:hb_libtool_age 56AC_SUBST(HB_LIBTOOL_VERSION_INFO) 57 58# Documentation 59have_gtk_doc=false 60m4_ifdef([GTK_DOC_CHECK], [ 61GTK_DOC_CHECK([1.15],[--flavour no-tmpl]) 62 if test "x$enable_gtk_doc" = xyes; then 63 have_gtk_doc=true 64 fi 65], [ 66 AM_CONDITIONAL([ENABLE_GTK_DOC], false) 67]) 68 69# Functions and headers 70AC_CHECK_FUNCS(atexit mprotect sysconf getpagesize mmap isatty) 71AC_CHECK_HEADERS(unistd.h sys/mman.h) 72 73# Compiler flags 74AC_CANONICAL_HOST 75if test "x$GCC" = "xyes"; then 76 77 # Make symbols link locally 78 LDFLAGS="$LDFLAGS -Bsymbolic-functions" 79 80 # Make sure we don't link to libstdc++ 81 CXXFLAGS="$CXXFLAGS -fno-rtti -fno-exceptions" 82 83 # Assorted warnings 84 CXXFLAGS="$CXXFLAGS -Wcast-align" 85 86 case "$host" in 87 *-*-mingw*) 88 ;; 89 *) 90 # Hide inline methods 91 CXXFLAGS="$CXXFLAGS -fvisibility-inlines-hidden" 92 ;; 93 esac 94 95 case "$host" in 96 arm-*-*) 97 # Request byte alignment on arm 98 CXXFLAGS="$CXXFLAGS -mstructure-size-boundary=8" 99 ;; 100 esac 101fi 102 103AM_CONDITIONAL(HAVE_GCC, test "x$GCC" = "xyes") 104 105hb_os_win32=no 106AC_MSG_CHECKING([for native Win32]) 107case "$host" in 108 *-*-mingw*) 109 hb_os_win32=yes 110 ;; 111esac 112AC_MSG_RESULT([$hb_os_win32]) 113AM_CONDITIONAL(OS_WIN32, test "$hb_os_win32" = "yes") 114 115have_pthread=false 116if test "$hb_os_win32" = no; then 117 AX_PTHREAD([have_pthread=true]) 118fi 119if $have_pthread; then 120 AC_DEFINE(HAVE_PTHREAD, 1, [Have POSIX threads]) 121fi 122AM_CONDITIONAL(HAVE_PTHREAD, $have_pthread) 123 124dnl ========================================================================== 125 126have_ot=true 127if $have_ot; then 128 AC_DEFINE(HAVE_OT, 1, [Have native OpenType Layout backend]) 129fi 130AM_CONDITIONAL(HAVE_OT, $have_ot) 131 132have_fallback=true 133if $have_fallback; then 134 AC_DEFINE(HAVE_FALLBACK, 1, [Have simple TrueType Layout backend]) 135fi 136AM_CONDITIONAL(HAVE_FALLBACK, $have_fallback) 137 138dnl =========================================================================== 139 140AC_ARG_WITH(glib, 141 [AS_HELP_STRING([--with-glib=@<:@yes/no/auto@:>@], 142 [Use glib @<:@default=auto@:>@])],, 143 [with_glib=auto]) 144have_glib=false 145if test "x$with_glib" = "xyes" -o "x$with_glib" = "xauto"; then 146 PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.16, have_glib=true, :) 147fi 148if test "x$with_glib" = "xyes" -a "x$have_glib" != "xtrue"; then 149 AC_MSG_ERROR([glib support requested but glib-2.0 not found]) 150fi 151if $have_glib; then 152 AC_DEFINE(HAVE_GLIB, 1, [Have glib2 library]) 153fi 154AM_CONDITIONAL(HAVE_GLIB, $have_glib) 155 156dnl =========================================================================== 157 158AC_ARG_WITH(gobject, 159 [AS_HELP_STRING([--with-gobject=@<:@yes/no/auto@:>@], 160 [Use gobject @<:@default=auto@:>@])],, 161 [with_gobject=no]) 162have_gobject=false 163if test "x$with_gobject" = "xyes" -o "x$with_gobject" = "xauto"; then 164 PKG_CHECK_MODULES(GOBJECT, gobject-2.0 glib-2.0, have_gobject=true, :) 165fi 166if test "x$with_gobject" = "xyes" -a "x$have_gobject" != "xtrue"; then 167 AC_MSG_ERROR([gobject support requested but gobject-2.0 / glib-2.0 not found]) 168fi 169if $have_gobject; then 170 AC_DEFINE(HAVE_GOBJECT, 1, [Have gobject2 library]) 171 GLIB_MKENUMS=`$PKG_CONFIG --variable=glib_mkenums glib-2.0` 172 AC_SUBST(GLIB_MKENUMS) 173fi 174AM_CONDITIONAL(HAVE_GOBJECT, $have_gobject) 175 176dnl =========================================================================== 177 178 179dnl =========================================================================== 180# Gobject-Introspection 181have_introspection=false 182m4_ifdef([GOBJECT_INTROSPECTION_CHECK], [ 183 if $have_gobject; then 184 GOBJECT_INTROSPECTION_CHECK([1.34.0]) 185 if test "x$found_introspection" = xyes; then 186 have_introspection=true 187 fi 188 else 189 AM_CONDITIONAL([HAVE_INTROSPECTION], false) 190 fi 191], [ 192 AM_CONDITIONAL([HAVE_INTROSPECTION], false) 193]) 194 195dnl =========================================================================== 196 197have_ucdn=true 198if $have_glib; then 199 have_ucdn=false 200fi 201if $have_ucdn; then 202 AC_DEFINE(HAVE_UCDN, 1, [Have UCDN Unicode functions]) 203fi 204AM_CONDITIONAL(HAVE_UCDN, $have_ucdn) 205 206dnl ========================================================================== 207 208AC_ARG_WITH(cairo, 209 [AS_HELP_STRING([--with-cairo=@<:@yes/no/auto@:>@], 210 [Use cairo @<:@default=auto@:>@])],, 211 [with_cairo=auto]) 212have_cairo=false 213if test "x$with_cairo" = "xyes" -o "x$with_cairo" = "xauto"; then 214 PKG_CHECK_MODULES(CAIRO, cairo >= 1.8.0, have_cairo=true, :) 215fi 216if test "x$with_cairo" = "xyes" -a "x$have_cairo" != "xtrue"; then 217 AC_MSG_ERROR([cairo support requested but not found]) 218fi 219if $have_cairo; then 220 AC_DEFINE(HAVE_CAIRO, 1, [Have cairo graphics library]) 221fi 222AM_CONDITIONAL(HAVE_CAIRO, $have_cairo) 223 224have_cairo_ft=false 225if $have_cairo; then 226 PKG_CHECK_MODULES(CAIRO_FT, cairo-ft, have_cairo_ft=true, :) 227fi 228if $have_cairo_ft; then 229 AC_DEFINE(HAVE_CAIRO_FT, 1, [Have cairo-ft support in cairo graphics library]) 230fi 231AM_CONDITIONAL(HAVE_CAIRO_FT, $have_cairo_ft) 232 233dnl ========================================================================== 234 235AC_ARG_WITH(icu, 236 [AS_HELP_STRING([--with-icu=@<:@yes/no/auto@:>@], 237 [Use ICU @<:@default=auto@:>@])],, 238 [with_icu=auto]) 239have_icu=false 240if test "x$with_icu" = "xyes" -o "x$with_icu" = "xauto"; then 241 PKG_CHECK_MODULES(ICU, icu-uc, have_icu=true, :) 242 243 dnl Fallback to icu-config if ICU pkg-config files could not be found 244 if test "$have_icu" != "true"; then 245 AC_CHECK_TOOL(ICU_CONFIG, icu-config, no) 246 AC_MSG_CHECKING([for ICU by using icu-config fallback]) 247 if test "$ICU_CONFIG" != "no" && "$ICU_CONFIG" --version >/dev/null; then 248 have_icu=true 249 # We don't use --cflags as this gives us a lot of things that we don't 250 # necessarily want, like debugging and optimization flags 251 # See man (1) icu-config for more info. 252 ICU_CFLAGS=`$ICU_CONFIG --cppflags` 253 ICU_LIBS=`$ICU_CONFIG --ldflags-searchpath --ldflags-libsonly` 254 AC_SUBST(ICU_CFLAGS) 255 AC_SUBST(ICU_LIBS) 256 AC_MSG_RESULT([yes]) 257 else 258 AC_MSG_RESULT([no]) 259 fi 260 fi 261fi 262if test "x$with_icu" = "xyes" -a "x$have_icu" != "xtrue"; then 263 AC_MSG_ERROR([icu support requested but icu-uc not found]) 264fi 265if $have_icu; then 266 CXXFLAGS="$CXXFLAGS `$PKG_CONFIG --variable=CXXFLAGS icu-uc`" 267 AC_DEFINE(HAVE_ICU, 1, [Have ICU library]) 268fi 269AM_CONDITIONAL(HAVE_ICU, $have_icu) 270 271dnl ========================================================================== 272 273AC_ARG_WITH(graphite2, 274 [AS_HELP_STRING([--with-graphite2=@<:@yes/no/auto@:>@], 275 [Use the graphite2 library @<:@default=no@:>@])],, 276 [with_graphite2=no]) 277have_graphite2=false 278if test "x$with_graphite2" = "xyes" -o "x$with_graphite2" = "xauto"; then 279 PKG_CHECK_MODULES(GRAPHITE2, graphite2, have_graphite2=true, :) 280fi 281if test "x$with_graphite2" = "xyes" -a "x$have_graphite2" != "xtrue"; then 282 AC_MSG_ERROR([graphite2 support requested but libgraphite2 not found]) 283fi 284if $have_graphite2; then 285 AC_DEFINE(HAVE_GRAPHITE2, 1, [Have Graphite2 library]) 286fi 287AM_CONDITIONAL(HAVE_GRAPHITE2, $have_graphite2) 288 289dnl ========================================================================== 290 291AC_ARG_WITH(freetype, 292 [AS_HELP_STRING([--with-freetype=@<:@yes/no/auto@:>@], 293 [Use the FreeType library @<:@default=auto@:>@])],, 294 [with_freetype=auto]) 295have_freetype=false 296if test "x$with_freetype" = "xyes" -o "x$with_freetype" = "xauto"; then 297 PKG_CHECK_MODULES(FREETYPE, freetype2 >= 2.3.8, have_freetype=true, :) 298fi 299if test "x$with_freetype" = "xyes" -a "x$have_freetype" != "xtrue"; then 300 AC_MSG_ERROR([FreeType support requested but libfreetype2 not found]) 301fi 302if $have_freetype; then 303 AC_DEFINE(HAVE_FREETYPE, 1, [Have FreeType 2 library]) 304 _save_libs="$LIBS" 305 _save_cflags="$CFLAGS" 306 LIBS="$LIBS $FREETYPE_LIBS" 307 CFLAGS="$CFLAGS $FREETYPE_CFLAGS" 308 AC_CHECK_FUNCS(FT_Face_GetCharVariantIndex) 309 LIBS="$_save_libs" 310 CFLAGS="$_save_cflags" 311fi 312AM_CONDITIONAL(HAVE_FREETYPE, $have_freetype) 313 314dnl =========================================================================== 315 316AC_ARG_WITH(uniscribe, 317 [AS_HELP_STRING([--with-uniscribe=@<:@yes/no/auto@:>@], 318 [Use the Uniscribe library @<:@default=no@:>@])],, 319 [with_uniscribe=no]) 320have_uniscribe=false 321if test "x$with_uniscribe" = "xyes" -o "x$with_uniscribe" = "xauto"; then 322 AC_CHECK_HEADERS(usp10.h windows.h, have_uniscribe=true) 323fi 324if test "x$with_uniscribe" = "xyes" -a "x$have_uniscribe" != "xtrue"; then 325 AC_MSG_ERROR([uniscribe support requested but not found]) 326fi 327if $have_uniscribe; then 328 UNISCRIBE_CFLAGS= 329 UNISCRIBE_LIBS="-lusp10 -lgdi32 -lrpcrt4" 330 AC_SUBST(UNISCRIBE_CFLAGS) 331 AC_SUBST(UNISCRIBE_LIBS) 332 AC_DEFINE(HAVE_UNISCRIBE, 1, [Have Uniscribe library]) 333fi 334AM_CONDITIONAL(HAVE_UNISCRIBE, $have_uniscribe) 335 336dnl =========================================================================== 337 338AC_ARG_WITH(coretext, 339 [AS_HELP_STRING([--with-coretext=@<:@yes/no/auto@:>@], 340 [Use CoreText @<:@default=no@:>@])],, 341 [with_coretext=no]) 342have_coretext=false 343if test "x$with_coretext" = "xyes" -o "x$with_coretext" = "xauto"; then 344 AC_CHECK_TYPE(CTFontRef, have_coretext=true,, [#include <ApplicationServices/ApplicationServices.h>]) 345 346 if $have_coretext; then 347 CORETEXT_CFLAGS= 348 CORETEXT_LIBS="-framework ApplicationServices" 349 AC_SUBST(CORETEXT_CFLAGS) 350 AC_SUBST(CORETEXT_LIBS) 351 else 352 # On iOS CoreText and CoreGraphics are stand-alone frameworks 353 if test "x$have_coretext" != "xtrue"; then 354 AC_CHECK_TYPE(CTFontRef, have_coretext=true,, [#include <CoreText/CoreText.h>]) 355 fi 356 357 if $have_coretext; then 358 CORETEXT_CFLAGS= 359 CORETEXT_LIBS="-framework CoreText -framework CoreGraphics" 360 AC_SUBST(CORETEXT_CFLAGS) 361 AC_SUBST(CORETEXT_LIBS) 362 fi 363 fi 364fi 365if test "x$with_coretext" = "xyes" -a "x$have_coretext" != "xtrue"; then 366 AC_MSG_ERROR([CoreText support requested but libcoretext not found]) 367fi 368if $have_coretext; then 369 AC_DEFINE(HAVE_CORETEXT, 1, [Have Core Text backend]) 370fi 371AM_CONDITIONAL(HAVE_CORETEXT, $have_coretext) 372 373dnl =========================================================================== 374 375AC_CACHE_CHECK([for Intel atomic primitives], hb_cv_have_intel_atomic_primitives, [ 376 hb_cv_have_intel_atomic_primitives=false 377 AC_TRY_LINK([ 378 void memory_barrier (void) { __sync_synchronize (); } 379 int atomic_add (int *i) { return __sync_fetch_and_add (i, 1); } 380 int mutex_trylock (int *m) { return __sync_lock_test_and_set (m, 1); } 381 void mutex_unlock (int *m) { __sync_lock_release (m); } 382 ], [], hb_cv_have_intel_atomic_primitives=true 383 ) 384]) 385if $hb_cv_have_intel_atomic_primitives; then 386 AC_DEFINE(HAVE_INTEL_ATOMIC_PRIMITIVES, 1, [Have Intel __sync_* atomic primitives]) 387fi 388 389dnl =========================================================================== 390 391AC_CACHE_CHECK([for Solaris atomic operations], hb_cv_have_solaris_atomic_ops, [ 392 hb_cv_have_solaris_atomic_ops=false 393 AC_TRY_LINK([ 394 #include <atomic.h> 395 /* This requires Solaris Studio 12.2 or newer: */ 396 #include <mbarrier.h> 397 void memory_barrier (void) { __machine_rw_barrier (); } 398 int atomic_add (volatile unsigned *i) { return atomic_add_int_nv (i, 1); } 399 void *atomic_ptr_cmpxchg (volatile void **target, void *cmp, void *newval) { return atomic_cas_ptr (target, cmp, newval); } 400 ], [], hb_cv_have_solaris_atomic_ops=true 401 ) 402]) 403if $hb_cv_have_solaris_atomic_ops; then 404 AC_DEFINE(HAVE_SOLARIS_ATOMIC_OPS, 1, [Have Solaris __machine_*_barrier and atomic_* operations]) 405fi 406 407if test "$os_win32" = no && ! $have_pthread; then 408 AC_CHECK_HEADERS(sched.h) 409 AC_SEARCH_LIBS(sched_yield,rt,AC_DEFINE(HAVE_SCHED_YIELD, 1, [Have sched_yield])) 410fi 411 412dnl =========================================================================== 413 414AC_CONFIG_FILES([ 415Makefile 416src/Makefile 417src/hb-version.h 418src/hb-ucdn/Makefile 419util/Makefile 420test/Makefile 421test/api/Makefile 422test/shaping/Makefile 423docs/Makefile 424docs/reference/Makefile 425docs/reference/version.xml 426]) 427 428AC_OUTPUT 429 430AC_MSG_NOTICE([ 431 432Build configuration: 433 434Unicode callbacks (you want at least one): 435 Glib: ${have_glib} 436 ICU: ${have_icu} 437 UCDN: ${have_ucdn} 438 439Font callbacks (the more the better): 440 FreeType: ${have_freetype} 441 442Tools used for command-line utilities: 443 Cairo: ${have_cairo} 444 445Additional shapers (the more the better): 446 Graphite2: ${have_graphite2} 447 448Platform shapers (not normally needed): 449 CoreText: ${have_coretext} 450 Uniscribe: ${have_uniscribe} 451 452Other features: 453 Documentation: ${have_gtk_doc} 454 GObject bindings: ${have_gobject} 455 Introspection: ${have_introspection} 456]) 457