ObjFW  Check-in [1e740abed1]

Overview
Comment:configure: Style change: Don't indent cases
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 1e740abed13cf4d46cafa468ae83fa6d519aeb181124d613a9577ec43206d809
User & Date: js on 2020-12-22 22:56:47
Other Links: manifest | tags
Context
2020-12-22
23:04
Update buildsys check-in: 0a58a95122 user: js tags: trunk
22:56
configure: Style change: Don't indent cases check-in: 1e740abed1 user: js tags: trunk
21:47
Fix Wii build check-in: 25f3799288 user: js tags: trunk
Changes

Modified configure.ac from [4d3ef3b09a] to [cb217b6f7b].

20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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
123
124
125
126
127
128
129
130
131
AC_CANONICAL_HOST

dnl Used to disable checking for -pedantic on some platforms where it's broken
check_pedantic="yes"

case "$host" in
	arm-*-riscos*)
		AS_IF([test x"$OBJCFLAGS" = x""], [
			OBJCFLAGS="-O2 -g"
		])
		flags="-mfloat-abi=softfp -mfpu=vfp -mlibscl"
		ASFLAGS="$ASFLAGS -mfloat-abi=softfp -mfpu=vfp"
		OBJCFLAGS="$OBJCFLAGS $flags"
		OBJFW_OBJCFLAGS="$OBJFW_OBJCFLAGS $flags"
		LDFLAGS="$LDFLAGS $flags"

		enable_shared="no"
		enable_threads="no"
		enable_sockets="no"
		enable_files="no"
		;;
	m68k-*-amigaos*)
		AS_IF([test x"$OBJCFLAGS" = x""], [
			OBJCFLAGS="-O0"
		])
		OBJCFLAGS="$OBJCFLAGS -noixemul"
		OBJFW_OBJCFLAGS="$OBJFW_OBJCFLAGS -noixemul"
		CPPFLAGS="$CPPFLAGS -D__NO_NET_API"
		LDFLAGS="$LDFLAGS -noixemul"
		LIBS="$LIBS -ldebug"

		enable_files="yes"	# Required for reading ENV:
		enable_shared="no"
		supports_amiga_lib="yes"

		AS_IF([test x"$enable_amiga_lib" != x"no"], [
			AC_SUBST(OBJFWRT_AMIGA_LIB, objfwrt68k.library)
			AC_SUBST(SFDC_TARGET, m68k-amigaos)
			AC_SUBST(SFD_FILE, amigaos3.sfd)
			AC_SUBST(SFDC_INLINE_H, inline.h)
			dnl For 68000, GCC emits calls to helper functions that
			dnl do not work properly in a library.
			t="-mcpu=68020 -fbaserel -noixemul"
			AC_SUBST(AMIGA_LIB_CFLAGS, "$t -ffreestanding")
			t="$t -resident -nostartfiles -nodefaultlibs"
			t="$t -ldebug -lc"
			AC_SUBST(AMIGA_LIB_LDFLAGS, $t)
		])

		AC_SUBST(LIBBASES_M, libbases.m)
		;;
	powerpc-*-amigaos*)
		CPPFLAGS="$CPPFLAGS -D__USE_INLINE__"

		enable_files="yes"	# Required for reading ENV:
		enable_shared="no"

		AC_SUBST(LIBBASES_M, libbases.m)
		;;
	*-morphos*)
		AS_IF([test x"$OBJCFLAGS" = x""], [
			OBJCFLAGS="-O2 -g"
		])
		OBJCFLAGS="$OBJCFLAGS -noixemul"
		OBJFW_OBJCFLAGS="$OBJFW_OBJCFLAGS -noixemul"
		LDFLAGS="$LDFLAGS -noixemul"
		LIBS="$LIBS -ldebug"

		enable_files="yes"	# Required for reading ENV:
		enable_shared="no"
		supports_amiga_lib="yes"
		check_pedantic="no"	# Breaks generated inlines

		AS_IF([test x"$enable_amiga_lib" != x"no"], [
			AC_SUBST(OBJFWRT_AMIGA_LIB, objfwrt.library)
			AC_SUBST(CVINCLUDE_INLINE_H, inline.h)
			t="-mresident32 -ffreestanding -noixemul"
			AC_SUBST(AMIGA_LIB_CFLAGS, $t)
			t="-mresident32 -nostartfiles -nodefaultlibs"
			t="$t -noixemul -ldebug -lc"
			AC_SUBST(AMIGA_LIB_LDFLAGS, $t)
		])

		AC_SUBST(LIBBASES_M, libbases.m)
		;;
	*-msdosdjgpp*)
		enable_shared="no"
		enable_threads="no"
		enable_sockets="no"
		;;
	*-*-mingw*)
		LDFLAGS="$LDFLAGS -Wl,--allow-multiple-definition"
		LIBS="$LIBS -lversion"

		AC_SUBST(USE_SRCS_WINDOWS, '${SRCS_WINDOWS}')
		;;
	*-psp-*)
		AS_IF([test x"$DEVKITPSP" = x""], [
			AC_MSG_ERROR(
				[DEVKITPSP is not set! Please set DEVKITPSP.])
		])

		AS_IF([test x"$OBJCFLAGS" = x""], [
			OBJCFLAGS="-O2"
		])
		OBJCFLAGS="$OBJCFLAGS -G0"
		OBJFW_OBJCFLAGS="$OBJFW_OBJCFLAGS -G0"
		CPPFLAGS="$CPPFLAGS -I$DEVKITPSP/psp/sdk/include"
		LDFLAGS="$LDFLAGS -G0"
		LIBS="$LIBS -L$DEVKITPSP/psp/sdk/lib -lpspdebug -lpspdisplay"
		LIBS="$LIBS -lpspge -lpspctrl -lpspsdk -lc -lpspnet"
		LIBS="$LIBS -lpspnet_inet -lpspnet_apctl -lpspnet_resolver"







