cfad47cfa3/configure.ac

4b825dc642cb6eb9a060e54bf8d69288fbee4904cfad47cfa334b206c65f22086bcc5d63e6f70944
1
#                                               -*- Autoconf -*-
2
# Process this file with autoconf to produce a configure script.
3
4
# This file has been created by hand.  Autoconf automation tools might
5
# not be able to deal with it.
6
#
7
# The email address in the AC_INIT invocation is the address of the
8
# current maintainer, not the original author.  If the maintainer
9
# changes, replace the email address.  It is used to tell the user where
10
# to send bug reports.
11
#
12
# AC_PREREQ(VERSION) should contain the version of Autoconf as used by the
13
# maintainer.  Everyone else should update to at least this version of
14
# Autoconf.
15
#
16
AC_PREREQ(2.63)
17
AC_INIT([FrobTADS],[0.13],[realnc@gmail.com],[frobtads])
18
AC_CONFIG_SRCDIR(src/osfrobtads.h)
19
AC_CONFIG_AUX_DIR(config)
20
AC_CONFIG_HEADERS(config.h)
21
AM_SILENT_RULES([yes])
22
AM_INIT_AUTOMAKE([-Wall foreign])
23
24
# The current TADS OEM version.  This must be set back to 0 each time
25
# FrobTADS is synced with a new version of the base code, and increased
26
# by 1 each time a new FrobTADS release is made that does not include a
27
# new version of the base code.  Note that this is a string, not a
28
# number.
29
#
30
AC_DEFINE([TADS_OEM_VERSION], ["0"], [Current TADS OEM version.])
31
32
# The current maintainer of FrobTADS.  Don't include an email address;
33
# the email should be specified in the AC_INIT invocation above.
34
#
35
AC_DEFINE([PACKAGE_MAINTAINER], ["Nikos Chantziaras"], [The person who currently maintains FrobTADS.])
36
37
38
#
39
# Checks for programs.
40
41
# Check for a C++ compiler.
42
#
43
AC_PROG_CXX
44
45
# Check for a C compiler.
46
#
47
AC_PROG_CC
48
49
# Check if the compiler accepts -c and -o at the same time.  We need
50
# this so that object files are placed in the same directory as the
51
# corresponding source file, rather than in the root directory.
52
#
53
AM_PROG_CC_C_O
54
AC_PROG_CXX_C_O
55
56
# On GNU C++, disable the strict-aliasing optimization since the T3VM
57
# crashes with it enabled.
58
# Disabled; the macro uses the options even on non-GCC compilers.  We
59
# don't want that.  Also, it would be better to be able to differenciate
60
# between GCC versions; GCC 4.2 and 4.3 don't seem to need this switch
61
# at all.
62
#AX_CXXFLAGS_GCC_OPTION(-fno-strict-aliasing)
63
64
65
#
66
# Checks for libraries.
67
68
# Try to find a curses library.  A curses library always provides the
69
# initscr() function, so we check for that.  We favor ncurses; if it
70
# isn't found we fall back to plain curses.  If that fails too, try
71
# pdcurses (normally pdcurses is just curses on most systems, but it
72
# doesn't hust to try pdcurses as a last resort.)
73
#
74
AC_SEARCH_LIBS([initscr], [ncurses curses pdcurses], [curseslibfound=true], [curseslibfound=false])
75
76
77
#
78
# Checks for header files.
79
80
AC_CHECK_HEADERS([limits.h stddef.h termios.h sys/ioctl.h])
81
82
# Prefer ncurses over curses.
83
#
84
AC_CHECK_HEADERS([ncurses.h curses.h], [break])
85
86
# Check for <sys/time.h>.  This is related to AC_HEADER_TIME below.
87
#
88
AC_CHECK_HEADERS([sys/time.h])
89
90
# Check if we may include both <time.h> and <sys/time.h>.  On some older
91
# systems, <sys/time.h> includes <time.h>, but <time.h> is not protected
92
# against multiple inclusion.  If it's safe to include both,
93
# TIME_WITH_SYS_TIME will be defined.
94
#
95
AC_HEADER_TIME
96
97
# Many systems lack <wchar.h>.
98
#
99
AC_CHECK_HEADERS([wchar.h], [wcharheaderfound=true], [wcharheaderfound=false])
100
101
# <glob.h> (pathname-search using patterns) is only available in POSIX.2.
102
#
103
AC_CHECK_HEADERS([glob.h])
104
105
# Locale support headers.
106
#
107
AC_CHECK_HEADERS([langinfo.h locale.h])
108
109
# If the use of TIOCGWINSZ requires <sys/ioctl.h>, then define
110
# GWINSZ_IN_SYS_IOCTL.  Otherwise TIOCGWINSZ can be found in <termios.h>.
111
#
112
AC_HEADER_TIOCGWINSZ
113
114
115
#
116
# Checks for typedefs, structures, and compiler characteristics.
117
118
# This normally checks if 'struct tm' is defined in <time.h>.  We could
119
# use this to include <sys/time.h> in case <time.h> lacks this struct.
120
# Unfortunately, the TADS base code includes <time.h> on its own in some
121
# places so it won't work.  This is plain paranoia anyway; I guess most
122
# systems define this struct in <time.h>.
123
#
124
#AC_STRUCT_TM
125
126
# Suggested by autoscan.
127
#
128
AC_C_CONST
129
AC_TYPE_SIZE_T
130
AC_C_VOLATILE
131
132
# Check what type the system's <signal.h> uses for signal handlers.
133
# This macro defines RETSIGTYPE to the appropriate type (void, int, or
134
# whatever).
135
#
136
AC_TYPE_SIGNAL
137
138
# Some systems don't provide the SIGWINCH signal (like MS Windows).
139
#
140
AC_CACHE_CHECK([for SIGWINCH signal support], ac_cv_sigwinch_signal,
141
[
142
  AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[#include <signal.h>]], [[int foo = SIGWINCH;]]),
143
    [ac_cv_sigwinch_signal=yes],
144
    [ac_cv_sigwinch_signal=no]
145
  )
146
])
147
if test x$ac_cv_sigwinch_signal = xyes; then
148
  AC_DEFINE([HAVE_SIGWINCH], [1], [Define to 1 if you have the SIGWINCH signal.])
