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