This repository was archived by the owner on Nov 1, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathconfigure
executable file
·569 lines (554 loc) · 13.3 KB
/
configure
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
#! /bin/sh
# Configuration script for LML/Haskell B
n="-n"
c=""
#echo=/bin/echo
echo=echo
# Until `read' works in bash on cygwin32 we have to fudge it.
dummyread=':'
if [ "X`$echo $n`" = "X-n" ] ; then n=""; c="\c"; fi
$echo "Configuration of LML/Haskell B."
$echo "Please answer these questions, the default answer is within []."
#
x_linkflags=''
x_h12='no' # 'yes', 'no'
x_exe='' # normally no suffix for executables
x_extra=''
x_mtarget='' # m_80386, ...
x_static='' # '', '-Bstatic'
x_ilml='[a-z]*.o' # 'Dummy.o', '[a-z]*.o'
x_system='-DSUNOS4' # '', '-DSYSV', '-DSUNOS4'
x_haskell='HASKELL' # '', 'HASKELL'
x_heapprof='' # '', 'HEAPPROF'
x_timeprof='' # '', 'TIMEPROF'
x_cc='gcc'
x_lib='/usr/local/lib/lmlc'
x_bin='/usr/local/bin'
x_man='/usr/local/man/man1'
lifdef='/usr/local/lib/lmlc'
if [ -r config.status ] ; then
$echo "There is an old config.status file."
$echo $n "Take defaults from this [y]? " $c
read ans
case "$ans" in
[nN]*)
;;
*)
. ./config.status
;;
esac
if [ "$x_system" = "-D__CYGWIN32__" ]; then
dummyread='read dummy'
$dummyread
fi
fi
stop=0
while [ $stop -eq 0 ]; do
$echo $n "Target architecture [$x_mtarget]? " $c
read ans
$dummyread
if [ -z "$ans" ] ; then ans="$x_mtarget"; fi
stop=1
ans=`echo "$ans" | tr A-Z a-z`
case "$ans" in
m_80386 | 386 | 486 | i386 | i486 | 586 | pentium )
x_mtarget=m_80386
if [ "$x_system" = "-D__386BSD__" ] ; then def=386bsd
elif [ "$x_system" = "-D__NetBSD__" ] ; then def=netbsd
elif [ "$x_system" = "-D__FreeBSD__=2" ] ; then def=freebsd
elif [ "$x_system" = "-Dlinux" ] ; then def=linux
elif [ "$x_system" = "-DDYNIX" ] ; then def=dynix
elif [ "$x_system" = "-DSOLARIS" ] ; then def=solaris
elif [ "$x_system" = "-D__CYGWIN32__" ] ; then def=cygwin32
else def=''; fi
$echo $n "What operating system are you running [$def]? " $c
read ans
$dummyread
if [ -z "$ans" ] ; then ans=$def; fi
case "$ans" in
386bsd | linux | dynix | netbsd | solaris | freebsd | cygwin32)
;;
* )
$echo "Use one of 386bsd, linux, dynix, netbsd, freebsd, solaris, or cygwin32"
exit 1
;;
esac
sysname=$ans
;;
m_sparc | sparc )
x_mtarget=m_sparc
if [ "$x_system" = "-DSUNOS4" ] ; then def=n; else def=y; fi
$echo $n "Are you running Solaris 2.x [$def]? " $c
read ans
if [ -z "$ans" ] ; then ans=$def; fi
case "$ans" in
[yY]*)
sysname=solaris
;;
*)
sysname=sunos4
;;
esac
;;
m_68000 | 68000 | m68000 | m68k | 68k | 68020 | 68030 | 68040 )
x_mtarget=m_68000
if [ "$x_system" = "-DSUNOS4" ] ; then def=sunos4
elif [ "$x_system" = "-DSUNOS3" ] ; then def=sunos3
elif [ "$x_system" = "-D__NetBSD__" ] ; then def=netbsd
else def=''; fi
$echo $n "What operating system are you running [$def]? " $c
read ans
if [ -z "$ans" ] ; then ans=$def; fi
case "$ans" in
sunos4 | sunos3 | netbsd)
sysname=$ans
;;
*)
$echo "Use one of sunos3, sunos4, netbsd"
exit 1
;;
esac
;;
m_vax | vax )
x_mtarget=m_vax
sysname=bsd4x
;;
m_mips | mips )
x_mtarget=m_mips
if [ "$x_system" = "-Dultrix" ] ; then def=ultrix; else def=irix; fi
$echo $n "Are you running ultrix or irix [$def]? " $c
read ans
if [ -z "$ans" ] ; then ans=$def; fi
case "$ans" in
ultrix)
sysname=ultrix
;;
irix)
sysname=irix
;;
*)
echo "You must run either ultrix or irix, sorry."
exit 1
;;
esac
;;
m_rs6000 | m_power | m_powerpc | rs6000 | power | powerpc )
x_mtarget=m_rs6000
sysname=aix
;;
m_alpha | alpha )
x_mtarget=m_alpha
sysname=osf
;;
m_hppa | hppa | pa )
x_mtarget=m_hppa
sysname=hpux
;;
* )
$echo "Unknown target. Use m_80386, m_sparc, m_68000, m_vax, m_rs6000, m_hppa, or m_mips."
stop=0
;;
esac
done
$echo $n "What C compiler do you want to use (may include extra flags) [$x_cc]? " $c
read ans
$dummyread
if [ "$ans" ] ; then x_cc="$ans"; fi
if [ "$x_cc" = "gcc" ] ; then x_gcclink=-DGCCLINK; else x_gcclink=''; fi
$echo "Target machine: $x_mtarget, target OS: $sysname, C compiler: '$x_cc'"
$echo '/lib/cpp $*' > bin/mycpp
$echo 'grep -s "$@"' > bin/mygreps
$echo "$x_cc"' $*' > bin/mycc
$echo 'sh ../bin/myld -r -o $*' > bin/joinobj
$echo '/bin/ld $*' > bin/myld
$echo 'ranlib $*' > bin/myranlib
$echo 'as $*' > bin/myas
$echo 'yacc $*' > bin/myyacc
$echo 'lex $*' > bin/mylex
$echo '' > bin/buildshlib
y_static="$x_static"
x_static=''
isys='../bin/myld -T 0 -r -o $*'
x_iaout=''
x_iaoutobjs=''
x_idynlib=''
x_idynliblinks=''
x_idynlibobjs=''
case $sysname in
cygwin32)
x_system='-D__CYGWIN32__'
x_exe='.exe'
isys=''
$echo 'rm -f $1; ar cr $*' > bin/joinobj
$echo '/usr/bin/cpp -traditional -\$ $*' > bin/mycpp
$echo '/usr/bin/ld $*' > bin/myld
$echo '/usr/bin/as $*' > bin/myas
$echo 'grep -q "$@"' > bin/mygreps
$echo 'bison -y $*' > bin/myyacc
$echo 'flex -l $*' > bin/mylex
;;
386bsd)
x_system='-D__386BSD__'
$echo '/usr/libexec/cpp -traditional -\$ $*' > bin/mycpp
;;
linux)
x_system='-Dlinux'
$echo '/lib/cpp -traditional -\$ $*' > bin/mycpp
$echo '/usr/bin/ld $*' > bin/myld
$echo 'grep -q "$@"' > bin/mygreps
if [ -z "$y_static" ] ; then def=n; else def=y; fi
$echo $n "Do you want the binaries statically linked [$def]? " $c
read ans
if [ -z "$ans" ] ; then ans=$def; fi
case "$ans" in
[yY]*)
x_static='-static'
;;
*)
x_static=''
;;
esac
isys='noop'
$echo 'shift; ld -shared -o $*' > bin/buildshlib
x_idynliblinks=-ldl
x_idynlib=-DI_DYNLIB
x_linkflags=-K-rdynamic
;;
dynix)
x_system='-DDYNIX'
;;
solaris)
x_system='-DSOLARIS'
$echo '/usr/ccs/bin/ld $*' > bin/myld
$echo '/usr/ccs/lib/cpp $*' > bin/mycpp
$echo 'grep "$@" >/dev/null' > bin/mygreps
$echo '' > bin/myranlib
$echo "$x_cc -I/usr/ucbinclude"' $*' > bin/mycc
$echo '/usr/ccs/bin/as $*' > bin/myas
if [ -z "$y_static" ] ; then def=n; else def=y; fi
$echo "With static linking, you cannot load shared libraries"
$echo "in the interactive system."
$echo $n "Do you want the binaries statically linked [$def]? " $c
read ans
if [ -z "$ans" ] ; then ans=$def; fi
case "$ans" in
[yY]*)
# not with GCC x_static='-Bstatic'
x_static='-static'
if [ $x_cc = cc ] ; then x_static='-Bstatic'; fi
;;
*)
x_static=''
;;
esac
$echo 'shift; ld -G -o $*' > bin/buildshlib
x_idynlib=-DI_DYNLIB
if [ -z "$x_static" ] ; then x_idynliblinks=-ldl ; fi
isys='noop'
#isys='gld -Ttext 0 -r -oformat a.out-sunos-big -o $*'
;;
sunos4)
x_system='-DSUNOS4'
if [ -z "$y_static" ] ; then def=n; else def=y; fi
$echo $n "Do you want the binaries statically linked [$def]? " $c
read ans
if [ -z "$ans" ] ; then ans=$def; fi
case "$ans" in
[yY]*)
# not with GCC x_static='-Bstatic'
x_static='-static'
if [ $x_cc = cc ] ; then x_static='-Bstatic'; fi
;;
*)
x_static=''
;;
esac
# yacc doesn't have enough states
$echo 'bison -y $*' > bin/myyacc
$echo '/bin/grep -s "$@"' > bin/mygreps
;;
sunos3)
x_system='-DSUNOS3'
;;
aix)
x_system='-D_AIX'
$echo 'grep -q "$@"' > bin/mygreps
$echo '/usr/ccs/lib/cpp $*' > bin/mycpp
isys=''
;;
bsd4x)
x_system='-DBSD4'
;;
ultrix)
x_system='-Dultrix'
;;
hpux)
x_system='-DHPUX'
$echo 'grep -q "$@"' > bin/mygreps
$echo 'yacc -Nm25000 -Ns5000 $*' > bin/myyacc
$echo "$x_cc"' -w2 $*' > bin/mycc
$echo '' > bin/myranlib
isys=''
;;
irix)
x_system='-DIRIX'
$echo '' > bin/myranlib
$echo 'grep "$@" >/dev/null' > bin/mygreps
$echo 'as -w $*' > bin/myas
;;
netbsd | freebsd)
if [ $sysname = freebsd ] ; then
x_system='-D__FreeBSD__=2'
else
x_system='-D__NetBSD__'
fi
$echo '/usr/libexec/cpp -traditional -\$ $*' > bin/mycpp
$echo 'grep -q "$@"' > bin/mygreps
$echo '/usr/bin/ld $*' > bin/myld
if [ -z "$y_static" ] ; then def=n; else def=y; fi
$echo "With static linking, you cannot load shared libraries"
$echo "in the interactive system."
$echo $n "Do you want the binaries statically linked [$def]? " $c
read ans
if [ -z "$ans" ] ; then ans=$def; fi
case "$ans" in
[yY]*)
x_static='-static'
;;
*)
x_static=''
;;
esac
# ld screams a lot about our object files
$echo 'shift; ld -Bshareable -o $* 2>&1 | (grep -v "text relocation" || true)' > bin/buildshlib
x_idynlib=-DI_DYNLIB
;;
osf)
if [ "$x_cc" = cc ] ; then
$echo 'if [ "$1" = "-static" ] ; then shift; fi' > bin/mycc
$echo 'cc $*' >> bin/mycc
fi
x_system='-DOSF'
$echo 'grep -q "$@"' > bin/mygreps
if [ -z "$y_static" ] ; then def=n; else def=y; fi
$echo $n "Do you want the binaries statically linked [$def]? " $c
read ans
if [ -z "$ans" ] ; then ans=$def; fi
case "$ans" in
[yY]*)
x_static='-static'
;;
*)
x_static=''
;;
esac
cat > bin/buildshlib << 'EOF'
sofile=../lib/so_locations
if [ ! -w $sofile ] ; then cp /usr/shlib/so_locations $sofile; chmod +w $sofile; fi
dir=$1
name=$2
shift 2
/bin/ld -expect_unresolved '*' -shared -update_registry $sofile -all -soname $dir/$name -o $name $*
EOF
x_idynlib=-DI_DYNLIB
isys='noop'
;;
*)
$echo Unknown system $sysname.
exit 1
;;
esac
if [ -z "$x_haskell" ] ; then def=n; else def=y; fi
$echo $n "Do you want Haskell [$def]? " $c
read ans
$dummyread
if [ -z "$ans" ] ; then ans=$def; fi
case "$ans" in
[nN]*)
x_haskell=''
;;
*)
x_haskell='HASKELL'
;;
esac
if [ ! -z "$x_haskell" ]; then
if [ "$x_h12" = "yes" ]; then def=y; else def=n; fi
$echo $n "Do you want Haskell 1.2 (obsolete) [$def]? " $c
read ans
$dummyread
if [ -z "$ans" ]; then ans=$def; fi
case "$ans" in
[nN]*)
x_h12=no
;;
*)
x_h12=yes
;;
esac
fi
if [ -z "$isys" ]
then
$echo "Sorry, you cannot run the interactive version on this platform."
x_ilml='Dummy.o'
else
if [ "$x_ilml" = "Dummy.o" ] ; then def=n; else def=y; fi
$echo $n "Do you want the interactive system [$def]? " $c
read ans
if [ -z "$ans" ] ; then ans=$def; fi
case "$ans" in
[nN]*)
x_ilml='Dummy.o'
x_idynlib=''
x_idynliblinks=''
x_lmlx=''
;;
*)
x_ilml='[a-z]*.o'
if [ ! "$isys" = "noop" ]
then x_iaout=-DI_AOUT
x_iaoutobjs="loadmodule.o load.o loadc.o getgp.o"
fi
if [ ! -z "$x_idynlib" ]
then if [ ! -z "$x_static" ]
then dynl=Dynlib_stupid.o
else dynl=Dynlib_c.o; fi
x_ilml="$x_ilml ilml/$dynl"
x_idynlibobjs="dynlib.o $dynl"
fi
if [ -z "$x_lmlx" ]; then def=n; else def=y; fi
$echo $n "Do you want the Fudget (X-windows) version of hbi [$def]? " $c
read ans
if [ -z "$ans" ] ; then ans=$def; fi
case "$ans" in
[nN]*)
x_lmlx=''
;;
*)
x_lmlx='-lmlx -i/usr/local/lib/lmlc/lmlx'
;;
esac
esac
fi
if [ "$isys" = "noop" ] ; then isys='touch $1'; fi
$echo "$isys" > bin/mkiprel
chmod +x bin/mycpp bin/mygreps bin/mycc bin/myld bin/myranlib bin/buildshlib bin/mkiprel bin/myas bin/myyacc bin/mylex bin/joinobj
#$echo 'If you want any extra flags to the compiler add them here.'
#def="$x_extra"
#$echo $n "Extra compiler flags [$def]? " $c
#read ans
#if [ -z "$ans" ] ; then ans=$def; fi
#x_extra="$ans"
x_extra=""
$echo 'Compiling library code for profiling takes a lot of time.'
if [ -z "$x_heapprof" ] ; then def=n; else def=y; fi
$echo $n "Do you want heap profiling [$def]? " $c
read ans
$dummyread
if [ -z "$ans" ] ; then ans=$def; fi
case "$ans" in
[yY]*)
x_heapprof='HEAPPROF'
;;
*)
x_heapprof=''
esac
if [ -z "$x_timeprof" ] ; then def=n; else def=y; fi
$echo $n "Do you want time profiling [$def]? " $c
read ans
$dummyread
if [ -z "$ans" ] ; then ans=$def; fi
case "$ans" in
[yY]*)
x_timeprof='TIMEPROF'
;;
*)
x_timeprof=''
esac
$echo $n "Where do you want the runnable binaries installed [$x_bin]? " $c
read ans
$dummyread
if [ -z "$ans" ] ; then ans="$x_bin"; fi
x_bin="$ans"
$echo $n "Where do you want the libraries installed [$x_lib]? " $c
read ans
$dummyread
if [ -z "$ans" ] ; then ans="$x_lib"; fi
x_lib="$ans"
$echo $n "Where do you want the (unformatted) man pages installed [$x_man]? " $c
read ans
$dummyread
if [ -z "$ans" ] ; then ans="$x_man"; fi
x_man="$ans"
cat << eof > config.status
x_h12='$x_h12'
x_mtarget='$x_mtarget'
x_static='$x_static'
x_system='$x_system'
x_ilml='$x_ilml'
x_haskell='$x_haskell'
x_heapprof='$x_heapprof'
x_timeprof='$x_timeprof'
x_bin='$x_bin'
x_lib='$x_lib'
x_man='$x_man'
x_extra='$x_extra'
x_cc='$x_cc'
x_lmlx='$x_lmlx'
eof
if [ "$x_ilml" = "Dummy.o" ] ; then
x_dilml=Dummy.o
x_iinst='noinstall'
x_ihaskell='noinstall'
else
x_dilml=''
x_iinst='install ${HASKELL}'
x_ihaskell='haskell'
fi
if [ -n "$x_haskell" ] ; then x_haskell='${'"$x_haskell}"; fi
if [ -n "$x_heapprof" ] ; then x_heapprof='${'"$x_heapprof}"; fi
if [ -n "$x_timeprof" ] ; then x_timeprof='${'"$x_timeprof}"; fi
cat << eof > mk.sed
s/XX_LINKFLAGS/$x_linkflags/
s/XX_H12/$x_h12/
s/XX_EXE/$x_exe/
s/XX_MTARGET/$x_mtarget/
s/XX_STATIC/$x_static/
s/XX_SYSTEM/$x_system/
s'XX_ILML'$x_ilml'
s/XX_DILML/$x_dilml/
s/XX_IINST/$x_iinst/
s/XX_HASKELL/$x_haskell/
s/XX_IHASKELL/$x_ihaskell/
s/XX_HEAPPROF/$x_heapprof/
s/XX_TIMEPROF/$x_timeprof/
s'XX_LMLX'$x_lmlx'
s'XX_BIN'$x_bin'
s'XX_LIB'$x_lib'
s'XX_MAN'$x_man'
s'XX_EXTRA'$x_extra'
s'XX_IDEFS'$x_iaout $x_idynlib'
s'XX_IEXTRA_OJBS'$x_iaoutobjs $x_idynlibobjs'
s'XX_ILINKS'$x_idynliblinks'
s/XX_GCCLINK/$x_gcclink/
eof
cat << eof > bin/edlib
#! /bin/sh -e
sed -e "s%XX_LIB%$x_lib%" < \$1 > \$2
chmod +x \$2
eof
chmod +x bin/edlib
touch Makefile
mv Makefile Makefile.bak
$echo '# THIS FILE IS PRODUCED FROM Makefile.in' > Makefile
sed -f mk.sed Makefile.in >> Makefile
sed -f mk.sed bin/asm.in > bin/asm
chmod +x bin/asm
rm mk.sed
$echo ' '
$echo 'Configuration complete. Now do'
$echo ' make universe'
$echo 'and wait for a long time. If it completes without errors do'
$echo ' make install'
$echo 'to install the new compiler. This step also takes a long time.'
$echo ' '
$echo ' Good luck!'