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