ObjFW  Check-in [538ceacc2f]

Overview
Comment:objfw-config: Don't reproduce flags from configure

Some distributions pass LDFLAGS and LIBS to configure that are specific
to building a distribution package, which then causes problems when
using objfw-config outside of this environment.

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 538ceacc2f288417ad9c1c879f79e0bda4b133be7bab0f3ee6e912735344faa1
User & Date: js on 2024-08-31 00:11:06
Other Links: manifest | tags
Context
2024-08-31
09:28
Add manpage for objfw-config check-in: 12f95ec46a user: js tags: trunk
00:15
objfw-config: Don't reproduce flags from configure check-in: 0050fce022 user: js tags: 1.1
00:11
objfw-config: Don't reproduce flags from configure check-in: 538ceacc2f user: js tags: trunk
2024-08-30
20:43
forwarding-arm64-elf.S: Fix padding with 4 check-in: 238f978fff user: js tags: trunk
Changes

Modified configure.ac from [5b53492ab9] to [6e067ef893].

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
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 -g"])
	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"
	with_tls="no"

	AC_SUBST(LIBBASES_M, libbases.m)
	;;







>












>

>







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
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"
	OBJFW_LDFLAGS="$OBJFW_LDFLAGS $flags"

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

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

	AC_SUBST(LIBBASES_M, libbases.m)
	;;
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
	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"

	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"

	LIBS="$LIBS -lpsputility -lpspuser -lpspkernel -lgcc -lpsplibc"

	enable_shared="no"
	enable_threads="no"	# TODO
	enable_sockets="no"	# TODO
	check_pedantic="no"

	AC_SUBST(MAP_LDFLAGS, ['-Wl,-Map,$@.map'])
	;;
hppa*-*-hpux*)
	dnl Don't default to -g: It creates errors from the assembler and breaks
	dnl exceptions.
	AS_IF([test x"$OBJCFLAGS" = x""], [OBJCFLAGS="-O2"])
	dnl HP-UX 11.11's inttypes.h defines UINTPTR_MAX etc. to nothing. GCC's
	dnl stdint.h defines those correctly, but if inttypes.h gets included
	dnl after something included stdint.h, it gets broken again. Therefore,
	dnl always include inttypes.h as the very first thing.
	dnl We need to put this into OBJCFLAGS and not CPPFLAGS as CPPFLAGS are
	dnl also used for .S files.
	OBJCFLAGS="$OBJCFLAGS -include inttypes.h"
	dnl We need -latomic for GCC's atomics to work.
	LIBS="$LIBS -latomic"

	;;
*-*-mint*)
	enable_shared="no"
	enable_threads="no"	# TODO
	with_tls="no"
	;;
*-apple-macos*)







>

>













>

>













>
|
|
|
>
|
>




















>







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
132
133
134
135
136
	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"
	OBJFW_LDFLAGS="$OBJFW_LDFLAGS -noixemul"
	LIBS="$LIBS -ldebug"
	OBJFW_LIBS="$OBJFW_LIBS -ldebug"

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

	AC_SUBST(LIBBASES_M, libbases.m)
	;;
*-msdosdjgpp*)
	enable_shared="no"
	enable_threads="no"
	enable_sockets="no"
	;;
*-*-mingw*)
	LDFLAGS="$LDFLAGS -Wl,--allow-multiple-definition"
	OBJFW_LDFLAGS="$OBJFW_LDFLAGS -Wl,--allow-multiple-definition"
	LIBS="$LIBS -lversion"
	OBJFW_LIBS="$OBJFW_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"
	OBJFW_LDFLAGS="$OBJFW_LDFLAGS -G0"
	tmp="-L$DEVKITPSP/psp/sdk/lib -lpspdebug -lpspdisplay -lpspge -lpspctrl"
	tmp="$tmp -lpspsdk -lc -lpspnet -lpspnet_inet -lpspnet_apctl"
	tmp="$tmp -lpspnet_resolver -lpsputility -lpspuser -lpspkernel -lgcc"
	tmp="$tmp -lpsplibc"
	LIBS="$LIBS $tmp"
	OBJFW_LIBS="$OBJFW_LIBS $tmp"
	enable_shared="no"
	enable_threads="no"	# TODO
	enable_sockets="no"	# TODO
	check_pedantic="no"

	AC_SUBST(MAP_LDFLAGS, ['-Wl,-Map,$@.map'])
	;;