|
<
<












|
<
<

















|
|
|
<














|
<
<















|
<
|

















<
|


|
<
<







20
21
22
23
24
25
26
27


28
29
30
31
32
33
34
35
36
37
38
39
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
AC_CANONICAL_HOST

dnl Used to disable checking for -pedantic on some platforms where it's broken
check_pedantic="yes"

case "$host" in
	arm-*-riscos*)
	AS_IF([test x"$OBJCFLAGS" = x""], [OBJCFLAGS="-O2 -g"])


		flags="-mfloat-abi=softfp -mfpu=vfp -mlibscl"
		ASFLAGS="$ASFLAGS -mfloat-abi=softfp -mfpu=vfp"
		OBJCFLAGS="$OBJCFLAGS $flags"
		OBJFW_OBJCFLAGS="$OBJFW_OBJCFLAGS $flags"
		LDFLAGS="$LDFLAGS $flags"

		enable_shared="no"
		enable_threads="no"
		enable_sockets="no"
		enable_files="no"
		;;
	m68k-*-amigaos*)
	AS_IF([test x"$OBJCFLAGS" = x""], [OBJCFLAGS="-O0"])


		OBJCFLAGS="$OBJCFLAGS -noixemul"
		OBJFW_OBJCFLAGS="$OBJFW_OBJCFLAGS -noixemul"
		CPPFLAGS="$CPPFLAGS -D__NO_NET_API"
		LDFLAGS="$LDFLAGS -noixemul"
		LIBS="$LIBS -ldebug"

		enable_files="yes"	# Required for reading ENV:
		enable_shared="no"
		supports_amiga_lib="yes"

		AS_IF([test x"$enable_amiga_lib" != x"no"], [
			AC_SUBST(OBJFWRT_AMIGA_LIB, objfwrt68k.library)
			AC_SUBST(SFDC_TARGET, m68k-amigaos)
			AC_SUBST(SFD_FILE, amigaos3.sfd)
			AC_SUBST(SFDC_INLINE_H, inline.h)
			dnl For 68000, GCC emits calls to helper functions that
			dnl do not work properly in a library.
		t="-mcpu=68020 -fbaserel -noixemul -ffreestanding"
		AC_SUBST(AMIGA_LIB_CFLAGS, $t)
		t="$t -resident -nostartfiles -nodefaultlibs -ldebug -lc"

			AC_SUBST(AMIGA_LIB_LDFLAGS, $t)
		])

		AC_SUBST(LIBBASES_M, libbases.m)
		;;
	powerpc-*-amigaos*)
		CPPFLAGS="$CPPFLAGS -D__USE_INLINE__"

		enable_files="yes"	# Required for reading ENV:
		enable_shared="no"

		AC_SUBST(LIBBASES_M, libbases.m)
		;;
	*-morphos*)
	AS_IF([test x"$OBJCFLAGS" = x""], [OBJCFLAGS="-O2 -g"])


		OBJCFLAGS="$OBJCFLAGS -noixemul"
		OBJFW_OBJCFLAGS="$OBJFW_OBJCFLAGS -noixemul"
		LDFLAGS="$LDFLAGS -noixemul"
		LIBS="$LIBS -ldebug"

		enable_files="yes"	# Required for reading ENV:
		enable_shared="no"
		supports_amiga_lib="yes"
		check_pedantic="no"	# Breaks generated inlines

		AS_IF([test x"$enable_amiga_lib" != x"no"], [
			AC_SUBST(OBJFWRT_AMIGA_LIB, objfwrt.library)
			AC_SUBST(CVINCLUDE_INLINE_H, inline.h)
			t="-mresident32 -ffreestanding -noixemul"
			AC_SUBST(AMIGA_LIB_CFLAGS, $t)
		t="-mresident32 -nostartfiles -nodefaultlibs -noixemul -ldebug"

		AC_SUBST(AMIGA_LIB_LDFLAGS, "$t -lc")
		])

		AC_SUBST(LIBBASES_M, libbases.m)
		;;
	*-msdosdjgpp*)
		enable_shared="no"
		enable_threads="no"
		enable_sockets="no"
		;;
	*-*-mingw*)
		LDFLAGS="$LDFLAGS -Wl,--allow-multiple-definition"
		LIBS="$LIBS -lversion"

		AC_SUBST(USE_SRCS_WINDOWS, '${SRCS_WINDOWS}')
		;;
	*-psp-*)
		AS_IF([test x"$DEVKITPSP" = x""], [

		AC_MSG_ERROR([DEVKITPSP is not set! Please set DEVKITPSP.])
		])

	AS_IF([test x"$OBJCFLAGS" = x""], [OBJCFLAGS="-O2"])


		OBJCFLAGS="$OBJCFLAGS -G0"
		OBJFW_OBJCFLAGS="$OBJFW_OBJCFLAGS -G0"
		CPPFLAGS="$CPPFLAGS -I$DEVKITPSP/psp/sdk/include"
		LDFLAGS="$LDFLAGS -G0"
		LIBS="$LIBS -L$DEVKITPSP/psp/sdk/lib -lpspdebug -lpspdisplay"
		LIBS="$LIBS -lpspge -lpspctrl -lpspsdk -lc -lpspnet"
		LIBS="$LIBS -lpspnet_inet -lpspnet_apctl -lpspnet_resolver"
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
	: ${GREP:=grep.exe}
	: ${RANLIB:=ranlib.exe}
])

