[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 : anton 1.41 #Copyright (C) 1995,1996,1997,1998 Free Software Foundation, Inc.
4 : anton 1.20
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 : anton 1.66 AM_INIT_AUTOMAKE(gforth,0.4.9-20000715)
26 : anton 1.47 #snapshots have numbers major.minor.release-YYYYMMDD
27 :     #note that lexicographic ordering bust be heeded.
28 :     #I.e., 0.4.1-YYYYMMDD must not exist before 0.4.1!
29 : anton 1.34 AM_CONFIG_HEADER(engine/config.h)
30 : anton 1.57 #AM_CYGWIN32
31 : anton 1.14
32 : anton 1.1 AC_ARG_ENABLE(force-reg,
33 :     [ --enable-force-reg Use explicit register declarations if they appear in
34 :     the machine.h file. This can cause a good speedup,
35 :     but also incorrect code with some gcc versions on
36 :     some processors (default disabled).],
37 :    
38 :     AC_DEFINE(FORCE_REG))
39 :     dnl this is not quite according to the autoconf manual, it causes a replacement
40 :     AC_ARG_ENABLE(direct-threaded,
41 :     [ --enable-direct-threaded Force direct threading. This may not work on
42 :     some machines and may cause slowdown on others.
43 :     (default processor-dependent)],
44 :     AC_DEFINE(DIRECT_THREADED))
45 :     AC_ARG_ENABLE(indirect-threaded,
46 :     [ --enable-indirect-threaded Force indirect threading. This can cause a
47 :     slowdown on some machines.
48 :     (default processor-dependent)],
49 :     AC_DEFINE(INDIRECT_THREADED))
50 :    
51 : pazsan 1.9 AC_ARG_WITH(debug,
52 : anton 1.10 [ --with-debug specifies option -g to compile with debug info (default)
53 : anton 1.27 --without-debug omits the -g switch and creates smaller images on
54 :     machines where "strip" has problems with gcc style
55 :     debugging informations.],
56 : pazsan 1.9 if test "$withval" = "yes"; then DEBUGFLAG=-g; fi)
57 :    
58 : anton 1.16 CFLAGS=$CFLAGS
59 :    
60 : pazsan 1.15 AC_PROG_CC
61 :    
62 :     if test "$GCC" = "yes"
63 :     then
64 :     echo "Fine, gcc is available"
65 :     else
66 :     cat <<'EOF'
67 : anton 1.16 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 : pazsan 1.15 EOF
71 :     exit 1
72 :     fi
73 : pazsan 1.9
74 : pazsan 1.15 AC_SUBST(CC)
75 : pazsan 1.9 AC_SUBST(DEBUGFLAG)
76 : anton 1.7
77 : anton 1.10 dnl the following macro produces a warning with autoconf-2.1
78 :     AC_CHECK_SIZEOF(char *)
79 :     case "$ac_cv_sizeof_char_p" in
80 :     2)
81 :     wordsize=16
82 :     ;;
83 :     4)
84 :     wordsize=32
85 :     ;;
86 :     8)
87 :     wordsize=64
88 :     ;;
89 :     esac
90 : pazsan 1.9
91 : pazsan 1.40 AC_CHECK_SIZEOF(char)
92 : pazsan 1.23 AC_CHECK_SIZEOF(short)
93 :     AC_CHECK_SIZEOF(int)
94 :     AC_CHECK_SIZEOF(long)
95 :     AC_CHECK_SIZEOF(long long)
96 :    
97 :     ac_cv_int_type_cell=none
98 :     case "$ac_cv_sizeof_char_p" in
99 : pazsan 1.40 $ac_cv_sizeof_int)
100 :     ac_cv_int_type_cell=int
101 :     ;;
102 : pazsan 1.23 $ac_cv_sizeof_short)
103 :     ac_cv_int_type_cell=short
104 :     ;;
105 : pazsan 1.40 $ac_cv_sizeof_char)
106 :     ac_cv_int_type_cell=char
107 : pazsan 1.23 ;;
108 :     $ac_cv_sizeof_long)
109 :     ac_cv_int_type_cell=long
110 :     ;;
111 :     $ac_cv_sizeof_long_long)
112 :     ac_cv_int_type_cell="long long"
113 :     ;;
114 :     esac
115 : pazsan 1.22 if test "$ac_cv_int_type_cell" != int; then
116 : anton 1.20 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
120 : pazsan 1.23 AC_DEFINE_UNQUOTED(CELL_TYPE,$ac_cv_int_type_cell)
121 :    
122 :     ac_cv_int_type_double_cell=none
123 :     case `expr 2 '*' "$ac_cv_sizeof_char_p"` in
124 :     $ac_cv_sizeof_short)
125 :     ac_cv_int_type_double_cell=short
126 :     ;;
127 :     $ac_cv_sizeof_int)
128 :     ac_cv_int_type_double_cell=int
129 :     ;;
130 :     $ac_cv_sizeof_long)
131 :     ac_cv_int_type_double_cell=long
132 :     ;;
133 :     $ac_cv_sizeof_long_long)
134 :     ac_cv_int_type_double_cell="long long"
135 :     ;;
136 :     esac
137 : anton 1.21 if test "$ac_cv_int_type_double_cell" = none; then
138 : anton 1.20 echo "Emulating double-cell arithmetic. This may be slow."
139 :     echo "If you find this unacceptable, ask the GCC maintainers to provide proper"
140 : pazsan 1.23 echo 'long longs for your machine (the GCC manual states that they \"are twice as'
141 :     echo "long as \`long int\'\")."
142 : anton 1.20 LIBOBJS="$LIBOBJS dblsub.o"
143 :     AC_DEFINE(BUGGY_LONG_LONG)
144 : pazsan 1.23 else
145 :     AC_DEFINE_UNQUOTED(DOUBLE_CELL_TYPE,$ac_cv_int_type_double_cell)
146 : anton 1.20 fi
147 :    
148 : jwilke 1.50 AC_MSG_CHECKING([whether the linker accepts -export-dynamic])
149 :     OLDLDFLAGS=$LDFLAGS
150 :     LDFLAGS="$LDFLAGS -export-dynamic"
151 :     AC_TRY_LINK(,,ac_export_dynamic=yes,ac_export_dynamic=no)
152 :     test $ac_export_dynamic = yes|| LDFLAGS=$OLDLDFLAGS
153 :     AC_MSG_RESULT($ac_export_dynamic)
154 :    
155 : anton 1.1 #terminology is a bit unusual here: The host is the system on which
156 :     #gforth will run; the system on which configure will run is the `build'
157 :     AC_CANONICAL_HOST
158 :     case "$host_cpu" in
159 :     hppa*)
160 : anton 1.34 machine=hppa
161 : anton 1.46 $srcdir/mkinstalldirs arch/hppa
162 : anton 1.38 LIBOBJS="$LIBOBJS ../arch/hppa/cache.o"
163 : jwilke 1.50 LDFLAGS="$LDFLAGS -Xlinker -N"
164 : anton 1.47 LIBS="$LIBS -L/lib/pa1.1/"
165 : anton 1.31 if test "${enable_direct_threaded+set}" = ""
166 :     then
167 :     AC_DEFINE(DIRECT_THREADED)
168 :     fi
169 : anton 1.1 ;;
170 :     sparc*)
171 : anton 1.34 machine=sparc
172 : anton 1.1 ;;
173 : anton 1.31 i386)
174 : anton 1.34 machine=386
175 : anton 1.16 CFLAGS="$CFLAGS -fomit-frame-pointer -fforce-addr -fforce-mem"
176 : anton 1.31 if test "${enable_direct_threaded+set}" = "" \
177 :     -a "${enable_indirect_threaded+set}" = ""
178 :     then
179 : anton 1.34 echo "Using direct threaded code on 386"
180 : anton 1.31 AC_DEFINE(DIRECT_THREADED)
181 :     fi
182 :     ;;
183 :     i486)
184 : anton 1.34 machine=386
185 : anton 1.31 CFLAGS="$CFLAGS -fomit-frame-pointer -fforce-addr -fforce-mem -m486"
186 :     if test "${enable_direct_threaded+set}" = "" \
187 :     -a "${enable_indirect_threaded+set}" = ""
188 :     then
189 : anton 1.34 echo "Using direct threaded code on 486"
190 : anton 1.31 AC_DEFINE(DIRECT_THREADED)
191 :     fi
192 :     ;;
193 : pazsan 1.53 i586)
194 : anton 1.34 machine=386
195 : anton 1.55 CFLAGS="$CFLAGS -fomit-frame-pointer -fforce-addr -fforce-mem"
196 : pazsan 1.56 CFLAGS_1="$CFLAGS"
197 :     CFLAGS="$CFLAGS -mpentium"
198 :     AC_TRY_COMPILE(,,,CFLAGS="$CFLAGS_1 -m486")
199 : anton 1.31 if test "${enable_direct_threaded+set}" = "" \
200 :     -a "${enable_indirect_threaded+set}" = ""
201 :     then
202 : pazsan 1.53 echo "Using indirect threaded code on Pentium/K5/K6"
203 : anton 1.31 AC_DEFINE(INDIRECT_THREADED)
204 : pazsan 1.53 fi
205 :     ;;
206 :     i686)
207 :     machine=386
208 : anton 1.55 CFLAGS="$CFLAGS -fomit-frame-pointer -fforce-addr -fforce-mem"
209 : pazsan 1.56 CFLAGS_1="$CFLAGS"
210 :     CFLAGS="$CFLAGS -mpentiumpro"
211 :     AC_TRY_COMPILE(,,,CFLAGS="$CFLAGS_1 -m486")
212 : pazsan 1.53 if test "${enable_direct_threaded+set}" = "" \
213 :     -a "${enable_indirect_threaded+set}" = ""
214 :     then
215 : pazsan 1.59 echo "Using direct threaded code on Athlon/PPro/Pentium II/Pentium III"
216 : pazsan 1.53 AC_DEFINE(DIRECT_THREADED)
217 : anton 1.31 fi
218 : anton 1.1 ;;
219 : pazsan 1.26 m68k)
220 : anton 1.34 machine=m68k
221 : pazsan 1.32 CFLAGS="$CFLAGS -fomit-frame-pointer"
222 :     if test "$host_os" = "nextstep3"
223 :     then
224 :     LIBOBJS="$LIBOBJS termios.o"
225 :     fi
226 : pazsan 1.26 ;;
227 : anton 1.1 mips*)
228 : anton 1.34 machine=mips
229 : anton 1.7 #link text and data segment into the same 256M region!
230 : anton 1.49 AC_MSG_CHECKING([whether the linker accepts -T])
231 :     OLDLDFLAGS=$LDFLAGS
232 :     LDFLAGS="$LDFLAGS -Xlinker -T -Xlinker 10000000"
233 :     AC_TRY_LINK(,,ac_link_mips_t=yes,ac_link_mips_t=no)
234 :     test $ac_link_mips_t = yes||LDFLAGS=$OLDLDFLAGS
235 :     AC_MSG_RESULT($ac_link_mips_t)
236 :     test $ac_link_mips_t = yes||(echo cannot link text and data into same 256M region, using indirect threading; AC_DEFINE(INDIRECT_THREADED))
237 : anton 1.37 AC_MSG_CHECKING([whether the linker accepts -D])
238 :     OLDLDFLAGS=$LDFLAGS
239 : anton 1.49 LDFLAGS="$LDFLAGS -Xlinker -D -Xlinker 10400000"
240 : anton 1.37 AC_TRY_LINK(,,ac_link_mips_d=yes,ac_link_mips_d=no)
241 : anton 1.49 test $ac_link_mips_d = yes||LDFLAGS=$OLDLDFLAGS
242 : anton 1.37 AC_MSG_RESULT($ac_link_mips_d)
243 : anton 1.1 ;;
244 : pazsan 1.9 alpha*)
245 : anton 1.34 machine=alpha
246 : anton 1.58 #full IEEE FP support for more uniformity across platforms:
247 :     CFLAGS="$CFLAGS -mieee"
248 : pazsan 1.9 ;;
249 : anton 1.31 power*)
250 : anton 1.34 machine=power
251 : anton 1.46 $srcdir/mkinstalldirs arch/power
252 : anton 1.36 AC_CHECK_FUNC(_sync_cache_range,true,LIBOBJS="$LIBOBJS ../arch/power/_sync_cache_range.o")
253 : anton 1.64 #link text segment into first 32MB
254 :     AC_MSG_CHECKING([whether the linker accepts --script=arch/power/elf32ppc.x])
255 :     OLDLDFLAGS=$LDFLAGS
256 :     #the -L../$srcdir helps when $srcdir is relative
257 :     LDFLAGS="$LDFLAGS -L$srcdir -L../$srcdir -Xlinker --script=$srcdir/arch/power/elf32ppc.x"
258 :     AC_TRY_LINK(,,ac_link_script=yes,ac_link_script=no)
259 :     test $ac_link_script = yes||LDFLAGS=$OLDLDFLAGS
260 :     AC_MSG_RESULT($ac_link_script)
261 : anton 1.65 AC_MSG_CHECKING([whether the code is in the first 32MB])
262 :     AC_TRY_RUN([main(){label: exit(((unsigned long)&&label)>32000000UL);}],ac_code_under_32=yes,ac_code_under_32=no,ac_code_under_32=no)
263 :     AC_MSG_RESULT($ac_code_under_32)
264 :     test $ac_code_under_32 = yes||(AC_MSG_WARN([Using indirect threading; please contact us (bug-gforth@gnu.org)]); AC_DEFINE(INDIRECT_THREADED))
265 : anton 1.31 ;;
266 : anton 1.1 *)
267 :     echo "No direct threading support for $host_cpu, using indirect threading."
268 : anton 1.20 echo "Using a generic machine description."
269 : anton 1.1 echo "I'll assume that C floats and doubles are represented by IEEE single and"
270 :     echo "double numbers. If this is not so, SF@ etc. will not work correctly."
271 : anton 1.16 echo "FLUSH-ICACHE will do nothing, so END-CODE may not work properly!"
272 : anton 1.34 machine=generic
273 : anton 1.1 esac
274 : anton 1.10 AC_SUBST(host)
275 : pazsan 1.15 AC_SUBST(ENGINE_FLAGS)
276 : anton 1.1
277 : anton 1.66 AC_CHECK_PROG(asm_fs,asm.fs,arch/$machine/asm.fs,,$srcdir/arch/$machine)
278 : anton 1.61 AC_SUBST(asm_fs)
279 :    
280 : anton 1.66 AC_CHECK_PROG(disasm_fs,disasm.fs,arch/$machine/disasm.fs,,$srcdir/arch/$machine)
281 : anton 1.61 AC_SUBST(disasm_fs)
282 :    
283 : pazsan 1.39 case "$host_os" in
284 :     *win32)
285 :     EXE=".exe"
286 :     ;;
287 :     *)
288 :     EXE=""
289 :     ;;
290 :     esac
291 :     AC_SUBST(EXE)
292 :    
293 : anton 1.1 dnl Now a little support for DOS/DJGCC
294 : pazsan 1.30 AC_SUBST(GFORTH_EXE)
295 :     GFORTH_EXE=""
296 : anton 1.48 AC_SUBST(GFORTHFAST_EXE)
297 :     GFORTHFAST_EXE=""
298 : pazsan 1.30 AC_SUBST(GFORTHDITC_EXE)
299 :     GFORTHDITC_EXE=""
300 : anton 1.1
301 : anton 1.24 PATHSEP=":"
302 :     AC_SUBST(PATHSEP)
303 :     AC_DEFINE_UNQUOTED(PATHSEP,'$PATHSEP')
304 : anton 1.27
305 :     AC_SUBST(FORTHSIZES)
306 : anton 1.24
307 : anton 1.1 dnl copy commands for systems that don't have links
308 : pazsan 1.29 AC_SUBST(LINK_KERNL)
309 :     LINK_KERNL=""
310 : anton 1.1
311 :     #if test $host_os=dos
312 :     #then
313 :     # echo Configuring for DOS!!!
314 :     # MAKE_EXE="coff2exe gforth"
315 : pazsan 1.29 # LINK_KERNL='$(CP) kernl32l.fi kernel.fi'
316 : anton 1.1 #fi
317 :    
318 :     dnl the following macro produces a warning with autoconf-2.1
319 :     AC_C_BIGENDIAN
320 : pazsan 1.23 AC_SUBST(KERNEL)
321 : anton 1.1 dnl ac_cv_c_bigendian is an undocumented variable of autoconf-2.1
322 :     if test $ac_cv_c_bigendian = yes; then
323 :     bytesex=b
324 : pazsan 1.23 KERNEL="kernl16b.fi kernl16l.fi kernl32b.fi kernl32l.fi kernl64b.fi kernl64l.fi"
325 : anton 1.1 else
326 :     bytesex=l
327 : pazsan 1.23 KERNEL="kernl16l.fi kernl16b.fi kernl32l.fi kernl32b.fi kernl64l.fi kernl64b.fi"
328 : anton 1.1 fi
329 :    
330 :     dnl Checks for programs.
331 :     AC_PROG_LN_S
332 : anton 1.34 dnl AM_PROG_INSTALL #performed by AM_INIT_AUTOMAKE
333 : anton 1.1
334 :     dnl Checks for library functions
335 : anton 1.2 dnl This check is just for making later checks link with libm.
336 :     dnl using sin here is no good idea since it is built-into gcc and typechecked
337 :     AC_CHECK_LIB(m,asin)
338 : anton 1.31 AC_CHECK_LIB(dl,dlopen)
339 : pazsan 1.32 if test "$host_os" != "nextstep3"
340 :     then
341 :     AC_FUNC_MEMCMP
342 :     fi
343 : pazsan 1.25 AC_REPLACE_FUNCS(memmove strtoul pow10 strerror strsignal atanh)
344 : anton 1.44 AC_CHECK_FUNCS(dlopen sys_siglist)
345 : anton 1.19 AC_DECL_SYS_SIGLIST
346 : anton 1.34 AC_CHECK_FUNC(getopt_long,true,LIBOBJS="$LIBOBJS getopt.o getopt1.o")
347 : anton 1.11 AC_CHECK_FUNCS(rint expm1 log1p)
348 : anton 1.1 AC_REPLACE_FUNCS(ecvt)
349 :     dnl No check for select, because our replacement is no good under
350 :     dnl anything but DOS
351 : anton 1.62 AC_CHECK_HEADERS(sys/mman.h fnmatch.h)
352 : anton 1.63 AC_FUNC_FNMATCH
353 :     test $ac_cv_func_fnmatch_works = yes || LIBOBJS="$LIBOBJS fnmatch.o"
354 : anton 1.28 AC_CHECK_FUNCS(mmap sysconf getpagesize)
355 : anton 1.34 AM_PATH_LISPDIR
356 : anton 1.1
357 : pazsan 1.23 kernel_fi=kernl${wordsize}${bytesex}.fi
358 :     AC_SUBST(kernel_fi)
359 : jwilke 1.50
360 :     dnl replace srource directory by absolute value
361 :     if test $srcdir = "."; then srcdir=`pwd`
362 :     fi
363 : anton 1.8
364 : anton 1.34 AC_SUBST(machine)
365 :     dnl AC_LINK_FILES(arch/$machine,arch/machine) #no longer needed
366 : anton 1.31 AC_OUTPUT([
367 :     Makefile
368 : pazsan 1.45 Makedist
369 : anton 1.43 gforthmi
370 : anton 1.35 engine/Makefile
371 : anton 1.44 doc/version.texi ],
372 :     echo timestamp > stamp-h
373 : anton 1.43 chmod +x gforthmi
374 : anton 1.44 test -d kernel||mkdir kernel)
375 :    

CVS Admin

Powered by ViewCVS 1.0-dev
(Powered by ViewCVS)

ViewCVS and CVS Help