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