On 6/25/08 2:14 AM, [EMAIL PROTECTED] said:

>I've checked my G4 PowerBook with Mac OS X 10.4.11 + 10.4u SDK,
>its header file does not define the macro MAC_OS_X_VERSION_10_5.
>But 10.4u SDK bundled in 10.5 defines it.

Apple often updates their SDKs between releases of Xcode and OSes, which
explains what you see here.

But "MAC_OS_X_VERSION_10_5" is just a constant, it does not indicate the
SDK version.  The numbering is obvious, see AvailabilityMacros.h:

#define MAC_OS_X_VERSION_10_0 1000
#define MAC_OS_X_VERSION_10_1 1010
#define MAC_OS_X_VERSION_10_2 1020
#define MAC_OS_X_VERSION_10_3 1030
#define MAC_OS_X_VERSION_10_4 1040
#define MAC_OS_X_VERSION_10_5 1050

So we could simplify:

#if defined( MAC_OS_X_VERSION_10_5 ) && \
    ( MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5 )

to:

#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050

I think it is still very readable and it has the advantage of working
with any SDK, even back to 10.0.

Note that developers often confuse the meanings of
MAC_OS_X_VERSION_MAX_ALLOWED and MAC_OS_X_VERSION_MIN_REQUIRED.

To check for the 10.5 SDK use:
#if MAC_OS_X_VERSION_MAX_ALLOWED

To check the minimum supported OS version ("Mac OS X deployment target"
build setting) use:
#if MAC_OS_X_VERSION_MIN_REQUIRED

So the previous conditional declaration of ResourceIndex was wrong, but
adding something to the configure script is not the ideal solution in my
option.  For example, it breaks VTK which uses freetype but does not use
freetype's configure stuff (it uses CMake).  A better solution is to
just test the SDK version.

I have attached a patch.  Suzuki-San, can you review and commit?

--
____________________________________________________________
Sean McBride, B. Eng                 [EMAIL PROTECTED]
Rogue Research                        www.rogue-research.com
Mac Software Developer              Montréal, Québec, Canada
Index: ChangeLog
===================================================================
RCS file: /sources/freetype/freetype2/ChangeLog,v
retrieving revision 1.1756
diff -r1.1756 ChangeLog
710,712c710,713
<       * src/base/ftmac.c: Use essential header files <Carbon/Carbon.h>
<       and <ApplicationServices/ApplicationServices.h> instead of
<       all-in-one header file <CoreServices/CoreServices.h>.
---
>       * src/base/ftmac.c: Use essential header files
>       <CoreServices/CoreServices.h> and
>       <ApplicationServices/ApplicationServices.h> instead of
>       all-in-one header file <Carbon/Carbon.h>.
Index: builds/unix/configure.raw
===================================================================
RCS file: /sources/freetype/freetype2/builds/unix/configure.raw,v
retrieving revision 1.28
diff -r1.28 configure.raw
214,220c214,215
< #if defined(__GNUC__) && defined(__APPLE_CC__)
< # include <Carbon/Carbon.h>
< # include <ApplicationServices/ApplicationServices.h>
< #else
< # include <ConditionalMacros.h>
< # include <Files.h>
< #endif
---
> #include <CoreServices/CoreServices.h>
> #include <ApplicationServices/ApplicationServices.h>
263,284d257
<        ])
<      AC_MSG_CHECKING([type ResourceIndex])
<      orig_CFLAGS="$CFLAGS"
<      CFLAGS="$CFLAGS $XX_CFLAGS $XX_ANSIFLAGS"
<      AC_COMPILE_IFELSE([
<        AC_LANG_PROGRAM([
< 
< #if defined(__GNUC__) && defined(__APPLE_CC__)
< # include <Carbon/Carbon.h>
< # include <ApplicationServices/ApplicationServices.h>
< #else
< # include <ConditionalMacros.h>
< # include <Files.h>
< # include <Resources.h>
< #endif
< 
<          ],
<          [
< 
<            ResourceIndex i = 0;
<            return i;
< 
286,293d258
<        [AC_MSG_RESULT([ok])
<         CFLAGS="$orig_CFLAGS"
<         CFLAGS="$CFLAGS -DHAVE_TYPE_RESOURCE_INDEX"
<        ],
<        [AC_MSG_RESULT([no])
<         CFLAGS="$orig_CFLAGS"
<        ])
<     ],
Index: src/base/ftmac.c
===================================================================
RCS file: /sources/freetype/freetype2/src/base/ftmac.c,v
retrieving revision 1.67
diff -r1.67 ftmac.c
80,81c80,82
<   /* The ResourceIndex type was available SDKs on 10.5 */
< #ifndef HAVE_TYPE_RESOURCE_INDEX
---
>   /* The ResourceIndex type was introduced in the 10.5 SDK. */
>   /* If an older SDK is being used, define ResourceIndex.   */
> #if MAC_OS_X_VERSION_MAX_ALLOWED < 1050
136,137c137
< #if defined( MAC_OS_X_VERSION_10_5 ) && \
<     ( MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5 )
---
> #if ( MAC_OS_X_VERSION_MIN_REQUIRED >= 1050 )
237,238c237
< #if ( __LP64__ ) || ( defined( MAC_OS_X_VERSION_10_5 ) && \
<       ( MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5 ) )
---
> #if ( __LP64__ ) || ( MAC_OS_X_VERSION_MIN_REQUIRED >= 1050 )
1110,1111c1109
< #if ( __LP64__ ) || ( defined( MAC_OS_X_VERSION_10_5 ) && \
<       ( MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5 ) )
---
> #if ( __LP64__ ) || ( MAC_OS_X_VERSION_MIN_REQUIRED >= 1050 )
_______________________________________________
Freetype-devel mailing list
Freetype-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/freetype-devel

Reply via email to