Skip to content

Commit 2134693

Browse files
author
anton
committed
some configure.in cleanups. In particular, I replaced all echos with
AC_MSG_... macros. The gcc version (for disabling dynamic code) is now checked in configure (not when compiling main.c) updated elisp-comp install-sh missing mkinstalldirs from autoconf-2.54
1 parent 2c0a3d5 commit 2134693

File tree

6 files changed

+336
-91
lines changed

6 files changed

+336
-91
lines changed

configure.in

Lines changed: 53 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,16 @@ dnl We use some automake macros here,
2424
dnl but don't use automake for creating Makefile.in
2525
AM_INIT_AUTOMAKE(gforth,0.5.9-20020901)
2626
#snapshots have numbers major.minor.release-YYYYMMDD
27-
#note that lexicographic ordering bust be heeded.
27+
#note that lexicographic ordering must be heeded.
2828
#I.e., 0.4.1-YYYYMMDD must not exist before 0.4.1!
2929
UPDATED="1 September 2002"
3030
AC_SUBST(UPDATED)
3131
AM_CONFIG_HEADER(engine/config.h)
3232
#AM_CYGWIN32
3333

34+
#default setting that may be changed later:
35+
no_dynamic_default=0
36+
3437
AC_ARG_ENABLE(force-reg,
3538
[ --enable-force-reg Use explicit register declarations if they appear in
3639
the machine.h file. This can cause a good speedup,
@@ -59,21 +62,20 @@ CFLAGS=$CFLAGS
5962

6063
AC_PROG_CC
6164

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)
7366

7467
AC_SUBST(CC)
7568
AC_SUBST(DEBUGFLAG)
7669

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+
7779
dnl the following macro produces a warning with autoconf-2.1
7880
AC_CHECK_SIZEOF(char *)
7981
case "$ac_cv_sizeof_char_p" in
@@ -94,6 +96,7 @@ AC_CHECK_SIZEOF(int)
9496
AC_CHECK_SIZEOF(long)
9597
AC_CHECK_SIZEOF(long long)
9698

99+
AC_MSG_CHECKING([for a C type for cells])
97100
ac_cv_int_type_cell=none
98101
case "$ac_cv_sizeof_char_p" in
99102
$ac_cv_sizeof_int)
@@ -112,13 +115,10 @@ case "$ac_cv_sizeof_char_p" in
112115
ac_cv_int_type_cell="long long"
113116
;;
114117
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)
120119
AC_DEFINE_UNQUOTED(CELL_TYPE,$ac_cv_int_type_cell,[an integer type that is as long as a pointer])
121120

121+
AC_MSG_CHECKING([for a C type for double-cells])
122122
ac_cv_int_type_double_cell=none
123123
case `expr 2 '*' "$ac_cv_sizeof_char_p"` in
124124
$ac_cv_sizeof_short)
@@ -134,15 +134,13 @@ case `expr 2 '*' "$ac_cv_sizeof_char_p"` in
134134
ac_cv_int_type_double_cell="long long"
135135
;;
136136
esac
137+
AC_MSG_RESULT($ac_cv_int_type_double_cell)
137138
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.])
142140
AC_LIBOBJ(dblsub)
143141
AC_DEFINE(BUGGY_LONG_LONG,,[define this if there is no working DOUBLE_CELL_TYPE on your machine])
144142
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])
146144
fi
147145

148146
AC_MSG_CHECKING([whether the linker accepts -export-dynamic])
@@ -196,16 +194,28 @@ case "$host_cpu" in
196194
;;
197195
mips*)
198196
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))
199212
#link text and data segment into the same 256M region!
200213
AC_MSG_CHECKING([whether the linker accepts -T])
201214
OLDLDFLAGS=$LDFLAGS
202215
LDFLAGS="$LDFLAGS -Xlinker -T -Xlinker 10000000"
203216
AC_TRY_LINK(,,ac_link_mips_t=yes,ac_link_mips_t=no)
204217
test $ac_link_mips_t = yes||LDFLAGS=$OLDLDFLAGS
205218
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]))
209219
AC_MSG_CHECKING([whether the linker accepts -D])
210220
OLDLDFLAGS=$LDFLAGS
211221
LDFLAGS="$LDFLAGS -Xlinker -D -Xlinker 10400000"
@@ -224,10 +234,9 @@ case "$host_cpu" in
224234
AC_CHECK_FUNC(_sync_cache_range,true,AC_LIBOBJ(../arch/power/_sync_cache_range))
225235
;;
226236
*)
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!])
231240
machine=generic
232241
esac
233242
AC_SUBST(host)
@@ -308,9 +317,10 @@ else
308317
fi
309318

