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