AC_LANG([Objective C])
case "$host_os" in
	morphos*)
		dnl Don't use clang on MorphOS - it does not support baserel,
		dnl which is required for the .library.
		potential_compilers="gcc"
		;;
	*)
		potential_compilers="clang egcc gcc"
		;;
esac
AC_PROG_OBJC($potential_compilers)







|
|







134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
	: ${GREP:=grep.exe}
	: ${RANLIB:=ranlib.exe}
])

AC_LANG([Objective C])
case "$host_os" in
	morphos*)
	dnl Don't use clang on MorphOS - it does not support baserel, which is
	dnl required for the .library.
		potential_compilers="gcc"
		;;
	*)
		potential_compilers="clang egcc gcc"
		;;
esac
AC_PROG_OBJC($potential_compilers)
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
301
302
303
304
305
306
307
308
309
310
311
312
dnl amiga-gcc requires -fexceptions in LDFLAGS in order to link in the glue code
dnl for registering the frames.
LDFLAGS="$LDFLAGS -fexceptions"

case "$OBJC" in
	*clang*)
		case "$host" in

			dnl Clang generates MIPS assembly not accepted by GNU
			dnl as, however, Clang's integrated assembler doesn't
			dnl accept everything used in ObjFW's assembly files.
			dnl Therefore, use the integrated assembler for ObjC
			dnl files, but not for assembly files.
			mips*-*-*)
				flag="-integrated-as"
				OBJCFLAGS="$OBJCFLAGS $flag"
				OBJFW_OBJCFLAGS="$OBJFW_OBJCFLAGS $flag"
				;;

			dnl Don't use -no-integrated-as on Darwin. It breaks
			dnl building for the iOS simulator.
			i?86-*-darwin* | x86_64-*-darwin*)
				;;
			dnl Many older Clang versions don't support jmp short.
			i?86-*-* | x86_64-*-*)

				ASFLAGS="$ASFLAGS -no-integrated-as"
				;;

			dnl Clang's assembler on Windows is not complete yet
			dnl and cannot compile all .S files.
			*-*-mingw*)
				ASFLAGS="$ASFLAGS -no-integrated-as"
				;;

			dnl Clang generates assembly output on SPARC64 that
			dnl OpenBSD's assembler does not accept.
			sparc64-*-*openbsd*)
				flag="-integrated-as"
				OBJCFLAGS="$OBJCFLAGS $flag"
				OBJFW_OBJCFLAGS="$OBJFW_OBJCFLAGS $flag"
				;;
		esac
		;;
esac

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

case "$build_os" in
	morphos*)
		# MorphOS 3.10 has a buggy ixemul that does not work with -pipe.
		;;
	*)
		AX_CHECK_COMPILER_FLAGS(-pipe, [OBJCFLAGS="$OBJCFLAGS -pipe"])
		;;
esac
AX_CHECK_COMPILER_FLAGS(-fno-common, [OBJCFLAGS="$OBJCFLAGS -fno-common"])
AX_CHECK_COMPILER_FLAGS(-Xclang -fno-constant-cfstrings, [
	flag="-Xclang -fno-constant-cfstrings"
	OBJCFLAGS="$OBJCFLAGS $flag"
	OBJFW_OBJCFLAGS="$OBJFW_OBJCFLAGS $flag"
])
AX_CHECK_COMPILER_FLAGS([-Wsign-compare -Werror],







>
|
|
|
|
|
<
<
|
|

>
|
|
<

<

>


>
|
|
<


>
|
|
<



















<
<
<
<
<

<
<







235
236
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
dnl amiga-gcc requires -fexceptions in LDFLAGS in order to link in the glue code
dnl for registering the frames.
LDFLAGS="$LDFLAGS -fexceptions"

case "$OBJC" in
	*clang*)
		case "$host" in
	mips*-*-*)
		dnl Clang generates MIPS assembly not accepted by GNU as,
		dnl however, Clang's integrated assembler doesn't accept
		dnl everything used in ObjFW's assembly files. Therefore, use
		dnl the integrated assembler for ObjC files, but not for
		dnl assembly files.


		OBJCFLAGS="$OBJCFLAGS -integrated-as"
		OBJFW_OBJCFLAGS="$OBJFW_OBJCFLAGS -integrated-as"
				;;
	i?86-*-darwin* | x86_64-*-darwin*)
		dnl Don't use -no-integrated-as on Darwin. It breaks building
		dnl for the iOS simulator.

				;;

			i?86-*-* | x86_64-*-*)
		dnl Many older Clang versions don't support jmp short.
				ASFLAGS="$ASFLAGS -no-integrated-as"
				;;
	*-*-mingw*)
		dnl Clang's assembler on Windows is not complete yet and cannot
		dnl compile all .S files.

				ASFLAGS="$ASFLAGS -no-integrated-as"
				;;
	sparc64-*-*openbsd*)
		dnl Clang generates assembly output on SPARC64 that OpenBSD's
		dnl assembler does not accept.

				flag="-integrated-as"
				OBJCFLAGS="$OBJCFLAGS $flag"
				OBJFW_OBJCFLAGS="$OBJFW_OBJCFLAGS $flag"
				;;
		esac
		;;
