ObjFW  Check-in [b1fa976eaa]

Overview
Comment:Check for M_PI and define it if it's missing.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: b1fa976eaabf236852ee8937dd5cff48a76e78902811b15bfb08786705f7a00a
User & Date: js on 2011-06-17 00:29:34
Other Links: manifest | tags
Context
2011-06-17
00:35
Add -[removeLastItem] and -[removeLastObject]. check-in: 5a127a0804 user: js tags: trunk
00:29
Check for M_PI and define it if it's missing. check-in: b1fa976eaa user: js tags: trunk
2011-06-16
02:33
-[readNBytes:intoBuffer:] & -[writeNBytes:fromBuffer:] take a void* now. check-in: 8440a70457 user: js tags: trunk
Changes

Modified configure.ac from [58f6a32a5a] to [fd2d4b283c].

215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
		;;
esac

AC_C_BIGENDIAN([
	AC_DEFINE(OF_BIG_ENDIAN, 1, [Whether we are big endian])
])

AC_CHECK_SIZEOF(float)
AC_CHECK_SIZEOF(double)
AS_IF([test x"$ac_cv_sizeof_float" != x"4" -o x"$ac_cv_sizeof_double" != x"8"],
	[AC_MSG_ERROR(
		[Floating point implementation does not conform to IEEE 754!])])

AC_MSG_CHECKING(for floating point endianess)
float_endianess="unknown"
AC_TRY_COMPILE([
	double endianess = 184092775106.859375;
], [
], [
	AS_IF([$EGREP BEndian conftest.$ac_objext >/dev/null], [
		AC_DEFINE(OF_FLOAT_BIG_ENDIAN, 1,
			[Whether floats are big endian])
		float_endianess="big endian"
	], [
		AS_IF([$EGREP naidnEB conftest.$ac_objext >/dev/null], [
			float_endianess="little endian"
		])
	])
])
AC_MSG_RESULT($float_endianess)
AS_IF([test x"$float_endianess" = x"unknown"], [
	AC_MSG_ERROR(
		[Floating point implementation does not conform to IEEE 754!])])

AC_MSG_CHECKING(for SIZE_MAX)
AC_EGREP_CPP(yes, [
	#include <stdint.h>
	#include <limits.h>

	#ifdef SIZE_MAX
	yes







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







215
216
217
218
219
220
221



























222
223
224
225
226
227
228
		;;
esac

AC_C_BIGENDIAN([
	AC_DEFINE(OF_BIG_ENDIAN, 1, [Whether we are big endian])
])




























AC_MSG_CHECKING(for SIZE_MAX)
AC_EGREP_CPP(yes, [
	#include <stdint.h>
	#include <limits.h>

	#ifdef SIZE_MAX
	yes
264
265
266
267
268
269
270
271

272
273
274
275
276











































277
278
279
280
281
282
283
		#include <limits.h>

		#ifdef SIZE_T_MAX
		yes
		#endif
	], [
		AC_MSG_RESULT(yes)
		size_max="SIZE_T_MAX"], [

		AC_MSG_RESULT(no)
		size_max="(~(size_t)0)"
	])
	AC_DEFINE_UNQUOTED(SIZE_MAX, $size_max, [Maximum value for size_t])
])












































AC_CHECK_FUNC(asprintf, [
	case "$host" in
		*-psp-*)
			dnl asprintf is broken on the PSP, but snprintf works.
			have_asprintf="no"
			AC_SUBST(ASPRINTF_M, "asprintf.m")







|
>





>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
		#include <limits.h>

		#ifdef SIZE_T_MAX
		yes
		#endif
	], [
		AC_MSG_RESULT(yes)
		size_max="SIZE_T_MAX"
	], [
		AC_MSG_RESULT(no)
		size_max="(~(size_t)0)"
	])
	AC_DEFINE_UNQUOTED(SIZE_MAX, $size_max, [Maximum value for size_t])
])

AC_CHECK_SIZEOF(float)
AC_CHECK_SIZEOF(double)
AS_IF([test x"$ac_cv_sizeof_float" != x"4" -o x"$ac_cv_sizeof_double" != x"8"],
	[AC_MSG_ERROR(
		[Floating point implementation does not conform to IEEE 754!])])

AC_MSG_CHECKING(for floating point endianess)
fp_endianess="unknown"
AC_TRY_COMPILE([
	double endianess = 184092775106.859375;
], [
], [
	AS_IF([$EGREP BEndian conftest.$ac_objext >/dev/null], [
		AC_DEFINE(OF_FLOAT_BIG_ENDIAN, 1,
			[Whether floats are big endian])
		fp_endianess="big endian"
	], [
		AS_IF([$EGREP naidnEB conftest.$ac_objext >/dev/null], [
			fp_endianess="little endian"
		])
	])
])
AC_MSG_RESULT($fp_endianess)
AS_IF([test x"$fp_endianess" = x"unknown"], [
	AC_MSG_ERROR(
		[Floating point implementation does not conform to IEEE 754!])])

AC_CHECK_LIB(m, fmod, LIBS="$LIBS -lm")

AC_MSG_CHECKING(for M_PI)
AC_EGREP_CPP(yes, [
	#include <math.h>

	#ifdef M_PI
	yes
	#endif
], [
	AC_MSG_RESULT(yes)
], [
	AC_MSG_RESULT(no)
	AC_DEFINE(M_PI, 3.141592653589793238462643, [Precalculated Pi])
])

AC_CHECK_FUNC(asprintf, [
	case "$host" in
		*-psp-*)
			dnl asprintf is broken on the PSP, but snprintf works.
			have_asprintf="no"
			AC_SUBST(ASPRINTF_M, "asprintf.m")
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
		])
	])
	AC_MSG_RESULT($ac_cv_snprintf_useful_ret)
])
test x"$have_asprintf" != x"yes" -a x"$ac_cv_snprintf_useful_ret" != x"yes" && \
	AC_MSG_ERROR(No asprintf and no snprintf returning required space!)

AC_CHECK_LIB(m, fmod, LIBS="$LIBS -lm")
AC_CHECK_LIB(dl, dlopen, LIBS="$LIBS -ldl")

AC_ARG_ENABLE(threads,
	AS_HELP_STRING([--disable-threads], [disable thread support]))
AS_IF([test x"$enable_threads" != x"no"], [
	case "$host_os" in
	mingw*)







<







330
331
332
333
334
335
336

337
338
339
340
341
342
343
		])
	])
	AC_MSG_RESULT($ac_cv_snprintf_useful_ret)
])
test x"$have_asprintf" != x"yes" -a x"$ac_cv_snprintf_useful_ret" != x"yes" && \
	AC_MSG_ERROR(No asprintf and no snprintf returning required space!)


AC_CHECK_LIB(dl, dlopen, LIBS="$LIBS -ldl")

AC_ARG_ENABLE(threads,
	AS_HELP_STRING([--disable-threads], [disable thread support]))
AS_IF([test x"$enable_threads" != x"no"], [
	case "$host_os" in
	mingw*)