310319
#check how to do asm(".skip 16")
320+
AC_MSG_CHECKING([if and how we can waste code space])
321+
skipcode=no
311322
for i in ".skip 16" ".block 16" ".org .+16" ".=.+16" ".space 16"
312323
do
313-
AC_MSG_CHECKING([whether asm("$i") skips 16 bytes])
314324
AC_TRY_RUN(
315325
int foo(int);
316326
main()
@@ -326,13 +336,20 @@ int foo(int x)
326336
}
327337
return (&&label2)-(&&label1);
328338
}
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+
,,)
334341
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
335351

352+
AC_DEFINE_UNQUOTED(NO_DYNAMIC_DEFAULT,$no_dynamic_default,default value for no_dynamic)
336353

337354
dnl Checks for programs.
338355
AC_PROG_LN_S
@@ -350,7 +367,7 @@ fi
350367
AC_REPLACE_FUNCS(memmove strtoul pow10 strerror strsignal atanh)
351368
AC_CHECK_FUNCS(dlopen sys_siglist getrusage)
352369
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))
354371
AC_CHECK_FUNCS(expm1 log1p)
355372
AC_REPLACE_FUNCS(rint ecvt)
356373
dnl No check for select, because our replacement is no good under

elisp-comp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/sh
2-
# Copyright (C) 1995 Free Software Foundation, Inc.
2+
# Copyright 1995 Free Software Foundation, Inc.
33
# François Pinard <[email protected]>, 1995.
44
#
55
# This program is free software; you can redistribute it and/or modify
@@ -16,6 +16,11 @@
1616
# along with this program; if not, write to the Free Software
1717
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
1818

19+
# As a special exception to the GNU General Public License, if you
20+
# distribute this file as part of a program that contains a
21+
# configuration script generated by Autoconf, you may include it under
22+
# the same distribution terms that you use for the rest of that program.
23+
1924
# This script byte-compiles all `.el' files which are part of its
2025
# arguments, using GNU Emacs, and put the resulting `.elc' files into
2126
# the current directory, so disregarding the original directories used
@@ -41,7 +46,7 @@ else
4146
cd $tempdir
4247

4348
echo "(setq load-path (cons nil load-path))" > script
44-
$EMACS -q -batch -l script -f batch-byte-compile *.el
49+
$EMACS -batch -q -l script -f batch-byte-compile *.el
4550
mv *.elc ..
4651

4752
cd ..

engine/main.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -128,13 +128,8 @@ Cell last_jump=0; /* if the last prim was compiled without jump, this
128128
is it's number, otherwise this contains 0 */
129129

130130
static int no_super=0; /* true if compile_prim should not fuse prims */
131-
/* --no-dynamic by default on gcc versions >=3.1 (it works with 3.0.4,
132-
but not with 3.2) */
133-
#if (__GNUC__>2 && __GNUC_MINOR__>=1)
134-
static int no_dynamic=1; /* true if compile_prim should not generate code */
135-
#else
136-
static int no_dynamic=0; /* true if compile_prim should not generate code */
137-
#endif
131+
static int no_dynamic=NO_DYNAMIC_DEFAULT; /* if true, no code is generated
132+
dynamically */
138133

139134
#ifdef HAS_DEBUG
140135
int debug=0;

install-sh

