configure.ac 49.9 KB
Newer Older
1
dnl Process this file with autoconf to produce a configure script.
2

3
#Authors: Bernd Paysan, Anton Ertl
Anton Ertl's avatar
Anton Ertl committed
4
#Copyright (C) 1995,1996,1997,1998,2000,2003,2004,2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019 Free Software Foundation, Inc.
5 6 7 8 9

#This file is part of Gforth.

#Gforth is free software; you can redistribute it and/or
#modify it under the terms of the GNU General Public License
anton's avatar
anton committed
10
#as published by the Free Software Foundation, either version 3
11 12 13 14
#of the License, or (at your option) any later version.

#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
15
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 17 18
#GNU General Public License for more details.

#You should have received a copy of the GNU General Public License
anton's avatar
anton committed
19
#along with this program. If not, see http://www.gnu.org/licenses/.
20

anton's avatar
anton committed
21

22 23
#We use some automake macros here,
#but don't use automake for creating Makefile.in
Bernd Paysan's avatar
Bernd Paysan committed
24
AC_INIT([gforth],[0.7.9_20200402],[https://savannah.gnu.org/bugs/?func=addbug&group=gforth])
anton's avatar
anton committed
25
AC_PREREQ(2.54)
Bernd Paysan's avatar
Bernd Paysan committed
26
AC_CONFIG_MACRO_DIR([m4])
27
#snapshots have numbers major.minor.release_YYYYMMDD
28
#note that lexicographic ordering must be heeded.
29
#I.e., 0.4.1_YYYYMMDD must not exist before 0.4.1!
Bernd Paysan's avatar
Bernd Paysan committed
30
UPDATED="February 8, 2018"
anton's avatar
anton committed
31
AC_SUBST(UPDATED)
32
AC_CONFIG_HEADERS(engine/config.h)
33 34
AC_USE_SYSTEM_EXTENSIONS
LT_INIT([disable-static])
Bernd Paysan's avatar
Bernd Paysan committed
35 36
LT_CONFIG_LTDL_DIR([libltdl])
LTDL_INIT
37

38 39 40 41 42 43 44 45
#remnants from having ltdl as convenience library
LTDLDEPS=""
LTDLINCL=""
LIBLTDL=""
LTDL_LDLIBS=""
AC_SUBST(LTDLDEPS)
AC_SUBST(LTDLINCL)
AC_SUBST(LIBLTDL)
46 47
AC_SUBST(LTDL_LDLIBS)

anton's avatar
anton committed
48
#suppress the "-g -O2" default
Bernd Paysan's avatar
Bernd Paysan committed
49 50 51 52 53 54 55
case "$CFLAGS" in
     *-O*)
	;;
     *)
	CFLAGS="$CFLAGS -O2"
	;;
esac
anton's avatar
anton committed
56

57 58
AC_SUBST(PROFEXES)
AC_SUBST(PROFOBJS)
anton's avatar
anton committed
59
AC_ARG_ENABLE(prof,
60 61 62 63
	AC_HELP_STRING([--enable-prof],
			[ Build gforth-prof, which outputs frequently occuring
                          sequences of primitives.]),
	,enable_prof=no)
64 65
if test "$enable_prof" != "no"; then
  PROFEXES='gforth-prof$(OPT)$(EXE)'; PROFOBJS='engine-prof$(OPT).o main-prof$(OPT).o profile$(OPT).o'
66
fi
67

68
AC_ARG_WITH(debug,
pazsan's avatar
pazsan committed
69 70 71 72
[  --with-debug		  specifies option -g to compile with debug info
  --without-debug	  omits the -g switch and creates smaller images on
			  machines where "strip" has problems with gcc style
			  debugging informations.],
73 74
if test "$withval" = "yes"; then DEBUGFLAG=-g; fi)

Bernd Paysan's avatar
Bernd Paysan committed
75
NO_CHECK=""
76
NO_FAIL=""
Bernd Paysan's avatar
Bernd Paysan committed
77 78 79 80 81 82 83
COMMENT="#"

AC_ARG_WITH(check,
[  --with-check		  enables sanity check during build (default)
  --without-check	  disables sanity check during build],
if test "$withval" = "no"; then NO_CHECK="$COMMENT"; fi)

pazsan's avatar
pazsan committed
84 85
GCC_LD="\$(GCC)"
EC_MODE="false"
pazsan's avatar
pazsan committed
86
NO_EC=""
pazsan's avatar
pazsan committed
87
EC=""
88 89
engine2='engine2$(OPT).o'
engine_fast2='engine-fast2$(OPT).o'
pazsan's avatar
pazsan committed
90 91 92 93
no_dynamic=""
image_i=""
signals_o="io.o signals.o"

pazsan's avatar
pazsan committed
94
AC_CANONICAL_HOST
95 96
AC_ARG_WITH(ec,
	AC_HELP_STRING([--with-ec=<arch>],
97
			[  Build gforth for systems without OS.]),
98
[if test "$withval" = "no"; then
99
  echo "defining hosted system"
100 101 102 103 104
else
  echo "defining standalone system (${withval})"
  AC_DEFINE(STANDALONE,,[Define if you want a Gforth without OS])
  EC_MODE="true"
  EC="-ec"
pazsan's avatar
pazsan committed
105
  NO_EC="#"
106 107
  NO_CHECK="true"
  NO_CHECKX="#"
108
  NO_CROSS="#"
109 110 111 112 113 114 115 116 117
  engine2=""
  engine_fast2=""
  no_dynamic="-DNO_DYNAMIC"
  image_i="image.i"
  if test "$withval" != "yes"; then
    signals_o="io-${withval}.o"
  else
    signals_o="io.o"
  fi
Bernd Paysan's avatar
Bernd Paysan committed
118 119 120 121 122 123 124 125
  cpu=$host_cpu
  case "$cpu" in
     i*86)
	cpu=386
     ;;
     x86_64)
        cpu=amd64
     ;;
Bernd Paysan's avatar
Bernd Paysan committed
126
     arm64|aarch64)
Bernd Paysan's avatar
Bernd Paysan committed
127 128
	cpu=arm64
     ;;
Bernd Paysan's avatar
Bernd Paysan committed
129 130
  esac

Bernd Paysan's avatar
Bernd Paysan committed
131 132
  if test -f "$srcdir/arch/${cpu}/${withval}/config.sh"; then
    source "$srcdir/arch/${cpu}/${withval}/config.sh"
pazsan's avatar
pazsan committed
133
  fi
