[gforth] / gforth / configure.in  

gforth: gforth/configure.in


1 : anton 1.1 dnl Process this file with autoconf to produce a configure script.
2 : anton 1.20
3 :     #Copyright (C) 1995,1996 Free Software Foundation, Inc.
4 :    
5 :     #This file is part of Gforth.
6 :    
7 :     #Gforth is free software; you can redistribute it and/or
8 :     #modify it under the terms of the GNU General Public License
9 :     #as published by the Free Software Foundation; either version 2
10 :     #of the License, or (at your option) any later version.
11 :    
12 :     #This program is distributed in the hope that it will be useful,
13 :     #but WITHOUT ANY WARRANTY; without even the implied warranty of
14 :     #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.#See the
15 :     #GNU General Public License for more details.
16 :    
17 :     #You should have received a copy of the GNU General Public License
18 :     #along with this program; if not, write to the Free Software
19 :     #Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 :    
21 : anton 1.31 AC_INIT(engine/engine.c)
22 : anton 1.34
23 :     dnl We use some automake macros here,
24 :     dnl but don't use automake for creating Makefile.in
25 :     AM_INIT_AUTOMAKE(gforth,0.4.0)
26 :     AM_CONFIG_HEADER(engine/config.h)
27 :     AM_CYGWIN32
28 : anton 1.14
29 : anton 1.1 AC_ARG_ENABLE(force-reg,
30 :     [ --enable-force-reg Use explicit register declarations if they appear in
31 :     the machine.h file. This can cause a good speedup,
32 :     but also incorrect code with some gcc versions on
33 :     some processors (default disabled).],
34 :    
35 :     AC_DEFINE(FORCE_REG))
36 :     dnl this is not quite according to the autoconf manual, it causes a replacement
37 :     AC_ARG_ENABLE(direct-threaded,
38 :     [ --enable-direct-threaded Force direct threading. This may not work on
39 :     some machines and may cause slowdown on others.
40 :     (default processor-dependent)],
41 :     AC_DEFINE(DIRECT_THREADED))
42 :     AC_ARG_ENABLE(indirect-threaded,
43 :     [ --enable-indirect-threaded Force indirect threading. This can cause a
44 :     slowdown on some machines.
45 :     (default processor-dependent)],
46 :     AC_DEFINE(INDIRECT_THREADED))
47 :    
48 : pazsan 1.9 AC_ARG_WITH(debug,
49 : anton 1.10 [ --with-debug specifies option -g to compile with debug info (default)
50 : anton 1.27 --without-debug omits the -g switch and creates smaller images on
51 :     machines where "strip" has problems with gcc style
52 :     debugging informations.],
53 : pazsan 1.9 if test "$withval" = "yes"; then DEBUGFLAG=-g; fi)
54 :    
55 : anton 1.16 CFLAGS=$CFLAGS
56 :    
57 : pazsan 1.15 AC_PROG_CC
58 :    
59 :     if test "$GCC" = "yes"
60 :     then
61 :     echo "Fine, gcc is available"
62 :     else
63 :     cat <<'EOF'
64 : anton 1.16 Gforth requires GCC-2.0 or higher (it uses GNU C extensions).
65 :     It does not work with other C compilers. Please install the GNU C compiler,
66 :     and try again (or search for a binary distribution for your platform).
67 : pazsan 1.15 EOF
68 :     exit 1
69 :     fi
70 : pazsan 1.9
71 : pazsan 1.15 AC_SUBST(CC)
72 : pazsan 1.9 AC_SUBST(DEBUGFLAG)
73 : anton 1.7
74 : anton 1.10 dnl the following macro produces a warning with autoconf-2.1
75 :     AC_CHECK_SIZEOF(char *)
76 :     case "$ac_cv_sizeof_char_p" in
77 :     2)
78 :     wordsize=16
79 :     ;;
80 :     4)
81 :     wordsize=32
82 :     ;;
83 :     8)
84 :     wordsize=64
85 :     ;;
86 :     esac
87 : pazsan 1.9
88 : pazsan 1.23 AC_CHECK_SIZEOF(short)
89 :     AC_CHECK_SIZEOF(int)
90 :     AC_CHECK_SIZEOF(long)
91 :     AC_CHECK_SIZEOF(long long)
92 :    
93 :     ac_cv_int_type_cell=none
94 :     case "$ac_cv_sizeof_char_p" in
95 :     $ac_cv_sizeof_short)
96 :     ac_cv_int_type_cell=short
97 :     ;;
98 :     $ac_cv_sizeof_int)
99 :     ac_cv_int_type_cell=int
100 :     ;;
101 :     $ac_cv_sizeof_long)
102 :     ac_cv_int_type_cell=long
103 :     ;;
104 :     $ac_cv_sizeof_long_long)
105 :     ac_cv_int_type_cell="long long"
106 :     ;;
107 :     esac
108 : pazsan 1.22 if test "$ac_cv_int_type_cell" != int; then
109 : anton 1.20 echo "So, sizeof(pointer)!=sizeof(int); looks like a DOS C compiler to me."
110 :     echo "Since you don't have a proper C on this machine, that's one more reason"
111 :     echo "to use Forth;-)"
112 :     fi
113 : pazsan 1.23 AC_DEFINE_UNQUOTED(CELL_TYPE,$ac_cv_int_type_cell)
114 :    
115 :     ac_cv_int_type_double_cell=none
116 :     case `expr 2 '*' "$ac_cv_sizeof_char_p"` in
117 :     $ac_cv_sizeof_short)
118 :     ac_cv_int_type_double_cell=short
119 :     ;;
120 :     $ac_cv_sizeof_int)
121 :     ac_cv_int_type_double_cell=int
122 :     ;;
123 :     $ac_cv_sizeof_long)
124 :     ac_cv_int_type_double_cell=long
125 :     ;;
126 :     $ac_cv_sizeof_long_long)
127 :     ac_cv_int_type_double_cell="long long"
128 :     ;;
129 :     esac
130 : anton 1.21 if test "$ac_cv_int_type_double_cell" = none; then
131 : anton 1.20 echo "Emulating double-cell arithmetic. This may be slow."
132 :     echo "If you find this unacceptable, ask the GCC maintainers to provide proper"
133 : pazsan 1.23 echo 'long longs for your machine (the GCC manual states that they \"are twice as'
134 :     echo "long as \`long int\'\")."
135 : anton 1.20 LIBOBJS="$LIBOBJS dblsub.o"
136 :     AC_DEFINE(BUGGY_LONG_LONG)
137 : pazsan 1.23 else
138 :     AC_DEFINE_UNQUOTED(DOUBLE_CELL_TYPE,$ac_cv_int_type_double_cell)
139 : anton 1.20 fi
140 :    
141 : anton 1.1 #terminology is a bit unusual here: The host is the system on which
142 :     #gforth will run; the system on which configure will run is the `build'
143 :     AC_CANONICAL_HOST
144 :     case "$host_cpu" in
145 :     hppa*)
146 : anton 1.34 machine=hppa
147 :     LIBOBJS="$LIBOBJS cache.o"
148 : pazsan 1.6 LDFLAGS="-Xlinker -N"
149 :     LIBS="-L/lib/pa1.1/"
150 : anton 1.31 if test "${enable_direct_threaded+set}" = ""
151 :     then
152 :     AC_DEFINE(DIRECT_THREADED)
153 :     fi
154 : anton 1.1 ;;
155 :     sparc*)
156 : anton 1.34 machine=sparc
157 : anton 1.1 ;;
158 : anton 1.31 i386)
159 : anton 1.34 machine=386
160 : anton 1.16 CFLAGS="$CFLAGS -fomit-frame-pointer -fforce-addr -fforce-mem"
161 : anton 1.31 if test "${enable_direct_threaded+set}" = "" \
162 :     -a "${enable_indirect_threaded+set}" = ""
163 :     then
164 : anton 1.34 echo "Using direct threaded code on 386"
165 : anton 1.31 AC_DEFINE(DIRECT_THREADED)
166 :     fi
167 :     ;;
168 :     i486)
169 : anton 1.34 machine=386
170 : anton 1.31 CFLAGS="$CFLAGS -fomit-frame-pointer -fforce-addr -fforce-mem -m486"
171 :     if test "${enable_direct_threaded+set}" = "" \
172 :     -a "${enable_indirect_threaded+set}" = ""
173 :     then
174 : anton 1.34 echo "Using direct threaded code on 486"
175 : anton 1.31 AC_DEFINE(DIRECT_THREADED)
176 :     fi
177 :     ;;
178 :     i586|i686)
179 : anton 1.34 machine=386
180 : anton 1.31 CFLAGS="$CFLAGS -fomit-frame-pointer -fforce-addr -fforce-mem -m486"
181 :     if test "${enable_direct_threaded+set}" = "" \
182 :     -a "${enable_indirect_threaded+set}" = ""
183 :     then
184 : anton 1.34 echo "Using indirect threaded code on Pentium and up"
185 : anton 1.31 AC_DEFINE(INDIRECT_THREADED)
186 :     fi
187 : anton 1.1 ;;
188 : pazsan 1.26 m68k)
189 : anton 1.34 machine=m68k
190 : pazsan 1.32 CFLAGS="$CFLAGS -fomit-frame-pointer"
191 :     if test "$host_os" = "nextstep3"
192 :     then
193 :     LIBOBJS="$LIBOBJS termios.o"
194 :     fi
195 : pazsan 1.26 ;;
196 : anton 1.1 mips*)
197 : anton 1.34 machine=mips
198 : anton 1.7 #link text and data segment into the same 256M region!
199 : anton 1.37 AC_MSG_CHECKING([whether the linker accepts -D])
200 :     OLDLDFLAGS=$LDFLAGS
201 :     LDFLAGS="$LDFLAGS -Xlinker -T -Xlinker 10000000 -Xlinker -D -Xlinker 10400000"
202 :     AC_TRY_LINK(,,ac_link_mips_d=yes,ac_link_mips_d=no)
203 :     test $ac_link_mips_d = yes||LDFLAGS="$OLDLDFLAGS -Xlinker -T -Xlinker 10000000"
204 :     AC_MSG_RESULT($ac_link_mips_d)
205 : anton 1.1 ;;
206 : pazsan 1.9 alpha*)
207 : anton 1.34 machine=alpha
208 : pazsan 1.9 ;;
209 : anton 1.31 power*)
210 : anton 1.34 machine=power
211 : anton 1.36 AC_CHECK_FUNC(_sync_cache_range,true,LIBOBJS="$LIBOBJS ../arch/power/_sync_cache_range.o")
212 : anton 1.31 ;;
213 : anton 1.1 *)
214 :     echo "No direct threading support for $host_cpu, using indirect threading."
215 : anton 1.20 echo "Using a generic machine description."
216 : anton 1.1 echo "I'll assume that C floats and doubles are represented by IEEE single and"
217 :     echo "double numbers. If this is not so, SF@ etc. will not work correctly."
218 : anton 1.16 echo "FLUSH-ICACHE will do nothing, so END-CODE may not work properly!"
219 : anton 1.34 machine=generic
220 : anton 1.1 esac
221 : anton 1.10 AC_SUBST(host)
222 : pazsan 1.15 AC_SUBST(ENGINE_FLAGS)
223 : anton 1.1
224 :     dnl Now a little support for DOS/DJGCC
225 : pazsan 1.30 AC_SUBST(GFORTH_EXE)
226 :     GFORTH_EXE=""
227 :     AC_SUBST(GFORTHDITC_EXE)
228 :     GFORTHDITC_EXE=""
229 : anton 1.1
230 : anton 1.24 PATHSEP=":"
231 :     AC_SUBST(PATHSEP)
232 :     AC_DEFINE_UNQUOTED(PATHSEP,'$PATHSEP')
233 : anton 1.27
234 :     AC_SUBST(FORTHSIZES)
235 : anton 1.24
236 : anton 1.1 dnl copy commands for systems that don't have links
237 : pazsan 1.29 AC_SUBST(LINK_KERNL)
238 :     LINK_KERNL=""
239 : anton 1.1
240 :     #if test $host_os=dos
241 :     #then
242 :     # echo Configuring for DOS!!!
243 :     # MAKE_EXE="coff2exe gforth"
244 : pazsan 1.29 # LINK_KERNL='$(CP) kernl32l.fi kernel.fi'
245 : anton 1.1 #fi
246 :    
247 :     dnl the following macro produces a warning with autoconf-2.1
248 :     AC_C_BIGENDIAN
249 : pazsan 1.23 AC_SUBST(KERNEL)
250 : anton 1.1 dnl ac_cv_c_bigendian is an undocumented variable of autoconf-2.1
251 :     if test $ac_cv_c_bigendian = yes; then
252 :     bytesex=b
253 : pazsan 1.23 KERNEL="kernl16b.fi kernl16l.fi kernl32b.fi kernl32l.fi kernl64b.fi kernl64l.fi"
254 : anton 1.1 else
255 :     bytesex=l
256 : pazsan 1.23 KERNEL="kernl16l.fi kernl16b.fi kernl32l.fi kernl32b.fi kernl64l.fi kernl64b.fi"
257 : anton 1.1 fi
258 :    
259 :     dnl Checks for programs.
260 :     AC_PROG_LN_S
261 : anton 1.34 dnl AM_PROG_INSTALL #performed by AM_INIT_AUTOMAKE
262 : anton 1.1
263 :     dnl Checks for library functions
264 : anton 1.2 dnl This check is just for making later checks link with libm.
265 :     dnl using sin here is no good idea since it is built-into gcc and typechecked
266 :     AC_CHECK_LIB(m,asin)
267 : anton 1.31 AC_CHECK_FUNCS(dlopen)
268 :     AC_CHECK_LIB(dl,dlopen)
269 :     AC_CHECK_LIB(kernel32,GetModuleHandle)
270 : pazsan 1.32 if test "$host_os" != "nextstep3"
271 :     then
272 :     AC_FUNC_MEMCMP
273 :     fi
274 : pazsan 1.25 AC_REPLACE_FUNCS(memmove strtoul pow10 strerror strsignal atanh)
275 : anton 1.17 AC_CHECK_FUNCS(sys_siglist)
276 : anton 1.19 AC_DECL_SYS_SIGLIST
277 : anton 1.34 AC_CHECK_FUNC(getopt_long,true,LIBOBJS="$LIBOBJS getopt.o getopt1.o")
278 : anton 1.11 AC_CHECK_FUNCS(rint expm1 log1p)
279 : anton 1.1 AC_REPLACE_FUNCS(ecvt)
280 :     dnl No check for select, because our replacement is no good under
281 :     dnl anything but DOS
282 : anton 1.28 AC_CHECK_HEADERS(sys/mman.h)
283 :     AC_CHECK_FUNCS(mmap sysconf getpagesize)
284 : anton 1.34 AM_PATH_LISPDIR
285 : anton 1.1
286 : pazsan 1.23 kernel_fi=kernl${wordsize}${bytesex}.fi
287 :     AC_SUBST(kernel_fi)
288 : anton 1.8
289 : anton 1.34 AC_SUBST(machine)
290 :     dnl AC_LINK_FILES(arch/$machine,arch/machine) #no longer needed
291 : anton 1.31 AC_OUTPUT([
292 :     Makefile
293 : anton 1.35 engine/Makefile
294 :     doc/version.texi ],echo timestamp > stamp-h)

CVS Admin

Powered by ViewCVS 1.0-dev
(Powered by ViewCVS)

ViewCVS and CVS Help