This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
make AutoSplit safer on filesystems with short filenames
[perl5.git] / Configure
<
CommitLineData
2304df62
AD
1#! /bin/sh
2#
3# If these # comments don't work, trim them. Don't worry about any other
4# shell scripts, Configure will trim # comments from them for you.
5#
6# (If you are trying to port this package to a machine without sh,
7# I would suggest you have a look at the prototypical config_h.SH file
8# and edit it to reflect your system. Some packages may include samples
9# of config.h for certain machines, so you might look for one of those.)
10#
11# Yes, you may rip this off to use in other distribution packages. This
12# script belongs to the public domain and cannot be copyrighted.
13#
14# (Note: this Configure script was generated automatically. Rather than
15# working with this copy of Configure, you may wish to get metaconfig.
16# The dist-3.0 package (which contains metaconfig) was posted in
dfe9444c
AD
17# comp.sources.misc and is available on CPAN under authors/id/RAM so
18# you may fetch it yourself from your nearest archive site.)
2304df62
AD
19#
20
dfe9444c 21# $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
2304df62 22#
24548b42 23# Generated on Tue Jul 7 10:10:21 EDT 1998 [metaconfig 3.0 PL70]
bfb7748a 24# (with additional metaconfig patches by doughera@lafayette.edu)
2304df62
AD
25
26cat >/tmp/c1$$ <<EOF
27ARGGGHHHH!!!!!
28
29SCO csh still thinks true is false. Write to SCO today and tell them that next
30year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
31
32(Actually, Configure ought to just patch csh in place. Hmm. Hmmmmm. All
33we'd have to do is go in and swap the && and || tokens, wherever they are.)
34
35[End of diatribe. We now return you to your regularly scheduled programming...]
36EOF
37cat >/tmp/c2$$ <<EOF
38
39OOPS! You naughty creature! You didn't run Configure with sh!
40I will attempt to remedy the situation by running sh for you...
41EOF
42
43true || cat /tmp/c1$$ /tmp/c2$$
44true || exec sh $0 $argv:q
45
46(exit $?0) || cat /tmp/c2$$
47(exit $?0) || exec sh $0 $argv:q
48rm -f /tmp/c1$$ /tmp/c2$$
49
a0d0e21e
LW
50: compute my invocation name
51me=$0
52case "$0" in
53*/*)
54 me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
55 test "$me" || me=$0
56 ;;
57esac
58
28e8609d
JH
59: the newline for tr
60if test X"$trnl" = X; then
61 case "`echo foo|tr '\n' x 2>/dev/null`" in
62 foox)
63 trnl='\n'
64 ;;
65 esac
66fi
67if test X"$trnl" = X; then
68 case "`echo foo|tr '\012' x 2>/dev/null`" in
69 foox)
70 trnl='\012'
71 ;;
72 esac
73fi
38b9e83a
LM
74if test -n "$DJGPP"; then
75 trnl='\012'
76fi
28e8609d
JH
77if test X"$trnl" = X; then
78 cat <<EOM >&2
79
80$me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
81
82EOM
83 exit 1
84fi
85
dfe9444c 86: Proper separator for the PATH environment variable
8e07c86e
AD
87p_=:
88: On OS/2 this directory should exist if this is not floppy only system :-]
dfe9444c
AD
89if test -d c:/. ; then
90 if test -n "$OS2_SHELL"; then
91 p_=\;
92 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
93 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
c4f23d77 94 elif test -n "$DJGPP"; then
dfe9444c
AD
95 p_=\;
96 fi
39e571d4 97fi
a0d0e21e
LW
98
99: Proper PATH setting
100paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
16d20bd9 101paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
232e078e 102paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
16d20bd9 103paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
232e078e
AD
104paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
105paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /usr/ccs/bin"
106paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
107paths="$paths /sbin /usr/sbin /usr/libexec"
a0d0e21e
LW
108
109for p in $paths
110do
8e07c86e
AD
111 case "$p_$PATH$p_" in
112 *$p_$p$p_*) ;;
113 *) test -d $p && PATH=$PATH$p_$p ;;
a0d0e21e
LW
114 esac
115done
116
8e07c86e 117PATH=.$p_$PATH
2304df62
AD
118export PATH
119
dfe9444c
AD
120: shall we be using ksh?
121inksh=''
122needksh=''
123avoidksh=''
124newsh=/bin/ksh
125changesh=''
ff0cee69 126if (PATH=.; alias -x) >/dev/null 2>&1; then
dfe9444c
AD
127 inksh=true
128fi
129if test -f /hp-ux -a -f /bin/ksh; then
130 needksh='to avoid sh bug in "here document" expansion'
131fi
132if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
133 if test X`/usr/bin/uname -v` = X4; then
134 avoidksh="to avoid AIX 4's /bin/sh"
135 newsh=/usr/bin/bsh
2304df62 136 fi
dfe9444c
AD
137fi
138case "$inksh/$needksh" in
139/[a-z]*)
c4f23d77 140 ENV=''
dfe9444c
AD
141 changesh=true
142 reason="$needksh"
143 ;;
144esac
145case "$inksh/$avoidksh" in
146true/[a-z]*)
147 changesh=true
148 reason="$avoidksh"
149 ;;
150esac
151case "$inksh/$needksh-$avoidksh-" in
152true/--)
a0d0e21e
LW
153 cat <<EOM
154(I see you are using the Korn shell. Some ksh's blow up on $me,
dfe9444c 155mainly on older exotic systems. If yours does, try the Bourne shell instead.)
ff0cee69 156EOM
dfe9444c
AD
157 ;;
158esac
159case "$changesh" in
160true)
161 echo "(Feeding myself to $newsh $reason.)"
162 case "$0" in
163 Configure|*/Configure) exec $newsh $0 "$@";;
164 *) exec $newsh Configure "$@";;
165 esac
166 ;;
167esac
2304df62 168
bfb7748a
AD
169: if needed set CDPATH to a harmless value that is not chatty
170: avoid bash 2.02 problems with empty CDPATH.
171case "$CDPATH" in
172'') ;;
173*) case "$SHELL" in
174 *bash*) CDPATH='.' ;;
175 *) CDPATH='' ;;
176 esac
177 ;;
178esac
2304df62
AD
179: Configure runs within the UU subdirectory
180test -d UU || mkdir UU
8e07c86e 181cd UU && rm -f ./*
2304df62 182
a0d0e21e 183dynamic_ext=''
2304df62 184extensions=''
a0d0e21e 185known_extensions=''
4318d5a0 186nonxs_ext=''
bfb7748a 187static_ext=''
8ff267be 188useopcode=''
a0d0e21e 189useposix=''
ecfc5424 190d_bsd=''
40a7a20a 191d_eunice=''
2304df62
AD
192d_xenix=''
193eunicefix=''
194Mcc=''
dfe9444c 195ar=''
2304df62
AD
196awk=''
197bash=''
198bison=''
199byacc=''
200cat=''
201chgrp=''
202chmod=''
203chown=''
ecfc5424 204comm=''
2304df62
AD
205compress=''
206cp=''
207cpio=''
208cpp=''
209csh=''
210date=''
211echo=''
212egrep=''
213emacs=''
214expr=''
215find=''
216flex=''
2304df62 217grep=''
8ff267be 218gzip=''
2304df62
AD
219inews=''
220ksh=''
221less=''
222line=''
223lint=''
224ln=''
225lp=''
226lpr=''
227ls=''
228mail=''
229mailx=''
dfe9444c 230make=''
2304df62
AD
231mkdir=''
232more=''
233mv=''
693762b4 234nm=''
2304df62
AD
235nroff=''
236perl=''
237pg=''
238pmake=''
239pr=''
240rm=''
241rmail=''
242sed=''
243sendmail=''
2304df62
AD
244shar=''
245sleep=''
246smail=''
247sort=''
248submit=''
249tail=''
250tar=''
251tbl=''
693762b4 252tee=''
2304df62
AD
253test=''
254touch=''
255tr=''
256troff=''
257uname=''
258uniq=''
259uuname=''
260vi=''
261zcat=''
8ff267be 262zip=''
1aef975c 263full_sed=''
a0d0e21e 264libswanted=''
2304df62
AD
265hint=''
266myuname=''
85e6fe83
LW
267osname=''
268osvers=''
2304df62
AD
269Author=''
270Date=''
271Header=''
272Id=''
273Locker=''
274Log=''
275RCSfile=''
276Revision=''
277Source=''
278State=''
dfe9444c
AD
279_a=''
280_exe=''
281_o=''
4633a7c4
LW
282archobjs=''
283exe_ext=''
284firstmakefile=''
285lib_ext=''
286obj_ext=''
287path_sep=''
2304df62 288afs=''
a0d0e21e 289alignbytes=''
c4f23d77 290ansi2knr=''
a0d0e21e
LW
291archlib=''
292archlibexp=''
a0d0e21e
LW
293d_archlib=''
294installarchlib=''
40000a8c
AD
295archname=''
296myarchname=''
ecfc5424 297baserev=''
2304df62
AD
298bin=''
299binexp=''
300installbin=''
301byteorder=''
302cc=''
303gccversion=''
304ccflags=''
305cppflags=''
306ldflags=''
307lkflags=''
8e07c86e 308locincpth=''
2304df62 309optimize=''
8e07c86e 310cf_email=''
2304df62
AD
311cf_by=''
312cf_time=''
313contains=''
a0d0e21e 314cpp_stuff=''
2304df62
AD
315cpplast=''
316cppminus=''
317cpprun=''
318cppstdin=''
319d_access=''
a0d0e21e 320d_alarm=''
ecfc5424 321d_attribut=''
2304df62
AD
322d_bcmp=''
323d_bcopy=''
324d_bzero=''
325d_casti32=''
326castflags=''
327d_castneg=''
a0d0e21e
LW
328d_chown=''
329d_chroot=''
2304df62 330d_chsize=''
a0d0e21e
LW
331d_closedir=''
332d_void_closedir=''
2304df62
AD
333d_const=''
334cryptlib=''
335d_crypt=''
336d_csh=''
1aef975c 337full_csh=''
a0d0e21e
LW
338d_cuserid=''
339d_dbl_dig=''
340d_difftime=''
341d_dlerror=''
342d_dlopen=''
343d_dlsymun=''
2304df62 344d_dosuid=''
a0d0e21e 345d_suidsafe=''
2304df62 346d_dup2=''
e5c9fcd0
AD
347d_endhent=''
348d_endnent=''
349d_endpent=''
350d_endsent=''
2304df62
AD
351d_fchmod=''
352d_fchown=''
353d_fcntl=''
a0d0e21e
LW
354d_fd_macros=''
355d_fd_set=''
356d_fds_bits=''
357d_fgetpos=''
2304df62
AD
358d_flexfnam=''
359d_flock=''
a0d0e21e
LW
360d_fork=''
361d_fsetpos=''
5f05dabc
PP
362d_ftime=''
363d_gettimeod=''
a0d0e21e 364d_Gconvert=''
2304df62 365d_getgrps=''
4599a1de 366d_gethbyaddr=''
4599a1de 367d_gethbyname=''
dfe9444c 368d_gethent=''
2304df62
AD
369aphostname=''
370d_gethname=''
371d_phostname=''
372d_uname=''
dc45a647 373d_gethostprotos=''
a0d0e21e 374d_getlogin=''
dfe9444c 375d_getnbyaddr=''
693762b4 376d_getnbyname=''
e5c9fcd0 377d_getnent=''
dc45a647 378d_getnetprotos=''
e5c9fcd0 379d_getpent=''
2afac517 380d_getpgid=''
2304df62 381d_getpgrp2=''
2afac517 382d_bsdgetpgrp=''
2304df62 383d_getpgrp=''
a0d0e21e 384d_getppid=''
2304df62 385d_getprior=''
693762b4
AD
386d_getpbyname=''
387d_getpbynumber=''
dc45a647 388d_getprotoprotos=''
e5c9fcd0 389d_getsent=''
dc45a647 390d_getservprotos=''
693762b4
AD
391d_getsbyname=''
392d_getsbyport=''
a4f3eea9 393d_gnulibc=''
93341792 394i_arpainet=''
2304df62 395d_htonl=''
7e1af8bc 396d_inetaton=''
2304df62
AD
397d_isascii=''
398d_killpg=''
dd64f1c3 399d_lchown=''
2304df62 400d_link=''
a0d0e21e
LW
401d_locconv=''
402d_lockf=''
e5c9fcd0
AD
403d_longdbl=''
404longdblsize=''
dc45a647
MB
405d_longlong=''
406longlongsize=''
2304df62 407d_lstat=''
a0d0e21e
LW
408d_mblen=''
409d_mbstowcs=''
410d_mbtowc=''
2304df62
AD
411d_memcmp=''
412d_memcpy=''
413d_memmove=''
414d_memset=''
415d_mkdir=''
a0d0e21e
LW
416d_mkfifo=''
417d_mktime=''
2304df62
AD
418d_msg=''
419d_msgctl=''
420d_msgget=''
421d_msgrcv=''
422d_msgsnd=''
a0d0e21e 423d_nice=''
2304df62 424d_open3=''
a0d0e21e
LW
425d_fpathconf=''
426d_pathconf=''
427d_pause=''
428d_pipe=''
8e07c86e 429d_poll=''
2304df62 430d_portable=''
dfe9444c
AD
431d_pthread_yield=''
432d_sched_yield=''
433d_pthreads_created_joinable=''
2304df62 434d_readdir=''
85e6fe83
LW
435d_rewinddir=''
436d_seekdir=''
437d_telldir=''
a0d0e21e 438d_readlink=''
2304df62
AD
439d_rename=''
440d_rmdir=''
441d_safebcpy=''
442d_safemcpy=''
36477c24 443d_sanemcmp=''
2304df62
AD
444d_select=''
445d_sem=''
446d_semctl=''
447d_semget=''
448d_semop=''
449d_setegid=''
450d_seteuid=''
dfe9444c 451d_setgrps=''
693762b4 452d_sethent=''
a0d0e21e 453d_setlinebuf=''
2304df62 454d_setlocale=''
e5c9fcd0
AD
455d_setnent=''
456d_setpent=''
2304df62
AD
457d_setpgid=''
458d_setpgrp2=''
2afac517 459d_bsdsetpgrp=''
2304df62
AD
460d_setpgrp=''
461d_setprior=''
462d_setregid=''
463d_setresgid=''
464d_setresuid=''
465d_setreuid=''
466d_setrgid=''
467d_setruid=''
e5c9fcd0 468d_setsent=''
2304df62 469d_setsid=''
e5c9fcd0 470d_setvbuf=''
760ac839 471d_sfio=''
8ff267be 472usesfio=''
2304df62
AD
473d_shm=''
474d_shmat=''
a0d0e21e
LW
475d_shmatprototype=''
476shmattype=''
2304df62
AD
477d_shmctl=''
478d_shmdt=''
479d_shmget=''
2c7991dc 480d_sigaction=''
8ff267be 481d_sigsetjmp=''
2304df62
AD
482d_oldsock=''
483d_socket=''
484d_sockpair=''
485sockethdr=''
486socketlib=''
487d_statblks=''
c2960299
AD
488d_stdio_cnt_lval=''
489d_stdio_ptr_lval=''
16d20bd9 490d_stdiobase=''
2304df62 491d_stdstdio=''
16d20bd9
AD
492stdio_base=''
493stdio_bufsiz=''
494stdio_cnt=''
dfe9444c 495stdio_filbuf=''
16d20bd9 496stdio_ptr=''
2304df62
AD
497d_index=''
498d_strchr=''
a0d0e21e 499d_strcoll=''
2304df62
AD
500d_strctcpy=''
501d_strerrm=''
502d_strerror=''
503d_sysernlst=''
504d_syserrlst=''
a89d8a78
DH
505d_strtod=''
506d_strtol=''
507d_strtoul=''
a0d0e21e 508d_strxfrm=''
2304df62
AD
509d_symlink=''
510d_syscall=''
a0d0e21e 511d_sysconf=''
2304df62 512d_system=''
a0d0e21e
LW
513d_tcgetpgrp=''
514d_tcsetpgrp=''
85e6fe83
LW
515d_time=''
516timetype=''
2304df62
AD
517clocktype=''
518d_times=''
519d_truncate=''
a0d0e21e
LW
520d_tzname=''
521d_umask=''
bd89102f
AD
522d_semctl_semid_ds=''
523d_semctl_semun=''
524d_union_semun=''
2304df62 525d_vfork=''
a0d0e21e 526usevfork=''
2304df62
AD
527d_voidsig=''
528signal_t=''
529d_volatile=''
530d_charvspr=''
531d_vprintf=''
532d_wait4=''
533d_waitpid=''
a0d0e21e
LW
534d_wcstombs=''
535d_wctomb=''
536dlext=''
85e6fe83
LW
537cccdlflags=''
538ccdlflags=''
2304df62 539dlsrc=''
232e078e 540ld=''
85e6fe83 541lddlflags=''
2304df62 542usedl=''
693762b4 543doublesize=''
a0d0e21e 544fpostype=''
2304df62
AD
545gidtype=''
546groupstype=''
547h_fcntl=''
548h_sysfile=''
ecfc5424
AD
549db_hashtype=''
550db_prefixtype=''
a0d0e21e 551i_db=''
2304df62 552i_dbm=''
8e07c86e 553i_rpcsvcdbm=''
2304df62 554d_dirnamlen=''
a0d0e21e 555direntrytype=''
2304df62 556i_dirent=''
a0d0e21e 557i_dld=''
2304df62
AD
558i_dlfcn=''
559i_fcntl=''
a0d0e21e 560i_float=''
2304df62 561i_gdbm=''
28e8609d
JH
562d_grpasswd=''
563d_setgrent=''
564d_getgrent=''
565d_endgrent=''
2304df62 566i_grp=''
a0d0e21e 567i_limits=''
4633a7c4 568i_locale=''
a0d0e21e
LW
569i_malloc=''
570i_math=''
85e6fe83 571i_memory=''
2304df62 572i_ndbm=''
3fd537d4 573i_netdb=''
85e6fe83 574i_neterrno=''
2304df62
AD
575i_niin=''
576i_sysin=''
577d_pwage=''
578d_pwchange=''
579d_pwclass=''
580d_pwcomment=''
581d_pwexpire=''
c4f23d77 582d_pwgecos=''
28e8609d 583d_pwpasswd=''
2304df62 584d_pwquota=''
28e8609d
JH
585d_setpwent=''
586d_getpwent=''
587d_endpwent=''
2304df62 588i_pwd=''
760ac839 589i_sfio=''
2304df62 590i_stddef=''
a0d0e21e 591i_stdlib=''
2304df62
AD
592i_string=''
593strings=''
594i_sysdir=''
595i_sysfile=''
596d_voidtty=''
597i_bsdioctl=''
a0d0e21e 598i_sysfilio=''
2304df62
AD
599i_sysioctl=''
600i_syssockio=''
601i_sysndir=''
a0d0e21e 602i_sysparam=''
8ff267be 603i_sysresrc=''
2304df62 604i_sysselct=''
1aef975c 605i_sysstat=''
a0d0e21e 606i_systimes=''
fed7345c 607i_systypes=''
25f94b33 608i_sysun=''
8ff267be 609i_syswait=''
2304df62
AD
610i_sgtty=''
611i_termio=''
612i_termios=''
613i_systime=''
614i_systimek=''
615i_time=''
616timeincl=''
85e6fe83 617i_unistd=''
2304df62 618i_utime=''
760ac839 619i_values=''
a0d0e21e 620i_stdarg=''
2304df62
AD
621i_varargs=''
622i_varhdr=''
623i_vfork=''
624intsize=''
24fef2a7
AD
625longsize=''
626shortsize=''
2304df62 627libc=''
8ff267be 628libperl=''
2afac517 629shrpenv=''
8ff267be 630useshrplib=''
a0d0e21e 631glibpth=''
2304df62 632libpth=''
8e07c86e 633loclibpth=''
2304df62
AD
634plibpth=''
635xlibpth=''
636libs=''
85e6fe83
LW
637lns=''
638lseektype=''
8ff267be 639make_set_make=''
85e6fe83 640d_mymalloc=''
94b6baf5 641freetype=''
2304df62
AD
642mallocobj=''
643mallocsrc=''
644malloctype=''
645usemymalloc=''
16d20bd9
AD
646installman1dir=''
647man1dir=''
648man1direxp=''
649man1ext=''
650installman3dir=''
651man3dir=''
652man3direxp=''
653man3ext=''
2304df62
AD
654huge=''
655large=''
656medium=''
657models=''
658small=''
659split=''
a0d0e21e 660modetype=''
2304df62
AD
661mydomain=''
662myhostname=''
663phostname=''
664c=''
665n=''
8e07c86e
AD
666d_eofnblk=''
667eagain=''
668o_nonblock=''
669rd_nodata=''
dfe9444c
AD
670netdb_hlen_type=''
671netdb_host_type=''
672netdb_name_type=''
673netdb_net_type=''
2304df62
AD
674groupcat=''
675hostcat=''
676passcat=''
85e6fe83
LW
677orderlib=''
678ranlib=''
2304df62
AD
679package=''
680spackage=''
2c7991dc 681pager=''
bfb7748a 682apiversion=''
ecfc5424 683patchlevel=''
760ac839 684subversion=''
bfb7748a 685version=''
8e07c86e 686perladmin=''
4633a7c4 687perlpath=''
dfe9444c 688pidtype=''
a0d0e21e 689prefix=''
1aef975c 690prefixexp=''
2304df62
AD
691installprivlib=''
692privlib=''
693privlibexp=''
694prototype=''
693762b4 695ptrsize=''
2304df62
AD
696randbits=''
697installscript=''
698scriptdir=''
699scriptdirexp=''
a0d0e21e 700selecttype=''
8ff267be 701sh=''
2304df62 702sig_name=''
dfe9444c 703sig_name_init=''
8e07c86e 704sig_num=''
4633a7c4
LW
705installsitearch=''
706sitearch=''
707sitearchexp=''
25f94b33
AD
708installsitelib=''
709sitelib=''
710sitelibexp=''
a0d0e21e
LW
711sizetype=''
712so=''
2304df62
AD
713sharpbang=''
714shsharp=''
715spitshell=''
dfe9444c 716src=''
a0d0e21e 717ssizetype=''
4633a7c4 718startperl=''
2304df62
AD
719startsh=''
720stdchar=''
721sysman=''
722uidtype=''
723nm_opt=''
40a7a20a 724nm_so_opt=''
2304df62
AD
725runnm=''
726usenm=''
8ff267be 727useperlio=''
693762b4 728d_oldpthreads=''
dfe9444c 729usethreads=''
2304df62
AD
730incpath=''
731mips=''
732mips_type=''
733usrinc=''
734defvoidused=''
735voidflags=''
28e8609d 736ebcdic=''
2304df62
AD
737CONFIG=''
738
ecfc5424
AD
739define='define'
740undef='undef'
741smallmach='pdp11 i8086 z8000 i80286 iAPX286'
742rmlist=''
743
744: We must find out about Eunice early
745eunicefix=':'
746if test -f /etc/unixtovms; then
747 eunicefix=/etc/unixtovms
748fi
749if test -f /etc/unixtovms.exe; then
750 eunicefix=/etc/unixtovms.exe
751fi
752
753: list of known cpp symbols, sorted alphabetically
754al="AMIX BIT_MSF BSD BSD4_3 BSD_NET2 CMU CRAY DGUX DOLPHIN DPX2"
755al="$al GO32 GOULD_PN HP700 I386 I80960 I960 Lynx M68000 M68K MACH"
756al="$al MIPSEB MIPSEL MSDOS MTXINU MULTIMAX MVS"
757al="$al M_COFF M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM"
758al="$al M_SYS3 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX"
759al="$al NeXT OCS88 OSF1 PARISC PC532 PORTAR POSIX"
760al="$al PWB R3000 RES RISC6000 RT Sun386i SVR3 SVR4"
761al="$al SYSTYPE_BSD SYSTYPE_SVR4 SYSTYPE_SYSV Tek4132 Tek4300"
762al="$al UMAXV USGr4 USGr4_2 UTEK UTS UTek UnicomPBB UnicomPBD Utek"
763al="$al VMS Xenix286"
2fb0af1a 764al="$al _AIX _AIX32 _AIX370 _AIX41 _AM29000 _COFF _CRAY _CX_UX _EPI _POWER"
ecfc5424
AD
765al="$al _IBMESA _IBMR2 _M88K _M88KBCS_TARGET"
766al="$al _MIPSEB _MIPSEL _M_COFF _M_I86 _M_I86SM _M_SYS3"
767al="$al _M_SYS5 _M_SYSIII _M_SYSV _M_UNIX _M_XENIX _NLS _PGC_ _R3000"
768al="$al _SYSTYPE_BSD _SYSTYPE_BSD43 _SYSTYPE_SVR4"
769al="$al _SYSTYPE_SYSV _SYSV3 _U370 _UNICOS"
770al="$al __386BSD__ __BIG_ENDIAN __BIG_ENDIAN__ __BSD_4_4__"
771al="$al __DGUX__ __DPX2__ __H3050R __H3050RX"
772al="$al __LITTLE_ENDIAN __LITTLE_ENDIAN__ __MACH__"
773al="$al __MIPSEB __MIPSEB__ __MIPSEL __MIPSEL__"
774al="$al __Next__ __OSF1__ __PARAGON__ __PGC__ __PWB __STDC__"
775al="$al __SVR4_2__ __UMAXV__"
776al="$al ____386BSD____ __alpha __alpha__ __amiga"
777al="$al __bsd4_2 __bsd4_2__ __bsdi__ __convex__"
778al="$al __host_mips__"
779al="$al __hp9000s200 __hp9000s300 __hp9000s400 __hp9000s500"
780al="$al __hp9000s500 __hp9000s700 __hp9000s800"
781al="$al __hppa __hpux __hp_osf __i286 __i286__ __i386 __i386__"
782al="$al __i486 __i486__ __i860 __i860__ __ibmesa __ksr1__ __linux__"
783al="$al __m68k __m68k__ __m88100__ __m88k __m88k__"
784al="$al __mc68000 __mc68000__ __mc68020 __mc68020__"
785al="$al __mc68030 __mc68030__ __mc68040 __mc68040__"
786al="$al __mc88100 __mc88100__ __mips __mips__"
787al="$al __motorola__ __osf__ __pa_risc __sparc__ __stdc__"
788al="$al __sun __sun__ __svr3__ __svr4__ __ultrix __ultrix__"
789al="$al __unix __unix__ __uxpm__ __uxps__ __vax __vax__"
790al="$al _host_mips _mips _unix"
791al="$al a29k aegis aix aixpc alliant alpha am29000 amiga ansi ardent"
792al="$al apollo ardent att386 att3b"
793al="$al bsd bsd43 bsd4_2 bsd4_3 bsd4_4 bsdi bull"
794al="$al cadmus clipper concurrent convex cray ctix"
795al="$al dmert encore gcos gcx gimpel gould"
796al="$al hbullx20 hcx host_mips hp200 hp300 hp700 hp800"
797al="$al hp9000 hp9000s300 hp9000s400 hp9000s500"
798al="$al hp9000s700 hp9000s800 hp9k8 hppa hpux"
799al="$al i186 i286 i386 i486 i8086"
800al="$al i80960 i860 iAPX286 ibm ibm032 ibmrt interdata is68k"
801al="$al ksr1 linux luna luna88k m68k m88100 m88k"
802al="$al mc300 mc500 mc68000 mc68010 mc68020 mc68030"
803al="$al mc68040 mc68060 mc68k mc68k32 mc700"
804al="$al mc88000 mc88100 merlin mert mips mvs n16"
805al="$al ncl_el ncl_mr"
806al="$al news1500 news1700 news1800 news1900 news3700"
807al="$al news700 news800 news900 ns16000 ns32000"
808al="$al ns32016 ns32332 ns32k nsc32000 os osf"
809al="$al parisc pc532 pdp11 plexus posix pyr"
810al="$al riscix riscos scs sequent sgi sinix sony sony_news"
811al="$al sonyrisc sparc sparclite spectrum stardent stratos"
812al="$al sun sun3 sun386 svr4 sysV68 sysV88"
813al="$al titan tower tower32 tower32_200 tower32_600 tower32_700"
814al="$al tower32_800 tower32_850 tss u370 u3b u3b2 u3b20 u3b200"
815al="$al u3b20d u3b5 ultrix unix unixpc unos vax venix vms"
816al="$al xenix z8000"
817
ecfc5424
AD
818i_whoami=''
819: change the next line if compiling for Xenix/286 on Xenix/386
820xlibpth='/usr/lib/386 /lib/386'
821
8e07c86e
AD
822: Possible local library directories to search.
823loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
824loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
825
ecfc5424 826: general looking path for locating libraries
dfe9444c 827glibpth="/shlib /usr/shlib /lib/pa1.1 /usr/lib/large"
4b40f7a3
SV
828glibpth="$glibpth /lib /usr/lib $xlibpth"
829glibpth="$glibpth /lib/large /usr/lib/small /lib/small"
830glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
ecfc5424
AD
831
832: Private path used by Configure to find libraries. Its value
833: is prepended to libpth. This variable takes care of special
834: machines, like the mips. Usually, it should be empty.
835plibpth=''
836
dfe9444c
AD
837: default library list
838libswanted=''
dfe9444c
AD
839: Possible local include directories to search.
840: Set locincpth to "" in a hint file to defeat local include searches.
841locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
842locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
843:
844: no include file wanted by default
845inclwanted=''
846
847: Trailing extension. Override this in a hint file, if needed.
4e2a5f63 848_exe=''
dfe9444c
AD
849: Extra object files, if any, needed on this platform.
850archobjs=''
851groupstype=''
bfb7748a
AD
852: full support for void wanted by default
853defvoidused=15
854
dfe9444c
AD
855: set useposix=false in your hint file to disable the POSIX extension.
856useposix=true
857: set useopcode=false in your hint file to disable the Opcode extension.
858useopcode=true
859: set usethreads on the Configure command line to enable threads.
ecfc5424 860: List of libraries we want.
693762b4
AD
861: If anyone needs -lnet, put it in a hint file.
862libswanted='sfio socket inet nsl nm ndbm gdbm dbm db malloc dl'
ecfc5424
AD
863libswanted="$libswanted dld ld sun m c cposix posix ndir dir crypt"
864libswanted="$libswanted ucb bsd BSD PW x"
1aef975c 865: We probably want to search /usr/shlib before most other libraries.
94b6baf5 866: This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
ecfc5424
AD
867glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
868glibpth="/usr/shlib $glibpth"
869: Do not use vfork unless overridden by a hint file.
870usevfork=false
871
8ff267be
PP
872: Find the basic shell for Bourne shell scripts
873case "$sh" in
874'')
8ff267be
PP
875 case "$SYSTYPE" in
876 *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
877 *) xxx='/bin/sh';;
878 esac
879 if test -f "$xxx"; then
880 sh="$xxx"
881 else
882 : Build up a list and do a single loop so we can 'break' out.
883 pth=`echo $PATH | sed -e "s/$p_/ /g"`
884 for xxx in sh bash ksh pdksh ash; do
885 for p in $pth; do
886 try="$try ${p}/${xxx}"
887 done
888 done
889 for xxx in $try; do
890 if test -f "$xxx"; then
891 sh="$xxx";
8ff267be
PP
892 break
893 elif test -f "$xxx.exe"; then
894 sh="$xxx";
8ff267be
PP
895 break
896 fi
897 done
898 fi
899 ;;
900esac
901
902case "$sh" in
903'') cat <<EOM >&2
904$me: Fatal Error: I can't find a Bourne Shell anywhere.
dfe9444c 905
8ff267be 906Usually it's in /bin/sh. How did you even get this far?
bfb7748a 907Please contact me (Andy Dougherty) at doughera@lafayette.edu and
dfe9444c 908we'll try to straighten this all out.
8ff267be
PP
909EOM
910 exit 1
911 ;;
912esac
913
760ac839 914: see if sh knows # comments
8ff267be 915if `$sh -c '#' >/dev/null 2>&1`; then
760ac839
LW
916 shsharp=true
917 spitshell=cat
760ac839
LW
918 xcat=/bin/cat
919 test -f $xcat || xcat=/usr/bin/cat
920 echo "#!$xcat" >try
921 $eunicefix try
922 chmod +x try
923 ./try > today
924 if test -s today; then
760ac839
LW
925 sharpbang='#!'
926 else
927 echo "#! $xcat" > try
928 $eunicefix try
929 chmod +x try
930 ./try > today
931 if test -s today; then
760ac839
LW
932 sharpbang='#! '
933 else
760ac839
LW
934 sharpbang=': use '
935 fi
936 fi
937else
dfe9444c 938 echo " "
8ff267be 939 echo "Your $sh doesn't grok # comments--I will strip them later on."
760ac839
LW
940 shsharp=false
941 cd ..
942 echo "exec grep -v '^[ ]*#'" >spitshell
943 chmod +x spitshell
944 $eunicefix spitshell
945 spitshell=`pwd`/spitshell
946 cd UU
947 echo "I presume that if # doesn't work, #! won't work either!"
948 sharpbang=': use '
949fi
950rm -f try today
951
952: figure out how to guarantee sh startup
8ff267be
PP
953case "$startsh" in
954'') startsh=${sharpbang}${sh} ;;
955*)
760ac839 956esac
760ac839
LW
957cat >try <<EOSS
958$startsh
959set abc
960test "$?abc" != 1
961EOSS
962
963chmod +x try
964$eunicefix try
965if ./try; then
8ff267be 966 : echo "Yup, it does."
760ac839 967else
dfe9444c
AD
968 echo "Hmm... '$startsh' does not guarantee sh startup..."
969 echo "You may have to fix up the shell scripts to make sure $sh runs them."
760ac839
LW
970fi
971rm -f try
972
aebf16e7
AD
973
974: Save command line options in file UU/cmdline.opt for later use in
975: generating config.sh.
976cat > cmdline.opt <<EOSH
977# Configure command line arguments.
978config_arg0='$0'
979config_args='$*'
980config_argc=$#
981EOSH
982argn=1
983for arg in "$@"; do
984 cat >>cmdline.opt <<EOSH
985config_arg$argn='$arg'
986EOSH
987 argn=`expr $argn + 1`
988done
989
2304df62
AD
990: produce awk script to parse command line options
991cat >options.awk <<'EOF'
992BEGIN {
16d20bd9 993 optstr = "dD:eEf:hKOrsSU:V"; # getopt-style specification
2304df62
AD
994
995 len = length(optstr);
996 for (i = 1; i <= len; i++) {
997 c = substr(optstr, i, 1);
998 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
999 if (a == ":") {
1000 arg[c] = 1;
1001 i++;
1002 }
1003 opt[c] = 1;
1004 }
1005}
1006{
1007 expect = 0;
1008 str = $0;
1009 if (substr(str, 1, 1) != "-") {
1010 printf("'%s'\n", str);
1011 next;
1012 }
1013 len = length($0);
1014 for (i = 2; i <= len; i++) {
1015 c = substr(str, i, 1);
1016 if (!opt[c]) {
1017 printf("-%s\n", substr(str, i));
1018 next;
1019 }
1020 printf("-%s\n", c);
1021 if (arg[c]) {
1022 if (i < len)
1023 printf("'%s'\n", substr(str, i + 1));
1024 else
1025 expect = 1;
1026 next;
1027 }
1028 }
1029}
1030END {
1031 if (expect)
1032 print "?";
1033}
1034EOF
1035
1036: process the command line options
4633a7c4
LW
1037set X `for arg in "$@"; do echo "X$arg"; done |
1038 sed -e s/X// | awk -f options.awk`
2304df62
AD
1039eval "set $*"
1040shift
1041rm -f options.awk
1042
1043: set up default values
1044fastread=''
1045reuseval=false
1046config_sh=''
1047alldone=''
1048error=''
1049silent=''
1050extractsh=''
ecfc5424 1051override=''
16d20bd9 1052knowitall=''
1aef975c 1053rm -f optdef.sh
28757baa
PP
1054cat >optdef.sh <<EOS
1055$startsh
1056EOS
2304df62 1057
dfe9444c 1058
2304df62
AD
1059: option parsing
1060while test $# -gt 0; do
1061 case "$1" in
1062 -d) shift; fastread=yes;;
1063 -e) shift; alldone=cont;;
1064 -f)
1065 shift
1066 cd ..
1067 if test -r "$1"; then
1068 config_sh="$1"
1069 else
a0d0e21e 1070 echo "$me: cannot read config file $1." >&2
2304df62
AD
1071 error=true
1072 fi
1073 cd UU
1074 shift;;
1075 -h) shift; error=true;;
1076 -r) shift; reuseval=true;;
dfe9444c 1077 -s) shift; silent=true; realsilent=true;;
2304df62 1078 -E) shift; alldone=exit;;
16d20bd9 1079 -K) shift; knowitall=true;;
ecfc5424 1080 -O) shift; override=true;;
dfe9444c 1081 -S) shift; silent=true; extractsh=true;;
a0d0e21e
LW
1082 -D)
1083 shift
1084 case "$1" in
1085 *=)
1086 echo "$me: use '-U symbol=', not '-D symbol='." >&2
1087 echo "$me: ignoring -D $1" >&2
1088 ;;
ecfc5424 1089 *=*) echo "$1" | \
1aef975c
AD
1090 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1091 *) echo "$1='define'" >> optdef.sh;;
a0d0e21e
LW
1092 esac
1093 shift
1094 ;;
1095 -U)
1096 shift
1097 case "$1" in
1aef975c 1098 *=) echo "$1" >> optdef.sh;;
a0d0e21e
LW
1099 *=*)
1100 echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1101 echo "$me: ignoring -U $1" >&2
1102 ;;
1aef975c 1103 *) echo "$1='undef'" >> optdef.sh;;
a0d0e21e
LW
1104 esac
1105 shift
1106 ;;
dfe9444c 1107 -V) echo "$me generated by metaconfig 3.0 PL70." >&2
2304df62
AD
1108 exit 0;;
1109 --) break;;
a0d0e21e 1110 -*) echo "$me: unknown option $1" >&2; shift; error=true;;
2304df62
AD
1111 *) break;;
1112 esac
1113done
1114
1115case "$error" in
1116true)
1117 cat >&2 <<EOM
2afac517 1118Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
a0d0e21e 1119 [-U symbol] [-U symbol=]
2304df62
AD
1120 -d : use defaults for all answers.
1121 -e : go on without questioning past the production of config.sh.
1122 -f : specify an alternate default configuration file.
1123 -h : print this help message and exit (with an error status).
1124 -r : reuse C symbols value if possible (skips costly nm extraction).
1125 -s : silent mode, only echoes questions and essential information.
a0d0e21e
LW
1126 -D : define symbol to have some value:
1127 -D symbol symbol gets the value 'define'
1128 -D symbol=value symbol gets the value 'value'
2304df62 1129 -E : stop at the end of questions, after having produced config.sh.
16d20bd9 1130 -K : do not use unless you know what you are doing.
ecfc5424 1131 -O : let -D and -U override definitions from loaded configuration file.
2304df62 1132 -S : perform variable substitutions on all .SH files (can mix with -f)
a0d0e21e
LW
1133 -U : undefine symbol:
1134 -U symbol symbol gets the value 'undef'
1135 -U symbol= symbol gets completely empty
2304df62
AD
1136 -V : print version number and exit (with a zero status).
1137EOM
1138 exit 1
1139 ;;
1140esac
1141
dfe9444c
AD
1142: Sanity checks
1143case "$fastread$alldone" in
1144yescont|yesexit) ;;
1145*)
1146 if test ! -t 0; then
1147 echo "Say 'sh Configure', not 'sh <Configure'"
1148 exit 1
1149 fi
1150 ;;
1151esac
1152
2304df62
AD
1153exec 4>&1
1154case "$silent" in
1155true) exec 1>/dev/null;;
1156esac
1157
ecfc5424 1158: run the defines and the undefines, if any, but leave the file out there...
1aef975c
AD
1159touch optdef.sh
1160. ./optdef.sh
a0d0e21e 1161
2304df62 1162: set package name
85e6fe83 1163package=perl5
1aef975c
AD
1164first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1165last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1166case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1167ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1168*) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1169esac
2304df62 1170
2304df62
AD
1171: Some greps do not return status, grrr.
1172echo "grimblepritz" >grimble
1173if grep blurfldyick grimble >/dev/null 2>&1 ; then
1174 contains=contains
1175elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1176 contains=grep
1177else
1178 contains=contains
1179fi
1180rm -f grimble
1181: the following should work in any shell
1182case "$contains" in
1183contains*)
1184 echo " "
1185 echo "AGH! Grep doesn't return a status. Attempting remedial action."
1186 cat >contains <<'EOSS'
1187grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1188EOSS
1189chmod +x contains
1190esac
1191
dfe9444c
AD
1192: Find the path to the source tree
1193case "$src" in
1194'') case "$0" in
1195 */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`;;
1196 *) src='.';;
1197 esac;;
1198esac
1199case "$src" in
1200'') src=/
1201 rsrc=/
1202 ;;
1203/*) rsrc="$src";;
1204*) rsrc="../$src";;
1205esac
1206if test -f $rsrc/Configure && \
1207 $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1208then
1209 : found it, so we are ok.
1210else
1211 rsrc=''
1212 for src in . .. ../.. ../../.. ../../../..; do
1213 if test -f ../$src/Configure && \
1214 $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1215 then
1216 rsrc=../$src
1217 break
1218 fi
1219 done
1220fi
1221case "$rsrc" in
1222'')
1223 cat <<EOM >&4
1224
1225Sorry, I can't seem to locate the source dir for $package. Please start
1226Configure with an explicit path -- i.e. /some/path/Configure.
1227
1228EOM
1229 exit 1
1230 ;;
1231../.) rsrc='..';;
1232*)
1233 echo " "
1234 echo "Sources for $package found in \"$src\"." >&4
1235 ;;
1236esac
1237
1238: script used to extract .SH files with variable substitutions
1239cat >extract <<'EOS'
1240CONFIG=true
1241echo "Doing variable substitutions on .SH files..."
1242if test -f $src/MANIFEST; then
1243 set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH'`
1244else
1245 echo "(Looking for .SH files under the source directory.)"
1246 set x `(cd $src; find . -name "*.SH" -print)`
1247fi
1248shift
1249case $# in
12500) set x `(cd $src; echo *.SH)`; shift;;
1251esac
1252if test ! -f $src/$1; then
1253 shift
1254fi
1255mkdir_p='
1256name=$1;
1257create="";
1258while test $name; do
1259 if test ! -d "$name"; then
1260 create="$name $create";
1261 name=`echo $name | sed -e "s|^[^/]*$||"`;
1262 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1263 else
1264 name="";
1265 fi;
1266done;
1267for file in $create; do
1268 mkdir $file;
1269done
1270'
1271for file in $*; do
1272 case "$src" in
1273 ".")
1274 case "$file" in
1275 */*)
1276 dir=`expr X$file : 'X\(.*\)/'`
1277 file=`expr X$file : 'X.*/\(.*\)'`
1278 (cd $dir && . ./$file)
1279 ;;
1280 *)
1281 . ./$file
1282 ;;
1283 esac
1284 ;;
1285 *)
1286 case "$file" in
1287 */*)
1288 dir=`expr X$file : 'X\(.*\)/'`
1289 file=`expr X$file : 'X.*/\(.*\)'`
1290 (set x $dir; shift; eval $mkdir_p)
1291 sh <$src/$dir/$file
1292 ;;
1293 *)
1294 sh <$src/$file
1295 ;;
1296 esac
1297 ;;
1298 esac
1299done
1300if test -f $src/config_h.SH; then
1301 if test ! -f config.h; then
1302 : oops, they left it out of MANIFEST, probably, so do it anyway.
1303 . $src/config_h.SH
1304 fi
1305fi
1306EOS
1307
1308: extract files and exit if asked to do so
1309case "$extractsh" in
1310true)
1311 case "$realsilent" in
1312 true) ;;
1313 *) exec 1>&4;;
1314 esac
1315 case "$config_sh" in
1316 '') config_sh='config.sh';;
1317 esac
1318 echo " "
1319 echo "Fetching answers from $config_sh..."
1320 cd ..
1321 . $config_sh
1322 test "$override" && . ./optdef.sh
1323 echo " "
1324 . UU/extract
1325 rm -rf UU
1326 echo "Done."
1327 exit 0
1328 ;;
1329esac
1330
1331: Eunice requires " " instead of "", can you believe it
1332echo " "
1333: Here we go...
1334echo "Beginning of configuration questions for $package."
1335
1336trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1337
2304df62
AD
1338: first determine how to suppress newline on echo command
1339echo " "
1340echo "Checking echo to see how to suppress newlines..."
1341(echo "hi there\c" ; echo " ") >.echotmp
1342if $contains c .echotmp >/dev/null 2>&1 ; then
1343 echo "...using -n."
1344 n='-n'
1345 c=''
1346else
1347 cat <<'EOM'
1348...using \c
1349EOM
1350 n=''
1351 c='\c'
1352fi
1353echo $n "The star should be here-->$c"
1354echo '*'
1355rm -f .echotmp
1356
1357: Now test for existence of everything in MANIFEST
1358echo " "
dfe9444c 1359if test -f $rsrc/MANIFEST; then
2304df62 1360 echo "First let's make sure your kit is complete. Checking..." >&4
dfe9444c 1361 awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
2304df62 1362 rm -f missing
dfe9444c 1363 tmppwd=`pwd`
2304df62 1364 for filelist in x??; do
dfe9444c 1365 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
2304df62
AD
1366 done
1367 if test -s missing; then
1368 cat missing >&4
1369 cat >&4 <<'EOM'
1370
1371THIS PACKAGE SEEMS TO BE INCOMPLETE.
1372
1373You have the option of continuing the configuration process, despite the
1374distinct possibility that your kit is damaged, by typing 'y'es. If you
1375do, don't blame me if something goes wrong. I advise you to type 'n'o
bfb7748a 1376and contact the author (doughera@lafayette.edu).
2304df62
AD
1377
1378EOM
1379 echo $n "Continue? [n] $c" >&4
1380 read ans
1381 case "$ans" in
1382 y*)
1383 echo "Continuing..." >&4
1384 rm -f missing
1385 ;;
1386 *)
1387 echo "ABORTING..." >&4
1388 kill $$
1389 ;;
1390 esac
1391 else
dfe9444c 1392 echo "Looks good..."
2304df62
AD
1393 fi
1394else
1395 echo "There is no MANIFEST file. I hope your kit is complete !"
1396fi
1397rm -f missing x??
1398
1399: compute the number of columns on the terminal for proper question formatting
1400case "$COLUMNS" in
1401'') COLUMNS='80';;
1402esac
1403
1404: set up the echo used in my read
1405myecho="case \"\$xxxm\" in
1406'') echo $n \"\$rp $c\" >&4;;
1407*) case \"\$rp\" in
1408 '') echo $n \"[\$xxxm] $c\";;
1409 *)
1410 if test \`echo \"\$rp [\$xxxm] \" | wc -c\` -ge $COLUMNS; then
1411 echo \"\$rp\" >&4
1412 echo $n \"[\$xxxm] $c\" >&4
1413 else
1414 echo $n \"\$rp [\$xxxm] $c\" >&4
1415 fi
1416 ;;
1417 esac;;
1418esac"
1419
1420: now set up to do reads with possible shell escape and default assignment
1421cat <<EOSC >myread
28757baa 1422$startsh
2304df62
AD
1423xxxm=\$dflt
1424$myecho
1425ans='!'
1426case "\$fastread" in
1427yes) case "\$dflt" in
1428 '') ;;
1429 *) ans='';
1430 case "\$silent-\$rp" in
1431 true-) ;;
1432 *) echo " " >&4;;
1433 esac;;
1434 esac;;
1435*) case "\$silent" in
1436 true) case "\$rp" in
1437 '') ans='';;
1438 esac;;
1439 esac;;
1440esac
1441while expr "X\$ans" : "X!" >/dev/null; do
1442 read answ
1443 set x \$xxxm
1444 shift
dfe9444c 1445 aok=''; eval "ans=\\"\$answ\\"" && aok=y
2304df62 1446 case "\$answ" in
dfe9444c
AD
1447 "!")
1448 sh 1>&4
1449 echo " "
1450 $myecho
1451 ;;
1452 !*)
1453 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1454 shift
1455 sh 1>&4 -c "\$*"
1456 echo " "
1457 $myecho
1458 ;;
2304df62
AD
1459 "\$ans")
1460 case "\$ans" in
ecfc5424
AD
1461 \\&*)
1462 set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1463 shift
1464 case "\$1" in
1465 -d)
1466 fastread=yes
40a7a20a 1467 echo "(OK, I'll run with -d after this question.)" >&4
ecfc5424
AD
1468 ;;
1469 -*)
40a7a20a 1470 echo "*** Sorry, \$1 not supported yet." >&4
ecfc5424
AD
1471 ;;
1472 esac
1473 $myecho
1474 ans=!
1475 ;;
2304df62
AD
1476 esac;;
1477 *)
1478 case "\$aok" in
1479 y)
1480 echo "*** Substitution done -- please confirm."
1481 xxxm="\$ans"
c9795ab7 1482 ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2304df62
AD
1483 xxxm="\$ans"
1484 ans=!
1485 ;;
1486 *)
1487 echo "*** Error -- try again."
1488 ans=!
1489 ;;
1490 esac
1491 $myecho
1492 ;;
1493 esac
1494 case "\$ans\$xxxm\$nostick" in
1495 '')
1496 ans=!
1497 $myecho
1498 ;;
1499 esac
1500done
1501case "\$ans" in
1502'') ans="\$xxxm";;
1503esac
1504EOSC
1505
1506: create .config dir to save info across Configure sessions
1507test -d ../.config || mkdir ../.config
1508cat >../.config/README <<EOF
1509This directory created by Configure to save information that should
dfe9444c 1510persist across sessions for $package.
2304df62
AD
1511
1512You may safely delete it if you wish.
1513EOF
1514
1515: general instructions
1516needman=true
1517firsttime=true
760ac839 1518user=`(logname) 2>/dev/null`
dfe9444c
AD
1519case "$user" in
1520'') user=`whoami 2>&1`;;
760ac839 1521esac
2304df62
AD
1522if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1523 firsttime=false
1524 echo " "
1525 rp='Would you like to see the instructions?'
1526 dflt=n
1527 . ./myread
1528 case "$ans" in
1529 [yY]*) ;;
1530 *) needman=false;;
1531 esac
1532fi
1533if $needman; then
1534 cat <<EOH
4e2a5f63 1535
2304df62 1536This installation shell script will examine your system and ask you questions
a0d0e21e 1537to determine how the perl5 package should be installed. If you get
2304df62
AD
1538stuck on a question, you may use a ! shell escape to start a subshell or
1539execute a command. Many of the questions will have default answers in square
1540brackets; typing carriage return will give you the default.
1541
1542On some of the questions which ask for file or directory names you are allowed
1543to use the ~name construct to specify the login directory belonging to "name",
1544even if you don't have a shell which knows about that. Questions where this is
1545allowed will be marked "(~name ok)".
1546
1547EOH
1548 rp=''
1549 dflt='Type carriage return to continue'
1550 . ./myread
1551 cat <<'EOH'
1552
1553The prompter used in this script allows you to use shell variables and
1554backticks in your answers. You may use $1, $2, etc... to refer to the words
1555in the default answer, as if the default line was a set of arguments given to a
1556script shell. This means you may also use $* to repeat the whole default line,
1557so you do not have to re-type everything to add something to the default.
1558
1559Everytime there is a substitution, you will have to confirm. If there is an
1560error (e.g. an unmatched backtick), the default answer will remain unchanged
1561and you will be prompted again.
1562
1563If you are in a hurry, you may run 'Configure -d'. This will bypass nearly all
1564the questions and use the computed defaults (or the previous answers if there
1565was already a config.sh file). Type 'Configure -h' for a list of options.
ecfc5424 1566You may also start interactively and then answer '& -d' at any prompt to turn
dfe9444c 1567on the non-interactive behaviour for the remainder of the execution.
2304df62
AD
1568
1569EOH
1570 . ./myread
1571 cat <<EOH
1572
1573Much effort has been expended to ensure that this shell script will run on any
1574Unix system. If despite that it blows up on yours, your best bet is to edit
40000a8c
AD
1575Configure and run it again. If you can't run Configure for some reason,
1576you'll have to generate a config.sh file by hand. Whatever problems you
bfb7748a 1577have, let me (doughera@lafayette.edu) know how I blew it.
2304df62
AD
1578
1579This installation script affects things in two ways:
1580
15811) it may do direct variable substitutions on some of the files included
1582 in this kit.
15832) it builds a config.h file for inclusion in C programs. You may edit
1584 any of these files as the need arises after running this script.
1585
1586If you make a mistake on a question, there is no easy way to back up to it
1587currently. The easiest thing to do is to edit config.sh and rerun all the SH
1588files. Configure will offer to let you do this before it runs the SH files.
1589
1590EOH
1591 dflt='Type carriage return to continue'
1592 . ./myread
1593 case "$firsttime" in
1594 true) echo $user >>../.config/instruct;;
1595 esac
1596fi
1597
2304df62
AD
1598: find out where common programs are
1599echo " "
1600echo "Locating common programs..." >&4
1601cat <<EOSC >loc
1602$startsh
1603case \$# in
16040) exit 1;;
1605esac
1606thing=\$1
1607shift
1608dflt=\$1
1609shift
1610for dir in \$*; do
1611 case "\$thing" in
1612 .)
1613 if test -d \$dir/\$thing; then
1614 echo \$dir
1615 exit 0
1616 fi
1617 ;;
1618 *)
a0d0e21e 1619 for thisthing in \$dir/\$thing; do
ecfc5424 1620 : just loop through to pick last item
a0d0e21e 1621 done
25f94b33 1622 if test -f \$thisthing; then
a0d0e21e 1623 echo \$thisthing
2304df62
AD
1624 exit 0
1625 elif test -f \$dir/\$thing.exe; then
c4f23d77
AD
1626 if test -n "$DJGPP"; then
1627 echo \$dir/\$thing.exe
1628 else
1629 : on Eunice apparently
1630 echo \$dir/\$thing
1631 fi
2304df62
AD
1632 exit 0
1633 fi
1634 ;;
1635 esac
1636done
1637echo \$dflt
1638exit 1
1639EOSC
1640chmod +x loc
1641$eunicefix loc
1642loclist="
1643awk
1644cat
ecfc5424 1645comm
2304df62
AD
1646cp
1647echo
1648expr
a0d0e21e 1649find
2304df62 1650grep
a0d0e21e 1651ls
dfe9444c 1652make
2304df62 1653mkdir
2304df62
AD
1654rm
1655sed
1656sort
85e6fe83 1657touch
2304df62
AD
1658tr
1659uniq
1660"
1661trylist="
1662Mcc
dfe9444c 1663ar
2304df62
AD
1664byacc
1665cpp
1666csh
1667date
1668egrep
8ff267be 1669gzip
2c7991dc 1670less
2304df62 1671line
8ff267be 1672ln
2c7991dc 1673more
693762b4 1674nm
2304df62
AD
1675nroff
1676perl
2c7991dc 1677pg
40a7a20a 1678sendmail
693762b4 1679tee
2304df62
AD
1680test
1681uname
8ff267be 1682zip
2304df62 1683"
8e07c86e 1684pth=`echo $PATH | sed -e "s/$p_/ /g"`
2304df62
AD
1685pth="$pth /lib /usr/lib"
1686for file in $loclist; do
dfe9444c
AD
1687 eval xxx=\$$file
1688 case "$xxx" in
1689 /*|?:[\\/]*)
1690 if test -f "$xxx"; then
1691 : ok
1692 else
1693 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1694 xxx=`./loc $file $file $pth`
1695 fi
1696 ;;
1697 '') xxx=`./loc $file $file $pth`;;
1698 *) xxx=`./loc $xxx $xxx $pth`;;
1699 esac
2304df62
AD
1700 eval $file=$xxx
1701 eval _$file=$xxx
1702 case "$xxx" in
1703 /*)
1704 echo $file is in $xxx.
1705 ;;
8e07c86e
AD
1706 ?:[\\/]*)
1707 echo $file is in $xxx.
1708 ;;
2304df62 1709 *)
25f94b33
AD
1710 echo "I don't know where '$file' is, and my life depends on it." >&4
1711 echo "Go find a public domain implementation or fix your PATH setting!" >&4
4633a7c4 1712 exit 1
2304df62
AD
1713 ;;
1714 esac
1715done
1716echo " "
1717echo "Don't worry if any of the following aren't found..."
1718say=offhand
1719for file in $trylist; do
dfe9444c
AD
1720 eval xxx=\$$file
1721 case "$xxx" in
1722 /*|?:[\\/]*)
1723 if test -f "$xxx"; then
1724 : ok
1725 else
1726 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1727 xxx=`./loc $file $file $pth`
1728 fi
1729 ;;
1730 '') xxx=`./loc $file $file $pth`;;
1731 *) xxx=`./loc $xxx $xxx $pth`;;
1732 esac
2304df62
AD
1733 eval $file=$xxx
1734 eval _$file=$xxx
1735 case "$xxx" in
1736 /*)
1737 echo $file is in $xxx.
1738 ;;
8e07c86e
AD
1739 ?:[\\/]*)
1740 echo $file is in $xxx.
1741 ;;
2304df62
AD
1742 *)
1743 echo "I don't see $file out there, $say."
1744 say=either
1745 ;;
1746 esac
1747done
1748case "$egrep" in
1749egrep)
1750 echo "Substituting grep for egrep."
1751 egrep=$grep
1752 ;;
1753esac
8ff267be
PP
1754case "$ln" in
1755ln)
1756 echo "Substituting cp for ln."
1757 ln=$cp
1758 ;;
1759esac
2304df62
AD
1760case "$test" in
1761test)
1762 echo "Hopefully test is built into your sh."
1763 ;;
1764*)
ecfc5424 1765 if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2304df62
AD
1766 echo "Using the test built into your sh."
1767 test=test
1768 _test=test
1769 fi
1770 ;;
1771esac
1772case "$echo" in
1773echo)
1774 echo "Hopefully echo is built into your sh."
1775 ;;
1776'') ;;
1777*)
1778 echo " "
1779echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
1780 $echo $n "hi there$c" >foo1
1781 echo $n "hi there$c" >foo2
1782 if cmp foo1 foo2 >/dev/null 2>&1; then
1783 echo "They are compatible. In fact, they may be identical."
1784 else
1785 case "$n" in
1786 '-n') n='' c='\c';;
1787 *) n='-n' c='';;
1788 esac
1789 cat <<FOO
1790They are not compatible! You are probably running ksh on a non-USG system.
1791I'll have to use $echo instead of the builtin, since Bourne shell doesn't
1792have echo built in and we may have to run some Bourne shell scripts. That
1793means I'll have to use '$n$c' to suppress newlines now. Life is ridiculous.
1794
1795FOO
1796 $echo $n "The star should be here-->$c"
1797 $echo "*"
1798 fi
1799 $rm -f foo1 foo2
1800 ;;
1801esac
1802
a0d0e21e
LW
1803: determine whether symbolic links are supported
1804echo " "
1805$touch blurfl
1806if $ln -s blurfl sym > /dev/null 2>&1 ; then
1807 echo "Symbolic links are supported." >&4
1808 lns="$ln -s"
1809else
1810 echo "Symbolic links are NOT supported." >&4
1811 lns="$ln"
1812fi
1813$rm -f blurfl sym
1814
ecfc5424
AD
1815: see whether [:lower:] and [:upper:] are supported character classes
1816echo " "
ecfc5424
AD
1817case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1818ABYZ)
1819 echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
1820 up='[:upper:]'
1821 low='[:lower:]'
1822 ;;
28e8609d
JH
1823*) # There is a discontinuity in EBCDIC between 'I' and 'J'
1824 # (0xc9 and 0xd1), therefore that is a nice testing point.
1825 if test "X$up" = X -o "X$low" = X; then
3eaeeeae 1826 case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
28e8609d
JH
1827 ij) up='[A-Z]'
1828 low='[a-z]'
1829 ;;
1830 esac
1831 fi
1832 if test "X$up" = X -o "X$low" = X; then
3eaeeeae 1833 case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
28e8609d
JH
1834 ij) up='A-Z'
1835 low='a-z'
1836 ;;
1837 esac
1838 fi
1839 if test "X$up" = X -o "X$low" = X; then
1840 case "`echo IJ | od -x 2>/dev/null`" in
1841 *C9D1*|*c9d1*)
1842 echo "Hey, this might be EBCDIC." >&4
1843 if test "X$up" = X -o "X$low" = X; then
1844 case "`echo IJ | tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
1845 ij) up='[A-IJ-RS-Z]'
1846 low='[a-ij-rs-z]'
1847 ;;
1848 esac
1849 fi
1850 if test "X$up" = X -o "X$low" = X; then
1851 case "`echo IJ | tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
1852 ij) up='A-IJ-RS-Z'
1853 low='a-ij-rs-z'
1854 ;;
1855 esac
1856 fi
1857 ;;
1858 esac
1859 fi
1860esac
3eaeeeae 1861case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
28e8609d
JH
1862ij)
1863 echo "Using $up and $low to convert case." >&4
1864 ;;
ecfc5424 1865*)
28e8609d
JH
1866 echo "I don't know how to translate letters from upper to lower case." >&4
1867 echo "Your tr is not acting any way I know of." >&4
1868 exit 1
1869 ;;
ecfc5424
AD
1870esac
1871: set up the translation script tr, must be called with ./tr of course
1872cat >tr <<EOSC
1873$startsh
1874case "\$1\$2" in
1875'[A-Z][a-z]') exec $tr '$up' '$low';;
1876'[a-z][A-Z]') exec $tr '$low' '$up';;
1877esac
1878exec $tr "\$@"
1879EOSC
1880chmod +x tr
1881$eunicefix tr
1882
2304df62
AD
1883: Try to determine whether config.sh was made on this system
1884case "$config_sh" in
1885'')
1886myuname=`( ($uname -a) 2>/dev/null || hostname) 2>&1`
28e8609d
JH
1887# tr '[A-Z]' '[a-z]' would not work in EBCDIC
1888# because the A-Z/a-z are not consecutive.
a0d0e21e 1889myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
3eaeeeae 1890 ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
1aef975c 1891newmyuname="$myuname"
2304df62 1892dflt=n
16d20bd9
AD
1893case "$knowitall" in
1894'')
1895 if test -f ../config.sh; then
1896 if $contains myuname= ../config.sh >/dev/null 2>&1; then
1897 eval "`grep myuname= ../config.sh`"
1898 fi
1899 if test "X$myuname" = "X$newmyuname"; then
1900 dflt=y
1901 fi
2304df62 1902 fi
16d20bd9
AD
1903 ;;
1904*) dflt=y;;
1905esac
2304df62
AD
1906
1907: Get old answers from old config file if Configure was run on the
1908: same system, otherwise use the hints.
1909hint=default
1910cd ..
1911if test -f config.sh; then
16d20bd9
AD
1912 echo " "
1913 rp="I see a config.sh file. Shall I use it to set the defaults?"
2304df62
AD
1914 . UU/myread
1915 case "$ans" in
1916 n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;;
1917 *) echo "Fetching default answers from your old config.sh file..." >&4
ecfc5424
AD
1918 tmp_n="$n"
1919 tmp_c="$c"
85cad39c 1920 tmp_sh="$sh"
2304df62
AD
1921 . ./config.sh
1922 cp config.sh UU
ecfc5424
AD
1923 n="$tmp_n"
1924 c="$tmp_c"
85cad39c
PP
1925 : Older versions did not always set $sh. Catch re-use of such
1926 : an old config.sh.
1927 case "$sh" in
1928 '') sh="$tmp_sh" ;;
1929 esac
2304df62
AD
1930 hint=previous
1931 ;;
1932 esac
1933fi
1934if test ! -f config.sh; then
1935 $cat <<EOM
1936
4e2a5f63
AD
1937First time through, eh? I have some defaults handy for some systems
1938that need some extra help getting the Configure answers right:
2304df62
AD
1939
1940EOM
dfe9444c 1941 (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/ /g' >&4
2304df62
AD
1942 dflt=''
1943 : Half the following guesses are probably wrong... If you have better
bfb7748a 1944 : tests or hints, please send them to doughera@lafayette.edu
2304df62 1945 : The metaconfig authors would also appreciate a copy...
a0d0e21e 1946 $test -f /irix && osname=irix
85e6fe83
LW
1947 $test -f /xenix && osname=sco_xenix
1948 $test -f /dynix && osname=dynix
1949 $test -f /dnix && osname=dnix
5f05dabc
PP
1950 $test -f /lynx.os && osname=lynxos
1951 $test -f /unicos && osname=unicos && osvers=`$uname -r`
7a4c00b4 1952 $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
85e6fe83 1953 $test -f /bin/mips && /bin/mips && osname=mips
ecfc5424
AD
1954 $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
1955 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
a0d0e21e
LW
1956 $test -d /usr/apollo/bin && osname=apollo
1957 $test -f /etc/saf/_sactab && osname=svr4
85e6fe83 1958 $test -d /usr/include/minix && osname=minix
4633a7c4 1959 if $test -d /MachTen; then
dfe9444c 1960 osname=machten
4633a7c4 1961 if $test -x /sbin/version; then
dfe9444c 1962 osvers=`/sbin/version | $awk '{print $2}' |
4633a7c4
LW
1963 $sed -e 's/[A-Za-z]$//'`
1964 elif $test -x /usr/etc/version; then
dfe9444c 1965 osvers=`/usr/etc/version | $awk '{print $2}' |
4633a7c4
LW
1966 $sed -e 's/[A-Za-z]$//'`
1967 else
1968 osvers="$2.$3"
1969 fi
1970 fi
2304df62
AD
1971 if $test -f $uname; then
1972 set X $myuname
1973 shift
1974
2304df62 1975 case "$5" in
85e6fe83 1976 fps*) osname=fps ;;
2304df62
AD
1977 mips*)
1978 case "$4" in
85e6fe83
LW
1979 umips) osname=umips ;;
1980 *) osname=mips ;;
2304df62 1981 esac;;
85e6fe83
LW
1982 [23]100) osname=mips ;;
1983 next*) osname=next ;;
ecfc5424
AD
1984 i386*)
1985 if $test -f /etc/kconfig; then
1986 osname=isc
a0d0e21e
LW
1987 if test "$lns" = "ln -s"; then
1988 osvers=4
1989 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
1990 osvers=3
2304df62 1991 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
a0d0e21e 1992 osvers=2
ecfc5424
AD
1993 fi
1994 fi
1995 ;;
c4f23d77
AD
1996 pc*)
1997 if test -n "$DJGPP"; then
1998 osname=dos
1999 osvers=djgpp
2000 fi
2001 ;;
2304df62
AD
2002 esac
2003
2004 case "$1" in
a0d0e21e
LW
2005 aix) osname=aix
2006 tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2007 case "$tmp" in
1aef975c 2008 'not found') osvers="$4"."$3" ;;
a0d0e21e
LW
2009 '<3240'|'<>3240') osvers=3.2.0 ;;
2010 '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2011 '=3250'|'>3250') osvers=3.2.5 ;;
1aef975c 2012 *) osvers=$tmp;;
a0d0e21e
LW
2013 esac
2014 ;;
23f87696
SZ
2015 *dc.osx) osname=dcosx
2016 osvers="$3"
2017 ;;
a0d0e21e
LW
2018 dnix) osname=dnix
2019 osvers="$3"
2020 ;;
2021 domainos) osname=apollo
2022 osvers="$3"
2023 ;;
2024 dgux) osname=dgux
2025 osvers="$3"
2026 ;;
760ac839
LW
2027 dynixptx*) osname=dynixptx
2028 osvers="$3"
2029 ;;
a0d0e21e
LW
2030 freebsd) osname=freebsd
2031 osvers="$3" ;;
2032 genix) osname=genix ;;
2033 hp*) osname=hpux
bfb7748a 2034 osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
a0d0e21e 2035 ;;
a78b0d02 2036 irix*) osname=irix
a0d0e21e
LW
2037 case "$3" in
2038 4*) osvers=4 ;;
2039 5*) osvers=5 ;;
ecfc5424 2040 *) osvers="$3" ;;
a0d0e21e
LW
2041 esac
2042 ;;
2043 linux) osname=linux
2044 case "$3" in
a0d0e21e
LW
2045 *) osvers="$3" ;;
2046 esac
2047 ;;
28e8609d
JH
2048 MiNT) osname=mint
2049 ;;
2050 netbsd*) osname=netbsd
ecfc5424
AD
2051 osvers="$3"
2052 ;;
4e81affe
MMIJG
2053 news-os) osvers="$3"
2054 case "$3" in
2055 4*) osname=newsos4 ;;
2056 *) osname=newsos ;;
2057 esac
2058 ;;
a0d0e21e
LW
2059 bsd386) osname=bsd386
2060 osvers=`$uname -r`
2061 ;;
ae3afa4e
TH
2062 powerux | power_ux | powermax_os | powermaxos | \
2063 powerunix | power_unix) osname=powerux
2064 osvers="$3"
2065 ;;
a0d0e21e
LW
2066 next*) osname=next ;;
2067 solaris) osname=solaris
2068 case "$3" in
2069 5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
ecfc5424 2070 *) osvers="$3" ;;
a0d0e21e
LW
2071 esac
2072 ;;
85e6fe83
LW
2073 sunos) osname=sunos
2074 case "$3" in
85e6fe83
LW
2075 5*) osname=solaris
2076 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
a0d0e21e 2077 *) osvers="$3" ;;
2304df62
AD
2078 esac
2079 ;;
a0d0e21e 2080 titanos) osname=titanos
85e6fe83 2081 case "$3" in
a0d0e21e
LW
2082 1*) osvers=1 ;;
2083 2*) osvers=2 ;;
2084 3*) osvers=3 ;;
2085 4*) osvers=4 ;;
ecfc5424 2086 *) osvers="$3" ;;
2304df62
AD
2087 esac
2088 ;;
85e6fe83 2089 ultrix) osname=ultrix
ecfc5424 2090 osvers="$3"
2304df62 2091 ;;
28757baa 2092 osf1|mls+) case "$5" in
fed7345c
AD
2093 alpha)
2094 osname=dec_osf
313489a2 2095 osvers=`echo "$3" | sed 's/^[xvt]//'`
ecfc5424
AD
2096 ;;
2097 hp*) osname=hp_osf1 ;;
2098 mips) osname=mips_osf1 ;;
85e6fe83
LW
2099 esac
2100 ;;
a0d0e21e
LW
2101 uts) osname=uts
2102 osvers="$3"
2103 ;;
ff68c719
PP
2104 qnx) osname=qnx
2105 osvers="$4"
2106 ;;
85e6fe83 2107 $2) case "$osname" in
2304df62 2108 *isc*) ;;
a0d0e21e 2109 *freebsd*) ;;
5f05dabc 2110 svr*)
a0d0e21e
LW
2111 : svr4.x or possibly later
2112 case "svr$3" in
2113 ${osname}*)
2114 osname=svr$3
2115 osvers=$4
2116 ;;
2117 esac
2118 case "$osname" in
2119 svr4.0)
2120 : Check for ESIX
2121 if test -f /stand/boot ; then
2122 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
ecfc5424
AD
2123 if test -n "$INITPROG" -a -f "$INITPROG"; then
2124 isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2125 if test -n "$isesix"; then
a0d0e21e
LW
2126 osname=esix4
2127 fi
2128 fi
2129 fi
2130 ;;
2131 esac
2132 ;;
2304df62 2133 *) if test -f /etc/systemid; then
a0d0e21e
LW
2134 osname=sco
2135 set `echo $3 | $sed 's/\./ /g'` $4
c4f23d77 2136 if $test -f $src/hints/sco_$1_$2_$3.sh; then
85e6fe83 2137 osvers=$1.$2.$3
c4f23d77 2138 elif $test -f $src/hints/sco_$1_$2.sh; then
85e6fe83 2139 osvers=$1.$2
c4f23d77 2140 elif $test -f $src/hints/sco_$1.sh; then
85e6fe83 2141 osvers=$1
2304df62 2142 fi
a0d0e21e
LW
2143 else
2144 case "$osname" in
2145 '') : Still unknown. Probably a generic Sys V.
2146 osname="sysv"
2147 osvers="$3"
2148 ;;
2149 esac
2304df62
AD
2150 fi
2151 ;;
2152 esac
2153 ;;
a0d0e21e
LW
2154 *) case "$osname" in
2155 '') : Still unknown. Probably a generic BSD.
2156 osname="$1"
2157 osvers="$3"
2158 ;;
2159 esac
2160 ;;
2304df62
AD
2161 esac
2162 else
dfe9444c
AD
2163 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2164 (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2165 if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2166 osname=news_os
2304df62 2167 fi
dfe9444c 2168 $rm -f UU/kernel.what
8e07c86e
AD
2169 elif test -d c:/.; then
2170 set X $myuname
2171 osname=os2
2172 osvers="$5"
2304df62
AD
2173 fi
2174 fi
85e6fe83 2175
a0d0e21e
LW
2176 : Now look for a hint file osname_osvers, unless one has been
2177 : specified already.
2178 case "$hintfile" in
2179 ''|' ')
ecfc5424 2180 file=`echo "${osname}_${osvers}" | $sed -e 's@\.@_@g' -e 's@_$@@'`
a0d0e21e 2181 : Also try without trailing minor version numbers.
ecfc5424
AD
2182 xfile=`echo $file | $sed -e 's@_[^_]*$@@'`
2183 xxfile=`echo $xfile | $sed -e 's@_[^_]*$@@'`
2184 xxxfile=`echo $xxfile | $sed -e 's@_[^_]*$@@'`
2185 xxxxfile=`echo $xxxfile | $sed -e 's@_[^_]*$@@'`
a0d0e21e
LW
2186 case "$file" in
2187 '') dflt=none ;;
2188 *) case "$osvers" in
2189 '') dflt=$file
2190 ;;
dfe9444c 2191 *) if $test -f $src/hints/$file.sh ; then
a0d0e21e 2192 dflt=$file
dfe9444c 2193 elif $test -f $src/hints/$xfile.sh ; then
a0d0e21e 2194 dflt=$xfile
dfe9444c 2195 elif $test -f $src/hints/$xxfile.sh ; then
a0d0e21e 2196 dflt=$xxfile
dfe9444c 2197 elif $test -f $src/hints/$xxxfile.sh ; then
a0d0e21e 2198 dflt=$xxxfile
dfe9444c 2199 elif $test -f $src/hints/$xxxxfile.sh ; then
a0d0e21e 2200 dflt=$xxxxfile
dfe9444c 2201 elif $test -f "$src/hints/${osname}.sh" ; then
a0d0e21e
LW
2202 dflt="${osname}"
2203 else
2204 dflt=none
2205 fi
2206 ;;
2207 esac
85e6fe83
LW
2208 ;;
2209 esac
4e2a5f63
AD
2210 if $test -f Policy.sh ; then
2211 case "$dflt" in
2212 *Policy*) ;;
2213 none) dflt="Policy" ;;
2214 *) dflt="Policy $dflt" ;;
2215 esac
2216 fi
85e6fe83 2217 ;;
a0d0e21e 2218 *)
ecfc5424 2219 dflt=`echo $hintfile | $sed 's/\.sh$//'`
a0d0e21e 2220 ;;
2304df62 2221 esac
1aef975c 2222
4e2a5f63
AD
2223 if $test -f Policy.sh ; then
2224 $cat <<EOM
2225
2226There's also a Policy hint file available, which should make the
2227site-specific (policy) questions easier to answer.
2228EOM
2229
2230 fi
2231
2304df62
AD
2232 $cat <<EOM
2233
2234You may give one or more space-separated answers, or "none" if appropriate.
4e2a5f63
AD
2235A well-behaved OS will have no hints, so answering "none" or just "Policy"
2236is a good thing. DO NOT give a wrong version.
2304df62
AD
2237
2238EOM
4e2a5f63 2239
2304df62 2240 rp="Which of these apply, if any?"
dfe9444c 2241 . UU/myread
85e6fe83
LW
2242 tans=$ans
2243 for file in $tans; do
4e2a5f63
AD
2244 if $test X$file = XPolicy -a -f Policy.sh; then
2245 . Policy.sh
2246 $cat Policy.sh >> UU/config.sh
2247 elif $test -f $src/hints/$file.sh; then
dfe9444c
AD
2248 . $src/hints/$file.sh
2249 $cat $src/hints/$file.sh >> UU/config.sh
85e6fe83 2250 elif $test X$tans = X -o X$tans = Xnone ; then
2304df62
AD
2251 : nothing
2252 else
85e6fe83
LW
2253 : Give one chance to correct a possible typo.
2254 echo "$file.sh does not exist"
2255 dflt=$file
2256 rp="hint to use instead?"
dfe9444c 2257 . UU/myread
85e6fe83 2258 for file in $ans; do
dfe9444c
AD
2259 if $test -f "$src/hints/$file.sh"; then
2260 . $src/hints/$file.sh
2261 $cat $src/hints/$file.sh >> UU/config.sh
85e6fe83
LW
2262 elif $test X$ans = X -o X$ans = Xnone ; then
2263 : nothing
2264 else
2265 echo "$file.sh does not exist -- ignored."
2266 fi
2267 done
2304df62
AD
2268 fi
2269 done
85e6fe83 2270
2304df62 2271 hint=recommended
85e6fe83 2272 : Remember our hint file for later.
dfe9444c 2273 if $test -f "$src/hints/$file.sh" ; then
a0d0e21e 2274 hintfile="$file"
85e6fe83 2275 else
a0d0e21e 2276 hintfile=''
85e6fe83 2277 fi
2304df62
AD
2278fi
2279cd UU
2280;;
2281*)
2282 echo " "
2283 echo "Fetching default answers from $config_sh..." >&4
ecfc5424
AD
2284 tmp_n="$n"
2285 tmp_c="$c"
2304df62
AD
2286 cd ..
2287 cp $config_sh config.sh 2>/dev/null
a78b0d02 2288 chmod +w config.sh
2304df62
AD
2289 . ./config.sh
2290 cd UU
2291 cp ../config.sh .
ecfc5424
AD
2292 n="$tmp_n"
2293 c="$tmp_c"
2304df62
AD
2294 hint=previous
2295 ;;
2296esac
1aef975c
AD
2297test "$override" && . ./optdef.sh
2298myuname="$newmyuname"
2304df62
AD
2299
2300: Restore computed paths
2301for file in $loclist $trylist; do
2302 eval $file="\$_$file"
2303done
2304
85e6fe83 2305cat << EOM
a0d0e21e 2306
85e6fe83 2307Configure uses the operating system name and version to set some defaults.
ecfc5424
AD
2308The default value is probably right if the name rings a bell. Otherwise,
2309since spelling matters for me, either accept the default or answer "none"
2310to leave it blank.
a0d0e21e 2311
85e6fe83 2312EOM
85e6fe83 2313case "$osname" in
a0d0e21e 2314 ''|' ')
85e6fe83 2315 case "$hintfile" in
a0d0e21e 2316 ''|' '|none) dflt=none ;;
ecfc5424 2317 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
85e6fe83
LW
2318 esac
2319 ;;
2320 *) dflt="$osname" ;;
2321esac
2322rp="Operating system name?"
2323. ./myread
2324case "$ans" in
ecfc5424
AD
2325none) osname='' ;;
2326*) osname=`echo "$ans" | $sed -e 's/[ ][ ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
85e6fe83 2327esac
8ff267be
PP
2328echo " "
2329case "$osvers" in
2330 ''|' ')
2331 case "$hintfile" in
2332 ''|' '|none) dflt=none ;;
2333 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2334 dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2335 case "$dflt" in
2336 ''|' ') dflt=none ;;
2337 esac
2338 ;;
2339 esac
2340 ;;
2341 *) dflt="$osvers" ;;
2342esac
2343rp="Operating system version?"
2344. ./myread
2345case "$ans" in
2346none) osvers='' ;;
2347*) osvers="$ans" ;;
2348esac
2349
2304df62 2350: who configured the system
7792a3d7 2351cf_time=`LC_ALL=C; export LC_ALL; $date 2>&1`
8ff267be 2352cf_by=`(logname) 2>/dev/null`
dfe9444c
AD
2353case "$cf_by" in
2354"")
8ff267be 2355 cf_by=`(whoami) 2>/dev/null`
dfe9444c
AD
2356 case "$cf_by" in
2357 "") cf_by=unknown ;;
8ff267be
PP
2358 esac ;;
2359esac
2304df62 2360
dfe9444c
AD
2361: set up the script used to warn in case of inconsistency
2362cat <<EOS >whoa
2363$startsh
2364EOS
2365cat <<'EOSC' >>whoa
2366dflt=y
2367echo " "
2368echo "*** WHOA THERE!!! ***" >&4
2369echo " The $hint value for \$$var on this machine was \"$was\"!" >&4
2370rp=" Keep the $hint value?"
2371. ./myread
2372case "$ans" in
2373y) td=$was; tu=$was;;
2374esac
2375EOSC
2376
2377: function used to set $1 to $val
2378setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2379case "$val$was" in
2380$define$undef) . ./whoa; eval "$var=\$td";;
2381$undef$define) . ./whoa; eval "$var=\$tu";;
2382*) eval "$var=$val";;
2383esac'
2384
2385cat <<EOM
2386
2387Perl can be built to take advantage of threads, on some systems.
2388To do so, Configure must be run with -Dusethreads.
2389(See README.threads for details.)
2390EOM
2391case "$usethreads" in
2392$define|true|[yY]*) dflt='y';;
2393*) dflt='n';;
2394esac
2395rp='Build a threading Perl?'
2396. ./myread
2397case "$ans" in
2398y|Y) val="$define" ;;
2399*) val="$undef" ;;
2400esac
2401set usethreads
2402eval $setvar
693762b4 2403: Look for a hint-file generated 'call-back-unit'. Now that the
dc45a647
MB
2404: user has specified if a threading perl is to be built, we may need
2405: to set or change some other defaults.
693762b4
AD
2406if $test -f usethreads.cbu; then
2407 . ./usethreads.cbu
2408fi
2409case "$d_oldpthreads" in
2410'') : Configure tests would be welcome here. For now, assume undef.
2411 val="$undef" ;;
2412*) val="$d_oldpthreads" ;;
2413esac
2414set d_oldpthreads
2415eval $setvar
dfe9444c 2416
4633a7c4 2417: determine the architecture name
2304df62 2418echo " "
4633a7c4
LW
2419if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
2420 tarch=`arch`"-$osname"
2421elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
2422 if uname -m > tmparch 2>&1 ; then
7e1af8bc 2423 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5f05dabc 2424 -e 's/$/'"-$osname/" tmparch`
4633a7c4
LW
2425 else
2426 tarch="$osname"
2427 fi
2428 $rm -f tmparch
2429else
2430 tarch="$osname"
2431fi
2432case "$myarchname" in
2433''|"$tarch") ;;
2434*)
2435 echo "(Your architecture name used to be $myarchname.)"
2436 archname=''
2304df62
AD
2437 ;;
2438esac
4633a7c4
LW
2439case "$archname" in
2440'') dflt="$tarch";;
2441*) dflt="$archname";;
2442esac
2443rp='What is your architecture name'
2444. ./myread
dc66995c 2445case "$usethreads" in
c6ee37c5
MB
2446$define) echo "Threads selected." >&4
2447 case "$ans" in
2448 *-thread) echo "...and architecture name already ends in -thread." >&4
2449 archname="$ans"
2450 ;;
2451 *) archname="$ans-thread"
2452 echo "...setting architecture name to $archname." >&4
2453 ;;
2454 esac
dc66995c
MB
2455 ;;
2456*) archname="$ans" ;;
2457esac
4633a7c4 2458myarchname="$tarch"
4633a7c4
LW
2459: is AFS running?
2460echo " "
2afac517
PP
2461case "$afs" in
2462$define|true) afs=true ;;
2463$undef|false) afs=false ;;
2464*) if test -d /afs; then
2465 afs=true
2466 else
2467 afs=false
2468 fi
2469 ;;
2470esac
2471if $afs; then
4633a7c4 2472 echo "AFS may be running... I'll be extra cautious then..." >&4
2304df62 2473else
4633a7c4 2474 echo "AFS does not seem to be running..." >&4
2304df62
AD
2475fi
2476
4633a7c4
LW
2477: decide how portable to be. Allow command line overrides.
2478case "$d_portable" in
2479"$undef") ;;
2480*) d_portable="$define" ;;
2304df62 2481esac
2304df62 2482
4633a7c4
LW
2483: set up shell script to do ~ expansion
2484cat >filexp <<EOSS
2485$startsh
2486: expand filename
2487case "\$1" in
2488 ~/*|~)
2489 echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
2304df62 2490 ;;
4633a7c4
LW
2491 ~*)
2492 if $test -f /bin/csh; then
2493 /bin/csh -f -c "glob \$1"
2494 failed=\$?
2495 echo ""
2496 exit \$failed
2497 else
2498 name=\`$expr x\$1 : '..\([^/]*\)'\`
2499 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
2500 if $test ! -d "\$dir"; then
2501 me=\`basename \$0\`
2502 echo "\$me: can't locate home directory for: \$name" >&2
2503 exit 1
2504 fi
2505 case "\$1" in
2506 */*)
2507 echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
2508 ;;
2509 *)
2510 echo \$dir
2511 ;;
2304df62 2512 esac
4633a7c4 2513 fi
2304df62
AD
2514 ;;
2515*)
4633a7c4 2516 echo \$1
2304df62
AD
2517 ;;
2518esac
4633a7c4
LW
2519EOSS
2520chmod +x filexp
2521$eunicefix filexp
2304df62
AD
2522
2523: now set up to get a file name
28757baa
PP
2524cat <<EOS >getfile
2525$startsh
2526EOS
2527cat <<'EOSC' >>getfile
2304df62
AD
2528tilde=''
2529fullpath=''
2530already=''
2531skip=''
2532none_ok=''
2533exp_file=''
a0d0e21e 2534nopath_ok=''
2304df62
AD
2535orig_rp="$rp"
2536orig_dflt="$dflt"
2537
2538case "$fn" in
ecfc5424 2539*\(*)
28e8609d 2540 expr $fn : '.*(\(.*\)).*' | tr ',' $trnl >getfile.ok
ecfc5424
AD
2541 fn=`echo $fn | sed 's/(.*)//'`
2542 ;;
2543esac
2544
2545case "$fn" in
a0d0e21e
LW
2546*:*)
2547 loc_file=`expr $fn : '.*:\(.*\)'`
2548 fn=`expr $fn : '\(.*\):.*'`
2549 ;;
2550esac
2551
2552case "$fn" in
2304df62
AD
2553*~*) tilde=true;;
2554esac
2555case "$fn" in
2556*/*) fullpath=true;;
2557esac
2558case "$fn" in
2559*+*) skip=true;;
2560esac
2561case "$fn" in
2562*n*) none_ok=true;;
2563esac
2564case "$fn" in
2565*e*) exp_file=true;;
2566esac
a0d0e21e
LW
2567case "$fn" in
2568*p*) nopath_ok=true;;
2569esac
2304df62
AD
2570
2571case "$fn" in
2572*f*) type='File';;
2573*d*) type='Directory';;
a0d0e21e 2574*l*) type='Locate';;
2304df62
AD
2575esac
2576
2577what="$type"
2578case "$what" in
2579Locate) what='File';;
2580esac
2581
2582case "$exp_file" in
2583'')
2584 case "$d_portable" in
2585 "$define") ;;
2586 *) exp_file=true;;
2587 esac
2588 ;;
2589esac
2590
2591cd ..
2592while test "$type"; do
2593 redo=''
2594 rp="$orig_rp"
2595 dflt="$orig_dflt"
2596 case "$tilde" in
2597 true) rp="$rp (~name ok)";;
2598 esac
2599 . UU/myread
ecfc5424
AD
2600 if test -f UU/getfile.ok && \
2601 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
2602 then
2603 value="$ans"
2604 ansexp="$ans"
2605 break
2606 fi
2304df62
AD
2607 case "$ans" in
2608 none)
2609 value=''
2610 ansexp=''
2611 case "$none_ok" in
2612 true) type='';;
2613 esac
2614 ;;
2615 *)
2616 case "$tilde" in
2617 '') value="$ans"
2618 ansexp="$ans";;
2619 *)
2620 value=`UU/filexp $ans`
2621 case $? in
2622 0)
2623 if test "$ans" != "$value"; then
ecfc5424 2624 echo "(That expands to $value on this system.)"
2304df62
AD
2625 fi
2626 ;;
2627 *) value="$ans";;
2628 esac
2629 ansexp="$value"
2630 case "$exp_file" in
2631 '') value="$ans";;
2632 esac
2633 ;;
2634 esac
2635 case "$fullpath" in
2636 true)
2637 case "$ansexp" in
2638 /*) value="$ansexp" ;;
2639 *)
2640 redo=true
2641 case "$already" in
2642 true)
2643 echo "I shall only accept a full path name, as in /bin/ls." >&4
2644 echo "Use a ! shell escape if you wish to check pathnames." >&4
2645 ;;
2646 *)
2647 echo "Please give a full path name, starting with slash." >&4
2648 case "$tilde" in
2649 true)
2650 echo "Note that using ~name is ok provided it expands well." >&4
2651 already=true
2652 ;;
2653 esac
2654 esac
2655 ;;
2656 esac
2657 ;;
2658 esac
2659 case "$redo" in
2660 '')
2661 case "$type" in
2662 File)
2663 if test -f "$ansexp"; then
2664 type=''
2665 elif test -r "$ansexp" || (test -h "$ansexp") >/dev/null 2>&1
2666 then
2667 echo "($value is not a plain file, but that's ok.)"
2668 type=''
2669 fi
2670 ;;
2671 Directory)
2672 if test -d "$ansexp"; then
2673 type=''
2674 fi
2675 ;;
2676 Locate)
40000a8c 2677 if test -d "$ansexp"; then
a0d0e21e
LW
2678 echo "(Looking for $loc_file in directory $value.)"
2679 value="$value/$loc_file"
40000a8c 2680 ansexp="$ansexp/$loc_file"
2304df62 2681 fi
40000a8c 2682 if test -f "$ansexp"; then
2304df62
AD
2683 type=''
2684 fi
a0d0e21e
LW
2685 case "$nopath_ok" in
2686 true) case "$value" in
2687 */*) ;;
2688 *) echo "Assuming $value will be in people's path."
2689 type=''
2690 ;;
2691 esac
2692 ;;
2693 esac
2304df62
AD
2694 ;;
2695 esac
2696
2697 case "$skip" in
2698 true) type='';
2699 esac
2700
2701 case "$type" in
2702 '') ;;
2703 *)
2704 if test "$fastread" = yes; then
2705 dflt=y
2706 else
2707 dflt=n
2708 fi
2709 rp="$what $value doesn't exist. Use that name anyway?"
2710 . UU/myread
2711 dflt=''
2712 case "$ans" in
2713 y*) type='';;
2714 *) echo " ";;
2715 esac
2716 ;;
2717 esac
2718 ;;
2719 esac
2720 ;;
2721 esac
2722done
2723cd UU
2724ans="$value"
2725rp="$orig_rp"
2726dflt="$orig_dflt"
ecfc5424 2727rm -f getfile.ok
2304df62
AD
2728EOSC
2729
4633a7c4
LW
2730: determine root of directory hierarchy where package will be installed.
2731case "$prefix" in
2732'')
2733 dflt=`./loc . /usr/local /usr/local /local /opt /usr`
8e07c86e 2734 ;;
4633a7c4
LW
2735*)
2736 dflt="$prefix"
8e07c86e
AD
2737 ;;
2738esac
4633a7c4 2739$cat <<EOM
2304df62 2740
4633a7c4
LW
2741By default, $package will be installed in $dflt/bin, manual
2742pages under $dflt/man, etc..., i.e. with $dflt as prefix for
2743all installation directories. Typically set to /usr/local, but you
2744may choose /usr if you wish to install $package among your system
2745binaries. If you wish to have binaries under /bin but manual pages
2746under /usr/local/man, that's ok: you will be prompted separately
2747for each of the installation directories, the prefix being only used
2748to set the defaults.
8e07c86e
AD
2749
2750EOM
2751fn=d~
2752rp='Installation prefix to use?'
2753. ./getfile
2754oldprefix=''
2755case "$prefix" in
a0d0e21e 2756'') ;;
8e07c86e
AD
2757*)
2758 case "$ans" in
2759 "$prefix") ;;
2760 *) oldprefix="$prefix";;
2761 esac
2762 ;;
a0d0e21e 2763esac
8e07c86e
AD
2764prefix="$ans"
2765prefixexp="$ansexp"
a0d0e21e 2766
8e07c86e
AD
2767: set the prefixit variable, to compute a suitable default value
2768prefixit='case "$3" in
2769""|none)
2770 case "$oldprefix" in
2771 "") eval "$1=\"\$$2\"";;
2772 *)
2773 case "$3" in
2774 "") eval "$1=";;
2775 none)
2776 eval "tp=\"\$$2\"";
2777 case "$tp" in
2778 ""|" ") eval "$1=\"\$$2\"";;
2779 *) eval "$1=";;
2780 esac;;
2781 esac;;
2782 esac;;
2783*)
2784 eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
2785 case "$tp" in
2786 --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
2787 /*-$oldprefix/*|\~*-$oldprefix/*)
2788 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
2789 *) eval "$1=\"\$$2\"";;
2790 esac;;
2791esac'
a0d0e21e 2792
bfb7748a
AD
2793: set the base revision
2794baserev=5.0
2795
2796: get the patchlevel
2797echo " "
2798echo "Getting the current patchlevel..." >&4
2799if $test -r $rsrc/patchlevel.h;then
2800 patchlevel=`awk '/define[ ]+PATCHLEVEL/ {print $3}' $rsrc/patchlevel.h`
2801 subversion=`awk '/define[ ]+SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
2802else
2803 patchlevel=0
2804 subversion=0
2805fi
2806$echo $n "(You have $package" $c
2807case "$package" in
2808"*$baserev") ;;
2809*) $echo $n " $baserev" $c ;;
2810esac
2811$echo $n " patchlevel $patchlevel" $c
2812test 0 -eq "$subversion" || $echo $n " subversion $subversion" $c
2813echo ".)"
2814
2815if test 0 -eq "$subversion"; then
2816 version=`LC_ALL=C; export LC_ALL; \
2817 echo $baserev $patchlevel | \
2818 $awk '{ printf "%.3f\n", $1 + $2/1000.0 }'`
2819else
2820 version=`LC_ALL=C; export LC_ALL; \
2821 echo $baserev $patchlevel $subversion | \
2822 $awk '{ printf "%.5f\n", $1 + $2/1000.0 + $3/100000.0 }'`
2823fi
2824: Figure out perl API version. Perhaps this should be in patchlevel.h
2825if test "$subversion" -lt 50; then
2826 apiversion=`LC_ALL=C; export LC_ALL; \
2827 echo $baserev $patchlevel | \
2828 $awk '{ printf "%.3f\n", $1 + $2/1000.0 }'`
2829else
2830 apiversion="$version"
2831fi
2832
4633a7c4 2833: determine where private library files go
3a6175e1
AD
2834: Usual default is /usr/local/lib/perl5/$version.
2835: Also allow things like /opt/perl/lib/$version, since
bfb7748a 2836: /opt/perl/lib/perl5... would be redundant.
4633a7c4 2837case "$prefix" in
3a6175e1
AD
2838*perl*) set dflt privlib lib/$version ;;
2839*) set dflt privlib lib/$package/$version ;;
4633a7c4 2840esac
8e07c86e 2841eval $prefixit
4633a7c4
LW
2842$cat <<EOM
2843
2844There are some auxiliary files for $package that need to be put into a
2845private library directory that is accessible by everyone.
2846
2847EOM
2848fn=d~+
2849rp='Pathname where the private library files will reside?'
8e07c86e 2850. ./getfile
4633a7c4
LW
2851if $test "X$privlibexp" != "X$ansexp"; then
2852 installprivlib=''
8e07c86e 2853fi
4633a7c4
LW
2854privlib="$ans"
2855privlibexp="$ansexp"
8e07c86e
AD
2856if $afs; then
2857 $cat <<EOM
2304df62 2858
8e07c86e 2859Since you are running AFS, I need to distinguish the directory in which
4633a7c4 2860private files reside from the directory in which they are installed (and from
8e07c86e 2861which they are presumably copied to the former directory by occult means).
a0d0e21e 2862
8e07c86e 2863EOM
4633a7c4
LW
2864 case "$installprivlib" in
2865 '') dflt=`echo $privlibexp | sed 's#^/afs/#/afs/.#'`;;
2866 *) dflt="$installprivlib";;
8e07c86e
AD
2867 esac
2868 fn=de~
4633a7c4 2869 rp='Where will private files be installed?'
8e07c86e 2870 . ./getfile
4633a7c4 2871 installprivlib="$ans"
8e07c86e 2872else
4633a7c4
LW
2873 installprivlib="$privlibexp"
2874fi
2875
8e07c86e
AD
2876: set the prefixup variable, to restore leading tilda escape
2877prefixup='case "$prefixexp" in
2878"$prefix") ;;
2879*) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
2880esac'
2881
4633a7c4
LW
2882: determine where public architecture dependent libraries go
2883set archlib archlib
8e07c86e 2884eval $prefixit
3a6175e1 2885: privlib default is /usr/local/lib/$package/$version
bfb7748a 2886: archlib default is /usr/local/lib/$package/$version/$archname
3a6175e1 2887: privlib may have an optional trailing /share.
bfb7748a
AD
2888tdflt=`echo $privlib | $sed 's,/share$,,'`
2889tdflt=$tdflt/$archname
4633a7c4 2890case "$archlib" in
bfb7748a 2891'') dflt=$tdflt
8e07c86e 2892 ;;
bfb7748a 2893*) dflt="$archlib"
774d564b 2894 ;;
8e07c86e 2895esac
4633a7c4
LW
2896cat <<EOM
2897
2898$spackage contains architecture-dependent library files. If you are
2899sharing libraries in a heterogeneous environment, you might store
2900these files in a separate location. Otherwise, you can just include
2901them with the rest of the public library files.
2902
8e07c86e 2903EOM
4633a7c4
LW
2904fn=d+~
2905rp='Where do you want to put the public architecture-dependent libraries?'
8e07c86e 2906. ./getfile
4633a7c4
LW
2907archlib="$ans"
2908archlibexp="$ansexp"
2909
8e07c86e
AD
2910if $afs; then
2911 $cat <<EOM
2912
7bac28a0
PP
2913Since you are running AFS, I need to distinguish the directory in
2914which architecture-dependent library files reside from the directory
2915in which they are installed (and from which they are presumably copied
2916to the former directory by occult means).
8e07c86e
AD
2917
2918EOM
4633a7c4
LW
2919 case "$installarchlib" in
2920 '') dflt=`echo $archlibexp | sed 's#^/afs/#/afs/.#'`;;
2921 *) dflt="$installarchlib";;
8e07c86e
AD
2922 esac
2923 fn=de~
4633a7c4 2924 rp='Where will architecture-dependent library files be installed?'
8e07c86e 2925 . ./getfile
4633a7c4 2926 installarchlib="$ans"
8e07c86e 2927else
4633a7c4
LW
2928 installarchlib="$archlibexp"
2929fi
2930if $test X"$archlib" = X"$privlib"; then
2931 d_archlib="$undef"
2932else
2933 d_archlib="$define"
8e07c86e
AD
2934fi
2935
40a7a20a
PP
2936: make some quick guesses about what we are up against
2937echo " "
2938$echo $n "Hmm... $c"
2939echo exit 1 >bsd
2940echo exit 1 >usg
2941echo exit 1 >v7
2942echo exit 1 >osf1
2943echo exit 1 >eunice
2944echo exit 1 >xenix
2945echo exit 1 >venix
8ff267be 2946echo exit 1 >os2
40a7a20a
PP
2947d_bsd="$undef"
2948$cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
2949if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
2950then
2951 echo "Looks kind of like an OSF/1 system, but we'll see..."
2952 echo exit 0 >osf1
2953elif test `echo abc | tr a-z A-Z` = Abc ; then
2954 xxx=`./loc addbib blurfl $pth`
2955 if $test -f $xxx; then
2956 echo "Looks kind of like a USG system with BSD features, but we'll see..."
2957 echo exit 0 >bsd
2958 echo exit 0 >usg
2959 else
2960 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
2961 echo "Looks kind of like an extended USG system, but we'll see..."
2962 else
2963 echo "Looks kind of like a USG system, but we'll see..."
2964 fi
2965 echo exit 0 >usg
2966 fi
2967elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
2968 echo "Looks kind of like a BSD system, but we'll see..."
2969 d_bsd="$define"
2970 echo exit 0 >bsd
2971else
2972 echo "Looks kind of like a Version 7 system, but we'll see..."
2973 echo exit 0 >v7
2974fi
2975case "$eunicefix" in
2976*unixtovms*)
2977 $cat <<'EOI'
2978There is, however, a strange, musty smell in the air that reminds me of
2979something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
2980EOI
2981 echo exit 0 >eunice
2982 d_eunice="$define"
2983: it so happens the Eunice I know will not run shell scripts in Unix format
2984 ;;
2985*)
2986 echo " "
2987 echo "Congratulations. You aren't running Eunice."
2988 d_eunice="$undef"
2989 ;;
2990esac
8ff267be
PP
2991: Detect OS2. The p_ variable is set above in the Head.U unit.
2992case "$p_" in
2993:) ;;
2994*)
2995 $cat <<'EOI'
2996I have the feeling something is not exactly right, however...don't tell me...
2997lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
2998EOI
2999 echo exit 0 >os2
3000 ;;
3001esac
40a7a20a
PP
3002if test -f /xenix; then
3003 echo "Actually, this looks more like a XENIX system..."
3004 echo exit 0 >xenix
3005 d_xenix="$define"
3006else
3007 echo " "
3008 echo "It's not Xenix..."
3009 d_xenix="$undef"
3010fi
3011chmod +x xenix
3012$eunicefix xenix
3013if test -f /venix; then
3014 echo "Actually, this looks more like a VENIX system..."
3015 echo exit 0 >venix
3016else
3017 echo " "
3018 if ./xenix; then
3019 : null
3020 else
3021 echo "Nor is it Venix..."
3022 fi
3023fi
8ff267be
PP
3024chmod +x bsd usg v7 osf1 eunice xenix venix os2
3025$eunicefix bsd usg v7 osf1 eunice xenix venix os2
40a7a20a
PP
3026$rm -f foo
3027
3028: see if setuid scripts can be secure
3029$cat <<EOM
3030
3031Some kernels have a bug that prevents setuid #! scripts from being
3032secure. Some sites have disabled setuid #! scripts because of this.
3033
3034First let's decide if your kernel supports secure setuid #! scripts.
3035(If setuid #! scripts would be secure but have been disabled anyway,
3036don't say that they are secure if asked.)
3037
3038EOM
3039
3040val="$undef"
3041if $test -d /dev/fd; then
3042 echo "#!$ls" >reflect
3043 chmod +x,u+s reflect
3044 ./reflect >flect 2>&1
3045 if $contains "/dev/fd" flect >/dev/null; then
3046 echo "Congratulations, your kernel has secure setuid scripts!" >&4
3047 val="$define"
3048 else
3049 $cat <<EOM
3050If you are not sure if they are secure, I can check but I'll need a
3051username and password different from the one you are using right now.
3052If you don't have such a username or don't want me to test, simply
3053enter 'none'.
3054
3055EOM
3056 rp='Other username to test security of setuid scripts with?'
3057 dflt='none'
3058 . ./myread
3059 case "$ans" in
3060 n|none)
3061 case "$d_suidsafe" in
3062 '') echo "I'll assume setuid scripts are *not* secure." >&4
3063 dflt=n;;
3064 "$undef")
3065 echo "Well, the $hint value is *not* secure." >&4
3066 dflt=n;;
3067 *) echo "Well, the $hint value *is* secure." >&4
3068 dflt=y;;
3069 esac
3070 ;;
3071 *)
3072 $rm -f reflect flect
3073 echo "#!$ls" >reflect
3074 chmod +x,u+s reflect
3075 echo >flect
3076 chmod a+w flect
3077 echo '"su" will (probably) prompt you for '"$ans's password."
3078 su $ans -c './reflect >flect'
3079 if $contains "/dev/fd" flect >/dev/null; then
3080 echo "Okay, it looks like setuid scripts are secure." >&4
3081 dflt=y
3082 else
3083 echo "I don't think setuid scripts are secure." >&4
3084 dflt=n
3085 fi
3086 ;;
3087 esac
3088 rp='Does your kernel have *secure* setuid scripts?'
3089 . ./myread
3090 case "$ans" in
3091 [yY]*) val="$define";;
3092 *) val="$undef";;
3093 esac
3094 fi
3095else
3096 echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
760ac839 3097 echo "(That's for file descriptors, not floppy disks.)"
40a7a20a
PP
3098 val="$undef"
3099fi
3100set d_suidsafe
3101eval $setvar
3102
3103$rm -f reflect flect
3104
3105: now see if they want to do setuid emulation
3106echo " "
3107val="$undef"
3108case "$d_suidsafe" in
3109"$define")
3110 val="$undef"
3111 echo "No need to emulate SUID scripts since they are secure here." >& 4
3112 ;;
3113*)
3114 $cat <<EOM
3115Some systems have disabled setuid scripts, especially systems where
3116setuid scripts cannot be secure. On systems where setuid scripts have
dfe9444c
AD
3117been disabled, the setuid/setgid bits on scripts are currently
3118useless. It is possible for $package to detect those bits and emulate
3119setuid/setgid in a secure fashion. This emulation will only work if
3120setuid scripts have been disabled in your kernel.
8e07c86e
AD
3121
3122EOM
dfe9444c
AD
3123 case "$d_dosuid" in
3124 "$define") dflt=y ;;
3125 *) dflt=n ;;
3126 esac
3127 rp="Do you want to do setuid/setgid emulation?"
3128 . ./myread
3129 case "$ans" in
3130 [yY]*) val="$define";;
3131 *) val="$undef";;
3132 esac
3133 ;;
4633a7c4 3134esac
dfe9444c 3135set d_dosuid
4633a7c4 3136eval $setvar
8e07c86e 3137
2c7991dc
PP
3138: determine where manual pages are on this system
3139echo " "
3140case "$sysman" in
3141'')
3142 syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
3143 syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
3144 syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
3145 syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
3146 syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
3147 sysman=`./loc . /usr/man/man1 $syspath`
3148 ;;
3149esac
3150if $test -d "$sysman"; then
3151 echo "System manual is in $sysman." >&4
3152else
3153 echo "Could not find manual pages in source form." >&4
3154fi
3155
dc45a647
MB
3156: see what memory models we can support
3157case "$models" in
3158'')
3159 $cat >pdp11.c <<'EOP'
3160main() {
3161#ifdef pdp11
3162 exit(0);
3163#else
3164 exit(1);
3165#endif
3166}
3167EOP
3168 ( cc -o pdp11 pdp11.c ) >/dev/null 2>&1
3169 if $test -f pdp11 && ./pdp11 2>/dev/null; then
3170 dflt='unsplit split'
3171 else
3172 tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
3173 case "$tans" in
3174 X) dflt='none';;
3175 *) if $test -d /lib/small || $test -d /usr/lib/small; then
3176 dflt='small'
3177 else
3178 dflt=''
3179 fi
3180 if $test -d /lib/medium || $test -d /usr/lib/medium; then
3181 dflt="$dflt medium"
3182 fi
3183 if $test -d /lib/large || $test -d /usr/lib/large; then
3184 dflt="$dflt large"
3185 fi
3186 if $test -d /lib/huge || $test -d /usr/lib/huge; then
3187 dflt="$dflt huge"
3188 fi
3189 esac
3190 fi;;
3191*) dflt="$models";;
3192esac
8e07c86e 3193$cat <<EOM
dc45a647
MB
3194
3195Some systems have different model sizes. On most systems they are called
3196small, medium, large, and huge. On the PDP11 they are called unsplit and
3197split. If your system doesn't support different memory models, say "none".
3198If you wish to force everything to one memory model, say "none" here and
3199put the appropriate flags later when it asks you for other cc and ld flags.
3200Venix systems may wish to put "none" and let the compiler figure things out.
3201(In the following question multiple model names should be space separated.)
3202
3203The default for most systems is "none".
8e07c86e 3204
8e07c86e 3205EOM
dc45a647
MB
3206rp="Which memory models are supported?"
3207. ./myread
3208models="$ans"
3209
3210case "$models" in
3211none)
3212 small=''
3213 medium=''
3214 large=''
3215 huge=''
3216 unsplit=''
3217 split=''
2c7991dc 3218 ;;
dc45a647
MB
3219*split)
3220 case "$split" in
3221 '') if $contains '\-i' $sysman/ld.1 >/dev/null 2>&1 || \
3222 $contains '\-i' $sysman/cc.1 >/dev/null 2>&1; then
3223 dflt='-i'
3224 else
3225 dflt='none'
3226 fi;;
3227 *) dflt="$split";;
3228 esac
3229 rp="What flag indicates separate I and D space?"
3230 . ./myread
3231 tans="$ans"
3232 case "$tans" in
3233 none) tans='';;
3234 esac
3235 split="$tans"
3236 unsplit='';;
3237*large*|*small*|*medium*|*huge*)
3238 case "$models" in
3239 *large*)
3240 case "$large" in
3241 '') dflt='-Ml';;
3242 *) dflt="$large";;
3243 esac
3244 rp="What flag indicates large model?"
3245 . ./myread
3246 tans="$ans"
3247 case "$tans" in
3248 none) tans='';
3249 esac
3250 large="$tans";;
3251 *) large='';;
3252 esac
3253 case "$models" in
3254 *huge*) case "$huge" in
3255 '') dflt='-Mh';;
3256 *) dflt="$huge";;
3257 esac
3258 rp="What flag indicates huge model?"
3259 . ./myread
3260 tans="$ans"
3261 case "$tans" in
3262 none) tans='';
3263 esac
3264 huge="$tans";;
3265 *) huge="$large";;
3266 esac
3267 case "$models" in
3268 *medium*) case "$medium" in
3269 '') dflt='-Mm';;
3270 *) dflt="$medium";;
3271 esac
3272 rp="What flag indicates medium model?"
3273 . ./myread
3274 tans="$ans"
3275 case "$tans" in
3276 none) tans='';
3277 esac
3278 medium="$tans";;
3279 *) medium="$large";;
3280 esac
3281 case "$models" in
3282 *small*) case "$small" in
3283 '') dflt='none';;
3284 *) dflt="$small";;
3285 esac
3286 rp="What flag indicates small model?"
3287 . ./myread
3288 tans="$ans"
3289 case "$tans" in
3290 none) tans='';
3291 esac
3292 small="$tans";;
3293 *) small='';;
25f94b33 3294 esac
8e07c86e 3295 ;;
dc45a647
MB
3296*)
3297 echo "Unrecognized memory models--you may have to edit Makefile.SH" >&4
8e07c86e
AD
3298 ;;
3299esac
dc45a647 3300$rm -f pdp11.* pdp11
4e2a5f63 3301
dc45a647
MB
3302: see if we need a special compiler
3303echo " "
3304if ./usg; then
3305 case "$cc" in
3306 '') case "$Mcc" in
3307 /*) dflt='Mcc';;
3308 *) case "$large" in
3309 -M*) dflt='cc';;
3310 *) if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
3311 if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
3312 dflt='cc'
3313 else
3314 dflt='cc -M'
3315 fi
3316 else
3317 dflt='cc'
3318 fi;;
3319 esac;;
3320 esac;;
3321 *) dflt="$cc";;
3322 esac
3323 case "$dflt" in
3324 *M*) $cat <<'EOM'
3325On some older systems the default C compiler will not resolve multiple global
3326references that happen to have the same name. On some such systems the "Mcc"
3327command may be used to force these to be resolved. On other systems a "cc -M"
3328command is required. (Note that the -M flag on other systems indicates a
3329memory model to use!) If you have the Gnu C compiler, you might wish to use
3330that instead.
8e07c86e
AD
3331
3332EOM
dc45a647 3333 ;;
2afac517 3334 esac
dc45a647
MB
3335 rp="Use which C compiler?"
3336 . ./myread
3337 cc="$ans"
4e2a5f63 3338else
dc45a647
MB
3339 case "$cc" in
3340 '') dflt=cc;;
3341 *) dflt="$cc";;
4e2a5f63 3342 esac
dc45a647 3343 rp="Use which C compiler?"
4e2a5f63
AD
3344 . ./myread
3345 cc="$ans"
3346fi
693762b4
AD
3347: Look for a hint-file generated 'call-back-unit'. Now that the
3348: user has specified the compiler, we may need to set or change some
3349: other defaults.
3350if $test -f cc.cbu; then
3351 . ./cc.cbu
3352fi
4e2a5f63
AD
3353echo " "
3354echo "Checking for GNU cc in disguise and/or its version number..." >&4
3355$cat >gccvers.c <<EOM
3356#include <stdio.h>
3357int main() {
3358#ifdef __GNUC__
3359#ifdef __VERSION__
3360 printf("%s\n", __VERSION__);
3361#else
3362 printf("%s\n", "1");
3363#endif
3364#endif
3365 exit(0);
3366}
3367EOM
3368if $cc -o gccvers gccvers.c >/dev/null 2>&1; then
3369 gccversion=`./gccvers`
3370 case "$gccversion" in
2afac517
PP
3371 '') echo "You are not using GNU cc." ;;
3372 *) echo "You are using GNU cc $gccversion." ;;
3373 esac
3374else
3375 echo " "
3376 echo "*** WHOA THERE!!! ***" >&4
3377 echo " Your C compiler \"$cc\" doesn't seem to be working!" >&4
3378 case "$knowitall" in
3379 '')
3380 echo " You'd better start hunting for one and let me know about it." >&4
3381 exit 1
2c7991dc 3382 ;;
8e07c86e 3383 esac
2afac517
PP
3384fi
3385$rm -f gccvers*
3386case "$gccversion" in
33871*) cpp=`./loc gcc-cpp $cpp $pth` ;;
8e07c86e
AD
3388esac
3389
2afac517 3390: What should the include directory be ?
8e07c86e 3391echo " "
2afac517
PP
3392$echo $n "Hmm... $c"
3393dflt='/usr/include'
3394incpath=''
3395mips_type=''
3396if $test -f /bin/mips && /bin/mips; then
3397 echo "Looks like a MIPS system..."
3398 $cat >usr.c <<'EOCP'
3399#ifdef SYSTYPE_BSD43
3400/bsd43
3401#endif
3402EOCP
3403 if $cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3404 dflt='/bsd43/usr/include'
3405 incpath='/bsd43'
3406 mips_type='BSD 4.3'
8e07c86e 3407 else
2afac517 3408 mips_type='System V'
8e07c86e 3409 fi
2afac517
PP
3410 $rm -f usr.c usr.out
3411 echo "and you're compiling with the $mips_type compiler and libraries."
3412 xxx_prompt=y
3413 echo "exit 0" >mips
8e07c86e 3414else
2afac517
PP
3415 echo "Doesn't look like a MIPS system."
3416 xxx_prompt=n
3417 echo "exit 1" >mips
3418fi
3419chmod +x mips
3420$eunicefix mips
2afac517
PP
3421case "$usrinc" in
3422'') ;;
3423*) dflt="$usrinc";;
3424esac
3425case "$xxx_prompt" in
3426y) fn=d/
dfe9444c 3427 echo " "
2afac517
PP
3428 rp='Where are the include files you want to use?'
3429 . ./getfile
3430 usrinc="$ans"
3431 ;;
3432*) usrinc="$dflt"
3433 ;;
3434esac
8e07c86e 3435
c4f23d77
AD
3436: see how we invoke the C preprocessor
3437echo " "
3438echo "Now, how can we feed standard input to your C preprocessor..." >&4
3439cat <<'EOT' >testcpp.c
3440#define ABC abc
3441#define XYZ xyz
3442ABC.XYZ
3443EOT
3444cd ..
3445echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3446chmod 755 cppstdin
3447wrapper=`pwd`/cppstdin
3448ok='false'
3449cd UU
3450
3451if $test "X$cppstdin" != "X" && \
3452 $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3453 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3454then
3455 echo "You used to use $cppstdin $cppminus so we'll use that again."
3456 case "$cpprun" in
3457 '') echo "But let's see if we can live without a wrapper..." ;;
3458 *)
3459 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3460 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3461 then
3462 echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3463 ok='true'
3464 else
3465 echo "(However, $cpprun $cpplast does not work, let's see...)"
3466 fi
3467 ;;
3468 esac
3469else
3470 case "$cppstdin" in
3471 '') ;;
3472 *)
3473 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3474 ;;
3475 esac
3476fi
3477
3478if $ok; then
3479 : nothing
3480elif echo 'Maybe "'"$cc"' -E" will work...'; \
3481 $cc -E <testcpp.c >testcpp.out 2>&1; \
3482 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3483 echo "Yup, it does."
3484 x_cpp="$cc -E"
3485 x_minus='';
3486elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3487 $cc -E - <testcpp.c >testcpp.out 2>&1; \
3488 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3489 echo "Yup, it does."
3490 x_cpp="$cc -E"
3491 x_minus='-';
3492elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3493 $cc -P <testcpp.c >testcpp.out 2>&1; \
3494 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3495 echo "Yipee, that works!"
3496 x_cpp="$cc -P"
3497 x_minus='';
3498elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3499 $cc -P - <testcpp.c >testcpp.out 2>&1; \
3500 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3501 echo "At long last!"
3502 x_cpp="$cc -P"
3503 x_minus='-';
3504elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3505 $cpp <testcpp.c >testcpp.out 2>&1; \
3506 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3507 echo "It works!"
3508 x_cpp="$cpp"
3509 x_minus='';
3510elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3511 $cpp - <testcpp.c >testcpp.out 2>&1; \
3512 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3513 echo "Hooray, it works! I was beginning to wonder."
3514 x_cpp="$cpp"
3515 x_minus='-';
3516elif echo 'Uh-uh. Time to get fancy. Trying a wrapper...'; \
3517 $wrapper <testcpp.c >testcpp.out 2>&1; \
3518 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3519 x_cpp="$wrapper"
3520 x_minus=''
3521 echo "Eureka!"
3522else
3523 dflt=''
3524 rp="No dice. I can't find a C preprocessor. Name one:"
3525 . ./myread
3526 x_cpp="$ans"
3527 x_minus=''
3528 $x_cpp <testcpp.c >testcpp.out 2>&1
3529 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3530 echo "OK, that will do." >&4
3531 else
3532echo "Sorry, I can't get that to work. Go find one and rerun Configure." >&4
3533 exit 1
3534 fi
3535fi
3536
3537case "$ok" in
3538false)
3539 cppstdin="$x_cpp"
3540 cppminus="$x_minus"
3541 cpprun="$x_cpp"
3542 cpplast="$x_minus"
3543 set X $x_cpp
3544 shift
3545 case "$1" in
3546 "$cpp")
3547 echo "Perhaps can we force $cc -E using a wrapper..."
3548 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3549 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3550 then
3551 echo "Yup, we can."
3552 cppstdin="$wrapper"
3553 cppminus='';
3554 else
3555 echo "Nope, we'll have to live without it..."
3556 fi
3557 ;;
3558 esac
3559 case "$cpprun" in
3560 "$wrapper")
3561 cpprun=''
3562 cpplast=''
3563 ;;
3564 esac
3565 ;;
3566esac
3567
3568case "$cppstdin" in
3569"$wrapper") ;;
3570*) $rm -f $wrapper;;
3571esac
3572$rm -f testcpp.c testcpp.out
3573
2afac517
PP
3574: Set private lib path
3575case "$plibpth" in
3576'') if ./mips; then
3577 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3578 fi;;
3579esac
3580case "$libpth" in
3581' ') dlist='';;
3582'') dlist="$loclibpth $plibpth $glibpth";;
3583*) dlist="$libpth";;
3584esac
8e07c86e 3585
2afac517
PP
3586: Now check and see which directories actually exist, avoiding duplicates
3587libpth=''
3588for xxx in $dlist
3589do
3590 if $test -d $xxx; then
3591 case " $libpth " in
3592 *" $xxx "*) ;;
3593 *) libpth="$libpth $xxx";;
3594 esac
3595 fi
3596done
3597$cat <<'EOM'
8e07c86e 3598
2afac517
PP
3599Some systems have incompatible or broken versions of libraries. Among
3600the directories listed in the question below, please remove any you
3601know not to be holding relevant libraries, and add any that are needed.
3602Say "none" for none.
8e07c86e 3603
8e07c86e 3604EOM
2afac517
PP
3605case "$libpth" in
3606'') dflt='none';;
3607*)
3608 set X $libpth
3609 shift
3610 dflt=${1+"$@"}
4633a7c4 3611 ;;
8e07c86e 3612esac
2afac517
PP
3613rp="Directories to use for library searches?"
3614. ./myread
3615case "$ans" in
3616none) libpth=' ';;
3617*) libpth="$ans";;
3618esac
8e07c86e 3619
2afac517
PP
3620: compute shared library extension
3621case "$so" in
3622'')
3623 if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3624 dflt='sl'
3625 else
3626 dflt='so'
3627 fi
3628 ;;
3629*) dflt="$so";;
8e07c86e 3630esac
2afac517 3631$cat <<EOM
8e07c86e 3632
2afac517
PP
3633On some systems, shared libraries may be available. Answer 'none' if
3634you want to suppress searching of shared libraries for the remaining
3635of this configuration.
8e07c86e
AD
3636
3637EOM
2afac517
PP
3638rp='What is the file extension used for shared libraries?'
3639. ./myread
3640so="$ans"
8e07c86e 3641
dfe9444c
AD
3642: Define several unixisms.
3643: Hints files or command line option can be used to override them.
3644: The convoluted testing is in case hints files set either the old
3645: or the new name.
3646case "$_exe" in
3647'') case "$exe_ext" in
3648 '') ;;
3649 *) _exe="$exe_ext" ;;
3650 esac
3651 ;;
3652esac
3653case "$_a" in
3654'') case "$lib_ext" in
3655 '') _a='.a';;
3656 *) _a="$lib_ext" ;;
3657 esac
3658 ;;
3659esac
3660case "$_o" in
3661'') case "$obj_ext" in
3662 '') _o='.o';;
3663 *) _o="$obj_ext";;
3664 esac
3665 ;;
3666esac
3667case "$p_" in
3668'') case "$path_sep" in
3669 '') p_=':';;
3670 *) p_="$path_sep";;
3671 esac
3672 ;;
3673esac
3674exe_ext=$_exe
3675lib_ext=$_a
3676obj_ext=$_o
3677path_sep=$p_
3678
3679: Which makefile gets called first. This is used by make depend.
3680case "$firstmakefile" in
3681'') firstmakefile='makefile';;
3682esac
3683
2afac517
PP
3684: Looking for optional libraries
3685echo " "
3686echo "Checking for optional libraries..." >&4
3687case "$libs" in
3688' '|'') dflt='';;
3689*) dflt="$libs";;
8e07c86e 3690esac
2afac517
PP
3691case "$libswanted" in
3692'') libswanted='c_s';;
3693esac
3694for thislib in $libswanted; do
3695
3696 if xxx=`./loc lib$thislib.$so.[0-9]'*' X $libpth`; $test -f "$xxx"; then
3697 echo "Found -l$thislib (shared)."
3698 case " $dflt " in
3699 *"-l$thislib "*);;
3700 *) dflt="$dflt -l$thislib";;
4633a7c4 3701 esac
2afac517
PP
3702 elif xxx=`./loc lib$thislib.$so X $libpth` ; $test -f "$xxx"; then
3703 echo "Found -l$thislib (shared)."
3704 case " $dflt " in
3705 *"-l$thislib "*);;
3706 *) dflt="$dflt -l$thislib";;
3707 esac
dfe9444c 3708 elif xxx=`./loc lib$thislib$_a X $libpth`; $test -f "$xxx"; then
2afac517
PP
3709 echo "Found -l$thislib."
3710 case " $dflt " in
3711 *"-l$thislib "*);;
3712 *) dflt="$dflt -l$thislib";;
3713 esac
dfe9444c 3714 elif xxx=`./loc $thislib$_a X $libpth`; $test -f "$xxx"; then
2afac517
PP
3715 echo "Found -l$thislib."
3716 case " $dflt " in
3717 *"-l$thislib "*);;
3718 *) dflt="$dflt -l$thislib";;
3719 esac
dfe9444c 3720 elif xxx=`./loc lib${thislib}_s$_a X $libpth`; $test -f "$xxx"; then
2afac517
PP
3721 echo "Found -l${thislib}_s."
3722 case " $dflt " in
3723 *"-l$thislib "*);;
3724 *) dflt="$dflt -l${thislib}_s";;
3725 esac
dfe9444c 3726 elif xxx=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$xxx"; then
2afac517
PP
3727 echo "Found -l$thislib."
3728 case " $dflt " in
3729 *"-l$thislib "*);;
3730 *) dflt="$dflt -l$thislib";;
3731 esac
3732 else
3733 echo "No -l$thislib."
3734 fi
3735done
3736set X $dflt
3737shift
3738dflt="$*"
3739case "$libs" in
3740'') dflt="$dflt";;
3741*) dflt="$libs";;
3742esac
3743case "$dflt" in
3744' '|'') dflt='none';;
8e07c86e 3745esac
2afac517 3746
4633a7c4
LW
3747$cat <<EOM
3748
2afac517
PP
3749Some versions of Unix support shared libraries, which make executables smaller
3750but make load time slightly longer.
8e07c86e 3751
2afac517
PP
3752On some systems, mostly System V Release 3's, the shared library is included
3753by putting the option "-lc_s" as the last thing on the cc command line when
3754linking. Other systems use shared libraries by default. There may be other
3755libraries needed to compile $package on your machine as well. If your system
3756needs the "-lc_s" option, include it here. Include any other special libraries
3757here as well. Say "none" for none.
4633a7c4 3758EOM
2afac517
PP
3759
3760echo " "
3761rp="Any additional libraries?"
8e07c86e 3762. ./myread
2afac517
PP
3763case "$ans" in
3764none) libs=' ';;
3765*) libs="$ans";;
3766esac
8e07c86e 3767
2afac517
PP
3768: determine optimize, if desired, or use for debug flag also
3769case "$optimize" in
2ae324a7 3770' '|$undef) dflt='none';;
2afac517
PP
3771'') dflt='-O';;
3772*) dflt="$optimize";;
4633a7c4 3773esac
2afac517 3774$cat <<EOH
4633a7c4 3775
760ac839 3776Some C compilers have problems with their optimizers. By default, $package
4633a7c4
LW
3777compiles with the -O flag to use the optimizer. Alternately, you might want
3778to use the symbolic debugger, which uses the -g flag (on traditional Unix
3779systems). Either flag can be specified here. To use neither flag, specify
3780the word "none".
3781
3782EOH
3783rp="What optimizer/debugger flag should be used?"
3784. ./myread
3785optimize="$ans"
3786case "$optimize" in
3787'none') optimize=" ";;
3788esac
3789
3790dflt=''
25f94b33
AD
3791: We will not override a previous value, but we might want to
3792: augment a hint file
3793case "$hint" in
3794none|recommended)
4633a7c4
LW
3795 case "$gccversion" in
3796 1*) dflt='-fpcc-struct-return' ;;
3797 esac
3798 case "$optimize" in
3799 *-g*) dflt="$dflt -DDEBUGGING";;
3800 esac
3801 case "$gccversion" in
3802 2*) if test -d /etc/conf/kconfig.d &&
3803 $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
3804 then
3805 dflt="$dflt -posix"
3806 fi
3807 ;;
3808 esac
3809 ;;
3810esac
3811
a4f3eea9
PP
3812case "$mips_type" in
3813*BSD*|'') inclwanted="$locincpth $usrinc";;
3814*) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
3815esac
3816for thisincl in $inclwanted; do
3817 if $test -d $thisincl; then
3818 if $test x$thisincl != x$usrinc; then
3819 case "$dflt" in
3820 *$thisincl*);;
3821 *) dflt="$dflt -I$thisincl";;
3822 esac
3823 fi
3824 fi
3825done
3826
3827inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
3828 xxx=true;
3829elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
3830 xxx=true;
3831else
3832 xxx=false;
3833fi;
3834if $xxx; then
3835 case "$dflt" in
3836 *$2*);;
3837 *) dflt="$dflt -D$2";;
3838 esac;
3839fi'
3840
3841if ./osf1; then
3842 set signal.h __LANGUAGE_C__; eval $inctest
3843else
3844 set signal.h LANGUAGE_C; eval $inctest
3845fi
a4f3eea9
PP
3846
3847case "$hint" in
3848none|recommended) dflt="$ccflags $dflt" ;;
3849*) dflt="$ccflags";;
3850esac
3851
3852case "$dflt" in
3853''|' ') dflt=none;;
3854esac
3855$cat <<EOH
3856
3857Your C compiler may want other flags. For this question you should include
3858-I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
3859but you should NOT include libraries or ld flags like -lwhatever. If you
3860want $package to honor its debug switch, you should include -DDEBUGGING here.
dfe9444c 3861Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
a4f3eea9
PP
3862
3863To use no flags, specify the word "none".
3864
3865EOH
3866set X $dflt
3867shift
3868dflt=${1+"$@"}
3869rp="Any additional cc flags?"
3870. ./myread
3871case "$ans" in
3872none) ccflags='';;
3873*) ccflags="$ans";;
3874esac
3875
3876: the following weeds options from ccflags that are of no interest to cpp
3877cppflags="$ccflags"
3878case "$gccversion" in
38791*) cppflags="$cppflags -D__GNUC__"
3880esac
3881case "$mips_type" in
3882'');;
3883*BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
3884esac
3885case "$cppflags" in
3886'');;
3887*)
3888 echo " "
3889 echo "Let me guess what the preprocessor flags are..." >&4
3890 set X $cppflags
3891 shift
3892 cppflags=''
3893 $cat >cpp.c <<'EOM'
3894#define BLURFL foo
3895
3896BLURFL xx LFRULB
3897EOM
3898 previous=''
3899 for flag in $*
3900 do
3901 case "$flag" in
3902 -*) ftry="$flag";;
3903 *) ftry="$previous $flag";;
3904 esac
7bac28a0 3905 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
a4f3eea9 3906 >cpp1.out 2>/dev/null && \
dfe9444c 3907 $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
a4f3eea9
PP
3908 >cpp2.out 2>/dev/null && \
3909 $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
3910 $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
3911 then
3912 cppflags="$cppflags $ftry"
3913 previous=''
3914 else
3915 previous="$flag"
3916 fi
3917 done
3918 set X $cppflags
3919 shift
3920 cppflags=${1+"$@"}
3921 case "$cppflags" in
3922 *-*) echo "They appear to be: $cppflags";;
3923 esac
3924 $rm -f cpp.c cpp?.out
3925 ;;
3926esac
3927
3928: flags used in final linking phase
a4f3eea9
PP
3929case "$ldflags" in
3930'') if ./venix; then
3931 dflt='-i -z'
3932 else
3933 dflt=''
3934 fi
3935 case "$ccflags" in
3936 *-posix*) dflt="$dflt -posix" ;;
3937 esac
3938 ;;
3939*) dflt="$ldflags";;
3940esac
3941
3942: Try to guess additional flags to pick up local libraries.
3943for thislibdir in $libpth; do
3944 case " $loclibpth " in
3945 *" $thislibdir "*)
3946 case "$dflt " in
3947 *"-L$thislibdir "*) ;;
3948 *) dflt="$dflt -L$thislibdir" ;;
3949 esac
3950 ;;
3951 esac
3952done
3953
3954case "$dflt" in
3955'') dflt='none' ;;
3956esac
3957
3958$cat <<EOH
3959
3960Your C linker may need flags. For this question you should
3961include -L/whatever and any other flags used by the C linker, but you
3962should NOT include libraries like -lwhatever.
3963
3964Make sure you include the appropriate -L/path flags if your C linker
3965does not normally search all of the directories you specified above,
3966namely
3967 $libpth
3968To use no flags, specify the word "none".
3969
3970EOH
3971
3972rp="Any additional ld flags (NOT including libraries)?"
3973. ./myread
3974case "$ans" in
3975none) ldflags='';;
3976*) ldflags="$ans";;
3977esac
3978rmlist="$rmlist pdp11"
3979
3980: coherency check
3981echo " "
dfe9444c 3982echo "Checking your choice of C compiler and flags for coherency..." >&4
87563a30 3983set X $cc $optimize $ccflags -o try $ldflags try.c $libs
a4f3eea9
PP
3984shift
3985$cat >try.msg <<EOM
3986I've tried to compile and run a simple program with:
3987
3988 $*
3989 ./try
3990
3991and I got the following output:
3992
3993EOM
3994$cat > try.c <<'EOF'
3995#include <stdio.h>
dfe9444c 3996main() { printf("Ok\n"); exit(0); }
a4f3eea9
PP
3997EOF
3998dflt=y
28e8609d 3999if sh -c "$cc $optimize $ccflags -o try $ldflags try.c $libs" >>try.msg 2>&1; then
a4f3eea9 4000 if sh -c './try' >>try.msg 2>&1; then
dfe9444c
AD
4001 xxx=`./try`
4002 case "$xxx" in
4003 "Ok") dflt=n ;;
4004 *) echo 'The program compiled OK, but produced no output.' >> try.msg
4005 case " $libs " in
4006 *" -lsfio "*)
4007 cat >> try.msg <<'EOQS'
4008If $libs contains -lsfio, and sfio is mis-configured, then it
4009sometimes (apparently) runs and exits with a 0 status, but with no
4010output! It may have to do with sfio's use of _exit vs. exit.
4011
4012EOQS
4013 rp="You have a big problem. Shall I abort Configure"
4014 dflt=y
4015 ;;
4016 esac
4017 ;;
4018 esac
a4f3eea9
PP
4019 else
4020 echo "The program compiled OK, but exited with status $?." >>try.msg
dfe9444c 4021 rp="You have a problem. Shall I abort Configure"
a4f3eea9
PP
4022 dflt=y
4023 fi
4024else
4025 echo "I can't compile the test program." >>try.msg
dfe9444c 4026 rp="You have a BIG problem. Shall I abort Configure"
a4f3eea9
PP
4027 dflt=y
4028fi
4029case "$dflt" in
4030y)
97286747 4031 $cat try.msg >&4
a4f3eea9
PP
4032 case "$knowitall" in
4033 '')
4034 echo "(The supplied flags might be incorrect with this C compiler.)"
4035 ;;
4036 *) dflt=n;;
4037 esac
4038 echo " "
4039 . ./myread
4040 case "$ans" in
4041 n*|N*) ;;
4042 *) echo "Ok. Stopping Configure." >&4