134 135
  GCC_PATH=$(which $CC)
  LIB_PATH=${GCC_PATH%/*/*}
136 137 138 139
  GCC_LD="\$(LD)"
  platform=${withval}
fi])

140
libbench='#'
pazsan's avatar
pazsan committed
141 142
AC_ARG_ENABLE(lib,
	AC_HELP_STRING([--enable-lib],
143 144
		       [  Compile Gforth as shared library (default enabled).]),
	,enable_lib=yes)
pazsan's avatar
pazsan committed
145

146 147 148 149 150 151 152
AC_ARG_WITH(cross,
	AC_HELP_STRING([--with-cross=<arch>],
			[  Build gforth using a cross compiler.]),
[if test "$withval" = "no"; then
  echo "defining hosted system"
else
  echo "defining cross compiled system (${withval})"
Bernd Paysan's avatar
Bernd Paysan committed
153 154 155 156 157 158 159 160
  cpu=$host_cpu
  case "$cpu" in
     i*86)
	cpu=386
     ;;
     x86_64)
        cpu=amd64
     ;;
Bernd Paysan's avatar
Bernd Paysan committed
161
     arm64|aarch64)
Bernd Paysan's avatar
Bernd Paysan committed
162 163
	cpu=arm64
     ;;
Bernd Paysan's avatar
Bernd Paysan committed
164 165
  esac

Bernd Paysan's avatar
Bernd Paysan committed
166 167
  if test -f "$srcdir/arch/${cpu}/${withval}/config.sh"; then
    source "$srcdir/arch/${cpu}/${withval}/config.sh"
168 169 170
  fi
  GCC_PATH=$(which $CC)
  LIB_PATH=${GCC_PATH%/*/*}
171
  platform=${withval}
172
  NO_EC=""
173 174
  NO_CHECK="true"
  NO_CHECKX="#"
175
  NO_CROSS="#"
176
  NO_FAIL="-"
177
fi])
pazsan's avatar
pazsan committed
178

179 180 181 182 183 184 185 186 187
EXTRAS=""
AC_ARG_WITH(extras,
	AC_HELP_STRING([--with-extras=<path>],
			[  add extra stuff from <path>]),
[if test "$withval" != "no"; then
  EXTRAS+="${withval} "
fi])
AC_SUBST(EXTRAS)

