mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 09:04:13 +00:00
add config check for blocks
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@32539 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
ff94cec600
commit
46cf25ebed
7 changed files with 168 additions and 18 deletions
|
@ -1,3 +1,12 @@
|
|||
2011-03-13 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* configure.ac:
|
||||
* configure:
|
||||
* config.mak.in:
|
||||
* Source/GNUmakefile:
|
||||
* Headers/Additions/GNUstepBase/config.h.in:
|
||||
Add config check for blocks support.
|
||||
|
||||
2011-03-12 Stefan Bidigaray <stefanbidi@gmail.com>
|
||||
|
||||
* Source/NSNumberFormatter.m: Cache property values and reset them
|
||||
|
|
|
@ -456,18 +456,28 @@ GSIArrayInsertSortedNoRetain(GSIArray array, GSIArrayItem item,
|
|||
static INLINE void
|
||||
GSIArrayRemoveItemAtIndex(GSIArray array, unsigned index)
|
||||
{
|
||||
GSIArrayItem tmp;
|
||||
#ifdef GSI_ARRAY_CHECKS
|
||||
#if defined(GSI_ARRAY_NO_RELEASE)
|
||||
# ifdef GSI_ARRAY_CHECKS
|
||||
NSCAssert(index < array->count, NSInvalidArgumentException);
|
||||
#endif
|
||||
# endif
|
||||
while (++index < array->count)
|
||||
array->ptr[index-1] = array->ptr[index];
|
||||
array->count--;
|
||||
# if GS_WITH_GC
|
||||
array->ptr[array->count] = (GSIArrayItem)(NSUInteger)0;
|
||||
# endif
|
||||
#else
|
||||
GSIArrayItem tmp;
|
||||
# ifdef GSI_ARRAY_CHECKS
|
||||
NSCAssert(index < array->count, NSInvalidArgumentException);
|
||||
# endif
|
||||
tmp = array->ptr[index];
|
||||
while (++index < array->count)
|
||||
array->ptr[index-1] = array->ptr[index];
|
||||
array->count--;
|
||||
#if !defined(GS_NO_RELEASE)
|
||||
#if GS_WITH_GC
|
||||
# if GS_WITH_GC
|
||||
array->ptr[array->count] = (GSIArrayItem)(NSUInteger)0;
|
||||
#endif
|
||||
# endif
|
||||
GSI_ARRAY_RELEASE(array, tmp);
|
||||
#endif
|
||||
}
|
||||
|
@ -479,7 +489,7 @@ GSIArrayRemoveLastItem(GSIArray array)
|
|||
NSCAssert(array->count, NSInvalidArgumentException);
|
||||
#endif
|
||||
array->count--;
|
||||
#if !defined(GS_NO_RELEASE)
|
||||
#if !defined(GSI_ARRAY_NO_RELEASE)
|
||||
GSI_ARRAY_RELEASE(array, array->ptr[array->count]);
|
||||
#if GS_WITH_GC
|
||||
array->ptr[array->count] = (GSIArrayItem)(NSUInteger)0;
|
||||
|
@ -490,15 +500,13 @@ GSIArrayRemoveLastItem(GSIArray array)
|
|||
static INLINE void
|
||||
GSIArrayRemoveItemAtIndexNoRelease(GSIArray array, unsigned index)
|
||||
{
|
||||
GSIArrayItem tmp;
|
||||
#ifdef GSI_ARRAY_CHECKS
|
||||
NSCAssert(index < array->count, NSInvalidArgumentException);
|
||||
#endif
|
||||
tmp = array->ptr[index];
|
||||
while (++index < array->count)
|
||||
array->ptr[index-1] = array->ptr[index];
|
||||
array->count--;
|
||||
#if GS_WITH_GC && !defined(GS_NO_RELEASE)
|
||||
#if GS_WITH_GC && !defined(GSI_ARRAY_NO_RELEASE)
|
||||
array->ptr[array->count] = (GSIArrayItem)(NSUInteger)0;
|
||||
#endif
|
||||
}
|
||||
|
@ -506,14 +514,22 @@ GSIArrayRemoveItemAtIndexNoRelease(GSIArray array, unsigned index)
|
|||
static INLINE void
|
||||
GSIArraySetItemAtIndex(GSIArray array, GSIArrayItem item, unsigned index)
|
||||
{
|
||||
GSIArrayItem tmp;
|
||||
#ifdef GSI_ARRAY_CHECKS
|
||||
#if defined(GSI_ARRAY_NO_RELEASE)
|
||||
# ifdef GSI_ARRAY_CHECKS
|
||||
NSCAssert(index < array->count, NSInvalidArgumentException);
|
||||
#endif
|
||||
# endif
|
||||
GSI_ARRAY_RETAIN(array, item);
|
||||
array->ptr[index] = item;
|
||||
#else
|
||||
GSIArrayItem tmp;
|
||||
# ifdef GSI_ARRAY_CHECKS
|
||||
NSCAssert(index < array->count, NSInvalidArgumentException);
|
||||
# endif
|
||||
tmp = array->ptr[index];
|
||||
GSI_ARRAY_RETAIN(array, item);
|
||||
array->ptr[index] = item;
|
||||
GSI_ARRAY_RELEASE(array, tmp);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -672,6 +672,9 @@
|
|||
/* Define to 1 if you have the <zlib.h> header file. */
|
||||
#undef HAVE_ZLIB_H
|
||||
|
||||
/* Define to 1 if you have the `_Block_copy' function. */
|
||||
#undef HAVE__BLOCK_COPY
|
||||
|
||||
/* Define to 1 if you have the `__builtin_extract_return_address' function. */
|
||||
#undef HAVE___BUILTIN_EXTRACT_RETURN_ADDRESS
|
||||
|
||||
|
|
|
@ -65,17 +65,20 @@ LIBRARY_NAME += libgnustep-base
|
|||
endif
|
||||
|
||||
ifeq ($(OBJC2RUNTIME),0)
|
||||
libgnustep-base_SUBPROJECTS = ObjectiveC2
|
||||
libgnustep-baseadd_SUBPROJECTS += Additions
|
||||
libgnustep-base_SUBPROJECTS = ObjectiveC2
|
||||
else
|
||||
ifeq ($(HAVE_BLOCKS),0)
|
||||
libgnustep-base_SUBPROJECTS = ObjectiveC2
|
||||
endif
|
||||
endif
|
||||
|
||||
libgnustep-base_SUBPROJECTS += Additions
|
||||
libgnustep-baseadd_SUBPROJECTS += Additions
|
||||
|
||||
ifeq ($(GNUSTEP_TARGET_OS), mingw32)
|
||||
libgnustep-base_SUBPROJECTS+=win32
|
||||
libgnustep-base_SUBPROJECTS += win32
|
||||
else
|
||||
libgnustep-base_SUBPROJECTS+=unix
|
||||
libgnustep-base_SUBPROJECTS += unix
|
||||
endif
|
||||
|
||||
DEFS= -DGNUSTEP_TARGET_DIR=\"$(GNUSTEP_TARGET_DIR)\" \
|
||||
|
@ -149,6 +152,7 @@ BASE_MFILES = \
|
|||
CXXException.m\
|
||||
GSArray.m \
|
||||
GSAttributedString.m \
|
||||
GSBlocks.m \
|
||||
GSConcreteValue.m \
|
||||
GSCountedSet.m \
|
||||
GSDictionary.m \
|
||||
|
|
|
@ -12,6 +12,7 @@ DYNAMIC_LINKER=@DYNAMIC_LINKER@
|
|||
|
||||
HAVE_LIBXML=@HAVE_LIBXML@
|
||||
HAVE_GNUTLS=@HAVE_GNUTLS@
|
||||
HAVE_BLOCKS=@HAVE_BLOCKS@
|
||||
|
||||
WITH_FFI=@WITH_FFI@
|
||||
|
||||
|
|
108
configure
vendored
108
configure
vendored
|
@ -715,6 +715,7 @@ NX_CONST_STRING_OBJCFLAGS
|
|||
NX_CONST_STRING_CLASS
|
||||
OBJCSYNC
|
||||
OBJC2RUNTIME
|
||||
HAVE_BLOCKS
|
||||
OBJCFLAGS
|
||||
GS_NONFRAGILE
|
||||
GS_MIXEDABI
|
||||
|
@ -12949,6 +12950,110 @@ else
|
|||
fi
|
||||
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Check for blocks support in runtime
|
||||
#--------------------------------------------------------------------
|
||||
|
||||
for ac_func in _Block_copy
|
||||
do
|
||||
as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
|
||||
{ echo "$as_me:$LINENO: checking for $ac_func" >&5
|
||||
echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
|
||||
if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
|
||||
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||
else
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
/* confdefs.h. */
|
||||
_ACEOF
|
||||
cat confdefs.h >>conftest.$ac_ext
|
||||
cat >>conftest.$ac_ext <<_ACEOF
|
||||
/* end confdefs.h. */
|
||||
/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
|
||||
For example, HP-UX 11i <limits.h> declares gettimeofday. */
|
||||
#define $ac_func innocuous_$ac_func
|
||||
|
||||
/* System header to define __stub macros and hopefully few prototypes,
|
||||
which can conflict with char $ac_func (); below.
|
||||
Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
|
||||
<limits.h> exists even on freestanding compilers. */
|
||||
|
||||
#ifdef __STDC__
|
||||
# include <limits.h>
|
||||
#else
|
||||
# include <assert.h>
|
||||
#endif
|
||||
|
||||
#undef $ac_func
|
||||
|
||||
/* Override any GCC internal prototype to avoid an error.
|
||||
Use char because int might match the return type of a GCC
|
||||
builtin and then its argument prototype would still apply. */
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
char $ac_func ();
|
||||
/* The GNU C library defines this for functions which it implements
|
||||
to always fail with ENOSYS. Some functions are actually named
|
||||
something starting with __ and the normal name is an alias. */
|
||||
#if defined __stub_$ac_func || defined __stub___$ac_func
|
||||
choke me
|
||||
#endif
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
return $ac_func ();
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
rm -f conftest.$ac_objext conftest$ac_exeext
|
||||
if { (ac_try="$ac_link"
|
||||
case "(($ac_try" in
|
||||
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
|
||||
*) ac_try_echo=$ac_try;;
|
||||
esac
|
||||
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
|
||||
(eval "$ac_link") 2>conftest.er1
|
||||
ac_status=$?
|
||||
grep -v '^ *+' conftest.er1 >conftest.err
|
||||
rm -f conftest.er1
|
||||
cat conftest.err >&5
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } && {
|
||||
test -z "$ac_c_werror_flag" ||
|
||||
test ! -s conftest.err
|
||||
} && test -s conftest$ac_exeext &&
|
||||
$as_test_x conftest$ac_exeext; then
|
||||
eval "$as_ac_var=yes"
|
||||
else
|
||||
echo "$as_me: failed program was:" >&5
|
||||
sed 's/^/| /' conftest.$ac_ext >&5
|
||||
|
||||
eval "$as_ac_var=no"
|
||||
fi
|
||||
|
||||
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
|
||||
conftest$ac_exeext conftest.$ac_ext
|
||||
fi
|
||||
ac_res=`eval echo '${'$as_ac_var'}'`
|
||||
{ echo "$as_me:$LINENO: result: $ac_res" >&5
|
||||
echo "${ECHO_T}$ac_res" >&6; }
|
||||
if test `eval echo '${'$as_ac_var'}'` = yes; then
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
done
|
||||
|
||||
if test $ac_cv_func__Block_copy = yes ; then
|
||||
HAVE_BLOCKS=1
|
||||
else
|
||||
HAVE_BLOCKS=0
|
||||
fi
|
||||
|
||||
|
||||
# Don't revert any Objective-C flags as they are used in the next test
|
||||
|
||||
GS_NONFRAGILE=0
|
||||
|
@ -25028,6 +25133,7 @@ NX_CONST_STRING_OBJCFLAGS!$NX_CONST_STRING_OBJCFLAGS$ac_delim
|
|||
NX_CONST_STRING_CLASS!$NX_CONST_STRING_CLASS$ac_delim
|
||||
OBJCSYNC!$OBJCSYNC$ac_delim
|
||||
OBJC2RUNTIME!$OBJC2RUNTIME$ac_delim
|
||||
HAVE_BLOCKS!$HAVE_BLOCKS$ac_delim
|
||||
OBJCFLAGS!$OBJCFLAGS$ac_delim
|
||||
GS_NONFRAGILE!$GS_NONFRAGILE$ac_delim
|
||||
GS_MIXEDABI!$GS_MIXEDABI$ac_delim
|
||||
|
@ -25080,7 +25186,7 @@ LIBOBJS!$LIBOBJS$ac_delim
|
|||
LTLIBOBJS!$LTLIBOBJS$ac_delim
|
||||
_ACEOF
|
||||
|
||||
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 55; then
|
||||
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 56; then
|
||||
break
|
||||
elif $ac_last_try; then
|
||||
{ { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
|
||||
|
|
11
configure.ac
11
configure.ac
|
@ -1648,6 +1648,17 @@ else
|
|||
fi
|
||||
AC_SUBST(OBJC2RUNTIME)
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Check for blocks support in runtime
|
||||
#--------------------------------------------------------------------
|
||||
AC_CHECK_FUNCS(_Block_copy)
|
||||
if test $ac_cv_func__Block_copy = yes ; then
|
||||
HAVE_BLOCKS=1
|
||||
else
|
||||
HAVE_BLOCKS=0
|
||||
fi
|
||||
AC_SUBST(HAVE_BLOCKS)
|
||||
|
||||
# Don't revert any Objective-C flags as they are used in the next test
|
||||
|
||||
GS_NONFRAGILE=0
|
||||
|
|
Loading…
Reference in a new issue