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