Commiter: Nikos Chantziaras
Author: Nikos Chantziaras
(2009/06/01 20:54) Over 2 years ago
Initial commit.
1
*.[oa]
2
Makefile
3
Makefile.in
4
/frob
5
/t3make
6
/tadsc
#! /bin/sh
autoreconf --verbose --install --warnings=all
## This file contains Automake rules common to many executables.
## This will instruct automake to create object files in the same
## directory as the corresponding source files, rather than in the
## top-level directory. This is needed since some source files in tads2
## and tads3 have the same name. Putting the object files in the same
7
## directory would cause the compiler to override some tads2 objects
8
## with tads3 objects of the same name.
9
##
10
## Note that this option requires the macro AM_PROG_CC_C_O to be used
11
## somewhere in configure.ac (since not all compilers can use the -c and
12
## -o options at the same time; different make-rules will be used if the
13
## compiler can't handle these options together).
14
15
AUTOMAKE_OPTIONS = subdir-objects
16
17
## These macros configure various parts of the base code.
18
19
## FROBTADS
20
## Tells the base code to include our osfrobtads.h header. This
21
## must be used in all executables.
22
23
## VMGLOB_VARS
24
## Tells the T3VM to use individual external variables for the
25
## globals. This is the fastest configuration. (See tads3/vmglob.h
26
## for details.)
27
28
## VMGLOB_PARAM
29
## Used in debug-builds of TADS 3 instead of VMGLOB_VARS.
30
31
## VM_FLAT_POOL
32
## Tells the T3VM to use the "flat" pool manager. A flat pool is
33
## somewhat faster than the default paged pool normaly used by the
34
## VM, but lacks dynamic memory capabilites. The paged pool is only
35
## useful for debuggers though, so we choose a flat pool. (See
36
## tads3/vmpoolsl.h for details.)
37
38
AM_CPPFLAGS = -DFROBTADS
39
40
if T3_DEBUG_BUILD
41
AM_CPPFLAGS += -DT3_DEBUG -DVMGLOB_PARAM
42
else
43
AM_CPPFLAGS += -DVMGLOB_VARS
44
endif
45
46
## Not yet; causes some (minor) memory leaks. For now, only the paged
47
## pool is safe.
48
## AM_CPPFLAGS += -DVM_FLAT_POOL
49
50
## If the system is little-endian, define _M_IX86_64. If not, we'll
51
## define _M_PPC. The base code needs one of these macros defined, so
52
## that it can decide which version of some endian-dependent routines
53
## to use.
54
55
## Note that we define _M_IX86_64 instead of _M_IX86 even though the
56
## former is intended for 64-bit platforms. The reason is that
57
## _M_IX86_64 works correctly even for 32-bit systems but not for
58
## 16-bit systems. _M_IX86 works for 32-bit systems as well as for
59
## 16-bit systems but not for 64-bit systems. Since we're only
60
## interested in 32 and 64-bit systems and don't support 16-bit systems
61
## at all, _M_IX86_64 is what we need.
62
63
## _M_PPC tells the base code to use the PowerPC versions of the
64
## endian-related routines. Despite the name, the PowerPC versions of
65
## these routines are generic and useable by both big-endian as well as
66
## little-endian machines; they're just a little slower on x86 and
67
## x86-64 systems than the ones activated with _M_IX86(_64).
68
69
if CPU_IS_BIGENDIAN
70
AM_CPPFLAGS += -D_M_PPC
71
72
AM_CPPFLAGS += -D_M_IX86_64
73
74
75
## If the user does not want the T2 VM to check for errors like stack
76
## overflows/underflows and such at runtime, define RUNFAST so that the
77
## base code disables these checks.
78
79
if !T2_RUNTIME_CHECKING
80
AM_CPPFLAGS += -DRUNFAST
81
82
83
## We need to tell the compiler where to find header files. We prepend
84
## the source directory in case we are building the package in a
85
## different directory than the one it has been unpacked into.
86
87
AM_CPPFLAGS += -I$(top_srcdir)/src -I$(top_srcdir)/tads2 -I$(top_srcdir)/tads3
88
89
## If the system lacks the wchar.h header, provide our own.
90
91
if WCHAR_HEADER_MISSING
92
AM_CPPFLAGS += -I$(top_srcdir)/src/wchar
93
94
95
## These are the paths of various TADS 3 data-files. We need to know
96
## about them at runtime, so we also define them as macros.
97
98
T3_INC_DIR = $(pkgdatadir)/tads3/include
99
T3_LIB_DIR = $(pkgdatadir)/tads3/lib
100
T3_RES_DIR = $(pkgdatadir)/tads3/res
101
AM_CPPFLAGS += -DT3_INC_DIR=\"$(T3_INC_DIR)\" -DT3_LIB_DIR=\"$(T3_LIB_DIR)\" -DT3_RES_DIR=\"$(T3_RES_DIR)\"
102
103
## This is not needed at runtime so we don't add it to AM_CPPFLAGS.
104
105
T3_CHARMAP_DIR = $(T3_RES_DIR)/charmap
106
107
## The TADS 3 character mapping tables are needed by both the
108
## interpreter as well as the compiler. Automake allows us to install
109
## files only once though. Normally, we would write something like
110
## "if BUILD_INTERPRETER or BUILD_T3_COMPILER", but Automake only allows
111
## a single conditional in 'if' statements.
112
113
if BUILD_INTERPRETER
114
t3charmapdir = $(T3_CHARMAP_DIR)
115
dist_t3charmap_DATA = tads3/charmap/cmaplib.t3r
116
else !BUILD_INTERPRETER
117
if BUILD_T3_COMPILER
118
119
120
endif BUILD_T3_COMPILER
121
endif !BUILD_INTERPRETER
122
123
## Tell Automake to include these files in the "make dist" (and friends)
124
## target. Note that files like AUTHORS, README, etc. are automatically
125
## included in the distribution only if they're in the
126
## top-level directory. Makefile fragments included from Makefile.am
127
## (such as this file) are also distributed automaticly.
128
129
EXTRA_DIST = \
130
bootstrap \
131
doc/AUTHORS \
132
doc/BUGS \
133
doc/ChangeLog \
134
doc/COMPILERS \
135
doc/CONFIGURE_DOC \
136
doc/COPYING \
137
doc/INSTALL \
138
doc/MacOSX \
139
doc/NEWS \
140
doc/README \
141
doc/SRC_GUIDELINES \
142
doc/THANKS \
143
tads2/LICENSE.TXT \
144
tads2/portnote.txt \
145
tads2/tadsver.htm \
146
tads3/LICENSE.TXT \
147
tads3/portnote.htm \
148
tads3/README.TXT
149
150
## Sources needed by both the interpreter as well as the compilers.
151
152
COMMONSOURCES = \
153
src/common.h \
154
src/missing.cc \
155
src/missing.h \
156
src/osbeos.h \
157
src/osdos.h \
158
src/osfrobtads.h \
159
src/osos2.h \
160
src/osportable.cc \
161
src/osunixt.h \
162
src/oswin.h \
163
src/wchar/wchar.h \
164
tads2/osifc.c \
165
tads2/osnoui.c \
166
tads2/osrestad.c
167
168
## TADS 2 runtime and compiler headers.
169
170
T2RCHEADERS = \
171
tads2/appctx.h \
172
tads2/argize.h \
173
tads2/bif.h \
174
tads2/cmap.h \
175
tads2/cmd.h \
176
tads2/dat.h \
177
tads2/dbg.h \
178
tads2/emt.h \
179
tads2/err.h \
180
tads2/fio.h \
181
tads2/h_ix86_64.h \
182
tads2/h_ix86.h \
183
tads2/h_ppc.h \
184
tads2/ler.h \
185
tads2/lib.h \
186
tads2/linf.h \
187
tads2/lin.h \
188
tads2/lst.h \
189
tads2/mch.h \
190
tads2/mcl.h \
191
tads2/mcm.h \
192
tads2/mcs.h \
193
tads2/obj.h \
194
tads2/oem.h \
195
tads2/opc.h \
196
tads2/osbigmem.h \
197
tads2/osgen.h \
198
tads2/os.h \
199
tads2/osifc.h \
200
tads2/osifctyp.h \
201
tads2/ply.h \
202
tads2/prp.h \
203
tads2/prs.h \
204
tads2/regex.h \
205
tads2/res.h \
206
tads2/run.h \
207
tads2/std.h \
208
tads2/sup.h \
209
tads2/tio.h \
210
tads2/tok.h \
211
tads2/trd.h \
212
tads2/voc.h
213
214
## TADS 2 runtime and compiler sources.
215
216
T2RCSOURCES = \
217
tads2/askf_tx.c \
218
tads2/bif.c \
219
tads2/bifgdum.c \
220
tads2/cmap.c \
221
tads2/cmd.c \
222
tads2/dat.c \
223
tads2/errmsg.c \
224
tads2/fio.c \
225
tads2/fioxor.c \
226
tads2/getstr.c \
227
tads2/indlg_tx.c \
228
tads2/ler.c \
229
tads2/lst.c \
230
tads2/mch.c \
231
tads2/mcm.c \
232
tads2/mcs.c \
233
tads2/obj.c \
234
tads2/oserr.c \
235
tads2/osgen3.c \
236
tads2/out.c \
237
tads2/output.c \
238
tads2/regex.c \
239
tads2/run.c \
240
tads2/suprun.c \
241
tads2/voc.c
242
243
## TADS 3 runtime and compiler sources.
244
245
T3RCSOURCES = \
246
tads3/askf_tx3.cpp \
247
tads3/charmap.cpp \
248
tads3/derived/vmuni_cs.cpp \
249
tads3/indlg_tx3.cpp \
250
tads3/resldexe.cpp \
251
tads3/resload.cpp \
252
tads3/std.cpp \
253
tads3/utf8.cpp \
254
tads3/vmanonfn.cpp \
255
tads3/vmbif.cpp \
256
tads3/vmbifreg.cpp \
257
tads3/vmbift3.cpp \
258
tads3/vmbiftad.cpp \
259
tads3/vmbiftio.cpp \
260
tads3/vmbignum.cpp \
261
tads3/vmbt3_nd.cpp \
262
tads3/vmbytarr.cpp \
263
tads3/vmcfgmem.cpp \
264
tads3/vmcoll.cpp \
265
tads3/vmconhmp.cpp \
266
tads3/vmconmor.cpp \
267
tads3/vmconsol.cpp \
268
tads3/vmcrc.cpp \
269
tads3/vmcset.cpp \
270
tads3/vmdict.cpp \
271
tads3/vmerr.cpp \
272
tads3/vmerrmsg.cpp \
273
tads3/vmfile.cpp \
274
tads3/vmfilobj.cpp \
275
tads3/vmfunc.cpp \
276
tads3/vmglob.cpp \
277
tads3/vmgram.cpp \
278
tads3/vmhash.cpp \
279
tads3/vmhostsi.cpp \
280
tads3/vmhosttx.cpp \
281
tads3/vmimage.cpp \
282
tads3/vmimg_nd.cpp \
283
tads3/vmini_nd.cpp \
284
tads3/vminit.cpp \
285
tads3/vminitim.cpp \
286
tads3/vmintcls.cpp \
287
tads3/vmiter.cpp \
288
tads3/vmlookup.cpp \
289
tads3/vmlst.cpp \
290
tads3/vmmcreg.cpp \
291
tads3/vmmeta.cpp \
292
tads3/vmobj.cpp \
293
tads3/vmpat.cpp \
294
tads3/vmpool.cpp \
295
tads3/vmpoolim.cpp \
296
tads3/vmregex.cpp \
297
tads3/vmrun.cpp \
298
tads3/vmrunsym.cpp \
299
tads3/vmsave.cpp \
300
tads3/vmsort.cpp \
301
tads3/vmsortv.cpp \
302
tads3/vmsrcf.cpp \
303
tads3/vmstack.cpp \
304
tads3/vmstrcmp.cpp \
305
tads3/vmstr.cpp \
306
tads3/vmtobj.cpp \
307
tads3/vmtype.cpp \
308
tads3/vmtypedh.cpp \
309
tads3/vmundo.cpp \
310
tads3/vmvec.cpp
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
# This file has been created by hand. Autoconf automation tools might
# not be able to deal with it.
#
# The email address in the AC_INIT invocation is the address of the
# current maintainer, not the original author. If the maintainer
# changes, replace the email address. It is used to tell the user where
# to send bug reports.
# AC_PREREQ(VERSION) should contain the version of Autoconf as used by the
# maintainer. Everyone else should update to at least this version of
# Autoconf.
AC_PREREQ(2.63)
AC_INIT([FrobTADS],[0.13],[realnc@gmail.com],[frobtads])
AC_CONFIG_SRCDIR(src/osfrobtads.h)
AC_CONFIG_AUX_DIR(config)
AC_CONFIG_HEADERS(config.h)
AM_SILENT_RULES([yes])
AM_INIT_AUTOMAKE([-Wall foreign])
# The current TADS OEM version. This must be set back to 0 each time
# FrobTADS is synced with a new version of the base code, and increased
# by 1 each time a new FrobTADS release is made that does not include a
# new version of the base code. Note that this is a string, not a
# number.
AC_DEFINE([TADS_OEM_VERSION], ["0"], [Current TADS OEM version.])
# The current maintainer of FrobTADS. Don't include an email address;
# the email should be specified in the AC_INIT invocation above.
AC_DEFINE([PACKAGE_MAINTAINER], ["Nikos Chantziaras"], [The person who currently maintains FrobTADS.])
# Checks for programs.
# Check for a C++ compiler.
AC_PROG_CXX
# Check for a C compiler.
AC_PROG_CC
# Check if the compiler accepts -c and -o at the same time. We need
# this so that object files are placed in the same directory as the
# corresponding source file, rather than in the root directory.
AM_PROG_CC_C_O
AC_PROG_CXX_C_O
# On GNU C++, disable the strict-aliasing optimization since the T3VM
# crashes with it enabled.
# Disabled; the macro uses the options even on non-GCC compilers. We
# don't want that. Also, it would be better to be able to differenciate
# between GCC versions; GCC 4.2 and 4.3 don't seem to need this switch
# at all.
#AX_CXXFLAGS_GCC_OPTION(-fno-strict-aliasing)
# Checks for libraries.
# Try to find a curses library. A curses library always provides the
# initscr() function, so we check for that. We favor ncurses; if it
# isn't found we fall back to plain curses. If that fails too, try
# pdcurses (normally pdcurses is just curses on most systems, but it
# doesn't hust to try pdcurses as a last resort.)
AC_SEARCH_LIBS([initscr], [ncurses curses pdcurses], [curseslibfound=true], [curseslibfound=false])
# Checks for header files.
AC_CHECK_HEADERS([limits.h stddef.h termios.h sys/ioctl.h])
# Prefer ncurses over curses.
AC_CHECK_HEADERS([ncurses.h curses.h], [break])
# Check for <sys/time.h>. This is related to AC_HEADER_TIME below.
AC_CHECK_HEADERS([sys/time.h])
# Check if we may include both <time.h> and <sys/time.h>. On some older
# systems, <sys/time.h> includes <time.h>, but <time.h> is not protected
# against multiple inclusion. If it's safe to include both,
# TIME_WITH_SYS_TIME will be defined.
AC_HEADER_TIME
# Many systems lack <wchar.h>.
AC_CHECK_HEADERS([wchar.h], [wcharheaderfound=true], [wcharheaderfound=false])
# <glob.h> (pathname-search using patterns) is only available in POSIX.2.
AC_CHECK_HEADERS([glob.h])
# Locale support headers.
AC_CHECK_HEADERS([langinfo.h locale.h])
# If the use of TIOCGWINSZ requires <sys/ioctl.h>, then define
# GWINSZ_IN_SYS_IOCTL. Otherwise TIOCGWINSZ can be found in <termios.h>.
AC_HEADER_TIOCGWINSZ
# Checks for typedefs, structures, and compiler characteristics.
# This normally checks if 'struct tm' is defined in <time.h>. We could
# use this to include <sys/time.h> in case <time.h> lacks this struct.
# Unfortunately, the TADS base code includes <time.h> on its own in some
# places so it won't work. This is plain paranoia anyway; I guess most
# systems define this struct in <time.h>.
#AC_STRUCT_TM
# Suggested by autoscan.
AC_C_CONST
AC_TYPE_SIZE_T
AC_C_VOLATILE
# Check what type the system's <signal.h> uses for signal handlers.
# This macro defines RETSIGTYPE to the appropriate type (void, int, or
# whatever).
AC_TYPE_SIGNAL
# Some systems don't provide the SIGWINCH signal (like MS Windows).
AC_CACHE_CHECK([for SIGWINCH signal support], ac_cv_sigwinch_signal,
[
AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[#include <signal.h>]], [[int foo = SIGWINCH;]]),
[ac_cv_sigwinch_signal=yes],
[ac_cv_sigwinch_signal=no]
)
])
if test x$ac_cv_sigwinch_signal = xyes; then
AC_DEFINE([HAVE_SIGWINCH], [1], [Define to 1 if you have the SIGWINCH signal.])
fi
# Some of the TADS base code tries to define "uchar", "ushort" and the
# like. This will cause a compiler error if these types are already
# defined, so it checks for the OS_U*_DEFINED macros first. We check
# for the existence of these types in both C and C++; the "common.h"
# header will then define the final OS_*_DEFINED macros according to
# whether it's being compiled by C or C++.
AC_LANG_PUSH(C)
AC_MSG_NOTICE([checking for presence of uchar, ushort, uint and ulong in C])
AC_CHECK_TYPE([uchar], [AC_DEFINE([C_UCHAR_DEFINED], [1], [Define to 1 if the uchar type exists in C.])])
AC_CHECK_TYPE([ushort], [AC_DEFINE([C_USHORT_DEFINED], [1], [Define to 1 if the ushort type exists in C.])])
AC_CHECK_TYPE([uint], [AC_DEFINE([C_UINT_DEFINED], [1], [Define to 1 if the uint type exists in C.])])
AC_CHECK_TYPE([ulong], [AC_DEFINE([C_ULONG_DEFINED], [1], [Define to 1 if the ulong type exists in C.])])
AC_LANG_POP(C)
# We can't use the same check twice, since autoconf would simply pull
# the results from the previous check from its cache. In order to
# avoid that, we check each type with a space appended so it looks
# different; sounds stupid, but works :P
AC_LANG_PUSH(C++)
AC_MSG_NOTICE([checking for presence of uchar, ushort, uint and ulong in C++])
AC_CHECK_TYPE([uchar ], [AC_DEFINE([CXX_UCHAR_DEFINED], [1], [Define to 1 if the uchar type exists in C++.])])
AC_CHECK_TYPE([ushort ], [AC_DEFINE([CXX_USHORT_DEFINED], [1], [Define to 1 if the ushort type exists in C++.])])
AC_CHECK_TYPE([uint ], [AC_DEFINE([CXX_UINT_DEFINED], [1], [Define to 1 if the uint type exists in C++.])])
AC_CHECK_TYPE([ulong ], [AC_DEFINE([CXX_ULONG_DEFINED], [1], [Define to 1 if the ulong type exists in C++.])])
AC_LANG_POP(C++)
# Makefile.am needs to know if the system is big-endian (like Motorola
# and SPARC CPUs) or little-endian (like Intel and VAX). We detect this
# here and let Automake know. We'll report big-endian even if we can't
# actually detect the endianess; that's because the big-endian routines
# of TADS are actually generic and work for both big as well as
# little-endian CPUs.
AC_C_BIGENDIAN([cpuisbigendian=true], [cpuisbigendian=false], [cpuisbigendian=true])
AM_CONDITIONAL([CPU_IS_BIGENDIAN], [test x$cpuisbigendian = xtrue])
# Check the sizes of 'int' and 'short'.
AC_CHECK_SIZEOF([int])
AC_CHECK_SIZEOF([short])
# Some systems have the wchar functions (wcslen, wcscpy, etc) in the C
# library, but <wchar.h> doesn't declare them.
AC_CHECK_DECLS([wcslen, wcscpy], [], [], [#include <wchar.h>])
# Check if we can ioctl() TIOCGWINSZ. This is the portable way of
# getting the terminal size.
AC_CACHE_CHECK([for TIOCGWINSZ ioctl support], ac_cv_tiocgwinsz_ioctl,
AC_COMPILE_IFELSE(AC_LANG_PROGRAM(
[[#ifndef GWINSZ_IN_SYS_IOCTL
#if HAVE_TERMIOS_H
#include <termios.h>
#endif
#if HAVE_SYS_IOCTL_H
#include <sys/ioctl.h>
#endif]],
[[struct winsize size; ioctl(0, TIOCGWINSZ, &size);]]),
[ac_cv_tiocgwinsz_ioctl=yes],
[ac_cv_tiocgwinsz_ioctl=no]
if test x$ac_cv_tiocgwinsz_ioctl = xyes; then
AC_DEFINE([HAVE_TIOCGWINSZ], [1], [Define to 1 if TIOCGWINSZ is available for ioctl.])
# Check if we can ioctl() TIOCGSIZE. This is the BSD4.3 way of getting
# the terminal size.
AC_CACHE_CHECK([for TIOCGSIZE ioctl support], ac_cv_tiocgsize_ioctl,
[[#if HAVE_TERMIOS_H
[[struct ttysize size; ioctl(0, TIOCGSIZE, &size);]]),
[ac_cv_tiocgsize_ioctl=yes],
[ac_cv_tiocgsize_ioctl=no]
if test x$ac_cv_tiocgsize_ioctl = xyes; then
AC_DEFINE([HAVE_TIOCGSIZE], [1], [Define to 1 if TIOCGSIZE is available for ioctl.])
# Checks for library functions.
# Don't do the malloc() and realloc() checks because they result in a
# link error during a cross compile and we don't provide the needed
# fallback functions (rpl_malloc() and rpl_realloc()) anyway (that is,
# if those checks would fail while not cross-compiling, we would still
# get a link error.)
#AC_FUNC_MALLOC
#AC_FUNC_REALLOC
AC_FUNC_MEMCMP
AC_FUNC_STAT
AC_FUNC_VPRINTF
AC_CHECK_FUNCS([memmove memset strchr putenv])
# The TADS base code considers the memicmp() function to be "standard".
# It actually isn't. If the system doesn't provide it, our own
# implementation will be used.
AC_CHECK_FUNCS([memicmp])
# Tads uses the functions stricmp() and strnicmp() as if they were
# standard. They aren't, but they have BSD 4.4 equivalents called
# strcasecmp() and strncasecmp(). Most Unices provide these. If the
# system provides them, and the original ones aren't provided, map
# stricmp() to strcasecmp() and strnicmp() to strncasecmp(). If none of
# them exist, our code will provide default implementations.
AC_CHECK_FUNC(stricmp,
[AC_DEFINE([HAVE_STRICMP], [1], [Define to 1 if you have stricmp.])],
AC_CHECK_FUNC(
strcasecmp,
AC_DEFINE(
[stricmp],
[strcasecmp],
[Map stricmp to strcasecmp if you lack the former.]
[HAVE_STRCASECMP],
[1],
[Define to 1 if you have strcasecmp but not stricmp.]
]
AC_CHECK_FUNC(strnicmp,
[AC_DEFINE([HAVE_STRNICMP], [1], [Define to 1 if have strnicmp.])],
strncasecmp,
[strnicmp],
[strncasecmp],
[Map strnicmp to strncasecmp if you lack the former.]
[HAVE_STRNCASECMP],
[Define to 1 if you have strncasecmp but not strnicmp.]
311
312
313
314
315
# Try to find a function that changes the current working directory. We
316
# first try chdir(). If not found, we search for SetCurrentDirectory().
317
318
# chdir() is listed in SVr4, SVID, POSIX, X/OPEN and 4.4BSD.
319
# SetCurrentDirectory() is MS-Windows. Actually, chdir() should also be
320
# available in Windows, but I'm not sure.
321
322
AC_CHECK_FUNC(chdir,
323
[AC_DEFINE([HAVE_CHDIR], [1], [Define to 1 if you have chdir.])],
324
[AC_CHECK_FUNC(SetCurrentDirectory,
325
[AC_DEFINE([HAVE_SETCURRENTDIRECTORY], [1], [Define to 1 if you have SetCurrentDirectory.])])]
326
327
328
# Tads wants a millisecond-precise timer. The standard C library lacks
329
# a function that gets the current time with ms-precision. Therefore,
330
# we search for one of 3 functions that can do that: clock_gettime(),
331
# gettimeofday() and ftime(), in that order.
332
333
# clock_gettime() has nanosecond-precision and is listed in SUSv2 and
334
# POSIX 1003.1-2001; gettimeofday() has microsecond-precision and is in
335
# SVr4, BSD 4.3 and POSIX 1003.1-2001; ftime() has millisecond-precision
336
# and is listed in the BSD 4.2 and POSIX 1003.1-2001 standards.
337
338
# clock_gettime() is the modern way of doing things, but is not widely
339
# available on older systems. gettimeofday() should be available
340
# almost everywhere, while ftime() is an obsolete function but still
341
# does the job most of the time (some implementations are buggy and lack
342
# millisecond precision, like in early glibc2 < 2.1.1 libraries, in
343
# which case ftime() is no better than time(); no problem though since
344
# most such systems provide gettimeofday()).
345
346
# Note that on some systems we must link with the "rt" library to be
347
# able to use the clock_gettime() function.
348
349
# If clock_gettime() has been found, we also check if the system
350
# supports a monotonic clock (CLOCK_MONOTONIC).
351
352
AC_SEARCH_LIBS(clock_gettime, rt,
353
354
AC_DEFINE([HAVE_CLOCK_GETTIME], [1], [Define to 1 if you have clock_gettime.])
355
AC_MSG_CHECKING([whether clock_gettime supports CLOCK_MONOTONIC])
356
AC_COMPILE_IFELSE(
357
AC_LANG_PROGRAM(
358
[[#include <time.h>]],
359
[[clockid_t clockType = CLOCK_MONOTONIC;]]
360
),
361
362
AC_MSG_RESULT(yes)
363
AC_DEFINE([HAVE_CLOCK_MONOTONIC], [1], [Define to 1 if clock_gettime supports CLOCK_MONOTONIC.])
364
],
365
AC_MSG_RESULT(no)
366
367
368
369
AC_CHECK_FUNCS([gettimeofday ftime], [break])
370
371
372
373
# Various other functions not available everywhere.
374
375
AC_CHECK_FUNCS([wcslen wcscpy glob])
376
377
# Check for use_default_colors(), which is an extension to curses and
378
# not available everywhere.
379
380
AC_CHECK_FUNCS([use_default_colors])
381
382
# Locale support functions.
383
384
AC_CACHE_CHECK([for nl_langinfo and CODESET], frob_cv_langinfo_codeset,
385
386
AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[#include <langinfo.h>]], [[char* cs = nl_langinfo(CODESET);]]),
387
[frob_cv_langinfo_codeset=yes],
388
[frob_cv_langinfo_codeset=no]
389
390
391
if test x$frob_cv_langinfo_codeset = xyes; then
392
AC_DEFINE([HAVE_LANGINFO_CODESET], [1], [Define to 1 if you have <langinfo.h> and nl_lan
393
ginfo(CODESET).])
394
395
396
AC_CHECK_FUNCS([setlocale])
397
398
399
400
# Checks for C++ features.
401
402
# Switch to C++ before running the tests.
403
404
AC_LANG(C++)
405
406
# Check if the compiler supports the 'and', 'or' and 'not' keywords.
407
# Note that even some real compilers don't support them, although they
408
# are in the standard since 1997. I'm not talking about VC++ 6; I said
409
# *real* compilers :*)
410
411
# If they aren't supported, we define them in common.h. We don't define
412
# them here in order to avoid problems with some C (not C++) compilers
413
# that already define them as macros.
414
415
AC_CACHE_CHECK([whether the C++ compiler supports the and keyword], ac_cv_cxx_and_keyword,
416
417
AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[int i;]], [[i = 0 and 1;]]),
418
[ac_cv_cxx_and_keyword=yes],
419
[ac_cv_cxx_and_keyword=no]
420
421
422
if test x$ac_cv_cxx_and_keyword = xyes; then
423
AC_DEFINE([HAVE_AND_KEYWORD], [1], [Define to 1 if you have the and keyword.])
424
425
426
AC_CACHE_CHECK([whether the C++ compiler supports the or keyword], ac_cv_cxx_or_keyword,
427
428
AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[int i;]], [[i = 0 or 1;]]),
429
[ac_cv_cxx_or_keyword=yes],
430
[ac_cv_cxx_or_keyword=no]
431
432
433
if test x$ac_cv_cxx_or_keyword = xyes; then
434
AC_DEFINE([HAVE_OR_KEYWORD], [1], [Define to 1 if you have the or keyword.])
435
436
437
AC_CACHE_CHECK([whether the C++ compiler supports the not keyword], ac_cv_cxx_not_keyword,
438
439
AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[int i;]], [[i = not 1;]]),
440
[ac_cv_cxx_not_keyword=yes],
441
[ac_cv_cxx_not_keyword=no]
442
443
444
if test x$ac_cv_cxx_not_keyword = xyes; then
445
AC_DEFINE([HAVE_NOT_KEYWORD], [1], [Define to 1 if you have the not keyword.])
446
447
448
# Check if the compiler supports the 'bool' datatype. Some older ones
449
# don't, so we'll have to typedef it in our common.h header.
450
451
AC_CHECK_TYPES(bool)
452
453
# Check if the compiler supports modern casting syntax
454
# (X_cast<type>(value)). If yes, we'll define HAVE_X_CAST. We use this
455
# to define the X_cast keywords as macros if the compiler lacks them.
456
457
# Original macros by Todd Veldhuizen and Luc Maisonobe <luc@spaceroots.org>.
458
# Updated by <realnc@gmail.com> and autoupdate.
459
460
AC_CACHE_CHECK(whether the compiler supports dynamic_cast<>, ac_cv_cxx_dynamic_cast,
461
[AC_COMPILE_IFELSE(
462
463
[[#include <typeinfo>
464
class Base {public: Base(){} virtual void f() = 0;};
465
class Derived: public Base {public: Derived(){} virtual void f(){}};
466
]], [[
467
Derived d;
468
Base& b=d;
469
return dynamic_cast<Derived*>(&b) ? 0 : 1;
470
]]),
471
[ac_cv_cxx_dynamic_cast=yes],
472
[ac_cv_cxx_dynamic_cast=no]
473
474
475
if test x$ac_cv_cxx_dynamic_cast = xyes; then
476
AC_DEFINE(HAVE_DYNAMIC_CAST, 1, [define to 1 if the compiler supports dynamic_cast<>])
477
478
479
AC_CACHE_CHECK(whether the compiler supports static_cast<>, ac_cv_cxx_static_cast,
480
481
482
483
484
485
int g(Derived&) {return 0;}
486
487
488
Base& b = d;
489
Derived& s = static_cast<Derived&> (b);
490
return g(s);
491
492
[ac_cv_cxx_static_cast=yes],
493
[ac_cv_cxx_static_cast=no]
494
495
496
if test x$ac_cv_cxx_static_cast = xyes; then
497
AC_DEFINE(HAVE_STATIC_CAST, 1, [define to 1 if the compiler supports static_cast<>])
498
499
500
AC_CACHE_CHECK(whether the compiler supports reinterpret_cast<>, ac_cv_cxx_reinterpret_cast,
501
502
503
504
505
506
class Unrelated {public: Unrelated(){}};
507
int g(Unrelated&) {return 0;}
508
509
510
511
Unrelated& e=reinterpret_cast<Unrelated&>(b);
512
return g(e);
513
514
[ac_cv_cxx_reinterpret_cast=yes],
515
[ac_cv_cxx_reinterpret_cast=no]
516
517
518
if test x$ac_cv_cxx_reinterpret_cast = xyes; then
519
AC_DEFINE(HAVE_REINTERPRET_CAST, 1, [define to 1 if the compiler supports reinterpret_cast<>])
520
521
522
523
524
# Additional 'configure' command-line options.
525
526
# Add '--enable-t3debug', which builds the debug-version of TADS 3 and
527
# also enables the TADS 3 test suite.
528
529
AC_ARG_ENABLE(t3debug, [ --enable-t3debug Build the debug version of TADS 3],
530
[case "${enableval}" in
531
yes) t3debugbuild=true
532
break ;;
533
no) t3debugbuild=false
534
535
*) AC_MSG_ERROR(bad value ${enableval} for --enable-t3debug)
536
537
esac],
538
[t3debugbuild=false]
539
540
AM_CONDITIONAL(T3_DEBUG_BUILD, test x$t3debugbuild = xtrue)
541
542
# Add '--enable-static-link', which allows the user to build static
543
# binaries on systems that default to dynamic linking.
544
545
AC_MSG_CHECKING(whether to create static or dynamic binaries)
546
AC_ARG_ENABLE(static-link, [ --enable-static-link Create statically-linked binaries],
547
548
yes) LDFLAGS="$LDFLAGS -static"
549
AC_MSG_RESULT(statically linked)
550
551
no) AC_MSG_RESULT(let the system decide)
552
553
*) AC_MSG_ERROR(bad value ${enableval} for --enable-static-link)
554
555
556
AC_MSG_RESULT(let the system decide)
557
558
559
# Add '--enable-error-checking', which allows the user to enable some
560
# extra error-checking code in the TADS2 VM (stack overflows and such).
561
562
AC_ARG_ENABLE(error-checking, [ --enable-error-checking Enable TADS2 runtime error-checks],
563
564
yes) t2runtimechecks=true
565
566
no) t2runtimechecks=false
567
568
*) AC_MSG_ERROR(bad value ${enableval} for --enable-error-checking)
569
570
571
[t2runtimechecks=false]
572
573
AM_CONDITIONAL([T2_RUNTIME_CHECKING], [test x$t2runtimechecks = xtrue])
574
575
576
# Tell Automake to build the interpreter only if a curses library was found.
577
578
AM_CONDITIONAL([BUILD_INTERPRETER], [test x$curseslibfound = xtrue])
579
580
# Build the compilers only if the sources are present.
581
582
AM_CONDITIONAL([BUILD_T2_COMPILER], [test -f "$srcdir/t2compiler/src/main.c"])
583
AM_CONDITIONAL([BUILD_T3_COMPILER], [test -f "$srcdir/t3compiler/src/osportable3.cc"])
584
585
# If the system lacks the <wchar.h> header, let Automake know.
586
587
AM_CONDITIONAL([WCHAR_HEADER_MISSING], [test x$wcharheaderfound = xfalse])
588
589
590
591
# Generate the output files.
592
593
AC_CONFIG_FILES([Makefile])
594
AC_OUTPUT
595
596
597
if test x$curseslibfound = xfalse; then
598
AC_MSG_NOTICE([***])
599
AC_MSG_NOTICE([*** A curses library is missing. The interpreter cannot be built.])
600
TADS2/TADS3 base code:
Michael J. Roberts <mjr_@hotmail.com>
FrobTADS code:
Nikos Chantziaras <realnc@gmail.com>
Command-line options parser:
Brad Appleton <bradapp@enteract.com>
Known bugs. Don't report them; fix them! :)
- On some versions of GCC in combination with certain x86 CPUs, the
Tads 3 VM will crash at startup when an optimization level of -O2
or higher is used. This can be fixed by using the
"-fno-strict-aliasing" option of g++ (gcc isn't affected).
- Currently, the interpreter cannot display characters outside the
7-bit ASCII range.
- When a game has set a timeout for an input, and the terminal the
interpreter runs in is resized, the timeout will be reset to its
initial value rather than the remaining time.
- The "--no-defcolors" option doesn't work with all curses versions.
- On some systems it is not possible to bundle multi-media resources
into the image file using the -recurse command line option of
t3make. The systems affected are those that lack the <glob.h>
system header.
- Currently, there's no way to pass arguments to the main() function
of a TADS 3 game. The derised behavior should be something like:
frob [frob options] gamefile.t3 [T3VM options]
- An interpreter crash (a segfault for example) is likely to leave the
terminal in a weird state. Entering "reset" (even if you can't see
what you're typing) followed by a "unicode_start" (if applicable for
your system) should bring the terminal back to normal.
- Plain-mode (pure stdout output without curses) is only partially
supported (frob --interface plain) and buggy.
- The package does not compile on SuSE Linux 7.2 (GCC 2.9x) with -ansi
enabled; works just fine without it. Looks like a bug in the
system's header files. The compiler is ancient and buggy though,
so I don't think it's worth fixing.
- Some test suite programs fail to link with GCC 2.x. Again, GCC 2.x
is ancient and buggy so a fix it's not a priority right now.
This software is distributed under the terms and conditions of the
"TADS 3 FREEWARE SOURCE CODE LICENSE". The text of this license can be
found in tads3/LICENSE.TXT, as included in the packaging of this file.
Note to distributors and packagers:
The license does not permit distribution of this software if a fee is
collected for this service, nor inclusion of this software with other
software for which a fee is collected without the maintainer's
permission.
A special thanks to Dave Picton for his patches and more than thorough
testing on Solaris and its broken curses lib :)
Thanks fly out to:
Adam D. Ashworth
James Cunningham
M. Damian Dollahite
Stephen Dranger
Sophie Fruehling
Ilya V. Goz
Donavan Hall
Andrew Huang
Michael Martin
Andrew Pontious
Mike Roberts
Andreas Sewe
Regan Toews
for the bug reports, patches, suggestions and everything else; privately
and/or through the IF newsgroups. Thanks, folks!
Also thanks to Chris Grau for the Fedora Core rpm.
## This file contains Automake rules for the interpreter.
bin_PROGRAMS += frob
## Sources needed only by the interpreter.
FROBSOURCES = \
src/colors.h \
src/frobappctx.cc \
src/frobappctx.h \
src/frobtadsapp.cc \
src/frobtadsapp.h \
src/frobtadsappcurses.cc \
src/frobtadsappcurses.h \
src/frobtadsappplain.h \
src/frobcurses.h \
src/tadswindow.h \
src/main.cc \
src/oemcurses.c \
src/options.cc \
src/options.h \
src/oscurses.cc \
src/osscurses.cc
## TADS 2 runtime sources.
T2RSOURCES = \
tads2/dbgtr.c \
tads2/trd.c \
tads2/execmd.c \
tads2/vocab.c \
tads2/qas.c \
tads2/runstat.c \
tads2/argize.c \
tads2/ply.c \
tads2/linfdum.c
## TADS 3 runtime headers
T3RHEADERS = \
tads3/charmap.h tads3/resload.h tads3/t3std.h tads3/tcprstyp.h tads3/utf8.h tads3/vmanonfn.h \
tads3/vmbif.h tads3/vmbifreg.h tads3/vmbift3.h tads3/vmbiftad.h tads3/vmbiftio.h tads3/vmbignum.h \
tads3/vmbytarr.h tads3/vmcoll.h tads3/vmconsol.h tads3/vmcrc.h tads3/vmcset.h tads3/vmdbg.h \
tads3/vmdict.h tads3/vmerr.h tads3/vmerrnum.h tads3/vmfile.h tads3/vmfilobj.h tads3/vmfunc.h \
tads3/vmglob.h tads3/vmglobv.h tads3/vmgram.h tads3/vmhash.h tads3/vmhost.h tads3/vmhostsi.h \
tads3/vmhosttx.h tads3/vmimage.h tads3/vmimgrb.h tads3/vmimport.h tads3/vminit.h tads3/vmintcls.h \
tads3/vmiter.h tads3/vmlookup.h tads3/vmlst.h tads3/vmmaincn.h tads3/vmmain.h tads3/vmmccore.h \
tads3/vmmcreg.h tads3/vmmeta.h tads3/vmobj.h tads3/vmop.h tads3/vmparam.h tads3/vmpat.h \
tads3/vmpool.h tads3/vmpoolsl.h tads3/vmpredef.h tads3/vmprof.h tads3/vmprofty.h tads3/vmregex.h \
tads3/vmres.h tads3/vmrun.h tads3/vmrunsym.h tads3/vmsave.h tads3/vmsort.h tads3/vmsrcf.h \
tads3/vmstack.h tads3/vmstrcmp.h tads3/vmstr.h tads3/vmstrres.h tads3/vmtobj.h tads3/vmtype.h \
tads3/vmundo.h tads3/vmuni.h tads3/vmvec.h tads3/vmvsn.h tads3/vmwrtimg.h
## TADS 3 runtime sources.
T3RSOURCES = \
tads3/vmbifl.cpp \
tads3/vmmain.cpp \
tads3/vmsa.cpp
frob_SOURCES = $(FROBSOURCES) $(COMMONSOURCES) $(T2RCHEADERS) $(T2RSOURCES) $(T2RCSOURCES) $(T3RHEADERS) $(T3RSOURCES) $(T3RCSOURCES)
frob_CPPFLAGS = -DRUNTIME $(AM_CPPFLAGS)
## Makefile.am -- Process this file with automake to produce Makefile.in
## This is the Automake master-file. It includes the other "fragments"
## as necessary (based on what configure.ac suggests).
## This will be copied verbatim to the generated Makefile.in and
## Makefile.
# This file has been generated automatically. Any changes made to this
# file will be *lost*.
## Include the rules common to many of the executables.
include $(srcdir)/Common.am
## Because each individual makefile expands bin_PROGRAMS with '+=', it
## must have been previously set, even if it's empty.
bin_PROGRAMS = frob
## If we should build the compilers, include their makefiles.
if BUILD_T2_COMPILER
include $(srcdir)/t2compiler/Makefile.am
include $(srcdir)/t3compiler/Makefile.am
## Ditto for the interpreter.
include Frob.am
FrobTADS - A portable TADS toolkit
http://www.tads.org
http://www.tads.org/frobtads.htm
The "doc" directory contains the documentation for this package:
AUTHORS
People who wrote FrobTADS' code.
BUGS
A list of known bugs. You shouldn't report them.
ChangeLog
Documents changes in the source code between versions.
COMPILERS
Explains how to build the TADS 2 and TADS 3 compilers and where
to obtain documentation for them.
CONFIGURE_DOC
Contains detailed documentation about the 'configure' script (this
script is used to configure the package prior to compilation).
COPYING
Legal blurb.
INSTALL
Installation and usage instructions. The first thing you should
read (after this README file).
MacOSX
Instructions for Mac OS X command-line novices.
NEWS
Contains the list of changes between FrobTADS versions.
README
Overview of the package.
SRC_GUIDELINES
A must-read for everyone who wants to contribute source code. It
mostly deals with how to write portable C++ and such.
THANKS
Lists people who contributed to FrobTADS in one way or another.
/* This file implements the appctx callbacks declared in frobappctx.h.
*/
#include "common.h"
#include "frobappctx.h"
#include "frobtadsapp.h"
int
getIoSafetyLevel( void* )
{
return globalApp->options.safetyLevel;
}
/* This gets included if we build FrobTADS in BeOS.
*
* It seems nothing special is required here.
#include "osfrobtads.h"
class Base {public: Base(){} virtual void f() = 0;};class Derived: public Base {public: Derived(){} virtual void f(){}};class Base {public: Base(){} virtual void f() = 0;};class Derived: public Base {public: Derived(){} virtual void f(){}};int g(Derived&) {return 0;}class Base {public: Base(){} virtual void f() = 0;};class Derived: public Base {public: Derived(){} virtual void f(){}};class Unrelated {public: Unrelated(){}};int g(Unrelated&) {return 0;}[case "${enableval}" in*) AC_MSG_ERROR(bad value ${enableval} for --enable-t3debug)[case "${enableval}" in*) AC_MSG_ERROR(bad value ${enableval} for --enable-static-link)[case "${enableval}" in*) AC_MSG_ERROR(bad value ${enableval} for --enable-error-checking){