hppa*-*-hpux*)
	dnl Don't default to -g: It creates errors from the assembler and breaks
	dnl exceptions.
	AS_IF([test x"$OBJCFLAGS" = x""], [OBJCFLAGS="-O2"])
	dnl HP-UX 11.11's inttypes.h defines UINTPTR_MAX etc. to nothing. GCC's
	dnl stdint.h defines those correctly, but if inttypes.h gets included
	dnl after something included stdint.h, it gets broken again. Therefore,
	dnl always include inttypes.h as the very first thing.
	dnl We need to put this into OBJCFLAGS and not CPPFLAGS as CPPFLAGS are
	dnl also used for .S files.
	OBJCFLAGS="$OBJCFLAGS -include inttypes.h"
	dnl We need -latomic for GCC's atomics to work.
	LIBS="$LIBS -latomic"
	OBJFW_LIBS="$OBJFW_LIBS -latomic"
	;;
*-*-mint*)
	enable_shared="no"
	enable_threads="no"	# TODO
	with_tls="no"
	;;
*-apple-macos*)
167
168
169
170
171
172
173

174

175
176
177
178
179
180
181

	flags="-mrvl -mcpu=750 -meabi -mhard-float"
	OBJCFLAGS="$OBJCFLAGS $flags"
	OBJFW_OBJCFLAGS="$OBJFW_OBJCFLAGS $flags"
	CPPFLAGS="$CPPFLAGS -DGEKKO -I$DEVKITPRO/libogc/include"
	OBJFW_CPPFLAGS="$OBJFW_CPPFLAGS -DGEKKO -I\$DEVKITPRO/libogc/include"
	LDFLAGS="$LDFLAGS -mrvl -mcpu=750 -meabi -mhard-float"

	LIBS="$LIBS -L$DEVKITPRO/libogc/lib/wii -lfat -logc"

	HID_LIBS="$HID_LIBS -lwiiuse -lbte"
	enable_shared="no"
	enable_threads="no"	# TODO
	with_tls="no"

	AC_DEFINE(OF_WII, 1, [Whether we are compiling for Wii])
	AC_SUBST(USE_SRCS_WII, '${SRCS_WII}')







>

>







178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194

	flags="-mrvl -mcpu=750 -meabi -mhard-float"
	OBJCFLAGS="$OBJCFLAGS $flags"
	OBJFW_OBJCFLAGS="$OBJFW_OBJCFLAGS $flags"
	CPPFLAGS="$CPPFLAGS -DGEKKO -I$DEVKITPRO/libogc/include"
	OBJFW_CPPFLAGS="$OBJFW_CPPFLAGS -DGEKKO -I\$DEVKITPRO/libogc/include"
	LDFLAGS="$LDFLAGS -mrvl -mcpu=750 -meabi -mhard-float"
	OBJFW_LDFLAGS="$OBJFW_LDFLAGS -mrvl -mcpu=750 -meabi -mhard-float"
	LIBS="$LIBS -L$DEVKITPRO/libogc/lib/wii -lfat -logc"
	OBJFW_LIBS="$OBJFW_LIBS -L$DEVKITPRO/libogc/lib/wii -lfat -logc"
	HID_LIBS="$HID_LIBS -lwiiuse -lbte"
	enable_shared="no"
	enable_threads="no"	# TODO
	with_tls="no"

	AC_DEFINE(OF_WII, 1, [Whether we are compiling for Wii])
	AC_SUBST(USE_SRCS_WII, '${SRCS_WII}')
191
192
193
194
195
196
197
198

199