esac

AX_CHECK_COMPILER_FLAGS(-std=gnu11, [
	OBJCFLAGS="$OBJCFLAGS -std=gnu11"
], [
	AX_CHECK_COMPILER_FLAGS(-std=gnu1x, [
		OBJCFLAGS="$OBJCFLAGS -std=gnu1x"
	], [
		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(-Xclang -fno-constant-cfstrings, [
	flag="-Xclang -fno-constant-cfstrings"
	OBJCFLAGS="$OBJCFLAGS $flag"
	OBJFW_OBJCFLAGS="$OBJFW_OBJCFLAGS $flag"
])
AX_CHECK_COMPILER_FLAGS([-Wsign-compare -Werror],
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
AX_CHECK_COMPILER_FLAGS([-Wobjc-missing-property-synthesis -Werror],
	[OBJCFLAGS="$OBJCFLAGS -Wobjc-missing-property-synthesis"])
AX_CHECK_COMPILER_FLAGS([-Wmissing-method-return-type -Werror],
	[OBJCFLAGS="$OBJCFLAGS -Wmissing-method-return-type"])

case "$host" in
	m68k-*-amigaos*)
		dnl The inline headers generate code that triggers
		dnl -Wpointer-sign.
		OBJCFLAGS="$OBJCFLAGS -Wno-pointer-sign"
		;;
esac

AC_MSG_CHECKING(whether Objective C compiler supports properties)
AC_COMPILE_IFELSE([
	AC_LANG_PROGRAM([







|
<







305
306
307
308
309
310
311
312

313
314
315
316
317
318
319
AX_CHECK_COMPILER_FLAGS([-Wobjc-missing-property-synthesis -Werror],
	[OBJCFLAGS="$OBJCFLAGS -Wobjc-missing-property-synthesis"])
AX_CHECK_COMPILER_FLAGS([-Wmissing-method-return-type -Werror],
	[OBJCFLAGS="$OBJCFLAGS -Wmissing-method-return-type"])

case "$host" in
	m68k-*-amigaos*)
	dnl The inline headers generate code that triggers -Wpointer-sign.

		OBJCFLAGS="$OBJCFLAGS -Wno-pointer-sign"
		;;
esac

AC_MSG_CHECKING(whether Objective C compiler supports properties)
AC_COMPILE_IFELSE([
	AC_LANG_PROGRAM([
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
		])
	])
])
AC_MSG_RESULT($objc_runtime)

case "$objc_runtime" in
	"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 -Xclang -fobjc-runtime=objfw"
		AC_LINK_IFELSE([
			AC_LANG_PROGRAM([







|
<







460
461
462
463
464
465
466
467

468
469
470
471
472
473
474
		])
	])
])
AC_MSG_RESULT($objc_runtime)

case "$objc_runtime" in
	"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 -Xclang -fobjc-runtime=objfw"
		AC_LINK_IFELSE([
			AC_LANG_PROGRAM([
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
				__objc_exec_class(void *module)
				{
				}
			], [[
				[Test test];
			]])
		], [
			flag="-Xclang -fobjc-runtime=objfw"
			OBJFW_OBJCFLAGS="$OBJFW_OBJCFLAGS $flag"
			AC_MSG_RESULT(yes)
		], [
			flag="-fgnu-runtime"
			OBJCFLAGS="$old_OBJCFLAGS $flag"
			OBJFW_OBJCFLAGS="$OBJFW_OBJCFLAGS $flag"
			AC_MSG_RESULT(no)
			old_compiler="yes"
		])

		AC_SUBST(RUNTIME, "runtime")
		AC_CONFIG_FILES(src/runtime/Info.plist)








<
|


<
|
|







497
498
499
500
501
502
503

504
505
506

507
508
509
510
511
512
513
514
515
				__objc_exec_class(void *module)
				{
				}
			], [[
				[Test test];
			]])
		], [

		OBJFW_OBJCFLAGS="$OBJFW_OBJCFLAGS -Xclang -fobjc-runtime=objfw"
			AC_MSG_RESULT(yes)
		], [

		OBJCFLAGS="$old_OBJCFLAGS -fgnu-runtime"
		OBJFW_OBJCFLAGS="$OBJFW_OBJCFLAGS -fgnu-runtime"
			AC_MSG_RESULT(no)
			old_compiler="yes"
		])

		AC_SUBST(RUNTIME, "runtime")
		AC_CONFIG_FILES(src/runtime/Info.plist)

