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 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.7], [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
40 # checks for native programs to generate building tool
42 if test ${cross_compiling} = yes; then
43 AC_CHECK_PROG(CC_BUILD, ${build}-gcc, ${build}-gcc)
44 test -z "${CC_BUILD}" && AC_CHECK_PROG(CC_BUILD, gcc, gcc)
45 test -z "${CC_BUILD}" && AC_CHECK_PROG(CC_BUILD, cc, cc, , , /usr/ucb/cc)
46 test -z "${CC_BUILD}" && AC_MSG_ERROR([cannot find native C compiler])
48 AC_MSG_CHECKING([for suffix of native executables])
49 rm -f a.* b.* a_out.exe conftest.*
50 echo > conftest.c "int main() { return 0;}"
51 ${CC_BUILD} conftest.c || AC_MSG_ERROR([native C compiler is not working])
53 if test -x a.out -o -x b.out -o -x conftest; then
55 elif test -x a_out.exe -o -x conftest.exe; then
57 elif test -x conftest.* ; then
58 EXEEXT_BUILD=`echo conftest.* | sed -n '1s/^.*\.//g'`
60 AC_MSG_RESULT($EXEEXT_BUILD)
63 EXEEXT_BUILD=${EXEEXT}
67 if test ! -z ${EXEEXT_BUILD}; then
68 EXEEXT_BUILD=."${EXEEXT_BUILD}"
71 AC_SUBST(EXEEXT_BUILD)
75 # get compiler flags right
77 if test "x$CC" = xgcc; then
79 XX_ANSIFLAGS="-pedantic -ansi"
94 AC_SUBST([XX_ANSIFLAGS])
99 AC_CHECK_PROG([RMF], [rm], [rm -f])
100 AC_CHECK_PROG([RMDIR], [rmdir], [rmdir])
103 # Since this file will be finally moved to another directory we make
104 # the path of the install script absolute. This small code snippet has
105 # been taken from automake's `ylwrap' script.
112 INSTALL="`pwd`/$INSTALL" ;;
116 # checks for header files
119 AC_CHECK_HEADERS([fcntl.h unistd.h])
122 # checks for typedefs, structures, and compiler characteristics
125 AC_CHECK_SIZEOF([int])
126 AC_CHECK_SIZEOF([long])
129 # checks for library functions
131 # Here we check whether we can use our mmap file component.
134 if test "$ac_cv_func_mmap_fixed_mapped" != yes; then
135 FTSYS_SRC='$(BASE_DIR)/ftsystem.c'
137 FTSYS_SRC='$(BUILD_DIR)/ftsystem.c'
139 AC_CHECK_DECLS([munmap],
147 #include <sys/mman.h>
153 AC_SUBST([FTSYS_SRC])
155 AC_CHECK_FUNCS([memcpy memmove])
158 # check for system zlib
160 # don't quote AS_HELP_STRING!
162 AS_HELP_STRING([--without-zlib],
163 [use internal zlib instead of system-wide]))
164 if test x$with_zlib != xno && test -z "$LIBZ"; then
165 AC_CHECK_LIB([z], [gzsetparams], [AC_CHECK_HEADER([zlib.h], [LIBZ='-lz'])])
167 if test x$with_zlib != xno && test -n "$LIBZ"; then
168 CFLAGS="$CFLAGS -DFT_CONFIG_OPTION_SYSTEM_ZLIB"
169 LDFLAGS="$LDFLAGS $LIBZ"
174 # check Apple's `-isysroot' option and duplicate it to LDFLAGS if required --
175 # Apple TechNote 2137 recommends to include it in CFLAGS but not in LDFLAGS
177 AC_MSG_CHECKING([whether CFLAGS includes -isysroot option])
181 AC_MSG_CHECKING([whether LDFLAGS includes -isysroot option])
188 isysroot_dir=`echo ${CFLAGS} | tr '\t' ' ' | sed 's/^.*-isysroot *//;s/ .*//'`
189 AC_MSG_WARN(-isysroot ${isysroot_dir} is added to LDFLAGS)
190 LDFLAGS="-isysroot ${isysroot_dir} ${LDFLAGS}"
200 # Whether to use Mac OS resource-based fonts.
202 # don't quote AS_HELP_STRING!
203 AC_ARG_WITH([old-mac-fonts],
204 AS_HELP_STRING([--with-old-mac-fonts],
205 [allow Mac resource-based fonts to be used]))
206 if test x$with_old_mac_fonts = xyes; then
207 orig_LDFLAGS="${LDFLAGS}"
208 AC_MSG_CHECKING([CoreServices & ApplicationServices of Mac OS X])
209 FT2_EXTRA_LIBS="-Wl,-framework,CoreServices -Wl,-framework,ApplicationServices"
210 LDFLAGS="$LDFLAGS $FT2_EXTRA_LIBS"
214 #if defined(__GNUC__) && defined(__APPLE_CC__)
215 # include <Carbon/Carbon.h>
216 # include <ApplicationServices/ApplicationServices.h>
218 # include <ConditionalMacros.h>
232 AC_MSG_CHECKING([OS_INLINE macro is ANSI compatible])
233 orig_CFLAGS="$CFLAGS"
234 CFLAGS="$CFLAGS $XX_CFLAGS $XX_ANSIFLAGS"
238 #if defined(__GNUC__) && defined(__APPLE_CC__)
239 # include <Carbon/Carbon.h>
240 # include <ApplicationServices/ApplicationServices.h>
242 # include <ConditionalMacros.h>
249 /* OSHostByteOrder() is typed as OS_INLINE */
250 int32_t os_byte_order = OSHostByteOrder();
253 if ( OSBigEndian != os_byte_order )
258 CFLAGS="$orig_CFLAGS"
259 CFLAGS="$CFLAGS -DHAVE_ANSI_OS_INLINE=1"
261 [AC_MSG_RESULT([no, ANSI incompatible])
262 CFLAGS="$orig_CFLAGS"
264 AC_MSG_CHECKING([type ResourceIndex])
265 orig_CFLAGS="$CFLAGS"
266 CFLAGS="$CFLAGS $XX_CFLAGS $XX_ANSIFLAGS"
270 #if defined(__GNUC__) && defined(__APPLE_CC__)
271 # include <Carbon/Carbon.h>
272 # include <ApplicationServices/ApplicationServices.h>
274 # include <ConditionalMacros.h>
276 # include <Resources.h>
287 CFLAGS="$orig_CFLAGS"
288 CFLAGS="$CFLAGS -DHAVE_TYPE_RESOURCE_INDEX"
291 CFLAGS="$orig_CFLAGS"
293 [AC_MSG_RESULT([not found])
294 LDFLAGS="${orig_LDFLAGS}"
295 CFLAGS="$CFLAGS -DDARWIN_NO_CARBON"])
299 dnl AC_MSG_WARN([target system is MacOS but configured to build without Carbon])
300 CFLAGS="$CFLAGS -DDARWIN_NO_CARBON"
307 # Whether to use FileManager which is deprecated since Mac OS X 10.4.
309 AC_ARG_WITH([fsspec],
310 AS_HELP_STRING([--with-fsspec],
311 [use obsolete FSSpec API of MacOS, if available (default=yes)]))
312 if test x$with_fsspec = xno; then
313 CFLAGS="$CFLAGS -DHAVE_FSSPEC=0"
314 elif test x$with_old_mac_fonts = xyes -a x$with_fsspec != x; then
315 AC_MSG_CHECKING([FSSpec-based FileManager])
319 #if defined(__GNUC__) && defined(__APPLE_CC__)
320 # include <Carbon/Carbon.h>
321 # include <ApplicationServices/ApplicationServices.h>
323 # include <ConditionalMacros.h>
333 ConstStr255Param fileName;
337 /* FSSpec functions: deprecated since Mac OS X 10.4 */
338 PBGetFCBInfoSync( paramBlock );
339 FSMakeFSSpec( vRefNum, dirID, fileName, spec );
343 CFLAGS="$CFLAGS -DHAVE_FSSPEC=1"],
344 [AC_MSG_RESULT([not found])
345 CFLAGS="$CFLAGS -DHAVE_FSSPEC=0"])
349 # Whether to use FileManager in Carbon since MacOS 9.x.
352 AS_HELP_STRING([--with-fsref],
353 [use Carbon FSRef API of MacOS, if available (default=yes)]))
354 if test x$with_fsref = xno; then
357 FreeType2 built without FSRef API cannot load
358 data-fork fonts on MacOS, except of XXX.dfont.
360 CFLAGS="$CFLAGS -DHAVE_FSREF=0"
361 elif test x$with_old_mac_fonts = xyes -a x$with_fsref != x; then
362 AC_MSG_CHECKING([FSRef-based FileManager])
366 #if defined(__GNUC__) && defined(__APPLE_CC__)
367 # include <Carbon/Carbon.h>
368 # include <ApplicationServices/ApplicationServices.h>
370 # include <ConditionalMacros.h>
379 ConstStr255Param fileName;
381 Boolean* isDirectory;
383 SInt16 desiredRefNum;
385 SInt16* actualRefNum;
386 HFSUniStr255* outForkName;
387 FSVolumeRefNum volume;
388 FSCatalogInfoBitmap whichInfo;
389 FSCatalogInfo* catalogInfo;
390 FSForkInfo* forkInfo;
397 /* FSRef functions: no need to check? */
398 FSGetForkCBInfo( desiredRefNum, volume, iterator,
399 actualRefNum, forkInfo, ref,
401 FSPathMakeRef( path, ref, isDirectory );
404 FSpMakeFSRef ( spec, ref );
405 FSGetCatalogInfo( ref, whichInfo, catalogInfo,
406 outForkName, spec, ref );
410 CFLAGS="$CFLAGS -DHAVE_FSREF=1"],
411 [AC_MSG_RESULT([not found])
412 CFLAGS="$CFLAGS -DHAVE_FSREF=0"])
416 # Whether to use QuickDraw API in ToolBox which is deprecated since
419 AC_ARG_WITH([quickdraw-toolbox],
420 AS_HELP_STRING([--with-quickdraw-toolbox],
421 [use MacOS QuickDraw in ToolBox, if available (default=yes)]))
422 if test x$with_quickdraw_toolbox = xno; then
423 CFLAGS="$CFLAGS -DHAVE_QUICKDRAW_TOOLBOX=0"
424 elif test x$with_old_mac_fonts = xyes -a x$with_quickdraw_toolbox != x; then
425 AC_MSG_CHECKING([QuickDraw FontManager functions in ToolBox])
429 #if defined(__GNUC__) && defined(__APPLE_CC__)
430 # include <Carbon/Carbon.h>
431 # include <ApplicationServices/ApplicationServices.h>
433 # include <ConditionalMacros.h>
442 FMInput* fmIn = NULL;
443 FMOutput* fmOut = NULL;
446 GetFontName( familyID, familyName );
447 GetFNum( familyName, &familyID );
448 fmOut = FMSwapFont( fmIn );
452 CFLAGS="$CFLAGS -DHAVE_QUICKDRAW_TOOLBOX=1"],
453 [AC_MSG_RESULT([not found])
454 CFLAGS="$CFLAGS -DHAVE_QUICKDRAW_TOOLBOX=0"])
458 # Whether to use QuickDraw API in Carbon which is deprecated since
461 AC_ARG_WITH([quickdraw-carbon],
462 AS_HELP_STRING([--with-quickdraw-carbon],
463 [use MacOS QuickDraw in Carbon, if available (default=yes)]))
464 if test x$with_quickdraw_carbon = xno; then
465 CFLAGS="$CFLAGS -DHAVE_QUICKDRAW_CARBON=0"
466 elif test x$with_old_mac_fonts = xyes -a x$with_quickdraw_carbon != x; then
467 AC_MSG_CHECKING([QuickDraw FontManager functions in Carbon])
471 #if defined(__GNUC__) && defined(__APPLE_CC__)
472 # include <Carbon/Carbon.h>
473 # include <ApplicationServices/ApplicationServices.h>
475 # include <ConditionalMacros.h>
482 FMFontFamilyIterator famIter;
485 FMFontFamilyInstanceIterator instIter;
492 FMCreateFontFamilyIterator( NULL, NULL, kFMUseGlobalScopeOption,
494 FMGetNextFontFamily( &famIter, &family );
495 FMGetFontFamilyName( family, famNameStr );
496 FMCreateFontFamilyInstanceIterator( family, &instIter );
497 FMGetNextFontFamilyInstance( &instIter, &font, &style, &size );
498 FMDisposeFontFamilyInstanceIterator( &instIter );
499 FMDisposeFontFamilyIterator( &famIter );
500 FMGetFontContainer( font, pathSpec );
504 CFLAGS="$CFLAGS -DHAVE_QUICKDRAW_CARBON=1"],
505 [AC_MSG_RESULT([not found])
506 CFLAGS="$CFLAGS -DHAVE_QUICKDRAW_CARBON=0"])
510 # Whether to use AppleTypeService since Mac OS X.
512 # don't quote AS_HELP_STRING!
514 AS_HELP_STRING([--with-ats],
515 [use AppleTypeService, if available (default=yes)]))
516 if test x$with_ats = xno; then
517 CFLAGS="$CFLAGS -DHAVE_ATS=0"
518 elif test x$with_old_mac_fonts = xyes -a x$with_ats != x ; then
519 AC_MSG_CHECKING([AppleTypeService functions])
523 #include <Carbon/Carbon.h>
531 ATSFontFindFromName( NULL, kATSOptionFlagsUnRestrictedScope );
533 ATSFontGetFileSpecification( 0, pathSpec );
538 CFLAGS="$CFLAGS -DHAVE_ATS=1"],
539 [AC_MSG_RESULT([not found])
540 CFLAGS="$CFLAGS -DHAVE_ATS=0"])
544 *HAVE_FSSPEC* | *HAVE_FSREF* | *HAVE_QUICKDRAW* | *HAVE_ATS* )
547 FSSpec/FSRef/QuickDraw/ATS options are explicitly given,
548 thus it is recommended to replace src/base/ftmac.c by builds/mac/ftmac.c.
550 CFLAGS="$CFLAGS "'-I$(TOP_DIR)/builds/mac/'
560 AC_SUBST([FT2_EXTRA_LIBS])
561 AC_SUBST([SYSTEM_ZLIB])
566 AC_SUBST([hardcode_libdir_flag_spec])
568 AC_SUBST([build_libtool_libs])
571 # configuration file -- stay in 8.3 limit
573 # since #undef doesn't survive in configuration header files we replace
574 # `/undef' with `#undef' after creating the output file
576 AC_CONFIG_HEADERS([ftconfig.h:ftconfig.in],
577 [mv ftconfig.h ftconfig.tmp
578 sed 's|/undef|#undef|' < ftconfig.tmp > ftconfig.h
581 # create the Unix-specific sub-Makefiles `builds/unix/unix-def.mk'
582 # and `builds/unix/unix-cc.mk' that will be used by the build system
584 AC_CONFIG_FILES([unix-cc.mk:unix-cc.in
585 unix-def.mk:unix-def.in
587 freetype2.pc:freetype2.in])
589 # re-generate the Jamfile to use libtool now
591 # AC_CONFIG_FILES([../../Jamfile:../../Jamfile.in])
595 # end of configure.raw