200
201
202
203
204
205
206

	flags="-mcpu=750 -meabi -mhard-float"
	OBJCFLAGS="$OBJCFLAGS $flags"
	OBJFW_OBJCFLAGS="$OBJFW_OBJCFLAGS $flags"
	CPPFLAGS="-isystem $DEVKITPRO/wut/include -D__WIIU__ -D__WUT__"
	OBJFW_CPPFLAGS="$OBJFW_CPPFLAGS -isystem \$DEVKITPRO/wut/include"
	OBJFW_CPPFLAGS="$OBJFW_CPPFLAGS -D__WIIU__ -D__WUT__"
	LDFLAGS="-specs=$DEVKITPRO/wut/share/wut.specs"

	LIBS="-L$DEVKITPRO/wut/lib -L$DEVKITPRO/wut/lib/stubs -lwut"


	enable_files="no"	# TODO
	enable_shared="no"	# TODO
	enable_threads="no"	# TODO
	enable_sockets="no"	# TODO

	AC_DEFINE(OF_WII_U, 1, [Whether we are compiling for Wii U])
	AC_SUBST(MAP_LDFLAGS, ['-Wl,-Map,$@.map'])







|
>
|
>
>







204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222

	flags="-mcpu=750 -meabi -mhard-float"
	OBJCFLAGS="$OBJCFLAGS $flags"
	OBJFW_OBJCFLAGS="$OBJFW_OBJCFLAGS $flags"
	CPPFLAGS="-isystem $DEVKITPRO/wut/include -D__WIIU__ -D__WUT__"
	OBJFW_CPPFLAGS="$OBJFW_CPPFLAGS -isystem \$DEVKITPRO/wut/include"
	OBJFW_CPPFLAGS="$OBJFW_CPPFLAGS -D__WIIU__ -D__WUT__"
	LDFLAGS="$LDFLAGS -specs=$DEVKITPRO/wut/share/wut.specs"
	OBJFW_LDFLAGS="$OBJFW_LDFLAGS -specs=$DEVKITPRO/wut/share/wut.specs"
	tmp="-L$DEVKITPRO/wut/lib -L$DEVKITPRO/wut/lib/stubs -lwut"
	LIBS="$LIBS $tmp"
	OBJFW_LIBS="$OBJFW_LIBS $tmp"
	enable_files="no"	# TODO
	enable_shared="no"	# TODO
	enable_threads="no"	# TODO
	enable_sockets="no"	# TODO

	AC_DEFINE(OF_WII_U, 1, [Whether we are compiling for Wii U])
	AC_SUBST(MAP_LDFLAGS, ['-Wl,-Map,$@.map'])
222
223
224
225
226
227
228

229


230
231
232
233
234
235
236
	flags="-march=armv5te -mtune=arm946e-s -mthumb -mthumb-interwork"
	OBJCFLAGS="$OBJCFLAGS $flags"
	OBJFW_OBJCFLAGS="$OBJFW_OBJCFLAGS $flags"
	CPPFLAGS="$CPPFLAGS -DARM9 -I$DEVKITPRO/libnds/include"
	OBJFW_CPPFLAGS="$OBJFW_CPPFLAGS -DARM9 -I\$DEVKITPRO/libnds/include"
	ASFLAGS="$ASFLAGS -march=armv5te"
	LDFLAGS="$LDFLAGS -specs=ds_arm9.specs"

	LIBS="$LIBS -L$DEVKITPRO/libnds/lib -lfilesystem -lfat -lnds9"


	enable_shared="no"
	enable_threads="no"	# TODO
	enable_sockets="no"	# TODO
	check_pedantic="no"

	AC_DEFINE(OF_NINTENDO_DS, 1, [Whether we are compiling for Nintendo DS])
	AC_SUBST(USE_SRCS_NINTENDO_DS, '${SRCS_NINTENDO_DS}')







>
|
>
>