558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605

606
607
608
609
610
611
612
613
614

615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
			AC_SUBST(LIBOBJFWRT_DEP_LVL2, "../$tmp")
		], [
			AC_SUBST(RUNTIME_LIBS, "-lobjfwrt")
		])

		AS_IF([test x"$enable_shared" = x"no" \
				-a x"$enable_amiga_lib" = x"no"], [
			tmp="../src/runtime/libobjfwrt.a"
			AC_SUBST(LIBOBJFWRT_DEP, "$tmp")
			AC_SUBST(LIBOBJFWRT_DEP_LVL2, "../$tmp")
		])

		AS_IF([test x"$enable_seluid24" = x"yes"], [
			AC_DEFINE(OF_SELUID24, 1,
				[Whether to use 24 bit selector UIDs])
		])

		AC_MSG_CHECKING(for exception type)
		AC_COMPILE_IFELSE([
			AC_LANG_PROGRAM([
				extern void foo();
			], [
				@try {
					foo();
				} @finally {
					foo();
				}
			])
		], [
			AS_IF([$EGREP __gnu_objc_personality_v0 \
					conftest.$ac_objext >/dev/null], [
				exception_type="DWARF"
			])
			AS_IF([$EGREP __gnu_objc_personality_sj0 \
					conftest.$ac_objext >/dev/null], [
				exception_type="SjLj"
			])
			AS_IF([$EGREP __gnu_objc_personality_seh0 \
					conftest.$ac_objext >/dev/null], [
				exception_type="SEH"
			])

			raise_exception="_Unwind_RaiseException"

			case "$exception_type" in
			DWARF)
				AC_DEFINE(HAVE_DWARF_EXCEPTIONS, 1,
					[Whether DWARF exceptions are used])

				;;
			SjLj)
				AC_DEFINE(HAVE_SJLJ_EXCEPTIONS, 1,
					[Whether SjLj exceptions are used])
				raise_exception="_Unwind_SjLj_RaiseException"
				;;
			SEH)
				AC_DEFINE(HAVE_SEH_EXCEPTIONS, 1,
					[Whether SEH exceptions are used])

				;;
			*)
				AC_MSG_RESULT(unknown)
				AC_MSG_ERROR([Exception type not detected!])
				;;
			esac

			AC_MSG_RESULT($exception_type)
		], [
			AC_MSG_RESULT(exceptions unavailable!)
			AC_MSG_ERROR([Exceptions not accepted by compiler!])
		])

		AC_SEARCH_LIBS($raise_exception, [c++abi gcc_s gcc], [
			dnl c++abi requires pthread on OpenBSD
			AS_IF([test x"$ac_lib" = x"c++abi"], [
				LIBS="$LIBS -lpthread"
			])
		], [
			AC_MSG_ERROR([$raise_exception missing!])
		], [-lpthread])

		AC_CHECK_FUNCS(_Unwind_GetDataRelBase _Unwind_GetTextRelBase)
		;;
	"Apple runtime")
		AC_DEFINE(OF_APPLE_RUNTIME, 1,
			[Whether we use the Apple ObjC runtime])

		AC_CHECK_LIB(objc, objc_msgSend, [
			AC_SUBST(RUNTIME_LIBS, "-lobjc")
			AC_SUBST(RUNTIME_FRAMEWORK_LIBS, "-lobjc")
		], [
			AC_MSG_ERROR([libobjc not found!])
		])







<
|
|



|
<














|
|


|
|


|
|



<
<




>









>















|
<
<







|
<







535
536
537
538
539
540
541

542
543
544
545
546
547

548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574


575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605


606
607
608
609
610
611
612
613

