1 # This file is part of the FreeType project.
3 # Process this file with autoconf to produce a configure script.
5 # Copyright (C) 2001-2020 by
6 # David Turner, Robert Wilhelm, and Werner Lemberg.
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
14 AC_INIT([FreeType], [2.10.4], [freetype@nongnu.org], [freetype])
15 AC_CONFIG_SRCDIR([ftconfig.h.in])
18 # Don't forget to update `docs/VERSIONS.TXT'!
20 version_info='23:4:17'
21 AC_SUBST([version_info])
22 ft_version=`echo $version_info | tr : .`
23 AC_SUBST([ft_version])
26 # checks for system type
37 PKG_PROG_PKG_CONFIG([0.24])
40 AC_CHECK_HEADER([windows.h], [LT_PROG_RC])
43 # checks for native programs to generate building tool
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_MSG_ERROR([cannot find native C compiler])
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])
56 if test -x a.out -o -x b.out -o -x conftest; then
58 elif test -x a_out.exe -o -x conftest.exe; then
60 elif test -x conftest.*; then
61 EXEEXT_BUILD=`echo conftest.* | sed -n '1s/^.*\././'`
63 rm -f a.* b.* a_out.exe conftest.*
64 AC_MSG_RESULT($EXEEXT_BUILD)
67 EXEEXT_BUILD=${EXEEXT}
71 AC_SUBST(EXEEXT_BUILD)
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.
77 # This small code snippet has been taken from automake's `ylwrap' script.
81 [[\\/]]* | ?:[[\\/]]*)
84 INSTALL="`pwd`/$INSTALL"
90 [[\\/]]* | ?:[[\\/]]*)
93 MKDIR_P="`pwd`/$MKDIR_P"
98 # checks for header files
101 AC_CHECK_HEADERS([fcntl.h unistd.h])
104 # checks for typedefs, structures, and compiler characteristics
107 AC_CHECK_SIZEOF([int])
108 AC_CHECK_SIZEOF([long])
109 AC_TYPE_LONG_LONG_INT
112 # check whether cpp computation of size of int and long in ftconfig.h.in works
114 AC_MSG_CHECKING([whether cpp computation of bit length in ftconfig.h.in works])
115 orig_CPPFLAGS="${CPPFLAGS}"
116 CPPFLAGS="-I${srcdir} -I. -I${srcdir}/../../include ${CPPFLAGS}"
119 if test ! -f ft2build.h; then
120 ac_clean_files=ft2build.h
124 cat > conftest.c <<\_ACEOF
126 #define FT_CONFIG_OPTIONS_H <freetype/config/ftoption.h>
127 #define FT_CONFIG_STANDARD_LIBRARY_H <freetype/config/ftstdlib.h>
128 #define FT_UINT_MAX UINT_MAX
129 #define FT_ULONG_MAX ULONG_MAX
130 #include "ftconfig.h.in"
132 echo >> conftest.c "#if FT_SIZEOF_INT == "${ac_cv_sizeof_int}
133 echo >> conftest.c "ac_cpp_ft_sizeof_int="${ac_cv_sizeof_int}
134 echo >> conftest.c "#endif"
135 echo >> conftest.c "#if FT_SIZEOF_LONG == "${ac_cv_sizeof_long}
136 echo >> conftest.c "ac_cpp_ft_sizeof_long="${ac_cv_sizeof_long}
137 echo >> conftest.c "#endif"
139 ${CPP} ${CPPFLAGS} conftest.c | ${GREP} ac_cpp_ft > conftest.sh
140 eval `cat conftest.sh`
141 rm -f conftest.* $ac_clean_files
143 if 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
147 ft_use_autoconf_sizeof_types=yes
150 AC_ARG_ENABLE(biarch-config,
151 [ --enable-biarch-config install biarch ftconfig.h to support multiple
152 architectures by single file], [], [])
154 case :${ft_use_autoconf_sizeof_types}:${enable_biarch_config}: in
156 AC_MSG_RESULT([broken but use it])
157 unset ft_use_autoconf_sizeof_types
160 AC_MSG_RESULT([works but ignore it])
161 ft_use_autoconf_sizeof_types=yes
165 unset ft_use_autoconf_sizeof_types
169 ft_use_autoconf_sizeof_types=yes
173 if 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.])
178 CPPFLAGS="${orig_CPPFLAGS}"
180 AC_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"])
188 AC_SUBST(INSTALL_FT2_CONFIG, [$enable_freetype_config])
190 # checks for library functions
194 # Here we check whether we can use our mmap file component.
196 AC_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"])
200 if test "x${enable_mmap}" != "xno"; then
203 if test "x${enable_mmap}" = "xno" \
204 -o "$ac_cv_func_mmap_fixed_mapped" != "yes"; then
205 FTSYS_SRC='$(BASE_DIR)/ftsystem.c'
207 FTSYS_SRC='$(BUILD_DIR)/ftsystem.c'
209 AC_CHECK_DECLS([munmap],
217 #include <sys/mman.h>
223 AC_SUBST([FTSYS_SRC])
225 AC_CHECK_FUNCS([memcpy memmove])
228 # get compiler flags right
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.
235 # Due to bugs in mingwrt 4.0.3 we don't use `-ansi' for MinGW.
237 # To avoid zillions of
239 # ISO C90 does not support 'long long'
241 # warnings, we disable `-pedantic' for gcc version < 4.6.
243 if test "x$GCC" = xyes; then
247 XX_ANSIFLAGS="-pedantic"
250 XX_ANSIFLAGS="-pedantic"
253 GCC_VERSION=`$CC -dumpversion`
254 GCC_MAJOR=`echo "$GCC_VERSION" | sed 's/\([[^.]][[^.]]*\).*/\1/'`
255 GCC_MINOR=`echo "$GCC_VERSION" | sed 's/[[^.]][[^.]]*.\([[^.]][[^.]]*\).*/\1/'`
257 XX_PEDANTIC=-pedantic
258 if test $GCC_MAJOR -lt 4; then
261 if test $GCC_MAJOR -eq 4 -a $GCC_MINOR -lt 6; then
267 for a in $XX_PEDANTIC -ansi
269 AC_MSG_CHECKING([gcc compiler flag ${a} to assure ANSI C works correctly])
270 orig_CFLAGS="${CFLAGS}"
271 CFLAGS="${CFLAGS} ${XX_ANSIFLAGS} ${a}"
286 [AC_MSG_RESULT([ok, adding to XX_ANSIFLAGS])
287 XX_ANSIFLAGS="${XX_ANSIFLAGS} ${a}"
289 [AC_MSG_RESULT([no])])
290 CFLAGS="${orig_CFLAGS}"
298 XX_CFLAGS="-std1 -g3"
307 AC_SUBST([XX_CFLAGS])
308 AC_SUBST([XX_ANSIFLAGS])
311 # It is recommended that shared libraries hide symbols except those with
312 # explicit __attribute__((visibility("default"))).
314 found_visibility_flag=no
315 AC_MSG_CHECKING([for -fvisibility=hidden compiler flag])
316 orig_CFLAGS="${CFLAGS}"
317 CFLAGS="${CFLAGS} -fvisibility=hidden"
318 AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
319 [found_visibility_flag=yes
321 [CFLAGS="${orig_CFLAGS}"
324 if 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
331 [CFLAGS="${orig_CFLAGS}"
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).
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.
343 # The `xxx_libsstaticconf' variables are for the `freetype-config' script.
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'
351 # check for system zlib
354 [AS_HELP_STRING([--with-zlib=@<:@yes|no|auto@:>@],
355 [use system zlib instead of internal library @<:@default=auto@:>@])],
356 [], [with_zlib=auto])
359 if test x"$with_zlib" = xyes -o x"$with_zlib" = xauto; then
363 if test x"$ZLIB_CFLAGS" = x -a x"$ZLIB_LIBS" = x; then
364 PKG_CHECK_EXISTS([$zlib_pkg], [have_zlib_pkg=yes])
366 PKG_CHECK_MODULES([ZLIB], [$zlib_pkg],
367 [have_zlib="yes (pkg-config)"], [:])
369 if test $have_zlib_pkg = yes; then
371 zlib_reqpriv="$zlib_pkg"
373 zlib_libsstaticconf=`$PKG_CONFIG --static --libs "$zlib_pkg"`
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)"
383 # fall back to standard autoconf test
386 [AC_CHECK_HEADER([zlib.h],
387 [have_zlib="yes (autoconf test)"
389 zlib_libsstaticconf="$zlib_libspriv"
390 ZLIB_LIBS="$zlib_libspriv"])])
395 if test x"$with_zlib" = xyes -a "$have_zlib" = no; then
396 AC_MSG_ERROR([external zlib support requested but library not found])
400 # check for system libbz2
403 [AS_HELP_STRING([--with-bzip2=@<:@yes|no|auto@:>@],
404 [support bzip2 compressed fonts @<:@default=auto@:>@])],
405 [], [with_bzip2=auto])
408 if test x"$with_bzip2" = xyes -o x"$with_bzip2" = xauto; then
412 if test x"$BZIP2_CFLAGS" = x -a x"$BZIP2_LIBS" = x; then
413 PKG_CHECK_EXISTS([$bzip2_pkg], [have_bzip2_pkg=yes])
415 PKG_CHECK_MODULES([BZIP2], [$bzip2_pkg],
416 [have_bzip2="yes (pkg-config)"], [:])
418 if test $have_bzip2_pkg = yes; then
420 bzip2_reqpriv="$bzip2_pkg"
422 bzip2_libsstaticconf=`$PKG_CONFIG --static --libs "$bzip2_pkg"`
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)"
432 # fall back to standard autoconf test
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"])])
444 if test x"$with_bzip2" = xyes -a "$have_bzip2" = no; then
445 AC_MSG_ERROR([bzip2 support requested but library not found])
449 # check for system libpng
452 [AS_HELP_STRING([--with-png=@<:@yes|no|auto@:>@],
453 [support png compressed OpenType embedded bitmaps @<:@default=auto@:>@])],
457 if test x"$with_png" = xyes -o x"$with_png" = xauto; then
461 if test x"$LIBPNG_CFLAGS" = x -a x"$LIBPNG_LIBS" = x; then
462 PKG_CHECK_EXISTS([$libpng_pkg], [have_libpng_pkg=yes])
464 PKG_CHECK_MODULES([LIBPNG], [$libpng_pkg],
465 [have_libpng="yes (pkg-config)"], [:])
467 if test $have_libpng_pkg = yes; then
469 libpng_reqpriv="$libpng_pkg"
471 libpng_libsstaticconf=`$PKG_CONFIG --static --libs "$libpng_pkg"`
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)"
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)"
497 if test x"$with_png" = xyes -a "$have_libpng" = no; then
498 AC_MSG_ERROR([libpng support requested but library not found])
502 # check for system libharfbuzz
504 AC_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])
510 if test x"$with_harfbuzz" = xyes -o x"$with_harfbuzz" = xauto; then
511 harfbuzz_pkg="harfbuzz >= 1.8.0"
514 if test x"$HARFBUZZ_CFLAGS" = x -a x"$HARFBUZZ_LIBS" = x; then
515 PKG_CHECK_EXISTS([$harfbuzz_pkg], [have_harfbuzz_pkg=yes])
517 PKG_CHECK_MODULES([HARFBUZZ], [$harfbuzz_pkg],
518 [have_harfbuzz="yes (pkg-config)"], [:])
520 if test $have_harfbuzz_pkg = yes; then
521 # we have harfbuzz.pc
522 harfbuzz_reqpriv="$harfbuzz_pkg"
524 harfbuzz_libsstaticconf=`$PKG_CONFIG --static --libs "$harfbuzz_pkg"`
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)"
534 # since HarfBuzz is quite a new library we don't fall back to a
535 # different test; additionally, it has too many dependencies
541 if test x"$with_harfbuzz" = xyes -a "$have_harfbuzz" = no; then
542 AC_MSG_ERROR([harfbuzz support requested but library not found])
546 # check for system libbrotlidec
548 AC_ARG_WITH([brotli],
549 [AS_HELP_STRING([--with-brotli=@<:@yes|no|auto@:>@],
550 [support decompression of WOFF2 streams @<:@default=auto@:>@])],
551 [], [with_brotli=auto])
554 if test x"$with_brotli" = xyes -o x"$with_brotli" = xauto; then
555 brotli_pkg="libbrotlidec"
558 if test x"$BROTLI_CFLAGS" = x -a x"$BROTLI_LIBS" = x; then
559 PKG_CHECK_EXISTS([$brotli_pkg], [have_brotli_pkg=yes])
561 PKG_CHECK_MODULES([BROTLI], [$brotli_pkg],
562 [have_brotli="yes (pkg-config)"], [:])
564 if test $have_brotli_pkg = yes; then
565 # we have libbrotlidec.pc
566 brotli_reqpriv="$brotli_pkg"
568 brotli_libsstaticconf=`$PKG_CONFIG --static --libs "$brotli_pkg"`
572 if test "$have_brotli" != no; then
573 # BROTLI_CFLAGS and BROTLI_LIBS are set by the user
574 brotli_libspriv="$BROTLI_LIBS"
575 brotli_libsstaticconf="$BROTLI_LIBS"
576 have_brotli="yes (BROTLI_CFLAGS and BROTLI_LIBS)"
578 # since Brotli is quite a new library we don't fall back to a
585 if test x"$with_brotli" = xyes -a "$have_brotli" = no; then
586 AC_MSG_ERROR([brotli support requested but library not found])
592 # We need `clock_gettime' for the `ftbench' demo program.
594 # The code is modeled after gnulib's file `clock_time.m4', ignoring
595 # very old Solaris systems.
598 AC_SEARCH_LIBS([clock_gettime],
600 [test "$ac_cv_search_clock_gettime" = "none required" \
601 || LIB_CLOCK_GETTIME=$ac_cv_search_clock_gettime])
602 AC_SUBST([LIB_CLOCK_GETTIME])
605 # Some options handling SDKs/archs in CFLAGS should be copied
606 # to LDFLAGS. Apple TechNote 2137 recommends to include these
607 # options in CFLAGS but not in LDFLAGS.
617 -isysroot|-arch) # options taking 1 argument
619 AC_MSG_CHECKING([whether CFLAGS and LDFLAGS share ${c} ${a}])
620 if expr " ${LDFLAGS} " : ".* ${c} *${a}.*" > /dev/null
624 AC_MSG_RESULT([no, copy to LDFLAGS])
625 LDFLAGS="${LDFLAGS} ${c} ${a}"
629 -m32|-m64|-march=*|-mcpu=*) # options taking no argument
630 AC_MSG_CHECKING([whether CFLAGS and LDFLAGS share ${c}])
631 if expr " ${LDFLAGS} " : ".* ${c} *${a}.*" > /dev/null
635 AC_MSG_RESULT([no, copy to LDFLAGS])
636 LDFLAGS="${LDFLAGS} ${c}"
640 # AC_MSG_RESULT([${c} is not copied to LDFLAGS])
646 set ${save_config_args}
649 # Whether to use Mac OS resource-based fonts.
651 ftmac_c="" # src/base/ftmac.c should not be included in makefiles by default
653 AC_ARG_WITH([old-mac-fonts],
654 AS_HELP_STRING([--with-old-mac-fonts],
655 [allow Mac resource-based fonts to be used]))
656 if test x$with_old_mac_fonts = xyes; then
657 orig_LDFLAGS="${LDFLAGS}"
658 AC_MSG_CHECKING([CoreServices & ApplicationServices of Mac OS X])
659 ft2_extra_libs="-Wl,-framework,CoreServices -Wl,-framework,ApplicationServices"
660 LDFLAGS="$LDFLAGS $ft2_extra_libs"
664 #if defined(__GNUC__) && defined(__APPLE_CC__)
665 # include <CoreServices/CoreServices.h>
666 # include <ApplicationServices/ApplicationServices.h>
668 # include <ConditionalMacros.h>
683 AC_MSG_CHECKING([whether OS_INLINE macro is ANSI compatible])
684 orig_CFLAGS="$CFLAGS -DFT_MACINTOSH"
685 CFLAGS="$CFLAGS $XX_CFLAGS $XX_ANSIFLAGS"
689 #if defined(__GNUC__) && defined(__APPLE_CC__)
690 # include <CoreServices/CoreServices.h>
691 # include <ApplicationServices/ApplicationServices.h>
693 # include <ConditionalMacros.h>
700 /* OSHostByteOrder() is typed as OS_INLINE */
701 int32_t os_byte_order = OSHostByteOrder();
704 if ( OSBigEndian != os_byte_order )
709 CFLAGS="$orig_CFLAGS"
710 CFLAGS="$CFLAGS -DHAVE_ANSI_OS_INLINE=1"
712 [AC_MSG_RESULT([no, ANSI incompatible])
713 CFLAGS="$orig_CFLAGS"
715 AC_MSG_CHECKING([type ResourceIndex])
716 orig_CFLAGS="$CFLAGS"
717 CFLAGS="$CFLAGS $XX_CFLAGS $XX_ANSIFLAGS"
721 #if defined(__GNUC__) && defined(__APPLE_CC__)
722 # include <CoreServices/CoreServices.h>
723 # include <ApplicationServices/ApplicationServices.h>
725 # include <ConditionalMacros.h>
727 # include <Resources.h>
738 CFLAGS="$orig_CFLAGS"
739 CFLAGS="$CFLAGS -DHAVE_TYPE_RESOURCE_INDEX=1"
742 CFLAGS="$orig_CFLAGS"
743 CFLAGS="$CFLAGS -DHAVE_TYPE_RESOURCE_INDEX=0"
745 [AC_MSG_RESULT([not found])
747 LDFLAGS="${orig_LDFLAGS}"
748 CFLAGS="$CFLAGS -DDARWIN_NO_CARBON"])
752 dnl AC_MSG_WARN([host system is MacOS but configured to build without Carbon])
753 CFLAGS="$CFLAGS -DDARWIN_NO_CARBON"
761 # Whether to use FileManager, which is deprecated since Mac OS X 10.4.
763 AC_ARG_WITH([fsspec],
764 AS_HELP_STRING([--with-fsspec],
765 [use obsolete FSSpec API of MacOS, if available (default=yes)]))
766 if test x$with_fsspec = xno; then
767 CFLAGS="$CFLAGS -DHAVE_FSSPEC=0"
768 elif test x$with_old_mac_fonts = xyes -a x$with_fsspec != x; then
769 AC_MSG_CHECKING([FSSpec-based FileManager])
773 #if defined(__GNUC__) && defined(__APPLE_CC__)
774 # include <CoreServices/CoreServices.h>
775 # include <ApplicationServices/ApplicationServices.h>
777 # include <ConditionalMacros.h>
787 ConstStr255Param fileName;
791 /* FSSpec functions: deprecated since Mac OS X 10.4 */
792 PBGetFCBInfoSync( paramBlock );
793 FSMakeFSSpec( vRefNum, dirID, fileName, spec );
797 CFLAGS="$CFLAGS -DHAVE_FSSPEC=1"],
798 [AC_MSG_RESULT([not found])
799 CFLAGS="$CFLAGS -DHAVE_FSSPEC=0"])
803 # Whether to use FileManager in Carbon since MacOS 9.x.
806 AS_HELP_STRING([--with-fsref],
807 [use Carbon FSRef API of MacOS, if available (default=yes)]))
808 if test x$with_fsref = xno; then
811 FreeType2 built without FSRef API cannot load
812 data-fork fonts on MacOS, except of XXX.dfont.
814 CFLAGS="$CFLAGS -DHAVE_FSREF=0"
815 elif test x$with_old_mac_fonts = xyes -a x$with_fsref != x; then
816 AC_MSG_CHECKING([FSRef-based FileManager])
820 #if defined(__GNUC__) && defined(__APPLE_CC__)
821 # include <CoreServices/CoreServices.h>
822 # include <ApplicationServices/ApplicationServices.h>
824 # include <ConditionalMacros.h>
833 ConstStr255Param fileName;
835 Boolean* isDirectory;
837 SInt16 desiredRefNum;
839 SInt16* actualRefNum;
840 HFSUniStr255* outForkName;
841 FSVolumeRefNum volume;
842 FSCatalogInfoBitmap whichInfo;
843 FSCatalogInfo* catalogInfo;
844 FSForkInfo* forkInfo;
851 /* FSRef functions: no need to check? */
852 FSGetForkCBInfo( desiredRefNum, volume, iterator,
853 actualRefNum, forkInfo, ref,
855 FSPathMakeRef( path, ref, isDirectory );
858 FSpMakeFSRef ( spec, ref );
859 FSGetCatalogInfo( ref, whichInfo, catalogInfo,
860 outForkName, spec, ref );
864 CFLAGS="$CFLAGS -DHAVE_FSREF=1"],
865 [AC_MSG_RESULT([not found])
866 CFLAGS="$CFLAGS -DHAVE_FSREF=0"])
870 # Whether to use QuickDraw API in ToolBox, which is deprecated since
873 AC_ARG_WITH([quickdraw-toolbox],
874 AS_HELP_STRING([--with-quickdraw-toolbox],
875 [use MacOS QuickDraw in ToolBox, if available (default=yes)]))
876 if test x$with_quickdraw_toolbox = xno; then
877 CFLAGS="$CFLAGS -DHAVE_QUICKDRAW_TOOLBOX=0"
878 elif test x$with_old_mac_fonts = xyes -a x$with_quickdraw_toolbox != x; then
879 AC_MSG_CHECKING([QuickDraw FontManager functions in ToolBox])
883 #if defined(__GNUC__) && defined(__APPLE_CC__)
884 # include <CoreServices/CoreServices.h>
885 # include <ApplicationServices/ApplicationServices.h>
887 # include <ConditionalMacros.h>
896 FMInput* fmIn = NULL;
897 FMOutput* fmOut = NULL;
900 GetFontName( familyID, familyName );
901 GetFNum( familyName, &familyID );
902 fmOut = FMSwapFont( fmIn );
906 CFLAGS="$CFLAGS -DHAVE_QUICKDRAW_TOOLBOX=1"],
907 [AC_MSG_RESULT([not found])
908 CFLAGS="$CFLAGS -DHAVE_QUICKDRAW_TOOLBOX=0"])
912 # Whether to use QuickDraw API in Carbon, which is deprecated since
915 AC_ARG_WITH([quickdraw-carbon],
916 AS_HELP_STRING([--with-quickdraw-carbon],
917 [use MacOS QuickDraw in Carbon, if available (default=yes)]))
918 if test x$with_quickdraw_carbon = xno; then
919 CFLAGS="$CFLAGS -DHAVE_QUICKDRAW_CARBON=0"
920 elif test x$with_old_mac_fonts = xyes -a x$with_quickdraw_carbon != x; then
921 AC_MSG_CHECKING([QuickDraw FontManager functions in Carbon])
925 #if defined(__GNUC__) && defined(__APPLE_CC__)
926 # include <CoreServices/CoreServices.h>
927 # include <ApplicationServices/ApplicationServices.h>
929 # include <ConditionalMacros.h>
936 FMFontFamilyIterator famIter;
939 FMFontFamilyInstanceIterator instIter;
946 FMCreateFontFamilyIterator( NULL, NULL, kFMUseGlobalScopeOption,
948 FMGetNextFontFamily( &famIter, &family );
949 FMGetFontFamilyName( family, famNameStr );
950 FMCreateFontFamilyInstanceIterator( family, &instIter );
951 FMGetNextFontFamilyInstance( &instIter, &font, &style, &size );
952 FMDisposeFontFamilyInstanceIterator( &instIter );
953 FMDisposeFontFamilyIterator( &famIter );
954 FMGetFontContainer( font, pathSpec );
958 CFLAGS="$CFLAGS -DHAVE_QUICKDRAW_CARBON=1"],
959 [AC_MSG_RESULT([not found])
960 CFLAGS="$CFLAGS -DHAVE_QUICKDRAW_CARBON=0"])
964 # Whether to use AppleTypeService since Mac OS X.
967 AS_HELP_STRING([--with-ats],
968 [use AppleTypeService, if available (default=yes)]))
969 if test x$with_ats = xno; then
970 CFLAGS="$CFLAGS -DHAVE_ATS=0"
971 elif test x$with_old_mac_fonts = xyes -a x$with_ats != x; then
972 AC_MSG_CHECKING([AppleTypeService functions])
976 #if defined(__GNUC__) && defined(__APPLE_CC__)
977 # include <CoreServices/CoreServices.h>
978 # include <ApplicationServices/ApplicationServices.h>
980 # include <ConditionalMacros.h>
990 ATSFontFindFromName( NULL, kATSOptionFlagsUnRestrictedScope );
992 ATSFontGetFileSpecification( 0, pathSpec );
997 CFLAGS="$CFLAGS -DHAVE_ATS=1"],
998 [AC_MSG_RESULT([not found])
999 CFLAGS="$CFLAGS -DHAVE_ATS=0"])
1003 *HAVE_FSSPEC* | *HAVE_FSREF* | *HAVE_QUICKDRAW* | *HAVE_ATS* )
1006 FSSpec/FSRef/QuickDraw/ATS options are explicitly given,
1007 thus it is recommended to replace src/base/ftmac.c by builds/mac/ftmac.c.
1009 CFLAGS="$CFLAGS "'-I$(TOP_DIR)/builds/mac/'
1015 # Check for Python and docwriter
1021 AC_CHECK_PROGS([PYTHON], [python3 python], [missing])
1022 if test "x$PYTHON" != "xmissing"; then
1023 AX_PROG_PYTHON_VERSION([3.5], [have_py3=yes], [])
1025 if test "x$have_py3" = "xyes"; then
1026 PIP="$PYTHON -m $PIP"
1027 AC_MSG_CHECKING([for \`docwriter' Python module])
1028 $PYTHON -m docwriter -h > /dev/null 2>&1
1029 if test "x$?" = "x0"; then
1031 AC_MSG_RESULT([yes])
1039 # entries in Requires.private are separated by commas
1040 REQUIRES_PRIVATE="$zlib_reqpriv, \
1043 $harfbuzz_reqpriv, \
1046 REQUIRES_PRIVATE=`echo "$REQUIRES_PRIVATE" \
1047 | sed -e 's/^ *//' \
1055 LIBS_PRIVATE="$zlib_libspriv \
1058 $harfbuzz_libspriv \
1062 LIBS_PRIVATE=`echo "$LIBS_PRIVATE" \
1063 | sed -e 's/^ *//' \
1067 LIBSSTATIC_CONFIG="-lfreetype \
1068 $zlib_libsstaticconf \
1069 $bzip2_libsstaticconf \
1070 $libpng_libsstaticconf \
1071 $harfbuzz_libsstaticconf \
1072 $brotli_libsstaticconf \
1074 # remove -L/usr/lib and -L/usr/lib64 since `freetype-config' adds them later
1075 # on if necessary; also beautify
1076 LIBSSTATIC_CONFIG=`echo "$LIBSSTATIC_CONFIG" \
1077 | sed -e 's|-L */usr/lib64/* | |g' \
1078 -e 's|-L */usr/lib/* | |g' \
1085 AC_SUBST([REQUIRES_PRIVATE])
1086 AC_SUBST([LIBS_PRIVATE])
1087 AC_SUBST([LIBSSTATIC_CONFIG])
1089 AC_SUBST([hardcode_libdir_flag_spec])
1091 AC_SUBST([build_libtool_libs])
1094 # changing LDFLAGS value should only be done after
1095 # lt_cv_prog_compiler_static_works test
1099 regexp="-e \\\"s|.*#.*def.*$1.*|#define $1|\\\""
1100 FTOPTION_H_SED="$FTOPTION_H_SED $regexp"
1105 regexp="-e \\\"s|.*#.*def.*$1.*|/* #undef $1 */|\\\""
1106 FTOPTION_H_SED="$FTOPTION_H_SED $regexp"
1109 if test "$have_zlib" != no; then
1110 CFLAGS="$CFLAGS $ZLIB_CFLAGS"
1111 LDFLAGS="$LDFLAGS $ZLIB_LIBS"
1112 ftoption_set FT_CONFIG_OPTION_SYSTEM_ZLIB
1114 ftoption_unset FT_CONFIG_OPTION_SYSTEM_ZLIB
1116 if test "$have_bzip2" != no; then
1117 CFLAGS="$CFLAGS $BZIP2_CFLAGS"
1118 LDFLAGS="$LDFLAGS $BZIP2_LIBS"
1119 ftoption_set FT_CONFIG_OPTION_USE_BZIP2
1121 ftoption_unset FT_CONFIG_OPTION_USE_BZIP2
1123 if test "$have_libpng" != no; then
1124 CFLAGS="$CFLAGS $LIBPNG_CFLAGS"
1125 LDFLAGS="$LDFLAGS $LIBPNG_LIBS"
1126 ftoption_set FT_CONFIG_OPTION_USE_PNG
1128 ftoption_unset FT_CONFIG_OPTION_USE_PNG
1130 if test "$have_harfbuzz" != no; then
1131 CFLAGS="$CFLAGS $HARFBUZZ_CFLAGS"
1132 LDFLAGS="$LDFLAGS $HARFBUZZ_LIBS"
1133 ftoption_set FT_CONFIG_OPTION_USE_HARFBUZZ
1135 ftoption_unset FT_CONFIG_OPTION_USE_HARFBUZZ
1137 if test "$have_brotli" != no; then
1138 CFLAGS="$CFLAGS $BROTLI_CFLAGS"
1139 LDFLAGS="$LDFLAGS $BROTLI_LIBS"
1140 ftoption_set FT_CONFIG_OPTION_USE_BROTLI
1142 ftoption_unset FT_CONFIG_OPTION_USE_BROTLI
1148 # We don't want to use a template file for `ftoption.h', since compilation
1149 # should work without calling a configure script also. For this reason, we
1150 # copy the `include/freetype/config/ftoption.h' file to the `unix/builds'
1151 # directory (using a dummy `AC_CONFIG_FILES' call) and apply the just
1152 # constructed $FTOPTION_H_SED regexp (using the post-action of
1153 # `AC_CONFIG_FILES'); this is also the version that gets installed later on.
1155 AC_CONFIG_FILES([ftoption.h:${srcdir}/../../include/freetype/config/ftoption.h],
1156 [mv ftoption.h ftoption.tmp
1157 eval "sed $FTOPTION_H_SED < ftoption.tmp > ftoption.h"
1159 [FTOPTION_H_SED="$FTOPTION_H_SED"])
1161 AC_CONFIG_HEADERS([ftconfig.h])
1163 # create the Unix-specific sub-Makefiles `builds/unix/unix-def.mk'
1164 # and `builds/unix/unix-cc.mk' that will be used by the build system
1166 AC_CONFIG_FILES([unix-cc.mk:unix-cc.in
1167 unix-def.mk:unix-def.in])
1173 Library configuration:
1174 external zlib: $have_zlib
1176 libpng: $have_libpng
1177 harfbuzz: $have_harfbuzz
1178 brotli: $have_brotli
1181 # Warn if docwriter is not installed
1183 if test $have_docwriter = no; then
1185 \`make refdoc' will fail since pip package \`docwriter' is not installed.
1186 To install, run \`$PIP install docwriter', or to use a Python
1187 virtual environment, run \`make refdoc-venv' (requires pip package
1188 \`virtualenv'). These operations require Python >= 3.5.
1192 # end of configure.raw