238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
	flags="-march=armv5te -mtune=arm946e-s -mthumb -mthumb-interwork"
	OBJCFLAGS="$OBJCFLAGS $flags"
	OBJFW_OBJCFLAGS="$OBJFW_OBJCFLAGS $flags"
	CPPFLAGS="$CPPFLAGS -DARM9 -I$DEVKITPRO/libnds/include"
	OBJFW_CPPFLAGS="$OBJFW_CPPFLAGS -DARM9 -I\$DEVKITPRO/libnds/include"
	ASFLAGS="$ASFLAGS -march=armv5te"
	LDFLAGS="$LDFLAGS -specs=ds_arm9.specs"
	OBJFW_LDFLAGS="$OBJFW_LDFLAGS -specs=ds_arm9.specs"
	tmp="-L$DEVKITPRO/libnds/lib -lfilesystem -lfat -lnds9"
	LIBS="$LIBS $tmp"
	OBJFW_LIBS="$OBJFW_LIBS $tmp"
	enable_shared="no"
	enable_threads="no"	# TODO
	enable_sockets="no"	# TODO
	check_pedantic="no"

	AC_DEFINE(OF_NINTENDO_DS, 1, [Whether we are compiling for Nintendo DS])
	AC_SUBST(USE_SRCS_NINTENDO_DS, '${SRCS_NINTENDO_DS}')
247
248
249
250
251
252
253
254

255

256

257
258
259
260
261
262
263
	flags="-march=armv6k -mtune=mpcore -mfloat-abi=hard -mtp=soft"
	flags="$flags -mword-relocations"
	OBJCFLAGS="$OBJCFLAGS $flags"
	OBJFW_OBJCFLAGS="$OBJFW_OBJCFLAGS $flags"
	CPPFLAGS="$CPPFLAGS -DARM11 -I$DEVKITPRO/libctru/include"
	OBJFW_CPPFLAGS="$OBJFW_CPPFLAGS -DARM11 -I\$DEVKITPRO/libctru/include"
	ASFLAGS="$ASFLAGS -march=armv6k"
	LDFLAGS="$LDFLAGS -specs=3dsx.specs -march=armv6k -mtune=mpcore"

	LDFLAGS="$LDFLAGS -mfloat-abi=hard -mtp=soft -mword-relocations"

	LIBS="$LIBS -L$DEVKITPRO/libctru/lib -lctru"

	enable_shared="no"
	enable_threads="no"	# TODO
	with_tls="no"
	check_pedantic="no"

	AC_DEFINE(OF_NINTENDO_3DS, 1,
		[Whether we are compiling for Nintendo 3DS])







|
>
|
>

>







266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
	flags="-march=armv6k -mtune=mpcore -mfloat-abi=hard -mtp=soft"
	flags="$flags -mword-relocations"
	OBJCFLAGS="$OBJCFLAGS $flags"
	OBJFW_OBJCFLAGS="$OBJFW_OBJCFLAGS $flags"
	CPPFLAGS="$CPPFLAGS -DARM11 -I$DEVKITPRO/libctru/include"
	OBJFW_CPPFLAGS="$OBJFW_CPPFLAGS -DARM11 -I\$DEVKITPRO/libctru/include"
	ASFLAGS="$ASFLAGS -march=armv6k"
	tmp="-specs=3dsx.specs -march=armv6k -mtune=mpcore -mfloat-abi=hard"
	tmp="$tmp -mtp=soft -mword-relocations"
	LDFLAGS="$LDFLAGS $tmp"
	OBJFW_LDFLAGS="$OBJFW_LDFLAGS $tmp"
	LIBS="$LIBS -L$DEVKITPRO/libctru/lib -lctru"
	OBJFW_LIBS="$OBJFW_LIBS -L$DEVKITPRO/libctru/lib -lctru"
	enable_shared="no"
	enable_threads="no"	# TODO
	with_tls="no"
	check_pedantic="no"

	AC_DEFINE(OF_NINTENDO_3DS, 1,
		[Whether we are compiling for Nintendo 3DS])
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
	flags="-march=armv8-a+crc+crypto -mtune=cortex-a57 -mtp=soft -fPIE"
	OBJCFLAGS="$OBJCFLAGS $flags"
	OBJFW_OBJCFLAGS="$OBJFW_OBJCFLAGS $flags"
	CPPFLAGS="$CPPFLAGS -D__SWITCH__ -I$DEVKITPRO/libnx/include"
	OBJFW_CPPFLAGS="$OBJFW_CPPFLAGS -D__SWITCH__ -I$DEVKITPRO/libnx/include"
	ASFLAGS="$ASFLAGS $flags"
	LDFLAGS="$LDFLAGS -specs=$DEVKITPRO/libnx/switch.specs $flags"


	LIBS="$LIBS -L$DEVKITPRO/libnx/lib -lnx"

	enable_shared="no"
	enable_threads="yes"
	enable_sockets="no"	# TODO
	check_pedantic="no"

	AC_DEFINE(OF_NINTENDO_SWITCH, 1,
		[Whether we are compiling for Nintendo Switch])
	AC_SUBST(USE_SRCS_NINTENDO_SWITCH, '${SRCS_NINTENDO_SWITCH}')
])

