1 # This file is part of the FreeType project.
3 # Process this file with autoconf to produce a configure script.
5 # Copyright 2001-2018 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.in])
18 # Don't forget to update `docs/VERSIONS.TXT'!
20 version_info='22:1:16'
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])
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.in works
114 AC_MSG_CHECKING([whether cpp computation of bit length in ftconfig.in works])
115 orig_CPPFLAGS="${CPPFLAGS}"
116 CPPFLAGS="-I${srcdir} -I. -I${srcdir}/../../include/freetype/config ${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 "ftoption.h"
127 #define FT_CONFIG_STANDARD_LIBRARY_H "ftstdlib.h"
128 #define FT_UINT_MAX UINT_MAX
129 #define FT_ULONG_MAX ULONG_MAX
130 #include "ftconfig.in"
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 AC_MSG_CHECKING([for -fvisibility=hidden compiler flag])
315 orig_CFLAGS="${CFLAGS}"
316 CFLAGS="${CFLAGS} -fvisibility=hidden"
317 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
319 CFLAGS="${orig_CFLAGS}"
323 # All library tests below try `pkg-config' first. If that fails, a function
324 # from the library is tested in the traditional autoconf way (zlib, bzip2),
325 # or a config script is called (libpng).
327 # The `xxx_reqpriv' variables are for the `Requires.private' field in
328 # `freetype2.pc'. The `xxx_libspriv' variables are for the `Libs.private'
329 # field in `freetype2.pc' if pkg-config doesn't find a proper .pc file.
331 # The `xxx_libsstaticconf' variables are for the `freetype-config' script.
333 # Note that a call to PKG_CHECK_MODULES(XXX, ...) sets and creates the
334 # output variables `XXX_CFLAGS' and `XXX_LIBS'. In case one or both are set
335 # for a library by the user, no entry for this library is added to
336 # `Requires.private'. Instead, it gets added to `Libs.private'
339 # check for system zlib
342 [AS_HELP_STRING([--with-zlib=@<:@yes|no|auto@:>@],
343 [use system zlib instead of internal library @<:@default=auto@:>@])],
344 [], [with_zlib=auto])
347 if test x"$with_zlib" = xyes -o x"$with_zlib" = xauto; then
351 if test x"$ZLIB_CFLAGS" = x -a x"$ZLIB_LIBS" = x; then
352 PKG_CHECK_EXISTS([$zlib_pkg], [have_zlib_pkg=yes])
354 PKG_CHECK_MODULES([ZLIB], [$zlib_pkg],
355 [have_zlib="yes (pkg-config)"], [:])
357 if test $have_zlib_pkg = yes; then
359 zlib_reqpriv="$zlib_pkg"
361 zlib_libsstaticconf=`$PKG_CONFIG --static --libs "$zlib_pkg"`
365 if test "$have_zlib" != no; then
366 # ZLIB_CFLAGS and ZLIB_LIBS are set by the user
367 zlib_libspriv="$ZLIB_LIBS"
368 zlib_libsstaticconf="$ZLIB_LIBS"
369 have_zlib="yes (ZLIB_CFLAGS and ZLIB_LIBS)"
371 # fall back to standard autoconf test
374 [AC_CHECK_HEADER([zlib.h],
375 [have_zlib="yes (autoconf test)"
377 zlib_libsstaticconf="$zlib_libspriv"
378 ZLIB_LIBS="$zlib_libspriv"])])
383 if test x"$with_zlib" = xyes -a "$have_zlib" = no; then
384 AC_MSG_ERROR([external zlib support requested but library not found])
388 # check for system libbz2
391 [AS_HELP_STRING([--with-bzip2=@<:@yes|no|auto@:>@],
392 [support bzip2 compressed fonts @<:@default=auto@:>@])],
393 [], [with_bzip2=auto])
396 if test x"$with_bzip2" = xyes -o x"$with_bzip2" = xauto; then
400 if test x"$BZIP2_CFLAGS" = x -a x"$BZIP2_LIBS" = x; then
401 PKG_CHECK_EXISTS([$bzip2_pkg], [have_bzip2_pkg=yes])
403 PKG_CHECK_MODULES([BZIP2], [$bzip2_pkg],
404 [have_bzip2="yes (pkg-config)"], [:])
406 if test $have_bzip2_pkg = yes; then
408 bzip2_reqpriv="$bzip2_pkg"
410 bzip2_libsstaticconf=`$PKG_CONFIG --static --libs "$bzip2_pkg"`
414 if test "$have_bzip2" != no; then
415 # BZIP2_CFLAGS and BZIP2_LIBS are set by the user
416 bzip2_libspriv="$BZIP2_LIBS"
417 bzip2_libsstaticconf="$BZIP2_LIBS"
418 have_bzip2="yes (BZIP2_CFLAGS and BZIP2_LIBS)"
420 # fall back to standard autoconf test
423 [AC_CHECK_HEADER([bzlib.h],
424 [have_bzip2="yes (autoconf test)"
425 bzip2_libspriv="-lbz2"
426 bzip2_libsstaticconf="$bzip2_libspriv"
427 BZIP2_LIBS="$bzip2_libspriv"])])
432 if test x"$with_bzip2" = xyes -a "$have_bzip2" = no; then
433 AC_MSG_ERROR([bzip2 support requested but library not found])
437 # check for system libpng
440 [AS_HELP_STRING([--with-png=@<:@yes|no|auto@:>@],
441 [support png compressed OpenType embedded bitmaps @<:@default=auto@:>@])],
445 if test x"$with_png" = xyes -o x"$with_png" = xauto; then
449 if test x"$LIBPNG_CFLAGS" = x -a x"$LIBPNG_LIBS" = x; then
450 PKG_CHECK_EXISTS([$libpng_pkg], [have_libpng_pkg=yes])
452 PKG_CHECK_MODULES([LIBPNG], [$libpng_pkg],
453 [have_libpng="yes (pkg-config)"], [:])
455 if test $have_libpng_pkg = yes; then
457 libpng_reqpriv="$libpng_pkg"
459 libpng_libsstaticconf=`$PKG_CONFIG --static --libs "$libpng_pkg"`
463 if test "$have_libpng" != no; then
464 # LIBPNG_CFLAGS and LIBPNG_LIBS are set by the user
465 libpng_libspriv="$LIBPNG_LIBS"
466 libpng_libsstaticconf="$LIBPNG_LIBS"
467 have_libpng="yes (LIBPNG_CFLAGS and LIBPNG_LIBS)"
469 # fall back to config script.
470 AC_MSG_CHECKING([for libpng-config])
471 if which libpng-config > /dev/null 2>&1; then
472 LIBPNG_CFLAGS=`libpng-config --cflags`
473 LIBPNG_LIBS=`libpng-config --ldflags`
474 libpng_libspriv=`libpng-config --static --ldflags`
475 libpng_libsstaticconf="$libpng_libspriv"
476 have_libpng="yes (libpng-config)"
485 if test x"$with_png" = xyes -a "$have_libpng" = no; then
486 AC_MSG_ERROR([libpng support requested but library not found])
490 # check for system libharfbuzz
492 AC_ARG_WITH([harfbuzz],
493 [AS_HELP_STRING([--with-harfbuzz=@<:@yes|no|auto@:>@],
494 [improve auto-hinting of OpenType fonts @<:@default=auto@:>@])],
495 [], [with_harfbuzz=auto])
498 if test x"$with_harfbuzz" = xyes -o x"$with_harfbuzz" = xauto; then
499 harfbuzz_pkg="harfbuzz >= 1.3.0"
502 if test x"$HARFBUZZ_CFLAGS" = x -a x"$HARFBUZZ_LIBS" = x; then
503 PKG_CHECK_EXISTS([$harfbuzz_pkg], [have_harfbuzz_pkg=yes])
505 PKG_CHECK_MODULES([HARFBUZZ], [$harfbuzz_pkg],
506 [have_harfbuzz="yes (pkg-config)"], [:])
508 if test $have_harfbuzz_pkg = yes; then
509 # we have harfbuzz.pc
510 harfbuzz_reqpriv="$harfbuzz_pkg"
512 harfbuzz_libsstaticconf=`$PKG_CONFIG --static --libs "$harfbuzz_pkg"`
516 if test "$have_harfbuzz" != no; then
517 # HARFBUZZ_CFLAGS and HARFBUZZ_LIBS are set by the user
518 harfbuzz_libspriv="$HARFBUZZ_LIBS"
519 harfbuzz_libsstaticconf="$HARFBUZZ_LIBS"
520 have_harfbuzz="yes (HARFBUZZ_CFLAGS and HARFBUZZ_LIBS)"
522 # since HarfBuzz is quite a new library we don't fall back to a
523 # different test; additionally, it has too many dependencies
529 if test x"$with_harfbuzz" = xyes -a "$have_harfbuzz" = no; then
530 AC_MSG_ERROR([harfbuzz support requested but library not found])
536 # We need `clock_gettime' for the `ftbench' demo program.
538 # The code is modeled after gnulib's file `clock_time.m4', ignoring
539 # very old Solaris systems.
542 AC_SEARCH_LIBS([clock_gettime],
544 [test "$ac_cv_search_clock_gettime" = "none required" \
545 || LIB_CLOCK_GETTIME=$ac_cv_search_clock_gettime])
546 AC_SUBST([LIB_CLOCK_GETTIME])
549 # Some options handling SDKs/archs in CFLAGS should be copied
550 # to LDFLAGS. Apple TechNote 2137 recommends to include these
551 # options in CFLAGS but not in LDFLAGS.
561 -isysroot|-arch) # options taking 1 argument
563 AC_MSG_CHECKING([whether CFLAGS and LDFLAGS share ${c} ${a}])
564 if expr " ${LDFLAGS} " : ".* ${c} *${a}.*" > /dev/null
568 AC_MSG_RESULT([no, copy to LDFLAGS])
569 LDFLAGS="${LDFLAGS} ${c} ${a}"
573 -m32|-m64|-march=*|-mcpu=*) # options taking no argument
574 AC_MSG_CHECKING([whether CFLAGS and LDFLAGS share ${c}])
575 if expr " ${LDFLAGS} " : ".* ${c} *${a}.*" > /dev/null
579 AC_MSG_RESULT([no, copy to LDFLAGS])
580 LDFLAGS="${LDFLAGS} ${c}"
584 # AC_MSG_RESULT([${c} is not copied to LDFLAGS])
590 set ${save_config_args}
593 # Whether to use Mac OS resource-based fonts.
595 ftmac_c="" # src/base/ftmac.c should not be included in makefiles by default
597 AC_ARG_WITH([old-mac-fonts],
598 AS_HELP_STRING([--with-old-mac-fonts],
599 [allow Mac resource-based fonts to be used]))
600 if test x$with_old_mac_fonts = xyes; then
601 orig_LDFLAGS="${LDFLAGS}"
602 AC_MSG_CHECKING([CoreServices & ApplicationServices of Mac OS X])
603 ft2_extra_libs="-Wl,-framework,CoreServices -Wl,-framework,ApplicationServices"
604 LDFLAGS="$LDFLAGS $ft2_extra_libs"
608 #if defined(__GNUC__) && defined(__APPLE_CC__)
609 # include <CoreServices/CoreServices.h>
610 # include <ApplicationServices/ApplicationServices.h>
612 # include <ConditionalMacros.h>
627 AC_MSG_CHECKING([whether OS_INLINE macro is ANSI compatible])
628 orig_CFLAGS="$CFLAGS -DFT_MACINTOSH"
629 CFLAGS="$CFLAGS $XX_CFLAGS $XX_ANSIFLAGS"
633 #if defined(__GNUC__) && defined(__APPLE_CC__)
634 # include <CoreServices/CoreServices.h>
635 # include <ApplicationServices/ApplicationServices.h>
637 # include <ConditionalMacros.h>
644 /* OSHostByteOrder() is typed as OS_INLINE */
645 int32_t os_byte_order = OSHostByteOrder();
648 if ( OSBigEndian != os_byte_order )
653 CFLAGS="$orig_CFLAGS"
654 CFLAGS="$CFLAGS -DHAVE_ANSI_OS_INLINE=1"
656 [AC_MSG_RESULT([no, ANSI incompatible])
657 CFLAGS="$orig_CFLAGS"
659 AC_MSG_CHECKING([type ResourceIndex])
660 orig_CFLAGS="$CFLAGS"
661 CFLAGS="$CFLAGS $XX_CFLAGS $XX_ANSIFLAGS"
665 #if defined(__GNUC__) && defined(__APPLE_CC__)
666 # include <CoreServices/CoreServices.h>
667 # include <ApplicationServices/ApplicationServices.h>
669 # include <ConditionalMacros.h>
671 # include <Resources.h>
682 CFLAGS="$orig_CFLAGS"
683 CFLAGS="$CFLAGS -DHAVE_TYPE_RESOURCE_INDEX=1"
686 CFLAGS="$orig_CFLAGS"
687 CFLAGS="$CFLAGS -DHAVE_TYPE_RESOURCE_INDEX=0"
689 [AC_MSG_RESULT([not found])
691 LDFLAGS="${orig_LDFLAGS}"
692 CFLAGS="$CFLAGS -DDARWIN_NO_CARBON"])
696 dnl AC_MSG_WARN([host system is MacOS but configured to build without Carbon])
697 CFLAGS="$CFLAGS -DDARWIN_NO_CARBON"
705 # Whether to use FileManager, which is deprecated since Mac OS X 10.4.
707 AC_ARG_WITH([fsspec],
708 AS_HELP_STRING([--with-fsspec],
709 [use obsolete FSSpec API of MacOS, if available (default=yes)]))
710 if test x$with_fsspec = xno; then
711 CFLAGS="$CFLAGS -DHAVE_FSSPEC=0"
712 elif test x$with_old_mac_fonts = xyes -a x$with_fsspec != x; then
713 AC_MSG_CHECKING([FSSpec-based FileManager])
717 #if defined(__GNUC__) && defined(__APPLE_CC__)
718 # include <CoreServices/CoreServices.h>
719 # include <ApplicationServices/ApplicationServices.h>
721 # include <ConditionalMacros.h>
731 ConstStr255Param fileName;
735 /* FSSpec functions: deprecated since Mac OS X 10.4 */
736 PBGetFCBInfoSync( paramBlock );
737 FSMakeFSSpec( vRefNum, dirID, fileName, spec );
741 CFLAGS="$CFLAGS -DHAVE_FSSPEC=1"],
742 [AC_MSG_RESULT([not found])
743 CFLAGS="$CFLAGS -DHAVE_FSSPEC=0"])
747 # Whether to use FileManager in Carbon since MacOS 9.x.
750 AS_HELP_STRING([--with-fsref],
751 [use Carbon FSRef API of MacOS, if available (default=yes)]))
752 if test x$with_fsref = xno; then
755 FreeType2 built without FSRef API cannot load
756 data-fork fonts on MacOS, except of XXX.dfont.
758 CFLAGS="$CFLAGS -DHAVE_FSREF=0"
759 elif test x$with_old_mac_fonts = xyes -a x$with_fsref != x; then
760 AC_MSG_CHECKING([FSRef-based FileManager])
764 #if defined(__GNUC__) && defined(__APPLE_CC__)
765 # include <CoreServices/CoreServices.h>
766 # include <ApplicationServices/ApplicationServices.h>
768 # include <ConditionalMacros.h>
777 ConstStr255Param fileName;
779 Boolean* isDirectory;
781 SInt16 desiredRefNum;
783 SInt16* actualRefNum;
784 HFSUniStr255* outForkName;
785 FSVolumeRefNum volume;
786 FSCatalogInfoBitmap whichInfo;
787 FSCatalogInfo* catalogInfo;
788 FSForkInfo* forkInfo;
795 /* FSRef functions: no need to check? */
796 FSGetForkCBInfo( desiredRefNum, volume, iterator,
797 actualRefNum, forkInfo, ref,
799 FSPathMakeRef( path, ref, isDirectory );
802 FSpMakeFSRef ( spec, ref );
803 FSGetCatalogInfo( ref, whichInfo, catalogInfo,
804 outForkName, spec, ref );
808 CFLAGS="$CFLAGS -DHAVE_FSREF=1"],
809 [AC_MSG_RESULT([not found])
810 CFLAGS="$CFLAGS -DHAVE_FSREF=0"])
814 # Whether to use QuickDraw API in ToolBox, which is deprecated since
817 AC_ARG_WITH([quickdraw-toolbox],
818 AS_HELP_STRING([--with-quickdraw-toolbox],
819 [use MacOS QuickDraw in ToolBox, if available (default=yes)]))
820 if test x$with_quickdraw_toolbox = xno; then
821 CFLAGS="$CFLAGS -DHAVE_QUICKDRAW_TOOLBOX=0"
822 elif test x$with_old_mac_fonts = xyes -a x$with_quickdraw_toolbox != x; then
823 AC_MSG_CHECKING([QuickDraw FontManager functions in ToolBox])
827 #if defined(__GNUC__) && defined(__APPLE_CC__)
828 # include <CoreServices/CoreServices.h>
829 # include <ApplicationServices/ApplicationServices.h>
831 # include <ConditionalMacros.h>
840 FMInput* fmIn = NULL;
841 FMOutput* fmOut = NULL;
844 GetFontName( familyID, familyName );
845 GetFNum( familyName, &familyID );
846 fmOut = FMSwapFont( fmIn );
850 CFLAGS="$CFLAGS -DHAVE_QUICKDRAW_TOOLBOX=1"],
851 [AC_MSG_RESULT([not found])
852 CFLAGS="$CFLAGS -DHAVE_QUICKDRAW_TOOLBOX=0"])
856 # Whether to use QuickDraw API in Carbon, which is deprecated since
859 AC_ARG_WITH([quickdraw-carbon],
860 AS_HELP_STRING([--with-quickdraw-carbon],
861 [use MacOS QuickDraw in Carbon, if available (default=yes)]))
862 if test x$with_quickdraw_carbon = xno; then
863 CFLAGS="$CFLAGS -DHAVE_QUICKDRAW_CARBON=0"
864 elif test x$with_old_mac_fonts = xyes -a x$with_quickdraw_carbon != x; then
865 AC_MSG_CHECKING([QuickDraw FontManager functions in Carbon])
869 #if defined(__GNUC__) && defined(__APPLE_CC__)
870 # include <CoreServices/CoreServices.h>
871 # include <ApplicationServices/ApplicationServices.h>
873 # include <ConditionalMacros.h>
880 FMFontFamilyIterator famIter;
883 FMFontFamilyInstanceIterator instIter;
890 FMCreateFontFamilyIterator( NULL, NULL, kFMUseGlobalScopeOption,
892 FMGetNextFontFamily( &famIter, &family );
893 FMGetFontFamilyName( family, famNameStr );
894 FMCreateFontFamilyInstanceIterator( family, &instIter );
895 FMGetNextFontFamilyInstance( &instIter, &font, &style, &size );
896 FMDisposeFontFamilyInstanceIterator( &instIter );
897 FMDisposeFontFamilyIterator( &famIter );
898 FMGetFontContainer( font, pathSpec );
902 CFLAGS="$CFLAGS -DHAVE_QUICKDRAW_CARBON=1"],
903 [AC_MSG_RESULT([not found])
904 CFLAGS="$CFLAGS -DHAVE_QUICKDRAW_CARBON=0"])
908 # Whether to use AppleTypeService since Mac OS X.
911 AS_HELP_STRING([--with-ats],
912 [use AppleTypeService, if available (default=yes)]))
913 if test x$with_ats = xno; then
914 CFLAGS="$CFLAGS -DHAVE_ATS=0"
915 elif test x$with_old_mac_fonts = xyes -a x$with_ats != x; then
916 AC_MSG_CHECKING([AppleTypeService functions])
920 #if defined(__GNUC__) && defined(__APPLE_CC__)
921 # include <CoreServices/CoreServices.h>
922 # include <ApplicationServices/ApplicationServices.h>
924 # include <ConditionalMacros.h>
934 ATSFontFindFromName( NULL, kATSOptionFlagsUnRestrictedScope );
936 ATSFontGetFileSpecification( 0, pathSpec );
941 CFLAGS="$CFLAGS -DHAVE_ATS=1"],
942 [AC_MSG_RESULT([not found])
943 CFLAGS="$CFLAGS -DHAVE_ATS=0"])
947 *HAVE_FSSPEC* | *HAVE_FSREF* | *HAVE_QUICKDRAW* | *HAVE_ATS* )
950 FSSpec/FSRef/QuickDraw/ATS options are explicitly given,
951 thus it is recommended to replace src/base/ftmac.c by builds/mac/ftmac.c.
953 CFLAGS="$CFLAGS "'-I$(TOP_DIR)/builds/mac/'
960 # entries in Requires.private are separated by commas;
961 REQUIRES_PRIVATE="$zlib_reqpriv, \
966 REQUIRES_PRIVATE=`echo "$REQUIRES_PRIVATE" \
975 LIBS_PRIVATE="$zlib_libspriv \
981 LIBS_PRIVATE=`echo "$LIBS_PRIVATE" \
986 LIBSSTATIC_CONFIG="-lfreetype \
987 $zlib_libsstaticconf \
988 $bzip2_libsstaticconf \
989 $libpng_libsstaticconf \
990 $harfbuzz_libsstaticconf \
992 # remove -L/usr/lib and -L/usr/lib64 since `freetype-config' adds them later
993 # on if necessary; also beautify
994 LIBSSTATIC_CONFIG=`echo "$LIBSSTATIC_CONFIG" \
995 | sed -e 's|-L */usr/lib64/* | |g' \
996 -e 's|-L */usr/lib/* | |g' \
1003 AC_SUBST([REQUIRES_PRIVATE])
1004 AC_SUBST([LIBS_PRIVATE])
1005 AC_SUBST([LIBSSTATIC_CONFIG])
1007 AC_SUBST([hardcode_libdir_flag_spec])
1009 AC_SUBST([build_libtool_libs])
1012 # changing LDFLAGS value should only be done after
1013 # lt_cv_prog_compiler_static_works test
1017 regexp="-e \\\"s|.*#.*def.*$1.*|#define $1|\\\""
1018 FTOPTION_H_SED="$FTOPTION_H_SED $regexp"
1023 regexp="-e \\\"s|.*#.*def.*$1.*|/* #undef $1 */|\\\""
1024 FTOPTION_H_SED="$FTOPTION_H_SED $regexp"
1027 if test "$have_zlib" != no; then
1028 CFLAGS="$CFLAGS $ZLIB_CFLAGS"
1029 LDFLAGS="$LDFLAGS $ZLIB_LIBS"
1030 ftoption_set FT_CONFIG_OPTION_SYSTEM_ZLIB
1032 ftoption_unset FT_CONFIG_OPTION_SYSTEM_ZLIB
1034 if test "$have_bzip2" != no; then
1035 CFLAGS="$CFLAGS $BZIP2_CFLAGS"
1036 LDFLAGS="$LDFLAGS $BZIP2_LIBS"
1037 ftoption_set FT_CONFIG_OPTION_USE_BZIP2
1039 ftoption_unset FT_CONFIG_OPTION_USE_BZIP2
1041 if test "$have_libpng" != no; then
1042 CFLAGS="$CFLAGS $LIBPNG_CFLAGS"
1043 LDFLAGS="$LDFLAGS $LIBPNG_LIBS"
1044 ftoption_set FT_CONFIG_OPTION_USE_PNG
1046 ftoption_unset FT_CONFIG_OPTION_USE_PNG
1048 if test "$have_harfbuzz" != no; then
1049 CFLAGS="$CFLAGS $HARFBUZZ_CFLAGS"
1050 LDFLAGS="$LDFLAGS $HARFBUZZ_LIBS"
1051 ftoption_set FT_CONFIG_OPTION_USE_HARFBUZZ
1053 ftoption_unset FT_CONFIG_OPTION_USE_HARFBUZZ
1059 # We don't want to use a template file for `ftoption.h', since compilation
1060 # should work without calling a configure script also. For this reason, we
1061 # copy the `include/freetype/config/ftoption.h' file to the `unix/builds'
1062 # directory (using a dummy `AC_CONFIG_FILES' call) and apply the just
1063 # constructed $FTOPTION_H_SED regexp (using the post-action of
1064 # `AC_CONFIG_FILES'); this is also the version that gets installed later on.
1066 AC_CONFIG_FILES([ftoption.h:${srcdir}/../../include/freetype/config/ftoption.h],
1067 [mv ftoption.h ftoption.tmp
1068 eval "sed $FTOPTION_H_SED < ftoption.tmp > ftoption.h"
1070 [FTOPTION_H_SED="$FTOPTION_H_SED"])
1072 # configuration file -- stay in 8.3 limit
1074 # since #undef doesn't survive in configuration header files we replace
1075 # `/undef' with `#undef' after creating the output file
1077 AC_CONFIG_HEADERS([ftconfig.h:ftconfig.in],
1078 [mv ftconfig.h ftconfig.tmp
1079 sed 's|/undef|#undef|' < ftconfig.tmp > ftconfig.h
1082 # create the Unix-specific sub-Makefiles `builds/unix/unix-def.mk'
1083 # and `builds/unix/unix-cc.mk' that will be used by the build system
1085 AC_CONFIG_FILES([unix-cc.mk:unix-cc.in
1086 unix-def.mk:unix-def.in])
1088 # re-generate the Jamfile to use libtool now
1090 # AC_CONFIG_FILES([../../Jamfile:../../Jamfile.in])
1096 Library configuration:
1097 external zlib: $have_zlib
1099 libpng: $have_libpng
1100 harfbuzz: $have_harfbuzz
1103 # end of configure.raw