614
615
616
617
618
619
620
			AC_SUBST(LIBOBJFWRT_DEP_LVL2, "../$tmp")
		], [
			AC_SUBST(RUNTIME_LIBS, "-lobjfwrt")
		])

		AS_IF([test x"$enable_shared" = x"no" \
				-a x"$enable_amiga_lib" = x"no"], [

		AC_SUBST(LIBOBJFWRT_DEP, "../src/runtime/libobjfwrt.a")
		AC_SUBST(LIBOBJFWRT_DEP_LVL2, "../../src/runtime/libobjfwrt.a")
		])

		AS_IF([test x"$enable_seluid24" = x"yes"], [
		AC_DEFINE(OF_SELUID24, 1, [Whether to use 24 bit selector UIDs])

		])

		AC_MSG_CHECKING(for exception type)
		AC_COMPILE_IFELSE([
			AC_LANG_PROGRAM([
				extern void foo();
			], [
				@try {
					foo();
				} @finally {
					foo();
				}
			])
		], [
		AS_IF([$EGREP __gnu_objc_personality_v0 conftest.$ac_objext \
		    >/dev/null], [
				exception_type="DWARF"
			])
		AS_IF([$EGREP __gnu_objc_personality_sj0 conftest.$ac_objext \
		    >/dev/null], [
				exception_type="SjLj"
			])
		AS_IF([$EGREP __gnu_objc_personality_seh0 conftest.$ac_objext \
		    >/dev/null], [
				exception_type="SEH"
			])



			case "$exception_type" in
			DWARF)
				AC_DEFINE(HAVE_DWARF_EXCEPTIONS, 1,
					[Whether DWARF exceptions are used])
			raise_exception="_Unwind_RaiseException"
				;;
			SjLj)
				AC_DEFINE(HAVE_SJLJ_EXCEPTIONS, 1,
					[Whether SjLj exceptions are used])
				raise_exception="_Unwind_SjLj_RaiseException"
				;;
			SEH)
				AC_DEFINE(HAVE_SEH_EXCEPTIONS, 1,
					[Whether SEH exceptions are used])
			raise_exception="_Unwind_RaiseException"
				;;
			*)
				AC_MSG_RESULT(unknown)
				AC_MSG_ERROR([Exception type not detected!])
				;;
			esac

			AC_MSG_RESULT($exception_type)
		], [
			AC_MSG_RESULT(exceptions unavailable!)
			AC_MSG_ERROR([Exceptions not accepted by compiler!])
		])

		AC_SEARCH_LIBS($raise_exception, [c++abi gcc_s gcc], [
			dnl c++abi requires pthread on OpenBSD
		AS_IF([test x"$ac_lib" = x"c++abi"], [LIBS="$LIBS -lpthread"])


		], [
			AC_MSG_ERROR([$raise_exception missing!])
		], [-lpthread])

		AC_CHECK_FUNCS(_Unwind_GetDataRelBase _Unwind_GetTextRelBase)
		;;
	"Apple runtime")
	AC_DEFINE(OF_APPLE_RUNTIME, 1, [Whether we use the Apple ObjC runtime])


		AC_CHECK_LIB(objc, objc_msgSend, [
			AC_SUBST(RUNTIME_LIBS, "-lobjc")
			AC_SUBST(RUNTIME_FRAMEWORK_LIBS, "-lobjc")
		], [
			AC_MSG_ERROR([libobjc not found!])
		])
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
AC_CHECK_FUNCS(_Unwind_Backtrace)

case "$host_os" in
	darwin*)
		AC_SUBST(LDFLAGS_REEXPORT, ["-Wl,-reexport-lobjfw"])
		AS_IF([test x"$objc_runtime" = x"Apple runtime"], [
			AC_SUBST(REEXPORT_RUNTIME, ["-Wl,-reexport-lobjc"])
			AC_SUBST(REEXPORT_RUNTIME_FRAMEWORK,
				["-Wl,-reexport-lobjc"])
			LDFLAGS="$LDFLAGS -Wl,-U,_NSFoundationVersionNumber"
		])

		AS_IF([test x"$objc_runtime" = x"ObjFW runtime"], [
			AS_IF([test x"$exception_type" = x"DWARF"], [
				LDFLAGS="$LDFLAGS -Wl,-U,___gxx_personality_v0"
			])







|
<







636
637
638
639
640
641
642
643

644
645
646
647
648
649
650
AC_CHECK_FUNCS(_Unwind_Backtrace)

case "$host_os" in
	darwin*)
		AC_SUBST(LDFLAGS_REEXPORT, ["-Wl,-reexport-lobjfw"])
		AS_IF([test x"$objc_runtime" = x"Apple runtime"], [
			AC_SUBST(REEXPORT_RUNTIME, ["-Wl,-reexport-lobjc"])
		AC_SUBST(REEXPORT_RUNTIME_FRAMEWORK, ["-Wl,-reexport-lobjc"])

			LDFLAGS="$LDFLAGS -Wl,-U,_NSFoundationVersionNumber"
		])

		AS_IF([test x"$objc_runtime" = x"ObjFW runtime"], [
			AS_IF([test x"$exception_type" = x"DWARF"], [
				LDFLAGS="$LDFLAGS -Wl,-U,___gxx_personality_v0"
			])
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
		[Floating point implementation does not conform to IEEE 754!])])

case "$host_cpu" in
	arm* | earm*)
		AC_MSG_CHECKING(for VFP2 or above)
		AC_COMPILE_IFELSE([
			AC_LANG_PROGRAM([], [
				#if !defined(__arm64__) && \
				    !defined(__aarch64__) && \
				    !defined(__ARM64_ARCH_8__)
				__asm__ __volatile__ (
				    "vstmdb	sp!, {d0-d7}"
				);
				#endif
			])
		], [







|
<







789
790
791
792
793
794
795
796

797
798
799
800
801
802
803
		[Floating point implementation does not conform to IEEE 754!])])

