configure.ac revision 71439a8c7ae9df25193bc3ad0f203117d2884a19
1AC_PREREQ([2.64]) 2AC_INIT([HarfBuzz], 3 [0.9.19], 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 dist-bzip2 no-dist-gzip -Wall no-define color-tests -Wno-portability]) 13AM_SILENT_RULES([yes]) 14 15# Initialize libtool 16m4_ifdef([AM_PROG_AR], [AM_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 55GOBJECT_INTROSPECTION_CHECK([1.32.0]) 56GTK_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=false 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 131AC_ARG_WITH(glib, 132 [AS_HELP_STRING([--with-glib=@<:@yes/no/auto@:>@], 133 [Use glib @<:@default=auto@:>@])],, 134 [with_glib=auto]) 135have_glib=false 136if test "x$with_glib" = "xyes" -o "x$with_glib" = "xauto"; then 137 PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.16, have_glib=true, :) 138fi 139if test "x$with_glib" = "xyes" -a "x$have_glib" != "xtrue"; then 140 AC_MSG_ERROR([glib support requested but glib-2.0 not found]) 141fi 142if $have_glib; then 143 AC_DEFINE(HAVE_GLIB, 1, [Have glib2 library]) 144fi 145AM_CONDITIONAL(HAVE_GLIB, $have_glib) 146 147AC_ARG_WITH(gobject, 148 [AS_HELP_STRING([--with-gobject=@<:@yes/no/auto@:>@], 149 [Use gobject @<:@default=auto@:>@])],, 150 [with_gobject=auto]) 151have_gobject=false 152if test "x$with_gobject" = "xyes" -o "x$with_gobject" = "xauto"; then 153 PKG_CHECK_MODULES(GOBJECT, gobject-2.0 glib-2.0, have_gobject=true, :) 154fi 155if test "x$with_gobject" = "xyes" -a "x$have_gobject" != "xtrue"; then 156 AC_MSG_ERROR([gobject support requested but gobject-2.0 / glib-2.0 not found]) 157fi 158if $have_gobject; then 159 AC_DEFINE(HAVE_GOBJECT, 1, [Have gobject2 library]) 160 GLIB_MKENUMS=`$PKG_CONFIG --variable=glib_mkenums glib-2.0` 161 AC_SUBST(GLIB_MKENUMS) 162fi 163AM_CONDITIONAL(HAVE_GOBJECT, $have_gobject) 164 165dnl =========================================================================== 166 167have_ucdn=true 168if $have_glib; then 169 have_ucdn=false 170fi 171if $have_ucdn; then 172 AC_DEFINE(HAVE_UCDN, 1, [Have UCDN Unicode functions]) 173fi 174AM_CONDITIONAL(HAVE_UCDN, $have_ucdn) 175 176dnl ========================================================================== 177 178AC_ARG_WITH(cairo, 179 [AS_HELP_STRING([--with-cairo=@<:@yes/no/auto@:>@], 180 [Use cairo @<:@default=auto@:>@])],, 181 [with_cairo=auto]) 182have_cairo=false 183if test "x$with_cairo" = "xyes" -o "x$with_cairo" = "xauto"; then 184 PKG_CHECK_MODULES(CAIRO, cairo >= 1.8.0, have_cairo=true, :) 185fi 186if test "x$with_cairo" = "xyes" -a "x$have_cairo" != "xtrue"; then 187 AC_MSG_ERROR([cairo support requested but not found]) 188fi 189if $have_cairo; then 190 AC_DEFINE(HAVE_CAIRO, 1, [Have cairo graphics library]) 191fi 192AM_CONDITIONAL(HAVE_CAIRO, $have_cairo) 193 194have_cairo_ft=false 195if $have_cairo; then 196 PKG_CHECK_MODULES(CAIRO_FT, cairo-ft, have_cairo_ft=true, :) 197fi 198if $have_cairo_ft; then 199 AC_DEFINE(HAVE_CAIRO_FT, 1, [Have cairo-ft support in cairo graphics library]) 200fi 201AM_CONDITIONAL(HAVE_CAIRO_FT, $have_cairo_ft) 202 203dnl ========================================================================== 204 205AC_ARG_WITH(icu, 206 [AS_HELP_STRING([--with-icu=@<:@yes/no/auto@:>@], 207 [Use ICU @<:@default=auto@:>@])],, 208 [with_icu=auto]) 209have_icu=false 210if test "x$with_icu" = "xyes" -o "x$with_icu" = "xauto"; then 211 PKG_CHECK_MODULES(ICU, icu-uc, have_icu=true, :) 212 213 dnl Fallback to icu-config if ICU pkg-config files could not be found 214 if test "$have_icu" != "true"; then 215 AC_CHECK_TOOL(ICU_CONFIG, icu-config, no) 216 AC_MSG_CHECKING([for ICU by using icu-config fallback]) 217 if test "$ICU_CONFIG" != "no" && "$ICU_CONFIG" --version >/dev/null; then 218 have_icu=true 219 # We don't use --cflags as this gives us a lot of things that we don't 220 # necessarily want, like debugging and optimization flags 221 # See man (1) icu-config for more info. 222 ICU_CFLAGS=`$ICU_CONFIG --cppflags` 223 ICU_LIBS=`$ICU_CONFIG --ldflags-searchpath --ldflags-libsonly` 224 AC_SUBST(ICU_CFLAGS) 225 AC_SUBST(ICU_LIBS) 226 AC_MSG_RESULT([yes]) 227 else 228 AC_MSG_RESULT([no]) 229 fi 230 fi 231fi 232if test "x$with_icu" = "xyes" -a "x$have_icu" != "xtrue"; then 233 AC_MSG_ERROR([icu support requested but icu-uc not found]) 234fi 235if $have_icu; then 236 CXXFLAGS="$CXXFLAGS `$PKG_CONFIG --variable=CXXFLAGS icu-uc`" 237 AC_DEFINE(HAVE_ICU, 1, [Have ICU library]) 238fi 239AM_CONDITIONAL(HAVE_ICU, $have_icu) 240 241dnl ========================================================================== 242 243have_icu_le=false 244dnl PKG_CHECK_MODULES(ICU_LE, icu-le icu-uc, have_icu_le=true, :) 245if $have_icu_le; then 246 AC_DEFINE(HAVE_ICU_LE, 1, [Have ICU Layout Engine library]) 247fi 248AM_CONDITIONAL(HAVE_ICU_LE, $have_icu_le) 249 250dnl ========================================================================== 251 252AC_ARG_WITH(graphite2, 253 [AS_HELP_STRING([--with-graphite2=@<:@yes/no/auto@:>@], 254 [Use the graphite2 library @<:@default=no@:>@])],, 255 [with_graphite2=no]) 256have_graphite2=false 257if test "x$with_graphite2" = "xyes" -o "x$with_graphite2" = "xauto"; then 258 PKG_CHECK_MODULES(GRAPHITE2, graphite2, have_graphite2=true, :) 259fi 260if test "x$with_graphite2" = "xyes" -a "x$have_graphite2" != "xtrue"; then 261 AC_MSG_ERROR([graphite2 support requested but libgraphite2 not found]) 262fi 263if $have_graphite2; then 264 AC_DEFINE(HAVE_GRAPHITE2, 1, [Have Graphite2 library]) 265fi 266AM_CONDITIONAL(HAVE_GRAPHITE2, $have_graphite2) 267 268dnl ========================================================================== 269 270AC_ARG_WITH(freetype, 271 [AS_HELP_STRING([--with-freetype=@<:@yes/no/auto@:>@], 272 [Use the FreeType library @<:@default=auto@:>@])],, 273 [with_freetype=auto]) 274have_freetype=false 275if test "x$with_freetype" = "xyes" -o "x$with_freetype" = "xauto"; then 276 PKG_CHECK_MODULES(FREETYPE, freetype2 >= 2.3.8, have_freetype=true, :) 277fi 278if test "x$with_freetype" = "xyes" -a "x$have_freetype" != "xtrue"; then 279 AC_MSG_ERROR([FreeType support requested but libfreetype2 not found]) 280fi 281if $have_freetype; then 282 AC_DEFINE(HAVE_FREETYPE, 1, [Have FreeType 2 library]) 283 _save_libs="$LIBS" 284 _save_cflags="$CFLAGS" 285 LIBS="$LIBS $FREETYPE_LIBS" 286 CFLAGS="$CFLAGS $FREETYPE_CFLAGS" 287 AC_CHECK_FUNCS(FT_Face_GetCharVariantIndex) 288 LIBS="$_save_libs" 289 CFLAGS="$_save_cflags" 290fi 291AM_CONDITIONAL(HAVE_FREETYPE, $have_freetype) 292 293dnl =========================================================================== 294 295AC_ARG_WITH(uniscribe, 296 [AS_HELP_STRING([--with-uniscribe=@<:@yes/no/auto@:>@], 297 [Use the Uniscribe library @<:@default=no@:>@])],, 298 [with_uniscribe=no]) 299have_uniscribe=false 300if test "x$with_uniscribe" = "xyes" -o "x$with_uniscribe" = "xauto"; then 301 AC_CHECK_HEADERS(usp10.h windows.h, have_uniscribe=true) 302fi 303if test "x$with_uniscribe" = "xyes" -a "x$have_uniscribe" != "xtrue"; then 304 AC_MSG_ERROR([uniscribe support requested but not found]) 305fi 306if $have_uniscribe; then 307 UNISCRIBE_CFLAGS= 308 UNISCRIBE_LIBS="-lusp10 -lgdi32 -lrpcrt4" 309 AC_SUBST(UNISCRIBE_CFLAGS) 310 AC_SUBST(UNISCRIBE_LIBS) 311 AC_DEFINE(HAVE_UNISCRIBE, 1, [Have Uniscribe library]) 312fi 313AM_CONDITIONAL(HAVE_UNISCRIBE, $have_uniscribe) 314 315dnl =========================================================================== 316 317AC_ARG_WITH(coretext, 318 [AS_HELP_STRING([--with-coretext=@<:@yes/no/auto@:>@], 319 [Use CoreText @<:@default=no@:>@])],, 320 [with_coretext=no]) 321have_coretext=false 322if test "x$with_coretext" = "xyes" -o "x$with_coretext" = "xauto"; then 323 AC_CHECK_TYPE(CTFontRef, have_coretext=true,, [#include <ApplicationServices/ApplicationServices.h>]) 324fi 325if test "x$with_coretext" = "xyes" -a "x$have_coretext" != "xtrue"; then 326 AC_MSG_ERROR([CoreText support requested but libcoretext not found]) 327fi 328if $have_coretext; then 329 CORETEXT_CFLAGS= 330 CORETEXT_LIBS="-framework ApplicationServices" 331 AC_SUBST(CORETEXT_CFLAGS) 332 AC_SUBST(CORETEXT_LIBS) 333 AC_DEFINE(HAVE_CORETEXT, 1, [Have Core Text backend]) 334fi 335AM_CONDITIONAL(HAVE_CORETEXT, $have_coretext) 336 337dnl =========================================================================== 338 339AC_CACHE_CHECK([for Intel atomic primitives], hb_cv_have_intel_atomic_primitives, [ 340 hb_cv_have_intel_atomic_primitives=false 341 AC_TRY_LINK([ 342 void memory_barrier (void) { __sync_synchronize (); } 343 int atomic_add (int *i) { return __sync_fetch_and_add (i, 1); } 344 int mutex_trylock (int *m) { return __sync_lock_test_and_set (m, 1); } 345 void mutex_unlock (int *m) { __sync_lock_release (m); } 346 ], [], hb_cv_have_intel_atomic_primitives=true 347 ) 348]) 349if $hb_cv_have_intel_atomic_primitives; then 350 AC_DEFINE(HAVE_INTEL_ATOMIC_PRIMITIVES, 1, [Have Intel __sync_* atomic primitives]) 351fi 352 353dnl =========================================================================== 354 355AC_CACHE_CHECK([for Solaris atomic operations], hb_cv_have_solaris_atomic_ops, [ 356 hb_cv_have_solaris_atomic_ops=false 357 AC_TRY_LINK([ 358 #include <atomic.h> 359 /* This requires Solaris Studio 12.2 or newer: */ 360 #include <mbarrier.h> 361 void memory_barrier (void) { __machine_rw_barrier (); } 362 int atomic_add (volatile unsigned *i) { return atomic_add_int_nv (i, 1); } 363 void *atomic_ptr_cmpxchg (volatile void **target, void *cmp, void *newval) { return atomic_cas_ptr (target, cmp, newval); } 364 ], [], hb_cv_have_solaris_atomic_ops=true 365 ) 366]) 367if $hb_cv_have_solaris_atomic_ops; then 368 AC_DEFINE(HAVE_SOLARIS_ATOMIC_OPS, 1, [Have Solaris __machine_*_barrier and atomic_* operations]) 369fi 370 371if test "$os_win32" = no && ! $have_pthread; then 372 AC_CHECK_HEADERS(sched.h) 373 AC_SEARCH_LIBS(sched_yield,rt,AC_DEFINE(HAVE_SCHED_YIELD, 1, [Have sched_yield])) 374fi 375 376dnl =========================================================================== 377 378AC_CONFIG_FILES([ 379Makefile 380src/Makefile 381src/hb-version.h 382src/hb-icu-le/Makefile 383src/hb-old/Makefile 384src/hb-ucdn/Makefile 385util/Makefile 386test/Makefile 387test/api/Makefile 388test/shaping/Makefile 389docs/Makefile 390docs/reference/Makefile 391]) 392 393AC_OUTPUT 394 395AC_MSG_NOTICE([ 396 397Build configuration: 398 399Unicode callbacks (you want at least one): 400 Glib: ${have_glib} 401 ICU: ${have_icu} 402 UCDN: ${have_ucdn} 403 404Font callbacks (the more the better): 405 FreeType: ${have_freetype} 406 407Tools used for command-line utilities: 408 Cairo: ${have_cairo} 409 410Additional shapers (the more the better): 411 Graphite2: ${have_graphite2} 412 413Test / platform shapers (not normally needed): 414 CoreText: ${have_coretext} 415 ICU Layout Engine: ${have_icu_le} 416 Old HarfBuzz: ${have_hb_old} 417 Uniscribe: ${have_uniscribe} 418 419Other features: 420 Documentation: ${enable_gtk_doc} 421 GObject bindings: ${have_gobject} 422 Introspection: ${found_introspection} 423]) 424