forked from dylan-hackers/gwydion-2.4
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
1220 lines (1067 loc) · 42.1 KB
/
configure.ac
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
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
dnl $Header: /scm/cvs/src/configure.in,v 1.155.2.3 2004/10/17 23:14:45 andreas Exp $
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 [M] Mindy-specific
dnl [C] d2c-specific
dnl [?] Might be specific to one or the other
dnl
dnl One important restriction on this new configure file: we
dnl don't support building parts of the distribution with Mindy
dnl in the absense of d2c. If someone wants to reimplement those
dnl features so that they work, send us mail.
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.50, and start
# processing config.h.in.
#--------------------------------------------------------------------
AC_INIT([gywdion-dylan],[2.4.1pre2])
AC_PREREQ(2.50)
AC_CONFIG_SRCDIR(common/format/format.dylan)
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=40
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)
#--------------------------------------------------------------------
# [M] See if the #!interpreter syntax is supported.
#--------------------------------------------------------------------
AC_SYS_INTERPRETER
if test $ac_cv_sys_interpreter = no; then
AC_DEFINE(NO_SHARP_BANG)
fi
#--------------------------------------------------------------------
# Find out what type of system we appear to be, and work out
# whether there's any cross-compiling going on.
#--------------------------------------------------------------------
AC_CANONICAL_SYSTEM # Find the system type
AC_ARG_PROGRAM # Provide support for name prefixes
AC_DEFUN([GD_D2C_SYSTEM],[
case $1 in
i*86-*-linux*)
case `gcc -dumpversion` in
3.3*) $2=x86-linux-gcc33 ;;
3.2*) $2=x86-linux-gcc32 ;;
*) $2=x86-linux-gcc ;;
esac ;;
x86_64-*-linux-gnu*) $2=x86_64-linux-gcc ;;
i*86-pc-bsdi*) $2=x86-bsdi-gcc ;;
powerpc-*-linux-gnu*)
case `gcc -dumpversion` in
4.*) $2=ppc-linux-gcc4 ;;
3.2*) $2=ppc-linux-gcc32 ;;
*) $2=ppc-linux-gcc ;;
esac ;;
alpha*-*-linux-gnu*) $2=alpha-linux-gcc ;;
sparc*-*-linux-gnu*) $2=sparc-linux-gcc ;;
s390*-*-linux-gnu*) $2=s390-linux-gcc ;;
arm*-*-linux-gnu*) $2=arm-linux-gcc ;;
hppa*-hp-hpux*) $2=hppa-hpux-gcc ;;
sparc*-solaris*)
case `gcc -dumpversion` in
3.0*) $2=sparc-solaris-gcc30 ;;
*) $2=sparc-solaris-gcc ;;
esac ;;
sparc*-openbsd*) $2=sparc-openbsd-gcc ;;
sparc*-freebsd*) $2=sparc64-freebsd-gcc ;;
i*86-*-solaris*) $2=x86-solaris-gcc ;;
i*86-*-freebsd2.*) $2=x86-freebsd-aout-gcc ;;
i*86-*-freebsd*)
case `gcc -dumpversion` in
3.3*) $2=x86-freebsd-elf-gcc33 ;;
3.2*) $2=x86-freebsd-elf-gcc32 ;;
*) $2=x86-freebsd-elf-gcc ;;
esac ;;
i*86-pc-cygwin*)
case `gcc -dumpversion` in
3.2*) $2=x86-cygnus-gcc32 ;;
*) $2=x86-cygnus-gcc ;;
esac ;;
i*86-pc-mingw32*) $2=x86-mingw32-gcc32 ;;
i*86-pc-none) $2=x86-win32-vc ;;
i*86-pc-beos) $2=x86-beos-gcc ;;
powerpc-apple-darwin*) $2=ppc-darwin-gcc ;;
x86_64-apple-darwin*)
case $CC in
*clang*) $2=x86_64-darwin-clang ;;
*) $2=x86_64-darwin-gcc ;;
esac ;;
i*86-apple-darwin*)
case $CC in
*clang*) $2=x86-darwin-clang ;;
*) $2=x86-darwin-gcc ;;
esac ;;
mips-sgi-irix*) $2=mips-irix-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)
#----------------------------------------------------------
# Now that I know the build version, and particularly, if it's cygnus
# I can add executable endings to those filenames
# Douglas M. Auclair, doug@cotilliongroup.com
#----------------------------------------------------------
AC_MSG_CHECKING(executable endings)
exe_ext=""
cygnus_line_hack=""
case $d2c_build in
x86-cygnus*|x86-mingw*)
exe_ext=".exe"
cygnus_line_hack="\$_ =~ s/\r//;"
;;
esac
AC_MSG_RESULT($exe_ext)
AC_SUBST(exe_ext)
AC_SUBST(cygnus_line_hack)
AC_MSG_CHECKING(d2c target system type)
GD_D2C_SYSTEM($target,d2c_target)
AC_MSG_RESULT($d2c_target)
AC_SUBST(d2c_target)
AC_SUBST(host_cpu)
DYLAN_HOST_OS="`uname -s`"
AC_SUBST(DYLAN_HOST_OS)
DYLAN_OS_VERSION="`uname -r`"
AC_SUBST(DYLAN_OS_VERSION)
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
AM_INIT_AUTOMAKE
AC_PROG_INSTALL
AC_PROG_CC # Specify when cross-compiling.
AC_PROG_LEX
AC_PROG_YACC
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_MSG_CHECKING(whether to build shared libraries)
shared=no
if $LIBTOOL --features | grep 'enable shared libraries' > /dev/null; then
shared=yes
fi
AC_MSG_RESULT($shared)
AC_SUBST(shared)
AC_MSG_CHECKING(whether to build static libraries)
static=no
if $LIBTOOL --features | grep 'enable static libraries' > /dev/null; then
static=yes
fi
AC_MSG_RESULT($static)
AC_SUBST(static)
#--------------------------------------------------------------------
# Figure out what to do with Mindy.
#--------------------------------------------------------------------
# If self-compiling, always run mindy out of the build area, since the
# installed version might be wrong.
MINDY=$buildroot/mindy/interp/mindy
MC=$buildroot/mindy/comp/mindycomp
# Set DYLANPATH so that mindy can find the uninstalled libraries.
DYLANPATH=""
for dir in collection-extensions format format-out internal-time matrix print \
regular-expressions standard-io stream-ext streams string-ext table-ext time \
transcendental getopt network
do DYLANPATH=${DYLANPATH}":"$buildroot/common/$dir
done
for dir in random dylan inspector tk;
do DYLANPATH=${DYLANPATH}":"$buildroot/mindy/libraries/$dir
done
DYLANPATH='"'$DYLANPATH'"'
AC_SUBST(DYLANPATH)
AC_SUBST(MINDY)
AC_SUBST(MC)
#--------------------------------------------------------------------
# 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||'`
# Did the user try to disable d2c?
AC_ARG_ENABLE(d2c, [ --disable-d2c Do not build d2c])
enable_d2c=${enable_d2c:-yes}
# Does the user explicitly want a bootstrap?
AC_ARG_ENABLE(d2c-bootstrap,
[ --enable-d2c-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_d2c_bootstrap=${enable_d2c_bootstrap:-no}
# Did the user try to disable mindy?
AC_ARG_ENABLE(mindy, [ --disable-mindy Do not build Mindy])
enable_mindy=${enable_mindy:-yes}
# Did the user try to enable bootstrapping with Mindy?
AC_ARG_ENABLE(mindy-bootstrap,
[ --enable-mindy-bootstrap
Force bootstrap with Mindy. This can easily
take a couple of hours, and is normally
done only when porting d2c to a new
architecture for the first time. You
usually want to get precompiled d2c binaries
if any are available for your system. See
the README.])
enable_mindy_bootstrap=${enable_mindy_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"
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"
fi
lid_format_version=$_DCI_DYLAN_LID_FORMAT_VERSION
AC_SUBST(lid_format_version)
#--------------------------------------------------------------------
# Determine our "build scenario". See BOOTSTRAP for a description of
# how this works.
#--------------------------------------------------------------------
enable_bootstrap=no
bootstrap_compiler=none
if test "$D2C" = no -a "$enable_d2c=yes"; then
enable_mindy_bootstrap=yes
fi
AC_MSG_CHECKING("which build scenario to use")
if test -x "$buildroot/bootstrap_compiler/d2c"; then
SCENARIO=SECOND_STAGE
build_tools_with_d2c=yes
enable_mindy_bootstrap=no
bootstrap_d2c="$buildroot/bootstrap_compiler/d2c"
D2C="$bootstrap_d2c -p$srcdir/d2c/compiler/platforms.descr"
elif test "$enable_mindy_bootstrap" = yes; then
SCENARIO=BOOTSTRAPPING_WITH_MINDY
build_tools_with_d2c=no
enable_mindy=yes
enable_d2c=yes
enable_bootstrap=yes
bootstrap_compiler=mindy
# Set D2C (for use with 'make test', I think).
d2c_dbc="$buildroot/d2c/compiler/main/d2c.dbc"
D2C="$MINDY -f $d2c_dbc -p$srcdir/d2c/compiler/platforms.descr"
elif test "$enable_d2c" = no; then
SCENARIO=MINDY_BUILD
build_tools_with_d2c=no
elif test "$D2C" != no; then
if test $CURRENT_BOOTSTRAP_COUNTER -ne $_DCI_D2C_BOOTSTRAP_COUNTER \
-o "$enable_d2c_bootstrap" = yes
then
SCENARIO=BOOTSTRAPPING_WITH_D2C
enable_mindy=no
build_tools_with_d2c=yes
enable_bootstrap=yes
bootstrap_compiler=d2c
shared=no
elif test "$d2c_cross_compiling" = yes; then
SCENARIO=CROSS_COMPILING
build_tools_with_d2c=yes # XXX - this won't work at all
enable_mindy=no
else
SCENARIO=REGULAR_BUILD
build_tools_with_d2c=yes
fi
else
SCENARIO=MINDY_BUILD
build_tools_with_d2c=no
fi
AC_MSG_RESULT($SCENARIO)
echo "Using the following build parameters:"
echo " Build Mindy: $enable_mindy"
echo " Build d2c: $enable_d2c"
echo " Build tools with d2c: $build_tools_with_d2c"
echo " Cross compiling: $d2c_cross_compiling"
echo " Bootstrapping: $enable_bootstrap"
echo " Bootstrap compiler: $bootstrap_compiler"
#--------------------------------------------------------------------
# Sanity-check our "build scenario". Certain combinations should never
# appear.
#--------------------------------------------------------------------
if test "$enable_mindy" = "no" -a "$enable_d2c" = "no" ; then
AC_MSG_ERROR([\
Not intending to build either mindy or d2c. Please check to see if
your system is supported, or specify fewer --disable-FOO flags.])
fi
if test "$SCENARIO" != CROSS_COMPILING -a "$d2c_cross_compiling" = yes; then
AC_MSG_ERROR([\
Cannot cross-compile. In particular, cross-compilation is
incompatible with bootstrapping and Mindy-only builds. You need an up-to-date
d2c binary installed somewhere in your path. Even then, cross-compilation
will probably fail. See BOOTSTRAPPING for details.])
fi
#--------------------------------------------------------------------
# Record our build parameters.
#--------------------------------------------------------------------
AC_SUBST(enable_mindy)
AC_SUBST(enable_d2c)
AC_SUBST(build_tools_with_d2c)
AC_SUBST(d2c_cross_compiling)
AC_SUBST(enable_bootstrap)
AC_SUBST(bootstrap_compiler)
AC_SUBST(enable_d2c_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_WITH_D2C 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_WITH_D2C; 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(dld, shl_load, [AC_DEFINE(HAVE_LIBDLD)
LIBS="$LIBS -ldld"])
AC_CHECK_LIB(dl, dlopen,[AC_DEFINE(HAVE_LIBDLDELF)
AC_DEFINE(HAVE_LIBDLD)
AC_LIBOBJ([shl])
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"])
#--------------------------------------------------------------------
# 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"
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"
FOUND_BOEHM=no
AC_CHECK_HEADERS(gc.h gc/gc.h, FOUND_BOEHM=yes,)
if test "$FOUND_BOEHM" = no; 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, FOUND_BOEHM=yes,)
fi
fi
if test "$FOUND_BOEHM" = no; 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_SUBST(GC_CFLAGS)
AC_SUBST(GC_LIBS)
#--------------------------------------------------------------------
# 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(time.h sys/time.h sys/resource.h)
AC_CHECK_FUNCS(getrlimit getrusage)
#--------------------------------------------------------------------
# Look for GTK+, set GTK_CFLAGS and GTK_LIBS
#--------------------------------------------------------------------
AC_ARG_WITH(gtk, [ --with-gtk Enable the GTK and GLIB bindings],,with_gtk=no)
case $with_gtk in
no) HAVE_GTK=no
;;
yes) AM_PATH_GTK(1.2.0,HAVE_GTK=yes,HAVE_GTK=no)
;;
esac
AC_SUBST(HAVE_GTK)
#--------------------------------------------------------------------
# Look for Carbon, set CARBON_CFLAGS and CARBON_LIBS
#--------------------------------------------------------------------
AC_ARG_WITH(carbon, [ --with-carbon Enable the Carbon bindings],,with_carbon=no)
case $with_carbon in
no) HAVE_CARBON=no
;;
yes) if test $d2c_host = ppc-darwin-gcc; then
HAVE_CARBON=yes
else
HAVE_CARBON=no
fi
;;
esac
AC_SUBST(HAVE_CARBON)
#--------------------------------------------------------------------
# Determine whether or not to compile DUIM
#--------------------------------------------------------------------
AC_MSG_CHECKING(for DUIM support)
AC_ARG_ENABLE(duim, [ --enable-duim=[no/yes/gtk/carbon] Enable the Dylan User Interface Manager],,enable_duim=no)
case $enable_duim in
no) ;;
vanilla);;
gtk) if test $HAVE_GTK = yes; then
enable_duim=gtk
else
enable_duim=no
fi
;;
carbon) if test $HAVE_CARBON = yes; then
enable_duim=carbon
else
enable_duim=no
fi
;;
yes) if test $HAVE_GTK = yes; then
enable_duim=gtk
elif test $HAVE_CARBON = yes; then
enable_duim=carbon
else
enable_duim=no
fi
;;
*) AC_MSG_ERROR(Unknown platform for DUIM)
;;
esac
AC_MSG_RESULT($enable_duim)
AC_SUBST(enable_duim)
#--------------------------------------------------------------------
# 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)
if test $enable_debug = yes; then
AC_DEFINE(GD_DEBUG)
fi
case `basename $CC` in
gcc* | *-gcc*)
if test $enable_debug = yes; then
CCOPTS="-g -O -fno-inline -Wall -pedantic"
elif test $enable_debug = minimum; then
CCOPTS="-g -O2 -Wall"
else
CCOPTS="-O4"
fi
EXTRA_INCLUDE_DIR="`gcc --print-file-name=include`"
if test "X$EXTRA_INCLUDE_DIR" = Xinclude; then
EXTRA_INCLUDE_DIR=
fi
;;
cl|cl.exe)
if test $enable_debug = yes; then
CCOPTS="-nologo /W3 /ZI/Ge"
else
CCOPTS="-nologo"
fi
;;
*)
CCOPTS="-g -O"
;;
esac
AC_SUBST(CCOPTS)
AC_SUBST(EXTRA_INCLUDE_DIR)
#--------------------------------------------------------------------
# Establish the default options for lex
#--------------------------------------------------------------------
if test $LEX = flex; then
LFLAGS=${LFLAGS--i}
else
AC_MSG_ERROR(Cannot build without flex to build mindy/comp/lexer-tab.c)
fi
AC_SUBST(LFLAGS)
#--------------------------------------------------------------------
# Establish the default options for yacc
#--------------------------------------------------------------------
if test "$YACC" = "bison -y"; then
# do nothing (an empty then clause is a syntax error)
DUMMY=dummy
else
AC_MSG_ERROR(Cannot build without bison to build mindy/comp/parser-tab.c)
fi
#--------------------------------------------------------------------
# Determine whether the time library can be supported
#--------------------------------------------------------------------
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)],
[AC_MSG_RESULT(no)
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)],
[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_CYGNUS_DAYLIGHT)])])])
#--------------------------------------------------------------------
# Find out if sigaction is available.
#--------------------------------------------------------------------
AC_FUNC_CHECK(sigaction, sigaction=1, sigaction=0)
if test $sigaction = 0; then
AC_DEFINE(NO_SIGACTION)
AC_LIBOBJ([sigaction])
AC_FUNC_CHECK(sigsetmask, sigsetmask=1, sigsetmask=0)
AC_FUNC_CHECK(sigrelse, sigrelse=1, sigrelse=0)
if test $sigsetmask = 1; then
echo "BSD_signals"
AC_DEFINE(BSD_SIGNALS)
elif test $sigrelse = 1; then
echo "USG_signals"
AC_DEFINE(USG_SIGNALS)
else
echo "I couldn't find posix, bsd, or sysV signal support."
echo "You may be able to compile compat/sigaction.c by hand."
fi
fi
#--------------------------------------------------------------------
# This next section is lifted from tcl-7.3, it deals with
# establishing which of the known faults in POSIX compliance
# need to be corrected.
#--------------------------------------------------------------------
#--------------------------------------------------------------------
# Supply substitutes for missing POSIX library procedures, or
# set flags so Tcl uses alternate procedures.
#--------------------------------------------------------------------
AC_REPLACE_FUNCS(getcwd opendir strerror strstr)
AC_REPLACE_FUNCS(strtol memmove tmpnam waitpid)
AC_CHECK_FUNC(gettimeofday, , AC_DEFINE(NO_GETTOD))
AC_CHECK_FUNC(getwd, , AC_DEFINE(NO_GETWD))
AC_CHECK_FUNC(wait3, , AC_DEFINE(NO_WAIT3))
#--------------------------------------------------------------------
# Supply substitutes for missing POSIX header files. Special
# notes:
# - Sprite's dirent.h exists but is bogus.
# - stdlib.h doesn't define strtol, strtoul, or
# strtod insome versions of SunOS
# - some versions of string.h don't declare procedures such
# as strstr
#--------------------------------------------------------------------
AC_HEADER_CHECK(unistd.h, , AC_DEFINE(NO_UNISTD_H))
AC_MSG_CHECKING(dirent.h)
AC_TRY_COMPILE([#include <sys/types.h>
#include <dirent.h>], [
DIR *d;
struct dirent *entryPtr;
char *p;
d = opendir("foobar");
entryPtr = readdir(d);
p = entryPtr->d_name;
closedir(d);
], tcl_ok=1, tcl_ok=0)
AC_EGREP_HEADER([Sprite version.* NOT POSIX], dirent.h, tcl_ok=0)
if test $tcl_ok = 0; then
AC_DEFINE(NO_DIRENT_H)
AC_MSG_RESULT(no dirent.h)
else
AC_MSG_RESULT(yes)
fi
AC_CHECK_HEADER(errno.h, , AC_DEFINE(NO_ERRNO_H))
AC_CHECK_HEADER(float.h, , AC_DEFINE(NO_FLOAT_H))
AC_CHECK_HEADER(limits.h, , AC_DEFINE(NO_LIMITS_H))
AC_CHECK_HEADER(bstring.h, , AC_DEFINE(NO_BSTRING_H))
AC_CHECK_HEADER(stdlib.h, tcl_ok=1, tcl_ok=0)
AC_EGREP_HEADER(getenv, stdlib.h, , tcl_ok=0)
AC_EGREP_HEADER(strtol, stdlib.h, , tcl_ok=0)
AC_EGREP_HEADER(strtoul, stdlib.h, , tcl_ok=0)
AC_EGREP_HEADER(strtod, stdlib.h, , tcl_ok=0)
if test $tcl_ok = 0; then
AC_DEFINE(NO_STDLIB_H)
fi
AC_CHECK_HEADER(string.h, tcl_ok=1, tcl_ok=0)
AC_EGREP_HEADER(strstr, string.h, , tcl_ok=0)
AC_EGREP_HEADER(strerror, string.h, , tcl_ok=0)
if test $tcl_ok = 0; then
AC_DEFINE(NO_STRING_H)
fi
AC_EGREP_HEADER(setsid, unistd.h, tcl_ok=1, tcl_ok=0)
if test $tcl_ok = 0; then
AC_LIBOBJ([setsid])
fi
AC_CHECK_HEADER(sys/time.h, , AC_DEFINE(NO_SYS_TIME_H))
AC_CHECK_HEADER(sys/wait.h, , AC_DEFINE(NO_SYS_WAIT_H))
#--------------------------------------------------------------------
# Include sys/select.h if it exists and if it supplies things
# that appear to be useful and aren't already in sys/types.h.
# This appears to be true only on the RS/6000 under AIX. Some
# systems like OSF/1 have a sys/select.h that's of no use, and
# other systems like SCO UNIX have a sys/select.h that's
# pernicious. If "fd_set" isn't defined anywhere then set a
# special flag.
#--------------------------------------------------------------------
AC_MSG_CHECKING(fd_set)
AC_TRY_COMPILE([#include <sys/types.h>],
[fd_set readMask, writeMask;], AC_MSG_RESULT(yes),
[AC_EGREP_HEADER(fd_mask, sys/select.h, AC_DEFINE(HAVE_SYS_SELECT_H)
AC_DEFINE(NO_FD_SET))
AC_MSG_RESULT(no fd_set)])
# On the HP, select is defined in sys/time.h
#
AC_EGREP_HEADER(select, sys/time.h, AC_DEFINE(SELECT_IN_TIME_H))
#--------------------------------------------------------------------
# On some systems strstr is broken: it returns a pointer even
# even if the original string is empty.
#--------------------------------------------------------------------
AC_TRY_RUN([
extern int strstr();
int main()
{
exit(strstr("\0test", "test") ? 1 : 0);
}
], , [AC_LIBOBJ([strstr])], [AC_LIBOBJ([strstr]) ])
#--------------------------------------------------------------------
# Check for strtoul function. This is tricky because under some
# versions of AIX strtoul returns an incorrect terminator
# pointer for the string "0".
#--------------------------------------------------------------------
AC_CHECK_FUNC(strtoul, tcl_ok=1, tcl_ok=0)
AC_TRY_RUN([
extern int strtoul();
int main()
{
char *string = "0";
char *term;
int value;
value = strtoul(string, &term, 0);
if ((value != 0) || (term != (string+1))) {
exit(1);
}
exit(0);
}], , tcl_ok=0, tcl_ok=0)
if test $tcl_ok = 0; then
AC_LIBOBJ([strtoul.])
fi
#--------------------------------------------------------------------
# Check for the strtod function. This is tricky because under
# some versions of Linux it mis-parses the string "+".
#--------------------------------------------------------------------
AC_CHECK_FUNC(strtod, tcl_ok=1, tcl_ok=0)
AC_TRY_RUN([
extern double strtod();
int main()
{
char *string = "+";
char *term;
double value;
value = strtod(string, &term);
if (term != string) {
exit(1);
}
exit(0);
}], , tcl_ok=0, tcl_ok=0)
if test $tcl_ok = 0; then
AC_LIBOBJ([strtod.o])
fi
#--------------------------------------------------------------------
# Check for various typedefs and provide substitutes if
# they don't exist.
#--------------------------------------------------------------------
AC_TYPE_MODE_T
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_TYPE_UID_T
#--------------------------------------------------------------------
# If a system doesn't have an opendir function (man, that's old!)
# then we have to supply a different version of dirent.h which
# is compatible with the substitute version of opendir that's
# provided. This version only works with V7-style directories.
#--------------------------------------------------------------------
AC_CHECK_FUNC(opendir, , AC_DEFINE(USE_DIRENT2_H))
#--------------------------------------------------------------------
# Check for the existence of sys_errlist (this is only needed if
# there's no strerror, but I don't know how to conditionalize the
# check).
#--------------------------------------------------------------------
AC_MSG_CHECKING(sys_errlist)
AC_TRY_COMPILE( , [
extern char *sys_errlist[];
extern int sys_nerr;
sys_errlist[sys_nerr-1][0] = 0;
], AC_MSG_RESULT(yes),
[AC_DEFINE(NO_SYS_ERRLIST)
AC_MSG_RESULT(no sys_errlist)])
#--------------------------------------------------------------------
# The check below checks whether <sys/wait.h> defines the type
# "union wait" correctly. It's needed because of weirdness in
# HP-UX where "union wait" is defined in both the BSD and SYS-V
# environments. Checking the usability of WIFEXITED seems to do
# the trick.
#--------------------------------------------------------------------
AC_MSG_CHECKING(union wait)
AC_TRY_COMPILE([#include <sys/types.h>
#include <sys/wait.h>], [
union wait x;
WIFEXITED(x); /* Generates compiler error if WIFEXITED
* uses an int. */
], AC_MSG_RESULT(yes),
[AC_DEFINE(NO_UNION_WAIT)
AC_MSG_RESULT(no union wait)])
#--------------------------------------------------------------------
# Check to see whether the system supports the matherr function
# and its associated type "struct exception".
#--------------------------------------------------------------------