case "$host_cpu" in
	arm* | earm*)
		AC_MSG_CHECKING(for VFP2 or above)
		AC_COMPILE_IFELSE([
			AC_LANG_PROGRAM([], [
			#if !defined(__arm64__) && !defined(__aarch64__) && \

				    !defined(__ARM64_ARCH_8__)
				__asm__ __volatile__ (
				    "vstmdb	sp!, {d0-d7}"
				);
				#endif
			])
		], [
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866

AC_CHECK_LIB(m, fmod, LIBS="$LIBS -lm")
AC_CHECK_LIB(complex, creal, TESTS_LIBS="$TESTS_LIBS -lcomplex")

AC_CHECK_FUNC(asprintf, [
	case "$host" in
		*-*-mingw*)
			dnl asprintf from MinGW is broken on older Windows
			dnl versions
			have_asprintf="no"
			;;
		*-psp-*)
			dnl asprintf is broken on the PSP
			have_asprintf="no"
			;;
		*)
			have_asprintf="yes"
			AC_DEFINE(HAVE_ASPRINTF, 1,
				[Whether we have asprintf()])
		;;
	esac
], [
	have_asprintf="no"
])

AC_ARG_ENABLE(unicode-tables,







|
<








|
<







811
812
813
814
815
816
817
818

819
820
821
822
823
824
825
826
827

828
829
830
831
832
833
834

AC_CHECK_LIB(m, fmod, LIBS="$LIBS -lm")
AC_CHECK_LIB(complex, creal, TESTS_LIBS="$TESTS_LIBS -lcomplex")

AC_CHECK_FUNC(asprintf, [
	case "$host" in
		*-*-mingw*)
		dnl asprintf from MinGW is broken on older Windows versions

			have_asprintf="no"
			;;
		*-psp-*)
			dnl asprintf is broken on the PSP
			have_asprintf="no"
			;;
		*)
			have_asprintf="yes"
		AC_DEFINE(HAVE_ASPRINTF, 1, [Whether we have asprintf()])

		;;
	esac
], [
	have_asprintf="no"
])

AC_ARG_ENABLE(unicode-tables,
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
AS_IF([test x"$host_os" != x"morphos"], [
	AC_CHECK_LIB(dl, dlopen, LIBS="$LIBS -ldl")
])
AC_CHECK_HEADERS_ONCE(dlfcn.h)
case "$host_os" in
	netbsd*)
		dnl dladdr exists on NetBSD, but it is completely broken.
		dnl When using it with code that uses __thread, it freezes the
		dnl process so that it has to be killed using SIGKILL.
		dnl When disabling __thread, it doesn't freeze, but all symbols
		dnl are wrong.
		;;
	*)
		AC_CHECK_FUNCS(dladdr)
		;;
esac

AC_CHECK_HEADERS(sys/mman.h)







|
|
|
|







877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
AS_IF([test x"$host_os" != x"morphos"], [
	AC_CHECK_LIB(dl, dlopen, LIBS="$LIBS -ldl")
])
AC_CHECK_HEADERS_ONCE(dlfcn.h)
case "$host_os" in
	netbsd*)
		dnl dladdr exists on NetBSD, but it is completely broken.
	dnl When using it with code that uses __thread, it freezes the process
	dnl so that it has to be killed using SIGKILL.
	dnl When disabling __thread, it doesn't freeze, but all symbols are
	dnl wrong.
		;;
	*)
		AC_CHECK_FUNCS(dladdr)
		;;
esac

AC_CHECK_HEADERS(sys/mman.h)
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017

