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