tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

configure.ac (35201B)


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