1 # This file is part of the FreeType project.
3 # Process this file with autoconf to produce a configure script.
5 # Copyright 2001-2012 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.4.9], [freetype@nongnu.org], [freetype])
15 AC_CONFIG_SRCDIR([ftconfig.in])
18 # Don't forget to update docs/VERSION.DLL!
21 AC_SUBST([version_info])
22 ft_version=`echo $version_info | tr : .`
23 AC_SUBST([ft_version])
26 # checks for system type
38 # checks for native programs to generate building tool
40 if test ${cross_compiling} = yes; then
41 AC_CHECK_PROG(CC_BUILD, ${build}-gcc, ${build}-gcc)
42 test -z "${CC_BUILD}" && AC_CHECK_PROG(CC_BUILD, gcc, gcc)
43 test -z "${CC_BUILD}" && AC_CHECK_PROG(CC_BUILD, cc, cc, , , /usr/ucb/cc)
44 test -z "${CC_BUILD}" && AC_MSG_ERROR([cannot find native C compiler])
46 AC_MSG_CHECKING([for suffix of native executables])
47 rm -f a.* b.* a_out.exe conftest.*
48 echo > conftest.c "int main() { return 0;}"
49 ${CC_BUILD} conftest.c || AC_MSG_ERROR([native C compiler is not working])
51 if test -x a.out -o -x b.out -o -x conftest; then
53 elif test -x a_out.exe -o -x conftest.exe; then
55 elif test -x conftest.*; then
56 EXEEXT_BUILD=`echo conftest.* | sed -n '1s/^.*\././'`
58 rm -f a.* b.* a_out.exe conftest.*
59 AC_MSG_RESULT($EXEEXT_BUILD)
62 EXEEXT_BUILD=${EXEEXT}
66 AC_SUBST(EXEEXT_BUILD)
70 # get compiler flags right
72 if test "x$GCC" = xyes; then
74 XX_ANSIFLAGS="-pedantic -ansi"
89 AC_SUBST([XX_ANSIFLAGS])
94 AC_CHECK_PROG([RMF], [rm], [rm -f])
95 AC_CHECK_PROG([RMDIR], [rmdir], [rmdir])
98 # Since this file will be finally moved to another directory we make
99 # the path of the install script absolute. This small code snippet has
100 # been taken from automake's `ylwrap' script.
107 INSTALL="`pwd`/$INSTALL"
112 # checks for header files
115 AC_CHECK_HEADERS([fcntl.h unistd.h])
118 # checks for typedefs, structures, and compiler characteristics
121 AC_CHECK_SIZEOF([int])
122 AC_CHECK_SIZEOF([long])
125 # check whether cpp computation of size of int and long in ftconfig.in works
127 AC_MSG_CHECKING([whether cpp computation of bit length in ftconfig.in works])
128 orig_CPPFLAGS="${CPPFLAGS}"
129 CPPFLAGS="-I${srcdir} -I. ${CPPFLAGS}"
130 ac_clean_files="ft2build.h ftoption.h ftstdlib.h"
131 touch ft2build.h ftoption.h ftstdlib.h
133 cat > conftest.c <<\_ACEOF
135 #define FT_CONFIG_OPTIONS_H "ftoption.h"
136 #define FT_CONFIG_STANDARD_LIBRARY_H "ftstdlib.h"
137 #define FT_UINT_MAX UINT_MAX
138 #define FT_ULONG_MAX ULONG_MAX
139 #include "ftconfig.in"
141 echo >> conftest.c "#if FT_SIZEOF_INT == "${ac_cv_sizeof_int}
142 echo >> conftest.c "ac_cpp_ft_sizeof_int="${ac_cv_sizeof_int}
143 echo >> conftest.c "#endif"
144 echo >> conftest.c "#if FT_SIZEOF_LONG == "${ac_cv_sizeof_long}
145 echo >> conftest.c "ac_cpp_ft_sizeof_long="${ac_cv_sizeof_long}
146 echo >> conftest.c "#endif"
148 ${CPP} ${CPPFLAGS} conftest.c | ${GREP} ac_cpp_ft > conftest.sh
149 eval `cat conftest.sh`
150 ${RMF} conftest.c conftest.sh confft2build.h ftoption.h ftstdlib.h
152 if test x != "x${ac_cpp_ft_sizeof_int}" \
153 -a x != x"${ac_cpp_ft_sizeof_long}"; then
154 unset ft_use_autoconf_sizeof_types
156 ft_use_autoconf_sizeof_types=yes
159 AC_ARG_ENABLE(biarch-config,
160 [ --enable-biarch-config install biarch ftconfig.h to support multiple
161 architectures by single file], [], [])
163 case :${ft_use_autoconf_sizeof_types}:${enable_biarch_config}: in
165 AC_MSG_RESULT([broken but use it])
166 unset ft_use_autoconf_sizeof_types
169 AC_MSG_RESULT([works but ignore it])
170 ft_use_autoconf_sizeof_types=yes
174 unset ft_use_autoconf_sizeof_types
178 ft_use_autoconf_sizeof_types=yes
182 if test x"${ft_use_autoconf_sizeof_types}" = xyes; then
183 AC_DEFINE([FT_USE_AUTOCONF_SIZEOF_TYPES])
186 CPPFLAGS="${orig_CPPFLAGS}"
189 # checks for library functions
191 # Here we check whether we can use our mmap file component.
193 AC_ARG_ENABLE([mmap],
194 AS_HELP_STRING([--disable-mmap],
195 [do not check mmap() and do not use]),
196 [enable_mmap="no"],[enable_mmap="yes"])
197 if test "x${enable_mmap}" != "xno"; then
200 if test "x${enable_mmap}" = "xno" \
201 -o "$ac_cv_func_mmap_fixed_mapped" != "yes"; then
202 FTSYS_SRC='$(BASE_DIR)/ftsystem.c'
204 FTSYS_SRC='$(BUILD_DIR)/ftsystem.c'
206 AC_CHECK_DECLS([munmap],
214 #include <sys/mman.h>
220 AC_SUBST([FTSYS_SRC])
222 AC_CHECK_FUNCS([memcpy memmove])
225 # check for system zlib
227 # don't quote AS_HELP_STRING!
229 AS_HELP_STRING([--without-zlib],
230 [use internal zlib instead of system-wide]))
231 if test x$with_zlib != xno && test -z "$LIBZ"; then
232 AC_CHECK_LIB([z], [gzsetparams], [AC_CHECK_HEADER([zlib.h], [LIBZ='-lz'])])
234 if test x$with_zlib != xno && test -n "$LIBZ"; then
235 CFLAGS="$CFLAGS -DFT_CONFIG_OPTION_SYSTEM_ZLIB"
236 LDFLAGS="$LDFLAGS $LIBZ"
240 # check for system libbz2
242 # don't quote AS_HELP_STRING!
244 AS_HELP_STRING([--without-bzip2],
245 [do not support bzip2 compressed fonts]))
246 if test x$with_bzip2 != xno && test -z "$LIBBZ2"; then
247 AC_CHECK_LIB([bz2], [BZ2_bzDecompress], [AC_CHECK_HEADER([bzlib.h], [LIBBZ2='-lbz2'])])
249 if test x$with_bzip2 != xno && test -n "$LIBBZ2"; then
250 CFLAGS="$CFLAGS -DFT_CONFIG_OPTION_USE_BZIP2"
251 LDFLAGS="$LDFLAGS $LIBBZ2"
254 # Some options handling SDKs/archs in CFLAGS should be copied
255 # to LDFLAGS. Apple TechNote 2137 recommends to include these
256 # options in CFLAGS but not in LDFLAGS.
266 -isysroot|-arch) # options taking 1 argument
268 AC_MSG_CHECKING([whether CFLAGS and LDFLAGS share ${c} ${a}])
269 if expr " ${LDFLAGS} " : ".* ${c} *${a}.*" > /dev/null
273 AC_MSG_RESULT([no, copy to LDFLAGS])
274 LDFLAGS="${LDFLAGS} ${c} ${a}"
278 -m32|-m64|-march=*|-mcpu=*) # options taking no argument
279 AC_MSG_RESULT([whether CFLAGS and LDFLAGS share ${c}])
280 if expr " ${LDFLAGS} " : ".* ${c} *${a}.*" > /dev/null
284 AC_MSG_RESULT([no, copy to LDFLAGS])
285 LDFLAGS="${LDFLAGS} ${c}"
289 # AC_MSG_RESULT([${c} is not copied to LDFLAGS])
295 set ${save_config_args}
298 # Whether to use Mac OS resource-based fonts.
300 ftmac_c="" # src/base/ftmac.c should not be included in makefiles by default
302 # don't quote AS_HELP_STRING!
303 AC_ARG_WITH([old-mac-fonts],
304 AS_HELP_STRING([--with-old-mac-fonts],
305 [allow Mac resource-based fonts to be used]))
306 if test x$with_old_mac_fonts = xyes; then
307 orig_LDFLAGS="${LDFLAGS}"
308 AC_MSG_CHECKING([CoreServices & ApplicationServices of Mac OS X])
309 FT2_EXTRA_LIBS="-Wl,-framework,CoreServices -Wl,-framework,ApplicationServices"
310 LDFLAGS="$LDFLAGS $FT2_EXTRA_LIBS"
314 #if defined(__GNUC__) && defined(__APPLE_CC__)
315 # include <CoreServices/CoreServices.h>
316 # include <ApplicationServices/ApplicationServices.h>
318 # include <ConditionalMacros.h>
333 AC_MSG_CHECKING([whether OS_INLINE macro is ANSI compatible])
334 orig_CFLAGS="$CFLAGS -DFT_MACINTOSH"
335 CFLAGS="$CFLAGS $XX_CFLAGS $XX_ANSIFLAGS"
339 #if defined(__GNUC__) && defined(__APPLE_CC__)
340 # include <CoreServices/CoreServices.h>
341 # include <ApplicationServices/ApplicationServices.h>
343 # include <ConditionalMacros.h>
350 /* OSHostByteOrder() is typed as OS_INLINE */
351 int32_t os_byte_order = OSHostByteOrder();
354 if ( OSBigEndian != os_byte_order )
359 CFLAGS="$orig_CFLAGS"
360 CFLAGS="$CFLAGS -DHAVE_ANSI_OS_INLINE=1"
362 [AC_MSG_RESULT([no, ANSI incompatible])
363 CFLAGS="$orig_CFLAGS"
365 AC_MSG_CHECKING([type ResourceIndex])
366 orig_CFLAGS="$CFLAGS"
367 CFLAGS="$CFLAGS $XX_CFLAGS $XX_ANSIFLAGS"
371 #if defined(__GNUC__) && defined(__APPLE_CC__)
372 # include <CoreServices/CoreServices.h>
373 # include <ApplicationServices/ApplicationServices.h>
375 # include <ConditionalMacros.h>
377 # include <Resources.h>
388 CFLAGS="$orig_CFLAGS"
389 CFLAGS="$CFLAGS -DHAVE_TYPE_RESOURCE_INDEX=1"
392 CFLAGS="$orig_CFLAGS"
393 CFLAGS="$CFLAGS -DHAVE_TYPE_RESOURCE_INDEX=0"
395 [AC_MSG_RESULT([not found])
397 LDFLAGS="${orig_LDFLAGS}"
398 CFLAGS="$CFLAGS -DDARWIN_NO_CARBON"])
402 dnl AC_MSG_WARN([host system is MacOS but configured to build without Carbon])
403 CFLAGS="$CFLAGS -DDARWIN_NO_CARBON"
411 # Whether to use FileManager which is deprecated since Mac OS X 10.4.
413 AC_ARG_WITH([fsspec],
414 AS_HELP_STRING([--with-fsspec],
415 [use obsolete FSSpec API of MacOS, if available (default=yes)]))
416 if test x$with_fsspec = xno; then
417 CFLAGS="$CFLAGS -DHAVE_FSSPEC=0"
418 elif test x$with_old_mac_fonts = xyes -a x$with_fsspec != x; then
419 AC_MSG_CHECKING([FSSpec-based FileManager])
423 #if defined(__GNUC__) && defined(__APPLE_CC__)
424 # include <CoreServices/CoreServices.h>
425 # include <ApplicationServices/ApplicationServices.h>
427 # include <ConditionalMacros.h>
437 ConstStr255Param fileName;
441 /* FSSpec functions: deprecated since Mac OS X 10.4 */
442 PBGetFCBInfoSync( paramBlock );
443 FSMakeFSSpec( vRefNum, dirID, fileName, spec );
447 CFLAGS="$CFLAGS -DHAVE_FSSPEC=1"],
448 [AC_MSG_RESULT([not found])
449 CFLAGS="$CFLAGS -DHAVE_FSSPEC=0"])
453 # Whether to use FileManager in Carbon since MacOS 9.x.
456 AS_HELP_STRING([--with-fsref],
457 [use Carbon FSRef API of MacOS, if available (default=yes)]))
458 if test x$with_fsref = xno; then
461 FreeType2 built without FSRef API cannot load
462 data-fork fonts on MacOS, except of XXX.dfont.
464 CFLAGS="$CFLAGS -DHAVE_FSREF=0"
465 elif test x$with_old_mac_fonts = xyes -a x$with_fsref != x; then
466 AC_MSG_CHECKING([FSRef-based FileManager])
470 #if defined(__GNUC__) && defined(__APPLE_CC__)
471 # include <CoreServices/CoreServices.h>
472 # include <ApplicationServices/ApplicationServices.h>
474 # include <ConditionalMacros.h>
483 ConstStr255Param fileName;
485 Boolean* isDirectory;
487 SInt16 desiredRefNum;
489 SInt16* actualRefNum;
490 HFSUniStr255* outForkName;
491 FSVolumeRefNum volume;
492 FSCatalogInfoBitmap whichInfo;
493 FSCatalogInfo* catalogInfo;
494 FSForkInfo* forkInfo;
501 /* FSRef functions: no need to check? */
502 FSGetForkCBInfo( desiredRefNum, volume, iterator,
503 actualRefNum, forkInfo, ref,
505 FSPathMakeRef( path, ref, isDirectory );
508 FSpMakeFSRef ( spec, ref );
509 FSGetCatalogInfo( ref, whichInfo, catalogInfo,
510 outForkName, spec, ref );
514 CFLAGS="$CFLAGS -DHAVE_FSREF=1"],
515 [AC_MSG_RESULT([not found])
516 CFLAGS="$CFLAGS -DHAVE_FSREF=0"])
520 # Whether to use QuickDraw API in ToolBox which is deprecated since
523 AC_ARG_WITH([quickdraw-toolbox],
524 AS_HELP_STRING([--with-quickdraw-toolbox],
525 [use MacOS QuickDraw in ToolBox, if available (default=yes)]))
526 if test x$with_quickdraw_toolbox = xno; then
527 CFLAGS="$CFLAGS -DHAVE_QUICKDRAW_TOOLBOX=0"
528 elif test x$with_old_mac_fonts = xyes -a x$with_quickdraw_toolbox != x; then
529 AC_MSG_CHECKING([QuickDraw FontManager functions in ToolBox])
533 #if defined(__GNUC__) && defined(__APPLE_CC__)
534 # include <CoreServices/CoreServices.h>
535 # include <ApplicationServices/ApplicationServices.h>
537 # include <ConditionalMacros.h>
546 FMInput* fmIn = NULL;
547 FMOutput* fmOut = NULL;
550 GetFontName( familyID, familyName );
551 GetFNum( familyName, &familyID );
552 fmOut = FMSwapFont( fmIn );
556 CFLAGS="$CFLAGS -DHAVE_QUICKDRAW_TOOLBOX=1"],
557 [AC_MSG_RESULT([not found])
558 CFLAGS="$CFLAGS -DHAVE_QUICKDRAW_TOOLBOX=0"])
562 # Whether to use QuickDraw API in Carbon which is deprecated since
565 AC_ARG_WITH([quickdraw-carbon],
566 AS_HELP_STRING([--with-quickdraw-carbon],
567 [use MacOS QuickDraw in Carbon, if available (default=yes)]))
568 if test x$with_quickdraw_carbon = xno; then
569 CFLAGS="$CFLAGS -DHAVE_QUICKDRAW_CARBON=0"
570 elif test x$with_old_mac_fonts = xyes -a x$with_quickdraw_carbon != x; then
571 AC_MSG_CHECKING([QuickDraw FontManager functions in Carbon])
575 #if defined(__GNUC__) && defined(__APPLE_CC__)
576 # include <CoreServices/CoreServices.h>
577 # include <ApplicationServices/ApplicationServices.h>
579 # include <ConditionalMacros.h>
586 FMFontFamilyIterator famIter;
589 FMFontFamilyInstanceIterator instIter;
596 FMCreateFontFamilyIterator( NULL, NULL, kFMUseGlobalScopeOption,
598 FMGetNextFontFamily( &famIter, &family );
599 FMGetFontFamilyName( family, famNameStr );
600 FMCreateFontFamilyInstanceIterator( family, &instIter );
601 FMGetNextFontFamilyInstance( &instIter, &font, &style, &size );
602 FMDisposeFontFamilyInstanceIterator( &instIter );
603 FMDisposeFontFamilyIterator( &famIter );
604 FMGetFontContainer( font, pathSpec );
608 CFLAGS="$CFLAGS -DHAVE_QUICKDRAW_CARBON=1"],
609 [AC_MSG_RESULT([not found])
610 CFLAGS="$CFLAGS -DHAVE_QUICKDRAW_CARBON=0"])
614 # Whether to use AppleTypeService since Mac OS X.
616 # don't quote AS_HELP_STRING!
618 AS_HELP_STRING([--with-ats],
619 [use AppleTypeService, if available (default=yes)]))
620 if test x$with_ats = xno; then
621 CFLAGS="$CFLAGS -DHAVE_ATS=0"
622 elif test x$with_old_mac_fonts = xyes -a x$with_ats != x; then
623 AC_MSG_CHECKING([AppleTypeService functions])
627 #if defined(__GNUC__) && defined(__APPLE_CC__)
628 # include <CoreServices/CoreServices.h>
629 # include <ApplicationServices/ApplicationServices.h>
631 # include <ConditionalMacros.h>
641 ATSFontFindFromName( NULL, kATSOptionFlagsUnRestrictedScope );
643 ATSFontGetFileSpecification( 0, pathSpec );
648 CFLAGS="$CFLAGS -DHAVE_ATS=1"],
649 [AC_MSG_RESULT([not found])
650 CFLAGS="$CFLAGS -DHAVE_ATS=0"])
654 *HAVE_FSSPEC* | *HAVE_FSREF* | *HAVE_QUICKDRAW* | *HAVE_ATS* )
657 FSSpec/FSRef/QuickDraw/ATS options are explicitly given,
658 thus it is recommended to replace src/base/ftmac.c by builds/mac/ftmac.c.
660 CFLAGS="$CFLAGS "'-I$(TOP_DIR)/builds/mac/'
672 AC_SUBST([FT2_EXTRA_LIBS])
673 AC_SUBST([SYSTEM_ZLIB])
678 AC_SUBST([hardcode_libdir_flag_spec])
680 AC_SUBST([build_libtool_libs])
683 # configuration file -- stay in 8.3 limit
685 # since #undef doesn't survive in configuration header files we replace
686 # `/undef' with `#undef' after creating the output file
688 AC_CONFIG_HEADERS([ftconfig.h:ftconfig.in],
689 [mv ftconfig.h ftconfig.tmp
690 sed 's|/undef|#undef|' < ftconfig.tmp > ftconfig.h
693 # create the Unix-specific sub-Makefiles `builds/unix/unix-def.mk'
694 # and `builds/unix/unix-cc.mk' that will be used by the build system
696 AC_CONFIG_FILES([unix-cc.mk:unix-cc.in
697 unix-def.mk:unix-def.in
699 freetype2.pc:freetype2.in])
701 # re-generate the Jamfile to use libtool now
703 # AC_CONFIG_FILES([../../Jamfile:../../Jamfile.in])
707 # end of configure.raw