124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
|
AC_SUBST(OFBLOCKTESTS_M, "OFBlockTests.m")
AC_MSG_RESULT(yes)
], [
AC_MSG_RESULT(no)
OBJCFLAGS="$old_OBJCFLAGS"
])
AC_CHECK_HEADERS([objfw-rt.h objc/objc.h])
test x"$ac_cv_header_objfw_rt_h" = x"yes" && objc_runtime="ObjFW-RT"
AC_MSG_CHECKING(which Objective C runtime we use)
AS_IF([test x"$ac_cv_header_objc_objc_h" = x"yes"], [
dnl Only accept it if it's from gcc >= 4.7, as the one in 4.6 is buggy
dnl when using the new API.
AC_EGREP_CPP(yes, [
#import <objc/objc.h>
#if defined(__GNU_LIBOBJC__) && __GNU_LIBOBJC__ >= 20110608
yes
#endif
], [
test x"$objc_runtime" = x"" && objc_runtime="GNU"
], [
dnl TODO: This is ugly. Let's think of a better check.
AC_EGREP_CPP(yes, [
#import <objc/objc.h>
#ifdef __objc_INCLUDE_GNU
yes
#endif
], [
test x"$objc_runtime" = x"" && objc_runtime="old GNU"
], [
objc_runtime="Apple"
])
])
])
AC_MSG_RESULT($objc_runtime)
case $objc_runtime in
ObjFW-RT)
AC_DEFINE(OF_OBJFW_RUNTIME, 1,
[Whether we use the ObjFW runtime])
AC_SUBST(GNU_RUNTIME, "-fgnu-runtime")
OBJCFLAGS="$OBJCFLAGS -fgnu-runtime"
AC_CHECK_LIB(objfw-rt, objc_msg_lookup, [
LIBS="-lobjfw-rt $LIBS"
], [
AC_MSG_ERROR([libobjfw-rt not found!])
])
;;
Apple)
AC_DEFINE(OF_APPLE_RUNTIME, 1,
[Whether we use the Apple ObjC runtime])
AC_CHECK_LIB(objc, objc_msgSend, [
LIBS="-lobjc $LIBS"
], [
AC_MSG_ERROR([libobjc not found!])
])
;;
GNU)
AC_DEFINE(OF_GNU_RUNTIME, 1,
[Whether we use the GNU ObjC runtime])
AC_CHECK_LIB(objc, objc_msg_lookup, [
LIBS="-lobjc $LIBS"
], [
AC_MSG_ERROR([libobjc not found!])
])
;;
"old GNU")
AC_DEFINE(OF_OLD_GNU_RUNTIME, 1,
[Whether we use the old GNU ObjC runtime])
AC_CHECK_LIB(objc, objc_msg_lookup, [
LIBS="-lobjc $LIBS"
], [
AC_MSG_ERROR([libobjc not found!])
])
;;
*)
AC_MSG_RESULT(none)
AC_MSG_ERROR(No ObjC runtime found! Please install ObjFW-RT!)
;;
esac
AC_CHECK_FUNC(objc_getProperty,, [
AC_DEFINE(NEED_OBJC_PROPERTIES_INIT, 1,
[Whether objc_properties_init needs to be called])
AC_SUBST(OBJC_PROPERTIES_M, "objc_properties.m")
])
|
<
<
|
|
|
<
<
<
<
<
<
<
<
<
<
|
|
|
|
|
|
|
|
|
|
|
|
<
|
<
<
<
<
<
<
|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
|
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
|
AC_SUBST(OFBLOCKTESTS_M, "OFBlockTests.m")
AC_MSG_RESULT(yes)
], [
AC_MSG_RESULT(no)
OBJCFLAGS="$old_OBJCFLAGS"
])
objc_runtime="ObjFW runtime"
AC_CHECK_HEADER(objc/objc.h)
AC_MSG_CHECKING(which Objective C runtime to use)
AS_IF([test x"$ac_cv_header_objc_objc_h" = x"yes"], [
dnl TODO: This is ugly. Let's think of a better check.
AC_EGREP_CPP(yes, [
#import <objc/objc.h>
#ifdef __objc_INCLUDE_GNU
yes
#endif
], [
dnl We don't want the GNU runtime
], [
objc_runtime="Apple runtime"
])
])
AC_MSG_RESULT($objc_runtime)
case $objc_runtime in
"ObjFW runtime")
AC_DEFINE(OF_OBJFW_RUNTIME, 1,
[Whether we use the ObjFW runtime])
AC_SUBST(GNU_RUNTIME, "-fgnu-runtime")
OBJCFLAGS="$OBJCFLAGS -fgnu-runtime"
;;
"Apple runtime")
AC_DEFINE(OF_APPLE_RUNTIME, 1,
[Whether we use the Apple ObjC runtime])
AC_CHECK_LIB(objc, objc_msgSend, [
LIBS="-lobjc $LIBS"
], [
AC_MSG_ERROR([libobjc not found!])
])
;;
esac
AC_CHECK_FUNC(objc_getProperty,, [
AC_DEFINE(NEED_OBJC_PROPERTIES_INIT, 1,
[Whether objc_properties_init needs to be called])
AC_SUBST(OBJC_PROPERTIES_M, "objc_properties.m")
])
|
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
|
AC_MSG_RESULT($have_threadsafe_getaddrinfo)
])
], [
AC_MSG_RESULT(no)
])
AS_IF([test x"$objc_runtime" = x"Apple"], [
AC_CHECK_HEADER(Foundation/NSObject.h, [
AC_SUBST(FOUNDATION_COMPAT_M, "foundation-compat.m")
])
])
AS_IF([test x"$GOBJC" = x"yes"], [
OBJCFLAGS="$OBJCFLAGS -Wwrite-strings -Wpointer-arith -Werror"
|
|
|
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
|
AC_MSG_RESULT($have_threadsafe_getaddrinfo)
])
], [
AC_MSG_RESULT(no)
])
AS_IF([test x"$objc_runtime" = x"Apple runtime"], [
AC_CHECK_HEADER(Foundation/NSObject.h, [
AC_SUBST(FOUNDATION_COMPAT_M, "foundation-compat.m")
])
])
AS_IF([test x"$GOBJC" = x"yes"], [
OBJCFLAGS="$OBJCFLAGS -Wwrite-strings -Wpointer-arith -Werror"
|