188 189 190 191 192 193
AC_ARG_WITH(install,
	AC_HELP_STRING([--with-install=<things>],
			[  Install extra <things>]),
[if test "$withval" != "no"; then
    for i in ${withval//,/ }
    do
194 195
	echo "install $i with $ac_configure_args ..."
	eval ./install-$i.sh $ac_configure_args
196 197 198
    done
fi])

199
DITCENGINE="./gforth-ditc"
200 201 202
AC_ARG_WITH(ditc,
	AC_HELP_STRING([--with-ditc=<engine>],
			[  Use this engine for compilation of gforth.fi]),
203
[if test $"withval" != "no"; then
204 205 206 207
  DITCENGINE=${withval}
fi])
AC_SUBST(DITCENGINE)

208 209 210
GFORTH_VERSION=$PACKAGE_VERSION
AC_SUBST(GFORTH_VERSION)

211 212 213 214 215 216 217
AC_ARG_ENABLE(version,
	AC_HELP_STRING([--disable-version],
			[  disable multi-version install]),
[if test "$enableval" = "no"; then
    PACKAGE_VERSION=current
fi],)

218
#variables mentioned in INSTALL
pazsan's avatar
pazsan committed
219
AC_ARG_VAR(SH, [The shell])
220
AC_ARG_VAR(CC, [The C compiler (must support GNU C 2.x).])
Bernd Paysan's avatar
Bernd Paysan committed
221
AC_ARG_VAR(HOSTCC, [The C compiler on the host (must have the same byte order and word size as target CC).])
222
AC_ARG_VAR(FORTHSIZES, [Gforth command line options for the default stack and dictionary sizes (see INSTALL).])
223
AC_ARG_VAR(STACK_CACHE_REGS, [number of registers in the maximum stack cache state for gforth-fast and gforth-native (default platform-dependent).])
224
AC_ARG_VAR(STACK_CACHE_DEFAULT_FAST, [number of registers in the default stack cache state for gforth-fast and gforth-native (default 1).])
225
AC_ARG_VAR(GCC_PR15242_WORKAROUND, [Force the enabling (1) or disabling (0) of a workaround for a gcc-3.x performance bug (default unset: use workaround for gcc-3.x)])
226
AC_ARG_VAR(LIBCC_BUILD_SRC, [(Additional) libcc interface source files that should be processed on building and installation (default none)])
227

228
AC_ARG_VAR(ac_cv_sizeof_char_p, [sizeof(char *)])
229
AC_ARG_VAR(ac_cv_sizeof_void_p, [sizeof(void *)])
230 231 232 233 234 235
AC_ARG_VAR(ac_cv_sizeof_char, [sizeof(char)])
AC_ARG_VAR(ac_cv_sizeof_short, [sizeof(short)])
AC_ARG_VAR(ac_cv_sizeof_int, [sizeof(int)])
AC_ARG_VAR(ac_cv_sizeof_long, [sizeof(long)])
AC_ARG_VAR(ac_cv_sizeof_long_long, [sizeof(long long)])
AC_ARG_VAR(ac_cv_sizeof_intptr_t, [sizeof(intptr_t)])
anton's avatar
anton committed
236 237
AC_ARG_VAR(ac_cv_sizeof_int128_t, [sizeof(int128_t)])
AC_ARG_VAR(ac_cv_sizeof_uint128_t, [sizeof(uint128_t)])
anton's avatar
anton committed
238 239
AC_ARG_VAR(ac_cv_c_bigendian, [Is the target big-endian ("yes" or "no")?])
AC_ARG_VAR(no_dynamic_default, [run gforth with --dynamic (0) or --no-dynamic (1) by default])
240
AC_ARG_VAR(condbranch_opt, [enable (1) or disable (0) using two dispatches for conditional branches])
anton's avatar
anton committed
241
AC_ARG_VAR(skipcode, [assembly code for skipping 16 bytes of code])
242
AC_ARG_VAR(asmcomment, [assembler comment start string])
243
AC_ARG_VAR(arm_cacheflush, [file containing ARM cacheflush function (without .c)])
244
AC_ARG_VAR(LTDL_LIBRARY_PATH, [additional directories for libltdl (for some 64-bit platforms)])
pazsan's avatar
pazsan committed
245

Anton Ertl's avatar
Anton Ertl committed
246 247 248 249
#ecvt_r is buggy on at least MacOS X, and not better than our ecvt_r
# in glibc, so use our ecvt_r by default
test -z "$ac_cv_func_ecvt_r" && ac_cv_func_ecvt_r=no

Bernd Paysan's avatar
Bernd Paysan committed
250 251
test -z "$HOSTCC" && HOSTCC='$(GCC)'

252 253
#set up feature test macros, so the tests get them right:
# turn on all POSIX, SUSv3, and GNU features if available
254
AC_GNU_SOURCE
255 256 257 258 259 260 261 262
#AC_DEFINE_UNQUOTED([_GNU_SOURCE],1,[feature test macro])

#Don't define _POSIX_SOURCE etc. because some OSs (in particular
#MacOSX) disable some features then (MacOSX checks for _POSIX_SOURCE,
#but not for _XOPEN_SOURCE)
#AC_DEFINE_UNQUOTED([_POSIX_SOURCE],1,[feature test macro])
#AC_DEFINE_UNQUOTED([_POSIX_C_SOURCE],199506L,[feature test macro])
#AC_DEFINE_UNQUOTED([_XOPEN_SOURCE],600,[feature test macro])
263
# turn on large file support with 64-bit off_t where available
264
AC_SYS_LARGEFILE
265 266
#AC_DEFINE_UNQUOTED([_LARGEFILE_SOURCE],1,[feature test macro])
#AC_DEFINE_UNQUOTED([_FILE_OFFSET_BITS],64,[feature test macro])
267

268 269 270
#currently we force direct threading this way.  Eventually we should
#setup in the arch and engine files right

pazsan's avatar
pazsan committed
271 272
AC_PROG_CC

273
test "$GCC" = "yes" || AC_MSG_ERROR(Gforth uses GNU C extensions and requires GCC 2.0 or higher)
274

pazsan's avatar
pazsan committed
275 276
test "x$SH" = "x" && SH="/bin/sh"

277 278
AC_MSG_CHECKING([whether to use two dispatches per conditional branch])
test x$condbranch_opt = x && 
279
if ($CC -v 2>&1 |grep 'gcc version 3' >/dev/null); then
280 281 282 283 284 285
   condbranch_opt=0
else
   condbranch_opt=1
fi
AC_MSG_RESULT($condbranch_opt)
AC_SUBST(condbranch_opt)
pazsan's avatar
pazsan committed
286
AC_SUBST(host_cpu)
287

pazsan's avatar
pazsan committed
288
AC_SUBST(SH)
pazsan's avatar
pazsan committed
289
AC_SUBST(CC)
290
AC_SUBST(GCC_LD)
291
AC_SUBST(DEBUGFLAG)
pazsan's avatar
pazsan committed
292
AC_SUBST(EC)
pazsan's avatar
pazsan committed
293
AC_SUBST(NO_EC)
Bernd Paysan's avatar
Bernd Paysan committed
294
AC_SUBST(NO_CHECK)
295
AC_SUBST(NO_CHECKX)
296
AC_SUBST(NO_FAIL)
297
AC_SUBST(NO_CROSS)
pazsan's avatar
pazsan committed
298
AC_SUBST(EC_MODE)
pazsan's avatar
pazsan committed
299 300 301 302
AC_SUBST(engine2)
AC_SUBST(engine_fast2)
AC_SUBST(no_dynamic)
AC_SUBST(image_i)
pazsan's avatar
pazsan committed
303
AC_SUBST(signals_o)
pazsan's avatar
pazsan committed
304
AC_SUBST(mi_prefix)
305
AC_SUBST(extraccdir)
306
AC_DEFINE_UNQUOTED([EXTRACCDIR], ["$extraccdir"], [Extra directory where to look for shared libraries])
307

308 309 310
#this is used to disable some (not generally essential) part of the
#Makefile that some makes don't grok.  It would be better to test for
#this specific Makefile feature than the make version.
311
AC_MSG_CHECKING(make type)
312
make_type=`make -n -v 2>&1|grep 'ake'|sed 's/ake .*/ake/'`
313 314 315 316 317
GNUMAKE='#'
test "$make_type" = "GNU Make" && GNUMAKE=''
AC_MSG_RESULT($make_type)
AC_SUBST(GNUMAKE)

Bernd Paysan's avatar
Bernd Paysan committed
318 319 320 321 322
if test "$ac_export_dynamic" != no; then
  if test "$ac_export_dynamic" != yes; then
    AC_MSG_CHECKING([whether the linker accepts -Wl,--export-dynamic])
    OLDLDFLAGS=$LDFLAGS
    LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
323 324
    #AC_TRY_LINK gives false positive on rs6000-ibm-aix4.2.1.0
    #AC_TRY_LINK(,,ac_export_dynamic=yes,ac_export_dynamic=no)
Bernd Paysan's avatar
Bernd Paysan committed
325 326 327
    AC_TRY_RUN(main(){exit(0);},ac_export_dynamic=yes,ac_export_dynamic=no,ac_export_dynamic=no)
    LDFLAGS=$OLDLDFLAGS
  fi
328
fi
329

Bernd Paysan's avatar
Bernd Paysan committed
330 331 332
test $ac_export_dynamic = yes && LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
test $ac_export_dynamic = yes && AC_DEFINE(HAS_BACKLINK,,[Define if you have backlinks])
AC_MSG_RESULT($ac_export_dynamic)
333
AX_GCC_BUILTIN(__builtin___clear_cache)
Bernd Paysan's avatar
Bernd Paysan committed
334

Bernd Paysan's avatar
Bernd Paysan committed
335
FAST=no
Bernd Paysan's avatar
Bernd Paysan committed
336
ANDROID_EXTRA=""
337 338 339 340 341
case "$host_os" in
    *android*)
	case "$host_cpu" in
	    arm64*|aarch64*|mips64*)
	    	AC_DEFINE(__ANDROID_API__,21,[Define if you use Android])
Bernd Paysan's avatar
Bernd Paysan committed
342
		ANDROID_EXTRA=-D__ANDROID_API__=21
343 344 345
		;;
	    *)
	    	AC_DEFINE(__ANDROID_API__,19,[Define if you use Android])
Bernd Paysan's avatar
Bernd Paysan committed
346
		ANDROID_EXTRA=-D__ANDROID_API__=19
347 348 349 350
		;;
	esac
	;;
esac
Bernd Paysan's avatar
Bernd Paysan committed
351
AC_SUBST(ANDROID_EXTRA)
352 353 354
#terminology is a bit unusual here: The host is the system on which
#gforth will run; the system on which configure will run is the `build'
case "$host_cpu" in
355 356 357 358 359
	arm64*|aarch64*)
		machine=arm64
		CFLAGS="$CFLAGS -fomit-frame-pointer"
                test x$STACK_CACHE_REGS = x && STACK_CACHE_REGS=3
		if test -z $arm_cacheflush; then
360
		   AC_LIBOBJ(arm64-cacheflush)
361 362
		fi
		;;
363 364
	arm*)
		machine=arm
Bernd Paysan's avatar
Bernd Paysan committed
365
		CFLAGS="$CFLAGS -fomit-frame-pointer"
Bernd Paysan's avatar
Bernd Paysan committed
366
		case "$host" in