CPP="$OBJCPP"
CPPFLAGS="$CPPFLAGS $OBJCPPFLAGS -DOF_COMPILING_OBJFW"
flags="-fexceptions -fobjc-exceptions -funwind-tables"
flags="$flags -fconstant-string-class=OFConstantString"
OBJCFLAGS="$OBJCFLAGS -Wall $flags"
OBJFW_OBJCFLAGS="$OBJFW_OBJCFLAGS $flags"
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







>
>

>



















>







297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
	flags="-march=armv8-a+crc+crypto -mtune=cortex-a57 -mtp=soft -fPIE"
	OBJCFLAGS="$OBJCFLAGS $flags"
	OBJFW_OBJCFLAGS="$OBJFW_OBJCFLAGS $flags"
	CPPFLAGS="$CPPFLAGS -D__SWITCH__ -I$DEVKITPRO/libnx/include"
	OBJFW_CPPFLAGS="$OBJFW_CPPFLAGS -D__SWITCH__ -I$DEVKITPRO/libnx/include"
	ASFLAGS="$ASFLAGS $flags"
	LDFLAGS="$LDFLAGS -specs=$DEVKITPRO/libnx/switch.specs $flags"
	OBJFW_LDFLAGS="$OBJFW_LDFLAGS -specs=$DEVKITPRO/libnx/switch.specs"
	OBJFW_LDFLAGS="$OBJFW_LDFLAGS $flags"
	LIBS="$LIBS -L$DEVKITPRO/libnx/lib -lnx"
	OBJFW_LIBS="$OBJFW_LIBS -L$DEVKITPRO/libnx/lib -lnx"
	enable_shared="no"
	enable_threads="yes"
	enable_sockets="no"	# TODO
	check_pedantic="no"

	AC_DEFINE(OF_NINTENDO_SWITCH, 1,
		[Whether we are compiling for Nintendo Switch])
	AC_SUBST(USE_SRCS_NINTENDO_SWITCH, '${SRCS_NINTENDO_SWITCH}')
])

CPP="$OBJCPP"
CPPFLAGS="$CPPFLAGS $OBJCPPFLAGS -DOF_COMPILING_OBJFW"
flags="-fexceptions -fobjc-exceptions -funwind-tables"
flags="$flags -fconstant-string-class=OFConstantString"
OBJCFLAGS="$OBJCFLAGS -Wall $flags"
OBJFW_OBJCFLAGS="$OBJFW_OBJCFLAGS $flags"
dnl amiga-gcc requires -fexceptions in LDFLAGS in order to link in the glue code
dnl for registering the frames.
LDFLAGS="$LDFLAGS -fexceptions"
OBJFW_LDFLAGS="$OBJFW_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
634
635
636
637
638
639
640
641



642
643
644
645
646
647
648
			exception_type="DWARF"
			raise_exception="_Unwind_RaiseException"
		])
	])

	AC_SEARCH_LIBS($raise_exception, [c++abi gcc_s gcc unwind], [
		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")







|
>
>
>







660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
			exception_type="DWARF"
			raise_exception="_Unwind_RaiseException"
		])
	])

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

	AC_CHECK_FUNCS(_Unwind_GetDataRelBase _Unwind_GetTextRelBase)
	;;
"Apple runtime")
691
692
693
694
695
696
697

698
699
700
701

702

703
704

705

