@@ -676,10 +676,45 @@ AC_SUBST(TESTS_STATIC_LIB, tests.a) TESTS_LIBS="$TESTS_LIBS -framework CoreFoundation" ]) ;; esac + +AC_MSG_CHECKING(whether Objective C compiler supports ARC) +old_OBJCFLAGS="$OBJCFLAGS" +OBJCFLAGS="$OBJCFLAGS -fobjc-arc -fobjc-arc-exceptions" +AC_TRY_COMPILE([ + #ifdef __has_attribute + # if __has_attribute(objc_root_class) + __attribute__((__objc_root_class__)) + # endif + #endif + @interface Foo + { + struct objc_class *_isa; + } + + + (id)alloc; + @end + + @implementation Foo + + (id)alloc + { + return (id)0; + } + @end +], [ + __weak id foo = [Foo alloc]; + (void)foo; +], [ + AC_MSG_RESULT(yes) + AC_DEFINE(COMPILER_SUPPORTS_ARC, 1, [Whether the compiler supports ARC]) + AC_SUBST(RUNTIME_ARC_TESTS_M, RuntimeARCTests.m) +], [ + AC_MSG_RESULT(no) +]) +OBJCFLAGS="$old_OBJCFLAGS" AC_C_BIGENDIAN([ AC_DEFINE(OF_BIG_ENDIAN, 1, [Whether we are big endian]) ]) AS_IF([test x"$ac_cv_c_bigendian" = x"universal"], [