1# This file is part of the FreeType project. 2# 3# Process this file with autoconf to produce a configure script. 4# 5# Copyright (C) 2001-2021 by 6# David Turner, Robert Wilhelm, and Werner Lemberg. 7# 8# This file is part of the FreeType project, and may only be used, modified, 9# and distributed under the terms of the FreeType project license, 10# LICENSE.TXT. By continuing to use, modify, or distribute this file you 11# indicate that you have read the license and understand and accept it 12# fully. 13 14AC_INIT([FreeType], [2.11.1], [freetype@nongnu.org], [freetype]) 15AC_CONFIG_SRCDIR([ftconfig.h.in]) 16 17 18# Don't forget to update `docs/VERSIONS.TXT'! 19 20version_info='24:1:18' 21AC_SUBST([version_info]) 22ft_version=`echo $version_info | tr : .` 23AC_SUBST([ft_version]) 24 25 26# checks for system type 27 28AC_CANONICAL_HOST 29 30 31# checks for programs 32 33AC_PROG_CC 34AC_PROG_CPP 35AC_SUBST(EXEEXT) 36 37PKG_PROG_PKG_CONFIG([0.24]) 38 39LT_INIT(win32-dll) 40AC_CHECK_HEADER([windows.h], [LT_PROG_RC]) 41 42 43# checks for native programs to generate building tool 44 45if test ${cross_compiling} = yes; then 46 AC_CHECK_PROG(CC_BUILD, ${build}-gcc, ${build}-gcc) 47 test -z "${CC_BUILD}" && AC_CHECK_PROG(CC_BUILD, gcc, gcc) 48 test -z "${CC_BUILD}" && AC_CHECK_PROG(CC_BUILD, cc, cc, , , /usr/ucb/cc) 49 test -z "${CC_BUILD}" && AC_MSG_ERROR([cannot find native C compiler]) 50 51 AC_MSG_CHECKING([for suffix of native executables]) 52 rm -f a.* b.* a_out.exe conftest.* 53 echo > conftest.c "int main() { return 0;}" 54 ${CC_BUILD} conftest.c || AC_MSG_ERROR([native C compiler is not working]) 55 rm -f conftest.c 56 if test -x a.out -o -x b.out -o -x conftest; then 57 EXEEXT_BUILD="" 58 elif test -x a_out.exe -o -x conftest.exe; then 59 EXEEXT_BUILD=".exe" 60 elif test -x conftest.*; then 61 EXEEXT_BUILD=`echo conftest.* | sed -n '1s/^.*\././'` 62 fi 63 rm -f a.* b.* a_out.exe conftest.* 64 AC_MSG_RESULT($EXEEXT_BUILD) 65else 66 CC_BUILD=${CC} 67 EXEEXT_BUILD=${EXEEXT} 68fi 69 70AC_SUBST(CC_BUILD) 71AC_SUBST(EXEEXT_BUILD) 72 73 74# Since these files will be eventually called from another directory (namely 75# from the top level) we make the path of the scripts absolute. 76# 77# This small code snippet has been taken from automake's `ylwrap' script. 78 79AC_PROG_INSTALL 80case "$INSTALL" in 81[[\\/]]* | ?:[[\\/]]*) 82 ;; 83*[[\\/]]*) 84 INSTALL="`pwd`/$INSTALL" 85 ;; 86esac 87 88AC_PROG_MKDIR_P 89case "$MKDIR_P" in 90[[\\/]]* | ?:[[\\/]]*) 91 ;; 92*[[\\/]]*) 93 MKDIR_P="`pwd`/$MKDIR_P" 94 ;; 95esac 96 97 98# checks for header files 99 100AC_CHECK_HEADERS([fcntl.h unistd.h]) 101 102 103# checks for typedefs, structures, and compiler characteristics 104 105AC_C_CONST 106 107AC_ARG_ENABLE([freetype-config], 108 AS_HELP_STRING([--enable-freetype-config], [install freetype-config]), 109 [case "${enableval}" in 110 yes) enable_freetype_config="TRUE" ;; 111 no) enable_freetype_config="FALSE" ;; 112 *) AC_MSG_ERROR([unknown value '${enableval}' passed with --enable-freetype-config]) ;; 113 esac], [enable_freetype_config="FALSE"]) 114 115AC_SUBST(INSTALL_FT2_CONFIG, [$enable_freetype_config]) 116 117# checks for library functions 118 119AC_SYS_LARGEFILE 120 121# Here we check whether we can use our mmap file component. 122# 123# Note that `ftsystem.c` for Windows has its own mmap-like implementation 124# not covered by `AC_FUNC_MMAP` and/or `FT_UNMAP_PARAM`. 125 126AC_ARG_ENABLE([mmap], 127 AS_HELP_STRING([--disable-mmap], 128 [do not check mmap() and do not use]), 129 [enable_mmap="no"], [enable_mmap="yes"]) 130if test "x${enable_mmap}" != "xno"; then 131 case "$host" in 132 *-*-mingw*) 133 AC_MSG_CHECKING([for working mmap]) 134 AC_MSG_RESULT([using MapViewOfFile in Windows]) 135 FTSYS_SRC='$(TOP_DIR)/builds/windows/ftsystem.c' 136 ;; 137 *) 138 AC_FUNC_MMAP 139 if test "$ac_cv_func_mmap_fixed_mapped" = "yes"; then 140 FTSYS_SRC='$(PLATFORM_DIR)/ftsystem.c' 141 142 AC_CHECK_DECLS([munmap], 143 [], 144 [], 145 [ 146 147#ifdef HAVE_UNISTD_H 148#include <unistd.h> 149#endif 150#include <sys/mman.h> 151 152 ]) 153 154 FT_MUNMAP_PARAM 155 fi 156 ;; 157 esac 158fi 159 160if test -z "$FTSYS_SRC"; then 161 FTSYS_SRC='$(BASE_DIR)/ftsystem.c' 162fi 163AC_SUBST([FTSYS_SRC]) 164 165 166AC_CHECK_FUNCS([memcpy memmove]) 167 168 169# get compiler flags right 170# 171# We try to make the compiler work for C99-strict source. Even if the 172# C compiler is gcc and C99 flags are available, some system headers 173# might be broken in C99 mode. We have to check whether compilation 174# finishes successfully. 175# 176if test "x$GCC" = xyes; then 177 XX_CFLAGS="-Wall" 178 case "$host" in 179 *-*-mingw*) 180 XX_ANSIFLAGS="-pedantic" 181 ;; 182 *-*-aix*) 183 XX_ANSIFLAGS="-pedantic" 184 ;; 185 *) 186 XX_ANSIFLAGS="" 187 188 for a in "-pedantic" "-std=c99" 189 do 190 AC_MSG_CHECKING([$CC compiler flag ${a} to assure ANSI C99 works correctly]) 191 orig_CFLAGS="${CFLAGS}" 192 CFLAGS="${CFLAGS} ${XX_ANSIFLAGS} ${a}" 193 AC_COMPILE_IFELSE([ 194 AC_LANG_PROGRAM([ 195 196#include <stdio.h> 197 198 ], 199 [ 200 201 { 202 puts( "" ); 203 return 0; 204 } 205 206 ])], 207 [AC_MSG_RESULT([ok, adding to XX_ANSIFLAGS]) 208 XX_ANSIFLAGS="${XX_ANSIFLAGS} ${a}" 209 ], 210 [AC_MSG_RESULT([no])]) 211 CFLAGS="${orig_CFLAGS}" 212 done 213 ;; 214 esac 215else 216 case "$host" in 217 *-dec-osf*) 218 CFLAGS= 219 XX_CFLAGS="-std1 -g3" 220 XX_ANSIFLAGS= 221 ;; 222 *) 223 XX_CFLAGS= 224 XX_ANSIFLAGS= 225 ;; 226 esac 227fi 228AC_SUBST([XX_CFLAGS]) 229AC_SUBST([XX_ANSIFLAGS]) 230 231 232# It is recommended that shared libraries hide symbols except those with 233# explicit __attribute__((visibility("default"))). 234# 235found_visibility_flag=no 236AC_MSG_CHECKING([for -fvisibility=hidden compiler flag]) 237orig_CFLAGS="${CFLAGS}" 238CFLAGS="${CFLAGS} -fvisibility=hidden" 239AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], 240 [found_visibility_flag=yes 241 AC_MSG_RESULT(yes)], 242 [CFLAGS="${orig_CFLAGS}" 243 AC_MSG_RESULT(no)]) 244 245if test "${found_visibility_flag}" = "no"; then 246 AC_MSG_CHECKING([for -xldscope=hidden compiler flag]) 247 orig_CFLAGS="${CFLAGS}" 248 CFLAGS="${CFLAGS} -xldscope=hidden" 249 AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], 250 [found_visibility_flag=yes 251 AC_MSG_RESULT(yes)], 252 [CFLAGS="${orig_CFLAGS}" 253 AC_MSG_RESULT(no)]) 254fi 255 256# All library tests below try `pkg-config' first. If that fails, a function 257# from the library is tested in the traditional autoconf way (zlib, bzip2), 258# or a config script is called (libpng). 259# 260# The `xxx_reqpriv' variables are for the `Requires.private' field in 261# `freetype2.pc'. The `xxx_libspriv' variables are for the `Libs.private' 262# field in `freetype2.pc' if pkg-config doesn't find a proper .pc file. 263# 264# The `xxx_libsstaticconf' variables are for the `freetype-config' script. 265# 266# Note that a call to PKG_CHECK_MODULES(XXX, ...) sets and creates the 267# output variables `XXX_CFLAGS' and `XXX_LIBS'. In case one or both are set 268# for a library by the user, no entry for this library is added to 269# `Requires.private'. Instead, it gets added to `Libs.private' 270 271 272# check for system zlib 273 274AC_ARG_WITH([zlib], 275 [AS_HELP_STRING([--with-zlib=@<:@yes|no|auto@:>@], 276 [use system zlib instead of internal library @<:@default=auto@:>@])], 277 [], [with_zlib=auto]) 278 279have_zlib=no 280if test x"$with_zlib" = xyes -o x"$with_zlib" = xauto; then 281 zlib_pkg="zlib" 282 have_zlib_pkg=no 283 284 if test x"$ZLIB_CFLAGS" = x -a x"$ZLIB_LIBS" = x; then 285 PKG_CHECK_EXISTS([$zlib_pkg], [have_zlib_pkg=yes]) 286 fi 287 PKG_CHECK_MODULES([ZLIB], [$zlib_pkg], 288 [have_zlib="yes (pkg-config)"], [:]) 289 290 if test $have_zlib_pkg = yes; then 291 # we have zlib.pc 292 zlib_reqpriv="$zlib_pkg" 293 zlib_libspriv= 294 zlib_libsstaticconf=`$PKG_CONFIG --static --libs "$zlib_pkg"` 295 else 296 zlib_reqpriv= 297 298 if test "$have_zlib" != no; then 299 # ZLIB_CFLAGS and ZLIB_LIBS are set by the user 300 zlib_libspriv="$ZLIB_LIBS" 301 zlib_libsstaticconf="$ZLIB_LIBS" 302 have_zlib="yes (ZLIB_CFLAGS and ZLIB_LIBS)" 303 else 304 # fall back to standard autoconf test 305 AC_CHECK_LIB([z], 306 [gzsetparams], 307 [AC_CHECK_HEADER([zlib.h], 308 [have_zlib="yes (autoconf test)" 309 zlib_libspriv="-lz" 310 zlib_libsstaticconf="$zlib_libspriv" 311 ZLIB_LIBS="$zlib_libspriv"])]) 312 fi 313 fi 314fi 315 316if test x"$with_zlib" = xyes -a "$have_zlib" = no; then 317 AC_MSG_ERROR([external zlib support requested but library not found]) 318fi 319 320 321# check for system libbz2 322 323AC_ARG_WITH([bzip2], 324 [AS_HELP_STRING([--with-bzip2=@<:@yes|no|auto@:>@], 325 [support bzip2 compressed fonts @<:@default=auto@:>@])], 326 [], [with_bzip2=auto]) 327 328have_bzip2=no 329if test x"$with_bzip2" = xyes -o x"$with_bzip2" = xauto; then 330 bzip2_pkg="bzip2" 331 have_bzip2_pkg=no 332 333 if test x"$BZIP2_CFLAGS" = x -a x"$BZIP2_LIBS" = x; then 334 PKG_CHECK_EXISTS([$bzip2_pkg], [have_bzip2_pkg=yes]) 335 fi 336 PKG_CHECK_MODULES([BZIP2], [$bzip2_pkg], 337 [have_bzip2="yes (pkg-config)"], [:]) 338 339 if test $have_bzip2_pkg = yes; then 340 # we have bzip2.pc 341 bzip2_reqpriv="$bzip2_pkg" 342 bzip2_libspriv= 343 bzip2_libsstaticconf=`$PKG_CONFIG --static --libs "$bzip2_pkg"` 344 else 345 bzip2_reqpriv= 346 347 if test "$have_bzip2" != no; then 348 # BZIP2_CFLAGS and BZIP2_LIBS are set by the user 349 bzip2_libspriv="$BZIP2_LIBS" 350 bzip2_libsstaticconf="$BZIP2_LIBS" 351 have_bzip2="yes (BZIP2_CFLAGS and BZIP2_LIBS)" 352 else 353 # fall back to standard autoconf test 354 AC_CHECK_LIB([bz2], 355 [BZ2_bzDecompress], 356 [AC_CHECK_HEADER([bzlib.h], 357 [have_bzip2="yes (autoconf test)" 358 bzip2_libspriv="-lbz2" 359 bzip2_libsstaticconf="$bzip2_libspriv" 360 BZIP2_LIBS="$bzip2_libspriv"])]) 361 fi 362 fi 363fi 364 365if test x"$with_bzip2" = xyes -a "$have_bzip2" = no; then 366 AC_MSG_ERROR([bzip2 support requested but library not found]) 367fi 368 369 370# check for system libpng 371 372AC_ARG_WITH([png], 373 [AS_HELP_STRING([--with-png=@<:@yes|no|auto@:>@], 374 [support png compressed OpenType embedded bitmaps @<:@default=auto@:>@])], 375 [], [with_png=auto]) 376 377have_libpng=no 378if test x"$with_png" = xyes -o x"$with_png" = xauto; then 379 libpng_pkg="libpng" 380 have_libpng_pkg=no 381 382 if test x"$LIBPNG_CFLAGS" = x -a x"$LIBPNG_LIBS" = x; then 383 PKG_CHECK_EXISTS([$libpng_pkg], [have_libpng_pkg=yes]) 384 fi 385 PKG_CHECK_MODULES([LIBPNG], [$libpng_pkg], 386 [have_libpng="yes (pkg-config)"], [:]) 387 388 if test $have_libpng_pkg = yes; then 389 # we have libpng.pc 390 libpng_reqpriv="$libpng_pkg" 391 libpng_libspriv= 392 libpng_libsstaticconf=`$PKG_CONFIG --static --libs "$libpng_pkg"` 393 else 394 libpng_reqpriv= 395 396 if test "$have_libpng" != no; then 397 # LIBPNG_CFLAGS and LIBPNG_LIBS are set by the user 398 libpng_libspriv="$LIBPNG_LIBS" 399 libpng_libsstaticconf="$LIBPNG_LIBS" 400 have_libpng="yes (LIBPNG_CFLAGS and LIBPNG_LIBS)" 401 else 402 # fall back to config script 403 AC_MSG_CHECKING([for libpng-config]) 404 if which libpng-config > /dev/null 2>&1; then 405 LIBPNG_CFLAGS=`libpng-config --cflags` 406 LIBPNG_LIBS=`libpng-config --ldflags` 407 libpng_libspriv=`libpng-config --static --ldflags` 408 libpng_libsstaticconf="$libpng_libspriv" 409 have_libpng="yes (libpng-config)" 410 AC_MSG_RESULT([yes]) 411 else 412 AC_MSG_RESULT([no]) 413 fi 414 fi 415 fi 416fi 417 418if test x"$with_png" = xyes -a "$have_libpng" = no; then 419 AC_MSG_ERROR([libpng support requested but library not found]) 420fi 421 422 423# check for system libharfbuzz 424 425AC_ARG_WITH([harfbuzz], 426 [AS_HELP_STRING([--with-harfbuzz=@<:@yes|no|auto@:>@], 427 [improve auto-hinting of OpenType fonts @<:@default=auto@:>@])], 428 [], [with_harfbuzz=auto]) 429 430have_harfbuzz=no 431if test x"$with_harfbuzz" = xyes -o x"$with_harfbuzz" = xauto; then 432 harfbuzz_pkg="harfbuzz >= 2.0.0" 433 have_harfbuzz_pkg=no 434 435 if test x"$HARFBUZZ_CFLAGS" = x -a x"$HARFBUZZ_LIBS" = x; then 436 PKG_CHECK_EXISTS([$harfbuzz_pkg], [have_harfbuzz_pkg=yes]) 437 fi 438 PKG_CHECK_MODULES([HARFBUZZ], [$harfbuzz_pkg], 439 [have_harfbuzz="yes (pkg-config)"], [:]) 440 441 if test $have_harfbuzz_pkg = yes; then 442 # we have harfbuzz.pc 443 harfbuzz_reqpriv="$harfbuzz_pkg" 444 harfbuzz_libspriv= 445 harfbuzz_libsstaticconf=`$PKG_CONFIG --static --libs "$harfbuzz_pkg"` 446 else 447 harfbuzz_reqpriv= 448 449 if test "$have_harfbuzz" != no; then 450 # HARFBUZZ_CFLAGS and HARFBUZZ_LIBS are set by the user 451 harfbuzz_libspriv="$HARFBUZZ_LIBS" 452 harfbuzz_libsstaticconf="$HARFBUZZ_LIBS" 453 have_harfbuzz="yes (HARFBUZZ_CFLAGS and HARFBUZZ_LIBS)" 454 else 455 # since HarfBuzz is quite a new library we don't fall back to a 456 # different test; additionally, it has too many dependencies 457 : 458 fi 459 fi 460fi 461 462if test x"$with_harfbuzz" = xyes -a "$have_harfbuzz" = no; then 463 AC_MSG_ERROR([harfbuzz support requested but library not found]) 464fi 465 466 467# check for system libbrotlidec 468 469AC_ARG_WITH([brotli], 470 [AS_HELP_STRING([--with-brotli=@<:@yes|no|auto@:>@], 471 [support decompression of WOFF2 streams @<:@default=auto@:>@])], 472 [], [with_brotli=auto]) 473 474have_brotli=no 475if test x"$with_brotli" = xyes -o x"$with_brotli" = xauto; then 476 brotli_pkg="libbrotlidec" 477 have_brotli_pkg=no 478 479 if test x"$BROTLI_CFLAGS" = x -a x"$BROTLI_LIBS" = x; then 480 PKG_CHECK_EXISTS([$brotli_pkg], [have_brotli_pkg=yes]) 481 fi 482 PKG_CHECK_MODULES([BROTLI], [$brotli_pkg], 483 [have_brotli="yes (pkg-config)"], [:]) 484 485 if test $have_brotli_pkg = yes; then 486 # we have libbrotlidec.pc 487 brotli_reqpriv="$brotli_pkg" 488 brotli_libspriv= 489 brotli_libsstaticconf=`$PKG_CONFIG --static --libs "$brotli_pkg"` 490 else 491 brotli_reqpriv= 492 493 if test "$have_brotli" != no; then 494 # BROTLI_CFLAGS and BROTLI_LIBS are set by the user 495 brotli_libspriv="$BROTLI_LIBS" 496 brotli_libsstaticconf="$BROTLI_LIBS" 497 have_brotli="yes (BROTLI_CFLAGS and BROTLI_LIBS)" 498 else 499 # since Brotli is quite a new library we don't fall back to a 500 # different test 501 : 502 fi 503 fi 504fi 505 506if test x"$with_brotli" = xyes -a "$have_brotli" = no; then 507 AC_MSG_ERROR([brotli support requested but library not found]) 508fi 509 510 511# check for librt 512# 513# We need `clock_gettime' for the `ftbench' demo program. 514# 515# The code is modeled after gnulib's file `clock_time.m4', ignoring 516# very old Solaris systems. 517 518LIB_CLOCK_GETTIME= 519AC_SEARCH_LIBS([clock_gettime], 520 [rt], 521 [test "$ac_cv_search_clock_gettime" = "none required" \ 522 || LIB_CLOCK_GETTIME=$ac_cv_search_clock_gettime]) 523AC_SUBST([LIB_CLOCK_GETTIME]) 524 525 526# Some options handling SDKs/archs in CFLAGS should be copied 527# to LDFLAGS. Apple TechNote 2137 recommends to include these 528# options in CFLAGS but not in LDFLAGS. 529 530save_config_args=$* 531set dummy ${CFLAGS} 532i=1 533while test $i -le $# 534do 535 c=$1 536 537 case "${c}" in 538 -isysroot|-arch) # options taking 1 argument 539 a=$2 540 AC_MSG_CHECKING([whether CFLAGS and LDFLAGS share ${c} ${a}]) 541 if expr " ${LDFLAGS} " : ".* ${c} *${a}.*" > /dev/null 542 then 543 AC_MSG_RESULT([yes]) 544 else 545 AC_MSG_RESULT([no, copy to LDFLAGS]) 546 LDFLAGS="${LDFLAGS} ${c} ${a}" 547 fi 548 shift 1 549 ;; 550 -m32|-m64|-march=*|-mcpu=*) # options taking no argument 551 AC_MSG_CHECKING([whether CFLAGS and LDFLAGS share ${c}]) 552 if expr " ${LDFLAGS} " : ".* ${c} *${a}.*" > /dev/null 553 then 554 AC_MSG_RESULT([yes]) 555 else 556 AC_MSG_RESULT([no, copy to LDFLAGS]) 557 LDFLAGS="${LDFLAGS} ${c}" 558 fi 559 ;; 560 # *) 561 # AC_MSG_RESULT([${c} is not copied to LDFLAGS]) 562 # ;; 563 esac 564 565 shift 1 566done 567set ${save_config_args} 568 569 570# Whether to use Mac OS resource-based fonts. 571 572ftmac_c="" # src/base/ftmac.c should not be included in makefiles by default 573 574AC_ARG_WITH([old-mac-fonts], 575 AS_HELP_STRING([--with-old-mac-fonts], 576 [allow Mac resource-based fonts to be used])) 577if test x$with_old_mac_fonts = xyes; then 578 orig_LDFLAGS="${LDFLAGS}" 579 AC_MSG_CHECKING([CoreServices & ApplicationServices of Mac OS X]) 580 ft2_extra_libs="-Wl,-framework,CoreServices -Wl,-framework,ApplicationServices" 581 LDFLAGS="$LDFLAGS $ft2_extra_libs" 582 AC_LINK_IFELSE([ 583 AC_LANG_PROGRAM([ 584 585#if defined(__GNUC__) && defined(__APPLE_CC__) 586# include <CoreServices/CoreServices.h> 587# include <ApplicationServices/ApplicationServices.h> 588#else 589# include <ConditionalMacros.h> 590# include <Files.h> 591#endif 592 593 ], 594 [ 595 596 short res = 0; 597 598 599 UseResFile( res ); 600 601 ])], 602 [AC_MSG_RESULT([ok]) 603 ftmac_c='ftmac.c' 604 AC_MSG_CHECKING([whether OS_INLINE macro is ANSI compatible]) 605 orig_CFLAGS="$CFLAGS -DFT_MACINTOSH" 606 CFLAGS="$CFLAGS $XX_CFLAGS $XX_ANSIFLAGS" 607 AC_COMPILE_IFELSE([ 608 AC_LANG_PROGRAM([ 609 610#if defined(__GNUC__) && defined(__APPLE_CC__) 611# include <CoreServices/CoreServices.h> 612# include <ApplicationServices/ApplicationServices.h> 613#else 614# include <ConditionalMacros.h> 615# include <Files.h> 616#endif 617 618 ], 619 [ 620 621 /* OSHostByteOrder() is typed as OS_INLINE */ 622 int32_t os_byte_order = OSHostByteOrder(); 623 624 625 if ( OSBigEndian != os_byte_order ) 626 return 1; 627 628 ])], 629 [AC_MSG_RESULT([ok]) 630 CFLAGS="$orig_CFLAGS" 631 CFLAGS="$CFLAGS -DHAVE_ANSI_OS_INLINE=1" 632 ], 633 [AC_MSG_RESULT([no, ANSI incompatible]) 634 CFLAGS="$orig_CFLAGS" 635 ]) 636 AC_MSG_CHECKING([type ResourceIndex]) 637 orig_CFLAGS="$CFLAGS" 638 CFLAGS="$CFLAGS $XX_CFLAGS $XX_ANSIFLAGS" 639 AC_COMPILE_IFELSE([ 640 AC_LANG_PROGRAM([ 641 642#if defined(__GNUC__) && defined(__APPLE_CC__) 643# include <CoreServices/CoreServices.h> 644# include <ApplicationServices/ApplicationServices.h> 645#else 646# include <ConditionalMacros.h> 647# include <Files.h> 648# include <Resources.h> 649#endif 650 651 ], 652 [ 653 654 ResourceIndex i = 0; 655 return i; 656 657 ])], 658 [AC_MSG_RESULT([ok]) 659 CFLAGS="$orig_CFLAGS" 660 CFLAGS="$CFLAGS -DHAVE_TYPE_RESOURCE_INDEX=1" 661 ], 662 [AC_MSG_RESULT([no]) 663 CFLAGS="$orig_CFLAGS" 664 CFLAGS="$CFLAGS -DHAVE_TYPE_RESOURCE_INDEX=0" 665 ])], 666 [AC_MSG_RESULT([not found]) 667 ft2_extra_libs="" 668 LDFLAGS="${orig_LDFLAGS}" 669 CFLAGS="$CFLAGS -DDARWIN_NO_CARBON"]) 670else 671 case x$host_os in 672 xdarwin*) 673 dnl AC_MSG_WARN([host system is MacOS but configured to build without Carbon]) 674 CFLAGS="$CFLAGS -DDARWIN_NO_CARBON" 675 ;; 676 *) 677 ;; 678 esac 679fi 680 681 682# Whether to use FileManager, which is deprecated since Mac OS X 10.4. 683 684AC_ARG_WITH([fsspec], 685 AS_HELP_STRING([--with-fsspec], 686 [use obsolete FSSpec API of MacOS, if available (default=yes)])) 687if test x$with_fsspec = xno; then 688 CFLAGS="$CFLAGS -DHAVE_FSSPEC=0" 689elif test x$with_old_mac_fonts = xyes -a x$with_fsspec != x; then 690 AC_MSG_CHECKING([FSSpec-based FileManager]) 691 AC_LINK_IFELSE([ 692 AC_LANG_PROGRAM([ 693 694#if defined(__GNUC__) && defined(__APPLE_CC__) 695# include <CoreServices/CoreServices.h> 696# include <ApplicationServices/ApplicationServices.h> 697#else 698# include <ConditionalMacros.h> 699# include <Files.h> 700#endif 701 702 ], 703 [ 704 705 FCBPBPtr paramBlock; 706 short vRefNum; 707 long dirID; 708 ConstStr255Param fileName; 709 FSSpec* spec; 710 711 712 /* FSSpec functions: deprecated since Mac OS X 10.4 */ 713 PBGetFCBInfoSync( paramBlock ); 714 FSMakeFSSpec( vRefNum, dirID, fileName, spec ); 715 716 ])], 717 [AC_MSG_RESULT([ok]) 718 CFLAGS="$CFLAGS -DHAVE_FSSPEC=1"], 719 [AC_MSG_RESULT([not found]) 720 CFLAGS="$CFLAGS -DHAVE_FSSPEC=0"]) 721fi 722 723 724# Whether to use FileManager in Carbon since MacOS 9.x. 725 726AC_ARG_WITH([fsref], 727 AS_HELP_STRING([--with-fsref], 728 [use Carbon FSRef API of MacOS, if available (default=yes)])) 729if test x$with_fsref = xno; then 730 AC_MSG_WARN([ 731*** WARNING 732 FreeType2 built without FSRef API cannot load 733 data-fork fonts on MacOS, except of XXX.dfont. 734 ]) 735 CFLAGS="$CFLAGS -DHAVE_FSREF=0" 736elif test x$with_old_mac_fonts = xyes -a x$with_fsref != x; then 737 AC_MSG_CHECKING([FSRef-based FileManager]) 738 AC_LINK_IFELSE([ 739 AC_LANG_PROGRAM([ 740 741#if defined(__GNUC__) && defined(__APPLE_CC__) 742# include <CoreServices/CoreServices.h> 743# include <ApplicationServices/ApplicationServices.h> 744#else 745# include <ConditionalMacros.h> 746# include <Files.h> 747#endif 748 749 ], 750 [ 751 752 short vRefNum; 753 long dirID; 754 ConstStr255Param fileName; 755 756 Boolean* isDirectory; 757 UInt8* path; 758 SInt16 desiredRefNum; 759 SInt16* iterator; 760 SInt16* actualRefNum; 761 HFSUniStr255* outForkName; 762 FSVolumeRefNum volume; 763 FSCatalogInfoBitmap whichInfo; 764 FSCatalogInfo* catalogInfo; 765 FSForkInfo* forkInfo; 766 FSRef* ref; 767 768#if HAVE_FSSPEC 769 FSSpec* spec; 770#endif 771 772 /* FSRef functions: no need to check? */ 773 FSGetForkCBInfo( desiredRefNum, volume, iterator, 774 actualRefNum, forkInfo, ref, 775 outForkName ); 776 FSPathMakeRef( path, ref, isDirectory ); 777 778#if HAVE_FSSPEC 779 FSpMakeFSRef ( spec, ref ); 780 FSGetCatalogInfo( ref, whichInfo, catalogInfo, 781 outForkName, spec, ref ); 782#endif 783 ])], 784 [AC_MSG_RESULT([ok]) 785 CFLAGS="$CFLAGS -DHAVE_FSREF=1"], 786 [AC_MSG_RESULT([not found]) 787 CFLAGS="$CFLAGS -DHAVE_FSREF=0"]) 788fi 789 790 791# Whether to use QuickDraw API in ToolBox, which is deprecated since 792# Mac OS X 10.4. 793 794AC_ARG_WITH([quickdraw-toolbox], 795 AS_HELP_STRING([--with-quickdraw-toolbox], 796 [use MacOS QuickDraw in ToolBox, if available (default=yes)])) 797if test x$with_quickdraw_toolbox = xno; then 798 CFLAGS="$CFLAGS -DHAVE_QUICKDRAW_TOOLBOX=0" 799elif test x$with_old_mac_fonts = xyes -a x$with_quickdraw_toolbox != x; then 800 AC_MSG_CHECKING([QuickDraw FontManager functions in ToolBox]) 801 AC_LINK_IFELSE([ 802 AC_LANG_PROGRAM([ 803 804#if defined(__GNUC__) && defined(__APPLE_CC__) 805# include <CoreServices/CoreServices.h> 806# include <ApplicationServices/ApplicationServices.h> 807#else 808# include <ConditionalMacros.h> 809# include <Fonts.h> 810#endif 811 812 ], 813 [ 814 815 Str255 familyName; 816 SInt16 familyID = 0; 817 FMInput* fmIn = NULL; 818 FMOutput* fmOut = NULL; 819 820 821 GetFontName( familyID, familyName ); 822 GetFNum( familyName, &familyID ); 823 fmOut = FMSwapFont( fmIn ); 824 825 ])], 826 [AC_MSG_RESULT([ok]) 827 CFLAGS="$CFLAGS -DHAVE_QUICKDRAW_TOOLBOX=1"], 828 [AC_MSG_RESULT([not found]) 829 CFLAGS="$CFLAGS -DHAVE_QUICKDRAW_TOOLBOX=0"]) 830fi 831 832 833# Whether to use QuickDraw API in Carbon, which is deprecated since 834# Mac OS X 10.4. 835 836AC_ARG_WITH([quickdraw-carbon], 837 AS_HELP_STRING([--with-quickdraw-carbon], 838 [use MacOS QuickDraw in Carbon, if available (default=yes)])) 839if test x$with_quickdraw_carbon = xno; then 840 CFLAGS="$CFLAGS -DHAVE_QUICKDRAW_CARBON=0" 841elif test x$with_old_mac_fonts = xyes -a x$with_quickdraw_carbon != x; then 842 AC_MSG_CHECKING([QuickDraw FontManager functions in Carbon]) 843 AC_LINK_IFELSE([ 844 AC_LANG_PROGRAM([ 845 846#if defined(__GNUC__) && defined(__APPLE_CC__) 847# include <CoreServices/CoreServices.h> 848# include <ApplicationServices/ApplicationServices.h> 849#else 850# include <ConditionalMacros.h> 851# include <Fonts.h> 852#endif 853 854 ], 855 [ 856 857 FMFontFamilyIterator famIter; 858 FMFontFamily family; 859 Str255 famNameStr; 860 FMFontFamilyInstanceIterator instIter; 861 FMFontStyle style; 862 FMFontSize size; 863 FMFont font; 864 FSSpec* pathSpec; 865 866 867 FMCreateFontFamilyIterator( NULL, NULL, kFMUseGlobalScopeOption, 868 &famIter ); 869 FMGetNextFontFamily( &famIter, &family ); 870 FMGetFontFamilyName( family, famNameStr ); 871 FMCreateFontFamilyInstanceIterator( family, &instIter ); 872 FMGetNextFontFamilyInstance( &instIter, &font, &style, &size ); 873 FMDisposeFontFamilyInstanceIterator( &instIter ); 874 FMDisposeFontFamilyIterator( &famIter ); 875 FMGetFontContainer( font, pathSpec ); 876 877 ])], 878 [AC_MSG_RESULT([ok]) 879 CFLAGS="$CFLAGS -DHAVE_QUICKDRAW_CARBON=1"], 880 [AC_MSG_RESULT([not found]) 881 CFLAGS="$CFLAGS -DHAVE_QUICKDRAW_CARBON=0"]) 882fi 883 884 885# Whether to use AppleTypeService since Mac OS X. 886 887AC_ARG_WITH([ats], 888 AS_HELP_STRING([--with-ats], 889 [use AppleTypeService, if available (default=yes)])) 890if test x$with_ats = xno; then 891 CFLAGS="$CFLAGS -DHAVE_ATS=0" 892elif test x$with_old_mac_fonts = xyes -a x$with_ats != x; then 893 AC_MSG_CHECKING([AppleTypeService functions]) 894 AC_LINK_IFELSE([ 895 AC_LANG_PROGRAM([ 896 897#if defined(__GNUC__) && defined(__APPLE_CC__) 898# include <CoreServices/CoreServices.h> 899# include <ApplicationServices/ApplicationServices.h> 900#else 901# include <ConditionalMacros.h> 902# include <Files.h> 903#endif 904 905 ], 906 [ 907 908 FSSpec* pathSpec; 909 910 911 ATSFontFindFromName( NULL, kATSOptionFlagsUnRestrictedScope ); 912#if HAVE_FSSPEC 913 ATSFontGetFileSpecification( 0, pathSpec ); 914#endif 915 916 ])], 917 [AC_MSG_RESULT([ok]) 918 CFLAGS="$CFLAGS -DHAVE_ATS=1"], 919 [AC_MSG_RESULT([not found]) 920 CFLAGS="$CFLAGS -DHAVE_ATS=0"]) 921fi 922 923case "$CFLAGS" in 924 *HAVE_FSSPEC* | *HAVE_FSREF* | *HAVE_QUICKDRAW* | *HAVE_ATS* ) 925 AC_MSG_WARN([ 926*** WARNING 927 FSSpec/FSRef/QuickDraw/ATS options are explicitly given, 928 thus it is recommended to replace src/base/ftmac.c by builds/mac/ftmac.c. 929 ]) 930 CFLAGS="$CFLAGS "'-I$(TOP_DIR)/builds/mac/' 931 ;; 932 *) 933 ;; 934esac 935 936# Check for pthreads 937 938AX_PTHREAD([have_pthread=yes], [have_pthread=no]) 939 940# Check for Python and docwriter 941 942have_py3=no 943have_docwriter=no 944PIP=pip 945 946AC_CHECK_PROGS([PYTHON], [python3 python], [missing]) 947if test "x$PYTHON" != "xmissing"; then 948 AX_PROG_PYTHON_VERSION([3.5], [have_py3=yes], []) 949 950 if test "x$have_py3" = "xyes"; then 951 PIP="$PYTHON -m $PIP" 952 AC_MSG_CHECKING([for `docwriter' Python module]) 953 $PYTHON -m docwriter -h > /dev/null 2>&1 954 if test "x$?" = "x0"; then 955 have_docwriter=yes 956 AC_MSG_RESULT([yes]) 957 else 958 AC_MSG_RESULT([no]) 959 fi 960 fi 961fi 962 963 964# entries in Requires.private are separated by commas 965REQUIRES_PRIVATE="$zlib_reqpriv, \ 966 $bzip2_reqpriv, \ 967 $libpng_reqpriv, \ 968 $harfbuzz_reqpriv, \ 969 $brotli_reqpriv" 970# beautify 971REQUIRES_PRIVATE=`echo "$REQUIRES_PRIVATE" \ 972 | sed -e 's/^ *//' \ 973 -e 's/ *$//' \ 974 -e 's/, */,/g' \ 975 -e 's/,,*/,/g' \ 976 -e 's/^,*//' \ 977 -e 's/,*$//' \ 978 -e 's/,/, /g'` 979 980LIBS_PRIVATE="$zlib_libspriv \ 981 $bzip2_libspriv \ 982 $libpng_libspriv \ 983 $harfbuzz_libspriv \ 984 $brotli_libspriv \ 985 $ft2_extra_libs" 986# beautify 987LIBS_PRIVATE=`echo "$LIBS_PRIVATE" \ 988 | sed -e 's/^ *//' \ 989 -e 's/ *$//' \ 990 -e 's/ */ /g'` 991 992LIBSSTATIC_CONFIG="-lfreetype \ 993 $zlib_libsstaticconf \ 994 $bzip2_libsstaticconf \ 995 $libpng_libsstaticconf \ 996 $harfbuzz_libsstaticconf \ 997 $brotli_libsstaticconf \ 998 $ft2_extra_libs" 999# remove -L/usr/lib and -L/usr/lib64 since `freetype-config' adds them later 1000# on if necessary; also beautify 1001LIBSSTATIC_CONFIG=`echo "$LIBSSTATIC_CONFIG" \ 1002 | sed -e 's|-L */usr/lib64/* | |g' \ 1003 -e 's|-L */usr/lib/* | |g' \ 1004 -e 's/^ *//' \ 1005 -e 's/ *$//' \ 1006 -e 's/ */ /g'` 1007 1008 1009AC_SUBST([ftmac_c]) 1010AC_SUBST([REQUIRES_PRIVATE]) 1011AC_SUBST([LIBS_PRIVATE]) 1012AC_SUBST([LIBSSTATIC_CONFIG]) 1013 1014AC_SUBST([hardcode_libdir_flag_spec]) 1015AC_SUBST([wl]) 1016AC_SUBST([build_libtool_libs]) 1017 1018 1019# changing LDFLAGS value should only be done after 1020# lt_cv_prog_compiler_static_works test 1021 1022ftoption_set() 1023{ 1024 regexp="-e \\\"s|.*#.*def.*$1.*|#define $1|\\\"" 1025 FTOPTION_H_SED="$FTOPTION_H_SED $regexp" 1026} 1027 1028ftoption_unset() 1029{ 1030 regexp="-e \\\"s|.*#.*def.*$1.*|/* #undef $1 */|\\\"" 1031 FTOPTION_H_SED="$FTOPTION_H_SED $regexp" 1032} 1033 1034if test "$have_zlib" != no; then 1035 CFLAGS="$CFLAGS $ZLIB_CFLAGS" 1036 LDFLAGS="$LDFLAGS $ZLIB_LIBS" 1037 ftoption_set FT_CONFIG_OPTION_SYSTEM_ZLIB 1038else 1039 ftoption_unset FT_CONFIG_OPTION_SYSTEM_ZLIB 1040fi 1041if test "$have_bzip2" != no; then 1042 CFLAGS="$CFLAGS $BZIP2_CFLAGS" 1043 LDFLAGS="$LDFLAGS $BZIP2_LIBS" 1044 ftoption_set FT_CONFIG_OPTION_USE_BZIP2 1045else 1046 ftoption_unset FT_CONFIG_OPTION_USE_BZIP2 1047fi 1048if test "$have_libpng" != no; then 1049 CFLAGS="$CFLAGS $LIBPNG_CFLAGS" 1050 LDFLAGS="$LDFLAGS $LIBPNG_LIBS" 1051 ftoption_set FT_CONFIG_OPTION_USE_PNG 1052else 1053 ftoption_unset FT_CONFIG_OPTION_USE_PNG 1054fi 1055if test "$have_harfbuzz" != no; then 1056 CFLAGS="$CFLAGS $HARFBUZZ_CFLAGS" 1057 LDFLAGS="$LDFLAGS $HARFBUZZ_LIBS" 1058 ftoption_set FT_CONFIG_OPTION_USE_HARFBUZZ 1059else 1060 ftoption_unset FT_CONFIG_OPTION_USE_HARFBUZZ 1061fi 1062if test "$have_brotli" != no; then 1063 CFLAGS="$CFLAGS $BROTLI_CFLAGS" 1064 LDFLAGS="$LDFLAGS $BROTLI_LIBS" 1065 ftoption_set FT_CONFIG_OPTION_USE_BROTLI 1066else 1067 ftoption_unset FT_CONFIG_OPTION_USE_BROTLI 1068fi 1069 1070if test "$have_pthread" != no; then 1071 CFLAGS="$CFLAGS $PTHREAD_CFLAGS" 1072 LDFLAGS="$LDFLAGS $PTHREAD_CFLAGS $PTHREAD_LIBS" 1073fi 1074 1075AC_SUBST([CFLAGS]) 1076AC_SUBST([LDFLAGS]) 1077 1078# We don't want to use a template file for `ftoption.h', since compilation 1079# should work without calling a configure script also. For this reason, we 1080# copy the `include/freetype/config/ftoption.h' file to the `unix/builds' 1081# directory (using a dummy `AC_CONFIG_FILES' call) and apply the just 1082# constructed $FTOPTION_H_SED regexp (using the post-action of 1083# `AC_CONFIG_FILES'); this is also the version that gets installed later on. 1084# 1085AC_CONFIG_FILES([ftoption.h:${srcdir}/../../include/freetype/config/ftoption.h], 1086 [mv ftoption.h ftoption.tmp 1087 eval "sed $FTOPTION_H_SED < ftoption.tmp > ftoption.h" 1088 rm ftoption.tmp], 1089 [FTOPTION_H_SED="$FTOPTION_H_SED"]) 1090 1091AC_CONFIG_HEADERS([ftconfig.h]) 1092 1093# create the Unix-specific sub-Makefiles `builds/unix/unix-def.mk' 1094# and `builds/unix/unix-cc.mk' that will be used by the build system 1095# 1096AC_CONFIG_FILES([unix-cc.mk:unix-cc.in 1097 unix-def.mk:unix-def.in]) 1098 1099AC_OUTPUT 1100 1101AC_MSG_NOTICE([ 1102 1103Library configuration: 1104 external zlib: $have_zlib 1105 bzip2: $have_bzip2 1106 libpng: $have_libpng 1107 harfbuzz: $have_harfbuzz 1108 brotli: $have_brotli 1109 pthread: $have_pthread 1110]) 1111 1112# Warn if docwriter is not installed 1113 1114if test $have_docwriter = no; then 1115 AC_MSG_WARN([ 1116 `make refdoc' will fail since pip package `docwriter' is not installed. 1117 To install, run `$PIP install docwriter', or to use a Python 1118 virtual environment, run `make refdoc-venv' (requires pip package 1119 `virtualenv'). These operations require Python >= 3.5. 1120 ]) 1121fi 1122 1123# Warn if pthread is not available 1124 1125if test $have_pthread = no; then 1126 AC_MSG_WARN([ 1127 `FT_DEBUG_LOGGING' will not work since the `pthread' library is not 1128 available. This warning can be safely ignored if you don't plan to use 1129 this configuration macro. 1130 ]) 1131fi 1132 1133# end of configure.raw 1134