We no longer use Gestalt(), so there's no need to check for it.

We *do*, however, use CFPropertyListCreateWithStream(), so we need to
check for it, and, if we're able to use the OS X frameworks at all, use
CFPropertyListCreateFromStream() if we don't have
CFPropertyListCreateWithStream().

svn path=/trunk/; revision=44812
This commit is contained in:
Guy Harris 2012-09-08 07:46:56 +00:00
parent 50351aa1c4
commit 001dbcfc0b
2 changed files with 17 additions and 4 deletions

View File

@ -640,19 +640,15 @@ darwin*)
# include <CoreFoundation/CFString.h>
# include <CoreFoundation/CFURL.h>
# include <ApplicationServices/ApplicationServices.h>
# include <CoreServices/CoreServices.h>
],
[
CFStringRef url_CFString;
CFURLRef url_CFURL;
OSStatus status;
long os_version;
url_CFString = CFStringCreateWithCString(NULL, "", kCFStringEncodingASCII);
url_CFURL = CFURLCreateWithString(NULL, url_CFString, NULL);
status = LSOpenCFURLRef(url_CFURL, NULL);
Gestalt(gestaltSystemVersion, &os_version);
],
ac_cv_can_use_osx_frameworks=yes,
ac_cv_can_use_osx_frameworks=no,
@ -662,6 +658,17 @@ darwin*)
CORESERVICES_FRAMEWORKS="$ac_coreservices_frameworks"
LAUNCHSERVICES_FRAMEWORKS="$ac_launchservices_frameworks"
AC_MSG_RESULT(yes)
#
# OK, so we have the OS X frameworks; do they include
# CFPropertyListCreateWithStream, or do we have
# to fall back on CFPropertyListCreateFromStream?
# (They only differ in the error return, which we
# don't care about. And, no, we shouldn't just
# use CFPropertyListCreateFromStream, because it's
# deprecated in newer releases.)
#
AC_CHECK_FUNCS(CFPropertyListCreateWithStream)
else
AC_MSG_RESULT(no)
fi

View File

@ -259,9 +259,15 @@ get_os_x_version_info(GString *str)
CFRelease(system_version_plist_stream);
return FALSE;
}
#ifdef HAVE_CFPROPERTYLISTCREATEWITHSTREAM
system_version_dict = CFPropertyListCreateWithStream(NULL,
system_version_plist_stream, 0, kCFPropertyListImmutable,
NULL, NULL);
#else
system_version_dict = CFPropertyListCreateFromStream(NULL,
system_version_plist_stream, 0, kCFPropertyListImmutable,
NULL, NULL);
#endif
if (system_version_dict == NULL)
return FALSE;
if (CFGetTypeID(system_version_dict) != CFDictionaryGetTypeID()) {