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