706
707
708
709
710
711
712
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"

		])
		AS_IF([test x"$exception_type" = x"SjLj"], [

			LDFLAGS="$LDFLAGS -Wl,-U,___gxx_personality_sj0"

		])
		AC_SUBST(REEXPORT_RUNTIME, ["-Wl,-reexport-lobjfwrt"])
		AC_SUBST(REEXPORT_RUNTIME_FRAMEWORK,
			["-Wl,-reexport_framework,ObjFWRT"])
	])

	AC_CHECK_HEADERS(sysdir.h)







>




>
|
>


>
|
>







720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
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"
		OBJFW_LDFLAGS="$OBJFW_LDFLAGS -Wl,-U,_NSFoundationVersionNumber"
	])

	AS_IF([test x"$objc_runtime" = x"ObjFW runtime"], [
		AS_IF([test x"$exception_type" = x"DWARF"], [
			tmp="-Wl,-U,___gxx_personality_v0"
			LDFLAGS="$LDFLAGS $tmp"
			OBJFW_LDFLAGS="$OBJFW_LDFLAGS $tmp"
		])
		AS_IF([test x"$exception_type" = x"SjLj"], [
			tmp="-Wl,-U,___gxx_personality_sj0"
			LDFLAGS="$LDFLAGS $tmp"
			OBJFW_LDFLAGS="$OBJFW_LDFLAGS $tmp"
		])
		AC_SUBST(REEXPORT_RUNTIME, ["-Wl,-reexport-lobjfwrt"])
		AC_SUBST(REEXPORT_RUNTIME_FRAMEWORK,
			["-Wl,-reexport_framework,ObjFWRT"])
	])

	AC_CHECK_HEADERS(sysdir.h)
889
890
891
892
893
894
895
896



897
898
899
900
901
902
903
	])
	;;
i?86 | x86_64)
	AC_CHECK_HEADERS(cet.h)
	;;
esac

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



AC_CHECK_LIB(complex, creal, TESTS_LIBS="$TESTS_LIBS -lcomplex")

AC_CHECK_FUNCS(strtof truncf)

AC_CHECK_FUNC(asprintf, [
	case "$host" in
	*-*-mint*)







|
>
>
>







923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
	])
	;;
i?86 | x86_64)
	AC_CHECK_HEADERS(cet.h)
	;;
esac

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

AC_CHECK_FUNCS(strtof truncf)

