@@ -24,13 +24,16 @@ dnl We use some automake macros here,
24
24
dnl but don't use automake for creating Makefile.in
25
25
AM_INIT_AUTOMAKE(gforth,0.5.9-20020901)
26
26
#snapshots have numbers major.minor.release-YYYYMMDD
27
- #note that lexicographic ordering bust be heeded.
27
+ #note that lexicographic ordering must be heeded.
28
28
#I.e., 0.4.1-YYYYMMDD must not exist before 0.4.1!
29
29
UPDATED="1 September 2002"
30
30
AC_SUBST(UPDATED)
31
31
AM_CONFIG_HEADER(engine/config.h)
32
32
#AM_CYGWIN32
33
33
34
+ #default setting that may be changed later:
35
+ no_dynamic_default=0
36
+
34
37
AC_ARG_ENABLE(force-reg,
35
38
[ --enable-force-reg Use explicit register declarations if they appear in
36
39
the machine.h file. This can cause a good speedup,
@@ -59,21 +62,20 @@ CFLAGS=$CFLAGS
59
62
60
63
AC_PROG_CC
61
64
62
- if test "$GCC" = "yes"
63
- then
64
- echo "Fine, gcc is available"
65
- else
66
- cat <<'EOF'
67
- Gforth requires GCC-2.0 or higher (it uses GNU C extensions).
68
- It does not work with other C compilers. Please install the GNU C compiler,
69
- and try again (or search for a binary distribution for your platform).
70
- EOF
71
- exit 1
72
- fi
65
+ test "$GCC" = "yes" || AC_MSG_ERROR(Gforth uses GNU C extensions and requires GCC 2.0 or higher)
73
66
74
67
AC_SUBST(CC)
75
68
AC_SUBST(DEBUGFLAG)
76
69
70
+ AC_MSG_CHECKING(gcc version)
71
+ gcc_version=`$CC -v 2>&1|grep 'gcc version'|sed 's/.*gcc version //'`
72
+ AC_MSG_RESULT($gcc_version)
73
+ if expr "$gcc_version" \> 3.0.4 >/dev/null && expr "$gcc_version" \< 3.2.1 >/dev/null
74
+ then
75
+ no_dynamic_default=1
76
+ AC_MSG_WARN(Disabling dynamic native code generation by default (speed penalty factor ~2))
77
+ fi
78
+
77
79
dnl the following macro produces a warning with autoconf-2.1
78
80
AC_CHECK_SIZEOF(char *)
79
81
case "$ac_cv_sizeof_char_p" in
@@ -94,6 +96,7 @@ AC_CHECK_SIZEOF(int)
94
96
AC_CHECK_SIZEOF(long)
95
97
AC_CHECK_SIZEOF(long long)
96
98
99
+ AC_MSG_CHECKING([for a C type for cells])
97
100
ac_cv_int_type_cell=none
98
101
case "$ac_cv_sizeof_char_p" in
99
102
$ac_cv_sizeof_int)
@@ -112,13 +115,10 @@ case "$ac_cv_sizeof_char_p" in
112
115
ac_cv_int_type_cell="long long"
113
116
;;
114
117
esac
115
- if test "$ac_cv_int_type_cell" != int; then
116
- echo "So, sizeof(pointer)!=sizeof(int); looks like a DOS C compiler to me."
117
- echo "Since you don't have a proper C on this machine, that's one more reason"
118
- echo "to use Forth;-)"
119
- fi
118
+ AC_MSG_RESULT($ac_cv_int_type_cell)
120
119
AC_DEFINE_UNQUOTED(CELL_TYPE,$ac_cv_int_type_cell,[an integer type that is as long as a pointer])
121
120
121
+ AC_MSG_CHECKING([for a C type for double-cells])
122
122
ac_cv_int_type_double_cell=none
123
123
case `expr 2 '*' "$ac_cv_sizeof_char_p"` in
124
124
$ac_cv_sizeof_short)
@@ -134,15 +134,13 @@ case `expr 2 '*' "$ac_cv_sizeof_char_p"` in
134
134
ac_cv_int_type_double_cell="long long"
135
135
;;
136
136
esac
137
+ AC_MSG_RESULT($ac_cv_int_type_double_cell)
137
138
if test "$ac_cv_int_type_double_cell" = none; then
138
- echo "Emulating double-cell arithmetic. This may be slow."
139
- echo "If you find this unacceptable, ask the GCC maintainers to provide proper"
140
- echo 'long longs for your machine (the GCC manual states that they \"are twice as'
141
- echo "long as \`long int\'\")."
139
+ AC_MSG_WARN([Emulating double-cell arithmetic. This may be slow.])
142
140
AC_LIBOBJ(dblsub)
143
141
AC_DEFINE(BUGGY_LONG_LONG,,[define this if there is no working DOUBLE_CELL_TYPE on your machine])
144
142
else
145
- AC_DEFINE_UNQUOTED(DOUBLE_CELL_TYPE,$ac_cv_int_type_double_cell,[an integer type that is twice as long as a pointer])
143
+ AC_DEFINE_UNQUOTED(DOUBLE_CELL_TYPE,$ac_cv_int_type_double_cell,[an integer type that is twice as long as a pointer])
146
144
fi
147
145
148
146
AC_MSG_CHECKING([whether the linker accepts -export-dynamic])
@@ -196,16 +194,28 @@ case "$host_cpu" in
196
194
;;
197
195
mips*)
198
196
machine=mips
197
+ #dynamic native code has the following problems on MIPS:
198
+ #
199
+ #1) J/JAL seems relocatable, but is are only
200
+ #relocatable within a 256MB-segment. While we try to
201
+ #get the linker to arrange this, there is no guarantee
202
+ #that this will succeed (and if the user uses a lot of
203
+ #memory, it is likely to fail).
204
+ #
205
+ #2) The way we generate dynamic native code may
206
+ #violate MIPS architectural restrictions (in
207
+ #particular, the delay slots of LW, MFLO, etc.)
208
+ #
209
+ #Therefore we disable dynamic native code by default:
210
+ no_dynamic_default=1
211
+ AC_MSG_WARN(Disabling dynamic native code generation by default (speed penalty factor ~2))
199
212
#link text and data segment into the same 256M region!
200
213
AC_MSG_CHECKING([whether the linker accepts -T])
201
214
OLDLDFLAGS=$LDFLAGS
202
215
LDFLAGS="$LDFLAGS -Xlinker -T -Xlinker 10000000"
203
216
AC_TRY_LINK(,,ac_link_mips_t=yes,ac_link_mips_t=no)
204
217
test $ac_link_mips_t = yes||LDFLAGS=$OLDLDFLAGS
205
218
AC_MSG_RESULT($ac_link_mips_t)
206
- fixme #dynamically generated code should be in the same 256MB
207
- # region as the text segment; no indirect threading necessary
208
- test $ac_link_mips_t = yes||(echo cannot link text and data into same 256M region, using indirect threading; AC_DEFINE(INDIRECT_THREADED,,[Define if you want to force an indirect threaded code implementation]))
209
219
AC_MSG_CHECKING([whether the linker accepts -D])
210
220
OLDLDFLAGS=$LDFLAGS
211
221
LDFLAGS="$LDFLAGS -Xlinker -D -Xlinker 10400000"
@@ -224,10 +234,9 @@ case "$host_cpu" in
224
234
AC_CHECK_FUNC(_sync_cache_range,true,AC_LIBOBJ(../arch/power/_sync_cache_range))
225
235
;;
226
236
*)
227
- echo "Using a generic machine description."
228
- echo "I'll assume that C floats and doubles are represented by IEEE single and"
229
- echo "double numbers. If this is not so, SF@ etc. will not work correctly."
230
- echo "FLUSH-ICACHE will do nothing, so END-CODE may not work properly!"
237
+ AC_MSG_WARN([Using a generic machine description])
238
+ AC_MSG_WARN([Assuming C floats and doubles are IEEE floats and doubles (for SF@ DF@ SF! DF!)])
239
+ AC_MSG_WARN([FLUSH-ICACHE will do nothing, so END-CODE may not work properly!])
231
240
machine=generic
232
241
esac
233
242
AC_SUBST(host)
@@ -308,9 +317,10 @@ else
308
317
fi
309
318
310
319
#check how to do asm(".skip 16")
320
+ AC_MSG_CHECKING([if and how we can waste code space])
321
+ skipcode=no
311
322
for i in ".skip 16" ".block 16" ".org .+16" ".=.+16" ".space 16"
312
323
do
313
- AC_MSG_CHECKING([whether asm("$i") skips 16 bytes])
314
324
AC_TRY_RUN(
315
325
int foo(int);
316
326
main()
@@ -326,13 +336,20 @@ int foo(int x)
326
336
}
327
337
return (&&label2)-(&&label1);
328
338
}
329
- ,AC_MSG_RESULT(yes)
330
- AC_DEFINE_UNQUOTED(SKIP16,asm("$i"),statement for skipping 16 bytes)
331
- break
332
- ,AC_MSG_RESULT(no),)
333
-
339
+ ,skipcode=$i; break
340
+ ,,)
334
341
done
342
+ AC_MSG_RESULT($skipcode)
343
+ if test "$skipcode" = no
344
+ then
345
+ no_dynamic_default=1
346
+ AC_DEFINE_UNQUOTED(SKIP16,((void)0),statement for skipping 16 bytes)
347
+ AC_MSG_WARN(Disabling dynamic native code generation by default (speed penalty factor ~2))
348
+ else
349
+ AC_DEFINE_UNQUOTED(SKIP16,asm("$skipcode"),statement for skipping 16 bytes)
350
+ fi
335
351
352
+ AC_DEFINE_UNQUOTED(NO_DYNAMIC_DEFAULT,$no_dynamic_default,default value for no_dynamic)
336
353
337
354
dnl Checks for programs.
338
355
AC_PROG_LN_S
350
367
AC_REPLACE_FUNCS(memmove strtoul pow10 strerror strsignal atanh)
351
368
AC_CHECK_FUNCS(dlopen sys_siglist getrusage)
352
369
AC_DECL_SYS_SIGLIST
353
- AC_CHECK_FUNC(getopt_long,true,AC_LIBOBJ(getopt.$ac_objext getopt1))
370
+ AC_CHECK_FUNC(getopt_long,true,AC_LIBOBJ(getopt); AC_LIBOBJ( getopt1))
354
371
AC_CHECK_FUNCS(expm1 log1p)
355
372
AC_REPLACE_FUNCS(rint ecvt)
356
373
dnl No check for select, because our replacement is no good under
0 commit comments