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