1 # This file is part of the FreeType project.
3 # Process this file with autoconf to produce a configure script.
5 # Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 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.3.12], [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" ;;
111 # checks for header files
114 AC_CHECK_HEADERS([fcntl.h unistd.h])
117 # checks for typedefs, structures, and compiler characteristics
120 AC_CHECK_SIZEOF([int])
121 AC_CHECK_SIZEOF([long])
124 # check whether cpp computation of size of int and long in ftconfig.in works
126 AC_MSG_CHECKING([cpp computation of bit length in ftconfig.in works])
127 orig_CPPFLAGS="${CPPFLAGS}"
128 CPPFLAGS="-I${srcdir} -I. ${CPPFLAGS}"
129 ac_clean_files="ft2build.h ftoption.h ftstdlib.h"
130 touch ft2build.h ftoption.h ftstdlib.h
132 cat > conftest.c <<\_ACEOF
134 #define FT_CONFIG_OPTIONS_H "ftoption.h"
135 #define FT_CONFIG_STANDARD_LIBRARY_H "ftstdlib.h"
136 #define FT_UINT_MAX UINT_MAX
137 #define FT_ULONG_MAX ULONG_MAX
138 #include "ftconfig.in"
140 echo >> conftest.c "#if FT_SIZEOF_INT == "${ac_cv_sizeof_int}
141 echo >> conftest.c "ac_cpp_ft_sizeof_int="${ac_cv_sizeof_int}
142 echo >> conftest.c "#endif"
143 echo >> conftest.c "#if FT_SIZEOF_LONG == "${ac_cv_sizeof_long}
144 echo >> conftest.c "ac_cpp_ft_sizeof_long="${ac_cv_sizeof_long}
145 echo >> conftest.c "#endif"
147 ${CPP} ${CPPFLAGS} conftest.c | ${GREP} ac_cpp_ft > conftest.sh
148 eval `cat conftest.sh`
149 ${RMF} conftest.c conftest.sh confft2build.h ftoption.h ftstdlib.h
151 if test x != "x${ac_cpp_ft_sizeof_int}" \
152 -a x != x"${ac_cpp_ft_sizeof_long}"; then
153 unset ft_use_autoconf_sizeof_types
155 ft_use_autoconf_sizeof_types=yes
158 AC_ARG_ENABLE(biarch-config,
159 [ --enable-biarch-config install biarch ftconfig.h to support multiple
160 architectures by single file], [], [])
162 case :${ft_use_autoconf_sizeof_types}:${enable_biarch_config}: in
164 AC_MSG_RESULT([broken but use it])
165 unset ft_use_autoconf_sizeof_types
168 AC_MSG_RESULT([works but ignore it])
169 ft_use_autoconf_sizeof_types=yes
173 unset ft_use_autoconf_sizeof_types
177 ft_use_autoconf_sizeof_types=yes
181 if test x"${ft_use_autoconf_sizeof_types}" = xyes; then
182 AC_DEFINE([FT_USE_AUTOCONF_SIZEOF_TYPES])
185 CPPFLAGS="${orig_CPPFLAGS}"
188 # checks for library functions
190 # Here we check whether we can use our mmap file component.
193 if test "$ac_cv_func_mmap_fixed_mapped" != yes; then
194 FTSYS_SRC='$(BASE_DIR)/ftsystem.c'
196 FTSYS_SRC='$(BUILD_DIR)/ftsystem.c'
198 AC_CHECK_DECLS([munmap],
206 #include <sys/mman.h>
212 AC_SUBST([FTSYS_SRC])
214 AC_CHECK_FUNCS([memcpy memmove])
217 # check for system zlib
219 # don't quote AS_HELP_STRING!
221 AS_HELP_STRING([--without-zlib],
222 [use internal zlib instead of system-wide]))
223 if test x$with_zlib != xno && test -z "$LIBZ"; then
224 AC_CHECK_LIB([z], [gzsetparams], [AC_CHECK_HEADER([zlib.h], [LIBZ='-lz'])])
226 if test x$with_zlib != xno && test -n "$LIBZ"; then
227 CFLAGS="$CFLAGS -DFT_CONFIG_OPTION_SYSTEM_ZLIB"
228 LDFLAGS="$LDFLAGS $LIBZ"
233 # Some options handling SDKs/archs in CFLAGS should be copied
234 # to LDFLAGS. Apple TechNote 2137 recommends to include these
235 # options in CFLAGS but not in LDFLAGS.
245 -isysroot|-arch) # options taking 1 argument
247 AC_MSG_CHECKING([whether CFLAGS and LDFLAGS share ${c} ${a}])
248 if expr " ${LDFLAGS} " : ".* ${c} *${a}.*" > /dev/null
252 AC_MSG_RESULT([no, copy to LDFLAGS])
253 LDFLAGS="${LDFLAGS} ${c} ${a}"
257 -m32|-m64) # options taking no argument
258 AC_MSG_RESULT([whether CFLAGS and LDFLAGS share ${c}])
259 if expr " ${LDFLAGS} " : ".* ${c} *${a}.*" > /dev/null
263 AC_MSG_RESULT([no, copy to LDFLAGS])
264 LDFLAGS="${LDFLAGS} ${c}"
268 # AC_MSG_RESULT([${c} is not copied to LDFLAGS])
274 set ${save_config_args}
277 # Whether to use Mac OS resource-based fonts.
279 ftmac_c="" # src/base/ftmac.c should not be included in makefiles by default
281 # don't quote AS_HELP_STRING!
282 AC_ARG_WITH([old-mac-fonts],
283 AS_HELP_STRING([--with-old-mac-fonts],
284 [allow Mac resource-based fonts to be used]))
285 if test x$with_old_mac_fonts = xyes; then
286 orig_LDFLAGS="${LDFLAGS}"
287 AC_MSG_CHECKING([CoreServices & ApplicationServices of Mac OS X])
288 FT2_EXTRA_LIBS="-Wl,-framework,CoreServices -Wl,-framework,ApplicationServices"
289 LDFLAGS="$LDFLAGS $FT2_EXTRA_LIBS"
293 #if defined(__GNUC__) && defined(__APPLE_CC__)
294 # include <CoreServices/CoreServices.h>
295 # include <ApplicationServices/ApplicationServices.h>
297 # include <ConditionalMacros.h>
312 AC_MSG_CHECKING([OS_INLINE macro is ANSI compatible])
313 orig_CFLAGS="$CFLAGS"
314 CFLAGS="$CFLAGS $XX_CFLAGS $XX_ANSIFLAGS"
318 #if defined(__GNUC__) && defined(__APPLE_CC__)
319 # include <CoreServices/CoreServices.h>
320 # include <ApplicationServices/ApplicationServices.h>
322 # include <ConditionalMacros.h>
329 /* OSHostByteOrder() is typed as OS_INLINE */
330 int32_t os_byte_order = OSHostByteOrder();
333 if ( OSBigEndian != os_byte_order )
338 CFLAGS="$orig_CFLAGS"
339 CFLAGS="$CFLAGS -DHAVE_ANSI_OS_INLINE=1"
341 [AC_MSG_RESULT([no, ANSI incompatible])
342 CFLAGS="$orig_CFLAGS"
344 AC_MSG_CHECKING([type ResourceIndex])
345 orig_CFLAGS="$CFLAGS"
346 CFLAGS="$CFLAGS $XX_CFLAGS $XX_ANSIFLAGS"
350 #if defined(__GNUC__) && defined(__APPLE_CC__)
351 # include <CoreServices/CoreServices.h>
352 # include <ApplicationServices/ApplicationServices.h>
354 # include <ConditionalMacros.h>
356 # include <Resources.h>
367 CFLAGS="$orig_CFLAGS"
368 CFLAGS="$CFLAGS -DHAVE_TYPE_RESOURCE_INDEX=1"
371 CFLAGS="$orig_CFLAGS"
372 CFLAGS="$CFLAGS -DHAVE_TYPE_RESOURCE_INDEX=0"
374 [AC_MSG_RESULT([not found])
376 LDFLAGS="${orig_LDFLAGS}"
377 CFLAGS="$CFLAGS -DDARWIN_NO_CARBON"])
381 dnl AC_MSG_WARN([host system is MacOS but configured to build without Carbon])
382 CFLAGS="$CFLAGS -DDARWIN_NO_CARBON"
389 # Whether to use FileManager which is deprecated since Mac OS X 10.4.
391 AC_ARG_WITH([fsspec],
392 AS_HELP_STRING([--with-fsspec],
393 [use obsolete FSSpec API of MacOS, if available (default=yes)]))
394 if test x$with_fsspec = xno; then
395 CFLAGS="$CFLAGS -DHAVE_FSSPEC=0"
396 elif test x$with_old_mac_fonts = xyes -a x$with_fsspec != x; then
397 AC_MSG_CHECKING([FSSpec-based FileManager])
401 #if defined(__GNUC__) && defined(__APPLE_CC__)
402 # include <CoreServices/CoreServices.h>
403 # include <ApplicationServices/ApplicationServices.h>
405 # include <ConditionalMacros.h>
415 ConstStr255Param fileName;
419 /* FSSpec functions: deprecated since Mac OS X 10.4 */
420 PBGetFCBInfoSync( paramBlock );
421 FSMakeFSSpec( vRefNum, dirID, fileName, spec );
425 CFLAGS="$CFLAGS -DHAVE_FSSPEC=1"],
426 [AC_MSG_RESULT([not found])
427 CFLAGS="$CFLAGS -DHAVE_FSSPEC=0"])
431 # Whether to use FileManager in Carbon since MacOS 9.x.
434 AS_HELP_STRING([--with-fsref],
435 [use Carbon FSRef API of MacOS, if available (default=yes)]))
436 if test x$with_fsref = xno; then
439 FreeType2 built without FSRef API cannot load
440 data-fork fonts on MacOS, except of XXX.dfont.
442 CFLAGS="$CFLAGS -DHAVE_FSREF=0"
443 elif test x$with_old_mac_fonts = xyes -a x$with_fsref != x; then
444 AC_MSG_CHECKING([FSRef-based FileManager])
448 #if defined(__GNUC__) && defined(__APPLE_CC__)
449 # include <CoreServices/CoreServices.h>
450 # include <ApplicationServices/ApplicationServices.h>
452 # include <ConditionalMacros.h>
461 ConstStr255Param fileName;
463 Boolean* isDirectory;
465 SInt16 desiredRefNum;
467 SInt16* actualRefNum;
468 HFSUniStr255* outForkName;
469 FSVolumeRefNum volume;
470 FSCatalogInfoBitmap whichInfo;
471 FSCatalogInfo* catalogInfo;
472 FSForkInfo* forkInfo;
479 /* FSRef functions: no need to check? */
480 FSGetForkCBInfo( desiredRefNum, volume, iterator,
481 actualRefNum, forkInfo, ref,
483 FSPathMakeRef( path, ref, isDirectory );
486 FSpMakeFSRef ( spec, ref );
487 FSGetCatalogInfo( ref, whichInfo, catalogInfo,
488 outForkName, spec, ref );
492 CFLAGS="$CFLAGS -DHAVE_FSREF=1"],
493 [AC_MSG_RESULT([not found])
494 CFLAGS="$CFLAGS -DHAVE_FSREF=0"])
498 # Whether to use QuickDraw API in ToolBox which is deprecated since
501 AC_ARG_WITH([quickdraw-toolbox],
502 AS_HELP_STRING([--with-quickdraw-toolbox],
503 [use MacOS QuickDraw in ToolBox, if available (default=yes)]))
504 if test x$with_quickdraw_toolbox = xno; then
505 CFLAGS="$CFLAGS -DHAVE_QUICKDRAW_TOOLBOX=0"
506 elif test x$with_old_mac_fonts = xyes -a x$with_quickdraw_toolbox != x; then
507 AC_MSG_CHECKING([QuickDraw FontManager functions in ToolBox])
511 #if defined(__GNUC__) && defined(__APPLE_CC__)
512 # include <CoreServices/CoreServices.h>
513 # include <ApplicationServices/ApplicationServices.h>
515 # include <ConditionalMacros.h>
524 FMInput* fmIn = NULL;
525 FMOutput* fmOut = NULL;
528 GetFontName( familyID, familyName );
529 GetFNum( familyName, &familyID );
530 fmOut = FMSwapFont( fmIn );
534 CFLAGS="$CFLAGS -DHAVE_QUICKDRAW_TOOLBOX=1"],
535 [AC_MSG_RESULT([not found])
536 CFLAGS="$CFLAGS -DHAVE_QUICKDRAW_TOOLBOX=0"])
540 # Whether to use QuickDraw API in Carbon which is deprecated since
543 AC_ARG_WITH([quickdraw-carbon],
544 AS_HELP_STRING([--with-quickdraw-carbon],
545 [use MacOS QuickDraw in Carbon, if available (default=yes)]))
546 if test x$with_quickdraw_carbon = xno; then
547 CFLAGS="$CFLAGS -DHAVE_QUICKDRAW_CARBON=0"
548 elif test x$with_old_mac_fonts = xyes -a x$with_quickdraw_carbon != x; then
549 AC_MSG_CHECKING([QuickDraw FontManager functions in Carbon])
553 #if defined(__GNUC__) && defined(__APPLE_CC__)
554 # include <CoreServices/CoreServices.h>
555 # include <ApplicationServices/ApplicationServices.h>
557 # include <ConditionalMacros.h>
564 FMFontFamilyIterator famIter;
567 FMFontFamilyInstanceIterator instIter;
574 FMCreateFontFamilyIterator( NULL, NULL, kFMUseGlobalScopeOption,
576 FMGetNextFontFamily( &famIter, &family );
577 FMGetFontFamilyName( family, famNameStr );
578 FMCreateFontFamilyInstanceIterator( family, &instIter );
579 FMGetNextFontFamilyInstance( &instIter, &font, &style, &size );
580 FMDisposeFontFamilyInstanceIterator( &instIter );
581 FMDisposeFontFamilyIterator( &famIter );
582 FMGetFontContainer( font, pathSpec );
586 CFLAGS="$CFLAGS -DHAVE_QUICKDRAW_CARBON=1"],
587 [AC_MSG_RESULT([not found])
588 CFLAGS="$CFLAGS -DHAVE_QUICKDRAW_CARBON=0"])
592 # Whether to use AppleTypeService since Mac OS X.
594 # don't quote AS_HELP_STRING!
596 AS_HELP_STRING([--with-ats],
597 [use AppleTypeService, if available (default=yes)]))
598 if test x$with_ats = xno; then
599 CFLAGS="$CFLAGS -DHAVE_ATS=0"
600 elif test x$with_old_mac_fonts = xyes -a x$with_ats != x ; then
601 AC_MSG_CHECKING([AppleTypeService functions])
605 #if defined(__GNUC__) && defined(__APPLE_CC__)
606 # include <CoreServices/CoreServices.h>
607 # include <ApplicationServices/ApplicationServices.h>
609 # include <ConditionalMacros.h>
619 ATSFontFindFromName( NULL, kATSOptionFlagsUnRestrictedScope );
621 ATSFontGetFileSpecification( 0, pathSpec );
626 CFLAGS="$CFLAGS -DHAVE_ATS=1"],
627 [AC_MSG_RESULT([not found])
628 CFLAGS="$CFLAGS -DHAVE_ATS=0"])
632 *HAVE_FSSPEC* | *HAVE_FSREF* | *HAVE_QUICKDRAW* | *HAVE_ATS* )
635 FSSpec/FSRef/QuickDraw/ATS options are explicitly given,
636 thus it is recommended to replace src/base/ftmac.c by builds/mac/ftmac.c.
638 CFLAGS="$CFLAGS "'-I$(TOP_DIR)/builds/mac/'
649 AC_SUBST([FT2_EXTRA_LIBS])
650 AC_SUBST([SYSTEM_ZLIB])
655 AC_SUBST([hardcode_libdir_flag_spec])
657 AC_SUBST([build_libtool_libs])
660 # configuration file -- stay in 8.3 limit
662 # since #undef doesn't survive in configuration header files we replace
663 # `/undef' with `#undef' after creating the output file
665 AC_CONFIG_HEADERS([ftconfig.h:ftconfig.in],
666 [mv ftconfig.h ftconfig.tmp
667 sed 's|/undef|#undef|' < ftconfig.tmp > ftconfig.h
670 # create the Unix-specific sub-Makefiles `builds/unix/unix-def.mk'
671 # and `builds/unix/unix-cc.mk' that will be used by the build system
673 AC_CONFIG_FILES([unix-cc.mk:unix-cc.in
674 unix-def.mk:unix-def.in
676 freetype2.pc:freetype2.in])
678 # re-generate the Jamfile to use libtool now
680 # AC_CONFIG_FILES([../../Jamfile:../../Jamfile.in])
684 # end of configure.raw