1AC_PREREQ([2.64]) 2AC_INIT([HarfBuzz], 3 [2.8.1], 4 [https://github.com/harfbuzz/harfbuzz/issues/new], 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.13.0 gnits tar-ustar dist-xz no-dist-gzip -Wall no-define color-tests -Wno-portability]) 13AM_SILENT_RULES([yes]) 14AX_CODE_COVERAGE 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 23AC_PROG_CC_C99 24AM_PROG_CC_C_O 25AC_PROG_CXX 26AX_CXX_COMPILE_STDCXX(11) 27AC_SYS_LARGEFILE 28PKG_PROG_PKG_CONFIG([0.28]) 29AM_MISSING_PROG([RAGEL], [ragel]) 30AM_MISSING_PROG([GIT], [git]) 31 32# Version 33m4_define(hb_version_triplet,m4_split(AC_PACKAGE_VERSION,[[.]])) 34m4_define(hb_version_major,m4_argn(1,hb_version_triplet)) 35m4_define(hb_version_minor,m4_argn(2,hb_version_triplet)) 36m4_define(hb_version_micro,m4_argn(3,hb_version_triplet)) 37HB_VERSION_MAJOR=hb_version_major 38HB_VERSION_MINOR=hb_version_minor 39HB_VERSION_MICRO=hb_version_micro 40HB_VERSION=AC_PACKAGE_VERSION 41AC_SUBST(HB_VERSION_MAJOR) 42AC_SUBST(HB_VERSION_MINOR) 43AC_SUBST(HB_VERSION_MICRO) 44AC_SUBST(HB_VERSION) 45 46# Libtool version 47m4_define([hb_version_int], 48 m4_eval(hb_version_major*10000 + hb_version_minor*100 + hb_version_micro)) 49HB_LIBTOOL_VERSION_INFO=hb_version_int:0:hb_version_int 50AC_SUBST(HB_LIBTOOL_VERSION_INFO) 51 52AC_ARG_WITH([libstdc++], 53 [AS_HELP_STRING([--with-libstdc++=@<:@yes/no@:>@], 54 [Allow linking with libstdc++ @<:@default=no@:>@])], 55 [with_libstdcxx=$withval], 56 [with_libstdcxx=no]) 57AM_CONDITIONAL(WITH_LIBSTDCXX, [test "x$with_libstdcxx" = "xyes"]) 58 59# Documentation 60have_gtk_doc=false 61m4_ifdef([GTK_DOC_CHECK], [ 62GTK_DOC_CHECK([1.15],[--flavour no-tmpl]) 63 if test "x$enable_gtk_doc" = xyes; then 64 have_gtk_doc=true 65 fi 66], [ 67 AM_CONDITIONAL([ENABLE_GTK_DOC], false) 68]) 69 70# Functions and headers 71AC_CHECK_FUNCS(atexit mprotect sysconf getpagesize mmap isatty) 72AC_CHECK_HEADERS(unistd.h sys/mman.h stdbool.h) 73 74# Compiler flags 75AC_CANONICAL_HOST 76AC_CHECK_ALIGNOF([struct{char;}]) 77if test "x$GCC" = "xyes"; then 78 79 # Make symbols link locally 80 AX_CHECK_LINK_FLAG([[-Bsymbolic-functions]], [LDFLAGS="$LDFLAGS -Bsymbolic-functions"]) 81 82 # Make it possible to not link to libstdc++ 83 # No threadsafe statics in C++ as we do it ourselves. 84 # We don't use these features, so it's safe to disable them 85 # even in the cases where we DO link to libstdc++. 86 # Put -fno-rtti before $CXXFLAGS such that users can re-enable it 87 # by overriding CXXFLAGS. 88 CXXFLAGS="-fno-rtti $CXXFLAGS -fno-exceptions -fno-threadsafe-statics" 89 90 case "$host" in 91 *-*-mingw*) 92 ;; 93 *) 94 # Hide inline methods 95 CXXFLAGS="$CXXFLAGS -fvisibility-inlines-hidden" 96 ;; 97 esac 98 99 case "$host" in 100 arm-*-*) 101 if test "x$ac_cv_alignof_struct_char__" != x1; then 102 # Request byte alignment 103 CXXFLAGS="$CXXFLAGS -mstructure-size-boundary=8" 104 fi 105 ;; 106 esac 107fi 108 109AM_CONDITIONAL(HAVE_GCC, test "x$GCC" = "xyes") 110 111hb_os_win32=no 112AC_MSG_CHECKING([for native Win32]) 113case "$host" in 114 *-*-mingw*) 115 hb_os_win32=yes 116 ;; 117esac 118AC_MSG_RESULT([$hb_os_win32]) 119AM_CONDITIONAL(OS_WIN32, test "$hb_os_win32" = "yes") 120 121have_pthread=false 122AX_PTHREAD([have_pthread=true]) 123if $have_pthread; then 124 AC_DEFINE(HAVE_PTHREAD, 1, [Have POSIX threads]) 125fi 126AM_CONDITIONAL(HAVE_PTHREAD, $have_pthread) 127 128dnl ========================================================================== 129 130AC_ARG_WITH(glib, 131 [AS_HELP_STRING([--with-glib=@<:@yes/no/auto@:>@], 132 [Use glib @<:@default=auto@:>@])],, 133 [with_glib=auto]) 134have_glib=false 135GLIB_DEPS="glib-2.0 >= 2.19.1" 136AC_SUBST(GLIB_DEPS) 137if test "x$with_glib" = "xyes" -o "x$with_glib" = "xauto"; then 138 PKG_CHECK_MODULES(GLIB, $GLIB_DEPS, 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=no@:>@])],, 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) 167AC_SUBST(have_gobject) 168 169dnl =========================================================================== 170 171 172dnl =========================================================================== 173# Gobject-Introspection 174have_introspection=false 175m4_ifdef([GOBJECT_INTROSPECTION_CHECK], [ 176 if $have_gobject; then 177 GOBJECT_INTROSPECTION_CHECK([1.34.0]) 178 if test "x$found_introspection" = xyes; then 179 have_introspection=true 180 fi 181 else 182 AM_CONDITIONAL([HAVE_INTROSPECTION], false) 183 fi 184], [ 185 AM_CONDITIONAL([HAVE_INTROSPECTION], false) 186]) 187 188dnl ========================================================================== 189 190AC_ARG_WITH(cairo, 191 [AS_HELP_STRING([--with-cairo=@<:@yes/no/auto@:>@], 192 [Use cairo @<:@default=auto@:>@])],, 193 [with_cairo=auto]) 194have_cairo=false 195if test "x$with_cairo" = "xyes" -o "x$with_cairo" = "xauto"; then 196 PKG_CHECK_MODULES(CAIRO, cairo >= 1.8.0, have_cairo=true, :) 197fi 198if test "x$with_cairo" = "xyes" -a "x$have_cairo" != "xtrue"; then 199 AC_MSG_ERROR([cairo support requested but not found]) 200fi 201if $have_cairo; then 202 AC_DEFINE(HAVE_CAIRO, 1, [Have cairo graphics library]) 203fi 204AM_CONDITIONAL(HAVE_CAIRO, $have_cairo) 205 206have_cairo_ft=false 207if $have_cairo; then 208 PKG_CHECK_MODULES(CAIRO_FT, cairo-ft, have_cairo_ft=true, :) 209fi 210if $have_cairo_ft; then 211 AC_DEFINE(HAVE_CAIRO_FT, 1, [Have cairo-ft support in cairo graphics library]) 212fi 213AM_CONDITIONAL(HAVE_CAIRO_FT, $have_cairo_ft) 214 215dnl ========================================================================== 216 217AC_ARG_WITH(chafa, 218 [AS_HELP_STRING([--with-chafa=@<:@yes/no/auto@:>@], 219 [Use chafa @<:@default=auto@:>@])],, 220 [with_chafa=auto]) 221have_chafa=false 222if test "x$with_chafa" = "xyes" -o "x$with_chafa" = "xauto"; then 223 PKG_CHECK_MODULES(CHAFA, chafa >= 1.6.0, have_chafa=true, :) 224fi 225if test "x$with_chafa" = "xyes" -a "x$have_chafa" != "xtrue"; then 226 AC_MSG_ERROR([chafa support requested but not found]) 227fi 228if $have_chafa; then 229 AC_DEFINE(HAVE_CHAFA, 1, [Have chafa terminal graphics library]) 230fi 231AM_CONDITIONAL(HAVE_CHAFA, $have_chafa) 232 233dnl ========================================================================== 234 235AC_ARG_WITH(icu, 236 [AS_HELP_STRING([--with-icu=@<:@yes/no/builtin/auto@:>@], 237 [Use ICU @<:@default=auto@:>@])],, 238 [with_icu=auto]) 239have_icu=false 240if test "x$with_icu" = "xyes" -o "x$with_icu" = "xbuiltin" -o "x$with_icu" = "xauto"; then 241 PKG_CHECK_MODULES(ICU, icu-uc, have_icu=true, :) 242fi 243if test \( "x$with_icu" = "xyes" -o "x$with_icu" = "xbuiltin" \) -a "x$have_icu" != "xtrue"; then 244 AC_MSG_ERROR([icu support requested but icu-uc not found]) 245fi 246 247if $have_icu; then 248 CXXFLAGS="$CXXFLAGS `$PKG_CONFIG --variable=CXXFLAGS icu-uc`" 249 AC_DEFINE(HAVE_ICU, 1, [Have ICU library]) 250 if test "x$with_icu" = "xbuiltin"; then 251 AC_DEFINE(HAVE_ICU_BUILTIN, 1, [Use hb-icu Unicode callbacks]) 252 fi 253fi 254AM_CONDITIONAL(HAVE_ICU, $have_icu) 255AM_CONDITIONAL(HAVE_ICU_BUILTIN, $have_icu && test "x$with_icu" = "xbuiltin") 256 257dnl =========================================================================== 258 259AC_ARG_WITH(graphite2, 260 [AS_HELP_STRING([--with-graphite2=@<:@yes/no/auto@:>@], 261 [Use the graphite2 library @<:@default=no@:>@])],, 262 [with_graphite2=no]) 263have_graphite2=false 264GRAPHITE2_DEPS="graphite2 >= 1.2.0" 265AC_SUBST(GRAPHITE2_DEPS) 266if test "x$with_graphite2" = "xyes" -o "x$with_graphite2" = "xauto"; then 267 PKG_CHECK_MODULES(GRAPHITE2, $GRAPHITE2_DEPS, have_graphite2=true, :) 268 if test "x$have_graphite2" != "xtrue"; then 269 # If pkg-config is not available, graphite2 can still be there 270 ac_save_CFLAGS="$CFLAGS" 271 ac_save_CPPFLAGS="$CPPFLAGS" 272 CFLAGS="$CFLAGS $GRAPHITE2_CFLAGS" 273 CPPFLAGS="$CPPFLAGS $GRAPHITE2_CFLAGS" 274 AC_CHECK_HEADER(graphite2/Segment.h, have_graphite2=true, :) 275 CPPFLAGS="$ac_save_CPPFLAGS" 276 CFLAGS="$ac_save_CFLAGS" 277 fi 278fi 279if test "x$with_graphite2" = "xyes" -a "x$have_graphite2" != "xtrue"; then 280 AC_MSG_ERROR([graphite2 support requested but libgraphite2 not found]) 281fi 282if $have_graphite2; then 283 AC_DEFINE(HAVE_GRAPHITE2, 1, [Have Graphite2 library]) 284fi 285AM_CONDITIONAL(HAVE_GRAPHITE2, $have_graphite2) 286 287dnl ========================================================================== 288 289AC_ARG_WITH(freetype, 290 [AS_HELP_STRING([--with-freetype=@<:@yes/no/auto@:>@], 291 [Use the FreeType library @<:@default=auto@:>@])],, 292 [with_freetype=auto]) 293have_freetype=false 294FREETYPE_DEPS="freetype2 >= 12.0.6" 295AC_SUBST(FREETYPE_DEPS) 296if test "x$with_freetype" = "xyes" -o "x$with_freetype" = "xauto"; then 297 # See freetype/docs/VERSION.DLL; 12.0.6 means freetype-2.4.2 298 PKG_CHECK_MODULES(FREETYPE, $FREETYPE_DEPS, have_freetype=true, :) 299fi 300if test "x$with_freetype" = "xyes" -a "x$have_freetype" != "xtrue"; then 301 AC_MSG_ERROR([FreeType support requested but libfreetype2 not found]) 302fi 303if $have_freetype; then 304 AC_DEFINE(HAVE_FREETYPE, 1, [Have FreeType 2 library]) 305 save_libs=$LIBS 306 LIBS="$LIBS $FREETYPE_LIBS" 307 AC_CHECK_FUNCS(FT_Get_Var_Blend_Coordinates FT_Set_Var_Blend_Coordinates FT_Done_MM_Var) 308 LIBS=$save_libs 309fi 310AM_CONDITIONAL(HAVE_FREETYPE, $have_freetype) 311 312dnl =========================================================================== 313 314AC_ARG_WITH(uniscribe, 315 [AS_HELP_STRING([--with-uniscribe=@<:@yes/no/auto@:>@], 316 [Use the Uniscribe library @<:@default=no@:>@])],, 317 [with_uniscribe=no]) 318have_uniscribe=false 319if test "x$with_uniscribe" = "xyes" -o "x$with_uniscribe" = "xauto"; then 320 AC_CHECK_HEADERS(usp10.h windows.h, have_uniscribe=true) 321fi 322if test "x$with_uniscribe" = "xyes" -a "x$have_uniscribe" != "xtrue"; then 323 AC_MSG_ERROR([uniscribe support requested but not found]) 324fi 325if $have_uniscribe; then 326 UNISCRIBE_CFLAGS= 327 UNISCRIBE_LIBS="-lusp10 -lgdi32 -lrpcrt4" 328 AC_SUBST(UNISCRIBE_CFLAGS) 329 AC_SUBST(UNISCRIBE_LIBS) 330 AC_DEFINE(HAVE_UNISCRIBE, 1, [Have Uniscribe library]) 331fi 332AM_CONDITIONAL(HAVE_UNISCRIBE, $have_uniscribe) 333 334dnl =========================================================================== 335 336AC_ARG_WITH(gdi, 337 [AS_HELP_STRING([--with-gdi=@<:@yes/no/auto@:>@], 338 [Provide GDI integration helpers @<:@default=no@:>@])],, 339 [with_gdi=no]) 340have_gdi=false 341if test "x$with_gdi" = "xyes" -o "x$with_gdi" = "xauto"; then 342 AC_CHECK_HEADERS(windows.h, have_gdi=true) 343fi 344if test "x$with_gdi" = "xyes" -a "x$have_gdi" != "xtrue"; then 345 AC_MSG_ERROR([gdi support requested but not found]) 346fi 347if $have_gdi; then 348 GDI_CFLAGS= 349 GDI_LIBS="-lgdi32" 350 AC_SUBST(GDI_CFLAGS) 351 AC_SUBST(GDI_LIBS) 352 AC_DEFINE(HAVE_GDI, 1, [Have GDI library]) 353fi 354AM_CONDITIONAL(HAVE_GDI, $have_gdi) 355 356dnl =========================================================================== 357 358AC_ARG_WITH(directwrite, 359 [AS_HELP_STRING([--with-directwrite=@<:@yes/no/auto@:>@], 360 [Use the DirectWrite library (experimental) @<:@default=no@:>@])],, 361 [with_directwrite=no]) 362have_directwrite=false 363AC_LANG_PUSH([C++]) 364if test "x$with_directwrite" = "xyes" -o "x$with_directwrite" = "xauto"; then 365 AC_CHECK_HEADERS(dwrite.h, have_directwrite=true) 366fi 367AC_LANG_POP([C++]) 368if test "x$with_directwrite" = "xyes" -a "x$have_directwrite" != "xtrue"; then 369 AC_MSG_ERROR([directwrite support requested but not found]) 370fi 371if $have_directwrite; then 372 DIRECTWRITE_CXXFLAGS= 373 DIRECTWRITE_LIBS= 374 AC_SUBST(DIRECTWRITE_CXXFLAGS) 375 AC_SUBST(DIRECTWRITE_LIBS) 376 AC_DEFINE(HAVE_DIRECTWRITE, 1, [Have DirectWrite library]) 377fi 378AM_CONDITIONAL(HAVE_DIRECTWRITE, $have_directwrite) 379 380dnl =========================================================================== 381 382AC_ARG_WITH(coretext, 383 [AS_HELP_STRING([--with-coretext=@<:@yes/no/auto@:>@], 384 [Use CoreText @<:@default=no@:>@])],, 385 [with_coretext=no]) 386have_coretext=false 387if test "x$with_coretext" = "xyes" -o "x$with_coretext" = "xauto"; then 388 AC_CHECK_TYPE(CTFontRef, have_coretext=true,, [#include <ApplicationServices/ApplicationServices.h>]) 389 390 if $have_coretext; then 391 CORETEXT_CFLAGS= 392 CORETEXT_LIBS="-framework ApplicationServices" 393 AC_SUBST(CORETEXT_CFLAGS) 394 AC_SUBST(CORETEXT_LIBS) 395 else 396 # On iOS CoreText and CoreGraphics are stand-alone frameworks 397 if test "x$have_coretext" != "xtrue"; then 398 # Check for a different symbol to avoid getting cached result. 399 AC_CHECK_TYPE(CTRunRef, have_coretext=true,, [#include <CoreText/CoreText.h>]) 400 fi 401 402 if $have_coretext; then 403 CORETEXT_CFLAGS= 404 CORETEXT_LIBS="-framework CoreText -framework CoreGraphics -framework CoreFoundation" 405 AC_SUBST(CORETEXT_CFLAGS) 406 AC_SUBST(CORETEXT_LIBS) 407 fi 408 fi 409fi 410if test "x$with_coretext" = "xyes" -a "x$have_coretext" != "xtrue"; then 411 AC_MSG_ERROR([CoreText support requested but libcoretext not found]) 412fi 413if $have_coretext; then 414 AC_DEFINE(HAVE_CORETEXT, 1, [Have Core Text backend]) 415fi 416AM_CONDITIONAL(HAVE_CORETEXT, $have_coretext) 417 418dnl =========================================================================== 419 420AC_CONFIG_FILES([ 421Makefile 422src/Makefile 423src/harfbuzz-config.cmake 424util/Makefile 425test/Makefile 426test/api/Makefile 427test/fuzzing/Makefile 428test/shaping/Makefile 429test/shaping/data/Makefile 430test/shaping/data/aots/Makefile 431test/shaping/data/in-house/Makefile 432test/shaping/data/text-rendering-tests/Makefile 433test/subset/Makefile 434test/subset/data/Makefile 435test/subset/data/repack_tests/Makefile 436docs/Makefile 437docs/version.xml 438]) 439 440AC_OUTPUT 441 442echo 443echo "C++ compiler version:" 444$CXX --version 445echo 446 447AC_MSG_NOTICE([ 448 449Autotools is no longer our supported build system for building the library 450for *nix distributions, please migrate to meson. 451 452]) 453 454 455AC_MSG_NOTICE([ 456 457Build configuration: 458 459Unicode callbacks (you want at least one): 460 Builtin true 461 Glib: ${have_glib} 462 ICU: ${have_icu} 463 464Font callbacks (the more the merrier): 465 FreeType: ${have_freetype} 466 467Tools used for command-line utilities: 468 Cairo: ${have_cairo} 469 Chafa: ${have_chafa} 470 471Additional shapers: 472 Graphite2: ${have_graphite2} 473 474Platform shapers (not normally needed): 475 CoreText: ${have_coretext} 476 DirectWrite: ${have_directwrite} 477 GDI: ${have_gdi} 478 Uniscribe: ${have_uniscribe} 479 480Other features: 481 Documentation: ${enable_gtk_doc} 482 GObject bindings: ${have_gobject} 483 Introspection: ${have_introspection} 484]) 485