blob: a1dab41ae906116ce3f3bb147bcfa56997022df4 [file] [log] [blame]
Werner Lemberge42dbce2003-11-09 08:37:14 +00001# This file is part of the FreeType project.
2#
3# Process this file with autoconf to produce a configure script.
Werner Lemberg60a04df2005-06-04 23:04:30 +00004#
5# Copyright 2001, 2002, 2003, 2004, 2005 by
6# David Turner, Robert Wilhelm, and Werner Lemberg.
7#
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
12# fully.
David Turner74043012000-07-08 00:22:20 +000013
Werner Lembergb3f32102001-06-08 12:19:22 +000014AC_INIT
15AC_CONFIG_SRCDIR([ftconfig.in])
David Turner74043012000-07-08 00:22:20 +000016
David Turner74043012000-07-08 00:22:20 +000017
Werner Lemberge42dbce2003-11-09 08:37:14 +000018# Don't forget to update docs/VERSION.DLL!
19
Werner Lemberg49f4d342005-06-16 19:07:08 +000020version_info='9:9:3'
Werner Lemberge42dbce2003-11-09 08:37:14 +000021AC_SUBST([version_info])
Werner Lemberg3de5b072001-03-20 07:52:52 +000022ft_version=`echo $version_info | tr : .`
Werner Lemberge42dbce2003-11-09 08:37:14 +000023AC_SUBST([ft_version])
David Turner74043012000-07-08 00:22:20 +000024
David Turner74043012000-07-08 00:22:20 +000025
Werner Lemberge42dbce2003-11-09 08:37:14 +000026# checks for system type
27
28AC_CANONICAL_TARGET
29
30
31# checks for programs
32
David Turner74043012000-07-08 00:22:20 +000033AC_PROG_CC
34AC_PROG_CPP
35
Werner Lemberge42dbce2003-11-09 08:37:14 +000036
37# get compiler flags right
38
David Turner74043012000-07-08 00:22:20 +000039if test "x$CC" = xgcc; then
Werner Lemberg92aa5272005-05-23 21:33:02 +000040 XX_CFLAGS="-Wall"
David Turner74043012000-07-08 00:22:20 +000041 XX_ANSIFLAGS="-pedantic -ansi"
42else
43 case "$host" in
Werner Lemberge42dbce2003-11-09 08:37:14 +000044 *-dec-osf*)
45 CFLAGS=
46 XX_CFLAGS="-std1 -g3"
47 XX_ANSIFLAGS=
48 ;;
49 *)
50 XX_CFLAGS=
51 XX_ANSIFLAGS=
52 ;;
David Turner74043012000-07-08 00:22:20 +000053 esac
54fi
Werner Lemberge42dbce2003-11-09 08:37:14 +000055AC_SUBST([XX_CFLAGS])
56AC_SUBST([XX_ANSIFLAGS])
David Turner74043012000-07-08 00:22:20 +000057
Werner Lembergfd9777e2000-07-31 10:56:42 +000058
Werner Lemberge42dbce2003-11-09 08:37:14 +000059# auxiliary programs
60
61AC_CHECK_PROG([RMF], [rm], [rm -f])
62AC_CHECK_PROG([RMDIR], [rmdir], [rmdir])
63
64
65# Since this file will be finally moved to another directory we make
66# the path of the install script absolute. This small code snippet has
67# been taken from automake's `ylwrap' script.
68
David Turner74043012000-07-08 00:22:20 +000069AC_PROG_INSTALL
Werner Lembergfd9777e2000-07-31 10:56:42 +000070case "$INSTALL" in
Werner Lemberge42dbce2003-11-09 08:37:14 +000071/*)
72 ;;
73*/*)
74 INSTALL="`pwd`/$INSTALL" ;;
Werner Lembergfd9777e2000-07-31 10:56:42 +000075esac
David Turner74043012000-07-08 00:22:20 +000076
Werner Lemberge42dbce2003-11-09 08:37:14 +000077
78# checks for header files
79
Werner Lembergd060a752000-07-20 06:57:41 +000080AC_HEADER_STDC
Werner Lemberge42dbce2003-11-09 08:37:14 +000081AC_CHECK_HEADERS([fcntl.h unistd.h])
David Turner74043012000-07-08 00:22:20 +000082
Werner Lemberge42dbce2003-11-09 08:37:14 +000083
84# checks for typedefs, structures, and compiler characteristics
85
David Turner74043012000-07-08 00:22:20 +000086AC_C_CONST
Werner Lemberge42dbce2003-11-09 08:37:14 +000087AC_CHECK_SIZEOF([int])
88AC_CHECK_SIZEOF([long])
David Turner74043012000-07-08 00:22:20 +000089
David Turner74043012000-07-08 00:22:20 +000090
Werner Lemberge42dbce2003-11-09 08:37:14 +000091# checks for library functions
92
93# Here we check whether we can use our mmap file component.
94
David Turner74043012000-07-08 00:22:20 +000095AC_FUNC_MMAP
96if test "$ac_cv_func_mmap_fixed_mapped" != yes; then
Werner Lemberg858f3102003-06-09 04:46:30 +000097 FTSYS_SRC='$(BASE_DIR)/ftsystem.c'
David Turner74043012000-07-08 00:22:20 +000098else
Werner Lemberg858f3102003-06-09 04:46:30 +000099 FTSYS_SRC='$(BUILD_DIR)/ftsystem.c'
Werner Lembergb1dd3532000-07-31 22:51:00 +0000100
Werner Lemberge42dbce2003-11-09 08:37:14 +0000101 AC_CHECK_DECLS([munmap],
102 [],
103 [],
104 [
105
106#ifdef HAVE_UNISTD_H
107#include <unistd.h>
108#endif
109#include <sys/mman.h>
110
111 ])
112
Werner Lembergb1dd3532000-07-31 22:51:00 +0000113 FT_MUNMAP_PARAM
David Turner74043012000-07-08 00:22:20 +0000114fi
Werner Lemberge42dbce2003-11-09 08:37:14 +0000115AC_SUBST([FTSYS_SRC])
David Turner74043012000-07-08 00:22:20 +0000116
Werner Lemberge42dbce2003-11-09 08:37:14 +0000117AC_CHECK_FUNCS([memcpy memmove])
David Turner74043012000-07-08 00:22:20 +0000118
Werner Lemberge42dbce2003-11-09 08:37:14 +0000119
120# Check for system zlib
121
122AC_ARG_WITH([zlib],
123 dnl don't quote AS_HELP_STRING!
124 AS_HELP_STRING([--without-zlib],
125 [use internal zlib instead of system-wide]))
David Turner621e4882002-12-16 21:51:24 +0000126if test x$with_zlib != xno && test -z "$LIBZ"; then
Werner Lemberge42dbce2003-11-09 08:37:14 +0000127 AC_CHECK_LIB([z], [gzsetparams], [AC_CHECK_HEADER([zlib.h], [LIBZ='-lz'])])
David Turner621e4882002-12-16 21:51:24 +0000128fi
129if test x$with_zlib != xno && test -n "$LIBZ"; then
130 CFLAGS="$CFLAGS -DFT_CONFIG_OPTION_SYSTEM_ZLIB"
David Turner19b6b992002-12-23 22:40:21 +0000131 LDFLAGS="$LDFLAGS $LIBZ"
David Turner621e4882002-12-16 21:51:24 +0000132 SYSTEM_ZLIB=yes
133fi
Werner Lemberg6eb116e2003-05-11 07:12:26 +0000134
Werner Lemberge42dbce2003-11-09 08:37:14 +0000135
136# Whether to use Mac OS resource-based fonts or not
137
138AC_ARG_WITH([old-mac-fonts],
139 dnl don't quote AS_HELP_STRING!
140 AS_HELP_STRING([--with-old-mac-fonts],
141 [allow Mac resource-based fonts to be used]))
Werner Lemberg6eb116e2003-05-11 07:12:26 +0000142if test x$with_old_mac_fonts = xyes; then
Werner Lemberg6eb116e2003-05-11 07:12:26 +0000143 LDFLAGS="$LDFLAGS -Xlinker -framework -Xlinker CoreServices \
144 -Xlinker -framework -Xlinker ApplicationServices"
145else
146 CFLAGS="$CFLAGS -DDARWIN_NO_CARBON"
147fi
148
Werner Lemberge42dbce2003-11-09 08:37:14 +0000149
Suzuki, Toshiya (鈴木俊哉)f8d16cc2006-01-11 09:28:38 +0000150# Whether to use FileManager which is deprecated since Mac OS X 10.4
151
152AC_ARG_WITH([fsspec],
153 AS_HELP_STRING([--with-fsspec],
154 [use obsolete FSSpec API of MacOS, if available (default=yes)]))
155if test x$with_fsspec = xno; then
156 CFLAGS="$CFLAGS -DHAVE_FSSPEC=0"
157elif test x$with_old_mac_fonts = xyes; then
158 AC_MSG_CHECKING([FSSpec-based FileManager])
159 AC_TRY_LINK([
160#if defined(__GNUC__) && defined(__APPLE_CC__)
161# include <Carbon/Carbon.h>
162# include <ApplicationServices/ApplicationServices.h>
163#else
164# include <ConditionalMacros.h>
165# include <Files.h>
166#endif
167 ], [
168 FCBPBPtr paramBlock;
169 short vRefNum;
170 long dirID;
171 ConstStr255Param fileName;
172 FSSpec* spec;
173
174 /* FSSpec functions: deprecated sicne Mac OS X 10.4 */
175 PBGetFCBInfoSync( paramBlock );
176 FSMakeFSSpec( vRefNum, dirID, fileName, spec );
177
178 ], [
179 AC_MSG_RESULT([ok])
180 CFLAGS="$CFLAGS -DHAVE_FSSPEC=1"
181 ], [
182 AC_MSG_RESULT([not found])
183 CFLAGS="$CFLAGS -DHAVE_FSSPEC=0"
184 ])
185fi
186
187# Whether to use FileManager in Carbon since MacOS 9.x
188
189AC_ARG_WITH([fsref],
190 AS_HELP_STRING([--with-fsref],
191 [use Carbon FSRef API of MacOS, if available (default=yes)]))
192if test x$with_fsref = xno; then
193 AC_MSG_WARN([
194*** WARNING
195 FreeType2 built without FSRef API cannot load
196 data-fork fonts on MacOS, except of XXX.dfont.
197])
198 CFLAGS="$CFLAGS -DHAVE_FSREF=0"
199elif test x$with_old_mac_fonts = xyes; then
200 AC_MSG_CHECKING([FSRef-based FileManager])
201 AC_TRY_LINK([
202#if defined(__GNUC__) && defined(__APPLE_CC__)
203# include <Carbon/Carbon.h>
204# include <ApplicationServices/ApplicationServices.h>
205#else
206# include <ConditionalMacros.h>
207# include <Files.h>
208#endif
209 ], [
210 FCBPBPtr paramBlock;
211 short vRefNum;
212 long dirID;
213 ConstStr255Param fileName;
214 FSSpec* spec;
215
216 Boolean* isDirectory;
217 UInt8* path;
218 SInt16 desiredRefNum;
219 SInt16* iterator;
220 SInt16* actualRefNum;
221 HFSUniStr255* outForkName;
222 FSVolumeRefNum volume;
223 FSCatalogInfoBitmap whichInfo;
224 FSCatalogInfo* catalogInfo;
225 FSForkInfo* forkInfo;
226 FSRef* ref;
227
228
229 /* FSRef functions: no need to check? */
230 FSGetForkCBInfo( desiredRefNum, volume, iterator,
231 actualRefNum, forkInfo, ref,
232 outForkName );
233 FSpMakeFSRef ( spec, ref );
234 FSGetCatalogInfo( ref, whichInfo, catalogInfo,
235 outForkName, spec, ref );
236 FSPathMakeRef( path, ref, isDirectory );
237
238 ], [
239 AC_MSG_RESULT([ok])
240 CFLAGS="$CFLAGS -DHAVE_FSREF=1"
241 ], [
242 AC_MSG_RESULT([not found])
243 CFLAGS="$CFLAGS -DHAVE_FSREF=0"
244 ])
245fi
246
247# Whether to use QuickDraw API in ToolBox which is deprecated since Mac OS X 10.4
248
249AC_ARG_WITH([quickdraw-toolbox],
250 AS_HELP_STRING([--with-quickdraw-toolbox],
251 [use MacOS QuickDraw in ToolBox, if available (default=yes)]))
252if test x$with_quickdraw_toolbox = xno; then
253 CFLAGS="$CFLAGS -DHAVE_QUICKDRAW_TOOLBOX=0"
254elif test x$with_old_mac_fonts = xyes; then
255 AC_MSG_CHECKING([QuickDraw FontManager functions in ToolBox])
256 AC_TRY_LINK([
257#if defined(__GNUC__) && defined(__APPLE_CC__)
258# include <Carbon/Carbon.h>
259# include <ApplicationServices/ApplicationServices.h>
260#else
261# include <ConditionalMacros.h>
262# include <Fonts.h>
263#endif
264 ], [
265 Str255 familyName;
266 SInt16 familyID = 0;
267 FMInput* fmIn = NULL;
268 FMOutput* fmOut = NULL;
269
270
271 GetFontName( familyID, familyName );
272 GetFNum( familyName, &familyID );
273 fmOut = FMSwapFont( fmIn );
274
275 ], [
276 AC_MSG_RESULT([ok])
277 CFLAGS="$CFLAGS -DHAVE_QUICKDRAW_TOOLBOX=1"
278 ], [
279 AC_MSG_RESULT([not found])
280 CFLAGS="$CFLAGS -DHAVE_QUICKDRAW_TOOLBOX=0"
281 ])
282fi
283
284
285# Whether to use QuickDraw API in Carbon which is deprecated since Mac OS X 10.4
286
287AC_ARG_WITH([quickdraw-carbon],
288 AS_HELP_STRING([--with-quickdraw-carbon],
289 [use MacOS QuickDraw in Carbon, if available (default=yes)]))
290if test x$with_quickdraw_carbon = xno; then
291 CFLAGS="$CFLAGS -DHAVE_QUICKDRAW_CARBON=0"
292elif test x$with_old_mac_fonts = xyes; then
293 AC_MSG_CHECKING([QuickDraw FontManager functions in Carbon])
294 AC_TRY_LINK([
295#if defined(__GNUC__) && defined(__APPLE_CC__)
296# include <Carbon/Carbon.h>
297# include <ApplicationServices/ApplicationServices.h>
298#else
299# include <ConditionalMacros.h>
300# include <Fonts.h>
301#endif
302 ], [
303 FMFontFamilyIterator famIter;
304 FMFontFamily family;
305 Str255 famNameStr;
306 FMFontFamilyInstanceIterator instIter;
307 FMFontStyle style;
308 FMFontSize size;
309 FMFont font;
310 FSSpec* pathSpec;
311
312
313 FMCreateFontFamilyIterator( NULL, NULL, kFMUseGlobalScopeOption, &famIter );
314 FMGetNextFontFamily( &famIter, &family );
315 FMGetFontFamilyName( family, famNameStr );
316 FMCreateFontFamilyInstanceIterator( family, &instIter );
317 FMGetNextFontFamilyInstance( &instIter, &font, &style, &size );
318 FMDisposeFontFamilyInstanceIterator( &instIter );
319 FMDisposeFontFamilyIterator( &famIter );
320 FMGetFontContainer( font, pathSpec );
321 ], [
322 AC_MSG_RESULT([ok])
323 CFLAGS="$CFLAGS -DHAVE_QUICKDRAW_CARBON=1"
324 ], [
325 AC_MSG_RESULT([not found])
326 CFLAGS="$CFLAGS -DHAVE_QUICKDRAW_CARBON=0"
327 ])
328fi
329
330
331# Whether to use AppleTypeService since Mac OS X
332AC_ARG_WITH([ats],
333 dnl don't quote AS_HELP_STRING!
334 AS_HELP_STRING([--with-ats],
335 [use AppleTypeService, if available (default=yes)]))
336if test x$with_ats = xno; then
337 CFLAGS="$CFLAGS -DHAVE_ATS=0"
338elif test x$with_old_mac_fonts = xyes; then
339 AC_MSG_CHECKING([AppleTypeService functions])
340 AC_TRY_LINK([
341#include <Carbon/Carbon.h>
342 ], [
343 FSSpec* pathSpec;
344
345
346 ATSFontFindFromName( NULL, kATSOptionFlagsUnRestrictedScope );
347 ATSFontGetFileSpecification( 0, pathSpec );
348 ], [
349 AC_MSG_RESULT([ok])
350 CFLAGS="$CFLAGS -DHAVE_ATS=1"
351 ], [
352 AC_MSG_RESULT([not found])
353 CFLAGS="$CFLAGS -DHAVE_ATS=0"
354 ])
355fi
356
357
358
Werner Lemberge42dbce2003-11-09 08:37:14 +0000359AC_SUBST([LIBZ])
360AC_SUBST([CFLAGS])
361AC_SUBST([LDFLAGS])
362AC_SUBST([SYSTEM_ZLIB])
363
David Turner621e4882002-12-16 21:51:24 +0000364
Werner Lembergc0c2abe2001-06-07 17:36:17 +0000365AC_PROG_LIBTOOL
Werner Lemberg53a1edd2004-02-08 22:45:48 +0000366# urgh -- these are internal libtool variables...
367AC_SUBST([enable_shared])
368AC_SUBST([hardcode_libdir_flag_spec])
369AC_SUBST([wl])
David Turner74043012000-07-08 00:22:20 +0000370
Werner Lemberge42dbce2003-11-09 08:37:14 +0000371
372# configuration file -- stay in 8.3 limit
373#
374# since #undef doesn't survive in configuration header files we replace
375# `/undef' with `#undef' after creating the output file
376
377AC_CONFIG_HEADERS([ftconfig.h:ftconfig.in],
378 [mv ftconfig.h ftconfig.tmp
379 sed 's|/undef|#undef|' < ftconfig.tmp > ftconfig.h
380 rm ftconfig.tmp])
381
382# create the Unix-specific sub-Makefiles `builds/unix/unix-def.mk'
383# and 'builds/unix/unix-cc.mk' that will be used by the build system
384#
Werner Lemberg3a317c62003-04-28 09:43:32 +0000385AC_CONFIG_FILES([unix-cc.mk:unix-cc.in
386 unix-def.mk:unix-def.in
387 freetype-config
388 freetype2.pc:freetype2.in])
David Turnerce9a0442002-01-08 18:33:55 +0000389
Werner Lemberge42dbce2003-11-09 08:37:14 +0000390# re-generate the Jamfile to use libtool now
391#
392# AC_CONFIG_FILES([../../Jamfile:../../Jamfile.in])
David Turnerce9a0442002-01-08 18:33:55 +0000393
Werner Lembergb3f32102001-06-08 12:19:22 +0000394AC_OUTPUT
David Turner74043012000-07-08 00:22:20 +0000395
Werner Lemberge42dbce2003-11-09 08:37:14 +0000396# end of configure.ac