Bernd Paysan's avatar
Bernd Paysan committed
367
		    *gnueabihf)
Bernd Paysan's avatar
Bernd Paysan committed
368
			# don't build for thumb
369
			CFLAGS="$CFLAGS -marm -march=armv6"
Bernd Paysan's avatar
Bernd Paysan committed
370 371 372 373 374 375
			FAST="yes" # build extra fast libraries
			;;
		    *gnueabi*)
			# don't build for thumb
			CFLAGS="$CFLAGS -marm"
			FAST="yes" # build extra fast libraries
Bernd Paysan's avatar
Bernd Paysan committed
376 377
			;;
		esac
378
		if test x$platform = xnxt; then
379 380
		   CFLAGS="$CFLAGS -mthumb -mthumb-interwork"
		fi
Bernd Paysan's avatar
Bernd Paysan committed
381 382
		case "$host_os" in
		     *android*)
383
			CFLAGS="$CFLAGS -march=armv5 -mfloat-abi=softfp -mfpu=vfp"
Bernd Paysan's avatar
Bernd Paysan committed
384
			FAST="yes" # build extra fast libraries
Bernd Paysan's avatar
Bernd Paysan committed
385 386
			;;
		esac
387
		case "$host_os" in
388
		     *linux*)
389
			AC_LIBOBJ(arm-cacheflush-linux)
390 391
			;;
		     *)   
392
			AC_LIBOBJ(arm-cacheflush0)
393
			AC_MSG_WARN([No I-cache flush code known, disabling dynamic native code generation])
394 395
			config_warns="$config_warns
Dynamic NC generation disabled."
396
			;;
397
                esac
anton's avatar
anton committed
398 399 400
                #longer skipcodes lead to problems on ARM, and it uses
                #only 4-byte alignment anyway
		test "$skipcode" || skipcode="nop"
401
		;;
402
	hppa*)
403
		machine=hppa
404
		AC_LIBOBJ(hppa-cache)
405
		#-N needed for --dynamic <M4U3b.3790$9d.317@news.cpqcorp.net>
406
		#LDFLAGS="$LDFLAGS -Xlinker -N" # no longer needed
407
		LIBS="$LIBS -L/lib/pa1.1/"
408 409
		;;
	sparc*)
410
		machine=sparc
411
		;;
anton's avatar
anton committed
412
	i386)
413
		machine=386
414
		CFLAGS="$CFLAGS -fomit-frame-pointer -fforce-addr"
Bernd Paysan's avatar
Bernd Paysan committed
415 416 417 418 419
		case "$host_os" in
		     *android*)
			FAST="yes" # build extra fast libraries
			;;
		esac
anton's avatar
anton committed
420 421
		;;
	i486)
422
		machine=386
423 424 425 426 427
		CFLAGS="$CFLAGS -fomit-frame-pointer -fforce-addr"
		CFLAGS_1="$CFLAGS"
		CFLAGS="$CFLAGS -march=i486"
		AC_TRY_COMPILE(,,,CFLAGS="$CFLAGS_1 -m486")
		AC_TRY_COMPILE(,,,CFLAGS="$CFLAGS_1")
428 429 430 431 432
		case "$host_os" in
		     *android*)
			FAST="yes" # build extra fast libraries
			;;
		esac
anton's avatar
anton committed
433
		;;
anton's avatar
anton committed
434
	i*86)
435
		machine=386
436
		CFLAGS="$CFLAGS -fomit-frame-pointer -fforce-addr"
437
		CFLAGS_1="$CFLAGS"
438
		CFLAGS="$CFLAGS_1 -march=athlon64 -mtune=generic"
439
		AC_TRY_COMPILE(,,,CFLAGS="$CFLAGS_1 -march=pentium -mtune=generic")
440
		AC_TRY_COMPILE(,,,CFLAGS="$CFLAGS_1 -march=pentium")
441
		AC_TRY_COMPILE(,,,CFLAGS="$CFLAGS_1 -m486")
442
		AC_TRY_COMPILE(,,,CFLAGS="$CFLAGS_1")
443 444 445 446 447
		case "$host_os" in
		     *android*)
			FAST="yes" # build extra fast libraries
			;;
		esac
448
		;;
anton's avatar
anton committed
449
	x86_64)
450 451 452 453 454 455 456 457 458 459
		case $CC
		in
		    *-m32*)
		    	machine=386
			CFLAGS="$CFLAGS -fomit-frame-pointer -fforce-addr"
			CFLAGS_1="$CFLAGS"
			CFLAGS="$CFLAGS -march=athlon64"
			;;
		    *)
		    	machine=amd64
460
			CFLAGS="$CFLAGS -fomit-frame-pointer"
461 462
			;;
		esac
anton's avatar
anton committed
463
		;;
464 465
	ia64*)
		machine=ia64
466
		AC_LIBOBJ(ia64_flush_icache_block)
467 468 469 470
		test "$skipcode" || skipcode="nop.i 0"
		#".skip 16" passes the test below,
		# but gives an assembler error in engine
		;;
pazsan's avatar
pazsan committed
471
        m68k)
472
		machine=m68k
pazsan's avatar
pazsan committed
473 474 475
		CFLAGS="$CFLAGS -fomit-frame-pointer"
		if test "$host_os" = "nextstep3"
		then
pazsan's avatar
pazsan committed
476
			AC_LIBOBJ(termios)
pazsan's avatar
pazsan committed
477
		fi
pazsan's avatar
pazsan committed
478
		;;
479
	mips*)
480
		machine=mips
481
		AC_LIBOBJ(mips_check_prim)
482 483 484 485 486 487 488 489 490 491 492 493 494
		#dynamic native code has the following problems on MIPS:
		#
		#1) J/JAL seems relocatable, but is are only
		#relocatable within a 256MB-segment.  While we try to
		#get the linker to arrange this, there is no guarantee
		#that this will succeed (and if the user uses a lot of
		#memory, it is likely to fail).
		#
		#2) The way we generate dynamic native code may
		#violate MIPS architectural restrictions (in
		#particular, the delay slots of LW, MFLO, etc.)
		#
		#Therefore we disable dynamic native code by default:
anton's avatar
anton committed
495
		if test -z "$no_dynamic_default"; then
496 497
			no_dynamic_default=1
			AC_MSG_WARN([Disabling default dynamic native code generation (relocation and delay slot issues)])
498
			config_warns="$config_warns
499
Dynamic Code generation disabled (relocation and delay slot issues).]"
500
		fi
501
		;;
502
	alpha*)
503
		machine=alpha
anton's avatar
anton committed
504 505
		#full IEEE FP support for more uniformity across platforms:
		CFLAGS="$CFLAGS -mieee"
506
		;;
507
	power*|rs6000)
