forked from gtk-gnutella/gtk-gnutella
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Configure
executable file
·12147 lines (11471 loc) · 242 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 package (which contains metaconfig) is available via git:
# git clone [email protected]:rmanfredi/dist.git
# $Id$
#
# Generated on Wed Dec 28 18:44:06 CET 2022 [metaconfig 3.5-255]
cat >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 >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 c1$$ c2$$
true || exec sh $0 $argv:q
(exit $?0) || cat c2$$
(exit $?0) || exec sh $0 $argv:q
rm -f c1$$ 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
case "X${MACHTYPE:-nonesuchmach}" in
*cygwin|*msys) ;;
*) p_=\; ;;
esac
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"
paths="$paths /system/gnu_library/bin"
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
if test -f /osf_boot -a -f /usr/sbin/setld; then
if test X`/usr/bin/uname -s` = XOSF1; then
avoidksh="to avoid Digital UNIX' ksh"
newsh=/bin/sh
unset BIN_SH
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)
export newsh
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
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 ./*
ccname=''
ccversion=''
from=''
run=''
targetarch=''
to=''
usecrosscompile=''
d_bsd=''
d_dos=''
d_eunice=''
d_linux=''
d_os2=''
d_windows=''
d_xenix=''
_exe=''
eunicefix=''
ar=''
awk=''
bash=''
bison=''
byacc=''
cat=''
chgrp=''
chmod=''
chown=''
comm=''
compress=''
cp=''
cpio=''
cpp=''
csh=''
date=''
echo=''
egrep=''
emacs=''
expr=''
find=''
flex=''
gcc=''
gmake=''
gmsgfmt=''
grep=''
gzip=''
inews=''
ksh=''
less=''
line=''
lint=''
ln=''
lp=''
lpr=''
ls=''
mail=''
mailx=''
make=''
mkdir=''
more=''
msgfmt=''
msgmerge=''
mv=''
nawk=''
nm=''
nroff=''
perl=''
pg=''
pmake=''
pr=''
rm=''
rmail=''
sed=''
sendmail=''
shar=''
sleep=''
smail=''
sort=''
submit=''
tail=''
tar=''
tbl=''
tee=''
test=''
touch=''
tr=''
troff=''
uname=''
uniq=''
uuname=''
vi=''
wc=''
xgettext=''
zcat=''
zip=''
incpath=''
mips_type=''
libswanted=''
hint=''
myuname=''
osname=''
osvers=''
Author=''
Date=''
Header=''
Id=''
Locker=''
Log=''
RCSfile=''
Revision=''
Source=''
State=''
_a=''
_o=''
archobjs=''
firstmakefile=''
rm_try=''
afs=''
afsroot=''
alignbytes=''
archlib=''
archlibexp=''
d_archlib=''
installarchlib=''
archname=''
myarchname=''
bin=''
binexp=''
installbin=''
byteorder=''
cc=''
ccflags=''
cppflags=''
ldflags=''
lkflags=''
locincpth=''
optimize=''
pthread=''
cf_by=''
cf_time=''
charsize=''
contains=''
cpp_quote=''
cpp_stuff=''
cpplast=''
cppminus=''
cpprun=''
cppstdin=''
d_gettblsz=''
nofile=''
tablesize=''
d_access=''
d_alarm=''
d_arc4random=''
d_attribut=''
d_backtrace=''
d_bcmp=''
d_bcopy=''
d_bfd_lib=''
d_bfd_section=''
d_bindtxtcode=''
d_bsearch=''
d_built_bswap32=''
d_built_bswap64=''
d_built_clz=''
d_built_ctz=''
d_built_popcount=''
d_bzero=''
d_clearenv=''
d_clock_getres=''
d_clock_gettime=''
d_closefrom=''
d_const=''
d_deflate=''
d_dev_poll=''
d_difftime=''
use_difftime=''
d_dirent_d_namlen=''
d_dirent_d_type=''
d_dirfd=''
d_dladdr=''
d_end_symbol=''
d_epoll=''
d_etext_symbol=''
d_fchdir=''
d_fdatasync=''
d_fdopendir=''
d_fork=''
d_fstatat=''
d_fsync=''
d_ftime=''
d_gettimeod=''
d_getaddrinfo=''
d_geteuid=''
aphostname=''
d_gethname=''
d_phostname=''
d_uname=''
d_getifaddrs=''
d_getinvent=''
d_getlogin=''
d_getnameinfo=''
d_getppid=''
d_getprogname=''
d_getpwnam=''
d_getpwuid=''
d_getrlimit=''
d_gettext=''
d_getuid=''
d_gnulibc=''
gnulibc_version=''
d_headless=''
d_herror=''
d_hstrerror=''
d_iconv=''
d_ieee754=''
ieee754_byteorder=''
d_inflate=''
d_iptos=''
d_ipv6=''
d_isascii=''
d_kevent_int_udata=''
d_kqueue=''
d_locale_charset=''
d_lstat=''
d_madvise=''
d_memalign=''
d_memcpy=''
d_memmove=''
d_mempcpy=''
d_memrchr=''
d_memset=''
d_mmap=''
d_msghdr_msg_flags=''
d_nanosleep=''
d_nls=''
d_open3=''
d_openat=''
d_pause=''
d_pipe2=''
d_poll=''
d_popcount=''
d_popen=''
d_portable=''
d_posix_fadvise=''
d_posix_memalign=''
d_pread=''
d_preadv=''
d_proginvocname=''
d_ptattr_setstack=''
d_pwrite=''
d_pwritev=''
d_recvmsg=''
d_regcomp=''
d_regparm=''
d_rusage=''
d_sbrk=''
d_sched_yield=''
d_select=''
d_semctl=''
d_semget=''
d_semop=''
d_semtimedop=''
d_sendfile=''
d_setenv=''
d_setproctitle=''
d_setprogname=''
d_setsid=''
d_sigaction=''
d_sigaltstack=''
d_sigprocmask=''
d_sigsetjmp=''
d_sockaddr_in_sin_len=''
d_sockaddr_un=''
d_socker_get=''
sockercflags=''
sockerldflags=''
d_oldsock=''
d_socket=''
d_sockpair=''
sockethdr=''
socketlib=''
d_statfs=''
d_statvfs=''
d_index=''
d_strchr=''
d_strlcat=''
d_strlcpy=''
d_sync_atomic=''
d_syscall=''
d_sysctl=''
d_system=''
clocktype=''
d_times=''
d_ttyname=''
d_uctx_mctx=''
d_uctx_mctx_gregs=''
d_usleep=''
d_vfork=''
usevfork=''
d_voidsig=''
signal_t=''
d_volatile=''
d_vsnprintf=''
d_waitpid=''
d_dbus=''
dbuscflags=''
dbusconfig=''
dbusldflags=''
ebcdic=''
d_enablenls=''
enablenls=''
cppfilter=''
fieldn=''
gccosandvers=''
gccversion=''
glade=''
d_glib=''
glibcflags=''
glibconfig=''
glibldflags=''
d_useglib1=''
d_useglib2=''
glibpackage=''
glibversion=''
d_gnutls=''
gnutlscflags=''
gnutlsconfig=''
gnutlsldflags=''
d_gtk=''
gtkcflags=''
gtkconfig=''
gtkldflags=''
gtkgversion=''
d_usegtk1=''
d_usegtk2=''
gtkpackage=''
gtkversion=''
h_fcntl=''
h_sysfile=''
i_alloca=''
i_arpainet=''
d_dirnamlen=''
direntrytype=''
i_dirent=''
i_dlfcn=''
i_execinfo=''
i_fcntl=''
i_iconv=''
i_ifaddrs=''
i_inttypes=''
i_invent=''
i_langinfo=''
i_libcharset=''
i_libintl=''
i_limits=''
i_linux_netlink=''
i_linux_rtnetlink=''
i_malloc=''
i_math=''
i_mswsock=''
i_netdb=''
i_netif=''
i_netroute=''
i_niin=''
i_sysin=''
i_niip=''
i_poll=''
i_pthread=''
d_pwage=''
d_pwchange=''
d_pwclass=''
d_pwcomment=''
d_pwexpire=''
d_pwquota=''
i_pwd=''
i_regex=''
i_sched=''
i_stdlib=''
i_string=''
strings=''
i_sysfile=''
i_sysipc=''
i_sysmman=''
i_sysmount=''
i_sysparam=''
i_syspoll=''
i_sysresrc=''
i_sysselct=''
i_syssem=''
i_syssendfile=''
i_syssock=''
i_sysstat=''
i_sysstatvfs=''
i_syssysctl=''
i_systimeb=''
i_systimes=''
i_systypes=''
i_sysun=''
i_sysutsname=''
i_sysvfs=''
i_syswait=''
i_systime=''
i_systimek=''
i_time=''
timeincl=''
i_sys_ucontext=''
i_ucontext=''
i_unistd=''
i_stdarg=''
i_varargs=''
i_varhdr=''
i_winsock2=''
i_ws2tcpip=''
i_zlib=''
d_can64=''
d_ilp32=''
d_ilp64=''
d_lp64=''
ilp=''
install=''
installdir=''
intsize=''
longsize=''
shortsize=''
issymlink=''
libc=''
libnames=''
glibpth=''
libpth=''
loclibpth=''
plibpth=''
xlibpth=''
libs=''
libscheck=''
libsdirs=''
libsfiles=''
libsfound=''
libspath=''
lns=''
locale=''
localeexp=''
make_set_make=''
d_mymalloc=''
freetype=''
mallocobj=''
mallocsrc=''
malloctype=''
usemymalloc=''
installmansrc=''
manext=''
mansrc=''
mansrcexp=''
mkdep=''
huge=''
large=''
medium=''
models=''
small=''
split=''
msgmerge_update=''
mydomain=''
myhostname=''
phostname=''
c=''
n=''
d_eofnblk=''
eagain=''
o_nonblock=''
rd_nodata=''
groupcat=''
hostcat=''
passcat=''
d_official=''
official=''
orderlib=''
ranlib=''
package=''
spackage=''
pkgsrc=''
prefix=''
prefixexp=''
installprivlib=''
privlib=''
privlibexp=''
prototype=''
ptrsize=''
d_remotectrl=''
remotectrl=''
sh=''
sig_count=''
sig_name=''
sig_name_init=''
sig_num=''
sig_num_init=''
sig_size=''
so=''
sharpbang=''
shsharp=''
spitshell=''
src=''
startsh=''
sysman=''
trnl=''
nm_opt=''
nm_so_opt=''
runnm=''
usenm=''
usrinc=''
defvoidused=''
voidflags=''
yacc=''
yaccflags=''
CONFIG=''
: Initialize wide constants
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
: Set executable suffix now -- needed before hints available
if test -f "/libs/version.library"; then
: Amiga OS
_exe=""
elif test -f "/system/gnu_library/bin/ar.pm"; then
: Stratus VOS
_exe=".pm"
elif test -n "$DJGPP"; then
: DOS DJGPP
_exe=".exe"
elif test -d c:/. ; then
: OS/2 or cygwin
_exe=".exe"
else
: All other UNIX systems
_exe=""
fi
ccname=''
ccversion=''
: Extra object files, if any, needed on this platform.
archobjs=''
: Possible local include directories to search.
: Set locincpth to "" in a hint file to defeat local include searches.
locincpth=""
:
: no include file wanted by default
inclwanted=''
i_whoami=''
libnames=''
: 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=""
: general looking path for locating libraries
glibpth="/lib /usr/lib $xlibpth"
glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
test -f /shlib/libc.so && glibpth="/shlib $glibpth"
glibpth="$glibpth /lib32 /lib64 "`ls -1d /usr/lib/*-gnu 2>/dev/null`
: 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=''
: should be set by hint files if needed
libscheck=''
usesocks=''
: full support for void wanted by default
defvoidused=15
: private initializations
libswanted="bfd iberty sendfile z iconv m intl dl"
: 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$_exe"
break
elif test -f "$xxx.exe"; then
sh="$xxx.exe"
break
fi
done
fi
;;
esac
case "$sh" in
'') cat >&2 <<EOM
$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 (gtk-gnutella developers) 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$_exe || xcat=/usr/bin/cat
if test ! -f $xcat$_exe; then
for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
if test -f $p/cat$_exe; then
xcat=$p/cat
break
fi
done
if test ! -f $xcat$_exe; then
echo "Can't find cat anywhere!"
exit 1
fi
fi
echo "#!$xcat" >sharp
$eunicefix sharp
chmod +x sharp
./sharp > today 2>/dev/null
if test -s today; then
sharpbang='#!'
else
echo "#! $xcat" > sharp
$eunicefix sharp
chmod +x sharp
./sharp > today 2>/dev/null
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 sharp today
: figure out how to guarantee sh startup
case "$startsh" in
'') startsh=${sharpbang}${sh} ;;
*)
esac
cat >sharp <<EOSS
$startsh
set abc
test "$?abc" != 1
EOSS
chmod +x sharp
$eunicefix sharp
if ./sharp; 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 sharp
: Save command line options in file UU/cmdline.opt for later use in
: generating config.sh.
cat > cmdline.opt <<EOSH
: Configure command line arguments.
config_arg0='$0'
config_args='$*'
config_argc=$#
EOSH
argn=1
args_exp=''
args_sep=''
for arg in "$@"; do
cat >>cmdline.opt <<EOSH
config_arg$argn='$arg'
EOSH
cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
$arg
EOC
arg_exp=`cat cmdl.opt`
args_exp="$args_exp$args_sep'$arg_exp'"
argn=`expr $argn + 1`
args_sep=' '
done
rm -f cmdl.opt
: produce awk script to parse command line options
cat >options.awk <<'EOF'
BEGIN {
optstr = "A: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 posthint.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;;
*=*)