krb5: don't include plist support unless CoreFoundation is present

depending what's available when you compile for iOS it's possible to
be __APPLE__ and not have CF; actually test for it instead of blythely
assuming it can be used
This commit is contained in:
Daria Phoebe Brashear
2017-10-24 12:53:46 -04:00
committed by Jeffrey Altman
parent 6428136e18
commit 0f5486eafc
4 changed files with 35 additions and 3 deletions

View File

@@ -0,0 +1,28 @@
AC_DEFUN([rk_FRAMEWORK_COREFOUNDATION], [
AC_MSG_CHECKING([for framework CoreFoundation])
AC_CACHE_VAL(rk_cv_framework_corefoundation,
[
if test "$rk_cv_framework_corefoundation" != yes; then
ac_save_LIBS="$LIBS"
LIBS="$ac_save_LIBS -framework CoreFoundation"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <CoreFoundation/CoreFoundation.h>
]],
[[CFURLRef url;
char path[] = "/";
url = CFURLCreateFromFileSystemRepresentation(kCFAllocatorDefault, (UInt8 *)
path, strlen(path), FALSE);
CFRelease(url);
]])],[rk_cv_framework_corefoundation=yes])
LIBS="$ac_save_LIBS"
fi
])
if test "$rk_cv_framework_corefoundation" = yes; then
AC_DEFINE(HAVE_FRAMEWORK_COREFOUNDATION, 1, [Have -framework CoreFoundation])
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
AM_CONDITIONAL(FRAMEWORK_COREFOUNDATION, test "$rk_cv_framework_corefoundation" = yes)
])

View File

@@ -572,6 +572,7 @@ AC_CHECK_TYPES([int8_t, int16_t, int32_t, int64_t,
])
rk_FRAMEWORK_SECURITY
rk_FRAMEWORK_COREFOUNDATION
KRB_READLINE

View File

@@ -253,6 +253,9 @@ libkrb5_la_DEPENDENCIES = \
version-script.map
libkrb5_la_LDFLAGS = -version-info 26:0:0
if FRAMEWORK_COREFOUNDATION
libkrb5_la_LDFLAGS += -framework CoreFoundation
endif
if versionscript
libkrb5_la_LDFLAGS += $(LDFLAGS_VERSION_SCRIPT)$(srcdir)/version-script.map

View File

@@ -35,7 +35,7 @@
#include "krb5_locl.h"
#ifdef __APPLE__
#if defined(HAVE_FRAMEWORK_COREFOUNDATION)
#include <CoreFoundation/CoreFoundation.h>
#endif
@@ -238,7 +238,7 @@ parse_binding(struct fileptr *f, unsigned *lineno, char *p,
return ret;
}
#if defined(__APPLE__)
#if defined(HAVE_FRAMEWORK_COREFOUNDATION)
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
#define HAVE_CFPROPERTYLISTCREATEWITHSTREAM 1
@@ -605,7 +605,7 @@ krb5_config_parse_file_multi (krb5_context context,
if (is_plist_file(fname)) {
context->config_include_depth--;
#ifdef __APPLE__
#if defined(HAVE_FRAMEWORK_COREFOUNDATION)
ret = parse_plist_config(context, fname, res);
if (ret) {
krb5_set_error_message(context, ret,