ObjFW  Diff

Differences From Artifact [c10c411671]:

To Artifact [e02fcf3101]:


233
234
235
236
237
238
239
240
241
242



243
244
245
246
247
248
249
233
234
235
236
237
238
239



240
241
242
243
244
245
246
247
248
249







-
-
-
+
+
+







		AX_CHECK_COMPILER_FLAGS(-std=gnu99,
			[OBJCFLAGS="$OBJCFLAGS -std=gnu99"])
	])
])

AX_CHECK_COMPILER_FLAGS(-pipe, [OBJCFLAGS="$OBJCFLAGS -pipe"])
AX_CHECK_COMPILER_FLAGS(-fno-common, [OBJCFLAGS="$OBJCFLAGS -fno-common"])
AX_CHECK_COMPILER_FLAGS(-fno-constant-cfstrings, [
	OBJCFLAGS="$OBJCFLAGS -fno-constant-cfstrings"
	AC_SUBST(NO_CONST_CFSTRINGS, "-fno-constant-cfstrings")
AX_CHECK_COMPILER_FLAGS(-Xclang -fno-constant-cfstrings, [
	OBJCFLAGS="$OBJCFLAGS -Xclang -fno-constant-cfstrings"
	AC_SUBST(NO_CONST_CFSTRINGS, "-Xclang -fno-constant-cfstrings")
])
AX_CHECK_COMPILER_FLAGS([-Wsign-compare -Werror],
	[OBJCFLAGS="$OBJCFLAGS -Wsign-compare"])
AS_IF([test x"$with_nds" != x"yes"], [
	AX_CHECK_COMPILER_FLAGS([-Wshadow -Werror],
		[OBJCFLAGS="$OBJCFLAGS -Wshadow"])
])
414
415
416
417
418
419
420
421

422
423
424
425
426
427
428
414
415
416
417
418
419
420

421
422
423
424
425
426
427
428







-
+







	"ObjFW runtime")
		AC_DEFINE(OF_OBJFW_RUNTIME, 1,
			[Whether we use the ObjFW runtime])

		AC_MSG_CHECKING([whether -fobjc-runtime=objfw is supported])

		old_OBJCFLAGS="$OBJCFLAGS"
		OBJCFLAGS="$OBJCFLAGS -fobjc-runtime=objfw"
		OBJCFLAGS="$OBJCFLAGS -Xclang -fobjc-runtime=objfw"
		AC_TRY_LINK([
			#ifdef __has_attribute
			# if __has_attribute(objc_root_class)
			__attribute__((__objc_root_class__))
			# endif
			#endif
			@interface Test
444
445
446
447
448
449
450
451

452
453
454
455
456
457
458
444
445
446
447
448
449
450

451
452
453
454
455
456
457
458







-
+







			void
			__objc_exec_class(void *module)
			{
			}
		], [
			[Test test];
		], [
			RUNTIME_FLAGS="-fobjc-runtime=objfw"
			RUNTIME_FLAGS="-Xclang -fobjc-runtime=objfw"
			AC_MSG_RESULT(yes)
		], [
			RUNTIME_FLAGS="-fgnu-runtime"
			OBJCFLAGS="$old_OBJCFLAGS -fgnu-runtime"
			AC_MSG_RESULT(no)
			old_compiler="yes"
		])
898
899
900
901
902
903
904

905
906


907
908
909
910
911
912
913
898
899
900
901
902
903
904
905


906
907
908
909
910
911
912
913
914







+
-
-
+
+







	case "$host_os" in
	mingw*)
		AC_MSG_RESULT(WinAPI)
		;;
	*)
		AC_MSG_RESULT(POSIX)

		dnl Use -Wp, as we only use it for the preprocessor.
		AX_CHECK_COMPILER_FLAGS(-pthread, [
			CPPFLAGS="$CPPFLAGS -pthread"
		AX_CHECK_COMPILER_FLAGS(-Wp,-pthread, [
			CPPFLAGS="$CPPFLAGS -Wp,-pthread"
		], [
			CPPFLAGS="$CPPFLAGS -D_REENTRANT -D_THREAD_SAFE"
		])

		AC_CHECK_LIB(pthread, pthread_create, LIBS="$LIBS -lpthread")

		AC_TRY_LINK([
1477
1478
1479
1480
1481
1482
1483
1484

1485
1486
1487
1488
1489

1490
1491
1492
1493
1494
1495
1496
1478
1479
1480
1481
1482
1483
1484

1485
1486
1487
1488
1489

1490
1491
1492
1493
1494
1495
1496
1497







-
+




-
+







])

dnl This needs to be after all other header checks, as they include unistd.h,
dnl which in old glibc versions uses __block. This is worked around in the code
dnl by providing a wrapper for unistd.h which takes care of this.
AC_MSG_CHECKING(whether Objective C compiler supports blocks)
old_OBJCFLAGS="$OBJCFLAGS"
OBJCFLAGS="$OBJCFLAGS -fblocks"
OBJCFLAGS="$OBJCFLAGS -Xclang -fblocks"
AC_TRY_COMPILE([], [
	int (^foo)(int bar);
	foo = ^ (int bar) { return 0; }
], [
	AC_SUBST(BLOCKS_FLAGS, "-fblocks")
	AC_SUBST(BLOCKS_FLAGS, "-Xclang -fblocks")
	AC_SUBST(OFBLOCKTESTS_M, "OFBlockTests.m")
	AC_MSG_RESULT(yes)
], [
	AC_MSG_RESULT(no)
	OBJCFLAGS="$old_OBJCFLAGS"
])