149
fi
150
151
# Some of the TADS base code tries to define "uchar", "ushort" and the
152
# like.  This will cause a compiler error if these types are already
153
# defined, so it checks for the OS_U*_DEFINED macros first.  We check
154
# for the existence of these types in both C and C++; the "common.h"
155
# header will then define the final OS_*_DEFINED macros according to
156
# whether it's being compiled by C or C++.
157
#
158
AC_LANG_PUSH(C)
159
AC_MSG_NOTICE([checking for presence of uchar, ushort, uint and ulong in C])
160
AC_CHECK_TYPE([uchar], [AC_DEFINE([C_UCHAR_DEFINED], [1], [Define to 1 if the uchar type exists in C.])])
161
AC_CHECK_TYPE([ushort], [AC_DEFINE([C_USHORT_DEFINED], [1], [Define to 1 if the ushort type exists in C.])])
162
AC_CHECK_TYPE([uint], [AC_DEFINE([C_UINT_DEFINED], [1], [Define to 1 if the uint type exists in C.])])
163
AC_CHECK_TYPE([ulong], [AC_DEFINE([C_ULONG_DEFINED], [1], [Define to 1 if the ulong type exists in C.])])
164
AC_LANG_POP(C)
165
166
# We can't use the same check twice, since autoconf would simply pull
167
# the results from the previous check from its cache.  In order to
168
# avoid that, we check each type with a space appended so it looks
169
# different; sounds stupid, but works :P
170
AC_LANG_PUSH(C++)
171
AC_MSG_NOTICE([checking for presence of uchar, ushort, uint and ulong in C++])
172
AC_CHECK_TYPE([uchar ], [AC_DEFINE([CXX_UCHAR_DEFINED], [1], [Define to 1 if the uchar type exists in C++.])])
173
AC_CHECK_TYPE([ushort ], [AC_DEFINE([CXX_USHORT_DEFINED], [1], [Define to 1 if the ushort type exists in C++.])])
174
AC_CHECK_TYPE([uint ], [AC_DEFINE([CXX_UINT_DEFINED], [1], [Define to 1 if the uint type exists in C++.])])
175
AC_CHECK_TYPE([ulong ], [AC_DEFINE([CXX_ULONG_DEFINED], [1], [Define to 1 if the ulong type exists in C++.])])
176
AC_LANG_POP(C++)
177
178
# Makefile.am needs to know if the system is big-endian (like Motorola
179
# and SPARC CPUs) or little-endian (like Intel and VAX).  We detect this
180
# here and let Automake know.  We'll report big-endian even if we can't
181
# actually detect the endianess; that's because the big-endian routines
182
# of TADS are actually generic and work for both big as well as
183
# little-endian CPUs.
184
#
185
AC_C_BIGENDIAN([cpuisbigendian=true], [cpuisbigendian=false], [cpuisbigendian=true])
186
AM_CONDITIONAL([CPU_IS_BIGENDIAN], [test x$cpuisbigendian = xtrue])
187
188
# Check the sizes of 'int' and 'short'.
189
#
190
AC_CHECK_SIZEOF([int])
191
AC_CHECK_SIZEOF([short])
192
193
# Some systems have the wchar functions (wcslen, wcscpy, etc) in the C
194
# library, but <wchar.h> doesn't declare them.
195
#
196
AC_CHECK_DECLS([wcslen, wcscpy], [], [], [#include <wchar.h>])
197
198
# Check if we can ioctl() TIOCGWINSZ.  This is the portable way of
199
# getting the terminal size.
200
#
201
AC_CACHE_CHECK([for TIOCGWINSZ ioctl support], ac_cv_tiocgwinsz_ioctl,
202
[
203
  AC_COMPILE_IFELSE(AC_LANG_PROGRAM(
204
[[#ifndef GWINSZ_IN_SYS_IOCTL
205
#if HAVE_TERMIOS_H
206
#include <termios.h>
207
#endif
208
#endif
209
#if HAVE_SYS_IOCTL_H
210
#include <sys/ioctl.h>
211
#endif]],
212
    [[struct winsize size; ioctl(0, TIOCGWINSZ, &size);]]),
213
    [ac_cv_tiocgwinsz_ioctl=yes],
214
    [ac_cv_tiocgwinsz_ioctl=no]
215
  )
216
])
217
if test x$ac_cv_tiocgwinsz_ioctl = xyes; then
218
  AC_DEFINE([HAVE_TIOCGWINSZ], [1], [Define to 1 if TIOCGWINSZ is available for ioctl.])
219
fi
220
221
# Check if we can ioctl() TIOCGSIZE.  This is the BSD4.3 way of getting
222
# the terminal size.
223
#
224
AC_CACHE_CHECK([for TIOCGSIZE ioctl support], ac_cv_tiocgsize_ioctl,
225
[
226
  AC_COMPILE_IFELSE(AC_LANG_PROGRAM(
227
[[#if HAVE_TERMIOS_H
228
#include <termios.h>
229
#endif
230
#if HAVE_SYS_IOCTL_H
231
#include <sys/ioctl.h>
232
#endif]],
233
    [[struct ttysize size; ioctl(0, TIOCGSIZE, &size);]]),
234
    [ac_cv_tiocgsize_ioctl=yes],
235
    [ac_cv_tiocgsize_ioctl=no]
236
  )
237
])
238
if test x$ac_cv_tiocgsize_ioctl = xyes; then
239
  AC_DEFINE([HAVE_TIOCGSIZE], [1], [Define to 1 if TIOCGSIZE is available for ioctl.])
240
fi
241
242
243
#
244
# Checks for library functions.
245
246
# Suggested by autoscan.
247
#
248
# Don't do the malloc() and realloc() checks because they result in a
249
# link error during a cross compile and we don't provide the needed
250
# fallback functions (rpl_malloc() and rpl_realloc()) anyway (that is,
251
# if those checks would fail while not cross-compiling, we would still
252
# get a link error.)
253
#AC_FUNC_MALLOC
254
#AC_FUNC_REALLOC
255
AC_FUNC_MEMCMP
256
AC_FUNC_STAT
257
AC_FUNC_VPRINTF
258
AC_CHECK_FUNCS([memmove memset strchr putenv])
259
260
# The TADS base code considers the memicmp() function to be "standard".
261
# It actually isn't.  If the system doesn't provide it, our own
262
# implementation will be used.
263
#
264
AC_CHECK_FUNCS([memicmp])
265
266
# Tads uses the functions stricmp() and strnicmp() as if they were
267
# standard.  They aren't, but they have BSD 4.4 equivalents called
268
# strcasecmp() and strncasecmp().  Most Unices provide these.  If the
269
# system provides them, and the original ones aren't provided, map
270
# stricmp() to strcasecmp() and strnicmp() to strncasecmp().  If none of
271
# them exist, our code will provide default implementations.
272
#
273
AC_CHECK_FUNC(stricmp,
274
  [AC_DEFINE([HAVE_STRICMP], [1], [Define to 1 if you have stricmp.])],
275
  [
276
    AC_CHECK_FUNC(
277
      strcasecmp,
278
      [
279
        AC_DEFINE(
280
          [stricmp],
281
          [strcasecmp],
282
          [Map stricmp to strcasecmp if you lack the former.]
283
        )
284
        AC_DEFINE(
285
          [HAVE_STRCASECMP],
286
          [1],
287
          [Define to 1 if you have strcasecmp but not stricmp.]
288
        )
289
      ]
290
    )
291
  ]
292
)
293
294
AC_CHECK_FUNC(strnicmp,
295
  [AC_DEFINE([HAVE_STRNICMP], [1], [Define to 1 if have strnicmp.])],
296
  [
297
    AC_CHECK_FUNC(
298
      strncasecmp,
299
      [
300
        AC_DEFINE(
301
          [strnicmp],
302
          [strncasecmp],
303
          [Map strnicmp to strncasecmp if you lack the former.]
304
        )
305
        AC_DEFINE(
306
          [HAVE_STRNCASECMP],
307
          [1],
308
          [Define to 1 if you have strncasecmp but not strnicmp.]
309
        )
310
      ]
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
fi
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
fi
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
fi
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
fi
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
    AC_LANG_PROGRAM(
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
fi
478
479
AC_CACHE_CHECK(whether the compiler supports static_cast<>, ac_cv_cxx_static_cast,
480
[AC_COMPILE_IFELSE(
481
    AC_LANG_PROGRAM(
482
    [[#include <typeinfo>
483
      class Base {public: Base(){} virtual void f() = 0;};
484
      class Derived: public Base {public: Derived(){} virtual void f(){}};
485
      int g(Derived&) {return 0;}
486
    ]], [[
487
      Derived d;
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
fi
499
500
AC_CACHE_CHECK(whether the compiler supports reinterpret_cast<>, ac_cv_cxx_reinterpret_cast,
501
[AC_COMPILE_IFELSE(
502
    AC_LANG_PROGRAM(
503
    [[#include <typeinfo>
504
      class Base {public: Base(){} virtual void f() = 0;};
505
      class Derived: public Base {public: Derived(){} virtual void f(){}};
506
      class Unrelated {public: Unrelated(){}};
507
      int g(Unrelated&) {return 0;}
508
    ]], [[
509
      Derived d;
510
      Base& b=d;
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
fi
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
           break ;;
535
      *)   AC_MSG_ERROR(bad value ${enableval} for --enable-t3debug)
536
           break ;;
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
  [case "${enableval}" in
548
      yes) LDFLAGS="$LDFLAGS -static"
549
           AC_MSG_RESULT(statically linked)
550
           break ;;
551
      no)  AC_MSG_RESULT(let the system decide)
552
           break ;;
553
      *)   AC_MSG_ERROR(bad value ${enableval} for --enable-static-link)
554
           break ;;
555
  esac],
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
  [case "${enableval}" in
564
      yes) t2runtimechecks=true
565
           break ;;
566
      no)  t2runtimechecks=false
567
           break ;;
568
      *)   AC_MSG_ERROR(bad value ${enableval} for --enable-error-checking)
569
           break ;;
570
  esac],
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
fi