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