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