1# This file is part of the FreeType project. 2# 3# Process this file with autoconf to produce a configure script. 4# 5# Copyright 2001-2015 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.6.1], [freetype@nongnu.org], [freetype]) 15AC_CONFIG_SRCDIR([ftconfig.in]) 16 17 18# Don't forget to update docs/VERSION.DLL! 19 20version_info='18:1:12' 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) 40 41 42# checks for native programs to generate building tool 43 44if test ${cross_compiling} = yes; then 45 AC_CHECK_PROG(CC_BUILD, ${build}-gcc, ${build}-gcc) 46 test -z "${CC_BUILD}" && AC_CHECK_PROG(CC_BUILD, gcc, gcc) 47 test -z "${CC_BUILD}" && AC_CHECK_PROG(CC_BUILD, cc, cc, , , /usr/ucb/cc) 48 test -z "${CC_BUILD}" && AC_MSG_ERROR([cannot find native C compiler]) 49 50 AC_MSG_CHECKING([for suffix of native executables]) 51 rm -f a.* b.* a_out.exe conftest.* 52 echo > conftest.c "int main() { return 0;}" 53 ${CC_BUILD} conftest.c || AC_MSG_ERROR([native C compiler is not working]) 54 rm -f conftest.c 55 if test -x a.out -o -x b.out -o -x conftest; then 56 EXEEXT_BUILD="" 57 elif test -x a_out.exe -o -x conftest.exe; then 58 EXEEXT_BUILD=".exe" 59 elif test -x conftest.*; then 60 EXEEXT_BUILD=`echo conftest.* | sed -n '1s/^.*\././'` 61 fi 62 rm -f a.* b.* a_out.exe conftest.* 63 AC_MSG_RESULT($EXEEXT_BUILD) 64else 65 CC_BUILD=${CC} 66 EXEEXT_BUILD=${EXEEXT} 67fi 68 69AC_SUBST(CC_BUILD) 70AC_SUBST(EXEEXT_BUILD) 71 72 73# Since this file will be finally moved to another directory we make 74# the path of the install scripts absolute. This small code snippet has 75# been taken from automake's `ylwrap' script. 76 77AC_PROG_INSTALL 78case "$INSTALL" in 79[\\/]* | ?:[\\/]*) 80 ;; 81*[\\/]*) 82 INSTALL="`pwd`/$INSTALL" 83 ;; 84esac 85 86AC_PROG_MKDIR_P 87case "$MKDIR_P" in 88[\\/]* | ?:[\\/]*) 89 ;; 90*[\\/]*) 91 MKDIR_P="`pwd`/$MKDIR_P" 92 ;; 93esac 94 95 96# checks for header files 97 98AC_HEADER_STDC 99AC_CHECK_HEADERS([fcntl.h unistd.h]) 100 101 102# checks for typedefs, structures, and compiler characteristics 103 104AC_C_CONST 105AC_CHECK_SIZEOF([int]) 106AC_CHECK_SIZEOF([long]) 107 108 109# check whether cpp computation of size of int and long in ftconfig.in works 110 111AC_MSG_CHECKING([whether cpp computation of bit length in ftconfig.in works]) 112orig_CPPFLAGS="${CPPFLAGS}" 113CPPFLAGS="-I${srcdir} -I. ${CPPFLAGS}" 114 115ac_clean_files= 116for f in ft2build.h ftoption.h ftstdlib.h; do 117 if test ! -f $f; then 118 ac_clean_files="$ac_clean_files $f" 119 touch $f 120 fi 121done 122 123cat > conftest.c <<\_ACEOF 124#include <limits.h> 125#define FT_CONFIG_OPTIONS_H "ftoption.h" 126#define FT_CONFIG_STANDARD_LIBRARY_H "ftstdlib.h" 127#define FT_UINT_MAX UINT_MAX 128#define FT_ULONG_MAX ULONG_MAX 129#include "ftconfig.in" 130_ACEOF 131echo >> conftest.c "#if FT_SIZEOF_INT == "${ac_cv_sizeof_int} 132echo >> conftest.c "ac_cpp_ft_sizeof_int="${ac_cv_sizeof_int} 133echo >> conftest.c "#endif" 134echo >> conftest.c "#if FT_SIZEOF_LONG == "${ac_cv_sizeof_long} 135echo >> conftest.c "ac_cpp_ft_sizeof_long="${ac_cv_sizeof_long} 136echo >> conftest.c "#endif" 137 138${CPP} ${CPPFLAGS} conftest.c | ${GREP} ac_cpp_ft > conftest.sh 139eval `cat conftest.sh` 140rm -f conftest.* $ac_clean_files 141 142if test x != "x${ac_cpp_ft_sizeof_int}" \ 143 -a x != x"${ac_cpp_ft_sizeof_long}"; then 144 unset ft_use_autoconf_sizeof_types 145else 146 ft_use_autoconf_sizeof_types=yes 147fi 148 149AC_ARG_ENABLE(biarch-config, 150[ --enable-biarch-config install biarch ftconfig.h to support multiple 151 architectures by single file], [], []) 152 153case :${ft_use_autoconf_sizeof_types}:${enable_biarch_config}: in 154 :yes:yes:) 155 AC_MSG_RESULT([broken but use it]) 156 unset ft_use_autoconf_sizeof_types 157 ;; 158 ::no:) 159 AC_MSG_RESULT([works but ignore it]) 160 ft_use_autoconf_sizeof_types=yes 161 ;; 162 ::yes: | :::) 163 AC_MSG_RESULT([yes]) 164 unset ft_use_autoconf_sizeof_types 165 ;; 166 *) 167 AC_MSG_RESULT([no]) 168 ft_use_autoconf_sizeof_types=yes 169 ;; 170esac 171 172if test x"${ft_use_autoconf_sizeof_types}" = xyes; then 173 AC_DEFINE([FT_USE_AUTOCONF_SIZEOF_TYPES], [], 174 [Define if autoconf sizeof types should be used.]) 175fi 176 177CPPFLAGS="${orig_CPPFLAGS}" 178 179 180# checks for library functions 181 182# Here we check whether we can use our mmap file component. 183 184AC_ARG_ENABLE([mmap], 185 AS_HELP_STRING([--disable-mmap], 186 [do not check mmap() and do not use]), 187 [enable_mmap="no"],[enable_mmap="yes"]) 188if test "x${enable_mmap}" != "xno"; then 189 AC_FUNC_MMAP 190fi 191if test "x${enable_mmap}" = "xno" \ 192 -o "$ac_cv_func_mmap_fixed_mapped" != "yes"; then 193 FTSYS_SRC='$(BASE_DIR)/ftsystem.c' 194else 195 FTSYS_SRC='$(BUILD_DIR)/ftsystem.c' 196 197 AC_CHECK_DECLS([munmap], 198 [], 199 [], 200 [ 201 202#ifdef HAVE_UNISTD_H 203#include <unistd.h> 204#endif 205#include <sys/mman.h> 206 207 ]) 208 209 FT_MUNMAP_PARAM 210fi 211AC_SUBST([FTSYS_SRC]) 212 213AC_CHECK_FUNCS([memcpy memmove]) 214 215 216# get compiler flags right 217# 218# We try to make the compiler work for C89-strict source. Even if the 219# C compiler is gcc and C89 flags are available, some system headers 220# (e.g., Android Bionic libc) are broken in C89 mode. We have to check 221# whether the compilation finishes successfully. 222# 223# Due to bugs in mingwrt 4.0.3 we don't use `-ansi' for MinGW. 224# 225# To avoid zillions of 226# 227# ISO C90 does not support 'long long' 228# 229# warnings, we disable `-pedantic' for gcc version < 4.6. 230# 231if test "x$GCC" = xyes; then 232 XX_CFLAGS="-Wall" 233 case "$host" in 234 *-*-mingw*) 235 XX_ANSIFLAGS="-pedantic" 236 ;; 237 *) 238 GCC_VERSION=`$CC -dumpversion` 239 GCC_MAJOR=`echo "$GCC_VERSION" | sed 's/\([[^.]][[^.]]*\).*/\1/'` 240 GCC_MINOR=`echo "$GCC_VERSION" | sed 's/[[^.]][[^.]]*.\([[^.]][[^.]]*\).*/\1/'` 241 242 XX_PEDANTIC=-pedantic 243 if test $GCC_MAJOR -lt 4; then 244 XX_PEDANTIC= 245 else 246 if test $GCC_MAJOR -eq 4 -a $GCC_MINOR -lt 6; then 247 XX_PEDANTIC= 248 fi 249 fi 250 251 XX_ANSIFLAGS="" 252 for a in $XX_PEDANTIC -ansi 253 do 254 AC_MSG_CHECKING([gcc compiler flag ${a} to assure ANSI C works correctly]) 255 orig_CFLAGS="${CFLAGS}" 256 CFLAGS="${CFLAGS} ${XX_ANSIFLAGS} ${a}" 257 AC_COMPILE_IFELSE([ 258 AC_LANG_PROGRAM([ 259 260#include <stdio.h> 261 262 ], 263 [ 264 265 { 266 puts( "" ); 267 return 0; 268 } 269 270 ])], 271 [AC_MSG_RESULT([ok, add it to XX_ANSIFLAGS]) 272 XX_ANSIFLAGS="${XX_ANSIFLAGS} ${a}" 273 ], 274 [AC_MSG_RESULT([no])]) 275 CFLAGS="${orig_CFLAGS}" 276 done 277 ;; 278 esac 279else 280 case "$host" in 281 *-dec-osf*) 282 CFLAGS= 283 XX_CFLAGS="-std1 -g3" 284 XX_ANSIFLAGS= 285 ;; 286 *) 287 XX_CFLAGS= 288 XX_ANSIFLAGS= 289 ;; 290 esac 291fi 292AC_SUBST([XX_CFLAGS]) 293AC_SUBST([XX_ANSIFLAGS]) 294 295 296# All library tests below try `pkg-config' first. If that fails, a function 297# from the library is tested in the traditional autoconf way (zlib, bzip2), 298# or a config script is called (libpng). 299# 300# The `xxx_reqpriv' variables are for the `Requires.private' field in 301# `freetype2.pc'. The `xxx_libspriv' variables are for the `Libs.private' 302# field in `freetype2.pc' if pkg-config doesn't find a proper .pc file. 303# 304# The `xxx_libsstaticconf' variables are for the `freetype-config' script. 305# 306# Note that a call to PKG_CHECK_MODULES(XXX, ...) sets and creates the 307# output variables `XXX_CFLAGS' and `XXX_LIBS'. In case one or both are set 308# for a library by the user, no entry for this library is added to 309# `Requires.private'. Instead, it gets added to `Libs.private' 310 311 312# check for system zlib 313 314AC_ARG_WITH([zlib], 315 [AS_HELP_STRING([--with-zlib=@<:@yes|no|auto@:>@], 316 [use system zlib instead of internal library @<:@default=auto@:>@])], 317 [], [with_zlib=auto]) 318 319have_zlib=no 320if test x"$with_zlib" = xyes -o x"$with_zlib" = xauto; then 321 zlib_pkg="zlib" 322 have_zlib_pkg=no 323 324 if test x"$ZLIB_CFLAGS" = x -a x"$ZLIB_LIBS" = x; then 325 PKG_CHECK_EXISTS([$zlib_pkg], [have_zlib_pkg=yes]) 326 fi 327 PKG_CHECK_MODULES([ZLIB], [$zlib_pkg], 328 [have_zlib="yes (pkg-config)"], [:]) 329 330 if test $have_zlib_pkg = yes; then 331 # we have zlib.pc 332 zlib_reqpriv="$zlib_pkg" 333 zlib_libspriv= 334 zlib_libsstaticconf=`$PKG_CONFIG --static --libs "$zlib_pkg"` 335 else 336 zlib_reqpriv= 337 338 if test "$have_zlib" != no; then 339 # ZLIB_CFLAGS and ZLIB_LIBS are set by the user 340 zlib_libspriv="$ZLIB_LIBS" 341 zlib_libsstaticconf="$ZLIB_LIBS" 342 have_zlib="yes (ZLIB_CFLAGS and ZLIB_LIBS)" 343 else 344 # fall back to standard autoconf test 345 AC_CHECK_LIB([z], 346 [gzsetparams], 347 [AC_CHECK_HEADER([zlib.h], 348 [have_zlib="yes (autoconf test)" 349 zlib_libspriv="-lz" 350 zlib_libsstaticconf="$zlib_libspriv" 351 ZLIB_LIBS="$zlib_libspriv"])]) 352 fi 353 fi 354fi 355 356if test x"$with_zlib" = xyes -a "$have_zlib" = no; then 357 AC_MSG_ERROR([external zlib support requested but library not found]) 358fi 359 360 361# check for system libbz2 362 363AC_ARG_WITH([bzip2], 364 [AS_HELP_STRING([--with-bzip2=@<:@yes|no|auto@:>@], 365 [support bzip2 compressed fonts @<:@default=auto@:>@])], 366 [], [with_bzip2=auto]) 367 368have_bzip2=no 369if test x"$with_bzip2" = xyes -o x"$with_bzip2" = xauto; then 370 bzip2_pkg="bzip2" 371 have_bzip2_pkg=no 372 373 if test x"$BZIP2_CFLAGS" = x -a x"$BZIP2_LIBS" = x; then 374 PKG_CHECK_EXISTS([$bzip2_pkg], [have_bzip2_pkg=yes]) 375 fi 376 PKG_CHECK_MODULES([BZIP2], [$bzip2_pkg], 377 [have_bzip2="yes (pkg-config)"], [:]) 378 379 if test $have_bzip2_pkg = yes; then 380 # we have bzip2.pc 381 bzip2_reqpriv="$bzip2_pkg" 382 bzip2_libspriv= 383 bzip2_libsstaticconf=`$PKG_CONFIG --static --libs "$bzip2_pkg"` 384 else 385 bzip2_reqpriv= 386 387 if test "$have_bzip2" != no; then 388 # BZIP2_CFLAGS and BZIP2_LIBS are set by the user 389 bzip2_libspriv="$BZIP2_LIBS" 390 bzip2_libsstaticconf="$BZIP2_LIBS" 391 have_bzip2="yes (BZIP2_CFLAGS and BZIP2_LIBS)" 392 else 393 # fall back to standard autoconf test 394 AC_CHECK_LIB([bz2], 395 [BZ2_bzDecompress], 396 [AC_CHECK_HEADER([bzlib.h], 397 [have_bzip2="yes (autoconf test)" 398 bzip2_libspriv="-lbz2" 399 bzip2_libsstaticconf="$bzip2_libspriv" 400 BZIP2_LIBS="$bzip2_libspriv"])]) 401 fi 402 fi 403fi 404 405if test x"$with_bzip2" = xyes -a "$have_bzip2" = no; then 406 AC_MSG_ERROR([bzip2 support requested but library not found]) 407fi 408 409 410# check for system libpng 411 412AC_ARG_WITH([png], 413 [AS_HELP_STRING([--with-png=@<:@yes|no|auto@:>@], 414 [support png compressed OpenType embedded bitmaps @<:@default=auto@:>@])], 415 [], [with_png=auto]) 416 417have_libpng=no 418if test x"$with_png" = xyes -o x"$with_png" = xauto; then 419 libpng_pkg="libpng" 420 have_libpng_pkg=no 421 422 if test x"$LIBPNG_CFLAGS" = x -a x"$LIBPNG_LIBS" = x; then 423 PKG_CHECK_EXISTS([$libpng_pkg], [have_libpng_pkg=yes]) 424 fi 425 PKG_CHECK_MODULES([LIBPNG], [$libpng_pkg], 426 [have_libpng="yes (pkg-config)"], [:]) 427 428 if test $have_libpng_pkg = yes; then 429 # we have libpng.pc 430 libpng_reqpriv="$libpng_pkg" 431 libpng_libspriv= 432 libpng_libsstaticconf=`$PKG_CONFIG --static --libs "$libpng_pkg"` 433 else 434 libpng_reqpriv= 435 436 if test "$have_libpng" != no; then 437 # LIBPNG_CFLAGS and LIBPNG_LIBS are set by the user 438 libpng_libspriv="$LIBPNG_LIBS" 439 libpng_libsstaticconf="$LIBPNG_LIBS" 440 have_libpng="yes (LIBPNG_CFLAGS and LIBPNG_LIBS)" 441 else 442 # fall back to config script. 443 AC_MSG_CHECKING([for libpng-config]) 444 if which libpng-config > /dev/null 2>&1; then 445 LIBPNG_CFLAGS=`libpng-config --cflags` 446 LIBPNG_LIBS=`libpng-config --ldflags` 447 libpng_libspriv=`libpng-config --static --ldflags` 448 libpng_libsstaticconf="$libpng_libspriv" 449 have_libpng="yes (libpng-config)" 450 AC_MSG_RESULT([yes]) 451 else 452 AC_MSG_RESULT([no]) 453 fi 454 fi 455 fi 456fi 457 458if test x"$with_png" = xyes -a "$have_libpng" = no; then 459 AC_MSG_ERROR([libpng support requested but library not found]) 460fi 461 462 463# check for system libharfbuzz 464 465AC_ARG_WITH([harfbuzz], 466 [AS_HELP_STRING([--with-harfbuzz=@<:@yes|no|auto@:>@], 467 [improve auto-hinting of OpenType fonts @<:@default=auto@:>@])], 468 [], [with_harfbuzz=auto]) 469 470have_harfbuzz=no 471if test x"$with_harfbuzz" = xyes -o x"$with_harfbuzz" = xauto; then 472 harfbuzz_pkg="harfbuzz >= 0.9.21" 473 have_harfbuzz_pkg=no 474 475 if test x"$HARFBUZZ_CFLAGS" = x -a x"$HARFBUZZ_LIBS" = x; then 476 PKG_CHECK_EXISTS([$harfbuzz_pkg], [have_harfbuzz_pkg=yes]) 477 fi 478 PKG_CHECK_MODULES([HARFBUZZ], [$harfbuzz_pkg], 479 [have_harfbuzz="yes (pkg-config)"], [:]) 480 481 if test $have_harfbuzz_pkg = yes; then 482 # we have harfbuzz.pc 483 harfbuzz_reqpriv="$harfbuzz_pkg" 484 harfbuzz_libspriv= 485 harfbuzz_libsstaticconf=`$PKG_CONFIG --static --libs "$harfbuzz_pkg"` 486 else 487 harfbuzz_reqpriv= 488 489 if test "$have_harfbuzz" != no; then 490 # HARFBUZZ_CFLAGS and HARFBUZZ_LIBS are set by the user 491 harfbuzz_libspriv="$HARFBUZZ_LIBS" 492 harfbuzz_libsstaticconf="$HARFBUZZ_LIBS" 493 have_harfbuzz="yes (HARFBUZZ_CFLAGS and HARFBUZZ_LIBS)" 494 else 495 # since HarfBuzz is quite a new library we don't fall back to a 496 # different test; additionally, it has too many dependencies 497 : 498 fi 499 fi 500fi 501 502if test x"$with_harfbuzz" = xyes -a "$have_harfbuzz" = no; then 503 AC_MSG_ERROR([harfbuzz support requested but library not found]) 504fi 505 506 507# Some options handling SDKs/archs in CFLAGS should be copied 508# to LDFLAGS. Apple TechNote 2137 recommends to include these 509# options in CFLAGS but not in LDFLAGS. 510 511save_config_args=$* 512set dummy ${CFLAGS} 513i=1 514while test $i -le $# 515do 516 c=$1 517 518 case "${c}" in 519 -isysroot|-arch) # options taking 1 argument 520 a=$2 521 AC_MSG_CHECKING([whether CFLAGS and LDFLAGS share ${c} ${a}]) 522 if expr " ${LDFLAGS} " : ".* ${c} *${a}.*" > /dev/null 523 then 524 AC_MSG_RESULT([yes]) 525 else 526 AC_MSG_RESULT([no, copy to LDFLAGS]) 527 LDFLAGS="${LDFLAGS} ${c} ${a}" 528 fi 529 shift 1 530 ;; 531 -m32|-m64|-march=*|-mcpu=*) # options taking no argument 532 AC_MSG_CHECKING([whether CFLAGS and LDFLAGS share ${c}]) 533 if expr " ${LDFLAGS} " : ".* ${c} *${a}.*" > /dev/null 534 then 535 AC_MSG_RESULT([yes]) 536 else 537 AC_MSG_RESULT([no, copy to LDFLAGS]) 538 LDFLAGS="${LDFLAGS} ${c}" 539 fi 540 ;; 541 # *) 542 # AC_MSG_RESULT([${c} is not copied to LDFLAGS]) 543 # ;; 544 esac 545 546 shift 1 547done 548set ${save_config_args} 549 550 551# Whether to use Mac OS resource-based fonts. 552 553ftmac_c="" # src/base/ftmac.c should not be included in makefiles by default 554 555AC_ARG_WITH([old-mac-fonts], 556 AS_HELP_STRING([--with-old-mac-fonts], 557 [allow Mac resource-based fonts to be used])) 558if test x$with_old_mac_fonts = xyes; then 559 orig_LDFLAGS="${LDFLAGS}" 560 AC_MSG_CHECKING([CoreServices & ApplicationServices of Mac OS X]) 561 ft2_extra_libs="-Wl,-framework,CoreServices -Wl,-framework,ApplicationServices" 562 LDFLAGS="$LDFLAGS $ft2_extra_libs" 563 AC_LINK_IFELSE([ 564 AC_LANG_PROGRAM([ 565 566#if defined(__GNUC__) && defined(__APPLE_CC__) 567# include <CoreServices/CoreServices.h> 568# include <ApplicationServices/ApplicationServices.h> 569#else 570# include <ConditionalMacros.h> 571# include <Files.h> 572#endif 573 574 ], 575 [ 576 577 short res = 0; 578 579 580 UseResFile( res ); 581 582 ])], 583 [AC_MSG_RESULT([ok]) 584 ftmac_c='ftmac.c' 585 AC_MSG_CHECKING([whether OS_INLINE macro is ANSI compatible]) 586 orig_CFLAGS="$CFLAGS -DFT_MACINTOSH" 587 CFLAGS="$CFLAGS $XX_CFLAGS $XX_ANSIFLAGS" 588 AC_COMPILE_IFELSE([ 589 AC_LANG_PROGRAM([ 590 591#if defined(__GNUC__) && defined(__APPLE_CC__) 592# include <CoreServices/CoreServices.h> 593# include <ApplicationServices/ApplicationServices.h> 594#else 595# include <ConditionalMacros.h> 596# include <Files.h> 597#endif 598 599 ], 600 [ 601 602 /* OSHostByteOrder() is typed as OS_INLINE */ 603 int32_t os_byte_order = OSHostByteOrder(); 604 605 606 if ( OSBigEndian != os_byte_order ) 607 return 1; 608 609 ])], 610 [AC_MSG_RESULT([ok]) 611 CFLAGS="$orig_CFLAGS" 612 CFLAGS="$CFLAGS -DHAVE_ANSI_OS_INLINE=1" 613 ], 614 [AC_MSG_RESULT([no, ANSI incompatible]) 615 CFLAGS="$orig_CFLAGS" 616 ]) 617 AC_MSG_CHECKING([type ResourceIndex]) 618 orig_CFLAGS="$CFLAGS" 619 CFLAGS="$CFLAGS $XX_CFLAGS $XX_ANSIFLAGS" 620 AC_COMPILE_IFELSE([ 621 AC_LANG_PROGRAM([ 622 623#if defined(__GNUC__) && defined(__APPLE_CC__) 624# include <CoreServices/CoreServices.h> 625# include <ApplicationServices/ApplicationServices.h> 626#else 627# include <ConditionalMacros.h> 628# include <Files.h> 629# include <Resources.h> 630#endif 631 632 ], 633 [ 634 635 ResourceIndex i = 0; 636 return i; 637 638 ])], 639 [AC_MSG_RESULT([ok]) 640 CFLAGS="$orig_CFLAGS" 641 CFLAGS="$CFLAGS -DHAVE_TYPE_RESOURCE_INDEX=1" 642 ], 643 [AC_MSG_RESULT([no]) 644 CFLAGS="$orig_CFLAGS" 645 CFLAGS="$CFLAGS -DHAVE_TYPE_RESOURCE_INDEX=0" 646 ])], 647 [AC_MSG_RESULT([not found]) 648 ft2_extra_libs="" 649 LDFLAGS="${orig_LDFLAGS}" 650 CFLAGS="$CFLAGS -DDARWIN_NO_CARBON"]) 651else 652 case x$host_os in 653 xdarwin*) 654 dnl AC_MSG_WARN([host system is MacOS but configured to build without Carbon]) 655 CFLAGS="$CFLAGS -DDARWIN_NO_CARBON" 656 ;; 657 *) 658 ;; 659 esac 660fi 661 662 663# Whether to use FileManager, which is deprecated since Mac OS X 10.4. 664 665AC_ARG_WITH([fsspec], 666 AS_HELP_STRING([--with-fsspec], 667 [use obsolete FSSpec API of MacOS, if available (default=yes)])) 668if test x$with_fsspec = xno; then 669 CFLAGS="$CFLAGS -DHAVE_FSSPEC=0" 670elif test x$with_old_mac_fonts = xyes -a x$with_fsspec != x; then 671 AC_MSG_CHECKING([FSSpec-based FileManager]) 672 AC_LINK_IFELSE([ 673 AC_LANG_PROGRAM([ 674 675#if defined(__GNUC__) && defined(__APPLE_CC__) 676# include <CoreServices/CoreServices.h> 677# include <ApplicationServices/ApplicationServices.h> 678#else 679# include <ConditionalMacros.h> 680# include <Files.h> 681#endif 682 683 ], 684 [ 685 686 FCBPBPtr paramBlock; 687 short vRefNum; 688 long dirID; 689 ConstStr255Param fileName; 690 FSSpec* spec; 691 692 693 /* FSSpec functions: deprecated since Mac OS X 10.4 */ 694 PBGetFCBInfoSync( paramBlock ); 695 FSMakeFSSpec( vRefNum, dirID, fileName, spec ); 696 697 ])], 698 [AC_MSG_RESULT([ok]) 699 CFLAGS="$CFLAGS -DHAVE_FSSPEC=1"], 700 [AC_MSG_RESULT([not found]) 701 CFLAGS="$CFLAGS -DHAVE_FSSPEC=0"]) 702fi 703 704 705# Whether to use FileManager in Carbon since MacOS 9.x. 706 707AC_ARG_WITH([fsref], 708 AS_HELP_STRING([--with-fsref], 709 [use Carbon FSRef API of MacOS, if available (default=yes)])) 710if test x$with_fsref = xno; then 711 AC_MSG_WARN([ 712*** WARNING 713 FreeType2 built without FSRef API cannot load 714 data-fork fonts on MacOS, except of XXX.dfont. 715 ]) 716 CFLAGS="$CFLAGS -DHAVE_FSREF=0" 717elif test x$with_old_mac_fonts = xyes -a x$with_fsref != x; then 718 AC_MSG_CHECKING([FSRef-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 short vRefNum; 734 long dirID; 735 ConstStr255Param fileName; 736 737 Boolean* isDirectory; 738 UInt8* path; 739 SInt16 desiredRefNum; 740 SInt16* iterator; 741 SInt16* actualRefNum; 742 HFSUniStr255* outForkName; 743 FSVolumeRefNum volume; 744 FSCatalogInfoBitmap whichInfo; 745 FSCatalogInfo* catalogInfo; 746 FSForkInfo* forkInfo; 747 FSRef* ref; 748 749#if HAVE_FSSPEC 750 FSSpec* spec; 751#endif 752 753 /* FSRef functions: no need to check? */ 754 FSGetForkCBInfo( desiredRefNum, volume, iterator, 755 actualRefNum, forkInfo, ref, 756 outForkName ); 757 FSPathMakeRef( path, ref, isDirectory ); 758 759#if HAVE_FSSPEC 760 FSpMakeFSRef ( spec, ref ); 761 FSGetCatalogInfo( ref, whichInfo, catalogInfo, 762 outForkName, spec, ref ); 763#endif 764 ])], 765 [AC_MSG_RESULT([ok]) 766 CFLAGS="$CFLAGS -DHAVE_FSREF=1"], 767 [AC_MSG_RESULT([not found]) 768 CFLAGS="$CFLAGS -DHAVE_FSREF=0"]) 769fi 770 771 772# Whether to use QuickDraw API in ToolBox, which is deprecated since 773# Mac OS X 10.4. 774 775AC_ARG_WITH([quickdraw-toolbox], 776 AS_HELP_STRING([--with-quickdraw-toolbox], 777 [use MacOS QuickDraw in ToolBox, if available (default=yes)])) 778if test x$with_quickdraw_toolbox = xno; then 779 CFLAGS="$CFLAGS -DHAVE_QUICKDRAW_TOOLBOX=0" 780elif test x$with_old_mac_fonts = xyes -a x$with_quickdraw_toolbox != x; then 781 AC_MSG_CHECKING([QuickDraw FontManager functions in ToolBox]) 782 AC_LINK_IFELSE([ 783 AC_LANG_PROGRAM([ 784 785#if defined(__GNUC__) && defined(__APPLE_CC__) 786# include <CoreServices/CoreServices.h> 787# include <ApplicationServices/ApplicationServices.h> 788#else 789# include <ConditionalMacros.h> 790# include <Fonts.h> 791#endif 792 793 ], 794 [ 795 796 Str255 familyName; 797 SInt16 familyID = 0; 798 FMInput* fmIn = NULL; 799 FMOutput* fmOut = NULL; 800 801 802 GetFontName( familyID, familyName ); 803 GetFNum( familyName, &familyID ); 804 fmOut = FMSwapFont( fmIn ); 805 806 ])], 807 [AC_MSG_RESULT([ok]) 808 CFLAGS="$CFLAGS -DHAVE_QUICKDRAW_TOOLBOX=1"], 809 [AC_MSG_RESULT([not found]) 810 CFLAGS="$CFLAGS -DHAVE_QUICKDRAW_TOOLBOX=0"]) 811fi 812 813 814# Whether to use QuickDraw API in Carbon, which is deprecated since 815# Mac OS X 10.4. 816 817AC_ARG_WITH([quickdraw-carbon], 818 AS_HELP_STRING([--with-quickdraw-carbon], 819 [use MacOS QuickDraw in Carbon, if available (default=yes)])) 820if test x$with_quickdraw_carbon = xno; then 821 CFLAGS="$CFLAGS -DHAVE_QUICKDRAW_CARBON=0" 822elif test x$with_old_mac_fonts = xyes -a x$with_quickdraw_carbon != x; then 823 AC_MSG_CHECKING([QuickDraw FontManager functions in Carbon]) 824 AC_LINK_IFELSE([ 825 AC_LANG_PROGRAM([ 826 827#if defined(__GNUC__) && defined(__APPLE_CC__) 828# include <CoreServices/CoreServices.h> 829# include <ApplicationServices/ApplicationServices.h> 830#else 831# include <ConditionalMacros.h> 832# include <Fonts.h> 833#endif 834 835 ], 836 [ 837 838 FMFontFamilyIterator famIter; 839 FMFontFamily family; 840 Str255 famNameStr; 841 FMFontFamilyInstanceIterator instIter; 842 FMFontStyle style; 843 FMFontSize size; 844 FMFont font; 845 FSSpec* pathSpec; 846 847 848 FMCreateFontFamilyIterator( NULL, NULL, kFMUseGlobalScopeOption, 849 &famIter ); 850 FMGetNextFontFamily( &famIter, &family ); 851 FMGetFontFamilyName( family, famNameStr ); 852 FMCreateFontFamilyInstanceIterator( family, &instIter ); 853 FMGetNextFontFamilyInstance( &instIter, &font, &style, &size ); 854 FMDisposeFontFamilyInstanceIterator( &instIter ); 855 FMDisposeFontFamilyIterator( &famIter ); 856 FMGetFontContainer( font, pathSpec ); 857 858 ])], 859 [AC_MSG_RESULT([ok]) 860 CFLAGS="$CFLAGS -DHAVE_QUICKDRAW_CARBON=1"], 861 [AC_MSG_RESULT([not found]) 862 CFLAGS="$CFLAGS -DHAVE_QUICKDRAW_CARBON=0"]) 863fi 864 865 866# Whether to use AppleTypeService since Mac OS X. 867 868AC_ARG_WITH([ats], 869 AS_HELP_STRING([--with-ats], 870 [use AppleTypeService, if available (default=yes)])) 871if test x$with_ats = xno; then 872 CFLAGS="$CFLAGS -DHAVE_ATS=0" 873elif test x$with_old_mac_fonts = xyes -a x$with_ats != x; then 874 AC_MSG_CHECKING([AppleTypeService functions]) 875 AC_LINK_IFELSE([ 876 AC_LANG_PROGRAM([ 877 878#if defined(__GNUC__) && defined(__APPLE_CC__) 879# include <CoreServices/CoreServices.h> 880# include <ApplicationServices/ApplicationServices.h> 881#else 882# include <ConditionalMacros.h> 883# include <Files.h> 884#endif 885 886 ], 887 [ 888 889 FSSpec* pathSpec; 890 891 892 ATSFontFindFromName( NULL, kATSOptionFlagsUnRestrictedScope ); 893#if HAVE_FSSPEC 894 ATSFontGetFileSpecification( 0, pathSpec ); 895#endif 896 897 ])], 898 [AC_MSG_RESULT([ok]) 899 CFLAGS="$CFLAGS -DHAVE_ATS=1"], 900 [AC_MSG_RESULT([not found]) 901 CFLAGS="$CFLAGS -DHAVE_ATS=0"]) 902fi 903 904case "$CFLAGS" in 905 *HAVE_FSSPEC* | *HAVE_FSREF* | *HAVE_QUICKDRAW* | *HAVE_ATS* ) 906 AC_MSG_WARN([ 907*** WARNING 908 FSSpec/FSRef/QuickDraw/ATS options are explicitly given, 909 thus it is recommended to replace src/base/ftmac.c by builds/mac/ftmac.c. 910 ]) 911 CFLAGS="$CFLAGS "'-I$(TOP_DIR)/builds/mac/' 912 ;; 913 *) 914 ;; 915esac 916 917 918# entries in Requires.private are separated by commas; 919REQUIRES_PRIVATE="$zlib_reqpriv, \ 920 $bzip2_reqpriv, \ 921 $libpng_reqpriv, \ 922 $harfbuzz_reqpriv" 923# beautify 924REQUIRES_PRIVATE=`echo "$REQUIRES_PRIVATE" \ 925 | sed -e 's/^ *//' \ 926 -e 's/ *$//' \ 927 -e 's/, */,/g' \ 928 -e 's/,,*/,/g' \ 929 -e 's/^,*//' \ 930 -e 's/,*$//' \ 931 -e 's/,/, /g'` 932 933LIBS_PRIVATE="$zlib_libspriv \ 934 $bzip2_libspriv \ 935 $libpng_libspriv \ 936 $harfbuzz_libspriv \ 937 $ft2_extra_libs" 938# beautify 939LIBS_PRIVATE=`echo "$LIBS_PRIVATE" \ 940 | sed -e 's/^ *//' \ 941 -e 's/ *$//' \ 942 -e 's/ */ /g'` 943 944LIBSSTATIC_CONFIG="-lfreetype \ 945 $zlib_libsstaticconf \ 946 $bzip2_libsstaticconf \ 947 $libpng_libsstaticconf \ 948 $harfbuzz_libsstaticconf \ 949 $ft2_extra_libs" 950# remove -L/usr/lib and -L/usr/lib64 since `freetype-config' adds them later 951# on if necessary; also beautify 952LIBSSTATIC_CONFIG=`echo "$LIBSSTATIC_CONFIG" \ 953 | sed -e 's|-L */usr/lib64/* | |g' \ 954 -e 's|-L */usr/lib/* | |g' \ 955 -e 's/^ *//' \ 956 -e 's/ *$//' \ 957 -e 's/ */ /g'` 958 959 960AC_SUBST([ftmac_c]) 961AC_SUBST([REQUIRES_PRIVATE]) 962AC_SUBST([LIBS_PRIVATE]) 963AC_SUBST([LIBSSTATIC_CONFIG]) 964 965AC_SUBST([hardcode_libdir_flag_spec]) 966AC_SUBST([wl]) 967AC_SUBST([build_libtool_libs]) 968 969 970# changing LDFLAGS value should only be done after 971# lt_cv_prog_compiler_static_works test 972 973if test "$have_zlib" != no; then 974 CFLAGS="$CFLAGS $ZLIB_CFLAGS -DFT_CONFIG_OPTION_SYSTEM_ZLIB" 975 LDFLAGS="$LDFLAGS $ZLIB_LIBS" 976fi 977 978if test "$have_bzip2" != no; then 979 CFLAGS="$CFLAGS $BZIP2_CFLAGS -DFT_CONFIG_OPTION_USE_BZIP2" 980 LDFLAGS="$LDFLAGS $BZIP2_LIBS" 981fi 982if test "$have_libpng" != no; then 983 CFLAGS="$CFLAGS $LIBPNG_CFLAGS -DFT_CONFIG_OPTION_USE_PNG" 984 LDFLAGS="$LDFLAGS $LIBPNG_LIBS" 985fi 986if test "$have_harfbuzz" != no; then 987 CFLAGS="$CFLAGS $HARFBUZZ_CFLAGS -DFT_CONFIG_OPTION_USE_HARFBUZZ" 988 LDFLAGS="$LDFLAGS $HARFBUZZ_LIBS" 989fi 990 991AC_SUBST([CFLAGS]) 992AC_SUBST([LDFLAGS]) 993 994# configuration file -- stay in 8.3 limit 995# 996# since #undef doesn't survive in configuration header files we replace 997# `/undef' with `#undef' after creating the output file 998 999AC_CONFIG_HEADERS([ftconfig.h:ftconfig.in], 1000 [mv ftconfig.h ftconfig.tmp 1001 sed 's|/undef|#undef|' < ftconfig.tmp > ftconfig.h 1002 rm ftconfig.tmp]) 1003 1004# create the Unix-specific sub-Makefiles `builds/unix/unix-def.mk' 1005# and `builds/unix/unix-cc.mk' that will be used by the build system 1006# 1007AC_CONFIG_FILES([unix-cc.mk:unix-cc.in 1008 unix-def.mk:unix-def.in]) 1009 1010# re-generate the Jamfile to use libtool now 1011# 1012# AC_CONFIG_FILES([../../Jamfile:../../Jamfile.in]) 1013 1014AC_OUTPUT 1015 1016AC_MSG_NOTICE([ 1017 1018Library configuration: 1019 external zlib: $have_zlib 1020 bzip2: $have_bzip2 1021 libpng: $have_libpng 1022 harfbuzz: $have_harfbuzz 1023]) 1024 1025# end of configure.raw 1026