508
		machine=power
509
		AC_CHECK_FUNC(_sync_cache_range,[true],[AC_LIBOBJ(power_sync_cache_range)])
510
		#long long is broken on (at least) gcc-2.95.* for PPC
511
		test x$ac_cv_sizeof_long_long = x && 
512
		($CC -v 2>&1 |grep 'gcc version 2.95' >/dev/null) &&
anton's avatar
anton committed
513
                     ac_cv_sizeof_long_long=0
514
                #One of the few architectures with enough callee-saved registers
515 516
                test x$STACK_CACHE_REGS = x && STACK_CACHE_REGS=3
                #or use 2, hardly slower at run-time and starts up faster
anton's avatar
anton committed
517 518 519 520

                #the skipcode that is normally selected below does not
                #work with gcc-3.[34]
		test "$skipcode" || skipcode="nop\nnop\nnop\nnop"
anton's avatar
anton committed
521
		;;
522 523 524
	tile*)
		machine=tile
		;;
525
	*)
526 527
		AC_MSG_WARN([Using a generic machine description])
		AC_MSG_WARN([Assuming C floats and doubles are IEEE floats and doubles (for SF@ DF@ SF! DF!)])
528 529
		config_warns="$config_warns
Generic machine description used."
530
		machine=generic
531
		#I-cache flushing would be needed for dynamic code generation
532
		if test -z $no_dynamic_default; then
533 534
		    if test no = $ax_cv_have___builtin___clear_cache; then
			AC_MSG_WARN([FLUSH-ICACHE will do nothing, so END-CODE may not work properly!])
535
			AC_MSG_WARN([Disabling default dynamic native code generation (no I-Cache synchronization)])
536
			config_warns="$config_warns
537
Dynamic Code generation disabled (no I-cache synchronization)."
538
		    fi
539
		fi
540
esac
541
AC_SUBST(host)
Bernd Paysan's avatar
Bernd Paysan committed
542
AC_SUBST(FAST)
543

544
MAKEINC=""
545
GFORTH_EXE="true"
546 547

echo "Check for arch/$machine/$platform/gforth.ld ($EC_MODE)"
548 549
if test x$EC_MODE = xtrue
then
550 551
	echo "Check for arch/$machine/$platform/gforth.ld"
	if test -f arch/$machine/$platform/gforth.ld
552
	then
553 554
		LDFLAGS="-T ../arch/$machine/$platform/gforth.ld -Map \$@.map -cref --gc-sections $LDFLAGS"
		if test x$platform = xnxt; then
555 556 557
			LIBS="$LIB_PATH/lib/gcc/arm-elf/$($CC --version | grep GCC | cut -d' ' -f3)/interwork/libgcc.a $LIB_PATH/arm-elf/lib/interwork/libc.a $LIBS"
		fi
	fi
558 559 560
	if test -f arch/$machine/$platform/make.inc
	then
		MAKEINC="include ../arch/$machine/$platform/make.inc"
561
		GFORTH_EXE="\$(MAKE) -f arch/$machine/$platform/make.inc \$@.exe"
562
	fi
563
fi
564
AC_SUBST(MAKEINC)
565

566 567 568 569 570
AC_ARG_VAR(STACK_CACHE_REGS, [number of registers in the maximum stack cache state for gforth-fast and gforth-native (default platform-dependent).])

test x$STACK_CACHE_REGS = x && STACK_CACHE_REGS=1
AC_DEFINE_UNQUOTED(STACK_CACHE_REGS, $STACK_CACHE_REGS,
		   [number of registers in the maximum stack cache state for gforth-fast and gforth-native])
571 572 573 574
test x$STACK_CACHE_DEFAULT_FAST = x && STACK_CACHE_DEFAULT_FAST=1
AC_DEFINE_UNQUOTED(STACK_CACHE_DEFAULT_FAST, $STACK_CACHE_DEFAULT_FAST,
		   [number of registers in the default stack cache state for gforth-fast and gforth-native])

575 576 577 578
test x$GCC_PR15242_WORKAROUND = x ||
AC_DEFINE_UNQUOTED(GCC_PR15242_WORKAROUND, $GCC_PR15242_WORKAROUND,
                   [force (1) or forbid (0) use of a workaround for a gcc performance bug])

579
#the following macro produces a warning with autoconf-2.1
580 581 582 583 584 585 586 587 588 589 590 591 592
AC_CHECK_SIZEOF(char *)
case "$ac_cv_sizeof_char_p" in
  2)
    wordsize=16
    ;;
  4)
    wordsize=32
    ;;
  8)
    wordsize=64
    ;;
esac

593 594 595 596 597 598 599 600 601 602 603 604 605
AC_CHECK_SIZEOF(void *)
case "$ac_cv_sizeof_void_p" in
  2)
    vwordsize=16
    ;;
  4)
    vwordsize=32
    ;;
  8)
    vwordsize=64
    ;;
esac

606 607 608 609 610 611 612
AC_CHECK_SIZEOF(char)
AC_CHECK_SIZEOF(short)
AC_CHECK_SIZEOF(int)
AC_CHECK_SIZEOF(long)
AC_CHECK_SIZEOF(long long)
AC_CHECK_SIZEOF(intptr_t)
AC_CHECK_SIZEOF(int128_t)
pazsan's avatar
pazsan committed
613
AC_CHECK_SIZEOF(uint128_t)
614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639

AC_MSG_CHECKING([for a C type for cells])
ac_cv_int_type_cell=none
case "$ac_cv_sizeof_char_p" in
  $ac_cv_sizeof_int)
    ac_cv_int_type_cell=int
    ;;
  $ac_cv_sizeof_short)
    ac_cv_int_type_cell=short
    ;;
  $ac_cv_sizeof_char)
    ac_cv_int_type_cell=char
    ;;
  $ac_cv_sizeof_long)
    ac_cv_int_type_cell=long
    ;;
  $ac_cv_sizeof_long_long)
    ac_cv_int_type_cell="long long"
    ;;
  $ac_cv_sizeof_intptr_t)
    ac_cv_int_type_cell="intptr_t"
    ;;
esac
AC_MSG_RESULT($ac_cv_int_type_cell)
AC_DEFINE_UNQUOTED(CELL_TYPE,$ac_cv_int_type_cell,[an integer type that is as long as a pointer])

640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689
AC_MSG_CHECKING([for a C type for wydes])
ac_cv_wyde_type_cell=none
case 2 in
  $ac_cv_sizeof_int)
    ac_cv_wyde_type_cell=int
    ;;
  $ac_cv_sizeof_short)
    ac_cv_wyde_type_cell=short
    ;;
  $ac_cv_sizeof_char)
    ac_cv_wyde_type_cell=char
    ;;
  $ac_cv_sizeof_long)
    ac_cv_wyde_type_cell=long
    ;;
  $ac_cv_sizeof_long_long)
    ac_cv_wyde_type_cell="long long"
    ;;
  $ac_cv_sizeof_intptr_t)
    ac_cv_wyde_type_cell="intptr_t"
    ;;