AC_CHECK_FUNC(asprintf, [
	case "$host" in
	*-*-mint*)
963
964
965
966
967
968
969
970



971
972
973
974
975
976
977
AS_IF([test x"$enable_static" = x"yes" -o x"$enable_shared" = x"no"], [
	AC_SUBST(ENCODINGS_A, "encodings.a")
])

AC_CHECK_FUNCS(arc4random arc4random_buf getrandom random, break)

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.







|
>
>
>







1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
AS_IF([test x"$enable_static" = x"yes" -o x"$enable_shared" = x"no"], [
	AC_SUBST(ENCODINGS_A, "encodings.a")
])

AC_CHECK_FUNCS(arc4random arc4random_buf getrandom random, break)

AS_IF([test x"$host_os" != x"morphos"], [
	AC_CHECK_LIB(dl, dlopen, [
		LIBS="$LIBS -ldl"
		OBJFW_LIBS="$OBJFW_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.
1005
1006
1007
1008
1009
1010
1011
1012



1013
1014
1015
1016
1017
1018
1019
		dnl Use -Wp, as we only use it for the preprocessor.
		AX_CHECK_COMPILER_FLAGS([-Wp,-pthread], [
			CPPFLAGS="$CPPFLAGS -Wp,-pthread"
		], [
			CPPFLAGS="$CPPFLAGS -D_REENTRANT -D_THREAD_SAFE"
		])

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




		AC_LINK_IFELSE([
			AC_LANG_PROGRAM([
				#include <pthread.h>
			], [
				pthread_create(NULL, NULL, NULL, NULL);
			])







|
>
>
>







1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
		dnl Use -Wp, as we only use it for the preprocessor.
		AX_CHECK_COMPILER_FLAGS([-Wp,-pthread], [
			CPPFLAGS="$CPPFLAGS -Wp,-pthread"
		], [
			CPPFLAGS="$CPPFLAGS -D_REENTRANT -D_THREAD_SAFE"
		])

		AC_CHECK_LIB(pthread, main, [
			LIBS="$LIBS -lpthread"
			OBJFW_LIBS="$OBJFW_LIBS -lpthread"
		])

		AC_LINK_IFELSE([
			AC_LANG_PROGRAM([
				#include <pthread.h>
			], [
				pthread_create(NULL, NULL, NULL, NULL);
			])
1391
1392
1393
1394
1395
1396
1397

1398
1399
1400

1401
1402
1403



1404
1405
1406
1407
1408
1409
1410
	AC_SUBST(USE_SRCS_SOCKETS, '${SRCS_SOCKETS}')

	case "$host_os" in
	amigaos* | morphos*)
		;;
	haiku*)
		LIBS="$LIBS -lnetwork"

		;;
	mingw*)
		LIBS="$LIBS -lws2_32 -liphlpapi"

		;;
	*)
		AC_CHECK_LIB(socket, socket, LIBS="$LIBS -lsocket")



		;;
	esac

	AC_CHECK_HEADER(sys/socket.h, [
		AC_DEFINE(OF_HAVE_SYS_SOCKET_H, 1,
			[Whether we have sys/socket.h])
	])







>



>


|
>
>
>







1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
	AC_SUBST(USE_SRCS_SOCKETS, '${SRCS_SOCKETS}')

	case "$host_os" in
	amigaos* | morphos*)
		;;
	haiku*)
		LIBS="$LIBS -lnetwork"
		OBJFW_LIBS="$OBJFW_LIBS -lnetwork"
		;;
	mingw*)
		LIBS="$LIBS -lws2_32 -liphlpapi"
		OBJFW_LIBS="$OBJFW_LIBS -lws2_32 -liphlpapi"
		;;
	*)
		AC_CHECK_LIB(socket, socket, [
			LIBS="$LIBS -lsocket"
			OBJFW_LIBS="$OBJFW_LIBS -lsocket"
		])
		;;
	esac

	AC_CHECK_HEADER(sys/socket.h, [
		AC_DEFINE(OF_HAVE_SYS_SOCKET_H, 1,
			[Whether we have sys/socket.h])
	])
1444
1445
1446
1447
1448
1449
1450




1451
1452
1453
1454
1455
1456
1457
	])
	AC_CHECK_HEADER(netinet/sctp.h, [
		AC_SEARCH_LIBS(sctp_recvv, sctp, [
			AC_DEFINE(OF_HAVE_SCTP, 1, [Whether we have SCTP])
			AC_DEFINE(OF_HAVE_NETINET_SCTP_H, 1,
				[Whether we have netinet/sctp.h])
			AC_SUBST(USE_SRCS_SCTP, '${SRCS_SCTP}')




		])
	])
	AC_CHECK_HEADERS([arpa/inet.h netdb.h sys/sockio.h])
	AC_CHECK_HEADERS([net/if.h], [], [], [
		#ifdef OF_HAVE_SYS_SOCKET_H
		# include <sys/socket.h>
		#endif







>
>
>
>







1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
	])
	AC_CHECK_HEADER(netinet/sctp.h, [
		AC_SEARCH_LIBS(sctp_recvv, sctp, [
			AC_DEFINE(OF_HAVE_SCTP, 1, [Whether we have SCTP])
			AC_DEFINE(OF_HAVE_NETINET_SCTP_H, 1,
				[Whether we have netinet/sctp.h])
			AC_SUBST(USE_SRCS_SCTP, '${SRCS_SCTP}')

			AS_IF([test x"$ac_lib" != x""], [
				OBJFW_LIBS="$OBJFW_LIBS -l$ac_lib"
			])
		])
	])
	AC_CHECK_HEADERS([arpa/inet.h netdb.h sys/sockio.h])
	AC_CHECK_HEADERS([net/if.h], [], [], [
		#ifdef OF_HAVE_SYS_SOCKET_H
		# include <sys/socket.h>
		#endif
2409
2410
2411
2412
2413
2414
2415


2416
2417
2418
2419
2420
2421
2422
dnl We use the ObjC compiler as our assembler
AC_SUBST(AS, $OBJC)
AC_SUBST(ASFLAGS)
AC_SUBST(DEP_ASFLAGS, '${DEP_OBJCFLAGS}')

AC_SUBST(OBJFW_CPPFLAGS)
AC_SUBST(OBJFW_OBJCFLAGS)



AC_SUBST(HID_LIBS)
AC_SUBST(TESTS_LIBS)

AC_CONFIG_FILES([
	buildsys.mk
	extra.mk







>
>







2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
dnl We use the ObjC compiler as our assembler
AC_SUBST(AS, $OBJC)
AC_SUBST(ASFLAGS)
AC_SUBST(DEP_ASFLAGS, '${DEP_OBJCFLAGS}')

AC_SUBST(OBJFW_CPPFLAGS)
AC_SUBST(OBJFW_OBJCFLAGS)
AC_SUBST(OBJFW_LDFLAGS)
AC_SUBST(OBJFW_LIBS)

AC_SUBST(HID_LIBS)
AC_SUBST(TESTS_LIBS)

AC_CONFIG_FILES([
	buildsys.mk
	extra.mk

Modified utils/objfw-config.in from [b9613126d3] to [77e2685d56].

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
CXXFLAGS=""
OBJC="@OBJC@"
OBJCFLAGS="@OBJFW_OBJCFLAGS@"
LIB_CFLAGS="@LIB_CFLAGS@"
LIB_LDFLAGS="@LIB_LDFLAGS@"
LIB_PREFIX="@LIB_PREFIX@"
LIB_SUFFIX="@LIB_SUFFIX@"
LDFLAGS="@LDFLAGS@"
LDFLAGS_REEXPORT="@LDFLAGS_REEXPORT@"
LDFLAGS_RPATH="@LDFLAGS_RPATH@"
LIBS="-lobjfw @RUNTIME_LIBS@ @LIBS@"
FRAMEWORK_LIBS="-framework ObjFW"
FRAMEWORK_LIBS="$FRAMEWORK_LIBS @RUNTIME_FRAMEWORK_LIBS@ @LIBS@"
PLUGIN_CFLAGS="@PLUGIN_CFLAGS@"
PLUGIN_LDFLAGS="@PLUGIN_LDFLAGS@"
PLUGIN_SUFFIX="@PLUGIN_SUFFIX@"
PROG_SUFFIX="@EXEEXT@"
STATIC_LIBS="${libdir}/libobjfw.a @LIBS@"
VERSION="@PACKAGE_VERSION@"

show_help() {
	cat >&2 <<__EOF__
objfw-config: Available arguments are:

    --all             Outputs all flags + libs







|


|

|




|







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
CXXFLAGS=""
OBJC="@OBJC@"
OBJCFLAGS="@OBJFW_OBJCFLAGS@"
LIB_CFLAGS="@LIB_CFLAGS@"
LIB_LDFLAGS="@LIB_LDFLAGS@"
LIB_PREFIX="@LIB_PREFIX@"
LIB_SUFFIX="@LIB_SUFFIX@"
LDFLAGS="@OBJFW_LDFLAGS@"
LDFLAGS_REEXPORT="@LDFLAGS_REEXPORT@"
LDFLAGS_RPATH="@LDFLAGS_RPATH@"
LIBS="-lobjfw @RUNTIME_LIBS@ @OBJFW_LIBS@"
FRAMEWORK_LIBS="-framework ObjFW"
FRAMEWORK_LIBS="$FRAMEWORK_LIBS @RUNTIME_FRAMEWORK_LIBS@ @OBJFW_LIBS@"
PLUGIN_CFLAGS="@PLUGIN_CFLAGS@"
PLUGIN_LDFLAGS="@PLUGIN_LDFLAGS@"
PLUGIN_SUFFIX="@PLUGIN_SUFFIX@"
PROG_SUFFIX="@EXEEXT@"
STATIC_LIBS="${libdir}/libobjfw.a @OBJFW_LIBS@"
VERSION="@PACKAGE_VERSION@"

show_help() {
	cat >&2 <<__EOF__
objfw-config: Available arguments are:

    --all             Outputs all flags + libs