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-2018 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/VERSIONS.TXT'! 19 20version_info='22:1:16' 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) 40LT_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.in works 113 114AC_MSG_CHECKING([whether cpp computation of bit length in ftconfig.in works]) 115orig_CPPFLAGS="${CPPFLAGS}" 116CPPFLAGS="-I${srcdir} -I. -I${srcdir}/../../include/freetype/config ${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 "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 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.3.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 librt 547# 548# We need `clock_gettime' for the `ftbench' demo program. 549# 550# The code is modeled after gnulib's file `clock_time.m4', ignoring 551# very old Solaris systems. 552 553LIB_CLOCK_GETTIME= 554AC_SEARCH_LIBS([clock_gettime], 555 [rt], 556 [test "$ac_cv_search_clock_gettime" = "none required" \ 557 || LIB_CLOCK_GETTIME=$ac_cv_search_clock_gettime]) 558AC_SUBST([LIB_CLOCK_GETTIME]) 559 560 561# Some options handling SDKs/archs in CFLAGS should be copied 562# to LDFLAGS. Apple TechNote 2137 recommends to include these 563# options in CFLAGS but not in LDFLAGS. 564 565save_config_args=$* 566set dummy ${CFLAGS} 567i=1 568while test $i -le $# 569do 570 c=$1 571 572 case "${c}" in 573 -isysroot|-arch) # options taking 1 argument 574 a=$2 575 AC_MSG_CHECKING([whether CFLAGS and LDFLAGS share ${c} ${a}]) 576 if expr " ${LDFLAGS} " : ".* ${c} *${a}.*" > /dev/null 577 then 578 AC_MSG_RESULT([yes]) 579 else 580 AC_MSG_RESULT([no, copy to LDFLAGS]) 581 LDFLAGS="${LDFLAGS} ${c} ${a}" 582 fi 583 shift 1 584 ;; 585 -m32|-m64|-march=*|-mcpu=*) # options taking no argument 586 AC_MSG_CHECKING([whether CFLAGS and LDFLAGS share ${c}]) 587 if expr " ${LDFLAGS} " : ".* ${c} *${a}.*" > /dev/null 588 then 589 AC_MSG_RESULT([yes]) 590 else 591 AC_MSG_RESULT([no, copy to LDFLAGS]) 592 LDFLAGS="${LDFLAGS} ${c}" 593 fi 594 ;; 595 # *) 596 # AC_MSG_RESULT([${c} is not copied to LDFLAGS]) 597 # ;; 598 esac 599 600 shift 1 601done 602set ${save_config_args} 603 604 605# Whether to use Mac OS resource-based fonts. 606 607ftmac_c="" # src/base/ftmac.c should not be included in makefiles by default 608 609AC_ARG_WITH([old-mac-fonts], 610 AS_HELP_STRING([--with-old-mac-fonts], 611 [allow Mac resource-based fonts to be used])) 612if test x$with_old_mac_fonts = xyes; then 613 orig_LDFLAGS="${LDFLAGS}" 614 AC_MSG_CHECKING([CoreServices & ApplicationServices of Mac OS X]) 615 ft2_extra_libs="-Wl,-framework,CoreServices -Wl,-framework,ApplicationServices" 616 LDFLAGS="$LDFLAGS $ft2_extra_libs" 617 AC_LINK_IFELSE([ 618 AC_LANG_PROGRAM([ 619 620#if defined(__GNUC__) && defined(__APPLE_CC__) 621# include <CoreServices/CoreServices.h> 622# include <ApplicationServices/ApplicationServices.h> 623#else 624# include <ConditionalMacros.h> 625# include <Files.h> 626#endif 627 628 ], 629 [ 630 631 short res = 0; 632 633 634 UseResFile( res ); 635 636 ])], 637 [AC_MSG_RESULT([ok]) 638 ftmac_c='ftmac.c' 639 AC_MSG_CHECKING([whether OS_INLINE macro is ANSI compatible]) 640 orig_CFLAGS="$CFLAGS -DFT_MACINTOSH" 641 CFLAGS="$CFLAGS $XX_CFLAGS $XX_ANSIFLAGS" 642 AC_COMPILE_IFELSE([ 643 AC_LANG_PROGRAM([ 644 645#if defined(__GNUC__) && defined(__APPLE_CC__) 646# include <CoreServices/CoreServices.h> 647# include <ApplicationServices/ApplicationServices.h> 648#else 649# include <ConditionalMacros.h> 650# include <Files.h> 651#endif 652 653 ], 654 [ 655 656 /* OSHostByteOrder() is typed as OS_INLINE */ 657 int32_t os_byte_order = OSHostByteOrder(); 658 659 660 if ( OSBigEndian != os_byte_order ) 661 return 1; 662 663 ])], 664 [AC_MSG_RESULT([ok]) 665 CFLAGS="$orig_CFLAGS" 666 CFLAGS="$CFLAGS -DHAVE_ANSI_OS_INLINE=1" 667 ], 668 [AC_MSG_RESULT([no, ANSI incompatible]) 669 CFLAGS="$orig_CFLAGS" 670 ]) 671 AC_MSG_CHECKING([type ResourceIndex]) 672 orig_CFLAGS="$CFLAGS" 673 CFLAGS="$CFLAGS $XX_CFLAGS $XX_ANSIFLAGS" 674 AC_COMPILE_IFELSE([ 675 AC_LANG_PROGRAM([ 676 677#if defined(__GNUC__) && defined(__APPLE_CC__) 678# include <CoreServices/CoreServices.h> 679# include <ApplicationServices/ApplicationServices.h> 680#else 681# include <ConditionalMacros.h> 682# include <Files.h> 683# include <Resources.h> 684#endif 685 686 ], 687 [ 688 689 ResourceIndex i = 0; 690 return i; 691 692 ])], 693 [AC_MSG_RESULT([ok]) 694 CFLAGS="$orig_CFLAGS" 695 CFLAGS="$CFLAGS -DHAVE_TYPE_RESOURCE_INDEX=1" 696 ], 697 [AC_MSG_RESULT([no]) 698 CFLAGS="$orig_CFLAGS" 699 CFLAGS="$CFLAGS -DHAVE_TYPE_RESOURCE_INDEX=0" 700 ])], 701 [AC_MSG_RESULT([not found]) 702 ft2_extra_libs="" 703 LDFLAGS="${orig_LDFLAGS}" 704 CFLAGS="$CFLAGS -DDARWIN_NO_CARBON"]) 705else 706 case x$host_os in 707 xdarwin*) 708 dnl AC_MSG_WARN([host system is MacOS but configured to build without Carbon]) 709 CFLAGS="$CFLAGS -DDARWIN_NO_CARBON" 710 ;; 711 *) 712 ;; 713 esac 714fi 715 716 717# Whether to use FileManager, which is deprecated since Mac OS X 10.4. 718 719AC_ARG_WITH([fsspec], 720 AS_HELP_STRING([--with-fsspec], 721 [use obsolete FSSpec API of MacOS, if available (default=yes)])) 722if test x$with_fsspec = xno; then 723 CFLAGS="$CFLAGS -DHAVE_FSSPEC=0" 724elif test x$with_old_mac_fonts = xyes -a x$with_fsspec != x; then 725 AC_MSG_CHECKING([FSSpec-based FileManager]) 726 AC_LINK_IFELSE([ 727 AC_LANG_PROGRAM([ 728 729#if defined(__GNUC__) && defined(__APPLE_CC__) 730# include <CoreServices/CoreServices.h> 731# include <ApplicationServices/ApplicationServices.h> 732#else 733# include <ConditionalMacros.h> 734# include <Files.h> 735#endif 736 737 ], 738 [ 739 740 FCBPBPtr paramBlock; 741 short vRefNum; 742 long dirID; 743 ConstStr255Param fileName; 744 FSSpec* spec; 745 746 747 /* FSSpec functions: deprecated since Mac OS X 10.4 */ 748 PBGetFCBInfoSync( paramBlock ); 749 FSMakeFSSpec( vRefNum, dirID, fileName, spec ); 750 751 ])], 752 [AC_MSG_RESULT([ok]) 753 CFLAGS="$CFLAGS -DHAVE_FSSPEC=1"], 754 [AC_MSG_RESULT([not found]) 755 CFLAGS="$CFLAGS -DHAVE_FSSPEC=0"]) 756fi 757 758 759# Whether to use FileManager in Carbon since MacOS 9.x. 760 761AC_ARG_WITH([fsref], 762 AS_HELP_STRING([--with-fsref], 763 [use Carbon FSRef API of MacOS, if available (default=yes)])) 764if test x$with_fsref = xno; then 765 AC_MSG_WARN([ 766*** WARNING 767 FreeType2 built without FSRef API cannot load 768 data-fork fonts on MacOS, except of XXX.dfont. 769 ]) 770 CFLAGS="$CFLAGS -DHAVE_FSREF=0" 771elif test x$with_old_mac_fonts = xyes -a x$with_fsref != x; then 772 AC_MSG_CHECKING([FSRef-based FileManager]) 773 AC_LINK_IFELSE([ 774 AC_LANG_PROGRAM([ 775 776#if defined(__GNUC__) && defined(__APPLE_CC__) 777# include <CoreServices/CoreServices.h> 778# include <ApplicationServices/ApplicationServices.h> 779#else 780# include <ConditionalMacros.h> 781# include <Files.h> 782#endif 783 784 ], 785 [ 786 787 short vRefNum; 788 long dirID; 789 ConstStr255Param fileName; 790 791 Boolean* isDirectory; 792 UInt8* path; 793 SInt16 desiredRefNum; 794 SInt16* iterator; 795 SInt16* actualRefNum; 796 HFSUniStr255* outForkName; 797 FSVolumeRefNum volume; 798 FSCatalogInfoBitmap whichInfo; 799 FSCatalogInfo* catalogInfo; 800 FSForkInfo* forkInfo; 801 FSRef* ref; 802 803#if HAVE_FSSPEC 804 FSSpec* spec; 805#endif 806 807 /* FSRef functions: no need to check? */ 808 FSGetForkCBInfo( desiredRefNum, volume, iterator, 809 actualRefNum, forkInfo, ref, 810 outForkName ); 811 FSPathMakeRef( path, ref, isDirectory ); 812 813#if HAVE_FSSPEC 814 FSpMakeFSRef ( spec, ref ); 815 FSGetCatalogInfo( ref, whichInfo, catalogInfo, 816 outForkName, spec, ref ); 817#endif 818 ])], 819 [AC_MSG_RESULT([ok]) 820 CFLAGS="$CFLAGS -DHAVE_FSREF=1"], 821 [AC_MSG_RESULT([not found]) 822 CFLAGS="$CFLAGS -DHAVE_FSREF=0"]) 823fi 824 825 826# Whether to use QuickDraw API in ToolBox, which is deprecated since 827# Mac OS X 10.4. 828 829AC_ARG_WITH([quickdraw-toolbox], 830 AS_HELP_STRING([--with-quickdraw-toolbox], 831 [use MacOS QuickDraw in ToolBox, if available (default=yes)])) 832if test x$with_quickdraw_toolbox = xno; then 833 CFLAGS="$CFLAGS -DHAVE_QUICKDRAW_TOOLBOX=0" 834elif test x$with_old_mac_fonts = xyes -a x$with_quickdraw_toolbox != x; then 835 AC_MSG_CHECKING([QuickDraw FontManager functions in ToolBox]) 836 AC_LINK_IFELSE([ 837 AC_LANG_PROGRAM([ 838 839#if defined(__GNUC__) && defined(__APPLE_CC__) 840# include <CoreServices/CoreServices.h> 841# include <ApplicationServices/ApplicationServices.h> 842#else 843# include <ConditionalMacros.h> 844# include <Fonts.h> 845#endif 846 847 ], 848 [ 849 850 Str255 familyName; 851 SInt16 familyID = 0; 852 FMInput* fmIn = NULL; 853 FMOutput* fmOut = NULL; 854 855 856 GetFontName( familyID, familyName ); 857 GetFNum( familyName, &familyID ); 858 fmOut = FMSwapFont( fmIn ); 859 860 ])], 861 [AC_MSG_RESULT([ok]) 862 CFLAGS="$CFLAGS -DHAVE_QUICKDRAW_TOOLBOX=1"], 863 [AC_MSG_RESULT([not found]) 864 CFLAGS="$CFLAGS -DHAVE_QUICKDRAW_TOOLBOX=0"]) 865fi 866 867 868# Whether to use QuickDraw API in Carbon, which is deprecated since 869# Mac OS X 10.4. 870 871AC_ARG_WITH([quickdraw-carbon], 872 AS_HELP_STRING([--with-quickdraw-carbon], 873 [use MacOS QuickDraw in Carbon, if available (default=yes)])) 874if test x$with_quickdraw_carbon = xno; then 875 CFLAGS="$CFLAGS -DHAVE_QUICKDRAW_CARBON=0" 876elif test x$with_old_mac_fonts = xyes -a x$with_quickdraw_carbon != x; then 877 AC_MSG_CHECKING([QuickDraw FontManager functions in Carbon]) 878 AC_LINK_IFELSE([ 879 AC_LANG_PROGRAM([ 880 881#if defined(__GNUC__) && defined(__APPLE_CC__) 882# include <CoreServices/CoreServices.h> 883# include <ApplicationServices/ApplicationServices.h> 884#else 885# include <ConditionalMacros.h> 886# include <Fonts.h> 887#endif 888 889 ], 890 [ 891 892 FMFontFamilyIterator famIter; 893 FMFontFamily family; 894 Str255 famNameStr; 895 FMFontFamilyInstanceIterator instIter; 896 FMFontStyle style; 897 FMFontSize size; 898 FMFont font; 899 FSSpec* pathSpec; 900 901 902 FMCreateFontFamilyIterator( NULL, NULL, kFMUseGlobalScopeOption, 903 &famIter ); 904 FMGetNextFontFamily( &famIter, &family ); 905 FMGetFontFamilyName( family, famNameStr ); 906 FMCreateFontFamilyInstanceIterator( family, &instIter ); 907 FMGetNextFontFamilyInstance( &instIter, &font, &style, &size ); 908 FMDisposeFontFamilyInstanceIterator( &instIter ); 909 FMDisposeFontFamilyIterator( &famIter ); 910 FMGetFontContainer( font, pathSpec ); 911 912 ])], 913 [AC_MSG_RESULT([ok]) 914 CFLAGS="$CFLAGS -DHAVE_QUICKDRAW_CARBON=1"], 915 [AC_MSG_RESULT([not found]) 916 CFLAGS="$CFLAGS -DHAVE_QUICKDRAW_CARBON=0"]) 917fi 918 919 920# Whether to use AppleTypeService since Mac OS X. 921 922AC_ARG_WITH([ats], 923 AS_HELP_STRING([--with-ats], 924 [use AppleTypeService, if available (default=yes)])) 925if test x$with_ats = xno; then 926 CFLAGS="$CFLAGS -DHAVE_ATS=0" 927elif test x$with_old_mac_fonts = xyes -a x$with_ats != x; then 928 AC_MSG_CHECKING([AppleTypeService functions]) 929 AC_LINK_IFELSE([ 930 AC_LANG_PROGRAM([ 931 932#if defined(__GNUC__) && defined(__APPLE_CC__) 933# include <CoreServices/CoreServices.h> 934# include <ApplicationServices/ApplicationServices.h> 935#else 936# include <ConditionalMacros.h> 937# include <Files.h> 938#endif 939 940 ], 941 [ 942 943 FSSpec* pathSpec; 944 945 946 ATSFontFindFromName( NULL, kATSOptionFlagsUnRestrictedScope ); 947#if HAVE_FSSPEC 948 ATSFontGetFileSpecification( 0, pathSpec ); 949#endif 950 951 ])], 952 [AC_MSG_RESULT([ok]) 953 CFLAGS="$CFLAGS -DHAVE_ATS=1"], 954 [AC_MSG_RESULT([not found]) 955 CFLAGS="$CFLAGS -DHAVE_ATS=0"]) 956fi 957 958case "$CFLAGS" in 959 *HAVE_FSSPEC* | *HAVE_FSREF* | *HAVE_QUICKDRAW* | *HAVE_ATS* ) 960 AC_MSG_WARN([ 961*** WARNING 962 FSSpec/FSRef/QuickDraw/ATS options are explicitly given, 963 thus it is recommended to replace src/base/ftmac.c by builds/mac/ftmac.c. 964 ]) 965 CFLAGS="$CFLAGS "'-I$(TOP_DIR)/builds/mac/' 966 ;; 967 *) 968 ;; 969esac 970 971 972# entries in Requires.private are separated by commas; 973REQUIRES_PRIVATE="$zlib_reqpriv, \ 974 $bzip2_reqpriv, \ 975 $libpng_reqpriv, \ 976 $harfbuzz_reqpriv" 977# beautify 978REQUIRES_PRIVATE=`echo "$REQUIRES_PRIVATE" \ 979 | sed -e 's/^ *//' \ 980 -e 's/ *$//' \ 981 -e 's/, */,/g' \ 982 -e 's/,,*/,/g' \ 983 -e 's/^,*//' \ 984 -e 's/,*$//' \ 985 -e 's/,/, /g'` 986 987LIBS_PRIVATE="$zlib_libspriv \ 988 $bzip2_libspriv \ 989 $libpng_libspriv \ 990 $harfbuzz_libspriv \ 991 $ft2_extra_libs" 992# beautify 993LIBS_PRIVATE=`echo "$LIBS_PRIVATE" \ 994 | sed -e 's/^ *//' \ 995 -e 's/ *$//' \ 996 -e 's/ */ /g'` 997 998LIBSSTATIC_CONFIG="-lfreetype \ 999 $zlib_libsstaticconf \ 1000 $bzip2_libsstaticconf \ 1001 $libpng_libsstaticconf \ 1002 $harfbuzz_libsstaticconf \ 1003 $ft2_extra_libs" 1004# remove -L/usr/lib and -L/usr/lib64 since `freetype-config' adds them later 1005# on if necessary; also beautify 1006LIBSSTATIC_CONFIG=`echo "$LIBSSTATIC_CONFIG" \ 1007 | sed -e 's|-L */usr/lib64/* | |g' \ 1008 -e 's|-L */usr/lib/* | |g' \ 1009 -e 's/^ *//' \ 1010 -e 's/ *$//' \ 1011 -e 's/ */ /g'` 1012 1013 1014AC_SUBST([ftmac_c]) 1015AC_SUBST([REQUIRES_PRIVATE]) 1016AC_SUBST([LIBS_PRIVATE]) 1017AC_SUBST([LIBSSTATIC_CONFIG]) 1018 1019AC_SUBST([hardcode_libdir_flag_spec]) 1020AC_SUBST([wl]) 1021AC_SUBST([build_libtool_libs]) 1022 1023 1024# changing LDFLAGS value should only be done after 1025# lt_cv_prog_compiler_static_works test 1026 1027ftoption_set() 1028{ 1029 regexp="-e \\\"s|.*#.*def.*$1.*|#define $1|\\\"" 1030 FTOPTION_H_SED="$FTOPTION_H_SED $regexp" 1031} 1032 1033ftoption_unset() 1034{ 1035 regexp="-e \\\"s|.*#.*def.*$1.*|/* #undef $1 */|\\\"" 1036 FTOPTION_H_SED="$FTOPTION_H_SED $regexp" 1037} 1038 1039if test "$have_zlib" != no; then 1040 CFLAGS="$CFLAGS $ZLIB_CFLAGS" 1041 LDFLAGS="$LDFLAGS $ZLIB_LIBS" 1042 ftoption_set FT_CONFIG_OPTION_SYSTEM_ZLIB 1043else 1044 ftoption_unset FT_CONFIG_OPTION_SYSTEM_ZLIB 1045fi 1046if test "$have_bzip2" != no; then 1047 CFLAGS="$CFLAGS $BZIP2_CFLAGS" 1048 LDFLAGS="$LDFLAGS $BZIP2_LIBS" 1049 ftoption_set FT_CONFIG_OPTION_USE_BZIP2 1050else 1051 ftoption_unset FT_CONFIG_OPTION_USE_BZIP2 1052fi 1053if test "$have_libpng" != no; then 1054 CFLAGS="$CFLAGS $LIBPNG_CFLAGS" 1055 LDFLAGS="$LDFLAGS $LIBPNG_LIBS" 1056 ftoption_set FT_CONFIG_OPTION_USE_PNG 1057else 1058 ftoption_unset FT_CONFIG_OPTION_USE_PNG 1059fi 1060if test "$have_harfbuzz" != no; then 1061 CFLAGS="$CFLAGS $HARFBUZZ_CFLAGS" 1062 LDFLAGS="$LDFLAGS $HARFBUZZ_LIBS" 1063 ftoption_set FT_CONFIG_OPTION_USE_HARFBUZZ 1064else 1065 ftoption_unset FT_CONFIG_OPTION_USE_HARFBUZZ 1066fi 1067 1068AC_SUBST([CFLAGS]) 1069AC_SUBST([LDFLAGS]) 1070 1071# We don't want to use a template file for `ftoption.h', since compilation 1072# should work without calling a configure script also. For this reason, we 1073# copy the `include/freetype/config/ftoption.h' file to the `unix/builds' 1074# directory (using a dummy `AC_CONFIG_FILES' call) and apply the just 1075# constructed $FTOPTION_H_SED regexp (using the post-action of 1076# `AC_CONFIG_FILES'); this is also the version that gets installed later on. 1077# 1078AC_CONFIG_FILES([ftoption.h:${srcdir}/../../include/freetype/config/ftoption.h], 1079 [mv ftoption.h ftoption.tmp 1080 eval "sed $FTOPTION_H_SED < ftoption.tmp > ftoption.h" 1081 rm ftoption.tmp], 1082 [FTOPTION_H_SED="$FTOPTION_H_SED"]) 1083 1084# configuration file -- stay in 8.3 limit 1085# 1086# since #undef doesn't survive in configuration header files we replace 1087# `/undef' with `#undef' after creating the output file 1088 1089AC_CONFIG_HEADERS([ftconfig.h:ftconfig.in], 1090 [mv ftconfig.h ftconfig.tmp 1091 sed 's|/undef|#undef|' < ftconfig.tmp > ftconfig.h 1092 rm ftconfig.tmp]) 1093 1094# create the Unix-specific sub-Makefiles `builds/unix/unix-def.mk' 1095# and `builds/unix/unix-cc.mk' that will be used by the build system 1096# 1097AC_CONFIG_FILES([unix-cc.mk:unix-cc.in 1098 unix-def.mk:unix-def.in]) 1099 1100# re-generate the Jamfile to use libtool now 1101# 1102# AC_CONFIG_FILES([../../Jamfile:../../Jamfile.in]) 1103 1104AC_OUTPUT 1105 1106AC_MSG_NOTICE([ 1107 1108Library configuration: 1109 external zlib: $have_zlib 1110 bzip2: $have_bzip2 1111 libpng: $have_libpng 1112 harfbuzz: $have_harfbuzz 1113]) 1114 1115# end of configure.raw 1116