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
|
case "$host" in
m68k-*-amigaos*)
AS_IF([test x"$OBJCFLAGS" != x""], [
OBJCFLAGS="$OBJCFLAGS -noixemul"
], [
OBJCFLAGS="-O0 -g -noixemul"
])
LDFLAGS="$LDFLAGS -noixemul"
enable_shared="no"
enable_threads="no"
enable_sockets="no"
enable_files="yes" # Required for reading ENV:
supports_amiga_lib="yes"
ac_cv_snprintf_useful_ret="yes"
AC_SUBST(NOIXEMUL, -noixemul)
AS_IF([test x"$enable_amiga_lib" != x"no"], [
AC_SUBST(SFDC_TARGET, m68k-amigaos)
dnl For 68000, GCC emits calls to helper functions that
dnl do not work properly in a library.
AC_SUBST(AMIGA_LIB_CFLAGS, "-mcpu=68020 -fbaserel")
AC_SUBST(AMIGA_LIB_LDFLAGS,
"-mcpu=68020 -fbaserel -resident -nostartfiles")
])
;;
powerpc-*-amigaos*)
enable_shared="no"
enable_threads="no"
;;
*-morphos*)
AS_IF([test x"$with_ixemul" != x"yes"], [
AS_IF([test x"$OBJCFLAGS" != x""], [
OBJCFLAGS="$OBJCFLAGS -noixemul"
], [
OBJCFLAGS="-O2 -g -noixemul"
])
LDFLAGS="$LDFLAGS -noixemul"
enable_files="yes" # Required for reading ENV:
supports_amiga_lib="yes"
AC_SUBST(NOIXEMUL, -noixemul)
AS_IF([test x"$enable_amiga_lib" != x"no"], [
AC_SUBST(SFDC_TARGET, ppc-morphos)
tmp="-mresident32 -fno-builtin"
AC_SUBST(AMIGA_LIB_CFLAGS, $tmp)
tmp="-mresident32 -nostartfiles -nodefaultlibs"
tmp="$tmp -lc"
AC_SUBST(AMIGA_LIB_LDFLAGS, $tmp)
|
>
<
<
>
<
<
|
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
|
case "$host" in
m68k-*-amigaos*)
AS_IF([test x"$OBJCFLAGS" != x""], [
OBJCFLAGS="$OBJCFLAGS -noixemul"
], [
OBJCFLAGS="-O0 -g -noixemul"
])
OBJFW_OBJCFLAGS="$OBJFW_OBJCFLAGS -noixemul"
LDFLAGS="$LDFLAGS -noixemul"
enable_shared="no"
enable_threads="no"
enable_sockets="no"
enable_files="yes" # Required for reading ENV:
supports_amiga_lib="yes"
ac_cv_snprintf_useful_ret="yes"
AS_IF([test x"$enable_amiga_lib" != x"no"], [
AC_SUBST(SFDC_TARGET, m68k-amigaos)
dnl For 68000, GCC emits calls to helper functions that
dnl do not work properly in a library.
AC_SUBST(AMIGA_LIB_CFLAGS, "-mcpu=68020 -fbaserel")
AC_SUBST(AMIGA_LIB_LDFLAGS,
"-mcpu=68020 -fbaserel -resident -nostartfiles")
])
;;
powerpc-*-amigaos*)
enable_shared="no"
enable_threads="no"
;;
*-morphos*)
AS_IF([test x"$with_ixemul" != x"yes"], [
AS_IF([test x"$OBJCFLAGS" != x""], [
OBJCFLAGS="$OBJCFLAGS -noixemul"
], [
OBJCFLAGS="-O2 -g -noixemul"
])
OBJFW_OBJCFLAGS="$OBJFW_OBJCFLAGS -noixemul"
LDFLAGS="$LDFLAGS -noixemul"
enable_files="yes" # Required for reading ENV:
supports_amiga_lib="yes"
AS_IF([test x"$enable_amiga_lib" != x"no"], [
AC_SUBST(SFDC_TARGET, ppc-morphos)
tmp="-mresident32 -fno-builtin"
AC_SUBST(AMIGA_LIB_CFLAGS, $tmp)
tmp="-mresident32 -nostartfiles -nodefaultlibs"
tmp="$tmp -lc"
AC_SUBST(AMIGA_LIB_LDFLAGS, $tmp)
|
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
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
256
257
258
|
AC_ARG_WITH(wii,
AS_HELP_STRING([--with-wii], [build for Wii]))
AS_IF([test x"$with_wii" = x"yes"], [
AS_IF([test x"$DEVKITPRO" = x""], [
AC_MSG_ERROR([DEVKITPRO is not set! Please set DEVKITPRO.])
])
OBJCFLAGS="$OBJCFLAGS -mrvl -mcpu=750 -meabi -mhard-float"
CPPFLAGS="$CPPFLAGS -DGEKKO -I$DEVKITPRO/libogc/include"
LDFLAGS="$LDFLAGS -mrvl -mcpu=750 -meabi -mhard-float"
LIBS="$LIBS -L$DEVKITPRO/libogc/lib/wii -lfat -logc"
TESTS_LIBS="$TESTS_LIBS -lwiiuse -lbte"
enable_shared="no"
enable_threads="no" # TODO
AC_DEFINE(OF_WII, 1, [Whether we are compiling for Wii])
AC_SUBST(DEFINES, "-DGEKKO")
AC_SUBST(INCLUDES, '-I$DEVKITPRO/libogc/include')
AC_SUBST(MAP_LDFLAGS, ['-Wl,-Map,$@.map'])
])
AC_ARG_WITH(nds,
AS_HELP_STRING([--with-nds], [build for Nintendo DS]))
AS_IF([test x"$with_nds" = x"yes"], [
AS_IF([test x"$DEVKITPRO" = x""], [
AC_MSG_ERROR([DEVKITPRO is not set! Please set DEVKITPRO.])
])
OBJCFLAGS="$OBJCFLAGS -march=armv5te -mtune=arm946e-s"
OBJCFLAGS="$OBJCFLAGS -mthumb -mthumb-interwork"
CPPFLAGS="$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(DEFINES, "-DARM9")
AC_SUBST(INCLUDES, '-I$DEVKITPRO/libnds/include')
AC_SUBST(MAP_LDFLAGS, ['-Wl,-Map,$@.map'])
])
AC_ARG_WITH(3ds,
AS_HELP_STRING([--with-3ds], [build for Nintendo 3DS]))
AS_IF([test x"$with_3ds" = x"yes"], [
AS_IF([test x"$DEVKITPRO" = x""], [
AC_MSG_ERROR([DEVKITPRO is not set! Please set DEVKITPRO.])
])
OBJCFLAGS="$OBJCFLAGS -march=armv6k -mtune=mpcore -mfloat-abi=hard"
OBJCFLAGS="$OBJCFLAGS -mtp=soft -mword-relocations"
CPPFLAGS="$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
check_pedantic="no"
AC_DEFINE(OF_NINTENDO_3DS, 1,
[Whether we are compiling for Nintendo 3DS])
AC_SUBST(DEFINES, "-DARM11")
AC_SUBST(INCLUDES, '-I$DEVKITPRO/libctru/include')
AC_SUBST(MAP_LDFLAGS, ['-Wl,-Map,$@.map'])
])
CPP="$OBJCPP"
CPPFLAGS="$CPPFLAGS $OBJCPPFLAGS -DOF_COMPILING_OBJFW"
OBJCFLAGS="$OBJCFLAGS -Wall -fexceptions -fobjc-exceptions -funwind-tables"
OBJCFLAGS="$OBJCFLAGS -fconstant-string-class=OFConstantString"
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*-*-*)
OBJCFLAGS="$OBJCFLAGS -integrated-as"
AC_SUBST(INTEGRATED_AS, "-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*)
OBJCFLAGS="$OBJCFLAGS -integrated-as"
AC_SUBST(INTEGRATED_AS, "-integrated-as")
;;
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, [
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"])
])
|
>
|
>
<
|
|
|
>
<
|
|
>
|
>
<
|
|
|
>
>
>
|
<
>
>
|
<
>
>
|
<
>
|
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
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
256
257
258
259
260
261
262
263
264
|
AC_ARG_WITH(wii,
AS_HELP_STRING([--with-wii], [build for Wii]))
AS_IF([test x"$with_wii" = x"yes"], [
AS_IF([test x"$DEVKITPRO" = x""], [
AC_MSG_ERROR([DEVKITPRO is not set! Please set DEVKITPRO.])
])
flags="-mrvl -mcpu=750 -meabi -mhard-float"
OBJCFLAGS="$OBJCFLAGS $flags"
OBJFW_OBJCFLAGS="$OBJFW_OBJCFLAGS $flags"
CPPFLAGS="$CPPFLAGS -DGEKKO -I$DEVKITPRO/libogc/include"
LDFLAGS="$LDFLAGS -mrvl -mcpu=750 -meabi -mhard-float"
LIBS="$LIBS -L$DEVKITPRO/libogc/lib/wii -lfat -logc"
TESTS_LIBS="$TESTS_LIBS -lwiiuse -lbte"
enable_shared="no"
enable_threads="no" # TODO
AC_DEFINE(OF_WII, 1, [Whether we are compiling for Wii])
OBJFW_CPPFLAGS="$OBJFW_CPPFLAGS -DGEKKO -I\$DEVKITPRO/libogc/include"
AC_SUBST(MAP_LDFLAGS, ['-Wl,-Map,$@.map'])
])
AC_ARG_WITH(nds,
AS_HELP_STRING([--with-nds], [build for Nintendo DS]))
AS_IF([test x"$with_nds" = x"yes"], [
AS_IF([test x"$DEVKITPRO" = x""], [
AC_MSG_ERROR([DEVKITPRO is not set! Please set DEVKITPRO.])
])
flags="-march=armv5te -mtune=arm946e-s -mthumb -mthumb-interwork"
OBJCFLAGS="$OBJCFLAGS $flags"
OBJFW_OBJCFLAGS="$OBJFW_OBJCFLAGS $flags"
CPPFLAGS="$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])
OBJFW_CPPFLAGS="$OBJFW_CPPFLAGS -DARM9 -I\$DEVKITPRO/libnds/include"
AC_SUBST(MAP_LDFLAGS, ['-Wl,-Map,$@.map'])
])
AC_ARG_WITH(3ds,
AS_HELP_STRING([--with-3ds], [build for Nintendo 3DS]))
AS_IF([test x"$with_3ds" = x"yes"], [
AS_IF([test x"$DEVKITPRO" = x""], [
AC_MSG_ERROR([DEVKITPRO is not set! Please set DEVKITPRO.])
])
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"
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
check_pedantic="no"
AC_DEFINE(OF_NINTENDO_3DS, 1,
[Whether we are compiling for Nintendo 3DS])
OBJFW_CPPFLAGS="$OBJFW_CPPFLAGS -DARM11 -I\$DEVKITPRO/libctru/include"
AC_SUBST(MAP_LDFLAGS, ['-Wl,-Map,$@.map'])
])
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
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 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"])
])
])
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],
[OBJCFLAGS="$OBJCFLAGS -Wsign-compare"])
AS_IF([test x"$with_nds" != x"yes"], [
AX_CHECK_COMPILER_FLAGS([-Wshadow -Werror],
[OBJCFLAGS="$OBJCFLAGS -Wshadow"])
])
|
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
|
void
__objc_exec_class(void *module)
{
}
], [
[Test test];
], [
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"
])
AC_SUBST(RUNTIME, "runtime")
AC_SUBST(RUNTIME_FLAGS)
AS_IF([test x"$enable_shared" != x"no"], [
AC_SUBST(OBJFW_RT_SHARED_LIB,
"${LIB_PREFIX}objfw_rt${LIB_SUFFIX}")
])
AS_IF([test x"$enable_static" = x"yes"], [
|
|
>
|
|
>
<
|
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
|
void
__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")
AS_IF([test x"$enable_shared" != x"no"], [
AC_SUBST(OBJFW_RT_SHARED_LIB,
"${LIB_PREFIX}objfw_rt${LIB_SUFFIX}")
])
AS_IF([test x"$enable_static" = x"yes"], [
|
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
|
AC_MSG_CHECKING(whether Objective C compiler supports blocks)
old_OBJCFLAGS="$OBJCFLAGS"
OBJCFLAGS="$OBJCFLAGS -Xclang -fblocks"
AC_TRY_COMPILE([], [
int (^foo)(int bar);
foo = ^ (int bar) { return 0; }
], [
AC_SUBST(BLOCKS_FLAGS, "-Xclang -fblocks")
AC_SUBST(OFBLOCKTESTS_M, "OFBlockTests.m")
AC_MSG_RESULT(yes)
], [
AC_MSG_RESULT(no)
OBJCFLAGS="$old_OBJCFLAGS"
])
|
|
|
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
|
AC_MSG_CHECKING(whether Objective C compiler supports blocks)
old_OBJCFLAGS="$OBJCFLAGS"
OBJCFLAGS="$OBJCFLAGS -Xclang -fblocks"
AC_TRY_COMPILE([], [
int (^foo)(int bar);
foo = ^ (int bar) { return 0; }
], [
OBJFW_OBJCFLAGS="$OBJFW_OBJCFLAGS -Xclang -fblocks"
AC_SUBST(OFBLOCKTESTS_M, "OFBlockTests.m")
AC_MSG_RESULT(yes)
], [
AC_MSG_RESULT(no)
OBJCFLAGS="$old_OBJCFLAGS"
])
|