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