-
Notifications
You must be signed in to change notification settings - Fork 1
/
configure.in
720 lines (615 loc) · 26.4 KB
/
configure.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
dnl
dnl The new and improved configure file for Gwydion Dylan!
dnl This is based on the old configure file, but rewritten to
dnl support our goals for maintaining and improving the compiler.
dnl
dnl Rules are annotated with codes:
dnl [C] d2c-specific
dnl [?] Might be specific to one or the other
dnl
dnl We don't support cross-compilation yet, but we're working on
dnl it.
#--------------------------------------------------------------------
# Emit configure initialization, verify that we're in the right
# source directory, require autoconf version 2.12, and start
# processing config.h.in.
#--------------------------------------------------------------------
AC_INIT(d2c/compiler/platforms.descr)
AC_PREREQ(2.50)
AC_CONFIG_HEADER(config.h)
#--------------------------------------------------------------------
# Version/package information.
#--------------------------------------------------------------------
PACKAGE="gwydion-dylan"
VERSION="`cat $srcdir/version`"
AC_SUBST(PACKAGE)
AC_SUBST(VERSION)
#--------------------------------------------------------------------
# This is used in conjunction with the output of 'd2c --compiler-info'
# to decide when d2c needs a full bootstrap. Increment the value here
# whenever the dump format or the interaction between the runtime and
# the compiler changes. (Please also increment the "preX" part of
# $srcdir/version when incrementing this value.)
#--------------------------------------------------------------------
CURRENT_BOOTSTRAP_COUNTER=1011
AC_SUBST(CURRENT_BOOTSTRAP_COUNTER)
#--------------------------------------------------------------------
# Make srcdir absolute to keep Mindy's build system from choking.
#--------------------------------------------------------------------
srcdir=`(cd $srcdir; pwd)`
#--------------------------------------------------------------------
# buildroot is the directory in which we run configure.
#--------------------------------------------------------------------
buildroot=`pwd`
AC_SUBST(buildroot)
top_builddir=$buildroot
AC_SUBST(top_builddir)
#--------------------------------------------------------------------
# recheck is how we invoked configure so we can re-run it during
# bootstrap.
#--------------------------------------------------------------------
recheck="$0 $ac_configure_args"
AC_SUBST(recheck)
#--------------------------------------------------------------------
# Find out what type of system we appear to be, and work out
# whether there's any cross-compiling going on.
#--------------------------------------------------------------------
AC_CANONICAL_BUILD # Find the system type
AC_CANONICAL_HOST
AC_CANONICAL_TARGET
AC_ARG_PROGRAM # Provide support for name prefixes
AC_PROG_CC # Specify when cross-compiling.
AC_DEFUN([GD_D2C_SYSTEM],[
case $1 in
i*86-*-cygwin*) $2=x86-cygwin-gcc ;;
i*86-*-freebsd*) $2=x86-freebsd-gcc ;;
i*86-*-linux*) $2=x86-linux-gcc ;;
x86_64-*-linux-gnu*) $2=x86_64-linux-gcc ;;
arm*-*-linux-gnu*) $2=arm-linux-gcc ;;
powerpc-*-linux-gnu*) $2=ppc-linux-gcc ;;
s390*-*-linux-gnu*) $2=s390-linux-gcc ;;
sparc*-*-linux-gnu*) $2=sparc-linux-gcc ;;
powerpc-apple-darwin*) $2=ppc-darwin-gcc ;;
i*86-apple-darwin*)
case $CC in
*clang*) $2=x86-darwin-clang ;;
*) $2=x86-darwin-gcc ;;
esac ;;
x86_64-apple-darwin*)
case $CC in
*clang*) $2=x86_64-darwin-clang ;;
*) $2=x86_64-darwin-gcc ;;
esac ;;
i*86-*-solaris*)
case $CC in
cc) $2=x86-solaris-sunpro ;;
*) $2=x86-solaris-gcc ;;
esac ;;
sparc*-solaris*)
case $CC in
cc) $2=sparc-solaris-sunpro ;;
*) $2=sparc-solaris-gcc ;;
esac ;;
# old stuff
sparc*-openbsd*) $2=sparc-openbsd-gcc ;;
i*86-pc-mingw32*) $2=x86-mingw32-gcc ;;
i*86-pc-none) $2=x86-win32-vc ;;
i*86-pc-beos) $2=x86-beos-gcc ;;
i*86-*-netbsd*) $2=x86-netbsd-gcc ;;
*) $2=unknown-unix ;;
esac])
version="`cat $srcdir/version`"
AC_SUBST(version)
echo "Running configure for Gwydion Dylan version $version"
AC_MSG_CHECKING(d2c build system type)
GD_D2C_SYSTEM($build,d2c_build)
AC_MSG_RESULT($d2c_build)
AC_SUBST(d2c_build)
AC_MSG_CHECKING(d2c host system type)
GD_D2C_SYSTEM($host,d2c_host)
AC_MSG_RESULT($d2c_host)
AC_SUBST(d2c_host)
AC_MSG_CHECKING(d2c target system type)
if test "x$target_alias" != "x"; then
d2c_target=$target_alias
else
GD_D2C_SYSTEM($target,d2c_target)
fi
AC_MSG_RESULT($d2c_target)
AC_SUBST(d2c_target)
#----------------------------------------------------------
# Now that I know the build version, and particularly, if
# it's cygwin, I can add executable endings to those filenames
# Douglas M. Auclair, [email protected]
#----------------------------------------------------------
AC_MSG_CHECKING(executable endings)
exe_ext=""
case $d2c_build in
*cygwin*|x86-mingw*)
exe_ext=".exe"
;;
esac
AC_MSG_RESULT($exe_ext)
AC_SUBST(exe_ext)
AC_SUBST(host_cpu)
AC_MSG_CHECKING(to see if we're cross-compiling)
d2c_cross_compiling=no
if test "$d2c_target" != "$d2c_host"; then
d2c_cross_compiling=yes
fi
AC_MSG_RESULT($d2c_cross_compiling)
#AC_MSG_CHECKING(to see if we're building a cross-compiler)
#cross_compiler=no
#if test "$host" != "$target"; then
# cross_compiler=yes
#fi
#AC_MSG_RESULT($cross_compiler)
#--------------------------------------------------------------------
# Find the current date, for substitution into man pages.
#--------------------------------------------------------------------
DATE="`date '+%d %B %Y'`"
AC_SUBST(DATE)
#--------------------------------------------------------------------
# Look for various programs which we might need. If these are
# missing, we want to deal with them early.
#--------------------------------------------------------------------
AC_PATH_PROG(PERL, perl, no)
if test "$PERL" = no; then
AC_MSG_ERROR(Cannot build without perl to run gen-makefile)
fi
AC_PROG_INSTALL
AC_PROG_LN_S
AC_CHECK_TOOL(RANLIB, ranlib, :)
AC_PATH_PROG(EMACS, emacs, no)
if test "$EMACS" = no; then
AC_PATH_PROG(EMACS, xemacs, no)
fi
#--------------------------------------------------------------------
# Configure libtool.
#--------------------------------------------------------------------
AC_PROG_LIBTOOL
LIBTOOL="${CONFIG_SHELL-/bin/sh} $buildroot/libtool"
AC_SUBST(enable_shared)
AC_SUBST(enable_static)
#--------------------------------------------------------------------
# Study our build environment carefully.
#--------------------------------------------------------------------
# Look for an installed d2c.
AC_PATH_PROG(D2C, d2c, no)
d2c_path=`echo $ac_cv_path_D2C|sed -e 's|/bin/d2c||'`
# Does the user explicitly want a bootstrap?
AC_ARG_ENABLE(bootstrap,
[ --enable-bootstrap Force a two-stage d2c bootstrap even if the
bootstrap counts match. This saves hacking
with main.dylan and configure.in every time
you want to test some little change in the
runtime system])
enable_bootstrap=${enable_bootstrap:-no}
# If d2c is present, try to ask it some questions.
if test "$D2C" != no; then
_DCI_DYLAN_LID_FORMAT_VERSION=0
_DCI_D2C_BOOTSTRAP_COUNTER=0
_DCI_D2C_RUNTIME_SUBDIR=
if $D2C --compiler-info > "$srcdir/compiler-info" 2> /dev/null; then
. "$srcdir/compiler-info"
else
cat "$srcdir/compiler-info"
rm -f "$srcdir/compiler-info"
AC_MSG_ERROR([Your d2c appears to be broken. A working d2c binary is
required to build $PACKAGE-$VERSION. Try running d2c --compiler-info to see what
error was encountered.])
fi
rm -f "$srcdir/compiler-info"
echo "Found the following Dylan compiler information:"
echo " LID format version: $_DCI_DYLAN_LID_FORMAT_VERSION"
echo " d2c bootstrap counter: $_DCI_D2C_BOOTSTRAP_COUNTER"
echo " d2c runtime subdirectory: $_DCI_D2C_RUNTIME_SUBDIR"
else
AC_MSG_ERROR([Cannot find d2c in your PATH. An existing d2c binary
(version 2.4.0 or later) is required to build $PACKAGE-$VERSION])
fi
lid_format_version=$_DCI_DYLAN_LID_FORMAT_VERSION
AC_SUBST(lid_format_version)
AC_PATH_PROG(MELANGE, melange, no)
AC_MSG_CHECKING(if $MELANGE needs flags)
need_melange_flags=no
MELANGEFLAGS=
case "${host}" in
*-apple-darwin*)
if ! $MELANGE --defines | grep __restrict > /dev/null; then
MELANGEFLAGS="-D__restrict=/\*\*/"
need_melange_flags=yes
fi
;;
esac
AC_MSG_RESULT($need_melange_flags)
AC_SUBST(MELANGEFLAGS)
#--------------------------------------------------------------------
# Deal with user-space probes, like DTrace, System Tap.
#--------------------------------------------------------------------
WITH_TRACING_DEFAULT='no'
case "${host}" in
*darwin8*) WITH_TRACING_DEFAULT='no' ;;
*darwin*) WITH_TRACING_DEFAULT='dtrace' ;;
esac
AC_MSG_CHECKING([whether to include tracing support])
AC_ARG_WITH([tracing],
[AS_HELP_STRING([--with-tracing=(dtrace,systemtap,no)],
[Enable inclusion of tracing support.)])],
[WITH_TRACING="${withval}"], [WITH_TRACING=${WITH_TRACING_DEFAULT}])
AC_MSG_RESULT(${WITH_TRACING})
if test "x${WITH_TRACING}" != xdtrace -a "x${WITH_TRACING}" != xsystemtap -a "x${WITH_TRACING}" != xno; then
AC_MSG_ERROR([${WITH_TRACING} is not a valid value for --with-tracing. Use 'dtrace', 'systemtap' or 'no'.])
fi
if test "x${WITH_TRACING}" = xdtrace; then
# Consider adding FreeBSD and Solaris support here.
case "${host}" in
*darwin*) ;;
*) AC_MSG_ERROR([dtrace is currently only supported on Mac OS X.]) ;;
esac
AC_CHECK_PROGS(DTRACE, dtrace)
if test -z "$DTRACE"; then
AC_MSG_ERROR([dtrace not found, consider using --without-tracing.])
fi
enable_dtrace=yes
AC_SUBST(enable_dtrace)
fi
# This is not complete yet.
if test "x${WITH_TRACING}" = xsystemtap; then
AC_MSG_WARN([systemtap support is not yet ready for use.])
case "${host}" in
*linux*) ;;
*) AC_MSG_ERROR([systemtap is only available on Linux.]) ;;
esac
AC_CHECK_PROGS(DTRACE, dtrace)
if test -z "$DTRACE"; then
AC_MSG_ERROR([dtrace not found, consider using --without-tracing.])
fi
AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND='yes'],
[SDT_H_FOUND='no';
AC_MSG_ERROR([systemtap support needs sys/sdt.h header])])
fi
#--------------------------------------------------------------------
# Determine our "build scenario".
#--------------------------------------------------------------------
AC_MSG_CHECKING(which build scenario to use)
if test $CURRENT_BOOTSTRAP_COUNTER -ne $_DCI_D2C_BOOTSTRAP_COUNTER; then
enable_bootstrap=yes
fi
if test -x "$buildroot/bootstrap_compiler/d2c"; then
SCENARIO=SECOND_STAGE
enable_bootstrap=no
bootstrap_d2c="$buildroot/bootstrap_compiler/d2c"
D2C="$bootstrap_d2c -p$srcdir/d2c/compiler/platforms.descr"
elif test "$enable_bootstrap" = yes; then
SCENARIO=BOOTSTRAPPING
enable_shared=no
elif test "$d2c_cross_compiling" = yes; then
SCENARIO=CROSS_COMPILING
else
SCENARIO=REGULAR_BUILD
fi
AC_MSG_RESULT($SCENARIO)
echo "Using the following build parameters:"
echo " Cross compiling: $d2c_cross_compiling"
echo " Bootstrapping: $enable_bootstrap"
#--------------------------------------------------------------------
# Sanity-check our "build scenario".
#--------------------------------------------------------------------
if test "$SCENARIO" = CROSS_COMPILING -o "$d2c_cross_compiling" = yes; then
AC_MSG_WARN([\
Cannot cross-compile.])
fi
#--------------------------------------------------------------------
# Record our build parameters.
#--------------------------------------------------------------------
AC_SUBST(d2c_cross_compiling)
AC_SUBST(enable_bootstrap)
#--------------------------------------------------------------------
# If we're bootstrapping with d2c, look for the installed runtime.
#--------------------------------------------------------------------
# Runtime libraries which must match the compiler used to build d2c.
RUNTIME_LIBRARIES="libruntime.a dylan.lib.du melange-support.lib.du transcendental.lib.du"
EXTRA_RUNTIME_LIBRARIES="libgc.a libdylan.a libdylan-dylan.a llibmelange.a libmelange-support.a libmelange-support-dylan.a libtranscendental.a libtranscendental-dylan.a"
# Delete our local runtime directory, if it exists.
LOCAL_RUNTIME="$buildroot"/previous_runtime
AC_SUBST(LOCAL_RUNTIME)
if test -d "$LOCAL_RUNTIME"; then
rm -rf "$LOCAL_RUNTIME"
fi
# Process our --with-existing-runtime option.
AC_ARG_WITH(existing-runtime,
[ --with-existing-runtime=RUNTIME_DIRECTORY
Look for the d2c runtime libraries in a different
place when bootstrapping. Defaults to
{prefix}/lib/dylan. This is only applicable when
building in BOOTSTRAPPING mode.])
with_existing_runtime=${with_existing_runtime:-no}
if test "$with_existing_runtime" = yes; then
with_existing_runtime=no
fi
AC_ARG_WITH(existing-runtime-header,
[ --with-existing-runtime-header=PATH_TO_RUNTIME_H
Location of runtime.h file of existing
d2c for bootstrapping purposes.])
existing_runtime_header=${with_existing_runtime_header:-"$d2c_path/include/runtime.h"}
# If we're bootstrapping with d2c, create local links to each runtime file.
if test $SCENARIO = BOOTSTRAPPING; then
AC_MSG_CHECKING(for existing d2c runtime)
if test "$with_existing_runtime" = no; then
relative_runtime="lib/dylan/$_DCI_D2C_RUNTIME_SUBDIR"
with_existing_runtime="$d2c_path/$relative_runtime"
fi
AC_MSG_RESULT($with_existing_runtime)
# Make a directory to hold the pre-existing runtime.
mkdir "$LOCAL_RUNTIME"
# Make links to our runtime libraries.
for f in $RUNTIME_LIBRARIES; do
lib="$with_existing_runtime/$f"
if test -r $lib; then
ln -s "$lib" "$LOCAL_RUNTIME"
else
AC_MSG_ERROR([
Cannot find $f in $with_existing_runtime.
You may need to specify the --with-existing-runtime option to configure; see
'./configure --help' for details.])
fi
done
for f in $EXTRA_RUNTIME_LIBRARIES; do
lib="$with_existing_runtime/$f"
if test -r $lib; then
ln -s "$lib" "$LOCAL_RUNTIME"
fi
done
# Make a link to our runtime.h file.
if test ! -f "$existing_runtime_header"; then
AC_MSG_ERROR([Cannot locate runtime.h for the installed d2c. ($existing_runtime_header)])
fi
ln -s "$existing_runtime_header" "$LOCAL_RUNTIME"
fi
AC_ARG_WITH(site-dylan-prefix,
[ --with-site-dylan-prefix=SITE_DYLAN_PREFIX
Use this prefix for the site-local Dylan
directory. You might want to set this to
/usr/local if you install Gwydion Dylan in
/usr, in order to be FSSTND compliant.])
with_site_dylan_prefix=${with_site_dylan_prefix:-no}
if test "$with_site_dylan_prefix" = yes; then
with_site_dylan_prefix=no
fi
AC_SUBST(with_site_dylan_prefix)
#--------------------------------------------------------------------
# Check for HP shared library emulation on ELF systems
# testing for /usr/include/dlfcn.h might be a good automatic test?
#--------------------------------------------------------------------
AC_CHECK_LIB(dl, dlopen,[LIBS="-ldl" GC_LIBS="-ldl"])
AC_CHECK_LIB(pthread, pthread_create,[AC_DEFINE([HAVE_PTHREAD],
[],
[pthread library available])
LIBS="$LIBS -lpthread"
GC_LIBS="$GC_LIBS -lpthread"])
WITH_GC_DEFAULT='boehm'
#case "${host}" in
# *darwin8*) WITH_GC_DEFAULT='boehm' ;;
# *darwin*) WITH_GC_DEFAULT='auto_zone' ;;
#esac
AC_MSG_CHECKING([which GC should be used])
AC_ARG_WITH([gc],
[AS_HELP_STRING([--with-gc=(boehm,auto_zone)],
[Specify which GC should be used.])],
[WITH_GC="${withval}"], [WITH_GC=${WITH_GC_DEFAULT}])
AC_MSG_RESULT(${WITH_GC})
AC_SUBST(WITH_GC)
if test "x${WITH_GC}" != xboehm -a "x${WITH_GC}" != xauto_zone; then
AC_MSG_ERROR([${WITH_GC} is not a valid value for --with-gc. Use 'boehm' or 'auto_zone'.])
fi
if test "x${WITH_GC}" = xauto_zone; then
case "${host}" in
*darwin*) ;;
*) AC_MSG_ERROR([auto_zone is currently only supported on Mac OS X.]) ;;
esac
GC_CFLAGS=
GC_LIBS="-lauto $GC_LIBS"
AC_CHECK_LIB(auto, auto_zone_allocate_object,,AC_MSG_ERROR([Could not link with auto_zone.]))
AC_CHECK_HEADER(auto_zone.h)
AC_DEFINE(USING_AUTOZONE, [1], [Define to 1 if using the auto_zone GC.])
fi
if test "x${WITH_GC}" = xboehm; then
#--------------------------------------------------------------------
# Look for gc, set GC_CFLAGS and GC_LIBS
#--------------------------------------------------------------------
AC_ARG_WITH(gc-prefix, [ --with-gc-prefix=PFX Prefix where Boehm gc is installed],
gc_prefix="$withval", gc_prefix="")
if test "x$gc_prefix" != x; then
GC_CFLAGS="-I$gc_prefix/include -I$gc_prefix/include/gc"
GC_LIBS="-L$gc_prefix/lib -lgc $GC_LIBS"
else
GC_LIBS="-lgc $GC_LIBS"
fi
save_CPPFLAGS="$CPPFLAGS"
save_LIBS="$LIBS"
CPPFLAGS="$GC_CFLAGS $CPPFLAGS"
LIBS="$GC_LIBS $LIBS"
AC_CHECK_HEADERS(gc.h gc/gc.h)
if test "x$ac_cv_header_gc_gc_h" != "xyes" -a "x$ac_cv_header_gc_h" != "xyes"; then
if test "x$gc_prefix" == x; then
AC_MSG_NOTICE([Looking for Boehm in /opt/local...])
gc_prefix="/opt/local"
GC_CFLAGS="-I$gc_prefix/include -I$gc_prefix/include/gc"
GC_LIBS="-L$gc_prefix/lib -lgc $GC_LIBS"
$as_unset ac_cv_header_gc_gc_h
$as_unset ac_cv_header_gc_h
CPPFLAGS="$GC_CFLAGS $CPPFLAGS"
LIBS="$GC_LIBS $LIBS"
AC_CHECK_HEADERS(gc.h gc/gc.h)
fi
fi
if test "x$ac_cv_header_gc_gc_h" != "xyes" -a "x$ac_cv_header_gc_h" != "xyes"; then
AC_MSG_ERROR([
Cannot locate the Boehm-Weiser conservative garbage collector. Please
download the library from http://www.hpl.hp.com/personal/Hans_Boehm/gc/
or from your operating system distribution.])
fi
AC_CHECK_LIB(gc, GC_malloc_ignore_off_page, ,AC_MSG_ERROR([
Cannot link with the Boehm-Weiser conservative garbage collector library.
Please download the library from http://www.hpl.hp.com/personal/Hans_Boehm/gc/
or from your operating system distribution.]))
CPPLAGS="$save_CPPLAGS"
LIBS="$save_LIBS"
AC_DEFINE(USING_BOEHM, [1], [Define to 1 if using the Boehm GC.])
fi
AC_SUBST(GC_CFLAGS)
AC_SUBST(GC_LIBS)
#--------------------------------------------------------------------
# Look for versions of setjmp/longjmp that let us control
# signal mask behavior.
#--------------------------------------------------------------------
AC_CHECK_FUNCS(sigsetjmp siglongjmp)
#--------------------------------------------------------------------
# Look for mmap/mprotect support
#--------------------------------------------------------------------
AC_CHECK_HEADERS(unistd.h sys/mman.h)
AC_CHECK_FUNCS(mprotect getpagesize)
#--------------------------------------------------------------------
# Look for getrlimit, getrusage
#--------------------------------------------------------------------
AC_CHECK_HEADERS(sys/time.h sys/resource.h)
AC_CHECK_FUNCS(getrlimit getrusage)
#--------------------------------------------------------------------
# How many threads do we want each invocation of d2c to use
#--------------------------------------------------------------------
AC_ARG_WITH(thread-count,
[ --with-thread-count=INTEGER
How many threads should d2c use. Currently only
tells the sub-make process the same thing.])
with_thread_count=${with_thread_count:-no}
if test "$with_thread_count" = yes; then
with_thread_count=no
fi
AC_SUBST(with_thread_count)
#====================================================================
# Start of section lifted from original configure.in.
# We might not need all the things we test for, but it's not worth
# the effort to trim this down to size. Note that much of this is
# Mindy-specific and doesn't apply to d2c. Like most things about
# configure, this should be considered magical until it breaks.
#====================================================================
#--------------------------------------------------------------------
# Establish the default compile options for cc
#--------------------------------------------------------------------
AC_ARG_ENABLE(debug, [ --enable-debug=[no/minimum/yes/profiling] turn on debugging [default=minimum]],,enable_debug=minimum)
AC_SUBST(enable_debug)
case `basename $CC` in
gcc* | *-gcc*)
EXTRA_INCLUDE_DIR="`$CC --print-file-name=include`"
if test "X$EXTRA_INCLUDE_DIR" = Xinclude; then
EXTRA_INCLUDE_DIR=
fi
;;
esac
AC_SUBST(EXTRA_INCLUDE_DIR)
#--------------------------------------------------------------------
# Determine whether the time library can be supported
#--------------------------------------------------------------------
AC_MSG_CHECKING([whether struct tm has a tm_gmtoff field])
AC_TRY_COMPILE([#include <time.h>], [struct tm t; long g = t.tm_gmtoff;],
[AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_TM_GMTOFF, [1], [Define to 1 if can use struct tm's tm_gmtoff.])],
[AC_MSG_RESULT(no)
AC_MSG_CHECKING([whether daylight and timezone are supported])
AC_TRY_LINK([#include <time.h>], [int a = daylight; long b = timezone;],
[AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_DAYLIGHT, [1], [Define to 1 if using daylight.])],
[AC_MSG_RESULT(no)])])
#--------------------------------------------------------------------
# Checks for the io and system libraries
#--------------------------------------------------------------------
AC_CHECK_FUNCS(localtime_r)
AC_STRUCT_TIMEZONE
AC_CHECK_MEMBERS([struct stat.st_blksize])
AC_CHECK_MEMBERS([struct stat.st_birthtimespec])
AC_CHECK_MEMBERS([struct stat.st_ctimespec])
AC_CHECK_MEMBERS([struct stat.st_atimespec])
AC_CHECK_MEMBERS([struct stat.st_mtimespec])
AC_CHECK_MEMBERS([struct stat.st_ctim])
AC_CHECK_MEMBERS([struct stat.st_atim])
AC_CHECK_MEMBERS([struct stat.st_mtim])
#--------------------------------------------------------------------
# Check for libm
#--------------------------------------------------------------------
AC_CHECK_LIB(m, sin, LIBS="$LIBS -lm")
#--------------------------------------------------------------------
# Check for various math library functions
#--------------------------------------------------------------------
AC_CHECK_FUNCS(frexpf frexpl ldexpf ldexpl logl log2l log10l log2)
AC_CHECK_FUNCS(fabsf sinf cosf tanf asinf acosf atanf atan2f expf sqrtf)
AC_CHECK_FUNCS(logf log2f log10f powf sinhf coshf tanhf)
#--------------------------------------------------------------------
# See if cfmakeraw() is already declared
#--------------------------------------------------------------------
AC_CHECK_DECLS([cfmakeraw],,,[#include <termios.h>])
#====================================================================
# End of section lifted from original configure.in.
#====================================================================
#--------------------------------------------------------------------
# Build and run config.status.
#--------------------------------------------------------------------
# Autoconf only seems to create one directory level at a time, so we need to
# create several directories which contain no Makefile.in.
# Note that we should probably do this in config.status, not configure,
# but since it's idempotent we can get away with doing it here.
$srcdir/mkinstalldirs tools
# Make sure there are no *.dylan.in files in this list. They cause two
# problems: d2c expects all sources to live in the srcdir (which is a problem
# in and of itself) and configure tries to create the *.dylan files before
# we build our buildroot tree causing things to flame out horribly.
AC_OUTPUT(Defaults tools/shared-misc/gen-bootstrap tools/shared-misc/gen-makefile tools/shared-misc/mk-build-tree tools/shared-misc/line-count tools/shared-misc/make-dylan-app tools/shared-misc/make-dylan-lib tools/shared-misc/update-libdirs doc/Makefile doc/dylan.7 doc/gwydion.7 doc/d2c.1 doc/dybug.1 doc/melange.1 doc/parsergen.1 doc/make-dylan-app.1 doc/platforms.descr.4,
[${INSTALL} -m uog+rx $buildroot/tools/shared-misc/mk-build-tree ./
${INSTALL} -m uog+rx $buildroot/tools/shared-misc/gen-bootstrap ./
${INSTALL} -m uog+rx $buildroot/tools/shared-misc/gen-makefile ./
(PATH=$buildroot:$PATH; export PATH; perl mk-build-tree -p$srcdir/d2c/compiler/platforms.descr)
touch $buildroot/force.timestamp
], [
srcdir=$srcdir
buildroot=$buildroot
])
#--------------------------------------------------------------------
# Describe compilation scenario
#--------------------------------------------------------------------
echo
echo "Build scenario: $SCENARIO"
echo
case $SCENARIO in
REGULAR_BUILD)
echo "Compiling d2c. The installed version of d2c will be"
echo "used to compile programs written in Dylan."
;;
SECOND_STAGE)
echo "Compiling d2c. The recently compiled version of d2c"
echo "will be used to compile programs written in Dylan."
echo
echo "If you've already done a second stage build and installed"
echo "a working copy of d2c, you can try 'make bootstrap_clean'."
;;
BOOTSTRAPPING)
echo "The installed version of d2c will be used to bootstrap this"
echo "version of d2c. Alternatively, you may want to download"
echo "up-to-date binaries for your platform. See the README for"
echo "details."
;;
CROSS_COMPILING)
echo "You're trying to use d2c as a cross-compiler. You may encounter"
echo "various problems. If you get it to work, please tell us how"
echo "you did it."
;;
*)
echo "Unknown build scenario! This is a bug."
;;
esac
if test "$srcdir" != "$buildroot"; then
echo
echo "Warning: Your source directory does not appear to be the same as"
echo "your build directory. Note that several machine-generated source"
echo "files will be created in the source hierarchy instead of"
echo "the build hierarchy."
fi