esac
AC_MSG_RESULT($ac_cv_wyde_type_cell)
AC_DEFINE_UNQUOTED(WYDE_TYPE,$ac_cv_wyde_type_cell,[an integer type that is 2 bytes long])

AC_MSG_CHECKING([for a C type for tetrabytes])
ac_cv_tetrabyte_type_cell=none
case 4 in
  $ac_cv_sizeof_int)
    ac_cv_tetrabyte_type_cell=int
    ;;
  $ac_cv_sizeof_short)
    ac_cv_tetrabyte_type_cell=short
    ;;
  $ac_cv_sizeof_char)
    ac_cv_tetrabyte_type_cell=char
    ;;
  $ac_cv_sizeof_long)
    ac_cv_tetrabyte_type_cell=long
    ;;
  $ac_cv_sizeof_long_long)
    ac_cv_tetrabyte_type_cell="long long"
    ;;
  $ac_cv_sizeof_intptr_t)
    ac_cv_tetrabyte_type_cell="intptr_t"
    ;;
esac
AC_MSG_RESULT($ac_cv_tetrabyte_type_cell)
AC_DEFINE_UNQUOTED(TETRABYTE_TYPE,$ac_cv_tetrabyte_type_cell,[an integer type that is 4 bytes long])

690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714
AC_MSG_CHECKING([for a C type for octabytes])
ac_cv_octabyte_type_cell=none
case 8 in
  $ac_cv_sizeof_int)
    ac_cv_octabyte_type_cell=int
    ;;
  $ac_cv_sizeof_short)
    ac_cv_octabyte_type_cell=short
    ;;
  $ac_cv_sizeof_char)
    ac_cv_octabyte_type_cell=char
    ;;
  $ac_cv_sizeof_long)
    ac_cv_octabyte_type_cell=long
    ;;
  $ac_cv_sizeof_long_long)
    ac_cv_octabyte_type_cell="long long"
    ;;
  $ac_cv_sizeof_intptr_t)
    ac_cv_octabyte_type_cell="intptr_t"
    ;;
esac
AC_MSG_RESULT($ac_cv_octabyte_type_cell)
AC_DEFINE_UNQUOTED(OCTABYTE_TYPE,$ac_cv_octabyte_type_cell,[an integer type that is 8 bytes long])

715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732
AC_MSG_CHECKING([for a C type for double-cells])
ac_cv_int_type_double_cell=none
case `expr 2 '*' "$ac_cv_sizeof_char_p"` in
  $ac_cv_sizeof_short)
    ac_cv_int_type_double_cell=short
    ;;
  $ac_cv_sizeof_int)
    ac_cv_int_type_double_cell=int
    ;;
  $ac_cv_sizeof_long)
    ac_cv_int_type_double_cell=long
    ;;
  $ac_cv_sizeof_long_long)
    ac_cv_int_type_double_cell="long long"
    ;;
  $ac_cv_sizeof_intptr_t)
    ac_cv_int_type_double_cell="intptr_t"
    ;;
anton's avatar
anton committed
733
  $ac_cv_sizeof_int128_t)
734 735 736 737
    ac_cv_int_type_double_cell="int128_t"
    ;;
esac
AC_MSG_RESULT($ac_cv_int_type_double_cell)
pazsan's avatar
pazsan committed
738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762

AC_MSG_CHECKING([for a C type for unsigned double-cells])
ac_cv_int_type_double_ucell=none
case `expr 2 '*' "$ac_cv_sizeof_char_p"` in
  $ac_cv_sizeof_short)
    ac_cv_int_type_double_ucell="unsigned short"
    ;;
  $ac_cv_sizeof_int)
    ac_cv_int_type_double_ucell="unsigned int"
    ;;
  $ac_cv_sizeof_long)
    ac_cv_int_type_double_ucell="unsigned long"
    ;;
  $ac_cv_sizeof_long_long)
    ac_cv_int_type_double_ucell="unsigned long long"
    ;;
  $ac_cv_sizeof_intptr_t)
    ac_cv_int_type_double_ucell="unsigned intptr_t"
    ;;
  $ac_cv_sizeof_uint128_t)
    ac_cv_int_type_double_ucell="uint128_t"
    ;;
esac
AC_MSG_RESULT($ac_cv_int_type_double_ucell)

763 764
if test "$ac_cv_int_type_double_cell" != none && \
   test "$ac_cv_int_type_double_ucell" != none
pazsan's avatar
pazsan committed
765
then
766
	AC_DEFINE_UNQUOTED(DOUBLE_CELL_TYPE,$ac_cv_int_type_double_cell,[an integer type that is twice as long as a pointer])
pazsan's avatar
pazsan committed
767
	AC_DEFINE_UNQUOTED(DOUBLE_UCELL_TYPE,$ac_cv_int_type_double_ucell,[an unsigned integer type that is twice as long as a pointer])
anton's avatar
anton committed
768 769
        OPTS=-ll
else
pazsan's avatar
pazsan committed
770
        if test "$ac_cv_sizeof_char_p" = 8; then
771
           OPTS="-ll -noll"
anton's avatar
anton committed
772 773 774
        else
           OPTS=-noll
        fi
775
fi
776

777
if grep FORCE_REG $srcdir/arch/$machine/machine.h >/dev/null; then
pazsan's avatar
pazsan committed
778 779 780
   OPTS2=''
   for i in $OPTS; do OPTS2="$OPTS2 $i-reg"; done
   OPTS="$OPTS2 $OPTS"
781 782
else
  AC_DEFINE_UNQUOTED(FORCE_REG_UNNECESSARY,,[defined if the platform does not need FORCE_REG])
783
fi
anton's avatar
anton committed
784
AC_SUBST(OPTS)
785 786 787 788 789 790 791

AC_TYPE_OFF_T
AC_CHECK_SIZEOF(off_t)
test $ac_cv_sizeof_off_t -gt $ac_cv_sizeof_char_p
ac_small_off_t=$?
AC_DEFINE_UNQUOTED(SMALL_OFF_T,$ac_small_off_t,[1 if off_t fits in a Cell])

792 793 794 795 796
ENGINE_FLAGS=
AC_SUBST(ENGINE_FLAGS)

# Try if GCC understands -fno-gcse

797
CHECKFLAGS="no-gcse caller-saves no-defer-pop no-inline wrapv char-unsigned no-strict-aliasing no-cse-follow-jumps no-reorder-blocks no-reorder-blocks-and-partition no-toplevel-reorder no-trigraphs align-labels=1 align-loops=1 align-jumps=1 no-delete-null-pointer-checks"
pazsan's avatar
pazsan committed
798

