1 # This file is part of the FreeType project.
3 # Process this file with autoconf to produce a configure script.
5 # Copyright (C) 2001-2023 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], [@VERSION@], [freetype@nongnu.org], [freetype])
15 AC_CONFIG_SRCDIR([ftconfig.h.in])
18 # Don't forget to update `docs/VERSIONS.TXT'!
20 version_info='26:1:20'
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(void) { 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
100 AC_CHECK_HEADERS([fcntl.h unistd.h])
103 # checks for typedefs, structures, and compiler characteristics
107 AC_ARG_ENABLE([freetype-config],
108 AS_HELP_STRING([--enable-freetype-config], [install freetype-config]),
109 [case "${enableval}" in
110 yes) enable_freetype_config="TRUE" ;;
111 no) enable_freetype_config="FALSE" ;;
112 *) AC_MSG_ERROR([unknown value '${enableval}' passed with --enable-freetype-config]) ;;
113 esac], [enable_freetype_config="FALSE"])
115 AC_SUBST(INSTALL_FT2_CONFIG, [$enable_freetype_config])
117 # checks for library functions
121 # Here we check whether we can use our mmap file component.
123 # Note that `ftsystem.c` for Windows has its own mmap-like implementation
124 # not covered by `AC_FUNC_MMAP` and/or `FT_UNMAP_PARAM`.
126 AC_ARG_ENABLE([mmap],
127 AS_HELP_STRING([--disable-mmap],
128 [do not check mmap() and do not use]),
129 [enable_mmap="no"], [enable_mmap="yes"])
130 if test "x${enable_mmap}" != "xno"; then
133 AC_MSG_CHECKING([for working mmap])
134 AC_MSG_RESULT([using MapViewOfFile in Windows])
135 FTSYS_SRC='$(TOP_DIR)/builds/windows/ftsystem.c'
139 if test "$ac_cv_func_mmap_fixed_mapped" = "yes"; then
140 FTSYS_SRC='$(PLATFORM_DIR)/ftsystem.c'
142 AC_CHECK_DECLS([munmap],
150 #include <sys/mman.h>
160 if test -z "$FTSYS_SRC"; then
161 FTSYS_SRC='$(BASE_DIR)/ftsystem.c'
163 AC_SUBST([FTSYS_SRC])
166 # get compiler flags right
168 # We try to make the compiler work for C99-strict source. Even if the
169 # C compiler is gcc and C99 flags are available, some system headers
170 # might be broken in C99 mode. We have to check whether compilation
171 # finishes successfully.
173 if test "x$GCC" = xyes; then
177 XX_ANSIFLAGS="-pedantic"
180 XX_ANSIFLAGS="-pedantic"
185 for a in "-pedantic" "-std=c99"
187 AC_MSG_CHECKING([$CC compiler flag ${a} to assure ANSI C99 works correctly])
188 orig_CFLAGS="${CFLAGS}"
189 CFLAGS="${CFLAGS} ${XX_ANSIFLAGS} ${a}"
204 [AC_MSG_RESULT([ok, adding to XX_ANSIFLAGS])
205 XX_ANSIFLAGS="${XX_ANSIFLAGS} ${a}"
207 [AC_MSG_RESULT([no])])
208 CFLAGS="${orig_CFLAGS}"
216 XX_CFLAGS="-std1 -g3"
225 AC_SUBST([XX_CFLAGS])
226 AC_SUBST([XX_ANSIFLAGS])
229 # It is recommended that shared libraries hide symbols except those with
230 # explicit __attribute__((visibility("default"))).
232 found_visibility_flag=no
233 AC_MSG_CHECKING([for -fvisibility=hidden compiler flag])
234 orig_CFLAGS="${CFLAGS}"
235 CFLAGS="${CFLAGS} -fvisibility=hidden"
236 AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
237 [found_visibility_flag=yes
239 [CFLAGS="${orig_CFLAGS}"
242 if test "${found_visibility_flag}" = "no"; then
243 AC_MSG_CHECKING([for -xldscope=hidden compiler flag])
244 orig_CFLAGS="${CFLAGS}"
245 CFLAGS="${CFLAGS} -xldscope=hidden"
246 AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
247 [found_visibility_flag=yes
249 [CFLAGS="${orig_CFLAGS}"
253 # All library tests below try `pkg-config' first. If that fails, a function
254 # from the library is tested in the traditional autoconf way (zlib, bzip2),
255 # or a config script is called (libpng).
257 # The `xxx_reqpriv' variables are for the `Requires.private' field in
258 # `freetype2.pc'. The `xxx_libspriv' variables are for the `Libs.private'
259 # field in `freetype2.pc' if pkg-config doesn't find a proper .pc file.
261 # The `xxx_libsstaticconf' variables are for the `freetype-config' script.
263 # Note that a call to PKG_CHECK_MODULES(XXX, ...) sets and creates the
264 # output variables `XXX_CFLAGS' and `XXX_LIBS'. In case one or both are set
265 # for a library by the user, no entry for this library is added to
266 # `Requires.private'. Instead, it gets added to `Libs.private'
269 # check for system zlib
272 [AS_HELP_STRING([--with-zlib=@<:@yes|no|auto@:>@],
273 [use system zlib instead of internal library @<:@default=auto@:>@])],
274 [], [with_zlib=auto])
277 if test x"$with_zlib" = xyes -o x"$with_zlib" = xauto; then
281 if test x"$ZLIB_CFLAGS" = x -a x"$ZLIB_LIBS" = x; then
282 PKG_CHECK_EXISTS([$zlib_pkg], [have_zlib_pkg=yes])
284 PKG_CHECK_MODULES([ZLIB], [$zlib_pkg],
285 [have_zlib="yes (pkg-config)"], [:])
287 if test $have_zlib_pkg = yes; then
289 zlib_reqpriv="$zlib_pkg"
291 zlib_libsstaticconf=`$PKG_CONFIG --static --libs "$zlib_pkg"`
295 if test "$have_zlib" != no; then
296 # ZLIB_CFLAGS and ZLIB_LIBS are set by the user
297 zlib_libspriv="$ZLIB_LIBS"
298 zlib_libsstaticconf="$ZLIB_LIBS"
299 have_zlib="yes (ZLIB_CFLAGS and ZLIB_LIBS)"
301 # fall back to standard autoconf test
304 [AC_CHECK_HEADER([zlib.h],
305 [have_zlib="yes (autoconf test)"
307 zlib_libsstaticconf="$zlib_libspriv"
308 ZLIB_LIBS="$zlib_libspriv"])])
313 if test x"$with_zlib" = xyes -a "$have_zlib" = no; then
314 AC_MSG_ERROR([external zlib support requested but library not found])
318 if test "$have_zlib" != no; then
321 AC_SUBST([SYSTEM_ZLIB])
324 # check for system libbz2
327 [AS_HELP_STRING([--with-bzip2=@<:@yes|no|auto@:>@],
328 [support bzip2 compressed fonts @<:@default=auto@:>@])],
329 [], [with_bzip2=auto])
332 if test x"$with_bzip2" = xyes -o x"$with_bzip2" = xauto; then
336 if test x"$BZIP2_CFLAGS" = x -a x"$BZIP2_LIBS" = x; then
337 PKG_CHECK_EXISTS([$bzip2_pkg], [have_bzip2_pkg=yes])
339 PKG_CHECK_MODULES([BZIP2], [$bzip2_pkg],
340 [have_bzip2="yes (pkg-config)"], [:])
342 if test $have_bzip2_pkg = yes; then
344 bzip2_reqpriv="$bzip2_pkg"
346 bzip2_libsstaticconf=`$PKG_CONFIG --static --libs "$bzip2_pkg"`
350 if test "$have_bzip2" != no; then
351 # BZIP2_CFLAGS and BZIP2_LIBS are set by the user
352 bzip2_libspriv="$BZIP2_LIBS"
353 bzip2_libsstaticconf="$BZIP2_LIBS"
354 have_bzip2="yes (BZIP2_CFLAGS and BZIP2_LIBS)"
356 # fall back to standard autoconf test
359 [AC_CHECK_HEADER([bzlib.h],
360 [have_bzip2="yes (autoconf test)"
361 bzip2_libspriv="-lbz2"
362 bzip2_libsstaticconf="$bzip2_libspriv"
363 BZIP2_LIBS="$bzip2_libspriv"])])
368 if test x"$with_bzip2" = xyes -a "$have_bzip2" = no; then
369 AC_MSG_ERROR([bzip2 support requested but library not found])
373 # check for system libpng
376 [AS_HELP_STRING([--with-png=@<:@yes|no|auto@:>@],
377 [support png compressed OpenType embedded bitmaps @<:@default=auto@:>@])],
381 if test x"$with_png" = xyes -o x"$with_png" = xauto; then
385 if test x"$LIBPNG_CFLAGS" = x -a x"$LIBPNG_LIBS" = x; then
386 PKG_CHECK_EXISTS([$libpng_pkg], [have_libpng_pkg=yes])
388 PKG_CHECK_MODULES([LIBPNG], [$libpng_pkg],
389 [have_libpng="yes (pkg-config)"], [:])
391 if test $have_libpng_pkg = yes; then
393 libpng_reqpriv="$libpng_pkg"
395 libpng_libsstaticconf=`$PKG_CONFIG --static --libs "$libpng_pkg"`
399 if test "$have_libpng" != no; then
400 # LIBPNG_CFLAGS and LIBPNG_LIBS are set by the user
401 libpng_libspriv="$LIBPNG_LIBS"
402 libpng_libsstaticconf="$LIBPNG_LIBS"
403 have_libpng="yes (LIBPNG_CFLAGS and LIBPNG_LIBS)"
405 # fall back to config script
406 AC_CHECK_PROG(have_libpng, [libpng-config], [yes (libpng-config)], [no])
407 if test "$have_libpng" != no; then
408 LIBPNG_CFLAGS=`libpng-config --cflags`
409 LIBPNG_LIBS=`libpng-config --ldflags`
410 libpng_libspriv=`libpng-config --static --ldflags`
411 libpng_libsstaticconf="$libpng_libspriv"
417 if test x"$with_png" = xyes -a "$have_libpng" = no; then
418 AC_MSG_ERROR([libpng support requested but library not found])
422 # check for system libharfbuzz
424 AC_ARG_WITH([harfbuzz],
425 [AS_HELP_STRING([--with-harfbuzz=@<:@yes|no|auto@:>@],
426 [improve auto-hinting of OpenType fonts @<:@default=auto@:>@])],
427 [], [with_harfbuzz=auto])
430 if test x"$with_harfbuzz" = xyes -o x"$with_harfbuzz" = xauto; then
431 harfbuzz_pkg="harfbuzz >= 2.0.0"
434 if test x"$HARFBUZZ_CFLAGS" = x -a x"$HARFBUZZ_LIBS" = x; then
435 PKG_CHECK_EXISTS([$harfbuzz_pkg], [have_harfbuzz_pkg=yes])
437 PKG_CHECK_MODULES([HARFBUZZ], [$harfbuzz_pkg],
438 [have_harfbuzz="yes (pkg-config)"], [:])
440 if test $have_harfbuzz_pkg = yes; then
441 # we have harfbuzz.pc
442 harfbuzz_reqpriv="$harfbuzz_pkg"
444 harfbuzz_libsstaticconf=`$PKG_CONFIG --static --libs "$harfbuzz_pkg"`
448 if test "$have_harfbuzz" != no; then
449 # HARFBUZZ_CFLAGS and HARFBUZZ_LIBS are set by the user
450 harfbuzz_libspriv="$HARFBUZZ_LIBS"
451 harfbuzz_libsstaticconf="$HARFBUZZ_LIBS"
452 have_harfbuzz="yes (HARFBUZZ_CFLAGS and HARFBUZZ_LIBS)"
454 # since HarfBuzz is quite a new library we don't fall back to a
455 # different test; additionally, it has too many dependencies
461 if test x"$with_harfbuzz" = xyes -a "$have_harfbuzz" = no; then
462 AC_MSG_ERROR([harfbuzz support requested but library not found])
466 # check for system libbrotlidec
468 AC_ARG_WITH([brotli],
469 [AS_HELP_STRING([--with-brotli=@<:@yes|no|auto@:>@],
470 [support decompression of WOFF2 streams @<:@default=auto@:>@])],
471 [], [with_brotli=auto])
474 if test x"$with_brotli" = xyes -o x"$with_brotli" = xauto; then
475 brotli_pkg="libbrotlidec"
478 if test x"$BROTLI_CFLAGS" = x -a x"$BROTLI_LIBS" = x; then
479 PKG_CHECK_EXISTS([$brotli_pkg], [have_brotli_pkg=yes])
481 PKG_CHECK_MODULES([BROTLI], [$brotli_pkg],
482 [have_brotli="yes (pkg-config)"], [:])
484 if test $have_brotli_pkg = yes; then
485 # we have libbrotlidec.pc
486 brotli_reqpriv="$brotli_pkg"
488 brotli_libsstaticconf=`$PKG_CONFIG --static --libs "$brotli_pkg"`
492 if test "$have_brotli" != no; then
493 # BROTLI_CFLAGS and BROTLI_LIBS are set by the user
494 brotli_libspriv="$BROTLI_LIBS"
495 brotli_libsstaticconf="$BROTLI_LIBS"
496 have_brotli="yes (BROTLI_CFLAGS and BROTLI_LIBS)"
498 # since Brotli is quite a new library we don't fall back to a
505 if test x"$with_brotli" = xyes -a "$have_brotli" = no; then
506 AC_MSG_ERROR([brotli support requested but library not found])
510 # Checks for the demo programs.
512 # FreeType doesn't need this. However, since the demo program repository
513 # doesn't come with a `configure` script of its own, we integrate the tests
514 # here for simplicity.
516 # We need `clock_gettime` from 'librt' for the `ftbench` demo program.
518 # The code is modeled after gnulib's file `clock_time.m4`, ignoring
519 # very old Solaris systems.
521 AC_SEARCH_LIBS([clock_gettime],
523 [test "$ac_cv_search_clock_gettime" = "none required" \
524 || LIB_CLOCK_GETTIME=$ac_cv_search_clock_gettime])
527 FT_DEMO_LDFLAGS="$LIB_CLOCK_GETTIME"
529 # 'librsvg' is needed to demonstrate SVG support.
530 AC_ARG_WITH([librsvg],
531 [AS_HELP_STRING([--with-librsvg=@<:@yes|no|auto@:>@],
532 [support OpenType SVG fonts in FreeType demo programs @<:@default=auto@:>@])],
533 [], [with_librsvg=auto])
536 if test x"$with_librsvg" = xyes -o x"$with_librsvg" = xauto; then
537 PKG_CHECK_MODULES([LIBRSVG], [librsvg-2.0 >= 2.46.0],
538 [have_librsvg="yes (pkg-config)"], [:])
540 if test "$have_librsvg" != no; then
541 FT_DEMO_CFLAGS="$FT_DEMO_CFLAGS $LIBRSVG_CFLAGS -DHAVE_LIBRSVG"
542 FT_DEMO_LDFLAGS="$FT_DEMO_LDFLAGS $LIBRSVG_LIBS"
546 if test x"$with_librsvg" = xyes -a "$have_librsvg" = no; then
547 AC_MSG_ERROR([librsvg support requested but library not found])
550 AC_SUBST([FT_DEMO_CFLAGS])
551 AC_SUBST([FT_DEMO_LDFLAGS])
554 # Some options handling SDKs/archs in CFLAGS should be copied
555 # to LDFLAGS. Apple TechNote 2137 recommends to include these
556 # options in CFLAGS but not in LDFLAGS.
566 -isysroot|-arch) # options taking 1 argument
568 AC_MSG_CHECKING([whether CFLAGS and LDFLAGS share ${c} ${a}])
569 if expr " ${LDFLAGS} " : ".* ${c} *${a}.*" > /dev/null
573 AC_MSG_RESULT([no, copy to LDFLAGS])
574 LDFLAGS="${LDFLAGS} ${c} ${a}"
578 -m32|-m64|-march=*|-mcpu=*) # options taking no argument
579 AC_MSG_CHECKING([whether CFLAGS and LDFLAGS share ${c}])
580 if expr " ${LDFLAGS} " : ".* ${c} *${a}.*" > /dev/null
584 AC_MSG_RESULT([no, copy to LDFLAGS])
585 LDFLAGS="${LDFLAGS} ${c}"
589 # AC_MSG_RESULT([${c} is not copied to LDFLAGS])
595 set ${save_config_args}
598 # Whether to use Mac OS resource-based fonts.
600 ftmac_c="" # src/base/ftmac.c should not be included in makefiles by default
602 AC_ARG_WITH([old-mac-fonts],
603 AS_HELP_STRING([--with-old-mac-fonts],
604 [allow Mac resource-based fonts to be used]))
605 if test x$with_old_mac_fonts = xyes; then
606 orig_LDFLAGS="${LDFLAGS}"
607 AC_MSG_CHECKING([CoreServices & ApplicationServices of Mac OS X])
608 ft2_extra_libs="-Wl,-framework,CoreServices -Wl,-framework,ApplicationServices"
609 LDFLAGS="$LDFLAGS $ft2_extra_libs"
613 #if defined(__GNUC__) && defined(__APPLE_CC__)
614 # include <CoreServices/CoreServices.h>
615 # include <ApplicationServices/ApplicationServices.h>
617 # include <ConditionalMacros.h>
632 AC_MSG_CHECKING([whether OS_INLINE macro is ANSI compatible])
633 orig_CFLAGS="$CFLAGS -DFT_MACINTOSH"
634 CFLAGS="$CFLAGS $XX_CFLAGS $XX_ANSIFLAGS"
638 #if defined(__GNUC__) && defined(__APPLE_CC__)
639 # include <CoreServices/CoreServices.h>
640 # include <ApplicationServices/ApplicationServices.h>
642 # include <ConditionalMacros.h>
649 /* OSHostByteOrder() is typed as OS_INLINE */
650 int32_t os_byte_order = OSHostByteOrder();
653 if ( OSBigEndian != os_byte_order )
658 CFLAGS="$orig_CFLAGS"
659 CFLAGS="$CFLAGS -DHAVE_ANSI_OS_INLINE=1"
661 [AC_MSG_RESULT([no, ANSI incompatible])
662 CFLAGS="$orig_CFLAGS"
664 AC_MSG_CHECKING([type ResourceIndex])
665 orig_CFLAGS="$CFLAGS"
666 CFLAGS="$CFLAGS $XX_CFLAGS $XX_ANSIFLAGS"
670 #if defined(__GNUC__) && defined(__APPLE_CC__)
671 # include <CoreServices/CoreServices.h>
672 # include <ApplicationServices/ApplicationServices.h>
674 # include <ConditionalMacros.h>
676 # include <Resources.h>
687 CFLAGS="$orig_CFLAGS"
688 CFLAGS="$CFLAGS -DHAVE_TYPE_RESOURCE_INDEX=1"
691 CFLAGS="$orig_CFLAGS"
692 CFLAGS="$CFLAGS -DHAVE_TYPE_RESOURCE_INDEX=0"
694 [AC_MSG_RESULT([not found])
696 LDFLAGS="${orig_LDFLAGS}"
697 CFLAGS="$CFLAGS -DDARWIN_NO_CARBON"])
701 dnl AC_MSG_WARN([host system is MacOS but configured to build without Carbon])
702 CFLAGS="$CFLAGS -DDARWIN_NO_CARBON"
710 # Whether to use FileManager, which is deprecated since Mac OS X 10.4.
712 AC_ARG_WITH([fsspec],
713 AS_HELP_STRING([--with-fsspec],
714 [use obsolete FSSpec API of MacOS, if available (default=yes)]))
715 if test x$with_fsspec = xno; then
716 CFLAGS="$CFLAGS -DHAVE_FSSPEC=0"
717 elif test x$with_old_mac_fonts = xyes -a x$with_fsspec != x; then
718 AC_MSG_CHECKING([FSSpec-based FileManager])
722 #if defined(__GNUC__) && defined(__APPLE_CC__)
723 # include <CoreServices/CoreServices.h>
724 # include <ApplicationServices/ApplicationServices.h>
726 # include <ConditionalMacros.h>
736 ConstStr255Param fileName;
740 /* FSSpec functions: deprecated since Mac OS X 10.4 */
741 PBGetFCBInfoSync( paramBlock );
742 FSMakeFSSpec( vRefNum, dirID, fileName, spec );
746 CFLAGS="$CFLAGS -DHAVE_FSSPEC=1"],
747 [AC_MSG_RESULT([not found])
748 CFLAGS="$CFLAGS -DHAVE_FSSPEC=0"])
752 # Whether to use FileManager in Carbon since MacOS 9.x.
755 AS_HELP_STRING([--with-fsref],
756 [use Carbon FSRef API of MacOS, if available (default=yes)]))
757 if test x$with_fsref = xno; then
760 FreeType2 built without FSRef API cannot load
761 data-fork fonts on MacOS, except of XXX.dfont.
763 CFLAGS="$CFLAGS -DHAVE_FSREF=0"
764 elif test x$with_old_mac_fonts = xyes -a x$with_fsref != x; then
765 AC_MSG_CHECKING([FSRef-based FileManager])
769 #if defined(__GNUC__) && defined(__APPLE_CC__)
770 # include <CoreServices/CoreServices.h>
771 # include <ApplicationServices/ApplicationServices.h>
773 # include <ConditionalMacros.h>
782 ConstStr255Param fileName;
784 Boolean* isDirectory;
786 SInt16 desiredRefNum;
788 SInt16* actualRefNum;
789 HFSUniStr255* outForkName;
790 FSVolumeRefNum volume;
791 FSCatalogInfoBitmap whichInfo;
792 FSCatalogInfo* catalogInfo;
793 FSForkInfo* forkInfo;
800 /* FSRef functions: no need to check? */
801 FSGetForkCBInfo( desiredRefNum, volume, iterator,
802 actualRefNum, forkInfo, ref,
804 FSPathMakeRef( path, ref, isDirectory );
807 FSpMakeFSRef ( spec, ref );
808 FSGetCatalogInfo( ref, whichInfo, catalogInfo,
809 outForkName, spec, ref );
813 CFLAGS="$CFLAGS -DHAVE_FSREF=1"],
814 [AC_MSG_RESULT([not found])
815 CFLAGS="$CFLAGS -DHAVE_FSREF=0"])
819 # Whether to use QuickDraw API in ToolBox, which is deprecated since
822 AC_ARG_WITH([quickdraw-toolbox],
823 AS_HELP_STRING([--with-quickdraw-toolbox],
824 [use MacOS QuickDraw in ToolBox, if available (default=yes)]))
825 if test x$with_quickdraw_toolbox = xno; then
826 CFLAGS="$CFLAGS -DHAVE_QUICKDRAW_TOOLBOX=0"
827 elif test x$with_old_mac_fonts = xyes -a x$with_quickdraw_toolbox != x; then
828 AC_MSG_CHECKING([QuickDraw FontManager functions in ToolBox])
832 #if defined(__GNUC__) && defined(__APPLE_CC__)
833 # include <CoreServices/CoreServices.h>
834 # include <ApplicationServices/ApplicationServices.h>
836 # include <ConditionalMacros.h>
845 FMInput* fmIn = NULL;
846 FMOutput* fmOut = NULL;
849 GetFontName( familyID, familyName );
850 GetFNum( familyName, &familyID );
851 fmOut = FMSwapFont( fmIn );
855 CFLAGS="$CFLAGS -DHAVE_QUICKDRAW_TOOLBOX=1"],
856 [AC_MSG_RESULT([not found])
857 CFLAGS="$CFLAGS -DHAVE_QUICKDRAW_TOOLBOX=0"])
861 # Whether to use QuickDraw API in Carbon, which is deprecated since
864 AC_ARG_WITH([quickdraw-carbon],
865 AS_HELP_STRING([--with-quickdraw-carbon],
866 [use MacOS QuickDraw in Carbon, if available (default=yes)]))
867 if test x$with_quickdraw_carbon = xno; then
868 CFLAGS="$CFLAGS -DHAVE_QUICKDRAW_CARBON=0"
869 elif test x$with_old_mac_fonts = xyes -a x$with_quickdraw_carbon != x; then
870 AC_MSG_CHECKING([QuickDraw FontManager functions in Carbon])
874 #if defined(__GNUC__) && defined(__APPLE_CC__)
875 # include <CoreServices/CoreServices.h>
876 # include <ApplicationServices/ApplicationServices.h>
878 # include <ConditionalMacros.h>
885 FMFontFamilyIterator famIter;
888 FMFontFamilyInstanceIterator instIter;
895 FMCreateFontFamilyIterator( NULL, NULL, kFMUseGlobalScopeOption,
897 FMGetNextFontFamily( &famIter, &family );
898 FMGetFontFamilyName( family, famNameStr );
899 FMCreateFontFamilyInstanceIterator( family, &instIter );
900 FMGetNextFontFamilyInstance( &instIter, &font, &style, &size );
901 FMDisposeFontFamilyInstanceIterator( &instIter );
902 FMDisposeFontFamilyIterator( &famIter );
903 FMGetFontContainer( font, pathSpec );
907 CFLAGS="$CFLAGS -DHAVE_QUICKDRAW_CARBON=1"],
908 [AC_MSG_RESULT([not found])
909 CFLAGS="$CFLAGS -DHAVE_QUICKDRAW_CARBON=0"])
913 # Whether to use AppleTypeService since Mac OS X.
916 AS_HELP_STRING([--with-ats],
917 [use AppleTypeService, if available (default=yes)]))
918 if test x$with_ats = xno; then
919 CFLAGS="$CFLAGS -DHAVE_ATS=0"
920 elif test x$with_old_mac_fonts = xyes -a x$with_ats != x; then
921 AC_MSG_CHECKING([AppleTypeService functions])
925 #if defined(__GNUC__) && defined(__APPLE_CC__)
926 # include <CoreServices/CoreServices.h>
927 # include <ApplicationServices/ApplicationServices.h>
929 # include <ConditionalMacros.h>
939 ATSFontFindFromName( NULL, kATSOptionFlagsUnRestrictedScope );
941 ATSFontGetFileSpecification( 0, pathSpec );
946 CFLAGS="$CFLAGS -DHAVE_ATS=1"],
947 [AC_MSG_RESULT([not found])
948 CFLAGS="$CFLAGS -DHAVE_ATS=0"])
952 *HAVE_FSSPEC* | *HAVE_FSREF* | *HAVE_QUICKDRAW* | *HAVE_ATS* )
955 FSSpec/FSRef/QuickDraw/ATS options are explicitly given,
956 thus it is recommended to replace src/base/ftmac.c by builds/mac/ftmac.c.
958 CFLAGS="$CFLAGS "'-I$(TOP_DIR)/builds/mac/'
966 AX_PTHREAD([have_pthread=yes], [have_pthread=no])
968 # Check for Python and docwriter
969 PYTHON_MIN_VERSION=3.5
974 AC_CHECK_PROGS([PYTHON], [python3 python], [missing])
975 if test "x$PYTHON" != "xmissing"; then
976 AX_PROG_PYTHON_VERSION([$PYTHON_MIN_VERSION], [have_py3=yes], [])
978 if test "x$have_py3" = "xyes"; then
979 PIP="$PYTHON -m $PIP"
980 AC_MSG_CHECKING([for `docwriter' Python module])
981 $PYTHON -m docwriter -h > /dev/null 2>&1
982 if test "x$?" = "x0"; then
992 # entries in Requires.private are separated by commas
993 PKGCONFIG_REQUIRES_PRIVATE="$zlib_reqpriv, \
999 PKGCONFIG_REQUIRES_PRIVATE=`echo "$PKGCONFIG_REQUIRES_PRIVATE" \
1000 | sed -e 's/^ *//' \
1008 PKGCONFIG_LIBS_PRIVATE="$zlib_libspriv \
1011 $harfbuzz_libspriv \
1015 PKGCONFIG_LIBS_PRIVATE=`echo "$PKGCONFIG_LIBS_PRIVATE" \
1016 | sed -e 's/^ *//' \
1020 LIBSSTATIC_CONFIG="-lfreetype \
1021 $zlib_libsstaticconf \
1022 $bzip2_libsstaticconf \
1023 $libpng_libsstaticconf \
1024 $harfbuzz_libsstaticconf \
1025 $brotli_libsstaticconf \
1027 # remove -L/usr/lib and -L/usr/lib64 since `freetype-config' adds them later
1028 # on if necessary; also beautify
1029 LIBSSTATIC_CONFIG=`echo "$LIBSSTATIC_CONFIG" \
1030 | sed -e 's|-L */usr/lib64/* | |g' \
1031 -e 's|-L */usr/lib/* | |g' \
1036 # If FreeType gets installed with `--disable-shared', don't use
1037 # 'private' fields. `pkg-config' only looks into `.pc' files and is
1038 # completely agnostic to whether shared libraries are actually present
1039 # or not. As a consequence, the user had to specify `--static' while
1040 # calling `pkg-config', which configure scripts are normally not
1044 PKGCONFIG_LIBS='-L${libdir} -lfreetype'
1046 if test $enable_shared = "no"; then
1047 PKGCONFIG_REQUIRES="$PKGCONFIG_REQUIRES $PKGCONFIG_REQUIRES_PRIVATE"
1048 PKGCONFIG_REQUIRES_PRIVATE=
1049 PKGCONFIG_LIBS="$PKGCONFIG_LIBS $PKGCONFIG_LIBS_PRIVATE"
1050 PKGCONFIG_LIBS_PRIVATE=
1054 AC_SUBST([PKGCONFIG_REQUIRES])
1055 AC_SUBST([PKGCONFIG_LIBS])
1056 AC_SUBST([PKGCONFIG_REQUIRES_PRIVATE])
1057 AC_SUBST([PKGCONFIG_LIBS_PRIVATE])
1058 AC_SUBST([LIBSSTATIC_CONFIG])
1060 AC_SUBST([hardcode_libdir_flag_spec])
1062 AC_SUBST([build_libtool_libs])
1065 # changing LDFLAGS value should only be done after
1066 # lt_cv_prog_compiler_static_works test
1070 regexp="-e \\\"s|.*#.*def.*$1.*|#define $1|\\\""
1071 FTOPTION_H_SED="$FTOPTION_H_SED $regexp"
1076 regexp="-e \\\"s|.*#.*def.*$1.*|/* #undef $1 */|\\\""
1077 FTOPTION_H_SED="$FTOPTION_H_SED $regexp"
1080 if test "$have_zlib" != no; then
1081 CFLAGS="$CFLAGS $ZLIB_CFLAGS"
1082 LDFLAGS="$LDFLAGS $ZLIB_LIBS"
1083 ftoption_set FT_CONFIG_OPTION_SYSTEM_ZLIB
1085 ftoption_unset FT_CONFIG_OPTION_SYSTEM_ZLIB
1087 if test "$have_bzip2" != no; then
1088 CFLAGS="$CFLAGS $BZIP2_CFLAGS"
1089 LDFLAGS="$LDFLAGS $BZIP2_LIBS"
1090 ftoption_set FT_CONFIG_OPTION_USE_BZIP2
1092 ftoption_unset FT_CONFIG_OPTION_USE_BZIP2
1094 if test "$have_libpng" != no; then
1095 CFLAGS="$CFLAGS $LIBPNG_CFLAGS"
1096 LDFLAGS="$LDFLAGS $LIBPNG_LIBS"
1097 ftoption_set FT_CONFIG_OPTION_USE_PNG
1099 ftoption_unset FT_CONFIG_OPTION_USE_PNG
1101 if test "$have_harfbuzz" != no; then
1102 CFLAGS="$CFLAGS $HARFBUZZ_CFLAGS"
1103 LDFLAGS="$LDFLAGS $HARFBUZZ_LIBS"
1104 ftoption_set FT_CONFIG_OPTION_USE_HARFBUZZ
1106 ftoption_unset FT_CONFIG_OPTION_USE_HARFBUZZ
1108 if test "$have_brotli" != no; then
1109 CFLAGS="$CFLAGS $BROTLI_CFLAGS"
1110 LDFLAGS="$LDFLAGS $BROTLI_LIBS"
1111 ftoption_set FT_CONFIG_OPTION_USE_BROTLI
1113 ftoption_unset FT_CONFIG_OPTION_USE_BROTLI
1116 if test "$have_pthread" != no; then
1117 CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
1118 LDFLAGS="$LDFLAGS $PTHREAD_CFLAGS $PTHREAD_LIBS"
1124 # We don't want to use a template file for `ftoption.h', since compilation
1125 # should work without calling a configure script also. For this reason, we
1126 # copy the `include/freetype/config/ftoption.h' file to the `unix/builds'
1127 # directory (using a dummy `AC_CONFIG_FILES' call) and apply the just
1128 # constructed $FTOPTION_H_SED regexp (using the post-action of
1129 # `AC_CONFIG_FILES'); this is also the version that gets installed later on.
1131 AC_CONFIG_FILES([ftoption.h:${srcdir}/../../include/freetype/config/ftoption.h],
1132 [mv ftoption.h ftoption.tmp
1133 eval "sed $FTOPTION_H_SED < ftoption.tmp > ftoption.h"
1135 [FTOPTION_H_SED="$FTOPTION_H_SED"])
1137 AC_CONFIG_HEADERS([ftconfig.h])
1139 # create the Unix-specific sub-Makefiles `builds/unix/unix-def.mk'
1140 # and `builds/unix/unix-cc.mk' that will be used by the build system
1142 AC_CONFIG_FILES([unix-cc.mk:unix-cc.in
1143 unix-def.mk:unix-def.in])
1149 Library configuration:
1150 external zlib: $have_zlib
1152 libpng: $have_libpng
1153 harfbuzz: $have_harfbuzz
1154 brotli: $have_brotli
1155 pthread: $have_pthread
1158 # Warn if docwriter is not installed
1160 if test $have_docwriter = no; then
1162 `make refdoc' will fail since pip package `docwriter' is not installed.
1163 To install, run `$PIP install docwriter', or to use a Python
1164 virtual environment, run `make refdoc-venv' (requires pip package
1165 `virtualenv'). These operations require Python >= $PYTHON_MIN_VERSION.
1169 # Warn if pthread is not available
1171 if test $have_pthread = no; then
1173 `FT_DEBUG_LOGGING' will not work since the `pthread' library is not
1174 available. This warning can be safely ignored if you don't plan to use
1175 this configuration macro.
1179 # end of configure.raw