40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
|
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
|
AX_CHECK_COMPILER_FLAGS(-Wshorten-64-to-32,
[OBJCFLAGS="$OBJCFLAGS -Wshorten-64-to-32"])
AX_CHECK_COMPILER_FLAGS(-Wsemicolon-before-method-body,
[OBJCFLAGS="$OBJCFLAGS -Wsemicolon-before-method-body"])
AX_CHECK_COMPILER_FLAGS(-Wno-objc-root-class,
[OBJCFLAGS="$OBJCFLAGS -Wno-objc-root-class"])
AC_MSG_CHECKING(whether Objective C compiler supports fast enumeration)
AC_TRY_COMPILE([
@protocol OFFastEnumeration
- (int)countByEnumeratingWithState: (void*)state
objects: (id*)objects
count: (int)count;
@end
], [
id n = (id)0;
for (id i in n);
], [
AC_DEFINE(OF_HAVE_FAST_ENUMERATION, 1,
[Compiler support for Fast Enumeration])
AC_MSG_RESULT(yes)
], [
AC_MSG_RESULT(no)
])
AC_MSG_CHECKING(whether Objective C compiler supports properties)
AC_TRY_COMPILE([
@interface Foo
{
id bar;
}
@property (retain, nonatomic) id bar;
@end
], [
Foo *foo = (id)0;
[foo setBar: (id)0];
[foo bar];
], [
AC_DEFINE(OF_HAVE_PROPERTIES, 1, [Compiler support for properties])
AC_SUBST(PROPERTIESTESTS_M, "PropertiesTests.m")
AC_MSG_RESULT(yes)
], [
AC_MSG_RESULT(no)
])
AC_MSG_CHECKING(whether Objective C compiler supports optional protocols)
AC_TRY_COMPILE([
@protocol Proto
@optional
+ (void)foo;
@end
@interface Foo <Proto>
@end
@implementation Foo
@end
], [
[Foo foo];
], [
AC_DEFINE(OF_HAVE_OPTIONAL_PROTOCOLS, 1,
[Compiler support for optional protocols])
AC_MSG_RESULT(yes)
], [
AC_MSG_RESULT(no)
])
AC_MSG_CHECKING(whether Objective C compiler supports blocks)
old_OBJCFLAGS="$OBJCFLAGS"
OBJCFLAGS="$OBJCFLAGS -fblocks"
AC_TRY_COMPILE([], [
int (^foo)(int bar);
foo = ^ (int bar) { return 0; }
], [
AC_DEFINE(OF_HAVE_BLOCKS, 1, [Compiler support for blocks])
AC_SUBST(BLOCKS_FLAGS, "-fblocks")
AC_SUBST(OFBLOCKTESTS_M, "OFBlockTests.m")
AC_MSG_RESULT(yes)
], [
AC_MSG_RESULT(no)
OBJCFLAGS="$old_OBJCFLAGS"
])
|