Lines changed: 35 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,27 @@
11
#!/bin/sh
22
#
33
# install - install a program, script, or datafile
4-
# This comes from X11R5.
4+
# This comes from X11R5 (mit/util/scripts/install.sh).
5+
#
6+
# Copyright 1991 by the Massachusetts Institute of Technology
7+
#
8+
# Permission to use, copy, modify, distribute, and sell this software and its
9+
# documentation for any purpose is hereby granted without fee, provided that
10+
# the above copyright notice appear in all copies and that both that
11+
# copyright notice and this permission notice appear in supporting
12+
# documentation, and that the name of M.I.T. not be used in advertising or
13+
# publicity pertaining to distribution of the software without specific,
14+
# written prior permission. M.I.T. makes no representations about the
15+
# suitability of this software for any purpose. It is provided "as is"
16+
# without express or implied warranty.
517
#
618
# Calling this script install-sh is preferred over install.sh, to prevent
719
# `make' implicit rules from creating a file called install from it
820
# when there is no Makefile.
921
#
1022
# This script is compatible with the BSD install script, but was written
11-
# from scratch.
12-
#
23+
# from scratch. It can only install one file at a time, a restriction
24+
# shared with many OS's install programs.
1325

1426

1527
# set DOITPROG to echo to test this script
@@ -29,7 +41,7 @@ stripprog="${STRIPPROG-strip}"
2941
rmprog="${RMPROG-rm}"
3042
mkdirprog="${MKDIRPROG-mkdir}"
3143

32-
tranformbasename=""
44+
transformbasename=""
3345
transform_arg=""
3446
instcmd="$mvprog"
3547
chmodcmd="$chmodprog 0755"
@@ -97,7 +109,7 @@ then
97109
echo "install: no input file specified"
98110
exit 1
99111
else
100-
true
112+
:
101113
fi
102114

103115
if [ x"$dir_arg" != x ]; then
@@ -106,18 +118,19 @@ if [ x"$dir_arg" != x ]; then
106118

107119
if [ -d $dst ]; then
108120
instcmd=:
121+
chmodcmd=""
109122
else
110-
instcmd=mkdir
123+
instcmd=$mkdirprog
111124
fi
112125
else
113126

114127
# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
115128
# might cause directories to be created, which would be especially bad
116129
# if $src (and thus $dsttmp) contains '*'.
117130

118-
if [ -f $src -o -d $src ]
131+
if [ -f "$src" ] || [ -d "$src" ]
119132
then
120-
true
133+
:
121134
else
122135
echo "install: $src does not exist"
123136
exit 1
@@ -128,7 +141,7 @@ else
128141
echo "install: no destination specified"
129142
exit 1
130143
else
131-
true
144+
:
132145
fi
133146

134147
# If destination is a directory, append the input filename; if your system
@@ -138,7 +151,7 @@ else
138151
then
139152
dst="$dst"/`basename $src`
140153
else
141-
true
154+
:
142155
fi
143156
fi
144157

@@ -150,8 +163,8 @@ dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
150163

151164
# Skip lots of stat calls in the usual case.
152165
if [ ! -d "$dstdir" ]; then
153-
defaultIFS='
154-
'
166+
defaultIFS='
167+
'
155168
IFS="${IFS-${defaultIFS}}"
156169

157170
oIFS="${IFS}"
@@ -170,7 +183,7 @@ while [ $# -ne 0 ] ; do
170183
then
171184
$mkdirprog "${pathcomp}"
172185
else
173-
true
186+
:
174187
fi
175188

176189
pathcomp="${pathcomp}/"
@@ -181,10 +194,10 @@ if [ x"$dir_arg" != x ]
181194
then
182195
$doit $instcmd $dst &&
183196

184-
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
185-
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
186-
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
187-
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
197+
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else : ; fi &&
198+
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else : ; fi &&
199+
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else : ; fi &&
200+
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else : ; fi
188201
else
189202

190203
# If we're going to rename the final executable, determine the name now.
@@ -203,7 +216,7 @@ else
203216
then
204217
dstfile=`basename $dst`
205218
else
206-
true
219+
:
207220
fi
208221

209222
# Make a temp file name in the proper directory.
@@ -222,10 +235,10 @@ else
222235
# ignore errors from any of these, just make sure not to ignore
223236
# errors from the above "$doit $instcmd $src $dsttmp" command.
224237

225-
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
226-
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
227-
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
228-
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
238+
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else :;fi &&
239+
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else :;fi &&
240+
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else :;fi &&
241+
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else :;fi &&
229242

230243
# Now rename the file to the real destination.
231244

0 commit comments

Comments
 (0)