From 94a6cb9919b0182d37fd51fcc24902435cb1ffc1 Mon Sep 17 00:00:00 2001 From: Frederik Seiffert Date: Tue, 14 May 2024 09:34:20 +0200 Subject: [PATCH] Fix Unicode includes in NSString.m Fixes compilation using ICU bundled with Windows. --- Headers/GNUstepBase/config.h.in | 6 ++++++ Source/NSString.m | 22 +++++++++++----------- configure | 2 +- configure.ac | 2 +- 4 files changed, 19 insertions(+), 13 deletions(-) diff --git a/Headers/GNUstepBase/config.h.in b/Headers/GNUstepBase/config.h.in index 9a1fcfe17..5018d6873 100644 --- a/Headers/GNUstepBase/config.h.in +++ b/Headers/GNUstepBase/config.h.in @@ -750,6 +750,9 @@ /* Define if libobjc has the _objc_unexpected_exception callback */ #undef HAVE_UNEXPECTED +/* Define to 1 if you have the header file. */ +#undef HAVE_UNICODE_UBRK_H + /* Define to 1 if you have the header file. */ #undef HAVE_UNICODE_UCAL_H @@ -792,6 +795,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_UNICODE_UTEXT_H +/* Define to 1 if you have the header file. */ +#undef HAVE_UNICODE_UTYPES_H + /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H diff --git a/Source/NSString.m b/Source/NSString.m index 5ca6aa1d2..e446a8ca5 100644 --- a/Source/NSString.m +++ b/Source/NSString.m @@ -66,11 +66,13 @@ #import "Foundation/NSLocale.h" #import "Foundation/NSLock.h" #import "Foundation/NSNotification.h" +#import "Foundation/NSObjCRuntime.h" #import "Foundation/NSScanner.h" #import "Foundation/NSUserDefaults.h" #import "Foundation/FoundationErrors.h" // For private method _decodePropertyListForKey: #import "Foundation/NSKeyedArchiver.h" +#import "GNUstepBase/GSBlocks.h" #import "GNUstepBase/GSMime.h" #import "GNUstepBase/NSString+GNUstepBase.h" #import "GNUstepBase/NSMutableString+GNUstepBase.h" @@ -102,24 +104,22 @@ #if defined(HAVE_UNICODE_UNORM2_H) # include #endif -#if defined(HAVE_UNICODE_USTRING_H) +#if defined(HAVE_UNICODE_USTRING_H) # include #endif -#if defined(HAVE_UNICODE_USEARCH_H) +#if defined(HAVE_UNICODE_USEARCH_H) # include #endif -#if defined(HAVE_ICU_H) +#if defined(HAVE_UNICODE_UBRK_H) +# include +#endif +#if defined(HAVE_UNICODE_UTYPES_H) +# include +#endif +#if defined(HAVE_ICU_H) # include #endif -#import "Foundation/NSObjCRuntime.h" -#import "GNUstepBase/GSBlocks.h" -#if GS_USE_ICU -#include -#include -#endif - - /* Create local inline versions of key functions for case-insensitive operations */ #import "Additions/unicode/caseconv.h" diff --git a/configure b/configure index 0f6e39724..e40c42cfe 100755 --- a/configure +++ b/configure @@ -13601,7 +13601,7 @@ else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } - for ac_header in unicode/uloc.h unicode/ulocdata.h unicode/ucol.h unicode/ucurr.h unicode/uregex.h unicode/ucal.h unicode/unorm2.h unicode/unum.h unicode/udat.h unicode/udatpg.h unicode/ustring.h unicode/usearch.h unicode/ucnv.h unicode/utext.h + for ac_header in unicode/uloc.h unicode/ulocdata.h unicode/ucol.h unicode/ucurr.h unicode/uregex.h unicode/ucal.h unicode/unorm2.h unicode/unum.h unicode/udat.h unicode/udatpg.h unicode/ustring.h unicode/usearch.h unicode/ucnv.h unicode/utext.h unicode/ubrk.h unicode/utypes.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" diff --git a/configure.ac b/configure.ac index 2d471697e..176d94a48 100644 --- a/configure.ac +++ b/configure.ac @@ -3571,7 +3571,7 @@ AS_IF([test "x$enable_icu" = "xyes"], [ esac if test $HAVE_ICU = 0; then PKG_CHECK_MODULES([ICU], [icu-i18n > 49.0], [ - AC_CHECK_HEADERS([unicode/uloc.h unicode/ulocdata.h unicode/ucol.h unicode/ucurr.h unicode/uregex.h unicode/ucal.h unicode/unorm2.h unicode/unum.h unicode/udat.h unicode/udatpg.h unicode/ustring.h unicode/usearch.h unicode/ucnv.h unicode/utext.h], + AC_CHECK_HEADERS([unicode/uloc.h unicode/ulocdata.h unicode/ucol.h unicode/ucurr.h unicode/uregex.h unicode/ucal.h unicode/unorm2.h unicode/unum.h unicode/udat.h unicode/udatpg.h unicode/ustring.h unicode/usearch.h unicode/ucnv.h unicode/utext.h unicode/ubrk.h unicode/utypes.h], HAVE_ICU=1)], [HAVE_ICU=0]) fi if test $HAVE_ICU = 0; then