-
Notifications
You must be signed in to change notification settings - Fork 0
/
Configure
executable file
·6569 lines (6166 loc) · 142 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
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
#! /bin/sh
#
# If these # comments don't work, trim them. Don't worry about any other
# shell scripts, Configure will trim # comments from them for you.
#
# (If you are trying to port this package to a machine without sh,
# I would suggest you have a look at the prototypical config_h.SH file
# and edit it to reflect your system. Some packages may include samples
# of config.h for certain machines, so you might look for one of those.)
#
# Yes, you may rip this off to use in other distribution packages. This
# script belongs to the public domain and cannot be copyrighted.
#
# (Note: this Configure script was generated automatically. Rather than
# working with this copy of Configure, you may wish to get metaconfig.
# The dist-3.0 package (which contains metaconfig) was posted in
# comp.sources.misc and is available on CPAN under authors/id/RAM so
# you may fetch it yourself from your nearest archive site.)
#
# $Id$
#
# Generated on Sun Aug 10 11:58:23 PDT 2003 [metaconfig 3.0 PL70]
# (with additional metaconfig patches by [email protected])
cat >/tmp/c1$$ <<EOF
ARGGGHHHH!!!!!
SCO csh still thinks true is false. Write to SCO today and tell them that next
year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
(Actually, Configure ought to just patch csh in place. Hmm. Hmmmmm. All
we'd have to do is go in and swap the && and || tokens, wherever they are.)
[End of diatribe. We now return you to your regularly scheduled programming...]
EOF
cat >/tmp/c2$$ <<EOF
OOPS! You naughty creature! You didn't run Configure with sh!
I will attempt to remedy the situation by running sh for you...
EOF
true || cat /tmp/c1$$ /tmp/c2$$
true || exec sh $0 $argv:q
(exit $?0) || cat /tmp/c2$$
(exit $?0) || exec sh $0 $argv:q
rm -f /tmp/c1$$ /tmp/c2$$
: compute my invocation name
me=$0
case "$0" in
*/*)
me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
test "$me" || me=$0
;;
esac
: Proper separator for the PATH environment variable
p_=:
: On OS/2 this directory should exist if this is not floppy only system :-]
if test -d c:/. ; then
if test -n "$OS2_SHELL"; then
p_=\;
PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
elif test -n "$DJGPP"; then
p_=\;
fi
fi
: Proper PATH setting
paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /usr/ccs/bin"
paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
paths="$paths /sbin /usr/sbin /usr/libexec"
for p in $paths
do
case "$p_$PATH$p_" in
*$p_$p$p_*) ;;
*) test -d $p && PATH=$PATH$p_$p ;;
esac
done
PATH=.$p_$PATH
export PATH
: shall we be using ksh?
inksh=''
needksh=''
avoidksh=''
newsh=/bin/ksh
changesh=''
if (PATH=.; alias -x) >/dev/null 2>&1; then
inksh=true
fi
if test -f /hp-ux -a -f /bin/ksh; then
needksh='to avoid sh bug in "here document" expansion'
fi
if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
if test X`/usr/bin/uname -v` = X4; then
avoidksh="to avoid AIX 4's /bin/sh"
newsh=/usr/bin/bsh
fi
fi
case "$inksh/$needksh" in
/[a-z]*)
ENV=''
changesh=true
reason="$needksh"
;;
esac
case "$inksh/$avoidksh" in
true/[a-z]*)
changesh=true
reason="$avoidksh"
;;
esac
case "$inksh/$needksh-$avoidksh-" in
true/--)
cat <<EOM
(I see you are using the Korn shell. Some ksh's blow up on $me,
mainly on older exotic systems. If yours does, try the Bourne shell instead.)
EOM
;;
esac
case "$changesh" in
true)
echo "(Feeding myself to $newsh $reason.)"
case "$0" in
Configure|*/Configure) exec $newsh $0 "$@";;
*) exec $newsh Configure "$@";;
esac
;;
esac
: if needed set CDPATH to a harmless value that is not chatty
: avoid bash 2.02 problems with empty CDPATH.
case "$CDPATH" in
'') ;;
*) case "$SHELL" in
*bash*) CDPATH='.' ;;
*) CDPATH='' ;;
esac
;;
esac
: Configure runs within the UU subdirectory
test -d UU || mkdir UU
cd UU && rm -f ./*
d_bsd=''
d_eunice=''
d_xenix=''
eunicefix=''
Mcc=''
awk=''
basename=''
bash=''
byacc=''
cat=''
comm=''
cp=''
cpp=''
csh=''
date=''
diff=''
echo=''
ed=''
egrep=''
expr=''
find=''
grep=''
inews=''
ispell=''
ksh=''
less=''
lint=''
mail=''
mkdir=''
more=''
mv=''
nm=''
nroff=''
perl=''
pg=''
pgp=''
rm=''
rmail=''
sed=''
sendmail=''
smail=''
sort=''
spell=''
tail=''
tee=''
test=''
tr=''
uname=''
uniq=''
uuname=''
vi=''
vspell=''
who=''
libswanted=''
hint=''
myuname=''
osname=''
osvers=''
Id=''
Log=''
_a=''
_exe=''
_o=''
archobjs=''
exe_ext=''
firstmakefile=''
lib_ext=''
obj_ext=''
path_sep=''
active=''
acttimes=''
d_acttimes=''
myactive=''
bin=''
binexp=''
installbin=''
cc=''
gccversion=''
ccflags=''
cppflags=''
ldflags=''
locincpth=''
optimize=''
cf_by=''
cf_time=''
contains=''
cpplast=''
cppminus=''
cpprun=''
cppstdin=''
d_attribut=''
d_ftime=''
d_gettimeod=''
aphostcmd=''
d_getdname=''
d_gethname=''
d_phostcmd=''
d_resinit=''
d_uname=''
d_getpwent=''
d_getcwd=''
d_getwd=''
d_gnulibc=''
d_havetlib=''
termlib=''
d_ignoreorg=''
d_internet=''
d_memcmp=''
d_memcpy=''
d_memset=''
d_mkdir=''
d_newsadm=''
newsadmin=''
d_genauth=''
d_local=''
d_nntp=''
d_xthread=''
servername=''
d_nolnbuf=''
d_normsig=''
jobslib=''
d_novoid=''
void=''
d_portable=''
d_rdchk=''
d_rename=''
d_sigblock=''
d_sighold=''
d_sizet=''
d_strccmp=''
d_strchr=''
d_strftime=''
strftimec=''
strftimeo=''
d_strstr=''
d_libndir=''
d_usendir=''
libndir=''
ndirc=''
ndiro=''
d_uwait3=''
d_uwait=''
d_vfork=''
usevfork=''
d_voidsig=''
signal_t=''
d_wifstat=''
defeditor=''
filexp=''
d_dirnamlen=''
direntrytype=''
i_dirent=''
i_ptem=''
i_stdlib=''
i_string=''
strings=''
i_sysdir=''
d_voidtty=''
i_bsdioctl=''
i_sysfilio=''
i_sysioctl=''
i_syssockio=''
i_sysndir=''
i_syswait=''
i_sgtty=''
i_termio=''
i_termios=''
i_systime=''
i_time=''
i_unistd=''
i_utime=''
i_vfork=''
ispell_options=''
ispell_prg=''
libc=''
glibpth=''
libpth=''
loclibpth=''
plibpth=''
xlibpth=''
libs=''
lns=''
citydist=''
cntrydist=''
contdist=''
locdist=''
multistatedist=''
orgdist=''
statedist=''
mailer=''
mailfile=''
installmansrc=''
manext=''
mansrc=''
mansrcexp=''
mboxchar=''
mimecap=''
c=''
n=''
d_berknames=''
d_passnames=''
d_usgnames=''
nametype=''
d_inews=''
extrainews=''
groupdesc=''
installinews=''
newslib=''
newslibexp=''
subscriptions=''
useinews=''
newsspool=''
orgname=''
package=''
spackage=''
pager=''
perlpath=''
hostbits=''
phost=''
phostcmd=''
prefix=''
prefixexp=''
prefshell=''
installprivlib=''
privlib=''
privlibexp=''
rootid=''
so=''
sharpbang=''
shsharp=''
spitshell=''
src=''
startsh=''
strn=''
sysman=''
overviewdir=''
overviewfmt=''
threaddir=''
tk=''
tkinc=''
tklibs=''
d_msdos=''
trn_init=''
trn_select=''
trnl=''
nm_opt=''
nm_so_opt=''
runnm=''
usenm=''
incpath=''
mips=''
mips_type=''
usrinc=''
yacc=''
yaccflags=''
d_whoami=''
CONFIG=''
define='define'
undef='undef'
smallmach='pdp11 i8086 z8000 i80286 iAPX286'
rmlist=''
: We must find out about Eunice early
eunicefix=':'
if test -f /etc/unixtovms; then
eunicefix=/etc/unixtovms
fi
if test -f /etc/unixtovms.exe; then
eunicefix=/etc/unixtovms.exe
fi
: list of known cpp symbols, sorted alphabetically
al="AMIX BIT_MSF BSD BSD4_3 BSD_NET2 CMU CRAY DGUX DOLPHIN DPX2"
al="$al GO32 GOULD_PN HP700 I386 I80960 I960 Lynx M68000 M68K MACH"
al="$al MIPSEB MIPSEL MSDOS MTXINU MULTIMAX MVS"
al="$al M_COFF M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM"
al="$al M_SYS3 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX"
al="$al NeXT OCS88 OSF1 PARISC PC532 PORTAR POSIX"
al="$al PWB R3000 RES RISC6000 RT Sun386i SVR3 SVR4"
al="$al SYSTYPE_BSD SYSTYPE_SVR4 SYSTYPE_SYSV Tek4132 Tek4300"
al="$al UMAXV USGr4 USGr4_2 UTEK UTS UTek UnicomPBB UnicomPBD Utek"
al="$al VMS Xenix286"
al="$al _AIX _AIX32 _AIX370 _AIX41 _AM29000 _COFF _CRAY _CX_UX _EPI"
al="$al _IBMESA _IBMR2 _M88K _M88KBCS_TARGET _POWER"
al="$al _MIPSEB _MIPSEL _M_COFF _M_I86 _M_I86SM _M_SYS3"
al="$al _M_SYS5 _M_SYSIII _M_SYSV _M_UNIX _M_XENIX _NLS _PGC_ _R3000"
al="$al _SYSTYPE_BSD _SYSTYPE_BSD43 _SYSTYPE_SVR4"
al="$al _SYSTYPE_SYSV _SYSV3 _U370 _UNICOS"
al="$al __386BSD__ __BIG_ENDIAN __BIG_ENDIAN__ __BSD_4_4__"
al="$al __DGUX__ __DPX2__ __H3050R __H3050RX"
al="$al __LITTLE_ENDIAN __LITTLE_ENDIAN__ __MACH__"
al="$al __MIPSEB __MIPSEB__ __MIPSEL __MIPSEL__"
al="$al __Next__ __OSF1__ __PARAGON__ __PGC__ __PWB __STDC__"
al="$al __SVR4_2__ __UMAXV__"
al="$al ____386BSD____ __alpha __alpha__ __amiga"
al="$al __bsd4_2 __bsd4_2__ __bsdi__ __convex__"
al="$al __host_mips__"
al="$al __hp9000s200 __hp9000s300 __hp9000s400 __hp9000s500"
al="$al __hp9000s500 __hp9000s700 __hp9000s800"
al="$al __hppa __hpux __hp_osf __i286 __i286__ __i386 __i386__"
al="$al __i486 __i486__ __i860 __i860__ __ibmesa __ksr1__ __linux__"
al="$al __m68k __m68k__ __m88100__ __m88k __m88k__"
al="$al __mc68000 __mc68000__ __mc68020 __mc68020__"
al="$al __mc68030 __mc68030__ __mc68040 __mc68040__"
al="$al __mc88100 __mc88100__ __mips __mips__"
al="$al __motorola__ __osf__ __pa_risc __sparc__ __stdc__"
al="$al __sun __sun__ __svr3__ __svr4__ __ultrix __ultrix__"
al="$al __unix __unix__ __uxpm__ __uxps__ __vax __vax__"
al="$al _host_mips _mips _unix"
al="$al a29k aegis aix aixpc alliant alpha am29000 amiga ansi ardent"
al="$al apollo ardent att386 att3b"
al="$al bsd bsd43 bsd4_2 bsd4_3 bsd4_4 bsdi bull"
al="$al cadmus clipper concurrent convex cray ctix"
al="$al dmert encore gcos gcx gimpel gould"
al="$al hbullx20 hcx host_mips hp200 hp300 hp700 hp800"
al="$al hp9000 hp9000s300 hp9000s400 hp9000s500"
al="$al hp9000s700 hp9000s800 hp9k8 hppa hpux"
al="$al i186 i286 i386 i486 i8086"
al="$al i80960 i860 iAPX286 ibm ibm032 ibmrt interdata is68k"
al="$al ksr1 linux luna luna88k m68k m88100 m88k"
al="$al mc300 mc500 mc68000 mc68010 mc68020 mc68030"
al="$al mc68040 mc68060 mc68k mc68k32 mc700"
al="$al mc88000 mc88100 merlin mert mips mvs n16"
al="$al ncl_el ncl_mr"
al="$al news1500 news1700 news1800 news1900 news3700"
al="$al news700 news800 news900 ns16000 ns32000"
al="$al ns32016 ns32332 ns32k nsc32000 os osf"
al="$al parisc pc532 pdp11 plexus posix pyr"
al="$al riscix riscos scs sequent sgi sinix sony sony_news"
al="$al sonyrisc sparc sparclite spectrum stardent stratos"
al="$al sun sun3 sun386 svr4 sysV68 sysV88"
al="$al titan tower tower32 tower32_200 tower32_600 tower32_700"
al="$al tower32_800 tower32_850 tss u370 u3b u3b2 u3b20 u3b200"
al="$al u3b20d u3b5 ultrix unix unixpc unos vax venix vms"
al="$al xenix z8000"
: Trailing extension. Override this in a hint file, if needed.
_exe=''
: Extra object files, if any, needed on this platform.
archobjs=''
gccversion=''
i_sysselct=''
: change the next line if compiling for Xenix/286 on Xenix/386
xlibpth='/usr/lib/386 /lib/386'
: Possible local library directories to search.
loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
: general looking path for locating libraries
glibpth="/shlib /usr/shlib /lib/pa1.1 /usr/lib/large"
glibpth="$glibpth /lib /usr/lib $xlibpth"
glibpth="$glibpth /lib/large /usr/lib/small /lib/small"
glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
: Private path used by Configure to find libraries. Its value
: is prepended to libpth. This variable takes care of special
: machines, like the mips. Usually, it should be empty.
plibpth=''
: default library list
libswanted=''
CTRLA=`echo a | tr a '\001'`
large=''
: Possible local include directories to search.
: Set locincpth to "" in a hint file to defeat local include searches.
locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
:
: no include file wanted by default
inclwanted=''
: List of libraries we want.
libswanted='malloc resolv socket net hdb bbn str nls nsl intl x ucb'
: Do not use vfork unless overridden by a hint file.
usevfork=false
: Find the basic shell for Bourne shell scripts
case "$sh" in
'')
case "$SYSTYPE" in
*bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
*) xxx='/bin/sh';;
esac
if test -f "$xxx"; then
sh="$xxx"
else
: Build up a list and do a single loop so we can 'break' out.
pth=`echo $PATH | sed -e "s/$p_/ /g"`
for xxx in sh bash ksh pdksh ash; do
for p in $pth; do
try="$try ${p}/${xxx}"
done
done
for xxx in $try; do
if test -f "$xxx"; then
sh="$xxx";
break
elif test -f "$xxx.exe"; then
sh="$xxx";
break
fi
done
fi
;;
esac
case "$sh" in
'') cat <<EOM >&2
$me: Fatal Error: I can't find a Bourne Shell anywhere.
Usually it's in /bin/sh. How did you even get this far?
Please contact me (Trn Workers) at [email protected] and
we'll try to straighten this all out.
EOM
exit 1
;;
esac
: see if sh knows # comments
if `$sh -c '#' >/dev/null 2>&1`; then
shsharp=true
spitshell=cat
xcat=/bin/cat
test -f $xcat || xcat=/usr/bin/cat
echo "#!$xcat" >try
$eunicefix try
chmod +x try
./try > today
if test -s today; then
sharpbang='#!'
else
echo "#! $xcat" > try
$eunicefix try
chmod +x try
./try > today
if test -s today; then
sharpbang='#! '
else
sharpbang=': use '
fi
fi
else
echo " "
echo "Your $sh doesn't grok # comments--I will strip them later on."
shsharp=false
cd ..
echo "exec grep -v '^[ ]*#'" >spitshell
chmod +x spitshell
$eunicefix spitshell
spitshell=`pwd`/spitshell
cd UU
echo "I presume that if # doesn't work, #! won't work either!"
sharpbang=': use '
fi
rm -f try today
: figure out how to guarantee sh startup
case "$startsh" in
'') startsh=${sharpbang}${sh} ;;
*)
esac
cat >try <<EOSS
$startsh
set abc
test "$?abc" != 1
EOSS
chmod +x try
$eunicefix try
if ./try; then
: echo "Yup, it does."
else
echo "Hmm... '$startsh' does not guarantee sh startup..."
echo "You may have to fix up the shell scripts to make sure $sh runs them."
fi
rm -f try
: produce awk script to parse command line options
cat >options.awk <<'EOF'
BEGIN {
optstr = "dD:eEf:hKOrsSU:V"; # getopt-style specification
len = length(optstr);
for (i = 1; i <= len; i++) {
c = substr(optstr, i, 1);
if (i < len) a = substr(optstr, i + 1, 1); else a = "";
if (a == ":") {
arg[c] = 1;
i++;
}
opt[c] = 1;
}
}
{
expect = 0;
str = $0;
if (substr(str, 1, 1) != "-") {
printf("'%s'\n", str);
next;
}
len = length($0);
for (i = 2; i <= len; i++) {
c = substr(str, i, 1);
if (!opt[c]) {
printf("-%s\n", substr(str, i));
next;
}
printf("-%s\n", c);
if (arg[c]) {
if (i < len)
printf("'%s'\n", substr(str, i + 1));
else
expect = 1;
next;
}
}
}
END {
if (expect)
print "?";
}
EOF
: process the command line options
set X `for arg in "$@"; do echo "X$arg"; done |
sed -e s/X// | awk -f options.awk`
eval "set $*"
shift
rm -f options.awk
: set up default values
fastread=''
reuseval=false
config_sh=''
alldone=''
error=''
silent=''
extractsh=''
override=''
knowitall=''
rm -f optdef.sh
cat >optdef.sh <<EOS
$startsh
EOS
: option parsing
while test $# -gt 0; do
case "$1" in
-d) shift; fastread=yes;;
-e) shift; alldone=cont;;
-f)
shift
cd ..
if test -r "$1"; then
config_sh="$1"
else
echo "$me: cannot read config file $1." >&2
error=true
fi
cd UU
shift;;
-h) shift; error=true;;
-r) shift; reuseval=true;;
-s) shift; silent=true; realsilent=true;;
-E) shift; alldone=exit;;
-K) shift; knowitall=true;;
-O) shift; override=true;;
-S) shift; silent=true; extractsh=true;;
-D)
shift
case "$1" in
*=)
echo "$me: use '-U symbol=', not '-D symbol='." >&2
echo "$me: ignoring -D $1" >&2
;;
*=*) echo "$1" | \
sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
*) echo "$1='define'" >> optdef.sh;;
esac
shift
;;
-U)
shift
case "$1" in
*=) echo "$1" >> optdef.sh;;
*=*)
echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
echo "$me: ignoring -U $1" >&2
;;
*) echo "$1='undef'" >> optdef.sh;;
esac
shift
;;
-V) echo "$me generated by metaconfig 3.0 PL70." >&2
exit 0;;
--) break;;
-*) echo "$me: unknown option $1" >&2; shift; error=true;;
*) break;;
esac
done
case "$error" in
true)
cat >&2 <<EOM
Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
[-U symbol] [-U symbol=]
-d : use defaults for all answers.
-e : go on without questioning past the production of config.sh.
-f : specify an alternate default configuration file.
-h : print this help message and exit (with an error status).
-r : reuse C symbols value if possible (skips costly nm extraction).
-s : silent mode, only echoes questions and essential information.
-D : define symbol to have some value:
-D symbol symbol gets the value 'define'
-D symbol=value symbol gets the value 'value'
-E : stop at the end of questions, after having produced config.sh.
-K : do not use unless you know what you are doing.
-O : let -D and -U override definitions from loaded configuration file.
-S : perform variable substitutions on all .SH files (can mix with -f)
-U : undefine symbol:
-U symbol symbol gets the value 'undef'
-U symbol= symbol gets completely empty
-V : print version number and exit (with a zero status).
EOM
exit 1
;;
esac
: Sanity checks
case "$fastread$alldone" in
yescont|yesexit) ;;
*)
if test ! -t 0; then
echo "Say 'sh Configure', not 'sh <Configure'"
exit 1
fi
;;
esac
exec 4>&1
case "$silent" in
true) exec 1>/dev/null;;
esac
: run the defines and the undefines, if any, but leave the file out there...
touch optdef.sh
. ./optdef.sh
: set package name
package=trn
first=`echo $package | sed -e 's/^\(.\).*/\1/'`
last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
*) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
esac
: Some greps do not return status, grrr.
echo "grimblepritz" >grimble
if grep blurfldyick grimble >/dev/null 2>&1 ; then
contains=contains
elif grep grimblepritz grimble >/dev/null 2>&1 ; then
contains=grep
else
contains=contains
fi
rm -f grimble
: the following should work in any shell
case "$contains" in
contains*)
echo " "
echo "AGH! Grep doesn't return a status. Attempting remedial action."
cat >contains <<'EOSS'
grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
EOSS
chmod +x contains
esac
: Find the path to the source tree
case "$src" in
'') case "$0" in
*/*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`;;
*) src='.';;
esac;;
esac
case "$src" in
'') src=/
rsrc=/
;;
/*) rsrc="$src";;
*) rsrc="../$src";;
esac
if test -f $rsrc/Configure && \
$contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
then
: found it, so we are ok.
else
rsrc=''
for src in . .. ../.. ../../.. ../../../..; do
if test -f ../$src/Configure && \
$contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
then
rsrc=../$src
break
fi
done
fi
case "$rsrc" in
'')
cat <<EOM >&4
Sorry, I can't seem to locate the source dir for $package. Please start
Configure with an explicit path -- i.e. /some/path/Configure.
EOM
exit 1
;;
../.) rsrc='..';;
*)
echo " "
echo "Sources for $package found in \"$src\"." >&4
;;
esac
: script used to extract .SH files with variable substitutions
cat >extract <<'EOS'
CONFIG=true
echo "Doing variable substitutions on .SH files..."
set makedir.SH `awk '$1 ~ /.SH$/ {print $1}' $src/MANIFEST | egrep -v 'newsnews|makedir'`
for file in $*; do
. $src/$file
done
EOS
: extract files and exit if asked to do so
case "$extractsh" in
true)
case "$realsilent" in
true) ;;
*) exec 1>&4;;
esac
case "$config_sh" in
'') config_sh='config.sh';;
esac
echo " "
echo "Fetching answers from $config_sh..."
cd ..
. $config_sh
test "$override" && . ./optdef.sh
echo " "
. UU/extract
rm -rf UU
echo "Done."
exit 0
;;
esac
: Eunice requires " " instead of "", can you believe it
echo " "
: Here we go...
echo "Beginning of configuration questions for $package."
trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
: first determine how to suppress newline on echo command
echo " "
echo "Checking echo to see how to suppress newlines..."
(echo "hi there\c" ; echo " ") >.echotmp
if $contains c .echotmp >/dev/null 2>&1 ; then
echo "...using -n."
n='-n'
c=''
else
cat <<'EOM'
...using \c
EOM
n=''
c='\c'
fi
echo $n "The star should be here-->$c"
echo '*'
rm -f .echotmp
: Now test for existence of everything in MANIFEST
echo " "
if test -f $rsrc/MANIFEST; then
echo "First let's make sure your kit is complete. Checking..." >&4
awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -l50
rm -f missing
tmppwd=`pwd`
for filelist in x??; do
(cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
done
if test -s missing; then
cat missing >&4
cat >&4 <<'EOM'
THIS PACKAGE SEEMS TO BE INCOMPLETE.
You have the option of continuing the configuration process, despite the
distinct possibility that your kit is damaged, by typing 'y'es. If you
do, don't blame me if something goes wrong. I advise you to type 'n'o
and contact the author ([email protected]).
EOM
echo $n "Continue? [n] $c" >&4
read ans
case "$ans" in
y*)
echo "Continuing..." >&4
rm -f missing
;;
*)
echo "ABORTING..." >&4
kill $$
;;
esac
else
echo "Looks good..."
fi
else
echo "There is no MANIFEST file. I hope your kit is complete !"
fi
rm -f missing x??
echo " "
: Find the appropriate value for a newline for tr
if test -n "$DJGPP"; then
trnl='\012'
fi
if test X"$trnl" = X; then
case "`echo foo|tr '\n' x 2>/dev/null`" in
foox) trnl='\n' ;;
esac
fi
if test X"$trnl" = X; then
case "`echo foo|tr '\012' x 2>/dev/null`" in
foox) trnl='\012' ;;
esac
fi
if test X"$trnl" = X; then
cat <<EOM >&2