1# Configure template for Gambit system.
2
3# Copyright (c) 1994-2018 by Marc Feeley, All Rights Reserved.
4
5# Process this file with autoconf to produce a configure script.
6
7AC_INIT(Gambit,v4.9.3,gambit@iro.umontreal.ca,gambit-v4_9_3)
8
9AC_CONFIG_HEADERS(include/config.h)
10
11PACKAGE_SHORTNAME="gambit"
12
13AC_SUBST(PACKAGE_SHORTNAME)
14AC_SUBST(PACKAGE_NAME)
15AC_SUBST(PACKAGE_VERSION)
16AC_SUBST(PACKAGE_STRING)
17AC_SUBST(PACKAGE_BUGREPORT)
18AC_SUBST(PACKAGE_TARNAME)
19
20AC_COPYRIGHT([[Copyright (c) 1994-2018 by Marc Feeley, All Rights Reserved.]])
21
22AC_CONFIG_SRCDIR(include/gambit.h.in)
23
24AC_PREFIX_DEFAULT(`if test -d "C:" ; then
25  echo "C:/Program Files/$PACKAGE_NAME" ;
26else
27  echo "/usr/local/$PACKAGE_NAME" ;
28fi`)
29
30AC_CANONICAL_SYSTEM
31
32###############################################################################
33#
34# Accumulate subsystems to include in runtime library.
35
36RTLIBSUBSYS=""
37RTLIBMAKEFILES=""
38
39###############################################################################
40#
41# To accumulate flags and definitions for C compilation.
42
43GAMBITLIB_DEFS=""
44
45FLAGS_OBJ=""
46FLAGS_DYN=""
47FLAGS_LIB=""
48FLAGS_EXE=""
49
50FLAGS_OBJ_DYN=""
51FLAGS_OBJ_DYN_LIB_EXE=""
52FLAGS_DYN_LIB=""
53FLAGS_OPT=""
54FLAGS_OPT_RTS=""
55
56DEFS_OBJ=""
57DEFS_DYN="-D___DYNAMIC"
58DEFS_LIB=""
59DEFS_EXE=""
60
61DEFS_OBJ_DYN_LIB_EXE=""
62
63if test "${COMPILATION_OPTIONS+set}" != set; then
64  COMPILATION_OPTIONS=""
65fi
66
67RTLIB_COND_EXPAND_FEATURES=""
68
69userlibdir="~/.gambit_userlib"
70
71###############################################################################
72#
73# Check if the system must be compiled using the C compiler or C++ compiler.
74
75AC_ARG_ENABLE(cplusplus,
76              AC_HELP_STRING([--enable-cplusplus],
77                             [compile using C++ compiler (default is NO)]),
78              ENABLE_CPLUSPLUS=$enableval,
79              ENABLE_CPLUSPLUS=no)
80
81if test "${CFLAGS+set}" != set; then
82  CFLAGS=""
83fi
84
85if test "${CXXFLAGS+set}" != set; then
86  CXXFLAGS=""
87fi
88
89if test "${LDFLAGS+set}" != set; then
90  LDFLAGS=""
91fi
92
93case "$target_os" in
94
95  darwin*) if test "$CC" = ""; then
96             SEARCH_LIST_FOR_CC="i686-apple-darwin11-gcc-4.2.1 i686-apple-darwin10-gcc-4.2.1 gcc clang"
97             for cc in $SEARCH_LIST_FOR_CC; do
98               AC_CHECK_PROG(HAVE_SPECIAL_CC, $cc, yes)
99               if test "$HAVE_SPECIAL_CC" = yes; then
100                 CC=$cc
101                 break
102               fi
103               unset ac_cv_prog_HAVE_SPECIAL_CC
104             done
105           fi
106
107           if test "$CXX" = "" -a "$ENABLE_CPLUSPLUS" = yes; then
108             SEARCH_LIST_FOR_CXX="i686-apple-darwin11-g++-4.2.1 i686-apple-darwin10-g++-4.2.1 g++ clang++"
109             for cxx in $SEARCH_LIST_FOR_CXX; do
110               AC_CHECK_PROG(HAVE_SPECIAL_CXX, $cxx, yes)
111               if test "$HAVE_SPECIAL_CXX" = yes; then
112                 CXX=$cxx
113                 break
114               fi
115               unset ac_cv_prog_HAVE_SPECIAL_CXX
116             done
117           fi
118           ;;
119
120esac
121
122AC_LANG(C)
123AC_PROG_CC
124AC_PROG_CPP
125C_COMPILER=$CC
126C_PREPROC=$CPP
127
128if test "$ENABLE_CPLUSPLUS" = yes; then
129
130  AC_LANG(C++)
131  AC_PROG_CXX
132  AC_PROG_CXXCPP
133  C_COMPILER=$CXX
134  C_PREPROC=$CXXCPP
135
136fi
137
138AC_SUBST(C_COMPILER)
139AC_SUBST(C_PREPROC)
140
141AC_SUBST(C_COMPILER_MF)
142AC_SUBST(C_PREPROC_MF)
143
144AC_SUBST(C_COMPILER_SH)
145AC_SUBST(C_PREPROC_SH)
146
147AC_SUBST(C_COMPILER_BAT)
148AC_SUBST(C_PREPROC_BAT)
149
150###############################################################################
151#
152# Check if the system must include GUIDE (Gambit Universal IDE).
153
154AC_ARG_ENABLE(guide,
155              AC_HELP_STRING([--enable-guide],
156                             [include the Gambit Universal IDE (default is NO)]),
157              ENABLE_GUIDE=$enableval,
158              ENABLE_GUIDE=no)
159
160if test "$ENABLE_GUIDE" = yes; then
161  if test "$ENABLE_CPLUSPLUS" = yes; then
162
163    # Determine if Qt is available, if the version is good, etc
164
165    ac_qmake='qmake -o conftest.qt /dev/null >&5'
166
167    rm -f conftest.qt
168
169    if { (eval echo "$as_me:$LINENO: \"$ac_qmake\"") >&5
170      (eval $ac_qmake) 2>&5
171      ac_status=$?
172      echo "$as_me:$LINENO: \$? = $ac_status" >&5
173      (exit $ac_status); }; then
174
175      ac_qt_version_check="grep -q '^# Generated by qmake ([^)]*) (Qt 3\\.3\\..*' conftest.qt"
176
177      if { (eval echo "$as_me:$LINENO: \"$ac_qt_version_check\"") >&5
178        (eval $ac_qt_version_check) 2>&5
179        ac_status=$?
180        echo "$as_me:$LINENO: \$? = $ac_status" >&5
181        (exit $ac_status); }; then
182
183        QTINCPATH=`sed -n -e '/^INCPATH[[ 	]]*=[[ 	]]*\(.*\)/s//\1/p' conftest.qt`
184        QTLIBS=`sed -n -e '/^LIBS[[ 	]]*=[[ 	]]*\\\$(SUBLIBS)[[ 	]]*\(.*\)/s//\1/p' conftest.qt`
185
186      else
187
188        qt_version=`sed -n -e '/^# Generated by qmake (\([^)]*\)) (Qt \([0-9]*\.[0-9]*\).*/s//\2/p' conftest.qt`
189
190        ENABLE_GUIDE=no
191        AC_MSG_NOTICE([
192************************************************************************
193***                                                                  ***
194*** The Gambit Universal IDE requires that the system be built using ***
195*** the Qt GUI library version 3.3.  Version $qt_version of Qt is currently  ***
196*** installed.                                                       ***
197***                                                                  ***
198************************************************************************
199])
200
201      fi
202
203    else
204
205      ENABLE_GUIDE=no
206      AC_MSG_NOTICE([
207************************************************************************
208***                                                                  ***
209*** The Gambit Universal IDE requires that the system be built using ***
210*** the Qt GUI library.  This library could not be located.  Make    ***
211*** sure that the program qmake is in your PATH.                     ***
212***                                                                  ***
213************************************************************************
214])
215
216    fi
217
218  else
219
220    ENABLE_GUIDE=no
221    AC_MSG_NOTICE([
222************************************************************************
223***                                                                  ***
224*** The Gambit Universal IDE requires that the system be built using ***
225*** a C++ compiler.  You must specify both "--enable-cplusplus" and  ***
226*** "--enable-guide" to include the Gambit Universal IDE.            ***
227***                                                                  ***
228************************************************************************
229])
230
231  fi
232fi
233
234if test "$ENABLE_GUIDE" = yes; then
235  AC_DEFINE([___GUIDE],[],[Enable GUIDE])
236  AC_SUBST(QTINCPATH)
237  RTLIBSUBSYS="$RTLIBSUBSYS guide"
238  RTLIBMAKEFILES="$RTLIBMAKEFILES lib/guide/guidepro lib/guide/makefile lib/guide/images/makefile"
239  LIBS="$LIBS $QTLIBS"
240fi
241
242AC_SUBST(ENABLE_GUIDE)
243
244###############################################################################
245#
246# Check if a specific C optimization level should be used.  An
247# optimization level of -O1 will be used by default.
248
249AC_ARG_ENABLE(c-opt,
250              AC_HELP_STRING([--enable-c-opt@<:@=level@:>@],
251                             [use higher C optimization level (default is NO)]),
252              ENABLE_C_OPT=$enableval,
253              ENABLE_C_OPT=no)
254
255
256###############################################################################
257#
258# Check if the system is to be debugged.
259
260AC_ARG_ENABLE(debug,
261              AC_HELP_STRING([--enable-debug],
262                             [build system so that it can be debugged (default is NO)]),
263              ENABLE_DEBUG=$enableval,
264              ENABLE_DEBUG=no)
265
266# Check if a debugging log file (gambit.log) should be generated.
267
268AC_ARG_ENABLE(debug-log,
269              AC_HELP_STRING([--enable-debug-log],
270                             [build system so that it generates a debugging log file (default is NO)]),
271              ENABLE_DEBUG_LOG=$enableval,
272              ENABLE_DEBUG_LOG=no)
273
274# Check if a C backtrace should be produced when a program crashes.
275
276AC_ARG_ENABLE(debug-c-backtrace,
277              AC_HELP_STRING([--enable-debug-c-backtrace],
278                             [build system so that it generates a C backtrace when a program crashes (default is NO)]),
279              ENABLE_DEBUG_C_BACKTRACE=$enableval,
280              ENABLE_DEBUG_C_BACKTRACE=no)
281
282if test "$ENABLE_DEBUG_C_BACKTRACE" = yes; then
283  AC_DEFINE([___DEBUG_C_BACKTRACE],[],[Enable generation of debugging log file])
284  ENABLE_DEBUG=yes
285fi
286
287# Check if debugging of the control flow history is needed.
288
289AC_ARG_ENABLE(debug-ctrl-flow-history,
290              AC_HELP_STRING([--enable-debug-ctrl-flow-history],
291                             [build system so that it tracks the control flow history (default is NO)]),
292              ENABLE_DEBUG_CTRL_FLOW_HISTORY=$enableval,
293              ENABLE_DEBUG_CTRL_FLOW_HISTORY=no)
294
295if test "$ENABLE_DEBUG_CTRL_FLOW_HISTORY" = yes; then
296  AC_DEFINE([___DEBUG_CTRL_FLOW_HISTORY],[],[Enable debugging of control flow history])
297  DEFS_OBJ_DYN_LIB_EXE="$DEFS_OBJ_DYN_LIB_EXE -D___DEBUG_CTRL_FLOW_HISTORY"
298  ENABLE_DEBUG_LOG=yes
299fi
300
301# Check if debugging of the host changes is needed.
302
303AC_ARG_ENABLE(debug-host-changes,
304              AC_HELP_STRING([--enable-debug-host-changes],
305                             [build system so that it tracks the host changes (default is NO)]),
306              ENABLE_DEBUG_HOST_CHANGES=$enableval,
307              ENABLE_DEBUG_HOST_CHANGES=no)
308
309if test "$ENABLE_DEBUG_HOST_CHANGES" = yes; then
310  AC_DEFINE([___DEBUG_HOST_CHANGES],[],[Enable debugging of host changes])
311  DEFS_OBJ_DYN_LIB_EXE="$DEFS_OBJ_DYN_LIB_EXE -D___DEBUG_HOST_CHANGES"
312  ENABLE_DEBUG_LOG=yes
313fi
314
315# Check if debugging the memory allocations is needed.
316
317AC_ARG_ENABLE(debug-alloc-mem,
318              AC_HELP_STRING([--enable-debug-alloc-mem],
319                             [build system so that it tracks the memory allocations (default is NO)]),
320              ENABLE_DEBUG_ALLOC_MEM=$enableval,
321              ENABLE_DEBUG_ALLOC_MEM=no)
322
323if test "$ENABLE_DEBUG_ALLOC_MEM" = yes; then
324  AC_DEFINE([___DEBUG_ALLOC_MEM],[],[Enable debugging the memory allocations])
325  DEFS_OBJ_DYN_LIB_EXE="$DEFS_OBJ_DYN_LIB_EXE -D___DEBUG_ALLOC_MEM"
326  ENABLE_DEBUG_LOG=yes
327fi
328
329# Check if debugging the garbage collector is needed.
330
331AC_ARG_ENABLE(debug-garbage-collect,
332              AC_HELP_STRING([--enable-debug-garbage-collect],
333                             [build system so that it detects issues in the garbage collect (default is NO)]),
334              ENABLE_DEBUG_GARBAGE_COLLECT=$enableval,
335              ENABLE_DEBUG_GARBAGE_COLLECT=no)
336
337if test "$ENABLE_DEBUG_GARBAGE_COLLECT" = yes; then
338  AC_DEFINE([___DEBUG_GARBAGE_COLLECT],[],[Enable debugging of garbage collect])
339  DEFS_OBJ_DYN_LIB_EXE="$DEFS_OBJ_DYN_LIB_EXE -D___DEBUG_GARBAGE_COLLECT"
340  ENABLE_DEBUG_LOG=yes
341fi
342
343# Turn on debugging.
344
345if test "$ENABLE_DEBUG" = yes; then
346  AC_DEFINE([___DEBUG],[],[Enable debugging])
347  DEFS_OBJ_DYN_LIB_EXE="$DEFS_OBJ_DYN_LIB_EXE -D___DEBUG"
348fi
349
350if test "$ENABLE_DEBUG_LOG" = yes; then
351  AC_DEFINE([___DEBUG_LOG],[],[Enable generation of debugging log file])
352fi
353
354###############################################################################
355#
356# Check if the system should keep an activity log.
357
358AC_ARG_ENABLE(activity-log,
359              AC_HELP_STRING([--enable-activity-log],
360                             [build system so it keeps an activity log (default is NO)]),
361              ENABLE_ACTIVITY_LOG=$enableval,
362              ENABLE_ACTIVITY_LOG=no)
363
364if test "$ENABLE_ACTIVITY_LOG" = yes; then
365  CONF_ACTIVITY_LOG="___ACTIVITY_LOG"
366else
367  CONF_ACTIVITY_LOG="___NO_ACTIVITY_LOG"
368fi
369
370AC_SUBST(CONF_ACTIVITY_LOG)
371
372###############################################################################
373#
374# Check if the system is to be profiled.
375
376AC_ARG_ENABLE(profile,
377              AC_HELP_STRING([--enable-profile],
378                             [build system so that it can be profiled (default is NO)]),
379              ENABLE_PROFILE=$enableval,
380              ENABLE_PROFILE=no)
381
382if test "$ENABLE_PROFILE" = yes; then
383  AC_DEFINE([___PROFILE],[],[Enable profiling])
384  DEFS_OBJ_DYN_LIB_EXE="$DEFS_OBJ_DYN_LIB_EXE -D___PROFILE"
385fi
386
387###############################################################################
388#
389# Check if the system is to be compiled to accumulate coverage statistics.
390
391AC_ARG_ENABLE(coverage,
392              AC_HELP_STRING([--enable-coverage],
393                             [build system to accumulate coverage statistics (default is NO)]),
394              ENABLE_COVERAGE=$enableval,
395              ENABLE_COVERAGE=no)
396
397###############################################################################
398#
399# Check if the system is to be compiled with trial run feedback.
400
401AC_ARG_ENABLE(feedback1,
402              AC_HELP_STRING([--enable-feedback1],
403                             [build system to accumulate trial run data (default is NO)]),
404              ENABLE_FEEDBACK1=$enableval,
405              ENABLE_FEEDBACK1=no)
406
407AC_ARG_ENABLE(feedback2,
408              AC_HELP_STRING([--enable-feedback2],
409                             [build system using trial run feedback (default is NO)]),
410              ENABLE_FEEDBACK2=$enableval,
411              ENABLE_FEEDBACK2=no)
412
413###############################################################################
414#
415# Check if a single C function should be generated for all the Scheme
416# functions in a file.  This makes the executable much faster but the
417# compilation will be much longer and take much more memory.
418
419AC_ARG_ENABLE(single-host,
420              AC_HELP_STRING([--enable-single-host],
421                             [compile each Scheme module as a single C function (default is NO)]),
422              ENABLE_SINGLE_HOST=$enableval,
423              ENABLE_SINGLE_HOST=no)
424
425if test "$ENABLE_SINGLE_HOST" = yes; then
426  AC_DEFINE([___SINGLE_HOST],[],[Enable single host mode])
427  DEFS_OBJ_DYN_LIB_EXE="$DEFS_OBJ_DYN_LIB_EXE -D___SINGLE_HOST"
428fi
429
430###############################################################################
431#
432# Check if inline code should be generated for jumps.  It is possible
433# that on some platforms this will result in a faster but larger
434# executable program.
435
436AC_ARG_ENABLE(inline-jumps,
437              AC_HELP_STRING([--enable-inline-jumps],
438                             [generate inline code for jumps (default is NO)]),
439              ENABLE_INLINE_JUMPS=$enableval,
440              ENABLE_INLINE_JUMPS=no)
441
442if test "$ENABLE_INLINE_JUMPS" = yes; then
443  AC_DEFINE([___INLINE_JUMPS],[],[Enable inlining of jumps])
444  DEFS_OBJ_DYN_LIB_EXE="$DEFS_OBJ_DYN_LIB_EXE -D___INLINE_JUMPS"
445fi
446
447###############################################################################
448#
449# Check if expensive GCC optimizations should be used.  This makes the
450# executable faster but the compilation will be much longer and take
451# much more memory.
452
453AC_ARG_ENABLE(gcc-opts,
454              AC_HELP_STRING([--enable-gcc-opts],
455                             [use expensive GCC optimizations (default is NO)]),
456              ENABLE_GCC_OPTS=$enableval,
457              ENABLE_GCC_OPTS=no)
458
459###############################################################################
460#
461# Check if GNU GCC specific options should be used.  When the system
462# is to be built in a setting where the target C compiler is either
463# the GNU GCC or the LLVM GCC it is advisable to avoid using GNU GCC
464# specific options that are not accepted by the LLVM GCC compiler
465# (this is the case on OS X, where the program "gcc" may be the LLVM
466# GCC which is part of Xcode, or the GNU GCC if it was installed
467# manually).
468
469AC_ARG_ENABLE(gnu-gcc-specific-options,
470              AC_HELP_STRING([--enable-gnu-gcc-specific-options],
471                             [use GNU GCC specific options (default is YES)]),
472              ENABLE_GNU_GCC_SPECIFIC_OPTIONS=$enableval,
473              ENABLE_GNU_GCC_SPECIFIC_OPTIONS=yes)
474
475AC_ARG_ENABLE(gnu-gcc-no-strict-aliasing,
476              AC_HELP_STRING([--enable-gnu-gcc-no-strict-aliasing],
477                             [use GNU GCC -fno-strict-aliasing option (default is YES)]),
478              ENABLE_GNU_GCC_NO_STRICT_ALIASING=$enableval,
479              ENABLE_GNU_GCC_NO_STRICT_ALIASING=yes)
480
481###############################################################################
482#
483# Check the width of Scheme characters.
484
485AC_ARG_ENABLE(char-size,
486              AC_HELP_STRING([--enable-char-size=N],
487                             [Scheme character size in bytes (default is 4)]),
488              CHAR_SIZE=$enableval,
489              CHAR_SIZE=4)
490
491if test "$CHAR_SIZE" = 1; then
492  CONF_MAX_CHR="0xff"
493else
494if test "$CHAR_SIZE" = 2; then
495  CONF_MAX_CHR="0xffff"
496else
497  CONF_MAX_CHR="0x10ffff"
498fi
499fi
500
501AC_SUBST(CONF_MAX_CHR)
502
503###############################################################################
504#
505# Check the encoding of filesystem paths.
506
507AC_ARG_ENABLE(path-encoding,
508              AC_HELP_STRING([--enable-path-encoding=utf8|latin1|ucs2|ucs4|wchar|native],
509                             [Filesystem path encoding (default is ucs2 on Windows and utf8 on other OSes)]),
510              ENABLE_PATH_ENCODING=$enableval,
511              ENABLE_PATH_ENCODING=no)
512
513if test "$ENABLE_PATH_ENCODING" = utf8; then
514  AC_DEFINE([___PATH_ENCODING_UTF8],[],[Select UTF-8 for path encoding])
515else
516  if test "$ENABLE_PATH_ENCODING" = latin1; then
517    AC_DEFINE([___PATH_ENCODING_LATIN1],[],[Select LATIN-1 for path encoding])
518  else
519    if test "$ENABLE_PATH_ENCODING" = ucs2; then
520      AC_DEFINE([___PATH_ENCODING_UCS2],[],[Select UCS-2 for path encoding])
521    else
522      if test "$ENABLE_PATH_ENCODING" = ucs4; then
523        AC_DEFINE([___PATH_ENCODING_UCS4],[],[Select UCS-4 for path encoding])
524      else
525        if test "$ENABLE_PATH_ENCODING" = wchar; then
526          AC_DEFINE([___PATH_ENCODING_WCHAR],[],[Select WCHAR for path encoding])
527        else
528          if test "$ENABLE_PATH_ENCODING" = native; then
529            AC_DEFINE([___PATH_ENCODING_NATIVE],[],[Select NATIVE for path encoding])
530          fi
531        fi
532      fi
533    fi
534  fi
535fi
536
537###############################################################################
538#
539# Determine default runtime options.
540
541AC_ARG_ENABLE(default-runtime-options,
542              AC_HELP_STRING([--enable-default-runtime-options=...],
543                             [Default runtime options (default is none)]),
544              ENABLE_DEFAULT_RUNTIME_OPTIONS=$enableval,
545              ENABLE_DEFAULT_RUNTIME_OPTIONS=)
546
547if test "$ENABLE_DEFAULT_RUNTIME_OPTIONS" != ""; then
548  DEFAULT_RUNTIME_OPTIONS=`echo "$ENABLE_DEFAULT_RUNTIME_OPTIONS" | sed -e "s/\(.\)/'\1',/g" -e "s/''',/'\\\\\\\\'',/g" -e "s/'\\\\\\\\',/'\\\\\\\\\\\\\\\\',/g" -e "s/^/{/" -e "s/$/'\\\\\\\\0'}/"`
549  AC_DEFINE_UNQUOTED([___DEFAULT_RUNTIME_OPTIONS],[$DEFAULT_RUNTIME_OPTIONS],[Select default runtime options])
550fi
551
552###############################################################################
553#
554# Check the size of the type "void*".  On many systems it is the same
555# size as "long".  If this isn't the case then define
556# ___VOIDSTAR_WIDTH appropriately.
557
558AC_CHECK_SIZEOF(void*)
559AC_CHECK_SIZEOF(long)
560
561if test "$ac_cv_sizeof_voidp" != "$ac_cv_sizeof_long"; then
562  CONF_VOIDSTAR_WIDTH="($ac_cv_sizeof_voidp * ___CHAR_WIDTH)"
563else
564  CONF_VOIDSTAR_WIDTH="___LONG_WIDTH"
565fi
566
567AC_SUBST(CONF_VOIDSTAR_WIDTH)
568
569###############################################################################
570#
571# Check for existence of the type "bool".  If the compiler does not
572# support it, the ___BOOL type will be mapped to "int".
573
574AC_CHECK_TYPE([bool])
575
576if test "$ac_cv_type_bool" = yes; then
577  CONF_BOOL="bool"
578else
579  CONF_BOOL="int"
580fi
581
582AC_SUBST(CONF_BOOL)
583
584###############################################################################
585#
586# Check if a shared library must be built.
587
588AC_ARG_ENABLE(shared,
589              AC_HELP_STRING([--enable-shared],
590                             [build the Scheme runtime system as a shared library (default is NO)]),
591              ENABLE_SHARED=$enableval,
592              ENABLE_SHARED=no)
593
594if test "$ENABLE_SHARED" = yes; then
595  AC_DEFINE([___SHARED],[],[Enable shared libraries])
596  # don't add to DEFS_OBJ_DYN_LIB_EXE
597fi
598
599###############################################################################
600#
601# Check if only ANSI C headers and libraries should be used.
602
603AC_ARG_ENABLE(ansi-c,
604              AC_HELP_STRING([--enable-ansi-c],
605                             [link only with ANSI C libraries (default is NO)]),
606              ANSI_C=$enableval,
607              ANSI_C=no)
608
609###############################################################################
610#
611# Check if symbolic links should be used for files not in the
612# central installation directory.
613
614AC_ARG_ENABLE(symlinks,
615              AC_HELP_STRING([--enable-symlinks],
616                             [use symbolic links for installed files not in the central installation directory (default is YES)]),
617              ENABLE_SYMLINKS=$enableval,
618              ENABLE_SYMLINKS=no)
619
620###############################################################################
621#
622# Determine the name to use for the Gambit interpreter and compiler.
623
624AC_ARG_ENABLE(interpreter-name,
625              AC_HELP_STRING([--enable-interpreter-name=INTERP],
626                             [Name to use for Gambit interpreter (default is gsi)]),
627              ENABLE_INTERPRETER_NAME=$enableval,
628              ENABLE_INTERPRETER_NAME="gsi")
629
630AC_ARG_ENABLE(compiler-name,
631              AC_HELP_STRING([--enable-compiler-name=COMP],
632                             [Name to use for Gambit compiler (default is gsc)]),
633              ENABLE_COMPILER_NAME=$enableval,
634              ENABLE_COMPILER_NAME="gsc")
635
636###############################################################################
637#
638# Check if multiple installed versions are supported.
639
640AC_ARG_ENABLE(multiple-versions,
641              AC_HELP_STRING([--enable-multiple-versions],
642                             [multiple installed versions are supported (default is NO)]),
643              ENABLE_MULTIPLE_VERSIONS=$enableval,
644              ENABLE_MULTIPLE_VERSIONS=no)
645
646###############################################################################
647#
648# Check if shared libraries should be linked to using an absolute path.
649
650AC_ARG_ENABLE(absolute-shared-libs,
651              AC_HELP_STRING([--enable-absolute-shared-libs],
652                             [shared libraries should be linked to using an absolute path (default is YES)]),
653              ENABLE_ABSOLUTE_SHARED_LIBS=$enableval,
654              ENABLE_ABSOLUTE_SHARED_LIBS=yes)
655
656if test "$ENABLE_SHARED" != yes; then
657  ENABLE_ABSOLUTE_SHARED_LIBS=no
658fi
659
660###############################################################################
661#
662# Check if library names should contain a version number suffix.
663
664AC_ARG_ENABLE(versioned-shared-libs,
665              AC_HELP_STRING([--enable-versioned-shared-libs],
666                             [library names should contain a version number suffix (default is NO)]),
667              ENABLE_VERSIONED_SHARED_LIBS=$enableval,
668              ENABLE_VERSIONED_SHARED_LIBS=no)
669
670###############################################################################
671#
672# Check if library names should contain a special suffix.
673
674AC_ARG_ENABLE(lib-suffix,
675              AC_HELP_STRING([--enable-lib-suffix],
676                             [library names should contain a suffix before the extension (default is NO)]),
677              LIB_SUFFIX=$enableval,
678              LIB_SUFFIX=no)
679
680if test "$LIB_SUFFIX" = no; then
681  LIB_SUFFIX=""
682else
683  if test "$LIB_SUFFIX" = yes; then
684    LIB_SUFFIX="-`echo $PACKAGE_VERSION | sed -e 's/\./_/g'`"
685  fi
686fi
687
688###############################################################################
689#
690# Determine which browser to use for help.
691
692AC_ARG_ENABLE(help-browser,
693              AC_HELP_STRING([--enable-help-browser=BROWSER],
694                             [Browser to use for help (default is to search)]),
695              HELP_BROWSER=$enableval,
696              HELP_BROWSER="")
697
698###############################################################################
699#
700# Check if the system must perform type checking.
701
702AC_ARG_ENABLE(type-checking,
703              AC_HELP_STRING([--enable-type-checking],
704                             [perform type checking (default is YES)]),
705              ENABLE_TYPE_CHECKING=$enableval,
706              ENABLE_TYPE_CHECKING=yes)
707
708if test "$ENABLE_TYPE_CHECKING" = yes; then
709  RTLIB_COND_EXPAND_FEATURES="$RTLIB_COND_EXPAND_FEATURES(define-cond-expand-feature|enable-type-checking|)"
710else
711  RTLIB_COND_EXPAND_FEATURES="$RTLIB_COND_EXPAND_FEATURES(define-cond-expand-feature|disable-type-checking|)"
712fi
713
714###############################################################################
715#
716# Check if the system must automatically force promises.
717
718AC_ARG_ENABLE(auto-forcing,
719              AC_HELP_STRING([--enable-auto-forcing],
720                             [automatically force promises (default is NO)]),
721              ENABLE_AUTO_FORCING=$enableval,
722              ENABLE_AUTO_FORCING=no)
723
724if test "$ENABLE_AUTO_FORCING" = yes; then
725  RTLIB_COND_EXPAND_FEATURES="$RTLIB_COND_EXPAND_FEATURES(define-cond-expand-feature|enable-auto-forcing|)"
726else
727  RTLIB_COND_EXPAND_FEATURES="$RTLIB_COND_EXPAND_FEATURES(define-cond-expand-feature|disable-auto-forcing|)"
728fi
729
730###############################################################################
731#
732# Check if the system must support the #.<expression> syntax.
733
734AC_ARG_ENABLE(sharp-dot,
735              AC_HELP_STRING([--enable-sharp-dot],
736                             [support #.<expression> syntax (default is YES)]),
737              ENABLE_SHARP_DOT=$enableval,
738              ENABLE_SHARP_DOT=yes)
739
740if test "$ENABLE_SHARP_DOT" = yes; then
741  RTLIB_COND_EXPAND_FEATURES="$RTLIB_COND_EXPAND_FEATURES(define-cond-expand-feature|enable-sharp-dot|)"
742else
743  RTLIB_COND_EXPAND_FEATURES="$RTLIB_COND_EXPAND_FEATURES(define-cond-expand-feature|disable-sharp-dot|)"
744fi
745
746###############################################################################
747#
748# Check which numerical types need to be supported.
749
750AC_ARG_ENABLE(bignum,
751              AC_HELP_STRING([--enable-bignum],
752                             [support infinite precision integers (default is YES)]),
753              ENABLE_BIGNUM=$enableval,
754              ENABLE_BIGNUM=yes)
755
756if test "$ENABLE_BIGNUM" = yes; then
757  RTLIB_COND_EXPAND_FEATURES="$RTLIB_COND_EXPAND_FEATURES(define-cond-expand-feature|enable-bignum|)"
758else
759  RTLIB_COND_EXPAND_FEATURES="$RTLIB_COND_EXPAND_FEATURES(define-cond-expand-feature|disable-bignum|)"
760fi
761
762AC_ARG_ENABLE(ratnum,
763              AC_HELP_STRING([--enable-ratnum],
764                             [support exact rational numbers (default is YES)]),
765              ENABLE_RATNUM=$enableval,
766              ENABLE_RATNUM=yes)
767
768if test "$ENABLE_RATNUM" = yes; then
769  RTLIB_COND_EXPAND_FEATURES="$RTLIB_COND_EXPAND_FEATURES(define-cond-expand-feature|enable-ratnum|)"
770else
771  RTLIB_COND_EXPAND_FEATURES="$RTLIB_COND_EXPAND_FEATURES(define-cond-expand-feature|disable-ratnum|)"
772fi
773
774AC_ARG_ENABLE(cpxnum,
775              AC_HELP_STRING([--enable-cpxnum],
776                             [support complex numbers (default is YES)]),
777              ENABLE_CPXNUM=$enableval,
778              ENABLE_CPXNUM=yes)
779
780if test "$ENABLE_CPXNUM" = yes; then
781  RTLIB_COND_EXPAND_FEATURES="$RTLIB_COND_EXPAND_FEATURES(define-cond-expand-feature|enable-cpxnum|)"
782else
783  RTLIB_COND_EXPAND_FEATURES="$RTLIB_COND_EXPAND_FEATURES(define-cond-expand-feature|disable-cpxnum|)"
784fi
785
786###############################################################################
787#
788# Check if debugging information for the Scheme runtime library is to
789# be generated when the system is bootstrapped (with
790# "make bootstrap; make bootclean; make").
791
792AC_ARG_ENABLE(rtlib-debug,
793              AC_HELP_STRING([--enable-rtlib-debug],
794                             [Include all debugging information in the code generated for the Scheme runtime library (default is NO)]),
795              ENABLE_RTLIB_DEBUG=$enableval,
796              ENABLE_RTLIB_DEBUG=no)
797
798if test "$ENABLE_RTLIB_DEBUG" = yes; then
799
800  COMPILATION_OPTIONS="$COMPILATION_OPTIONS -debug"
801
802fi
803
804AC_ARG_ENABLE(rtlib-debug-location,
805              AC_HELP_STRING([--enable-rtlib-debug-location],
806                             [Include source code location debugging information in the code generated for the Scheme runtime library (default is NO)]),
807              ENABLE_RTLIB_DEBUG_LOCATION=$enableval,
808              ENABLE_RTLIB_DEBUG_LOCATION=no)
809
810if test "$ENABLE_RTLIB_DEBUG_LOCATION" = yes; then
811
812  COMPILATION_OPTIONS="$COMPILATION_OPTIONS -debug-location"
813
814fi
815
816AC_ARG_ENABLE(rtlib-debug-source,
817              AC_HELP_STRING([--enable-rtlib-debug-source],
818                             [Include the source code debugging information in the code generated for the Scheme runtime library (default is NO)]),
819              ENABLE_RTLIB_DEBUG_SOURCE=$enableval,
820              ENABLE_RTLIB_DEBUG_SOURCE=no)
821
822if test "$ENABLE_RTLIB_DEBUG_SOURCE" = yes; then
823
824  COMPILATION_OPTIONS="$COMPILATION_OPTIONS -debug-source"
825
826fi
827
828AC_ARG_ENABLE(rtlib-debug-environments,
829              AC_HELP_STRING([--enable-rtlib-debug-environments],
830                             [Include environment debugging information in the code generated for the Scheme runtime library (default is NO)]),
831              ENABLE_RTLIB_DEBUG_ENVIRONMENTS=$enableval,
832              ENABLE_RTLIB_DEBUG_ENVIRONMENTS=no)
833
834if test "$ENABLE_RTLIB_DEBUG_ENVIRONMENTS" = yes; then
835
836  COMPILATION_OPTIONS="$COMPILATION_OPTIONS -debug-environments"
837
838fi
839
840AC_ARG_ENABLE(track-scheme,
841              AC_HELP_STRING([--enable-track-scheme],
842                             [Include Scheme code location in C code generated (default is NO)]),
843              ENABLE_TRACK_SCHEME=$enableval,
844              ENABLE_TRACK_SCHEME=no)
845
846if test "$ENABLE_TRACK_SCHEME" = yes; then
847
848  COMPILATION_OPTIONS="$COMPILATION_OPTIONS -track-scheme"
849
850fi
851
852###############################################################################
853#
854# Check whether to enable poll as the select method
855
856AC_ARG_ENABLE(poll,
857              AC_HELP_STRING([--enable-poll],
858                             [Enable poll as the select method (default is NO)]),
859              ENABLE_POLL=$enableval,
860              ENABLE_POLL=no)
861
862if test "$ENABLE_POLL" = yes; then
863  AC_DEFINE([USE_POLL_FOR_SELECT],[],[Enable use of poll instead of select])
864fi
865
866###############################################################################
867#
868# Check whether to enable high-resolution timing
869
870AC_ARG_ENABLE(high-res-timing,
871              AC_HELP_STRING([--enable-high-res-timing],
872                             [Enable high-resolution timing (default is NO)]),
873              ENABLE_HIGH_RES_TIMING=$enableval,
874              ENABLE_HIGH_RES_TIMING=no)
875
876if test "$ENABLE_HIGH_RES_TIMING" = yes; then
877  AC_DEFINE([USE_HIGH_RES_TIMING],[],[Enable high-resolution timing])
878fi
879
880###############################################################################
881#
882# Check if the runtime system must be compiled to support multiple
883# Gambit VM instances or not.  A Gambit VM instance has its own global
884# environment and heap, separate from other Gambit VM instances.
885
886AC_ARG_ENABLE(multiple-vms,
887              AC_HELP_STRING([--enable-multiple-vms],
888                             [support multiple Gambit VM instances (default is NO)]),
889              ENABLE_MULTIPLE_VMS=$enableval,
890              ENABLE_MULTIPLE_VMS=no)
891
892if test "$ENABLE_MULTIPLE_VMS" = no; then
893  CONF_SINGLE_MULTIPLE_VMS="___SINGLE_VM"
894else
895  CONF_SINGLE_MULTIPLE_VMS="___MULTIPLE_VMS"
896fi
897
898AC_SUBST(CONF_SINGLE_MULTIPLE_VMS)
899
900###############################################################################
901#
902# Check if the runtime system must be compiled to support multiple OS
903# threads per Gambit VM instance.  In other words, is it allowed for
904# multiple OS threads to be running in a given VM instance?
905
906AC_ARG_ENABLE(multiple-threaded-vms,
907              AC_HELP_STRING([--enable-multiple-threaded-vms],
908                             [support multiple OS threads per Gambit VM instance (default is NO)]),
909              ENABLE_MULTIPLE_THREADED_VMS=$enableval,
910              ENABLE_MULTIPLE_THREADED_VMS=no)
911
912if test "$ENABLE_MULTIPLE_THREADED_VMS" = no; then
913  CONF_SINGLE_MULTIPLE_THREADED_VMS="___SINGLE_THREADED_VMS"
914else
915  CONF_SINGLE_MULTIPLE_THREADED_VMS="___MULTIPLE_THREADED_VMS"
916fi
917
918AC_SUBST(CONF_SINGLE_MULTIPLE_THREADED_VMS)
919
920###############################################################################
921#
922# Check if the SMP Scheme thread scheduler should be enabled.
923
924AC_ARG_ENABLE(smp,
925              AC_HELP_STRING([--enable-smp],
926                             [support SMP Scheme thread scheduler (default is NO)]),
927              ENABLE_SMP=$enableval,
928              ENABLE_SMP=no)
929
930if test "$ENABLE_SMP" = yes; then
931  RTLIB_COND_EXPAND_FEATURES="$RTLIB_COND_EXPAND_FEATURES(define-cond-expand-feature|enable-smp|)"
932else
933  RTLIB_COND_EXPAND_FEATURES="$RTLIB_COND_EXPAND_FEATURES(define-cond-expand-feature|disable-smp|)"
934fi
935
936###############################################################################
937#
938# Determine the maximum number of OS threads (processors) per
939# Gambit VM instance.
940
941AC_ARG_ENABLE(max-processors,
942              AC_HELP_STRING([--enable-max-processors=N],
943                             [Max number of processors per Gambit VM instance (default is 64)]),
944              MAX_PROCESSORS=$enableval,
945              MAX_PROCESSORS=64)
946
947if test "$ENABLE_MULTIPLE_THREADED_VMS" = no; then
948  CONF_MAX_PROCESSORS=1
949else
950  CONF_MAX_PROCESSORS="$MAX_PROCESSORS"
951fi
952
953AC_SUBST(CONF_MAX_PROCESSORS)
954
955###############################################################################
956#
957# Check if OS threads are supported by the runtime system and if so
958# which thread system is to be used.
959
960AC_ARG_ENABLE(thread-system,
961              AC_HELP_STRING([--enable-thread-system@<:@=thread-system@:>@],
962                             [use OS threads (default is NO)]),
963              ENABLE_THREAD_SYSTEM=$enableval,
964              ENABLE_THREAD_SYSTEM=no)
965
966if test "$ENABLE_THREAD_SYSTEM" = no; then
967
968  if test "$ENABLE_MULTIPLE_VMS" != no -o "$ENABLE_MULTIPLE_THREADED_VMS" != no; then
969    ENABLE_THREAD_SYSTEM=yes
970  fi
971fi
972
973###############################################################################
974#
975# Check if thread local storage variables can be referenced from
976# dynamically loaded code.
977
978AC_ARG_ENABLE(dynamic-tls,
979              AC_HELP_STRING([--enable-dynamic-tls],
980                             [allow thread local storage variables to be referenced from dynamically loaded code (default is NO)]),
981              ENABLE_DYNAMIC_TLS=$enableval,
982              ENABLE_DYNAMIC_TLS=no)
983
984if test "$ENABLE_DYNAMIC_TLS" = yes; then
985  AC_DEFINE([___DYNAMIC_TLS],[],[Enable dynamic linking of TLS])
986  DEFS_OBJ_DYN_LIB_EXE="$DEFS_OBJ_DYN_LIB_EXE -D___DYNAMIC_TLS"
987fi
988
989###############################################################################
990#
991# Check if SSL support should be added using OpenSSL.
992
993AC_ARG_ENABLE(openssl,
994              AC_HELP_STRING([--enable-openssl],
995                             [compile with SSL support using OpenSSL (default is NO)]),
996              ENABLE_OPENSSL=$enableval,
997              ENABLE_OPENSSL=no)
998
999if test "$ENABLE_OPENSSL" = yes; then
1000  AC_DEFINE([USE_OPENSSL],[],[Enable SSL support using OpenSSL])
1001  AC_SEARCH_LIBS([main], [ssl crypto], [], [
1002    AC_MSG_ERROR([unable to find the SSL libraries])
1003  ])
1004fi
1005
1006###############################################################################
1007#
1008# Check for C compiler.
1009
1010AC_DEFUN([AC_CHECK_C_COMPILER_DEF],
1011[AC_CACHE_CHECK([whether $C_COMPILER defines $1], [ac_cv_$2],
1012[
1013rm -f conftest.$ac_ext
1014cat >conftest.$ac_ext <<_ACEOF
1015#line $LINENO "configure"
1016int
1017main ()
1018{
1019#ifndef $1
1020       choke me
1021#endif
1022
1023  ;
1024  return 0;
1025}
1026_ACEOF
1027if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
1028  (eval $ac_link) 2>&5
1029  ac_status=$?
1030  echo "$as_me:$LINENO: \$? = $ac_status" >&5
1031  (exit $ac_status); }; then
1032  ac_cv_$2="yes"
1033else
1034  ac_cv_$2=""
1035fi
1036])
1037$2="$ac_cv_$2"
1038AC_SUBST($2)
1039])
1040
1041AC_DEFUN([AC_CHECK_C_COMPILER_OPT],
1042[AC_CACHE_CHECK([whether $C_COMPILER accepts $1], [ac_cv_$2],
1043[
1044rm -f conftest.$ac_ext
1045cat >conftest.$ac_ext <<_ACEOF
1046#line $LINENO "configure"
1047int
1048main ()
1049{
1050  return 0;
1051}
1052_ACEOF
1053ac_test_CFLAGS=${CFLAGS+set}
1054ac_test_CXXFLAGS=${CXXFLAGS+set}
1055ac_save_CFLAGS=$CFLAGS
1056ac_save_CXXFLAGS=$CXXFLAGS
1057CFLAGS="$1$3"
1058CXXFLAGS="$1$3"
1059if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
1060  (eval $ac_link) 2>&5
1061  ac_status=$?
1062  echo "$as_me:$LINENO: \$? = $ac_status" >&5
1063  (exit $ac_status); }; then
1064  ac_cv_$2=" $1"
1065else
1066  ac_cv_$2=""
1067fi
1068if test "$ac_test_CFLAGS" = set; then
1069  CFLAGS=$ac_save_CFLAGS
1070fi
1071if test "$ac_test_CXXFLAGS" = set; then
1072  CXXFLAGS=$ac_save_CXXFLAGS
1073fi
1074])
1075$2="$ac_cv_$2"
1076AC_SUBST($2)
1077])
1078
1079AC_DEFUN([AC_CHECK_C_COMPILER_CPP_EXPR],
1080[AC_CACHE_CHECK([how $C_COMPILER's preprocessor evaluates $1], [ac_cv_$2],
1081[
1082rm -f conftest.$ac_ext
1083cat >conftest.$ac_ext <<_ACEOF
1084#line $LINENO "configure"
1085int
1086main ()
1087{
1088#if $1
1089#else
1090       choke me
1091#endif
1092
1093  ;
1094  return 0;
1095}
1096_ACEOF
1097if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
1098  (eval $ac_link) 2>&5
1099  ac_status=$?
1100  echo "$as_me:$LINENO: \$? = $ac_status" >&5
1101  (exit $ac_status); }; then
1102  ac_cv_$2="yes"
1103else
1104  ac_cv_$2=""
1105fi
1106])
1107$2="$ac_cv_$2"
1108AC_SUBST($2)
1109])
1110
1111AC_CHECK_C_COMPILER_DEF(__GNUC__,C_COMP_GNUC)
1112AC_CHECK_C_COMPILER_DEF(__clang__,C_COMP_CLANG)
1113AC_CHECK_C_COMPILER_DEF(__llvm__,C_COMP_LLVM)
1114AC_CHECK_C_COMPILER_DEF(_MSC_VER,C_COMP_VISUALC)
1115#AC_CHECK_C_COMPILER_DEF(__WATCOMC__,C_COMP_WATCOMC)
1116#AC_CHECK_C_COMPILER_DEF(__BORLANDC__,C_COMP_BORLANDC)
1117AC_CHECK_C_COMPILER_DEF(_WIN32,OS_WIN32)
1118
1119###############################################################################
1120#
1121# Check for header files.
1122
1123AC_CHECK_HEADERS(errno.h)
1124AC_CHECK_HEADERS(float.h)
1125AC_CHECK_HEADERS(signal.h)
1126AC_CHECK_HEADERS(stdio.h)
1127AC_CHECK_HEADERS(stdlib.h)
1128AC_CHECK_HEADERS(string.h)
1129AC_CHECK_HEADERS(time.h)
1130
1131# Default path separator
1132PATH_SEP="/"
1133
1134# Shell environment checks
1135
1136AC_DEFUN([AC_CHECK_ENVIRON],
1137[AC_CACHE_CHECK([for environ], ac_cv_environ,
1138[
1139  AC_TRY_COMPILE([
1140    #ifdef __cplusplus
1141    extern "C" {
1142    #endif
1143    extern char **environ;
1144    #ifdef __cplusplus
1145    }
1146    #endif
1147    ],[char *arg0 = *environ;],
1148  ac_cv_environ=yes,
1149  ac_cv_environ=no)
1150])
1151  if test $ac_cv_environ = yes; then
1152    AC_DEFINE([HAVE_ENVIRON],[],[Defined when environ is available])
1153  fi
1154])
1155
1156AC_DEFUN([AC_CHECK__NSGETENVIRON],
1157[AC_CHECK_HEADERS(crt_externs.h)
1158 AC_CACHE_CHECK([for _NSGetEnviron], ac_cv__NSGetEnviron,
1159[
1160  AC_TRY_COMPILE([
1161    #ifdef HAVE_CRT_EXTERNS_H
1162    #include <crt_externs.h>
1163    #endif
1164    ],[char *arg0 = *(*_NSGetEnviron());],
1165  ac_cv__NSGetEnviron=yes,
1166  ac_cv__NSGetEnviron=no)
1167])
1168  if test $ac_cv__NSGetEnviron = yes; then
1169    AC_DEFINE([HAVE__NSGETENVIRON],[],[Defined when _NSGetEnviron is available])
1170  fi
1171])
1172
1173AC_DEFUN([AC_CHECK_REMOVE],
1174[
1175  AC_CHECK_FUNCS(remove)
1176])
1177
1178AC_DEFUN([AC_CHECK_RENAME],
1179[
1180  AC_CHECK_FUNCS(rename)
1181])
1182
1183AC_DEFUN([AC_CHECK_MKDIR],
1184[
1185  AC_CHECK_HEADERS(sys/stat.h)
1186  AC_CHECK_FUNCS(mkdir)
1187])
1188
1189AC_DEFUN([AC_CHECK_OPENDIR],
1190[
1191  AC_CHECK_HEADERS(dirent.h)
1192  AC_CHECK_FUNCS(opendir)
1193])
1194
1195AC_DEFUN([AC_CHECK_STAT],
1196[
1197  AC_CHECK_HEADERS(stat.h)
1198  AC_CHECK_HEADERS(sys/stat.h)
1199  AC_CHECK_FUNCS(stat)
1200  AC_CHECK_FUNCS(stat64)
1201  AC_CHECK_TYPE([struct stat64],
1202                [AC_DEFINE([HAVE_STRUCT_STAT64],[],[Defined when struct stat64 is available])],
1203                [],
1204                [#include <sys/stat.h>])
1205])
1206
1207AC_DEFUN([AC_CHECK_SIGSET_T],
1208[
1209  CONF_USE_SIGSET_T="___USE_NO_SIGSET_T"
1210  AC_CACHE_CHECK([for sigset_t], ac_cv_type_sigset_t,
1211  [
1212    AC_TRY_COMPILE([
1213      #ifdef HAVE_SIGNAL_H
1214      #include <signal.h>
1215      #endif
1216      ],[sigset_t ss;],
1217    ac_cv_type_sigset_t=yes,
1218    ac_cv_type_sigset_t=no)
1219  ])
1220  if test $ac_cv_type_sigset_t = yes; then
1221    CONF_USE_SIGSET_T="___USE_SIGSET_T"
1222  fi
1223  AC_SUBST(CONF_USE_SIGSET_T)
1224])
1225
1226
1227AC_DEFUN([AC_CHECK_COMMON],
1228[
1229  AC_CHECK_ENVIRON
1230  AC_CHECK__NSGETENVIRON
1231  AC_CHECK_REMOVE
1232  AC_CHECK_RENAME
1233  AC_CHECK_MKDIR
1234  AC_CHECK_OPENDIR
1235  AC_CHECK_STAT
1236  AC_CHECK_SIGSET_T
1237])
1238
1239# Check for OS functions and header files
1240
1241if test "$ANSI_C" = yes; then
1242
1243  # Check if linking to the math library needs some special linker flags.
1244
1245  AC_SEARCH_LIBS(asin,m)
1246
1247  # The following functions should be provided by an ANSI-C conforming
1248  # compiler, but it is safest to double check.  If they are not
1249  # available, the system will still compile but some functionality
1250  # will be missing from the Gambit runtime system.
1251
1252  AC_CHECK_FUNCS(getenv)
1253  AC_CHECK_FUNCS(time)
1254  AC_CHECK_FUNCS(clock)
1255
1256  # Check for common functions which are frequently available
1257  # even if not strictly ANSI-C.
1258
1259  AC_CHECK_COMMON
1260
1261else
1262
1263  AC_CHECK_HEADERS(unistd.h)
1264  AC_CHECK_HEADERS(pwd.h)
1265  AC_CHECK_HEADERS(dlfcn.h)
1266  AC_CHECK_HEADERS(dl.h)
1267  AC_CHECK_HEADERS(sys/dxe.h)
1268  AC_CHECK_HEADERS(mach-o/dyld.h)
1269  AC_CHECK_HEADERS(mach/mach_time.h)
1270  AC_CHECK_HEADERS(sys/types.h)
1271  AC_CHECK_HEADERS(sys/time.h)
1272  AC_CHECK_HEADERS(sys/times.h)
1273  AC_CHECK_HEADERS(sys/timeb.h)
1274  AC_CHECK_HEADERS(sys/timers.h)
1275  AC_CHECK_HEADERS(sys/resource.h)
1276  AC_CHECK_HEADERS(sys/wait.h)
1277  AC_CHECK_HEADERS(sys/mman.h)
1278  AC_CHECK_HEADERS(syslog.h)
1279  AC_CHECK_HEADERS(execinfo.h)
1280  AC_CHECK_HEADERS(netdb.h)
1281  AC_CHECK_HEADERS(grp.h)
1282  #AC_CHECK_HEADERS(windows.h)
1283  #AC_CHECK_HEADERS(io.h)
1284  #AC_CHECK_HEADERS(tchar.h)
1285  AC_CHECK_HEADERS(fpu_control.h)
1286  AC_CHECK_HEADERS(os2.h)
1287  AC_CHECK_HEADERS(dos.h)
1288  AC_CHECK_HEADERS(direct.h)
1289  #AC_CHECK_HEADERS(Retrace.h)
1290  #AC_CHECK_HEADERS(Files.h)
1291  #AC_CHECK_HEADERS(Finder.h)
1292  #AC_CHECK_HEADERS(Errors.h)
1293  #AC_CHECK_HEADERS(Folders.h)
1294  #AC_CHECK_HEADERS(OSUtils.h)
1295  #AC_CHECK_HEADERS(Power.h)
1296  #AC_CHECK_HEADERS(CodeFragments.h)
1297  #AC_CHECK_HEADERS(SIOUX.h)
1298  #AC_CHECK_HEADERS(mac_gui.h)
1299  #AC_CHECK_HEADERS(unix.h)
1300  AC_CHECK_HEADERS(wdefwin.h)
1301  AC_CHECK_HEADERS(tfork.h)
1302  AC_CHECK_HEADERS(curses.h)
1303  AC_CHECK_HEADERS(ncurses.h)
1304  AC_CHECK_HEADERS(netinet/in.h)
1305  AC_CHECK_HEADERS(arpa/inet.h)
1306  AC_CHECK_HEADERS(termios.h)
1307  #AC_CHECK_HEADERS(term.h)
1308  AC_CHECK_HEADERS(pty.h)
1309  AC_CHECK_HEADERS(stropts.h)
1310  AC_CHECK_HEADERS(libutil.h)
1311  AC_CHECK_HEADERS(util.h)
1312  AC_CHECK_HEADERS(sys/fpu.h)
1313  AC_CHECK_HEADERS(fenv.h)
1314  AC_CHECK_HEADERS(fcntl.h)
1315  AC_CHECK_HEADERS(sys/ioctl.h)
1316  AC_CHECK_HEADERS(sys/socket.h)
1317  AC_CHECK_HEADERS(strings.h)
1318  AC_CHECK_HEADERS(memory.h)
1319  AC_CHECK_HEADERS(sys/sysctl.h)
1320  AC_CHECK_HEADERS(ws2tcpip.h)
1321  AC_CHECK_HEADERS(TargetConditionals.h)
1322  AC_CHECK_HEADERS(AvailabilityMacros.h)
1323  AC_CHECK_HEADERS(poll.h)
1324
1325  AC_CHECK_COMMON
1326
1327  if test "$C_COMP_VISUALC" != yes; then
1328
1329    AC_DEFUN([AC_TYPE_SOCKLEN_T],
1330    [AC_CACHE_CHECK([for socklen_t], ac_cv_type_socklen_t,
1331    [
1332      AC_TRY_COMPILE(
1333      [#include <sys/types.h>
1334       #ifdef HAVE_SYS_SOCKET_H
1335       #include <sys/socket.h>
1336       #endif
1337       #ifdef HAVE_WS2TCPIP_H
1338       #include <ws2tcpip.h>
1339       #endif],
1340      [socklen_t len = 42; return 0;],
1341      ac_cv_type_socklen_t=yes,
1342      ac_cv_type_socklen_t=no)
1343    ])
1344      if test $ac_cv_type_socklen_t != yes; then
1345        AC_DEFINE([socklen_t],[int],[C type for socklen_t])
1346      fi
1347    ])
1348
1349    AC_TYPE_SOCKLEN_T
1350
1351  fi
1352
1353  #AC_TYPE_MODE_T
1354  #AC_TYPE_OFF_T
1355  #AC_TYPE_PID_T
1356  #AC_TYPE_SIGNAL
1357  #AC_TYPE_SIZE_T
1358  #AC_TYPE_UID_T
1359
1360  #AC_HEADER_DIRENT
1361  #AC_HEADER_STAT
1362  #AC_HEADER_STDC
1363  #AC_HEADER_SYS_WAIT
1364  #AC_HEADER_TIME
1365  #AC_HEADER_TIOCGWINSZ
1366  #AC_FUNC_SELECT_ARGTYPES
1367
1368  #AC_FUNC_CLOSEDIR_VOID
1369  #AC_FUNC_FSEEKO
1370  #AC_FUNC_STAT
1371  #AC_FUNC_LSTAT
1372
1373  if test "$C_COMP_VISUALC" = yes; then
1374
1375    PATH_SEP="\\\\\\\\\\\\\\\\"
1376
1377    LIBS="$LIBS Kernel32.Lib User32.Lib Gdi32.Lib WS2_32.Lib"
1378
1379    if test "$ENABLE_HIGH_RES_TIMING" = yes; then
1380      LIBS="$LIBS WinMM.Lib"
1381    fi
1382
1383    FLAGS_OBJ_DYN_LIB_EXE="$FLAGS_OBJ_DYN_LIB_EXE -D_WINDOWS -D_WIN32_WINNT=0x0600"
1384
1385    # For compatibility with Windows XP
1386    FLAGS_OBJ_DYN_LIB_EXE="$FLAGS_OBJ_DYN_LIB_EXE -D_ATL_XP_TARGETING"
1387
1388  else
1389
1390    case "$target_os" in
1391
1392       mingw*) # add Windows libraries needed by MinGW
1393
1394               PATH_SEP="\\\\\\\\\\\\\\\\"
1395
1396               LIBS="$LIBS -lws2_32"
1397
1398               if test "$ENABLE_HIGH_RES_TIMING" = yes; then
1399                 LIBS="$LIBS -lwinmm"
1400               fi
1401
1402               FLAGS_OBJ_DYN_LIB_EXE="$FLAGS_OBJ_DYN_LIB_EXE -D_WINDOWS -D_WIN32_WINNT=0x0600"
1403               ;;
1404
1405            *) # check libraries for other systems
1406
1407               AC_SEARCH_LIBS(asin,m)
1408
1409               AC_SEARCH_LIBS(dlopen,dl)
1410               AC_SEARCH_LIBS(shl_load,dld)
1411
1412               #AC_SEARCH_LIBS(tgetstr,ncurses curses)
1413               #AC_SEARCH_LIBS(tigetstr,ncurses curses)
1414
1415               AC_SEARCH_LIBS(socket,socket)
1416
1417               AC_SEARCH_LIBS(gethostbyname,nsl resolv xnet)
1418
1419               AC_SEARCH_LIBS(hstrerror,resolv)
1420
1421               AC_SEARCH_LIBS(openpty,util)
1422
1423               AC_SEARCH_LIBS(clock_gettime,rt)
1424
1425               AC_SEARCH_LIBS(timeBeginPeriod,winmm)
1426               ;;
1427    esac
1428
1429  fi
1430
1431  AC_CHECK_FUNCS(pipe)
1432  AC_CHECK_FUNCS(socketpair)
1433  AC_CHECK_FUNCS(chdir)
1434  AC_CHECK_FUNCS(execvp)
1435  AC_CHECK_FUNCS(getgrnam)
1436  AC_CHECK_FUNCS(getpid)
1437  AC_CHECK_FUNCS(getppid)
1438  AC_CHECK_FUNCS(getpwnam)
1439  AC_CHECK_FUNCS(ioctl)
1440  AC_CHECK_FUNCS(link)
1441  AC_CHECK_FUNCS(mkfifo)
1442  AC_CHECK_FUNCS(rmdir)
1443  AC_CHECK_FUNCS(socket)
1444  AC_CHECK_FUNCS(utimes)
1445  AC_CHECK_FUNCS(strerror)
1446  AC_CHECK_FUNCS(symlink)
1447  AC_CHECK_FUNCS(sysconf)
1448  AC_CHECK_FUNCS(sysctl)
1449  AC_CHECK_FUNCS(sysctlbyname)
1450  AC_CHECK_FUNCS(syslog)
1451  AC_CHECK_FUNCS(backtrace_symbols_fd)
1452  AC_CHECK_FUNCS(unlink)
1453  AC_CHECK_FUNCS(waitpid)
1454  AC_CHECK_FUNCS(mmap)
1455  AC_CHECK_FUNCS(fcntl)
1456
1457  # The following checks for library functions have been written
1458  # specially to catch the case where they are declared as inline
1459  # functions.  This was done when porting to the Android platform,
1460  # but it may be useful for other platforms as well.
1461
1462  # used to be: AC_CHECK_FUNCS(tcgetattr)
1463
1464  AC_DEFUN([AC_CHECK_FUNC_TCGETSETATTR],
1465  [AC_CACHE_CHECK([for tcgetsetattr], ac_cv_func_tcgetsetattr,
1466  [
1467    AC_TRY_COMPILE([
1468      #ifdef HAVE_TERMIOS_H
1469      #include <termios.h>
1470      #endif
1471      ],[int fd = 1; struct termios tios; tcgetattr (fd, &tios); tcsetattr (fd, TCSANOW, &tios);],
1472    ac_cv_func_tcgetsetattr=yes,
1473    ac_cv_func_tcgetsetattr=no)
1474  ])
1475    if test $ac_cv_func_tcgetsetattr = yes; then
1476      AC_DEFINE([HAVE_TCGETSETATTR],[],[Defined when tcgetattr and tcsetattr are available])
1477    fi
1478  ])
1479
1480  AC_CHECK_FUNC_TCGETSETATTR
1481
1482  # used to be: AC_CHECK_FUNCS(sigaction)
1483
1484  AC_DEFUN([AC_CHECK_FUNC_SIGACTION],
1485  [AC_CACHE_CHECK([for sigaction], ac_cv_func_sigaction,
1486  [
1487    AC_TRY_COMPILE([
1488      #ifdef HAVE_SIGNAL_H
1489      #include <signal.h>
1490      #endif
1491      ],[struct sigaction sa1, sa2; sigaction (1, &sa1, &sa2);],
1492    ac_cv_func_sigaction=yes,
1493    ac_cv_func_sigaction=no)
1494  ])
1495    if test $ac_cv_func_sigaction = yes; then
1496      AC_DEFINE([HAVE_SIGACTION],[],[Defined when sigaction is available])
1497    fi
1498  ])
1499
1500  AC_CHECK_FUNC_SIGACTION
1501
1502  # used to be: AC_CHECK_FUNCS(sigemptyset)
1503  #             AC_CHECK_FUNCS(sigaddset)
1504
1505  AC_DEFUN([AC_CHECK_FUNC_SIGSET],
1506  [AC_CACHE_CHECK([for sigemptyset/sigaddset], ac_cv_func_sigset,
1507  [
1508    AC_TRY_COMPILE([
1509      #ifdef HAVE_SIGNAL_H
1510      #include <signal.h>
1511      #endif
1512      ],[sigset_t ss; sigemptyset (&ss); sigaddset (&ss, 1);],
1513    ac_cv_func_sigset=yes,
1514    ac_cv_func_sigset=no)
1515  ])
1516    if test $ac_cv_func_sigset = yes; then
1517      AC_DEFINE([HAVE_SIGEMPTYSET],[],[Defined when sigemptyset is available])
1518      AC_DEFINE([HAVE_SIGADDSET],[],[Defined when sigaddset is available])
1519    fi
1520  ])
1521
1522  AC_CHECK_FUNC_SIGSET
1523
1524  # used to be: AC_CHECK_FUNCS(sigprocmask)
1525
1526  AC_DEFUN([AC_CHECK_FUNC_SIGPROCMASK],
1527  [AC_CACHE_CHECK([for sigprocmask], ac_cv_func_sigprocmask,
1528  [
1529    AC_TRY_COMPILE([
1530      #ifdef HAVE_SIGNAL_H
1531      #include <signal.h>
1532      #endif
1533      ],[sigset_t ss1, ss2; sigemptyset (&ss1); sigaddset (&ss1, 1); sigprocmask (SIG_BLOCK, &ss1, &ss2);],
1534    ac_cv_func_sigprocmask=yes,
1535    ac_cv_func_sigprocmask=no)
1536  ])
1537    if test $ac_cv_func_sigprocmask = yes; then
1538      AC_DEFINE([HAVE_SIGPROCMASK],[],[Defined when sigprocmask is available])
1539    fi
1540  ])
1541
1542  AC_CHECK_FUNC_SIGPROCMASK
1543
1544  # used to be: AC_CHECK_FUNCS(signal)
1545
1546  AC_DEFUN([AC_CHECK_FUNC_SIGNAL],
1547  [AC_CACHE_CHECK([for signal], ac_cv_func_signal,
1548  [
1549    AC_TRY_COMPILE([
1550      #ifdef HAVE_SIGNAL_H
1551      #include <signal.h>
1552      #endif
1553      ],[signal (1, SIG_DFL);],
1554    ac_cv_func_signal=yes,
1555    ac_cv_func_signal=no)
1556  ])
1557    if test $ac_cv_func_signal = yes; then
1558      AC_DEFINE([HAVE_SIGNAL],[],[Defined when signal is available])
1559    fi
1560  ])
1561
1562  AC_CHECK_FUNC_SIGNAL
1563
1564  AC_CHECK_FUNCS(clock_gettime)
1565  AC_CHECK_FUNCS(mach_absolute_time)
1566  AC_CHECK_FUNCS(getclock)
1567  #AC_CHECK_FUNCS(GetSystemTime)
1568  AC_CHECK_FUNCS(gettimeofday)
1569  AC_CHECK_FUNCS(ftime)
1570  AC_CHECK_FUNCS(time)
1571
1572  AC_CHECK_FUNCS(nanosleep)
1573  #AC_CHECK_FUNCS(Sleep)
1574  AC_CHECK_FUNCS(sleep)
1575
1576  #AC_CHECK_FUNCS(GetProcessTimes)
1577  AC_CHECK_FUNCS(getrusage)
1578  AC_CHECK_FUNCS(times)
1579  AC_CHECK_FUNCS(clock)
1580  AC_CHECK_FUNCS(DosQuerySysInfo)
1581
1582  AC_CHECK_FUNCS(setitimer)
1583  AC_CHECK_FUNCS(dos_setvect)
1584  AC_CHECK_FUNCS(DosStartTimer)
1585  AC_CHECK_FUNCS(VInstall)
1586  #AC_CHECK_FUNCS(CreateThread)
1587
1588  AC_CHECK_FUNCS(shl_load)
1589  #AC_CHECK_FUNCS(LoadLibrary)
1590  AC_CHECK_FUNCS(DosLoadModule)
1591  AC_CHECK_FUNCS(dxe_load)
1592  AC_CHECK_FUNCS(GetDiskFragment)
1593  AC_CHECK_FUNCS(dlopen)
1594  AC_CHECK_FUNCS(NSLinkModule) # has been deprecated by Apple
1595
1596  AC_CHECK_FUNCS(gethostname)
1597  AC_CHECK_FUNCS(inet_pton)
1598  AC_CHECK_FUNCS(getaddrinfo)
1599  AC_CHECK_FUNCS(gethostbyname)
1600  AC_CHECK_FUNCS(gethostbyaddr)
1601  AC_CHECK_FUNCS(getservbyname)
1602  AC_CHECK_FUNCS(getservbyport)
1603  AC_CHECK_FUNCS(getprotobyname)
1604  AC_CHECK_FUNCS(getprotobynumber)
1605  AC_CHECK_FUNCS(getnetbyname)
1606
1607  AC_CHECK_FUNCS(select)
1608  AC_CHECK_FUNCS(poll)
1609  AC_CHECK_FUNCS(ppoll)
1610  #AC_CHECK_FUNCS(MsgWaitForMultipleObjects)
1611
1612  #AC_CHECK_FUNCS(tgetstr)
1613  #AC_CHECK_FUNCS(tigetstr)
1614
1615  AC_CHECK_FUNCS(openpty)
1616  AC_CHECK_FUNCS(getpt)
1617  AC_CHECK_FUNCS(ptsname)
1618  AC_CHECK_FUNCS(ctermid)
1619  AC_CHECK_FUNCS(isastream)
1620
1621  AC_CHECK_FUNCS(hstrerror)
1622
1623  AC_CHECK_FUNCS(snprintf)
1624
1625  case "$target_os" in
1626    # the OpenBSD test is always lowercase
1627    openbsd*)
1628      # OpenBSD/mips64(el) does have get_fpc_csr(), but lacks union fpc_csr.
1629      ;;
1630    *)
1631      AC_CHECK_FUNCS(get_fpc_csr)
1632      ;;
1633  esac
1634
1635fi
1636
1637###############################################################################
1638#
1639# Determine which thread system to use.
1640
1641# Check for threading system early, in case this has an impact on
1642# other functionality.
1643
1644CONF_THREAD_SYSTEM="___USE_NO_THREAD_SYSTEM"
1645CONF_THREAD_LOCAL_STORAGE_CLASS="___NO_THREAD_LOCAL_STORAGE_CLASS"
1646
1647if test "$ENABLE_THREAD_SYSTEM" != no; then
1648
1649  FOUND_THREAD_SYSTEM="no"
1650
1651  if test "$FOUND_THREAD_SYSTEM" = no -a \( "$ENABLE_THREAD_SYSTEM" = yes -o "$ENABLE_THREAD_SYSTEM" = posix -o "$ENABLE_THREAD_SYSTEM" = pthreads \); then
1652
1653    # check if posix thread system is available
1654
1655    ORIG_CFLAGS="$CFLAGS"
1656    ORIG_LIBS="$LIBS"
1657
1658    for opt in "" "OPT_CFLAGS=\"-mt\"" "OPT_CFLAGS=\"-pthread\"" "OPT_LIBS=\"-lpthread\""; do
1659
1660      OPT_CFLAGS=""
1661      OPT_LIBS=""
1662
1663      eval "$opt"
1664
1665      CFLAGS="$ORIG_CFLAGS $OPT_CFLAGS"
1666      LIBS="$ORIG_LIBS $OPT_LIBS"
1667
1668      AC_MSG_CHECKING([for posix threads with CFLAGS='$CFLAGS' and LIBS='$LIBS'])
1669
1670      AC_LINK_IFELSE(
1671        [AC_LANG_PROGRAM([
1672           #include <pthread.h>
1673           void *start_fn (void *ptr) { return ptr; }
1674        ],[
1675           pthread_t thread;
1676           pthread_mutex_t mut;
1677           if (pthread_mutex_init (&mut, NULL) == 0 &&
1678               pthread_mutex_lock (&mut) == 0 &&
1679               pthread_mutex_unlock (&mut) == 0 &&
1680               pthread_mutex_destroy (&mut) == 0) {
1681             pthread_create (&thread, NULL, start_fn, NULL);
1682             pthread_join (thread, NULL);
1683           }
1684        ])],[
1685         AC_MSG_RESULT([yes])
1686         FOUND_THREAD_SYSTEM="posix"
1687         FLAGS_OBJ_DYN_LIB_EXE="$FLAGS_OBJ_DYN_LIB_EXE $OPT_CFLAGS"
1688         break
1689        ],[
1690         AC_MSG_RESULT([no])
1691         LIBS="$ORIG_LIBS"
1692        ])
1693
1694      CFLAGS="$ORIG_CFLAGS"
1695
1696    done
1697
1698  fi
1699
1700  if test "$FOUND_THREAD_SYSTEM" = no -a \( "$ENABLE_THREAD_SYSTEM" = yes -o "$ENABLE_THREAD_SYSTEM" = win32 \); then
1701
1702    # check if win32 thread system is available
1703
1704    AC_MSG_CHECKING([for win32 threads])
1705
1706    if test "$OS_WIN32" = yes; then
1707      AC_MSG_RESULT([yes])
1708      FOUND_THREAD_SYSTEM="win32"
1709    else
1710      AC_MSG_RESULT([no])
1711    fi
1712
1713  fi
1714
1715  if test "$FOUND_THREAD_SYSTEM" != no; then
1716
1717    case "$FOUND_THREAD_SYSTEM" in
1718
1719      posix)
1720        CONF_THREAD_SYSTEM="___USE_POSIX_THREAD_SYSTEM"
1721        ;;
1722
1723      win32)
1724        CONF_THREAD_SYSTEM="___USE_WIN32_THREAD_SYSTEM"
1725        ;;
1726
1727    esac
1728
1729    AC_MSG_CHECKING([for thread local storage class])
1730
1731    TLS_CLASS="none"
1732
1733    for tls_class in "_Thread_local" "__thread" "__declspec(thread)"; do
1734      AC_TRY_COMPILE([
1735        #include <stdlib.h>
1736        ] $tls_class [ int foo;
1737       ],[
1738        foo = 42;
1739       ],[TLS_CLASS="$tls_class"; break])
1740    done
1741
1742    AC_MSG_RESULT($TLS_CLASS)
1743
1744    if test "$TLS_CLASS" != none; then
1745      CONF_THREAD_LOCAL_STORAGE_CLASS="___THREAD_LOCAL_STORAGE_CLASS $TLS_CLASS"
1746    fi
1747
1748  else
1749
1750    if test "$ENABLE_THREAD_SYSTEM" = yes; then
1751
1752      AC_MSG_NOTICE([
1753*********************************************************************
1754***                                                               ***
1755*** A thread system is required for this configuration but none   ***
1756*** of the supported thread systems (posix threads and win32      ***
1757*** threads) are available on this platform. The configuration    ***
1758*** will proceed as though --disable-thread-system,               ***
1759*** --disable-multiple-vms, and --disable-multiple-threaded-vms   ***
1760*** were specified.                                               ***
1761***                                                               ***
1762*********************************************************************
1763])
1764
1765    else
1766
1767      AC_MSG_NOTICE([
1768*********************************************************************
1769***                                                               ***
1770*** The thread system selected with --enable-thread-system=XXX    ***
1771*** is not available on this platform. The configuration will     ***
1772*** proceed as though --disable-thread-system,                    ***
1773*** --disable-multiple-vms, and --disable-multiple-threaded-vms   ***
1774*** were specified.                                               ***
1775***                                                               ***
1776*********************************************************************
1777])
1778
1779    fi
1780
1781    CONF_SINGLE_MULTIPLE_VMS="___SINGLE_VM"
1782    CONF_SINGLE_MULTIPLE_THREADED_VMS="___SINGLE_THREADED_VMS"
1783    CONF_MAX_PROCESSORS=1
1784
1785  fi
1786
1787fi
1788
1789AC_SUBST(CONF_THREAD_SYSTEM)
1790AC_SUBST(CONF_THREAD_LOCAL_STORAGE_CLASS)
1791
1792# Check availability of WIN32 CONDITION_VARIABLE type.
1793
1794CONF_HAVE_CONDITION_VARIABLE="___DONT_HAVE_CONDITION_VARIABLE"
1795
1796if test "$OS_WIN32" = yes; then
1797
1798  AC_CHECK_TYPE([CONDITION_VARIABLE],
1799                [CONF_HAVE_CONDITION_VARIABLE="___HAVE_CONDITION_VARIABLE"],
1800                [],
1801                [#include <windows.h>])
1802
1803fi
1804
1805AC_SUBST(CONF_HAVE_CONDITION_VARIABLE)
1806
1807###############################################################################
1808#
1809# Check for pthread_setaffinity_np if using posix threads.
1810
1811if test "$FOUND_THREAD_SYSTEM" = posix; then
1812
1813  AC_LINK_IFELSE(
1814   [AC_LANG_PROGRAM(
1815    [#define _GNU_SOURCE
1816     #include <pthread.h>],
1817    [cpu_set_t cpuset;
1818     CPU_ZERO (&cpuset);
1819     CPU_SET (0, &cpuset);
1820     pthread_setaffinity_np (pthread_self (), sizeof (cpu_set_t), &cpuset);])],
1821    AC_DEFINE([HAVE_PTHREAD_SETAFFINITY_NP],[1],[Define if pthread_setaffinity_np is supported]))
1822
1823fi
1824
1825###############################################################################
1826#
1827# OpenSSL flags
1828
1829if test "$ENABLE_OPENSSL" = yes; then
1830
1831  case "$target_os" in
1832    darwin*) # OS X ships a very old version and considers OpenSSL deprecated
1833             CFLAGS="$CFLAGS -Wno-deprecated-declarations -I\"/usr/local/opt/openssl/include\""
1834             LIBS="$LIBS -L/usr/local/opt/openssl/lib -lssl -lcrypto"
1835             ;;
1836    mingw*) # Search in typical locations
1837             CFLAGS="$CFLAGS -I\"/C/OpenSSL-x64/include\" -I\"/c/OpenSSL/include\" -I\"/usr/local/include\""
1838             LIBS="$LIBS -L\"/C/OpenSSL-x64/lib\" -L\"/c/OpenSSL/lib\" -L\"/usr/local/lib/\" -lssl -lcrypto -lws2_32 -lgdi32 -lcrypt32 -mconsole"
1839             ;;
1840         *)
1841             LIBS="$LIBS -L/usr/local/opt/openssl/lib -lssl -lcrypto"
1842             ;;
1843  esac
1844
1845fi
1846
1847
1848###############################################################################
1849#
1850# Check for possible presence of C compiler bugs.
1851
1852# For details see the messages printed at the end of the configure script.
1853
1854if test "$C_COMP_GNUC" = yes; then
1855  AC_COMPUTE_INT(C_COMP_GNUC_VERSION,[__GNUC__*100000+__GNUC_MINOR__*1000+__GNUC_PATCHLEVEL__])
1856fi
1857
1858if test "$C_COMP_CLANG" = yes; then
1859  AC_COMPUTE_INT(C_COMP_CLANG_VERSION,[__clang_major__*100000+__clang_minor__*1000+__clang_patchlevel__])
1860fi
1861
1862if test "$C_COMP_LLVM" = yes -a "$C_COMP_CLANG" != yes -a "$C_COMP_GNUC_VERSION" -lt 405000; then
1863  LLVM_GCC_LABEL_VALUES_POSSIBLE_BUG=yes
1864fi
1865
1866if test "$C_COMP_CLANG" != yes -a "$C_COMP_GNUC_VERSION" -ge 402000 -a "$C_COMP_GNUC_VERSION" -lt 404000 -a "$ENABLE_SINGLE_HOST" = yes; then
1867  GNU_GCC_MOVE_LOOP_INVARIANTS_POSSIBLE_BUG=yes
1868fi
1869
1870case "$target_os" in
1871  darwin*) # strangely this bug only appears on Mac OS
1872    if test "$C_COMP_CLANG" != yes -a "$C_COMP_GNUC_VERSION" -ge 600000 -a "$DASH_fno_ipa_ra" != "" -a "$ENABLE_SHARED" = yes -a "$ENABLE_C_OPT" != no; then
1873      GNU_GCC_IPA_RA_POSSIBLE_BUG=yes
1874    fi
1875    ;;
1876esac
1877
1878###############################################################################
1879#
1880# Check which command line options are supported by $C_COMPILER.
1881
1882if test "$C_COMP_GNUC" = yes; then
1883
1884  ########## Using gcc...
1885
1886  # Determine if GNU gcc or LLVM gcc is being used.
1887
1888  if test "$C_COMP_CLANG" = yes -o "$ENABLE_GNU_GCC_SPECIFIC_OPTIONS" != yes; then
1889
1890    # clang does not support these options:
1891    DASH_no_cpp_precomp=""
1892    DASH_fschedule_insns2=""
1893    DASH_fno_trapping_math=""
1894    DASH_fno_move_loop_invariants=""
1895    DASH_fno_keep_inline_dllexport=""
1896    #DASH_fpermissive=""
1897    DASH_mieee=""
1898    DASH_mieee_with_inexact=""
1899    DASH_mpc64=""
1900    DASH_fno_ipa_ra=""
1901
1902  else
1903
1904    # preprocessor options:
1905    AC_CHECK_C_COMPILER_OPT(-no-cpp-precomp,DASH_no_cpp_precomp)
1906
1907    # optimization options:
1908    AC_CHECK_C_COMPILER_OPT(-fschedule-insns2,DASH_fschedule_insns2)
1909    AC_CHECK_C_COMPILER_OPT(-fno-trapping-math,DASH_fno_trapping_math)
1910    AC_CHECK_C_COMPILER_OPT(-fno-move-loop-invariants,DASH_fno_move_loop_invariants)
1911    AC_CHECK_C_COMPILER_OPT(-fno-keep-inline-dllexport,DASH_fno_keep_inline_dllexport)
1912    #AC_CHECK_C_COMPILER_OPT(-fpermissive,DASH_fpermissive)
1913
1914    # machine specific options:
1915    AC_CHECK_C_COMPILER_OPT(-mieee,DASH_mieee)
1916    AC_CHECK_C_COMPILER_OPT(-mieee-with-inexact,DASH_mieee_with_inexact)
1917    AC_CHECK_C_COMPILER_OPT(-mpc64,DASH_mpc64)
1918  fi
1919
1920  # debugging options:
1921  AC_CHECK_C_COMPILER_OPT(-Wall,DASH_Wall)
1922  AC_CHECK_C_COMPILER_OPT(-W,DASH_W)
1923  AC_CHECK_C_COMPILER_OPT(-Wno-unused,DASH_Wno_unused)
1924  AC_CHECK_C_COMPILER_OPT(-Wno-write-strings,DASH_Wno_write_strings)
1925  AC_CHECK_C_COMPILER_OPT(-Wdisabled-optimization,DASH_Wdisabled_optimization)
1926  AC_CHECK_C_COMPILER_OPT(-g,DASH_g)
1927
1928  # profiling options:
1929  AC_CHECK_C_COMPILER_OPT(-p,DASH_p)
1930  AC_CHECK_C_COMPILER_OPT(-pg,DASH_pg)
1931  AC_CHECK_C_COMPILER_OPT(-ftest-coverage,DASH_ftest_coverage)
1932  AC_CHECK_C_COMPILER_OPT(-fprofile-arcs,DASH_fprofile_arcs)
1933  AC_CHECK_C_COMPILER_OPT(-fbranch-probabilities,DASH_fbranch_probabilities)
1934
1935  # optimization options:
1936  AC_CHECK_C_COMPILER_OPT(-O1,DASH_O1)
1937  AC_CHECK_C_COMPILER_OPT(-O2,DASH_O2)
1938  AC_CHECK_C_COMPILER_OPT(-O3,DASH_O3)
1939  AC_CHECK_C_COMPILER_OPT(-Ofast,DASH_Ofast)
1940  AC_CHECK_C_COMPILER_OPT(-fno-math-errno,DASH_fno_math_errno)
1941  AC_CHECK_C_COMPILER_OPT(-fno-strict-aliasing,DASH_fno_strict_aliasing)
1942  AC_CHECK_C_COMPILER_OPT(-fwrapv,DASH_fwrapv)
1943  AC_CHECK_C_COMPILER_OPT(-ftrapv,DASH_ftrapv)
1944  AC_CHECK_C_COMPILER_OPT(-fomit-frame-pointer,DASH_fomit_frame_pointer)
1945  AC_CHECK_C_COMPILER_OPT(-fno-ipa-ra, DASH_fno_ipa_ra)
1946
1947  FLAGS_OPT_LO="$DASH_O1"
1948
1949  if test "$DASH_O3" != ""; then
1950    FLAGS_OPT_HI="$DASH_O3"
1951  else
1952    if test "$DASH_O2" != ""; then
1953      FLAGS_OPT_HI="$DASH_O2"
1954    else
1955      FLAGS_OPT_HI="$DASH_O1"
1956    fi
1957  fi
1958
1959  FLAGS_OPT="$FLAGS_OPT_LO"
1960  FLAGS_OPT_RTS="$FLAGS_OPT_HI"
1961
1962  case "$ENABLE_C_OPT" in
1963
1964     yes) FLAGS_OPT="$FLAGS_OPT_HI"
1965          ;;
1966
1967      no) ;;
1968
1969       *) FLAGS_OPT=" $ENABLE_C_OPT"
1970          ;;
1971
1972  esac
1973
1974# It isn't clear these are useful:
1975#  AC_CHECK_C_COMPILER_OPT(-fexpensive-optimizations,DASH_fexpensive_optimizations)
1976#  AC_CHECK_C_COMPILER_OPT(-fforce-addr,DASH_fforce_addr)
1977#  AC_CHECK_C_COMPILER_OPT(-fpeephole2,DASH_fpeephole2)
1978#  AC_CHECK_C_COMPILER_OPT(-falign-jumps,DASH_falign_jumps)
1979#  AC_CHECK_C_COMPILER_OPT(-falign-functions,DASH_falign_functions)
1980#  AC_CHECK_C_COMPILER_OPT(-fno-function-cse,DASH_fno_function_cse)
1981#  AC_CHECK_C_COMPILER_OPT(-ftree-copyrename,DASH_ftree_copyrename)
1982#  AC_CHECK_C_COMPILER_OPT(-ftree-fre,DASH_ftree_fre)
1983#  AC_CHECK_C_COMPILER_OPT(-ftree-dce,DASH_ftree_dce)
1984#  AC_CHECK_C_COMPILER_OPT(-fschedule-interblock,DASH_fschedule_interblock)
1985#  AC_CHECK_C_COMPILER_OPT(-fregmove,DASH_fregmove)
1986#  AC_CHECK_C_COMPILER_OPT(-fgcse-las,DASH_fgcse_las)
1987#  AC_CHECK_C_COMPILER_OPT(-freorder-functions,DASH_freorder_functions)
1988#  AC_CHECK_C_COMPILER_OPT(-fcaller-saves,DASH_fcaller_saves)
1989#  AC_CHECK_C_COMPILER_OPT(-fno-if-conversion2,DASH_fno_if_conversion2)
1990#  AC_CHECK_C_COMPILER_OPT(-foptimize-sibling-calls,DASH_foptimize_sibling_calls)
1991#  AC_CHECK_C_COMPILER_OPT(-fcse-skip-blocks,DASH_fcse_skip_blocks)
1992#  AC_CHECK_C_COMPILER_OPT(-funit-at-a-time,DASH_funit_at_a_time)
1993#  AC_CHECK_C_COMPILER_OPT(-finline-functions,DASH_finline_functions)
1994
1995  if test "$ENABLE_GCC_OPTS" = yes; then
1996    AC_CHECK_C_COMPILER_OPT(-fmodulo-sched,DASH_fmodulo_sched)
1997    AC_CHECK_C_COMPILER_OPT(-freschedule-modulo-scheduled-loops,DASH_freschedule_modulo_scheduled_loops)
1998
1999  fi
2000
2001  # code generation options:
2002  case "$target_os" in
2003
2004     mingw*) # no special code generation options needed by MinGW
2005             ;;
2006
2007    cygwin*) # no special code generation options needed by cygwin
2008             ;;
2009
2010          *) # check for code generation options for other systems
2011             AC_CHECK_C_COMPILER_OPT(-fPIC,DASH_fPIC)
2012             AC_CHECK_C_COMPILER_OPT(-fpic,DASH_fpic)
2013             ;;
2014  esac
2015  AC_CHECK_C_COMPILER_OPT(-fno-common,DASH_fno_common)
2016
2017  # linking options:
2018  case "$target_os" in
2019
2020     mingw*) # no special options needed by MinGW
2021             AC_CHECK_C_COMPILER_OPT(-shared,DASH_shared,$DASH_fPIC$DASH_fpic)
2022             ;;
2023
2024    cygwin*) # no special options needed by cygwin
2025             AC_CHECK_C_COMPILER_OPT(-shared,DASH_shared,$DASH_fPIC$DASH_fpic)
2026             ;;
2027
2028   solaris*) # check for options needed by Solaris
2029             AC_CHECK_C_COMPILER_OPT(-shared,DASH_shared,$DASH_fPIC$DASH_fpic)
2030             ;;
2031
2032      hpux*) # check for options needed by HP-UX
2033             AC_CHECK_C_COMPILER_OPT(-shared,DASH_shared,$DASH_fPIC$DASH_fpic)
2034             ;;
2035
2036    darwin*) # check for special options added by Apple
2037             AC_CHECK_C_COMPILER_OPT(-dynamiclib,DASH_dynamiclib)
2038             AC_CHECK_C_COMPILER_OPT(-bundle,DASH_bundle)
2039             AC_CHECK_C_COMPILER_OPT(-flat_namespace -undefined suppress,DASH_flat_namespace_undefined_suppress)
2040             ;;
2041
2042          *) # for other systems
2043             AC_CHECK_C_COMPILER_OPT(-rdynamic,DASH_rdynamic)
2044             AC_CHECK_C_COMPILER_OPT(-shared,DASH_shared,$DASH_fPIC$DASH_fpic)
2045             ;;
2046  esac
2047
2048  # determine which flags to add to CFLAGS, CXXFLAGS and LDFLAGS
2049  case "$target_os" in
2050    darwin*) # avoid the default C preprocessor which is setup for Objective-C
2051             FLAGS_OBJ_DYN="$FLAGS_OBJ_DYN$DASH_no_cpp_precomp"
2052             ;;
2053  esac
2054
2055  FLAGS_OBJ_DYN="$FLAGS_OBJ_DYN$DASH_Wno_unused"
2056  FLAGS_OBJ_DYN="$FLAGS_OBJ_DYN$DASH_Wno_write_strings"
2057  FLAGS_OBJ_DYN="$FLAGS_OBJ_DYN$DASH_Wdisabled_optimization"
2058
2059  if test "$ENABLE_PROFILE" = yes; then
2060    if test "x$DASH_pg" != x; then
2061      FLAGS_OBJ_DYN_LIB_EXE="$FLAGS_OBJ_DYN_LIB_EXE$DASH_pg"
2062    else
2063      FLAGS_OBJ_DYN_LIB_EXE="$FLAGS_OBJ_DYN_LIB_EXE$DASH_p"
2064    fi
2065  fi
2066
2067  if test "$ENABLE_DEBUG" = yes; then
2068    FLAGS_OPT=""
2069    FLAGS_OPT_RTS=""
2070    FLAGS_OBJ_DYN="$FLAGS_OBJ_DYN$DASH_g$DASH_ftrapv"
2071  else
2072    # TODO: remove the use of -fwrapv once runtime system is cleaned up
2073    FLAGS_OBJ_DYN="$FLAGS_OBJ_DYN$DASH_fwrapv"
2074  fi
2075
2076  if test "$ENABLE_GNU_GCC_NO_STRICT_ALIASING" = yes; then
2077    FLAGS_OBJ_DYN="$FLAGS_OBJ_DYN$DASH_fno_strict_aliasing"
2078  fi
2079
2080  FLAGS_OBJ_DYN="$FLAGS_OBJ_DYN$DASH_fno_trapping_math"
2081  FLAGS_OBJ_DYN="$FLAGS_OBJ_DYN$DASH_fno_math_errno"
2082  FLAGS_OBJ_DYN="$FLAGS_OBJ_DYN$DASH_fschedule_insns2"
2083  FLAGS_OBJ_DYN="$FLAGS_OBJ_DYN$DASH_fno_keep_inline_dllexport"
2084
2085#  if test "$ENABLE_CPLUSPLUS" = yes; then
2086#    FLAGS_OBJ_DYN="$FLAGS_OBJ_DYN$DASH_fpermissive"
2087#  fi
2088
2089# It isn't clear these are useful:
2090#  FLAGS_OBJ_DYN="$FLAGS_OBJ_DYN$DASH_fno_trapping_math$DASH_fno_strict_aliasing$DASH_fwrapv$DASH_ftrapv$DASH_fexpensive_optimizations$DASH_fforce_addr$DASH_fpeephole2$DASH_falign_jumps$DASH_falign_functions$DASH_fno_function_cse$DASH_ftree_copyrename$DASH_ftree_fre$DASH_ftree_dce$DASH_fschedule_interblock$DASH_fregmove$DASH_fgcse_las$DASH_freorder_functions$DASH_fcaller_saves$DASH_fno_if_conversion2$DASH_foptimize_sibling_calls$DASH_fcse_skip_blocks$DASH_funit_at_a_time$DASH_finline_functions"
2091
2092  if test "$ENABLE_GCC_OPTS" = yes; then
2093    FLAGS_OBJ_DYN="$FLAGS_OBJ_DYN$DASH_fmodulo_sched"
2094    FLAGS_OBJ_DYN="$FLAGS_OBJ_DYN$DASH_freschedule_modulo_scheduled_loops"
2095  fi
2096
2097  case "$target_os" in
2098
2099     mingw*) # MinGW's setjmp seems to need the frame pointer
2100             ;;
2101
2102          *) # other systems are fine as far as I can tell
2103             if test "$ENABLE_DEBUG" != yes -a "$ENABLE_PROFILE" != yes; then
2104               FLAGS_OBJ_DYN="$FLAGS_OBJ_DYN$DASH_fomit_frame_pointer"
2105             fi
2106             ;;
2107  esac
2108
2109  if test "$GNU_GCC_IPA_RA_POSSIBLE_BUG" = yes; then
2110    FLAGS_OBJ_DYN="$FLAGS_OBJ_DYN$DASH_fno_ipa_ra"
2111  fi
2112
2113  if test "$GNU_GCC_MOVE_LOOP_INVARIANTS_POSSIBLE_BUG" = yes; then
2114    FLAGS_OBJ_DYN="$FLAGS_OBJ_DYN$DASH_fno_move_loop_invariants"
2115  fi
2116
2117  if test "$ENABLE_FEEDBACK1" = yes -o "$ENABLE_COVERAGE" = yes; then
2118    AC_DEFINE([___DONT_UNLOAD_DYN_CODE],[],[Disable unloading of dynamically loaded code])
2119    FLAGS_OBJ_DYN_LIB_EXE="$FLAGS_OBJ_DYN_LIB_EXE$DASH_fprofile_arcs"
2120    if test "$ENABLE_COVERAGE" = yes; then
2121      FLAGS_OBJ_DYN_LIB_EXE="$FLAGS_OBJ_DYN_LIB_EXE$DASH_ftest_coverage"
2122    fi
2123  fi
2124
2125  if test "$ENABLE_FEEDBACK2" = yes; then
2126    AC_DEFINE([___DONT_UNLOAD_DYN_CODE],[],[Disable unloading of dynamically loaded code])
2127    FLAGS_OBJ_DYN_LIB_EXE="$FLAGS_OBJ_DYN_LIB_EXE$DASH_fbranch_probabilities"
2128  fi
2129
2130  if test "x$DASH_fPIC" != x; then
2131    FLAGS_OBJ_DYN="$FLAGS_OBJ_DYN$DASH_fPIC"
2132  else
2133    FLAGS_OBJ_DYN="$FLAGS_OBJ_DYN$DASH_fpic"
2134  fi
2135
2136  FLAGS_OBJ_DYN="$FLAGS_OBJ_DYN$DASH_fno_common"
2137
2138  FLAGS_OBJ_DYN="$FLAGS_OBJ_DYN$DASH_mieee"
2139  FLAGS_OBJ_DYN="$FLAGS_OBJ_DYN$DASH_mieee_with_inexact"
2140  FLAGS_OBJ_DYN="$FLAGS_OBJ_DYN$DASH_mpc64"
2141
2142  case "$target_os" in
2143
2144    darwin*) # check for special options added by Apple
2145             FLAGS_DYN="$FLAGS_DYN$DASH_bundle"
2146             FLAGS_LIB="$FLAGS_LIB$DASH_dynamiclib -install_name \$(libdir)/\$(LIBRARY)\$(LIB_VERSION_SUFFIX)"
2147             FLAGS_DYN_LIB="$FLAGS_DYN_LIB$DASH_flat_namespace_undefined_suppress"
2148             ;;
2149
2150          *) # for other systems
2151             FLAGS_DYN_LIB="$FLAGS_DYN_LIB$DASH_rdynamic"
2152             FLAGS_DYN_LIB="$FLAGS_DYN_LIB$DASH_shared"
2153             FLAGS_EXE="$FLAGS_EXE$DASH_rdynamic"
2154             ;;
2155  esac
2156
2157else if test "$C_COMP_VISUALC" = yes; then
2158
2159  ########## Microsoft Visual C++ compiler
2160
2161  FLAGS_OPT_LO="-Oityb1"
2162  FLAGS_OPT_HI="-Oityb2"
2163
2164  FLAGS_OPT="$FLAGS_OPT_LO"
2165  FLAGS_OPT_RTS="$FLAGS_OPT_HI"
2166
2167  case "$ENABLE_C_OPT" in
2168
2169     yes) FLAGS_OPT="$FLAGS_OPT_HI"
2170          ;;
2171
2172      no) ;;
2173
2174       *) FLAGS_OPT=" $ENABLE_C_OPT"
2175          ;;
2176
2177  esac
2178
2179  FLAGS_OBJ_DYN_LIB_EXE="$FLAGS_OBJ_DYN_LIB_EXE -nologo -MT -D_CRT_SECURE_NO_DEPRECATE"
2180  FLAGS_DYN="$FLAGS_DYN -LD"
2181
2182#else if test "$C_COMP_WATCOMC" = yes; then
2183#else if test "$C_COMP_BORLANDC" = yes; then
2184
2185else
2186
2187  ########## Need to guess the C compiler from the OS...
2188
2189  case "$target_os" in
2190
2191   solaris*) ########## Probably using the Sun Workshop C/C++ compiler...
2192
2193             # debugging options:
2194             AC_CHECK_C_COMPILER_OPT(-g,DASH_g)
2195
2196             # profiling options:
2197             AC_CHECK_C_COMPILER_OPT(-p,DASH_p)
2198
2199             # optimization options:
2200             AC_CHECK_C_COMPILER_OPT(-xO2,DASH_xO2)
2201
2202             # code generation options:
2203             AC_CHECK_C_COMPILER_OPT(-KPIC,DASH_KPIC)
2204
2205             # linking options:
2206             AC_CHECK_C_COMPILER_OPT(-G,DASH_G)
2207
2208             # determine which flags to add to CFLAGS, CXXFLAGS and LDFLAGS
2209
2210             if test "$ENABLE_DEBUG" = yes; then
2211               FLAGS_OBJ_DYN="$FLAGS_OBJ_DYN$DASH_g"
2212             fi
2213
2214             if test "$ENABLE_PROFILE" = yes; then
2215               FLAGS_OBJ_DYN_LIB_EXE="$FLAGS_OBJ_DYN_LIB_EXE$DASH_p"
2216             fi
2217
2218             if test "$ENABLE_DEBUG" != yes; then
2219               FLAGS_OBJ_DYN="$FLAGS_OBJ_DYN$DASH_xO2"
2220             fi
2221
2222             FLAGS_OBJ_DYN="$FLAGS_OBJ_DYN$DASH_KPIC"
2223
2224             FLAGS_DYN_LIB="$FLAGS_DYN_LIB$DASH_G"
2225             ;;
2226
2227       osf*) ########## Probably using the Compaq Tru64 UNIX C/C++ compiler...
2228
2229             # debugging options:
2230             AC_CHECK_C_COMPILER_OPT(-g,DASH_g)
2231
2232             # profiling options:
2233             AC_CHECK_C_COMPILER_OPT(-p,DASH_p)
2234
2235             # optimization options:
2236             AC_CHECK_C_COMPILER_OPT(-O2,DASH_O2)
2237
2238             # code generation options:
2239             AC_CHECK_C_COMPILER_OPT(-ieee,DASH_ieee)
2240             AC_CHECK_C_COMPILER_OPT(-call_shared,DASH_call_shared)
2241             #AC_CHECK_C_COMPILER_OPT(-taso,DASH_taso)
2242
2243             # linking options:
2244             AC_CHECK_C_COMPILER_OPT(-shared,DASH_shared)
2245             AC_CHECK_C_COMPILER_OPT(-expect_unresolved,DASH_expect_unresolved)
2246
2247             # determine which flags to add to CFLAGS, CXXFLAGS and LDFLAGS
2248
2249             if test "$ENABLE_DEBUG" = yes; then
2250               FLAGS_OBJ_DYN="$FLAGS_OBJ_DYN$DASH_g"
2251             fi
2252
2253             if test "$ENABLE_PROFILE" = yes; then
2254               FLAGS_OBJ_DYN_LIB_EXE="$FLAGS_OBJ_DYN_LIB_EXE$DASH_p"
2255             fi
2256
2257             if test "$ENABLE_DEBUG" != yes; then
2258               FLAGS_OBJ_DYN="$FLAGS_OBJ_DYN$DASH_O2"
2259             fi
2260
2261             FLAGS_OBJ_DYN="$FLAGS_OBJ_DYN$DASH_ieee$DASH_call_shared"
2262
2263             FLAGS_DYN_LIB="$FLAGS_DYN_LIB$DASH_shared$DASH_expect_unresolved"
2264             ;;
2265
2266      irix*) ########## Probably using the MIPSpro C/C++ compiler...
2267
2268             # debugging options:
2269             AC_CHECK_C_COMPILER_OPT(-fullwarn,DASH_fullwarn)
2270             AC_CHECK_C_COMPILER_OPT([-woff 1110,1174,1209,1552,3201],DASH_woff_1110_1174_1209_1552_3201)
2271             AC_CHECK_C_COMPILER_OPT(-g,DASH_g)
2272
2273             # optimization options:
2274             AC_CHECK_C_COMPILER_OPT(-O1,DASH_O1)
2275             AC_CHECK_C_COMPILER_OPT(-OPT:Olimit=0,DASH_OPT_Olimit_0)
2276
2277             # code generation options:
2278             #AC_CHECK_C_COMPILER_OPT(-KPIC,DASH_KPIC)
2279             #AC_CHECK_C_COMPILER_OPT(-non_shared,DASH_non_shared)
2280             AC_CHECK_C_COMPILER_OPT(-TENV:large_GOT,DASH_TENV_large_GOT)
2281             AC_CHECK_C_COMPILER_OPT(-OPT:IEEE_comparisons=ON,DASH_OPT_IEEE_comparisons_ON)
2282             AC_CHECK_C_COMPILER_OPT(-OPT:IEEE_NaN_inf=ON,DASH_OPT_IEEE_NaN_inf_ON)
2283
2284             # linking options:
2285             AC_CHECK_C_COMPILER_OPT(-shared,DASH_shared)
2286
2287             # determine which flags to add to CFLAGS, CXXFLAGS and LDFLAGS
2288
2289             FLAGS_OBJ_DYN="$FLAGS_OBJ_DYN$DASH_fullwarn$DASH_woff_1110_1174_1209_1552_3201"
2290
2291             if test "$ENABLE_DEBUG" = yes; then
2292               FLAGS_OBJ_DYN="$FLAGS_OBJ_DYN$DASH_g"
2293             fi
2294
2295             if test "$ENABLE_DEBUG" != yes; then
2296               FLAGS_OBJ_DYN="$FLAGS_OBJ_DYN$DASH_O1$DASH_OPT_Olimit_0"
2297             fi
2298
2299             FLAGS_OBJ_DYN="$FLAGS_OBJ_DYN$DASH_TENV_large_GOT$DASH_OPT_IEEE_comparisons_ON$DASH_OPT_IEEE_NaN_inf_ON"
2300
2301             FLAGS_DYN_LIB="$FLAGS_DYN_LIB$DASH_shared"
2302             ;;
2303
2304      hpux*) ########## Probably using the HP-UX compiler...
2305
2306             # debugging options:
2307             AC_CHECK_C_COMPILER_OPT(-g,DASH_g)
2308
2309             # profiling options:
2310             AC_CHECK_C_COMPILER_OPT(-p,DASH_p)
2311
2312             # optimization options:
2313             AC_CHECK_C_COMPILER_OPT(-O1,DASH_O1)
2314
2315             # linking options:
2316             AC_CHECK_C_COMPILER_OPT(-b,DASH_b)
2317
2318             # determine which flags to add to CFLAGS, CXXFLAGS and LDFLAGS
2319
2320             if test "$ENABLE_DEBUG" = yes; then
2321               FLAGS_OBJ_DYN="$FLAGS_OBJ_DYN$DASH_g"
2322             fi
2323
2324             if test "$ENABLE_PROFILE" = yes; then
2325               FLAGS_OBJ_DYN_LIB_EXE="$FLAGS_OBJ_DYN_LIB_EXE$DASH_p"
2326             fi
2327
2328             if test "$ENABLE_DEBUG" != yes; then
2329               FLAGS_OBJ_DYN="$FLAGS_OBJ_DYN$DASH_O1"
2330             fi
2331
2332             FLAGS_DYN_LIB="$FLAGS_DYN_LIB$DASH_b"
2333             ;;
2334
2335       aix*) ########## Probably using the AIX xlC compiler...
2336
2337             # debugging options:
2338             AC_CHECK_C_COMPILER_OPT(-g,DASH_g)
2339
2340             # profiling options:
2341             AC_CHECK_C_COMPILER_OPT(-p,DASH_p)
2342
2343             # optimization options:
2344             AC_CHECK_C_COMPILER_OPT(-O1,DASH_O1)
2345
2346             # linking options:
2347             AC_CHECK_C_COMPILER_OPT(-G,DASH_G)
2348
2349             # determine which flags to add to CFLAGS, CXXFLAGS and LDFLAGS
2350
2351             if test "$ENABLE_DEBUG" = yes; then
2352               FLAGS_OBJ_DYN="$FLAGS_OBJ_DYN$DASH_g"
2353             fi
2354
2355             if test "$ENABLE_PROFILE" = yes; then
2356               FLAGS_OBJ_DYN_LIB_EXE="$FLAGS_OBJ_DYN_LIB_EXE$DASH_p"
2357             fi
2358
2359             if test "$ENABLE_DEBUG" != yes; then
2360               FLAGS_OBJ_DYN="$FLAGS_OBJ_DYN$DASH_O1"
2361             fi
2362
2363             FLAGS_DYN_LIB="$FLAGS_DYN_LIB$DASH_G"
2364             ;;
2365
2366          *) ########## Unsupported operating system
2367
2368             AC_MSG_NOTICE([
2369*********************************************************************
2370***                                                               ***
2371*** The GCC compiler is not being used and the operating system   ***
2372*** is not one that has been tested with the Gambit system.       ***
2373*** The configure script will use certain compiler options that   ***
2374*** may not be correct or sufficient for compiling the system.    ***
2375*** Please report success or failure to gambit@iro.umontreal.ca.  ***
2376*** This will help us support this operating system in the        ***
2377*** future.                                                       ***
2378***                                                               ***
2379*********************************************************************
2380])
2381
2382             # debugging options:
2383             AC_CHECK_C_COMPILER_OPT(-g,DASH_g)
2384
2385             # profiling options:
2386             AC_CHECK_C_COMPILER_OPT(-p,DASH_p)
2387
2388             # optimization options:
2389             AC_CHECK_C_COMPILER_OPT(-O1,DASH_O1)
2390
2391             # linking options:
2392             AC_CHECK_C_COMPILER_OPT(-shared,DASH_shared)
2393
2394             # determine which flags to add to CFLAGS, CXXFLAGS and LDFLAGS
2395
2396             if test "$ENABLE_DEBUG" = yes; then
2397               FLAGS_OBJ_DYN="$FLAGS_OBJ_DYN$DASH_g"
2398             fi
2399
2400             if test "$ENABLE_PROFILE" = yes; then
2401               FLAGS_OBJ_DYN_LIB_EXE="$FLAGS_OBJ_DYN_LIB_EXE$DASH_p"
2402             fi
2403
2404             if test "$ENABLE_DEBUG" != yes; then
2405               FLAGS_OBJ_DYN="$FLAGS_OBJ_DYN$DASH_O1"
2406             fi
2407
2408             FLAGS_DYN_LIB="$FLAGS_DYN_LIB$DASH_shared"
2409             ;;
2410  esac
2411
2412fi
2413fi
2414
2415if test "$ENABLE_CPLUSPLUS" = yes; then
2416  CORCXXFLAGS="$CXXFLAGS"
2417else
2418  CORCXXFLAGS="$CFLAGS"
2419fi
2420
2421FLAGS_OBJ="$CORCXXFLAGS $FLAGS_OBJ $FLAGS_OBJ_DYN $FLAGS_OBJ_DYN_LIB_EXE"
2422FLAGS_DYN="$LDFLAGS $CORCXXFLAGS $FLAGS_DYN $FLAGS_OBJ_DYN $FLAGS_OBJ_DYN_LIB_EXE $FLAGS_DYN_LIB"
2423FLAGS_LIB="$LDFLAGS $CORCXXFLAGS $FLAGS_LIB $FLAGS_OBJ_DYN_LIB_EXE $FLAGS_DYN_LIB"
2424#FLAGS_EXE="$LDFLAGS $CORCXXFLAGS $FLAGS_EXE $FLAGS_OBJ_DYN_LIB_EXE"
2425FLAGS_EXE="$LDFLAGS $FLAGS_OBJ $FLAGS_EXE"
2426
2427DEFS_OBJ="$DEFS_OBJ_DYN_LIB_EXE $DEFS_OBJ"
2428DEFS_DYN="$DEFS_OBJ_DYN_LIB_EXE $DEFS_DYN"
2429DEFS_LIB="$DEFS_OBJ_DYN_LIB_EXE $DEFS_LIB"
2430DEFS_EXE="$DEFS_OBJ_DYN_LIB_EXE $DEFS_EXE"
2431
2432AC_SUBST(FLAGS_OBJ)
2433AC_SUBST(FLAGS_DYN)
2434AC_SUBST(FLAGS_LIB)
2435AC_SUBST(FLAGS_EXE)
2436AC_SUBST(FLAGS_OPT)
2437AC_SUBST(FLAGS_OPT_RTS)
2438AC_SUBST(DEFS_OBJ)
2439AC_SUBST(DEFS_DYN)
2440AC_SUBST(DEFS_LIB)
2441AC_SUBST(DEFS_EXE)
2442
2443AC_SUBST(FLAGS_OBJ_MF)
2444AC_SUBST(FLAGS_DYN_MF)
2445AC_SUBST(FLAGS_LIB_MF)
2446AC_SUBST(FLAGS_EXE_MF)
2447AC_SUBST(FLAGS_OPT_MF)
2448AC_SUBST(FLAGS_OPT_RTS_MF)
2449AC_SUBST(DEFS_OBJ_MF)
2450AC_SUBST(DEFS_DYN_MF)
2451AC_SUBST(DEFS_LIB_MF)
2452AC_SUBST(DEFS_EXE_MF)
2453
2454AC_SUBST(FLAGS_OBJ_SH)
2455AC_SUBST(FLAGS_DYN_SH)
2456AC_SUBST(FLAGS_LIB_SH)
2457AC_SUBST(FLAGS_EXE_SH)
2458AC_SUBST(FLAGS_OPT_SH)
2459AC_SUBST(FLAGS_OPT_RTS_SH)
2460AC_SUBST(DEFS_OBJ_SH)
2461AC_SUBST(DEFS_DYN_SH)
2462AC_SUBST(DEFS_LIB_SH)
2463AC_SUBST(DEFS_EXE_SH)
2464
2465AC_SUBST(FLAGS_OBJ_BAT)
2466AC_SUBST(FLAGS_DYN_BAT)
2467AC_SUBST(FLAGS_LIB_BAT)
2468AC_SUBST(FLAGS_EXE_BAT)
2469AC_SUBST(FLAGS_OPT_BAT)
2470AC_SUBST(FLAGS_OPT_RTS_BAT)
2471AC_SUBST(DEFS_OBJ_BAT)
2472AC_SUBST(DEFS_DYN_BAT)
2473AC_SUBST(DEFS_LIB_BAT)
2474AC_SUBST(DEFS_EXE_BAT)
2475
2476###############################################################################
2477
2478AC_SUBST(RTLIBSUBSYS)
2479
2480###############################################################################
2481
2482AC_PATH_XTRA
2483
2484
2485#AC_SYS_INTERPRETER
2486#AC_SYS_LARGEFILE
2487#AC_SYS_POSIX_TERMIOS
2488
2489AC_PROG_LN_S
2490AC_PROG_RANLIB
2491
2492AN_MAKEVAR([AR], [AC_PROG_AR])
2493AN_PROGRAM([ar], [AC_PROG_AR])
2494AC_DEFUN([AC_PROG_AR], [AC_CHECK_TOOL([AR], [ar], [ar])])
2495AC_PROG_AR
2496
2497RC="git"
2498GIT="git"
2499HG="hg"
2500
2501exe="$EXEEXT"
2502obj=".$OBJEXT"
2503
2504case "$target_os" in
2505
2506   mingw*) bat=".bat"
2507           ;;
2508
2509        *) bat=""
2510           ;;
2511esac
2512
2513LIB_VERSION_SUFFIX=""
2514LIB_MAJOR_VERSION_SUFFIX=""
2515
2516AC_SUBST(LIB_VERSION_SUFFIX)
2517AC_SUBST(LIB_MAJOR_VERSION_SUFFIX)
2518
2519if test "$ENABLE_SHARED" = yes; then
2520
2521  case "$target_os" in
2522
2523     mingw* | cygwin*)
2524             LIB_PREFIX="lib"
2525             LIB_EXTENSION=".dll"
2526             SETDLPATH="PATH=\"\$(rootfromhere)/lib:\$(rootfromhere)/gsi:\$(rootfromhere)/gsc:\${PATH}\""
2527             SETDLPATHBOOT="PATH=\"\$(rootfromhere):\${PATH}\""
2528             ;;
2529
2530    darwin*) LIB_PREFIX="lib"
2531             LIB_EXTENSION=".dylib"
2532             SETDLPATH="DYLD_LIBRARY_PATH=\$(rootfromhere)/lib:\$(rootfromhere)/gsi:\$(rootfromhere)/gsc:\${DYLD_LIBRARY_PATH}"
2533             SETDLPATHBOOT="DYLD_LIBRARY_PATH=\$(rootfromhere):\${DYLD_LIBRARY_PATH}"
2534             ;;
2535
2536      hpux*) LIB_PREFIX="lib"
2537             LIB_EXTENSION=".so"
2538             SETDLPATH="SHLIB_PATH=\$(rootfromhere)/lib:\$(rootfromhere)/gsi:\$(rootfromhere)/gsc:\${SHLIB_PATH}"
2539             SETDLPATHBOOT="SHLIB_PATH=\$(rootfromhere):\${SHLIB_PATH}"
2540             ;;
2541
2542       aix*) LIB_PREFIX="lib"
2543             LIB_EXTENSION=".so"
2544             SETDLPATH="LIBPATH=\$(rootfromhere)/lib:\$(rootfromhere)/gsi:\$(rootfromhere)/gsc:\${LIBPATH}"
2545             SETDLPATHBOOT="LIBPATH=\$(rootfromhere):\${LIBPATH}"
2546             ;;
2547
2548          *) LIB_PREFIX="lib"
2549             LIB_EXTENSION=".so"
2550             SETDLPATH="LD_LIBRARY_PATH=\$(rootfromhere)/lib:\$(rootfromhere)/gsi:\$(rootfromhere)/gsc:\${LD_LIBRARY_PATH}"
2551             SETDLPATHBOOT="LD_LIBRARY_PATH=\$(rootfromhere):\${LD_LIBRARY_PATH}"
2552
2553             if test "$ENABLE_VERSIONED_SHARED_LIBS" = yes; then
2554               LIB_VERSION_SUFFIX=".`echo $PACKAGE_VERSION | sed -e 's/v//g'`"
2555               LIB_MAJOR_VERSION_SUFFIX=".`echo $PACKAGE_VERSION | sed -e 's/v//g' -e 's/\\.[[^.]]*\\.[[^.]]*//g'`"
2556             fi
2557
2558             FLAGS_LIB="$FLAGS_LIB -Wl,-soname,\$(LIBRARY)\$(LIB_MAJOR_VERSION_SUFFIX)"
2559             ;;
2560  esac
2561
2562  MAKE_LIBRARY='$(C_COMPILER) $(FLAGS_LIB) -o $(LIBRARY)$(LIB_VERSION_SUFFIX) $(LIBRARY_OBJECTS) $(MAKE_LIBRARY_LIBS) $(LIBS)'
2563  MAKE_LIBRARY_FOR_INSTALL='$(C_COMPILER) $(FLAGS_LIB) -o $(LIBRARY)$(LIB_VERSION_SUFFIX) $(LIBRARY_OBJECTS) $(MAKE_LIBRARY_FOR_INSTALL_LIBS) $(LIBS)'
2564  FIXLIB=':'
2565  LINK_FOR_INSTALL='$(C_COMPILER) $(FLAGS_EXE) $(EXECUTABLE_OBJECTS) $(LINK_FOR_INSTALL_LIBS) $(LIBS) -o $(EXECUTABLE)'
2566
2567else
2568
2569  SETDLPATH=""
2570  SETDLPATHBOOT=""
2571
2572  if test "$C_COMP_VISUALC" = yes; then
2573
2574    ########## Microsoft Visual C++ compiler
2575
2576    LIB_PREFIX="lib"
2577    LIB_EXTENSION=".lib"
2578    MAKE_LIBRARY='lib -out:$(LIBRARY)$(LIB_VERSION_SUFFIX) $(LIBRARY_OBJECTS)'
2579    MAKE_LIBRARY_FOR_INSTALL=':'
2580    FIXLIB=':'
2581    LINK_FOR_INSTALL=':'
2582
2583#  else if test "$C_COMP_WATCOMC" = yes; then
2584#  else if test "$C_COMP_BORLANDC" = yes; then
2585
2586  else
2587
2588    ########## Other C compiler
2589
2590    LIB_PREFIX="lib"
2591    LIB_EXTENSION=".a"
2592    MAKE_LIBRARY='$(AR) rc $(LIBRARY)$(LIB_VERSION_SUFFIX) $(LIBRARY_OBJECTS) && $(RANLIB) $(LIBRARY)$(LIB_VERSION_SUFFIX)'
2593    MAKE_LIBRARY_FOR_INSTALL=':'
2594    FIXLIB='$(RANLIB)'
2595    LINK_FOR_INSTALL=':'
2596
2597  fi
2598
2599fi
2600
2601GAMBITLIB="gambit$LIB_SUFFIX"
2602GAMBITGSCLIB="gambitgsc$LIB_SUFFIX"
2603GAMBITGSILIB="gambitgsi$LIB_SUFFIX"
2604
2605if test "yes" = yes; then
2606
2607  GAMBITLIB_LOC=""
2608  GAMBITLIB_LINK="\"\${GAMBITDIR_LIB}/$LIB_PREFIX$GAMBITLIB$LIB_EXTENSION$LIB_VERSION_SUFFIX\""
2609
2610  GAMBITGSILIB_LOC=""
2611  GAMBITGSILIB_LINK="\"\${GAMBITDIR_LIB_GSI}/$LIB_PREFIX$GAMBITGSILIB$LIB_EXTENSION$LIB_VERSION_SUFFIX\" \"\${GAMBITDIR_LIB}/$LIB_PREFIX$GAMBITLIB$LIB_EXTENSION$LIB_VERSION_SUFFIX\""
2612
2613  GAMBITGSCLIB_LOC=""
2614  GAMBITGSCLIB_LINK="\"\${GAMBITDIR_LIB_GSC}/$LIB_PREFIX$GAMBITGSCLIB$LIB_EXTENSION$LIB_VERSION_SUFFIX\" \"\${GAMBITDIR_LIB}/$LIB_PREFIX$GAMBITLIB$LIB_EXTENSION$LIB_VERSION_SUFFIX\""
2615
2616else
2617
2618  GAMBITLIB_LOC="-L\"\${GAMBITDIR_LIB}\""
2619  GAMBITLIB_LINK="-l$GAMBITLIB"
2620
2621  GAMBITGSILIB_LOC="-L\"\${GAMBITDIR_LIB_GSI}\" -L\"\${GAMBITDIR_LIB}\""
2622  GAMBITGSILIB_LINK="-l$GAMBITGSILIB -l$GAMBITLIB"
2623
2624  GAMBITGSCLIB_LOC="-L\"\${GAMBITDIR_LIB_GSC}\" -L\"\${GAMBITDIR_LIB}\""
2625  GAMBITGSCLIB_LINK="-l$GAMBITGSCLIB -l$GAMBITLIB"
2626
2627fi
2628
2629if test "$C_COMP_VISUALC" = yes; then
2630
2631  ########## Microsoft Visual C++ compiler
2632
2633  BUILD_OBJ_RTS="\${C_COMPILER} \${FLAGS_OPT_RTS} \${FLAGS_OBJ} \${DEFS_OBJ} -I\"\${GAMBITDIR_INCLUDE}\" -c -Fo\"\${BUILD_OBJ_OUTPUT_FILENAME}\" \${BUILD_OBJ_CC_OPTIONS} \${BUILD_OBJ_INPUT_FILENAMES}"
2634
2635  BUILD_OBJ="\${C_COMPILER} \${FLAGS_OPT} \${FLAGS_OBJ} \${DEFS_OBJ} -I\"\${GAMBITDIR_INCLUDE}\" -c -Fo\"\${BUILD_OBJ_OUTPUT_FILENAME}\" \${BUILD_OBJ_CC_OPTIONS} \${BUILD_OBJ_INPUT_FILENAMES}"
2636
2637  BUILD_DYN="\${C_COMPILER} \${FLAGS_OPT} \${FLAGS_DYN} \${DEFS_DYN} -I\"\${GAMBITDIR_INCLUDE}\" -Fe\"\${BUILD_DYN_OUTPUT_FILENAME}\" \${BUILD_DYN_CC_OPTIONS} \${BUILD_DYN_LD_OPTIONS_PRELUDE} \${BUILD_DYN_INPUT_FILENAMES} \${BUILD_DYN_LD_OPTIONS}"
2638
2639  BUILD_LIB="echo BUILD_LIB not yet implemented"
2640
2641  if test "$ac_cv_sizeof_voidp" = 8; then
2642    # 64 bit environment
2643    SUBSYS_MIN_REQ_VERSION="5.02"
2644  else
2645    # 32 bit environment
2646    SUBSYS_MIN_REQ_VERSION="5.01"
2647  fi
2648
2649  BUILD_EXE="\${C_COMPILER} \${FLAGS_EXE} \${DEFS_EXE} -I\"\${GAMBITDIR_INCLUDE}\" ${GAMBITLIB_LOC} -Fe\"\${BUILD_EXE_OUTPUT_FILENAME}\" \${BUILD_EXE_CC_OPTIONS} \${BUILD_EXE_LD_OPTIONS_PRELUDE} \${BUILD_EXE_INPUT_FILENAMES} ${GAMBITLIB_LINK} \${LIBS} \${BUILD_EXE_LD_OPTIONS} -link -subsystem:console,${SUBSYS_MIN_REQ_VERSION} -entry:WinMainCRTStartup"
2650
2651else
2652
2653  BUILD_OBJ_RTS="\${C_COMPILER} \${FLAGS_OPT_RTS} \${FLAGS_OBJ} \${DEFS_OBJ} -I\"\${GAMBITDIR_INCLUDE}\" -c -o \"\${BUILD_OBJ_OUTPUT_FILENAME}\" \${BUILD_OBJ_CC_OPTIONS} \${BUILD_OBJ_INPUT_FILENAMES}"
2654
2655  BUILD_OBJ="\${C_COMPILER} \${FLAGS_OPT} \${FLAGS_OBJ} \${DEFS_OBJ} -I\"\${GAMBITDIR_INCLUDE}\" -c -o \"\${BUILD_OBJ_OUTPUT_FILENAME}\" \${BUILD_OBJ_CC_OPTIONS} \${BUILD_OBJ_INPUT_FILENAMES}"
2656
2657  BUILD_DYN="\${C_COMPILER} \${FLAGS_OPT} \${FLAGS_DYN} \${DEFS_DYN} -I\"\${GAMBITDIR_INCLUDE}\" -o \"\${BUILD_DYN_OUTPUT_FILENAME}\" \${BUILD_DYN_CC_OPTIONS} \${BUILD_DYN_LD_OPTIONS_PRELUDE} \${BUILD_DYN_INPUT_FILENAMES} \${BUILD_DYN_LD_OPTIONS}"
2658
2659  BUILD_LIB="echo BUILD_LIB not yet implemented"
2660
2661  BUILD_EXE="\${C_COMPILER} \${FLAGS_EXE} \${DEFS_EXE} -I\"\${GAMBITDIR_INCLUDE}\" ${GAMBITLIB_LOC} -o \"\${BUILD_EXE_OUTPUT_FILENAME}\" \${BUILD_EXE_CC_OPTIONS} \${BUILD_EXE_LD_OPTIONS_PRELUDE} \${BUILD_EXE_INPUT_FILENAMES} ${GAMBITLIB_LINK} \${LIBS} \${BUILD_EXE_LD_OPTIONS}"
2662
2663fi
2664
2665# The following code for making installed libraries may benefit from
2666# a rewrite so that it reuses the "BUILD_XXX" command infrastructure.
2667
2668if test "$ENABLE_ABSOLUTE_SHARED_LIBS" = yes; then
2669
2670  MAKE_LIBRARY_FOR_INSTALL_LIBS='$$t_libdir/$(LIB_PREFIX)$(GAMBITLIB)$(LIB_EXTENSION)$(LIB_VERSION_SUFFIX)'
2671  LINK_FOR_INSTALL_GSI_LIBS='$$t_libdir/$(LIB_PREFIX)$(GAMBITGSILIB)$(LIB_EXTENSION)$(LIB_VERSION_SUFFIX) $$t_libdir/$(LIB_PREFIX)$(GAMBITLIB)$(LIB_EXTENSION)$(LIB_VERSION_SUFFIX)'
2672  LINK_FOR_INSTALL_GSC_LIBS='$$t_libdir/$(LIB_PREFIX)$(GAMBITGSCLIB)$(LIB_EXTENSION)$(LIB_VERSION_SUFFIX) $$t_libdir/$(LIB_PREFIX)$(GAMBITLIB)$(LIB_EXTENSION)$(LIB_VERSION_SUFFIX)'
2673
2674else
2675
2676  MAKE_LIBRARY_FOR_INSTALL_LIBS='-L$(rootfromhere)/lib -l$(GAMBITLIB)'
2677  LINK_FOR_INSTALL_GSI_LIBS='-L. -L$(rootfromhere)/lib -l$(GAMBITGSILIB) -l$(GAMBITLIB)'
2678  LINK_FOR_INSTALL_GSC_LIBS='-L. -L$(rootfromhere)/lib -l$(GAMBITGSCLIB) -l$(GAMBITLIB)'
2679
2680fi
2681
2682###############################################################################
2683#
2684# Determine what prefix and suffix are added to function names by the
2685# C compiler or linker.
2686
2687case "$target_os" in
2688
2689   mingw*) # empty prefix and suffix
2690           ;;
2691
2692  cygwin*) # empty prefix and suffix
2693           ;;
2694
2695        *) # for other systems
2696
2697           ac_link_obj_file='$C_COMPILER $FLAGS_DYN $DEFS_DYN -Iinclude -o conftest.o1 conftest.$ac_ext >&5'
2698
2699           rm -f conftest.$ac_ext conftest.o1 conftest1.sed
2700
2701           cat >conftest.$ac_ext <<_ACEOF
2702#line $LINENO "configure"
2703#define ___VERSION 400000
2704#define ___MODULE_NAME " GAMBITCHECKMODULEPREFIXSUFFIX"
2705#define ___LINKER_ID ____20_GAMBITCHECKMODULEPREFIXSUFFIX
2706#define ___MH_PROC ___H__20_GAMBITCHECKMODULEPREFIXSUFFIX
2707#define ___SCRIPT_LINE 0
2708#define ___MAX_CHR 0x10ffff
2709#define ___VOIDSTAR_WIDTH ___LONG_WIDTH
2710#include "gambit.h.in"
2711
2712___BEGIN_MOD1
2713___END_MOD1
2714___BEGIN_MOD2
2715___END_MOD2
2716_ACEOF
2717
2718           if { (eval echo "$as_me:$LINENO: \"$ac_link_obj_file\"") >&5
2719             (eval $ac_link_obj_file) 2>&5
2720             ac_status=$?
2721             echo "$as_me:$LINENO: \$? = $ac_status" >&5
2722             (exit $ac_status); }; then
2723
2724             cat >conftest1.sed <<_ACEOF
2725/^.* \([[a-zA-Z0-9_$]]*\)____20_GAMBITCHECKMODULEPREFIXSUFFIX\([[a-zA-Z0-9_$]]*\)$/s//#define ___IMPORTED_ID_PREFIX "\1"\\
2726#define ___IMPORTED_ID_SUFFIX "\2"/p
2727_ACEOF
2728
2729             # The nm program will extract the symbols in the object file
2730             # conftest.o1.  The following option is used:
2731             #   -g    shows the external symbols only (to avoid confusion with
2732             #         internal symbols generated by the compiler)
2733             nm -g conftest.o1 | sed -n -f conftest1.sed | sed -n -e "1,2p" >>confdefs.h
2734
2735           fi
2736           ;;
2737esac
2738
2739###############################################################################
2740#
2741# Determine where the installation directories are located.
2742
2743if test "$prefix" = NONE; then
2744  prefix="${ac_default_prefix}"
2745fi
2746
2747if test "$ENABLE_MULTIPLE_VERSIONS" = yes; then
2748  prefix="${prefix}/$PACKAGE_VERSION"
2749fi
2750
2751if test "$bindir" = "\${exec_prefix}/bin"; then
2752  bindir="\${prefix}/bin"
2753fi
2754
2755if test "$includedir" = "\${prefix}/include"; then
2756  includedir="\${prefix}/include"
2757fi
2758
2759if test "$libdir" = "\${exec_prefix}/lib"; then
2760  libdir="\${prefix}/lib"
2761fi
2762
2763if test "$docdir" = "\${datarootdir}/doc/\${PACKAGE_TARNAME}"; then
2764  docdir="\${prefix}/doc"
2765fi
2766
2767if test "$infodir" = "\${datarootdir}/info"; then
2768  infodir="\${prefix}/info"
2769fi
2770
2771if test "$datadir" = "\${datarootdir}"; then
2772  datadir="\${prefix}/share"
2773fi
2774
2775GAMBITLIB_DEFS="$GAMBITLIB_DEFS -D___GAMBITDIR=\"\\\"`echo \"$prefix\" | sed -e \"s|/|$PATH_SEP|g\"`\\\"\""
2776
2777GAMBITLIB_DEFS="$GAMBITLIB_DEFS -D___GAMBITDIR_USERLIB=\"\\\"`echo \"$userlibdir\" | sed -e \"s|/|$PATH_SEP|g\"`\\\"\""
2778
2779if test "$ENABLE_SYMLINKS" != yes; then
2780
2781  if test "$bindir" != "\${prefix}/bin"; then
2782    GAMBITLIB_DEFS="$GAMBITLIB_DEFS -D___GAMBITDIR_BIN=\"\\\"`echo \"$bindir\" | sed -e \"s|/|$PATH_SEP|g\"`\\\"\""
2783  fi
2784
2785  if test "$includedir" != "\${prefix}/include"; then
2786    GAMBITLIB_DEFS="$GAMBITLIB_DEFS -D___GAMBITDIR_INCLUDE=\"\\\"`echo \"$includedir\" | sed -e \"s|/|$PATH_SEP|g\"`\\\"\""
2787  fi
2788
2789  if test "$libdir" != "\${prefix}/lib"; then
2790    GAMBITLIB_DEFS="$GAMBITLIB_DEFS -D___GAMBITDIR_LIB=\"\\\"`echo \"$libdir\" | sed -e \"s|/|$PATH_SEP|g\"`\\\"\""
2791  fi
2792
2793  if test "$docdir" != "\${prefix}/doc"; then
2794    GAMBITLIB_DEFS="$GAMBITLIB_DEFS -D___GAMBITDIR_DOC=\"\\\"`echo \"$docdir\" | sed -e \"s|/|$PATH_SEP|g\"`\\\"\""
2795  fi
2796
2797  if test "$infodir" != "\${prefix}/info"; then
2798    GAMBITLIB_DEFS="$GAMBITLIB_DEFS -D___GAMBITDIR_INFO=\"\\\"`echo \"$infodir\" | sed -e \"s|/|$PATH_SEP|g\"`\\\"\""
2799  fi
2800
2801  if test "$datadir" != "\${prefix}/share"; then
2802    GAMBITLIB_DEFS="$GAMBITLIB_DEFS -D___GAMBITDIR_SHARE=\"\\\"`echo \"$datadir\" | sed -e \"s|/|$PATH_SEP|g\"`\\\"\""
2803  fi
2804
2805fi
2806
2807emacsdir="\${datadir}/emacs/site-lisp"
2808
2809OBJ_EXTENSION="$obj"
2810EXE_EXTENSION="$exe"
2811BAT_EXTENSION="$bat"
2812
2813CONFIGURE_COMMAND="$0$ac_configure_args"
2814AC_SUBST(CONFIGURE_COMMAND)
2815
2816GAMBITLIB_DEFS="$GAMBITLIB_DEFS -D___SYS_TYPE_CPU=\"\\\"$target_cpu\\\"\""
2817GAMBITLIB_DEFS="$GAMBITLIB_DEFS -D___SYS_TYPE_VENDOR=\"\\\"$target_vendor\\\"\""
2818GAMBITLIB_DEFS="$GAMBITLIB_DEFS -D___SYS_TYPE_OS=\"\\\"$target_os\\\"\""
2819GAMBITLIB_DEFS="$GAMBITLIB_DEFS -D___CONFIGURE_COMMAND=\"\\\"`echo "$CONFIGURE_COMMAND" | sed -e s/\\\\\\\\/\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\/g -e s/\\\\\\\"/\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"/g`\"\\\""
2820GAMBITLIB_DEFS="$GAMBITLIB_DEFS -D___OBJ_EXTENSION=\"\\\"$OBJ_EXTENSION\\\"\""
2821GAMBITLIB_DEFS="$GAMBITLIB_DEFS -D___EXE_EXTENSION=\"\\\"$EXE_EXTENSION\\\"\""
2822GAMBITLIB_DEFS="$GAMBITLIB_DEFS -D___BAT_EXTENSION=\"\\\"$BAT_EXTENSION\\\"\""
2823
2824###############################################################################
2825
2826# Escape strings before substitution.
2827
2828ESC_MF="sed -e s/\\\\\\\$/\\\$\\\$/g"
2829ESC_SH="sed -e s/\\\\/\\\\\\\\\\\\\\\\/g -e s/\\\"/\\\\\\\"/g -e s/\\\$/\\\\\\\$/g -e s/^/\"/ -e s/$/\"/"
2830ESC_ECHO="sed -e s/\\\\/\\\\\\\\\\\\\\\\/g -e s/\\\"/\\\\\\\"/g -e s/^/\"/ -e s/$/\"/"
2831ESC_BAT="sed -e s/\${/%%/g -e s/}/%%/g"
2832ESC_ECHO_BAT="sed -e s/\${/%/g -e s/}/%/g"
2833
2834C_COMPILER_MF=`echo "$C_COMPILER" | $ESC_MF`
2835C_PREPROC_MF=`echo "$C_PREPROC" | $ESC_MF`
2836
2837FLAGS_OBJ_MF=`echo "$FLAGS_OBJ" | $ESC_MF`
2838FLAGS_DYN_MF=`echo "$FLAGS_DYN" | $ESC_MF`
2839FLAGS_LIB_MF=`echo "$FLAGS_LIB" | $ESC_MF`
2840FLAGS_EXE_MF=`echo "$FLAGS_EXE" | $ESC_MF`
2841
2842FLAGS_OPT_MF=`echo "$FLAGS_OPT" | $ESC_MF`
2843FLAGS_OPT_RTS_MF=`echo "$FLAGS_OPT_RTS" | $ESC_MF`
2844
2845DEFS_OBJ_MF=`echo "$DEFS_OBJ" | $ESC_MF`
2846DEFS_DYN_MF=`echo "$DEFS_DYN" | $ESC_MF`
2847DEFS_LIB_MF=`echo "$DEFS_LIB" | $ESC_MF`
2848DEFS_EXE_MF=`echo "$DEFS_EXE" | $ESC_MF`
2849
2850BUILD_OBJ_RTS_MF=`echo "$BUILD_OBJ_RTS" | $ESC_MF`
2851BUILD_OBJ_MF=`echo "$BUILD_OBJ" | $ESC_MF`
2852BUILD_DYN_MF=`echo "$BUILD_DYN" | $ESC_MF`
2853BUILD_LIB_MF=`echo "$BUILD_LIB" | $ESC_MF`
2854BUILD_EXE_MF=`echo "$BUILD_EXE" | $ESC_MF`
2855
2856DEFS_MF=`echo "$DEFS" | $ESC_MF`
2857LIBS_MF=`echo "$LIBS" | $ESC_MF`
2858GAMBITLIB_DEFS_MF=`echo "$GAMBITLIB_DEFS" | $ESC_MF`
2859GAMBITLIB_MF=`echo "$GAMBITLIB" | $ESC_MF`
2860GAMBITGSCLIB_MF=`echo "$GAMBITGSCLIB" | $ESC_MF`
2861GAMBITGSILIB_MF=`echo "$GAMBITGSILIB" | $ESC_MF`
2862LIB_PREFIX_MF=`echo "$LIB_PREFIX" | $ESC_MF`
2863LIB_EXTENSION_MF=`echo "$LIB_EXTENSION" | $ESC_MF`
2864OBJ_EXTENSION_MF=`echo "$OBJ_EXTENSION" | $ESC_MF`
2865EXE_EXTENSION_MF=`echo "$EXE_EXTENSION" | $ESC_MF`
2866BAT_EXTENSION_MF=`echo "$BAT_EXTENSION" | $ESC_MF`
2867
2868C_COMPILER_SH=`echo "$C_COMPILER" | $ESC_SH`
2869C_PREPROC_SH=`echo "$C_PREPROC" | $ESC_SH`
2870
2871FLAGS_OBJ_SH=`echo "$FLAGS_OBJ" | $ESC_SH`
2872FLAGS_DYN_SH=`echo "$FLAGS_DYN" | $ESC_SH`
2873FLAGS_LIB_SH=`echo "$FLAGS_LIB" | $ESC_SH`
2874FLAGS_EXE_SH=`echo "$FLAGS_EXE" | $ESC_SH`
2875
2876FLAGS_OPT_SH=`echo "$FLAGS_OPT" | $ESC_SH`
2877FLAGS_OPT_RTS_SH=`echo "$FLAGS_OPT_RTS" | $ESC_SH`
2878
2879DEFS_OBJ_SH=`echo "$DEFS_OBJ" | $ESC_SH`
2880DEFS_DYN_SH=`echo "$DEFS_DYN" | $ESC_SH`
2881DEFS_LIB_SH=`echo "$DEFS_LIB" | $ESC_SH`
2882DEFS_EXE_SH=`echo "$DEFS_EXE" | $ESC_SH`
2883
2884BUILD_OBJ_RTS_SH=`echo "$BUILD_OBJ_RTS" | $ESC_SH`
2885BUILD_OBJ_SH=`echo "$BUILD_OBJ" | $ESC_SH`
2886BUILD_DYN_SH=`echo "$BUILD_DYN" | $ESC_SH`
2887BUILD_LIB_SH=`echo "$BUILD_LIB" | $ESC_SH`
2888BUILD_EXE_SH=`echo "$BUILD_EXE" | $ESC_SH`
2889
2890DEFS_SH=`echo "$DEFS" | $ESC_SH`
2891LIBS_SH=`echo "$LIBS" | $ESC_SH`
2892GAMBITLIB_DEFS_SH=`echo "$GAMBITLIB_DEFS" | $ESC_SH`
2893GAMBITLIB_SH=`echo "$GAMBITLIB" | $ESC_SH`
2894GAMBITGSCLIB_SH=`echo "$GAMBITGSCLIB" | $ESC_SH`
2895GAMBITGSILIB_SH=`echo "$GAMBITGSILIB" | $ESC_SH`
2896LIB_PREFIX_SH=`echo "$LIB_PREFIX" | $ESC_SH`
2897LIB_EXTENSION_SH=`echo "$LIB_EXTENSION" | $ESC_SH`
2898OBJ_EXTENSION_SH=`echo "$OBJ_EXTENSION" | $ESC_SH`
2899EXE_EXTENSION_SH=`echo "$EXE_EXTENSION" | $ESC_SH`
2900BAT_EXTENSION_SH=`echo "$BAT_EXTENSION" | $ESC_SH`
2901
2902C_COMPILER_BAT=`echo "$C_COMPILER" | $ESC_BAT`
2903C_PREPROC_BAT=`echo "$C_PREPROC" | $ESC_BAT`
2904
2905FLAGS_OBJ_BAT=`echo "$FLAGS_OBJ" | $ESC_BAT`
2906FLAGS_DYN_BAT=`echo "$FLAGS_DYN" | $ESC_BAT`
2907FLAGS_LIB_BAT=`echo "$FLAGS_LIB" | $ESC_BAT`
2908FLAGS_EXE_BAT=`echo "$FLAGS_EXE" | $ESC_BAT`
2909
2910FLAGS_OPT_BAT=`echo "$FLAGS_OPT" | $ESC_BAT`
2911FLAGS_OPT_RTS_BAT=`echo "$FLAGS_OPT_RTS" | $ESC_BAT`
2912
2913DEFS_OBJ_BAT=`echo "$DEFS_OBJ" | $ESC_BAT`
2914DEFS_DYN_BAT=`echo "$DEFS_DYN" | $ESC_BAT`
2915DEFS_LIB_BAT=`echo "$DEFS_LIB" | $ESC_BAT`
2916DEFS_EXE_BAT=`echo "$DEFS_EXE" | $ESC_BAT`
2917
2918BUILD_OBJ_RTS_BAT=`echo "$BUILD_OBJ_RTS" | $ESC_BAT`
2919BUILD_OBJ_BAT=`echo "$BUILD_OBJ" | $ESC_BAT`
2920BUILD_DYN_BAT=`echo "$BUILD_DYN" | $ESC_BAT`
2921BUILD_LIB_BAT=`echo "$BUILD_LIB" | $ESC_BAT`
2922BUILD_EXE_BAT=`echo "$BUILD_EXE" | $ESC_BAT`
2923
2924DEFS_BAT=`echo "$DEFS" | $ESC_BAT`
2925LIBS_BAT=`echo "$LIBS" | $ESC_BAT`
2926GAMBITLIB_DEFS_BAT=`echo "$GAMBITLIB_DEFS" | $ESC_BAT`
2927GAMBITLIB_BAT=`echo "$GAMBITLIB" | $ESC_BAT`
2928GAMBITGSCLIB_BAT=`echo "$GAMBITGSCLIB" | $ESC_BAT`
2929GAMBITGSILIB_BAT=`echo "$GAMBITGSILIB" | $ESC_BAT`
2930LIB_PREFIX_BAT=`echo "$LIB_PREFIX" | $ESC_BAT`
2931LIB_EXTENSION_BAT=`echo "$LIB_EXTENSION" | $ESC_BAT`
2932OBJ_EXTENSION_BAT=`echo "$OBJ_EXTENSION" | $ESC_BAT`
2933EXE_EXTENSION_BAT=`echo "$EXE_EXTENSION" | $ESC_BAT`
2934BAT_EXTENSION_BAT=`echo "$BAT_EXTENSION" | $ESC_BAT`
2935
2936BUILD_OBJ_RTS_ECHO=`echo "$BUILD_OBJ_RTS" | $ESC_ECHO`
2937BUILD_OBJ_ECHO=`echo "$BUILD_OBJ" | $ESC_ECHO`
2938BUILD_DYN_ECHO=`echo "$BUILD_DYN" | $ESC_ECHO`
2939BUILD_LIB_ECHO=`echo "$BUILD_LIB" | $ESC_ECHO`
2940BUILD_EXE_ECHO=`echo "$BUILD_EXE" | $ESC_ECHO`
2941
2942BUILD_OBJ_RTS_ECHO_BAT=`echo "$BUILD_OBJ_RTS" | $ESC_ECHO_BAT`
2943BUILD_OBJ_ECHO_BAT=`echo "$BUILD_OBJ" | $ESC_ECHO_BAT`
2944BUILD_DYN_ECHO_BAT=`echo "$BUILD_DYN" | $ESC_ECHO_BAT`
2945BUILD_LIB_ECHO_BAT=`echo "$BUILD_LIB" | $ESC_ECHO_BAT`
2946BUILD_EXE_ECHO_BAT=`echo "$BUILD_EXE" | $ESC_ECHO_BAT`
2947
2948###############################################################################
2949
2950if test "$srcdir" = "."; then
2951  srcdirpfx=""
2952else
2953  srcdirpfx="\$(srcdir)/"
2954fi
2955
2956INSTALL='$(rootfromhere)/install-sh -c'
2957INSTALL_DATA='$(rootfromhere)/install-sh -c -m 644'
2958INSTALL_LIB='$(rootfromhere)/install-sh -c -m 644'
2959INSTALL_PROGRAM='$(rootfromhere)/install-sh -c -m 755'
2960
2961AC_SUBST(srcdirpfx)
2962AC_SUBST(exe)
2963AC_SUBST(obj)
2964AC_SUBST(bat)
2965AC_SUBST(SETDLPATH)
2966AC_SUBST(SETDLPATHBOOT)
2967
2968AC_SUBST(BUILD_OBJ_RTS)
2969AC_SUBST(BUILD_OBJ)
2970AC_SUBST(BUILD_DYN)
2971AC_SUBST(BUILD_LIB)
2972AC_SUBST(BUILD_EXE)
2973AC_SUBST(DEFS)
2974AC_SUBST(LIBS)
2975AC_SUBST(GAMBITLIB_DEFS)
2976AC_SUBST(GAMBITLIB)
2977AC_SUBST(GAMBITGSCLIB)
2978AC_SUBST(GAMBITGSILIB)
2979AC_SUBST(LIB_PREFIX)
2980AC_SUBST(LIB_EXTENSION)
2981AC_SUBST(OBJ_EXTENSION)
2982AC_SUBST(EXE_EXTENSION)
2983AC_SUBST(BAT_EXTENSION)
2984
2985AC_SUBST(BUILD_OBJ_RTS_MF)
2986AC_SUBST(BUILD_OBJ_MF)
2987AC_SUBST(BUILD_DYN_MF)
2988AC_SUBST(BUILD_LIB_MF)
2989AC_SUBST(BUILD_EXE_MF)
2990AC_SUBST(DEFS_MF)
2991AC_SUBST(LIBS_MF)
2992AC_SUBST(GAMBITLIB_DEFS_MF)
2993AC_SUBST(GAMBITLIB_MF)
2994AC_SUBST(GAMBITGSCLIB_MF)
2995AC_SUBST(GAMBITGSILIB_MF)
2996AC_SUBST(LIB_PREFIX_MF)
2997AC_SUBST(LIB_EXTENSION_MF)
2998AC_SUBST(OBJ_EXTENSION_MF)
2999AC_SUBST(EXE_EXTENSION_MF)
3000AC_SUBST(BAT_EXTENSION_MF)
3001
3002AC_SUBST(BUILD_OBJ_RTS_SH)
3003AC_SUBST(BUILD_OBJ_SH)
3004AC_SUBST(BUILD_DYN_SH)
3005AC_SUBST(BUILD_LIB_SH)
3006AC_SUBST(BUILD_EXE_SH)
3007AC_SUBST(DEFS_SH)
3008AC_SUBST(LIBS_SH)
3009AC_SUBST(GAMBITLIB_DEFS_SH)
3010AC_SUBST(GAMBITLIB_SH)
3011AC_SUBST(GAMBITGSCLIB_SH)
3012AC_SUBST(GAMBITGSILIB_SH)
3013AC_SUBST(LIB_PREFIX_SH)
3014AC_SUBST(LIB_EXTENSION_SH)
3015AC_SUBST(OBJ_EXTENSION_SH)
3016AC_SUBST(EXE_EXTENSION_SH)
3017AC_SUBST(BAT_EXTENSION_SH)
3018
3019AC_SUBST(BUILD_OBJ_RTS_BAT)
3020AC_SUBST(BUILD_OBJ_BAT)
3021AC_SUBST(BUILD_DYN_BAT)
3022AC_SUBST(BUILD_LIB_BAT)
3023AC_SUBST(BUILD_EXE_BAT)
3024AC_SUBST(DEFS_BAT)
3025AC_SUBST(LIBS_BAT)
3026AC_SUBST(GAMBITLIB_DEFS_BAT)
3027AC_SUBST(GAMBITLIB_BAT)
3028AC_SUBST(GAMBITGSCLIB_BAT)
3029AC_SUBST(GAMBITGSILIB_BAT)
3030AC_SUBST(LIB_PREFIX_BAT)
3031AC_SUBST(LIB_EXTENSION_BAT)
3032AC_SUBST(OBJ_EXTENSION_BAT)
3033AC_SUBST(EXE_EXTENSION_BAT)
3034AC_SUBST(BAT_EXTENSION_BAT)
3035
3036AC_SUBST(BUILD_OBJ_RTS_ECHO)
3037AC_SUBST(BUILD_OBJ_ECHO)
3038AC_SUBST(BUILD_DYN_ECHO)
3039AC_SUBST(BUILD_LIB_ECHO)
3040AC_SUBST(BUILD_EXE_ECHO)
3041
3042AC_SUBST(BUILD_OBJ_RTS_ECHO_BAT)
3043AC_SUBST(BUILD_OBJ_ECHO_BAT)
3044AC_SUBST(BUILD_DYN_ECHO_BAT)
3045AC_SUBST(BUILD_LIB_ECHO_BAT)
3046AC_SUBST(BUILD_EXE_ECHO_BAT)
3047
3048AC_SUBST(MAKE_LIBRARY)
3049AC_SUBST(MAKE_LIBRARY_FOR_INSTALL)
3050AC_SUBST(MAKE_LIBRARY_FOR_INSTALL_LIBS)
3051AC_SUBST(LINK)
3052AC_SUBST(LINK_FOR_INSTALL)
3053AC_SUBST(LINK_FOR_INSTALL_GSI_LIBS)
3054AC_SUBST(LINK_FOR_INSTALL_GSC_LIBS)
3055AC_SUBST(INSTALL)
3056AC_SUBST(INSTALL_DATA)
3057AC_SUBST(INSTALL_LIB)
3058AC_SUBST(INSTALL_PROGRAM)
3059AC_SUBST(LN_S)
3060AC_SUBST(RANLIB)
3061AC_SUBST(AR)
3062AC_SUBST(RC)
3063AC_SUBST(GIT)
3064AC_SUBST(HG)
3065AC_SUBST(FIXLIB)
3066
3067AC_SUBST(X_FLAGS)
3068AC_SUBST(X_LIBS)
3069
3070AC_SUBST(ENABLE_SYMLINKS)
3071AC_SUBST(ENABLE_INTERPRETER_NAME)
3072AC_SUBST(ENABLE_COMPILER_NAME)
3073AC_SUBST(ENABLE_MULTIPLE_VERSIONS)
3074AC_SUBST(ENABLE_SHARED)
3075AC_SUBST(ENABLE_ABSOLUTE_SHARED_LIBS)
3076AC_SUBST(ENABLE_VERSIONED_SHARED_LIBS)
3077AC_SUBST(emacsdir)
3078AC_SUBST(HELP_BROWSER)
3079AC_SUBST(COMPILATION_OPTIONS)
3080AC_SUBST(RTLIB_COND_EXPAND_FEATURES)
3081
3082AC_PROG_MAKE_SET
3083
3084AC_OUTPUT(makefile include/makefile include/gambit.h lib/makefile $RTLIBMAKEFILES gsi/makefile gsc/makefile bin/makefile bin/gambcomp-C.unix bin/gambcomp-C.bat.windows bin/gambcomp-js.unix bin/gambcomp-js.bat.windows bin/gambcomp-python.unix bin/gambcomp-python.bat.windows bin/gambcomp-ruby.unix bin/gambcomp-ruby.bat.windows bin/gambcomp-php.unix bin/gambcomp-php.bat.windows bin/gambcomp-java.unix bin/gambcomp-java.bat.windows bin/gambdoc.unix bin/gambdoc.bat.windows misc/makefile doc/makefile tests/makefile examples/makefile examples/distr-comp/makefile examples/pi/makefile examples/ring/makefile examples/web-repl/makefile examples/web-server/makefile examples/tcltk/makefile examples/Xlib-simple/makefile examples/pthread/makefile examples/misc/makefile bench/makefile contrib/makefile contrib/GambitREPL/makefile contrib/xactlog/makefile prebuilt/makefile prebuilt/macosx/makefile prebuilt/macosx/build-phase2 prebuilt/windows/makefile prebuilt/windows/build-phase2 githooks/makefile)
3085
3086if test "$ENABLE_SINGLE_HOST" != yes -a "$C_COMP_LLVM" != yes; then
3087  AC_MSG_NOTICE([
3088**************************************************************************
3089***                                                                    ***
3090*** The option "--enable-single-host" was not specified to the         ***
3091*** configure script.  The Gambit system will compile correctly but    ***
3092*** typically the executables will run considerably slower than when   ***
3093*** "--enable-single-host" is specified.  On the other hand the build  ***
3094*** with "--enable-single-host" is typically slower and requires lots  ***
3095*** of RAM memory (>= 1 GB).  If you are willing to wait for the       ***
3096*** longer build, try the configure option "--enable-single-host".     ***
3097***                                                                    ***
3098**************************************************************************
3099])
3100fi
3101
3102if test "$ENABLE_SINGLE_HOST" = yes -a "$C_COMP_LLVM" = yes; then
3103  AC_MSG_NOTICE([
3104**************************************************************************
3105***                                                                    ***
3106*** The option "--enable-single-host" was specified to the configure   ***
3107*** script and a LLVM C compiler is being used (clang or LLVM GCC).    ***
3108*** This combination is not recommended as the build may require a     ***
3109*** lot of memory and a very long time (over 30 minutes on a fairly    ***
3110*** fast machine with clang 3.0).  Configuring with GNU GCC will give  ***
3111*** a faster build (1 min on the same machine with GNU GCC 4.2.1) and  ***
3112*** the executable will be faster.                                     ***
3113***                                                                    ***
3114**************************************************************************
3115])
3116fi
3117
3118if test "$ENABLE_SINGLE_HOST" != yes -a "$C_COMP_CLANG" = yes; then
3119  AC_MSG_NOTICE([
3120**************************************************************************
3121***                                                                    ***
3122*** The clang compiler is being used.  Please be aware that the build  ***
3123*** may take a very long time (over 30 minutes on a fairly fast        ***
3124*** machine with clang 3.0).  Configuring with GNU GCC will give a     ***
3125*** faster build (1 min on the same machine with GNU GCC 4.2.1) and    ***
3126*** the executable will be faster.                                     ***
3127***                                                                    ***
3128**************************************************************************
3129])
3130fi
3131
3132if echo " $CFLAGS $CXXFLAGS $FLAGS_OPT " | grep -e " -O[[^ ]]*[[23456789]] " > /dev/null; then
3133  AC_MSG_NOTICE([
3134**************************************************************************
3135***                                                                    ***
3136*** The setting of CFLAGS, CXXFLAGS and/or the --enable-c-opt is       ***
3137*** selecting a C compiler optimization level >= -O2 .  This           ***
3138*** typically causes run time performance that is *less* than when     ***
3139*** using the default -O1 optimization level.  You may want to try it  ***
3140*** both ways and use whichever yields the best performance.           ***
3141***                                                                    ***
3142**************************************************************************
3143])
3144fi
3145
3146if test "$C_COMP_GNUC" = yes; then
3147
3148  if test "$GNU_GCC_MOVE_LOOP_INVARIANTS_POSSIBLE_BUG" = yes; then
3149    AC_MSG_NOTICE([
3150**************************************************************************
3151***                                                                    ***
3152*** The GCC compiler that is being used has problems compiling Gambit  ***
3153*** generated code when the normal set of C compiler optimizations are ***
3154*** enabled and the configure flag "--enable-single-host" is           ***
3155*** specified.  It can take over 20 GB of virtual memory to            ***
3156*** compile some files.  For this reason the GCC compiler optimization ***
3157*** which performs loop invariant code motion has been disabled by     ***
3158*** adding the GCC command line option "-fno-move-loop-invariants".    ***
3159*** This greatly reduces compile time space requirements and it has a  ***
3160*** small impact on overall run time performance, but for some tight   ***
3161*** loops the effect is larger.  If you want to avoid this problem     ***
3162*** then upgrade your version of GCC to 4.4 (or above hopefully) or    ***
3163*** downgrade to a version prior to 4.2 .                              ***
3164***                                                                    ***
3165**************************************************************************
3166])
3167  fi
3168
3169  if test "$LLVM_GCC_LABEL_VALUES_POSSIBLE_BUG" = yes; then
3170
3171    AC_MSG_NOTICE([
3172**************************************************************************
3173***                                                                    ***
3174*** The LLVM GCC compiler that is being used may have a bug in the     ***
3175*** compilation of label values (i.e. &&label).  This bug was          ***
3176*** discovered when compiling Gambit with Xcode on Mac OS X (see bug   ***
3177*** ID# 9956714).  For this reason the use of computed gotos in the    ***
3178*** generated code has been disabled.  This greatly reduces the run    ***
3179*** time performance.  The system runs 5 times slower than when it is  ***
3180*** compiled with GNU GCC.  It is highly recommended that you use      ***
3181*** another C compiler if possible.                                    ***
3182***                                                                    ***
3183**************************************************************************
3184])
3185  fi
3186
3187
3188  if test "$GNU_GCC_IPA_RA_POSSIBLE_BUG" = yes ; then
3189
3190    AC_MSG_NOTICE([
3191**************************************************************************
3192***                                                                    ***
3193*** The GNU GCC compiler that is being used may show a bug while       ***
3194*** compiling Gambit with --enable-shared and --enable-c-opt >= -O2.   ***
3195*** For this reason, the optimization -fipa-ra has been disabled.      ***
3196***                                                                    ***
3197**************************************************************************
3198])
3199  fi
3200
3201
3202
3203#  if test "$ENABLE_GCC_OPTS" != yes; then
3204#    AC_MSG_NOTICE([
3205#**************************************************************************
3206#*** The GCC compiler is being used but the option "--enable-gcc-opts"  ***
3207#*** was not specified to the configure script.  The Gambit system      ***
3208#*** will compile correctly but the code generated by the GCC compiler  ***
3209#*** will be suboptimal and the executables will run slightly slower    ***
3210#*** than if "--enable-gcc-opts" is specified.  On the other hand the   ***
3211#*** build process will be faster and require less memory.  If you have ***
3212#*** lots of RAM memory (>= 2 Gbytes) and you are willing to wait for   ***
3213#*** the longer build try the configure option "--enable-gcc-opts".     ***
3214#**************************************************************************
3215#])
3216#  fi
3217
3218fi
3219
3220if false; then
3221
3222if test "$ENABLE_MULTIPLE_VMS" != no -o "$ENABLE_MULTIPLE_THREADED_VMS" != no; then
3223
3224  AC_MSG_NOTICE([
3225*********************************************************************
3226***                                                               ***
3227*** The option --enable-multiple-vms or the option                ***
3228*** --enable-multiple-threaded-vms (or both) have been specified. ***
3229*** This enables support for parallel execution of Scheme code.   ***
3230***                                                               ***
3231*** This is a feature that is considered experimental and of beta ***
3232*** quality currently. You are encouraged to report any issues    ***
3233*** encountered at https://github.com/gambit/gambit/issues .      ***
3234***                                                               ***
3235*********************************************************************
3236])
3237
3238else
3239
3240  AC_MSG_NOTICE([
3241*********************************************************************
3242***                                                               ***
3243*** Neither of the options --enable-multiple-vms and              ***
3244*** --enable-multiple-threaded-vms have been specified. This      ***
3245*** means that support for parallel execution of Scheme code is   ***
3246*** disabled. In the future, support for parallel execution will  ***
3247*** be the default. If you wish to contribute to the testing of   ***
3248*** this feature, please activate one of those options. Note that ***
3249*** this is a feature that is considered experimental and of beta ***
3250*** quality currently. You are encouraged to report any issues    ***
3251*** encountered at https://github.com/gambit/gambit/issues .      ***
3252***                                                               ***
3253*********************************************************************
3254])
3255
3256fi
3257
3258fi
3259