799 800 801 802 803 804 805 806 807 808 809
for i in $CHECKFLAGS
do
    AC_MSG_CHECKING([if $CC understands -f$i])
    ac_i=$(echo ac_$i | tr '=\-' '__')
    CFLAGS_1="$CFLAGS"
    CFLAGS="$CFLAGS -f$i"
    AC_TRY_COMPILE(,,eval $ac_i=yes;ENGINE_FLAGS="$ENGINE_FLAGS -f$i",eval ac_$ibar=no)
    CFLAGS="$CFLAGS_1"
    ac_result=$(eval echo "\$$ac_i")
    AC_MSG_RESULT($ac_result)
done
810

Bernd Paysan's avatar
Bernd Paysan committed
811 812
# Try if GCC understands -pthread
AC_MSG_CHECKING([if $CC understands -pthread])
813
CFLAGS_1="$CFLAGS"
Bernd Paysan's avatar
Bernd Paysan committed
814 815 816
LDFLAGS_1="$LDFLAGS"
CFLAGS="$CFLAGS -pthread"
LDFLAGS="$LDFLAGS -pthread"
817
AC_TRY_COMPILE(,,ac_pthread=yes;ENGINE_FLAGS="$ENGINE_FLAGS -pthread",ac_pthread=no)
Bernd Paysan's avatar
Bernd Paysan committed
818 819 820
test "$ac_pthread" == yes || CFLAGS="$CFLAGS_1"
test "$ac_pthread" == yes || LDFLAGS="$LDFLAGS_1"
AC_MSG_RESULT($ac_pthread)
821

822 823 824 825 826 827 828 829 830 831 832
if test -z "$LIBTOOL_CC"
then
  LIBTOOL_CC="$CC"
  # Try if GCC understands -Wimplicit-function-declaration
  AC_MSG_CHECKING([if $CC understands -Wimplicit-function-declaration])
  CFLAGS_1="$CFLAGS"
  CFLAGS="$CFLAGS -Wimplicit-function-declaration"
  AC_TRY_COMPILE(,,LIBTOOL_CC="$CC -Wimplicit-function-declaration",)
  CFLAGS="$CFLAGS_1"
  AC_MSG_RESULT($ac_align_jumps)
fi
833 834
# remove prefix for cross compilation
LIBTOOL_CC=${LIBTOOL_CC#$CROSS_PREFIX}
835
AC_SUBST(LIBTOOL_CC)
836
AC_SUBST(CROSS_PREFIX)
837 838


anton's avatar
anton committed
839 840 841 842 843 844
# Try if GCC understands __attribute__((unused))
AC_MSG_CHECKING([how to suppress 'unused variable' warnings])
AC_TRY_COMPILE(,[int __attribute__((unused)) foo;], MAYBE_UNUSED='__attribute__((unused))',)
AC_DEFINE_UNQUOTED(MAYBE_UNUSED,$MAYBE_UNUSED,[attribute for possibly unused variables])
AC_MSG_RESULT($MAYBE_UNUSED)

anton's avatar
anton committed
845
# Try if GCC understands __thread
pazsan's avatar
pazsan committed
846 847 848 849 850
AC_CACHE_CHECK([whether gcc understands '__thread'], [ac_cv_thread],
     [AC_TRY_COMPILE(,[extern __thread int foo;],
                        [ac_cv_thread=yes],
                        [ac_cv_thread=no])])
test x$ac_cv_thread = xyes && PER_THREAD='__thread'
anton's avatar
anton committed
851 852
AC_DEFINE_UNQUOTED(PER_THREAD,$PER_THREAD,[storage class for thread-local variables])

anton's avatar
anton committed
853 854
#try if m4 understands -s
AC_MSG_CHECKING([how to invoke m4])
855
if m4 -s /dev/null >/dev/null 2>&1; then
anton's avatar
anton committed
856 857 858 859 860 861 862
 M4="m4 -s"
else
 M4=m4
fi
AC_SUBST(M4)
AC_MSG_RESULT($M4)

863
#echo "machine='$machine'"
864

865
#AC_CHECK_PROG(asm_fs,asm.fs,arch/$machine/asm.fs,,$srcdir/arch/$machine)
pazsan's avatar
pazsan committed
866 867
if test x$EC_MODE = xfalse
then
868 869
  AS_IF([test -f $srcdir/arch/$machine/asm.fs],
        [asm_fs=arch/$machine/asm.fs])
pazsan's avatar
pazsan committed
870
fi
871 872
AC_SUBST(asm_fs)

873
#AC_CHECK_PROG(disasm_fs,disasm.fs,arch/$machine/disasm.fs,,$srcdir/arch/$machine)
pazsan's avatar
pazsan committed
874 875
if test x$EC_MODE = xfalse
then
876 877
  AS_IF([test -f $srcdir/arch/$machine/disasm.fs],
   	[disasm_fs=arch/$machine/disasm.fs])
pazsan's avatar
pazsan committed
878
fi
879 880
AC_SUBST(disasm_fs)

anton's avatar
anton committed
881
AC_PATH_PROG(INSTALL_INFO,install-info,[echo '>>>>Please make info dir entry:'],$PATH:/sbin:/usr/sbin:/usr/local/sbin)
anton's avatar
anton committed
882

Bernd Paysan's avatar
Bernd Paysan committed
883
RM=rm # usually, rm is called rm
Bernd Paysan's avatar
Bernd Paysan committed
884
MV=mv # usually, mv is called mv
Bernd Paysan's avatar
Bernd Paysan committed
885

886
case "$host_os" in
Bernd Paysan's avatar
Bernd Paysan committed
887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903
	*ios*)
		#Darwin uses some funny preprocessor by default; eliminate it:
		AC_MSG_CHECKING([if $CC understands -no-cpp-precomp on Darwin])
		CFLAGS_1="$CFLAGS"
		CFLAGS="$CFLAGS -no-cpp-precomp"
		AC_TRY_COMPILE(,,ac_no_cpp_precomp=yes;ENGINE_FLAGS="$ENGINE_FLAGS -no-cpp-precomp",ac_no_cpp_precomp=no)
		test "$ac_no_cpp_precomp" == yes || CFLAGS="$CFLAGS_1"
		AC_MSG_RESULT($ac_no_cpp_precomp)
		DIRSEP="/"
		PATHSEP=":"
		DEFAULTSYSTEMPREFIX=""
		# Mac OS X hides the X stuff in /opt, if you installed
		# XQuartz
                #the following magic value was suggested by
                #http://mail.python.org/pipermail/pythonmac-sig/2005-October/015190.html
                AC_DEFINE_UNQUOTED(MACOSX_DEPLOYMENT_TARGET,"10.10",[an environment variable value needed by libtool on some MacOS X versions])
		;;
