From 8fe8af2d57dcdfe67375756f2a29eb16b4b7e422 Mon Sep 17 00:00:00 2001 From: Richard Frith-MacDonald Date: Mon, 29 Feb 2016 10:05:36 +0000 Subject: [PATCH] Implement versdion check for new ICU code git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@39424 72102866-910b-0410-8b05-ffd578937521 --- Source/NSCalendar.m | 6 +++++- configure | 6 +++--- configure.ac | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Source/NSCalendar.m b/Source/NSCalendar.m index 73020838a..81090530f 100644 --- a/Source/NSCalendar.m +++ b/Source/NSCalendar.m @@ -38,6 +38,7 @@ #if defined(HAVE_UNICODE_UCAL_H) #define id ucal_id #include +#include #undef id #endif @@ -396,11 +397,14 @@ do \ toDate: (NSDate *) resultDate options: (NSUInteger) opts { -#if GS_USE_ICU == 1 +#if GS_USE_ICU == 1 && (U_ICU_VERSION_MAJOR_NUM > 4 \ + || (U_ICU_VERSION_MAJOR_NUM == 4 && U_ICU_VERSION_MINOR_NUM >= 8)) + NSDateComponents *comps = nil; UErrorCode err = U_ZERO_ERROR; UDate udateFrom = (UDate)floor([startingDate timeIntervalSince1970] * 1000.0); UDate udateTo = (UDate)floor([resultDate timeIntervalSince1970] * 1000.0); + ucal_setMillis (my->cal, udateFrom, &err); if (U_FAILURE(err)) { diff --git a/configure b/configure index d2d39fd33..2853839ce 100755 --- a/configure +++ b/configure @@ -12117,9 +12117,9 @@ fi echo "See http://site.icu-project.org/ for help." else ICU_VERSION=`$ICU_CONFIG --version` - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ICU >= 4.8" >&5 -$as_echo_n "checking for ICU >= 4.8... " >&6; } - found=`expr $ICU_VERSION \>= 4.8` + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ICU >= 4.6" >&5 +$as_echo_n "checking for ICU >= 4.6... " >&6; } + found=`expr $ICU_VERSION \>= 4.6` if test "$found" = "1" ; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } diff --git a/configure.ac b/configure.ac index 0ce30b1d0..abebcb77c 100644 --- a/configure.ac +++ b/configure.ac @@ -3317,7 +3317,7 @@ AC_ARG_WITH(icu-library, if test $enable_icu = yes; then if test "$enable_icu_config" = "yes"; then - AC_CHECK_ICU(4.8, have_icu=yes, have_icu=no) + AC_CHECK_ICU(4.6, have_icu=yes, have_icu=no) else have_icu=no; AC_CHECKING([for libicu (icu-config disabled)])