1018
1019
1020
1021
1022
1023
1024

	AC_ARG_ENABLE(compiler-tls,
		AS_HELP_STRING([--disable-compiler-tls],
			[disable compiler thread local storage]))

	case "$host" in
		aarch64*-*-android*)
			# Compiler TLS is broken on AArch64 Android with Clang
			enable_compiler_tls="no"
			;;
		m68k-*-amigaos* | powerpc-*-amigaos*)
			# Compiler TLS is broken on AmigaOS
			enable_compiler_tls="no"
			;;
		*-*-morphos*)
			# Compiler TLS needs helpers that we don't want in the
			# .library
			enable_compiler_tls="no"

	esac

	AS_IF([test x"$enable_compiler_tls" != x"no"], [
		AC_CHECK_HEADER(threads.h, [
			AC_DEFINE(OF_HAVE_THREADS_H, 1,
				[Whether we have threads.h])
		])







|



|



|
|

>







968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993

	AC_ARG_ENABLE(compiler-tls,
		AS_HELP_STRING([--disable-compiler-tls],
			[disable compiler thread local storage]))

	case "$host" in
		aarch64*-*-android*)
		dnl Compiler TLS is broken on AArch64 Android with Clang
			enable_compiler_tls="no"
			;;
		m68k-*-amigaos* | powerpc-*-amigaos*)
		dnl Compiler TLS is broken on AmigaOS
			enable_compiler_tls="no"
			;;
		*-*-morphos*)
		dnl Compiler TLS needs helpers that we don't want in the
		dnl .library
			enable_compiler_tls="no"
		;;
	esac

	AS_IF([test x"$enable_compiler_tls" != x"no"], [
		AC_CHECK_HEADER(threads.h, [
			AC_DEFINE(OF_HAVE_THREADS_H, 1,
				[Whether we have threads.h])
		])
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206

	case "$host_os" in
		msdosdjgpp*)
			dnl DJGPP has the type, but it's not really usable.
			;;
		*)
			AC_CHECK_TYPE(off64_t, [
				AC_DEFINE(OF_HAVE_OFF64_T, 1,
					[Whether we have off64_t])
				AC_CHECK_FUNCS([lseek64 lstat64 open64 stat64])
			])
			;;
	esac

	AC_CHECK_HEADERS([pwd.h grp.h])
	AC_CHECK_FUNC(chmod, [







|
<







1160
1161
1162
1163
1164
1165
1166
1167

1168
1169
1170
1171
1172
1173
1174

	case "$host_os" in
		msdosdjgpp*)
			dnl DJGPP has the type, but it's not really usable.
			;;
		*)
			AC_CHECK_TYPE(off64_t, [
			AC_DEFINE(OF_HAVE_OFF64_T, 1, [Whether we have off64_t])

				AC_CHECK_FUNCS([lseek64 lstat64 open64 stat64])
			])
			;;
	esac

	AC_CHECK_HEADERS([pwd.h grp.h])
	AC_CHECK_FUNC(chmod, [
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
AC_ARG_ENABLE(sockets,
	AS_HELP_STRING([--disable-sockets], [disable socket support]))
AS_IF([test x"$enable_sockets" != x"no"], [
	AC_DEFINE(OF_HAVE_SOCKETS, 1, [Whether we have sockets])
	AC_SUBST(USE_SRCS_SOCKETS, '${SRCS_SOCKETS}')

	case "$host_os" in
		amigaos*)
			;;
		haiku*)
			LIBS="$LIBS -lnetwork"
			;;
		mingw*)
			LIBS="$LIBS -lws2_32 -liphlpapi"
			;;







|







1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
AC_ARG_ENABLE(sockets,
	AS_HELP_STRING([--disable-sockets], [disable socket support]))
AS_IF([test x"$enable_sockets" != x"no"], [
	AC_DEFINE(OF_HAVE_SOCKETS, 1, [Whether we have sockets])
	AC_SUBST(USE_SRCS_SOCKETS, '${SRCS_SOCKETS}')

	case "$host_os" in
	amigaos* | morphos*)
			;;
		haiku*)
			LIBS="$LIBS -lnetwork"
			;;
		mingw*)
			LIBS="$LIBS -lws2_32 -liphlpapi"
			;;
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
			AC_SUBST(OF_POLL_KERNEL_EVENT_OBSERVER_M,
				"OFPollKernelEventObserver.m")
		])
	])

	case "$host_os" in
		amigaos* | mingw* | morphos*)
			AC_DEFINE(HAVE_SELECT, 1,
				[Whether we have select() or similar])
			AC_SUBST(OF_SELECT_KERNEL_EVENT_OBSERVER_M,
				"OFSelectKernelEventObserver.m")
			;;
		*)
			AC_CHECK_HEADERS(sys/select.h)
			AC_CHECK_FUNC(select, [
				AC_DEFINE(HAVE_SELECT, 1,







|
<







1466
1467
1468
1469
1470
1471
1472
1473

1474
1475
1476
1477
1478
1479
1480
			AC_SUBST(OF_POLL_KERNEL_EVENT_OBSERVER_M,
				"OFPollKernelEventObserver.m")
		])
	])

	case "$host_os" in
		amigaos* | mingw* | morphos*)
		AC_DEFINE(HAVE_SELECT, 1, [Whether we have select() or similar])

			AC_SUBST(OF_SELECT_KERNEL_EVENT_OBSERVER_M,
				"OFSelectKernelEventObserver.m")
			;;
		*)
			AC_CHECK_HEADERS(sys/select.h)
			AC_CHECK_FUNC(select, [
				AC_DEFINE(HAVE_SELECT, 1,
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571

case "$host_os" in
	darwin*)
		AC_MSG_CHECKING(whether we are compiling for macOS)
		AC_EGREP_CPP(egrep_cpp_yes, [
			#include <TargetConditionals.h>

			#if (!defined(TARGET_OS_IPHONE) || \
			    !TARGET_OS_IPHONE) && \
			    (!defined(TARGET_OS_SIMULATOR) || \
			    !TARGET_OS_SIMULATOR)
			egrep_cpp_yes
			#endif
		], [
			AC_MSG_RESULT(yes)
			have_processes="yes"
		], [
			AC_MSG_RESULT(no)







|
<
|
<







1521
1522
1523
1524
1525
1526
1527
1528

1529

1530
1531
1532
1533
1534
1535
1536

case "$host_os" in
	darwin*)
		AC_MSG_CHECKING(whether we are compiling for macOS)
		AC_EGREP_CPP(egrep_cpp_yes, [
			#include <TargetConditionals.h>

		#if (!defined(TARGET_OS_IPHONE) || !TARGET_OS_IPHONE) && \

		    (!defined(TARGET_OS_SIMULATOR) || !TARGET_OS_SIMULATOR)

			egrep_cpp_yes
			#endif
		], [
			AC_MSG_RESULT(yes)
			have_processes="yes"
		], [
			AC_MSG_RESULT(no)