904
	*darwin*)
Bernd Paysan's avatar
Bernd Paysan committed
905
		#dar*win* must be first, not to confuse with cygwin, win32 or similar
906
		#Darwin uses some funny preprocessor by default; eliminate it:
907
		AC_MSG_CHECKING([if $CC understands -no-cpp-precomp on Darwin])
908
		CFLAGS_1="$CFLAGS"
anton's avatar
anton committed
909
		CFLAGS="$CFLAGS -no-cpp-precomp"
910 911
		AC_TRY_COMPILE(,,ac_no_cpp_precomp=yes;ENGINE_FLAGS="$ENGINE_FLAGS -no-cpp-precomp",ac_no_cpp_precomp=no)
		test "$ac_no_cpp_precomp" == yes || CFLAGS="$CFLAGS_1"
912
		AC_MSG_RESULT($ac_no_cpp_precomp)
913
		DIRSEP="/"
anton's avatar
anton committed
914
		PATHSEP=":"
915
		DEFAULTSYSTEMPREFIX=""
Bernd Paysan's avatar
Bernd Paysan committed
916 917
		# Mac OS X hides the X stuff in /opt, if you installed
		# XQuartz
918 919 920 921 922 923 924
		case $platform in
			ios)
				host_os=ios # remove version number
				CC=${CC-xcrun -sdk iphoneos clang -arch $cpu -framework OpenGLES}
			;;
			*)
				host_os=darwin # remove version number
925 926 927 928 929
				for i in /opt/X11 /sw /usr/local
				do
					test -d $i/include && CPPFLAGS="$CPPFLAGS -I$i/include"
					test -d $i/lib && LDFLAGS="$LDFLAGS -L$i/lib"
				done
930 931
			;;
		esac
932 933
                #the following magic value was suggested by
                #http://mail.python.org/pipermail/pythonmac-sig/2005-October/015190.html
Bernd Paysan's avatar
Bernd Paysan committed
934
                AC_DEFINE_UNQUOTED(MACOSX_DEPLOYMENT_TARGET,"10.10",[an environment variable value needed by libtool on some MacOS X versions])
935
		;;
Bernd Paysan's avatar
Bernd Paysan committed
936 937 938
	*win*)
		# !!!FIXME!!! problems with cygwin and ';' as path separator
		DIRSEP="/" # normal dirsep
Bernd Paysan's avatar
Bernd Paysan committed
939 940
		PATHSEP=":" # colon as pathsep
		#we don't want the builtins of command.com/cmd.exe and its
Bernd Paysan's avatar
Bernd Paysan committed
941 942 943 944
		# handling of .com files.
		#$COMSPEC contains the name of the Windows shell;
		# the ./ is there, because the bash does not recognize
		# absolute DOS filenames
Bernd Paysan's avatar
Bernd Paysan committed
945
		DEFAULTSYSTEMPREFIX="" #"./${COMSPEC//\\/\\\\\\\\} /c "
Bernd Paysan's avatar
Bernd Paysan committed
946
		no_chmod="#"
947
		RM='$GFORTH -e ": rm BEGIN  argc @ 1 >  WHILE  next-arg delete-file throw REPEAT ; rm bye"' # on Windows, use Gforth to delete files
Bernd Paysan's avatar
Bernd Paysan committed
948
		MV='$GFORTH -e ": mv next-arg next-arg rename-file throw ; mv bye"' # on Windows, use Gforth to move files
Bernd Paysan's avatar
Bernd Paysan committed
949
		;;
pazsan's avatar
pazsan committed
950 951 952 953
	*linux*)
		DIRSEP="/"
		PATHSEP=":"
		DEFAULTSYSTEMPREFIX=""
954
		if test -z "$LTDL_LIBRARY_PATH" -a "$wordsize" = 64; then
955
		   LTDL_LIBRARY_PATH=`/sbin/ldconfig -p |tail -n +2 |sed 's/^.* => //'|sed 's|/[[^/]]*$||'| grep 64 | sort -u | tr '\n' : | sed -e 's/:$//'`
pazsan's avatar
pazsan committed
956 957
		fi
		;;
958
	*)
pazsan's avatar
pazsan committed
959
		DIRSEP="/"
anton's avatar
anton committed
960
		PATHSEP=":"
961
		DEFAULTSYSTEMPREFIX=""
962 963
		;;
esac
Bernd Paysan's avatar
Bernd Paysan committed
964
AC_SUBST(no_chmod)
Bernd Paysan's avatar
Bernd Paysan committed
965
AC_SUBST(RM)
Bernd Paysan's avatar
Bernd Paysan committed
966
AC_SUBST(MV)
pazsan's avatar
pazsan committed
967
AC_SUBST(DIRSEP)
pazsan's avatar
pazsan committed
968
AC_DEFINE_UNQUOTED(DIRSEP,'$DIRSEP',[a directory separator character])
anton's avatar
anton committed
969 970
AC_SUBST(PATHSEP)
AC_DEFINE_UNQUOTED(PATHSEP,'$PATHSEP',[a path separator character])
971 972
AC_SUBST(DEFAULTSYSTEMPREFIX)
AC_DEFINE_UNQUOTED(DEFAULTSYSTEMPREFIX,"$DEFAULTSYSTEMPREFIX",[default for environment variable GFORTHSYSTEMPREFIX])
973 974 975
if test -n "$LTDL_LIBRARY_PATH"; then
   AC_DEFINE_UNQUOTED(LTDL_LIBRARY_PATH,"$LTDL_LIBRARY_PATH",[Define LTDL_LIBRARY_PATH for 64 bit Linux])
fi                                                                
976

anton's avatar
anton committed
977
#work around SELinux brain damage (from Andrew Haley <12t8f3jakb74g2c@news.supernews.com>)
anton's avatar
anton committed
978 979
#This magic incantation  seems to be completely undocumented.
AC_CHECK_PROG([MASSAGE_EXE],[chcon],[chcon -t unconfined_execmem_exec_t],[true])
anton's avatar
anton committed
980

981
#Now a little support for DOS/DJGCC
982 983 984
GFORTHFAST_EXE="$GFORTH_EXE"
GFORTHITC_EXE="$GFORTH_EXE"
GFORTHDITC_EXE="$GFORTH_EXE"
pazsan's avatar
pazsan committed
985
AC_SUBST(GFORTH_EXE)
986
AC_SUBST(GFORTHFAST_EXE)
987
AC_SUBST(GFORTHITC_EXE)
pazsan's avatar
pazsan committed
988
AC_SUBST(GFORTHDITC_EXE)
989

990 991
AC_SUBST(FORTHSIZES)