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